diff --git a/.fern/metadata.json b/.fern/metadata.json index a66ea1e..5537d0e 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "8cfe954dda14329fc30a4f80b915db0acf608382", + "originGitCommit": "1ab5d36abb4de887dde605f8b82a71dce464a26b", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.5.5", + "requestedVersion": "1.5.6", "ciProvider": "github", - "sdkVersion": "1.5.5" + "sdkVersion": "1.5.6" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock index 8683d29..dc4a2c1 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -36,5 +36,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.11.1 -current_generation: d154934d6a2afaf450896d2bbc575fdd061e1562 + - commit_sha: 9ef584d5a4b3d7cf1b53e9667a766da9dce2ce09 + tree_hash: 5e10be6e608058c4c816f6945f82b8d21194cc51 + timestamp: 2026-08-17T10:13:16.774Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.11.1 +current_generation: 9ef584d5a4b3d7cf1b53e9667a766da9dce2ce09 patches: [] diff --git a/build.gradle b/build.gradle index 71faae1..0a98126 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ java { group = 'com.schematichq' -version = '1.5.5' +version = '1.5.6' jar { dependsOn(":generatePomFileForMavenPublication") @@ -93,7 +93,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.5.5' + version = '1.5.6' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index cef993c..38875f7 100644 --- a/reference.md +++ b/reference.md @@ -1095,6 +1095,99 @@ client.accounts().deleteEnvironment("environment_id"); + + + + +
client.accounts.getOnboardingState() -> GetOnboardingStateResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().getOnboardingState(); +``` +
+
+
+
+ + +
+
+
+ +
client.accounts.updateOnboardingState(request) -> UpdateOnboardingStateResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().updateOnboardingState( + UpdateOnboardingStateRequestBody + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**path:** `Optional` + +
+
+ +
+
+ +**pricingPageUrl:** `Optional` + +
+
+ +
+
+ +**track:** `Optional` + +
+
+ +
+
+ +**websiteUrl:** `Optional` + +
+
+
+
+ +
@@ -4302,6 +4395,14 @@ client.credits().createCreditBundle(
+**compatiblePlanIds:** `Optional>` — Plans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan. + +
+
+ +
+
+ **creditId:** `String`
@@ -4477,6 +4578,14 @@ client.credits().updateCreditBundleDetails(
+**compatiblePlanIds:** `Optional>` — Plans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan. + +
+
+ +
+
+ **currencyPrices:** `Optional>`
@@ -9182,6 +9291,86 @@ client.companies().updateEntityTraitDefinition(
+ +
+ + +
client.companies.deleteEntityTraitDefinition(entityTraitDefinitionId) -> DeleteEntityTraitDefinitionResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().deleteEntityTraitDefinition("entity_trait_definition_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**entityTraitDefinitionId:** `String` — entity_trait_definition_id + +
+
+
+
+ + +
+
+
+ +
client.companies.getEntityTraitDefinitionUsage(entityTraitDefinitionId) -> GetEntityTraitDefinitionUsageResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().getEntityTraitDefinitionUsage("entity_trait_definition_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**entityTraitDefinitionId:** `String` — entity_trait_definition_id + +
+
+
+
+ +
@@ -9357,6 +9546,78 @@ client.companies().getEntityTraitValues( + + + + +
client.companies.countEntityTraits() -> CountEntityTraitsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().countEntityTraits( + CountEntityTraitsRequest + .builder() + .definitionId("definition_id") + .entityType(EntityType.COMPANY) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**definitionId:** `Optional` + +
+
+ +
+
+ +**entityType:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ +
@@ -9380,9 +9641,6 @@ client.companies().listPlanChanges( .companyIds( Arrays.asList("company_ids") ) - .planIds( - Arrays.asList("plan_ids") - ) .action(PlanChangeAction.CHECKOUT) .basePlanAction(PlanChangeBasePlanAction.FALLBACK) .companyId("company_id") @@ -9436,14 +9694,6 @@ client.companies().listPlanChanges(
-**planIds:** `Optional` - -
-
- -
-
- **limit:** `Optional` — Page limit (default 100)
@@ -13054,7 +13304,7 @@ client.entitlements().getUserUsageDetail( ## plans -
client.plans.updateCompanyPlans(companyPlanId, request) -> UpdateCompanyPlansResponse +
client.plans.updateCompanyPlans(companyId, request) -> UpdateCompanyPlansResponse
@@ -13068,7 +13318,7 @@ client.entitlements().getUserUsageDetail( ```java client.plans().updateCompanyPlans( - "company_plan_id", + "company_id", UpdateCompanyPlansRequestBody .builder() .addOnIds( @@ -13090,7 +13340,7 @@ client.plans().updateCompanyPlans(
-**companyPlanId:** `String` — company_plan_id +**companyId:** `String` — company_id
@@ -13139,6 +13389,7 @@ client.plans().listCustomPlanBillings( ) .companyId("company_id") .planId("plan_id") + .planBillingSource(PlanBillingSource.CUSTOM_PLAN) .status(CustomPlanBillingStatus.ACTIVE) .limit(1000000L) .offset(1000000L) @@ -13174,6 +13425,14 @@ client.plans().listCustomPlanBillings(
+**planBillingSource:** `Optional` — Filter by the flow that created the billing record. Defaults to custom_plan. + +
+
+ +
+
+ **status:** `Optional` — Filter by billing status
@@ -14347,7 +14606,7 @@ client.plans().listPlanIssues(
-
client.plans.deletePlanVersion(planId) -> DeletePlanVersionResponse +
client.plans.deletePlanVersion(planVersionId) -> DeletePlanVersionResponse
@@ -14361,7 +14620,7 @@ client.plans().listPlanIssues( ```java client.plans().deletePlanVersion( - "plan_id", + "plan_version_id", DeletePlanVersionRequest .builder() .promoteArchivedVersion(true) @@ -14381,7 +14640,7 @@ client.plans().deletePlanVersion(
-**planId:** `String` — plan_id +**planVersionId:** `String` — plan_version_id
@@ -14401,7 +14660,7 @@ client.plans().deletePlanVersion(
-
client.plans.publishPlanVersion(planId, request) -> PublishPlanVersionResponse +
client.plans.publishPlanVersion(planVersionId, request) -> PublishPlanVersionResponse
@@ -14415,7 +14674,7 @@ client.plans().deletePlanVersion( ```java client.plans().publishPlanVersion( - "plan_id", + "plan_version_id", PublishPlanVersionRequestBody .builder() .migrationStrategy(PlanVersionMigrationStrategy.IMMEDIATE) @@ -14438,7 +14697,7 @@ client.plans().publishPlanVersion(
-**planId:** `String` — plan_id +**planVersionId:** `String` — plan_version_id
@@ -14518,6 +14777,14 @@ client.plans().publishPlanVersion(
+**prorationBehavior:** `Optional` + +
+
+ +
+
+ **sendInvoice:** `Optional` — Whether Stripe emails the invoice when it is finalized. Defaults to true.
@@ -15144,7 +15411,7 @@ client.planbundle().createPlanBundle(
-
client.planbundle.updatePlanBundle(planBundleId, request) -> UpdatePlanBundleResponse +
client.planbundle.updatePlanBundle(planId, request) -> UpdatePlanBundleResponse
@@ -15158,7 +15425,7 @@ client.planbundle().createPlanBundle( ```java client.planbundle().updatePlanBundle( - "plan_bundle_id", + "plan_id", UpdatePlanBundleRequestBody .builder() .entitlements( @@ -15185,7 +15452,7 @@ client.planbundle().updatePlanBundle(
-**planBundleId:** `String` — plan_bundle_id +**planId:** `String` — plan_id
@@ -18179,9 +18446,11 @@ client.plangroups().getPlanGroup( client.plangroups().createPlanGroup( CreatePlanGroupRequestBody .builder() + .checkoutBundlePurchaseBehavior(CheckoutBundlePurchaseBehavior.INDIVIDUAL) .checkoutCollectAddress(true) .checkoutCollectEmail(true) .checkoutCollectPhone(true) + .checkoutCollectTaxId(true) .enableTaxCollection(true) .optInEnabled(true) .preventDowngradesWhenOverLimit(true) @@ -18253,6 +18522,14 @@ client.plangroups().createPlanGroup(
+**checkoutBundlePurchaseBehavior:** `CheckoutBundlePurchaseBehavior` + +
+
+ +
+
+ **checkoutCollectAddress:** `Boolean`
@@ -18277,6 +18554,14 @@ client.plangroups().createPlanGroup(
+**checkoutCollectTaxId:** `Boolean` + +
+
+ +
+
+ **customCheckoutFields:** `Optional>`
@@ -18546,9 +18831,11 @@ client.plangroups().updatePlanGroup( "plan_group_id", UpdatePlanGroupRequestBody .builder() + .checkoutBundlePurchaseBehavior(CheckoutBundlePurchaseBehavior.INDIVIDUAL) .checkoutCollectAddress(true) .checkoutCollectEmail(true) .checkoutCollectPhone(true) + .checkoutCollectTaxId(true) .enableTaxCollection(true) .optInEnabled(true) .preventDowngradesWhenOverLimit(true) @@ -18628,6 +18915,14 @@ client.plangroups().updatePlanGroup(
+**checkoutBundlePurchaseBehavior:** `CheckoutBundlePurchaseBehavior` + +
+
+ +
+
+ **checkoutCollectAddress:** `Boolean`
@@ -18652,6 +18947,14 @@ client.plangroups().updatePlanGroup(
+**checkoutCollectTaxId:** `Boolean` + +
+
+ +
+
+ **customCheckoutFields:** `Optional>`
@@ -19199,15 +19502,6 @@ client.planmigrations().createMigration( .planVersionIdTo("plan_version_id_to") .strategy(PlanVersionMigrationStrategy.IMMEDIATE) .targetPlanType(PlanType.PLAN) - .companyIds( - Arrays.asList("company_ids") - ) - .excludedCompanyIds( - Arrays.asList("excluded_company_ids") - ) - .planVersionIdsFrom( - Arrays.asList("plan_version_ids_from") - ) .build() ); ``` @@ -19224,7 +19518,7 @@ client.planmigrations().createMigration(
-**companyIds:** `List` +**companyIds:** `Optional>`
@@ -19232,7 +19526,7 @@ client.planmigrations().createMigration(
-**excludedCompanyIds:** `List` +**excludedCompanyIds:** `Optional>`
@@ -19256,7 +19550,15 @@ client.planmigrations().createMigration(
-**planVersionIdsFrom:** `List` +**planVersionIdsFrom:** `Optional>` + +
+
+ +
+
+ +**prorationBehavior:** `Optional`
@@ -19471,9 +19773,6 @@ client.planmigrations().previewMigration( .planId("plan_id") .planVersionIdTo("plan_version_id_to") .targetPlanType(PlanType.PLAN) - .companyIds( - Arrays.asList("company_ids") - ) .build() ); ``` @@ -19490,7 +19789,7 @@ client.planmigrations().previewMigration(
-**companyIds:** `List` +**companyIds:** `Optional>`
@@ -19514,6 +19813,14 @@ client.planmigrations().previewMigration(
+**planVersionIdsFrom:** `Optional>` + +
+
+ +
+
+ **targetPlanType:** `PlanType`
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index 0873c62..63ecbd4 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.5"); + put("User-Agent", "com.schematichq:schematic-java/1.5.6"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.5.5"); + put("X-Fern-SDK-Version", "1.5.6"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java index 3719aa9..f62983b 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java @@ -16,6 +16,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.requests.UpdateOnboardingStateRequestBody; import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; @@ -27,6 +28,7 @@ import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; +import com.schematic.api.resources.accounts.types.GetOnboardingStateResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; @@ -35,6 +37,7 @@ import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; +import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; public class AccountsClient { protected final ClientOptions clientOptions; @@ -252,6 +255,31 @@ public DeleteEnvironmentResponse deleteEnvironment(String environmentId, Request return this.rawClient.deleteEnvironment(environmentId, requestOptions).body(); } + public GetOnboardingStateResponse getOnboardingState() { + return this.rawClient.getOnboardingState().body(); + } + + public GetOnboardingStateResponse getOnboardingState(RequestOptions requestOptions) { + return this.rawClient.getOnboardingState(requestOptions).body(); + } + + public UpdateOnboardingStateResponse updateOnboardingState() { + return this.rawClient.updateOnboardingState().body(); + } + + public UpdateOnboardingStateResponse updateOnboardingState(RequestOptions requestOptions) { + return this.rawClient.updateOnboardingState(requestOptions).body(); + } + + public UpdateOnboardingStateResponse updateOnboardingState(UpdateOnboardingStateRequestBody request) { + return this.rawClient.updateOnboardingState(request).body(); + } + + public UpdateOnboardingStateResponse updateOnboardingState( + UpdateOnboardingStateRequestBody request, RequestOptions requestOptions) { + return this.rawClient.updateOnboardingState(request, requestOptions).body(); + } + public QuickstartResponse quickstart() { return this.rawClient.quickstart().body(); } diff --git a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java index 3a5326b..306f5ce 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java @@ -16,6 +16,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.requests.UpdateOnboardingStateRequestBody; import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; @@ -27,6 +28,7 @@ import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; +import com.schematic.api.resources.accounts.types.GetOnboardingStateResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; @@ -35,6 +37,7 @@ import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; +import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; import java.util.concurrent.CompletableFuture; public class AsyncAccountsClient { @@ -264,6 +267,32 @@ public CompletableFuture deleteEnvironment( return this.rawClient.deleteEnvironment(environmentId, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture getOnboardingState() { + return this.rawClient.getOnboardingState().thenApply(response -> response.body()); + } + + public CompletableFuture getOnboardingState(RequestOptions requestOptions) { + return this.rawClient.getOnboardingState(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateOnboardingState() { + return this.rawClient.updateOnboardingState().thenApply(response -> response.body()); + } + + public CompletableFuture updateOnboardingState(RequestOptions requestOptions) { + return this.rawClient.updateOnboardingState(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateOnboardingState( + UpdateOnboardingStateRequestBody request) { + return this.rawClient.updateOnboardingState(request).thenApply(response -> response.body()); + } + + public CompletableFuture updateOnboardingState( + UpdateOnboardingStateRequestBody request, RequestOptions requestOptions) { + return this.rawClient.updateOnboardingState(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture quickstart() { return this.rawClient.quickstart().thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java index a0ed741..c0d7b67 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java @@ -29,6 +29,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.requests.UpdateOnboardingStateRequestBody; import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; @@ -40,6 +41,7 @@ import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; +import com.schematic.api.resources.accounts.types.GetOnboardingStateResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; @@ -48,6 +50,7 @@ import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; +import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -1931,6 +1934,213 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> getOnboardingState() { + return getOnboardingState(null); + } + + public CompletableFuture> getOnboardingState( + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("onboarding-state"); + 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, GetOnboardingStateResponse.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> updateOnboardingState() { + return updateOnboardingState(UpdateOnboardingStateRequestBody.builder().build()); + } + + public CompletableFuture> updateOnboardingState( + RequestOptions requestOptions) { + return updateOnboardingState(UpdateOnboardingStateRequestBody.builder().build(), requestOptions); + } + + public CompletableFuture> updateOnboardingState( + UpdateOnboardingStateRequestBody request) { + return updateOnboardingState(request, null); + } + + public CompletableFuture> updateOnboardingState( + UpdateOnboardingStateRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("onboarding-state"); + 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, UpdateOnboardingStateResponse.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> quickstart() { return quickstart(null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java index 5f46f46..871952c 100644 --- a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java @@ -29,6 +29,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.requests.UpdateOnboardingStateRequestBody; import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; @@ -40,6 +41,7 @@ import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; +import com.schematic.api.resources.accounts.types.GetOnboardingStateResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; @@ -48,6 +50,7 @@ import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; +import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import okhttp3.Headers; @@ -1499,6 +1502,164 @@ public BaseSchematicHttpResponse deleteEnvironment( } } + public BaseSchematicHttpResponse getOnboardingState() { + return getOnboardingState(null); + } + + public BaseSchematicHttpResponse getOnboardingState(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("onboarding-state"); + 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, GetOnboardingStateResponse.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 updateOnboardingState() { + return updateOnboardingState(UpdateOnboardingStateRequestBody.builder().build()); + } + + public BaseSchematicHttpResponse updateOnboardingState( + RequestOptions requestOptions) { + return updateOnboardingState(UpdateOnboardingStateRequestBody.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse updateOnboardingState( + UpdateOnboardingStateRequestBody request) { + return updateOnboardingState(request, null); + } + + public BaseSchematicHttpResponse updateOnboardingState( + UpdateOnboardingStateRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("onboarding-state"); + 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, UpdateOnboardingStateResponse.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 quickstart() { return quickstart(null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateOnboardingStateRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateOnboardingStateRequestBody.java new file mode 100644 index 0000000..d4db49c --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateOnboardingStateRequestBody.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.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.OnboardingPath; +import com.schematic.api.types.OnboardingTrack; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOnboardingStateRequestBody.Builder.class) +public final class UpdateOnboardingStateRequestBody { + private final Optional path; + + private final Optional pricingPageUrl; + + private final Optional track; + + private final Optional websiteUrl; + + private final Map additionalProperties; + + private UpdateOnboardingStateRequestBody( + Optional path, + Optional pricingPageUrl, + Optional track, + Optional websiteUrl, + Map additionalProperties) { + this.path = path; + this.pricingPageUrl = pricingPageUrl; + this.track = track; + this.websiteUrl = websiteUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("path") + public Optional getPath() { + return path; + } + + @JsonProperty("pricing_page_url") + public Optional getPricingPageUrl() { + return pricingPageUrl; + } + + @JsonProperty("track") + public Optional getTrack() { + return track; + } + + @JsonProperty("website_url") + public Optional getWebsiteUrl() { + return websiteUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOnboardingStateRequestBody && equalTo((UpdateOnboardingStateRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOnboardingStateRequestBody other) { + return path.equals(other.path) + && pricingPageUrl.equals(other.pricingPageUrl) + && track.equals(other.track) + && websiteUrl.equals(other.websiteUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.path, this.pricingPageUrl, this.track, this.websiteUrl); + } + + @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 path = Optional.empty(); + + private Optional pricingPageUrl = Optional.empty(); + + private Optional track = Optional.empty(); + + private Optional websiteUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateOnboardingStateRequestBody other) { + path(other.getPath()); + pricingPageUrl(other.getPricingPageUrl()); + track(other.getTrack()); + websiteUrl(other.getWebsiteUrl()); + return this; + } + + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public Builder path(Optional path) { + this.path = path; + return this; + } + + public Builder path(OnboardingPath path) { + this.path = Optional.ofNullable(path); + return this; + } + + @JsonSetter(value = "pricing_page_url", nulls = Nulls.SKIP) + public Builder pricingPageUrl(Optional pricingPageUrl) { + this.pricingPageUrl = pricingPageUrl; + return this; + } + + public Builder pricingPageUrl(String pricingPageUrl) { + this.pricingPageUrl = Optional.ofNullable(pricingPageUrl); + return this; + } + + @JsonSetter(value = "track", nulls = Nulls.SKIP) + public Builder track(Optional track) { + this.track = track; + return this; + } + + public Builder track(OnboardingTrack track) { + this.track = Optional.ofNullable(track); + return this; + } + + @JsonSetter(value = "website_url", nulls = Nulls.SKIP) + public Builder websiteUrl(Optional websiteUrl) { + this.websiteUrl = websiteUrl; + return this; + } + + public Builder websiteUrl(String websiteUrl) { + this.websiteUrl = Optional.ofNullable(websiteUrl); + return this; + } + + public UpdateOnboardingStateRequestBody build() { + return new UpdateOnboardingStateRequestBody(path, pricingPageUrl, track, websiteUrl, 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/accounts/types/GetOnboardingStateResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetOnboardingStateResponse.java new file mode 100644 index 0000000..f7641a7 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetOnboardingStateResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.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.GetOnboardingStateResp; +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 = GetOnboardingStateResponse.Builder.class) +public final class GetOnboardingStateResponse { + private final GetOnboardingStateResp data; + + private final Map params; + + private final Map additionalProperties; + + private GetOnboardingStateResponse( + GetOnboardingStateResp data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public GetOnboardingStateResp 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 GetOnboardingStateResponse && equalTo((GetOnboardingStateResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetOnboardingStateResponse 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 GetOnboardingStateResp data); + + Builder from(GetOnboardingStateResponse other); + } + + public interface _FinalStage { + GetOnboardingStateResponse 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 GetOnboardingStateResp data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetOnboardingStateResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull GetOnboardingStateResp 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 GetOnboardingStateResponse build() { + return new GetOnboardingStateResponse(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/accounts/types/UpdateOnboardingStateResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/UpdateOnboardingStateResponse.java new file mode 100644 index 0000000..e10f76e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/UpdateOnboardingStateResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.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.GetOnboardingStateResp; +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 = UpdateOnboardingStateResponse.Builder.class) +public final class UpdateOnboardingStateResponse { + private final GetOnboardingStateResp data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateOnboardingStateResponse( + GetOnboardingStateResp data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public GetOnboardingStateResp 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 UpdateOnboardingStateResponse && equalTo((UpdateOnboardingStateResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOnboardingStateResponse 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 GetOnboardingStateResp data); + + Builder from(UpdateOnboardingStateResponse other); + } + + public interface _FinalStage { + UpdateOnboardingStateResponse 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 GetOnboardingStateResp data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateOnboardingStateResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull GetOnboardingStateResp 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 UpdateOnboardingStateResponse build() { + return new UpdateOnboardingStateResponse(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/companies/AsyncCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java index 8e49990..720d24e 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java @@ -9,6 +9,7 @@ import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityKeysRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; +import com.schematic.api.resources.companies.requests.CountEntityTraitsRequest; import com.schematic.api.resources.companies.requests.CountPlanTraitsRequest; import com.schematic.api.resources.companies.requests.CountUsersRequest; import com.schematic.api.resources.companies.requests.CreateEntityTraitDefinitionRequestBody; @@ -33,6 +34,7 @@ import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityKeysResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; +import com.schematic.api.resources.companies.types.CountEntityTraitsResponse; import com.schematic.api.resources.companies.types.CountPlanTraitsResponse; import com.schematic.api.resources.companies.types.CountUsersResponse; import com.schematic.api.resources.companies.types.CreateCompanyResponse; @@ -41,6 +43,7 @@ import com.schematic.api.resources.companies.types.DeleteCompanyMembershipResponse; import com.schematic.api.resources.companies.types.DeleteCompanyResponse; import com.schematic.api.resources.companies.types.DeleteEntityKeyDefinitionResponse; +import com.schematic.api.resources.companies.types.DeleteEntityTraitDefinitionResponse; import com.schematic.api.resources.companies.types.DeleteUserByKeysResponse; import com.schematic.api.resources.companies.types.DeleteUserResponse; import com.schematic.api.resources.companies.types.GetActiveCompanySubscriptionResponse; @@ -48,6 +51,7 @@ import com.schematic.api.resources.companies.types.GetCompanyBillingEntityResponse; import com.schematic.api.resources.companies.types.GetCompanyResponse; import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionResponse; +import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionUsageResponse; import com.schematic.api.resources.companies.types.GetEntityTraitValuesResponse; import com.schematic.api.resources.companies.types.GetOrCreateCompanyMembershipResponse; import com.schematic.api.resources.companies.types.GetOrCreateEntityTraitDefinitionResponse; @@ -442,6 +446,34 @@ public CompletableFuture updateEntityTraitD .thenApply(response -> response.body()); } + public CompletableFuture deleteEntityTraitDefinition( + String entityTraitDefinitionId) { + return this.rawClient + .deleteEntityTraitDefinition(entityTraitDefinitionId) + .thenApply(response -> response.body()); + } + + public CompletableFuture deleteEntityTraitDefinition( + String entityTraitDefinitionId, RequestOptions requestOptions) { + return this.rawClient + .deleteEntityTraitDefinition(entityTraitDefinitionId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture getEntityTraitDefinitionUsage( + String entityTraitDefinitionId) { + return this.rawClient + .getEntityTraitDefinitionUsage(entityTraitDefinitionId) + .thenApply(response -> response.body()); + } + + public CompletableFuture getEntityTraitDefinitionUsage( + String entityTraitDefinitionId, RequestOptions requestOptions) { + return this.rawClient + .getEntityTraitDefinitionUsage(entityTraitDefinitionId, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture countEntityTraitDefinitions() { return this.rawClient.countEntityTraitDefinitions().thenApply(response -> response.body()); } @@ -472,6 +504,23 @@ public CompletableFuture getEntityTraitValues( return this.rawClient.getEntityTraitValues(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture countEntityTraits() { + return this.rawClient.countEntityTraits().thenApply(response -> response.body()); + } + + public CompletableFuture countEntityTraits(RequestOptions requestOptions) { + return this.rawClient.countEntityTraits(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countEntityTraits(CountEntityTraitsRequest request) { + return this.rawClient.countEntityTraits(request).thenApply(response -> response.body()); + } + + public CompletableFuture countEntityTraits( + CountEntityTraitsRequest request, RequestOptions requestOptions) { + return this.rawClient.countEntityTraits(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listPlanChanges() { return this.rawClient.listPlanChanges().thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java index 294c557..918ac74 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -22,6 +22,7 @@ import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityKeysRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; +import com.schematic.api.resources.companies.requests.CountEntityTraitsRequest; import com.schematic.api.resources.companies.requests.CountPlanTraitsRequest; import com.schematic.api.resources.companies.requests.CountUsersRequest; import com.schematic.api.resources.companies.requests.CreateEntityTraitDefinitionRequestBody; @@ -46,6 +47,7 @@ import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityKeysResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; +import com.schematic.api.resources.companies.types.CountEntityTraitsResponse; import com.schematic.api.resources.companies.types.CountPlanTraitsResponse; import com.schematic.api.resources.companies.types.CountUsersResponse; import com.schematic.api.resources.companies.types.CreateCompanyResponse; @@ -54,6 +56,7 @@ import com.schematic.api.resources.companies.types.DeleteCompanyMembershipResponse; import com.schematic.api.resources.companies.types.DeleteCompanyResponse; import com.schematic.api.resources.companies.types.DeleteEntityKeyDefinitionResponse; +import com.schematic.api.resources.companies.types.DeleteEntityTraitDefinitionResponse; import com.schematic.api.resources.companies.types.DeleteUserByKeysResponse; import com.schematic.api.resources.companies.types.DeleteUserResponse; import com.schematic.api.resources.companies.types.GetActiveCompanySubscriptionResponse; @@ -61,6 +64,7 @@ import com.schematic.api.resources.companies.types.GetCompanyBillingEntityResponse; import com.schematic.api.resources.companies.types.GetCompanyResponse; import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionResponse; +import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionUsageResponse; import com.schematic.api.resources.companies.types.GetEntityTraitValuesResponse; import com.schematic.api.resources.companies.types.GetOrCreateCompanyMembershipResponse; import com.schematic.api.resources.companies.types.GetOrCreateEntityTraitDefinitionResponse; @@ -2882,6 +2886,202 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> + deleteEntityTraitDefinition(String entityTraitDefinitionId) { + return deleteEntityTraitDefinition(entityTraitDefinitionId, null); + } + + public CompletableFuture> + deleteEntityTraitDefinition(String entityTraitDefinitionId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entity-trait-definitions") + .addPathSegment(entityTraitDefinitionId); + 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, DeleteEntityTraitDefinitionResponse.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> + getEntityTraitDefinitionUsage(String entityTraitDefinitionId) { + return getEntityTraitDefinitionUsage(entityTraitDefinitionId, null); + } + + public CompletableFuture> + getEntityTraitDefinitionUsage(String entityTraitDefinitionId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entity-trait-definitions") + .addPathSegment(entityTraitDefinitionId) + .addPathSegments("usage"); + 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, GetEntityTraitDefinitionUsageResponse.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> countEntityTraitDefinitions() { return countEntityTraitDefinitions( @@ -3129,6 +3329,129 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> countEntityTraits() { + return countEntityTraits(CountEntityTraitsRequest.builder().build()); + } + + public CompletableFuture> countEntityTraits( + RequestOptions requestOptions) { + return countEntityTraits(CountEntityTraitsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> countEntityTraits( + CountEntityTraitsRequest request) { + return countEntityTraits(request, null); + } + + public CompletableFuture> countEntityTraits( + CountEntityTraitsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entity-traits/count"); + if (request.getDefinitionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "definition_id", request.getDefinitionId().get(), false); + } + if (request.getEntityType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "entity_type", request.getEntityType().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, CountEntityTraitsResponse.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> listPlanChanges() { return listPlanChanges(ListPlanChangesRequest.builder().build()); } @@ -3172,10 +3495,6 @@ public CompletableFuture> lis QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } - if (request.getPlanIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_ids", request.getPlanIds().get(), true); - } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java index 1b228e1..85fcf08 100644 --- a/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java @@ -9,6 +9,7 @@ import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityKeysRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; +import com.schematic.api.resources.companies.requests.CountEntityTraitsRequest; import com.schematic.api.resources.companies.requests.CountPlanTraitsRequest; import com.schematic.api.resources.companies.requests.CountUsersRequest; import com.schematic.api.resources.companies.requests.CreateEntityTraitDefinitionRequestBody; @@ -33,6 +34,7 @@ import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityKeysResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; +import com.schematic.api.resources.companies.types.CountEntityTraitsResponse; import com.schematic.api.resources.companies.types.CountPlanTraitsResponse; import com.schematic.api.resources.companies.types.CountUsersResponse; import com.schematic.api.resources.companies.types.CreateCompanyResponse; @@ -41,6 +43,7 @@ import com.schematic.api.resources.companies.types.DeleteCompanyMembershipResponse; import com.schematic.api.resources.companies.types.DeleteCompanyResponse; import com.schematic.api.resources.companies.types.DeleteEntityKeyDefinitionResponse; +import com.schematic.api.resources.companies.types.DeleteEntityTraitDefinitionResponse; import com.schematic.api.resources.companies.types.DeleteUserByKeysResponse; import com.schematic.api.resources.companies.types.DeleteUserResponse; import com.schematic.api.resources.companies.types.GetActiveCompanySubscriptionResponse; @@ -48,6 +51,7 @@ import com.schematic.api.resources.companies.types.GetCompanyBillingEntityResponse; import com.schematic.api.resources.companies.types.GetCompanyResponse; import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionResponse; +import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionUsageResponse; import com.schematic.api.resources.companies.types.GetEntityTraitValuesResponse; import com.schematic.api.resources.companies.types.GetOrCreateCompanyMembershipResponse; import com.schematic.api.resources.companies.types.GetOrCreateEntityTraitDefinitionResponse; @@ -424,6 +428,32 @@ public UpdateEntityTraitDefinitionResponse updateEntityTraitDefinition( .body(); } + public DeleteEntityTraitDefinitionResponse deleteEntityTraitDefinition(String entityTraitDefinitionId) { + return this.rawClient + .deleteEntityTraitDefinition(entityTraitDefinitionId) + .body(); + } + + public DeleteEntityTraitDefinitionResponse deleteEntityTraitDefinition( + String entityTraitDefinitionId, RequestOptions requestOptions) { + return this.rawClient + .deleteEntityTraitDefinition(entityTraitDefinitionId, requestOptions) + .body(); + } + + public GetEntityTraitDefinitionUsageResponse getEntityTraitDefinitionUsage(String entityTraitDefinitionId) { + return this.rawClient + .getEntityTraitDefinitionUsage(entityTraitDefinitionId) + .body(); + } + + public GetEntityTraitDefinitionUsageResponse getEntityTraitDefinitionUsage( + String entityTraitDefinitionId, RequestOptions requestOptions) { + return this.rawClient + .getEntityTraitDefinitionUsage(entityTraitDefinitionId, requestOptions) + .body(); + } + public CountEntityTraitDefinitionsResponse countEntityTraitDefinitions() { return this.rawClient.countEntityTraitDefinitions().body(); } @@ -452,6 +482,23 @@ public GetEntityTraitValuesResponse getEntityTraitValues( return this.rawClient.getEntityTraitValues(request, requestOptions).body(); } + public CountEntityTraitsResponse countEntityTraits() { + return this.rawClient.countEntityTraits().body(); + } + + public CountEntityTraitsResponse countEntityTraits(RequestOptions requestOptions) { + return this.rawClient.countEntityTraits(requestOptions).body(); + } + + public CountEntityTraitsResponse countEntityTraits(CountEntityTraitsRequest request) { + return this.rawClient.countEntityTraits(request).body(); + } + + public CountEntityTraitsResponse countEntityTraits( + CountEntityTraitsRequest request, RequestOptions requestOptions) { + return this.rawClient.countEntityTraits(request, requestOptions).body(); + } + public ListPlanChangesResponse listPlanChanges() { return this.rawClient.listPlanChanges().body(); } diff --git a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java index a1493cc..da74552 100644 --- a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java @@ -22,6 +22,7 @@ import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityKeysRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; +import com.schematic.api.resources.companies.requests.CountEntityTraitsRequest; import com.schematic.api.resources.companies.requests.CountPlanTraitsRequest; import com.schematic.api.resources.companies.requests.CountUsersRequest; import com.schematic.api.resources.companies.requests.CreateEntityTraitDefinitionRequestBody; @@ -46,6 +47,7 @@ import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityKeysResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; +import com.schematic.api.resources.companies.types.CountEntityTraitsResponse; import com.schematic.api.resources.companies.types.CountPlanTraitsResponse; import com.schematic.api.resources.companies.types.CountUsersResponse; import com.schematic.api.resources.companies.types.CreateCompanyResponse; @@ -54,6 +56,7 @@ import com.schematic.api.resources.companies.types.DeleteCompanyMembershipResponse; import com.schematic.api.resources.companies.types.DeleteCompanyResponse; import com.schematic.api.resources.companies.types.DeleteEntityKeyDefinitionResponse; +import com.schematic.api.resources.companies.types.DeleteEntityTraitDefinitionResponse; import com.schematic.api.resources.companies.types.DeleteUserByKeysResponse; import com.schematic.api.resources.companies.types.DeleteUserResponse; import com.schematic.api.resources.companies.types.GetActiveCompanySubscriptionResponse; @@ -61,6 +64,7 @@ import com.schematic.api.resources.companies.types.GetCompanyBillingEntityResponse; import com.schematic.api.resources.companies.types.GetCompanyResponse; import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionResponse; +import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionUsageResponse; import com.schematic.api.resources.companies.types.GetEntityTraitValuesResponse; import com.schematic.api.resources.companies.types.GetOrCreateCompanyMembershipResponse; import com.schematic.api.resources.companies.types.GetOrCreateEntityTraitDefinitionResponse; @@ -2287,6 +2291,154 @@ public BaseSchematicHttpResponse updateEnti } } + public BaseSchematicHttpResponse deleteEntityTraitDefinition( + String entityTraitDefinitionId) { + return deleteEntityTraitDefinition(entityTraitDefinitionId, null); + } + + public BaseSchematicHttpResponse deleteEntityTraitDefinition( + String entityTraitDefinitionId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entity-trait-definitions") + .addPathSegment(entityTraitDefinitionId); + 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, DeleteEntityTraitDefinitionResponse.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 getEntityTraitDefinitionUsage( + String entityTraitDefinitionId) { + return getEntityTraitDefinitionUsage(entityTraitDefinitionId, null); + } + + public BaseSchematicHttpResponse getEntityTraitDefinitionUsage( + String entityTraitDefinitionId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entity-trait-definitions") + .addPathSegment(entityTraitDefinitionId) + .addPathSegments("usage"); + 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, GetEntityTraitDefinitionUsageResponse.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 countEntityTraitDefinitions() { return countEntityTraitDefinitions( CountEntityTraitDefinitionsRequest.builder().build()); @@ -2483,6 +2635,102 @@ public BaseSchematicHttpResponse getEntityTraitVal } } + public BaseSchematicHttpResponse countEntityTraits() { + return countEntityTraits(CountEntityTraitsRequest.builder().build()); + } + + public BaseSchematicHttpResponse countEntityTraits(RequestOptions requestOptions) { + return countEntityTraits(CountEntityTraitsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse countEntityTraits(CountEntityTraitsRequest request) { + return countEntityTraits(request, null); + } + + public BaseSchematicHttpResponse countEntityTraits( + CountEntityTraitsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("entity-traits/count"); + if (request.getDefinitionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "definition_id", request.getDefinitionId().get(), false); + } + if (request.getEntityType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "entity_type", request.getEntityType().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, CountEntityTraitsResponse.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 listPlanChanges() { return listPlanChanges(ListPlanChangesRequest.builder().build()); } @@ -2524,10 +2772,6 @@ public BaseSchematicHttpResponse listPlanChanges( QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } - if (request.getPlanIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_ids", request.getPlanIds().get(), true); - } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitsRequest.java new file mode 100644 index 0000000..78ad740 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitsRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.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.EntityType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountEntityTraitsRequest.Builder.class) +public final class CountEntityTraitsRequest { + private final Optional definitionId; + + private final Optional entityType; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private CountEntityTraitsRequest( + Optional definitionId, + Optional entityType, + Optional limit, + Optional offset, + Map additionalProperties) { + this.definitionId = definitionId; + this.entityType = entityType; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("definition_id") + public Optional getDefinitionId() { + return definitionId; + } + + @JsonProperty("entity_type") + public Optional getEntityType() { + return entityType; + } + + /** + * @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 CountEntityTraitsRequest && equalTo((CountEntityTraitsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountEntityTraitsRequest other) { + return definitionId.equals(other.definitionId) + && entityType.equals(other.entityType) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.definitionId, this.entityType, 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 definitionId = Optional.empty(); + + private Optional entityType = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountEntityTraitsRequest other) { + definitionId(other.getDefinitionId()); + entityType(other.getEntityType()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @JsonSetter(value = "definition_id", nulls = Nulls.SKIP) + public Builder definitionId(Optional definitionId) { + this.definitionId = definitionId; + return this; + } + + public Builder definitionId(String definitionId) { + this.definitionId = Optional.ofNullable(definitionId); + return this; + } + + @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) + public Builder entityType(Optional entityType) { + this.entityType = entityType; + return this; + } + + public Builder entityType(EntityType entityType) { + this.entityType = Optional.ofNullable(entityType); + 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 CountEntityTraitsRequest build() { + return new CountEntityTraitsRequest(definitionId, entityType, 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/companies/requests/ListPlanChangesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java index aa3452c..194fc53 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java @@ -26,8 +26,6 @@ public final class ListPlanChangesRequest { private final Optional> companyIds; - private final Optional> planIds; - private final Optional action; private final Optional basePlanAction; @@ -42,7 +40,6 @@ public final class ListPlanChangesRequest { private ListPlanChangesRequest( Optional> companyIds, - Optional> planIds, Optional action, Optional basePlanAction, Optional companyId, @@ -50,7 +47,6 @@ private ListPlanChangesRequest( Optional offset, Map additionalProperties) { this.companyIds = companyIds; - this.planIds = planIds; this.action = action; this.basePlanAction = basePlanAction; this.companyId = companyId; @@ -64,11 +60,6 @@ public Optional> getCompanyIds() { return companyIds; } - @JsonProperty("plan_ids") - public Optional> getPlanIds() { - return planIds; - } - @JsonProperty("action") public Optional getAction() { return action; @@ -113,7 +104,6 @@ public Map getAdditionalProperties() { private boolean equalTo(ListPlanChangesRequest other) { return companyIds.equals(other.companyIds) - && planIds.equals(other.planIds) && action.equals(other.action) && basePlanAction.equals(other.basePlanAction) && companyId.equals(other.companyId) @@ -123,14 +113,7 @@ private boolean equalTo(ListPlanChangesRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash( - this.companyIds, - this.planIds, - this.action, - this.basePlanAction, - this.companyId, - this.limit, - this.offset); + return Objects.hash(this.companyIds, this.action, this.basePlanAction, this.companyId, this.limit, this.offset); } @java.lang.Override @@ -146,8 +129,6 @@ public static Builder builder() { public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional> planIds = Optional.empty(); - private Optional action = Optional.empty(); private Optional basePlanAction = Optional.empty(); @@ -165,7 +146,6 @@ private Builder() {} public Builder from(ListPlanChangesRequest other) { companyIds(other.getCompanyIds()); - planIds(other.getPlanIds()); action(other.getAction()); basePlanAction(other.getBasePlanAction()); companyId(other.getCompanyId()); @@ -190,22 +170,6 @@ public Builder companyIds(String companyIds) { return this; } - @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; - } - - public Builder planIds(String planIds) { - this.planIds = Optional.of(Collections.singletonList(planIds)); - return this; - } - @JsonSetter(value = "action", nulls = Nulls.SKIP) public Builder action(Optional action) { this.action = action; @@ -269,7 +233,7 @@ public Builder offset(Long offset) { public ListPlanChangesRequest build() { return new ListPlanChangesRequest( - companyIds, planIds, action, basePlanAction, companyId, limit, offset, additionalProperties); + companyIds, action, basePlanAction, companyId, limit, offset, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitsParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitsParams.java new file mode 100644 index 0000000..af2af7b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitsParams.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.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.EntityType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountEntityTraitsParams.Builder.class) +public final class CountEntityTraitsParams { + private final Optional definitionId; + + private final Optional entityType; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private CountEntityTraitsParams( + Optional definitionId, + Optional entityType, + Optional limit, + Optional offset, + Map additionalProperties) { + this.definitionId = definitionId; + this.entityType = entityType; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("definition_id") + public Optional getDefinitionId() { + return definitionId; + } + + @JsonProperty("entity_type") + public Optional getEntityType() { + return entityType; + } + + /** + * @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 CountEntityTraitsParams && equalTo((CountEntityTraitsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountEntityTraitsParams other) { + return definitionId.equals(other.definitionId) + && entityType.equals(other.entityType) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.definitionId, this.entityType, 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 definitionId = Optional.empty(); + + private Optional entityType = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountEntityTraitsParams other) { + definitionId(other.getDefinitionId()); + entityType(other.getEntityType()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @JsonSetter(value = "definition_id", nulls = Nulls.SKIP) + public Builder definitionId(Optional definitionId) { + this.definitionId = definitionId; + return this; + } + + public Builder definitionId(String definitionId) { + this.definitionId = Optional.ofNullable(definitionId); + return this; + } + + @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) + public Builder entityType(Optional entityType) { + this.entityType = entityType; + return this; + } + + public Builder entityType(EntityType entityType) { + this.entityType = Optional.ofNullable(entityType); + 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 CountEntityTraitsParams build() { + return new CountEntityTraitsParams(definitionId, entityType, 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/companies/types/CountEntityTraitsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitsResponse.java new file mode 100644 index 0000000..f480640 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitsResponse.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.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 com.schematic.api.types.CountResponse; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountEntityTraitsResponse.Builder.class) +public final class CountEntityTraitsResponse { + private final CountResponse data; + + private final CountEntityTraitsParams params; + + private final Map additionalProperties; + + private CountEntityTraitsResponse( + CountResponse data, CountEntityTraitsParams params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CountResponse getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public CountEntityTraitsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountEntityTraitsResponse && equalTo((CountEntityTraitsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountEntityTraitsResponse 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 { + ParamsStage data(@NotNull CountResponse data); + + Builder from(CountEntityTraitsResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull CountEntityTraitsParams params); + } + + public interface _FinalStage { + CountEntityTraitsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private CountResponse data; + + private CountEntityTraitsParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountEntityTraitsResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public ParamsStage data(@NotNull CountResponse 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 + @JsonSetter("params") + public _FinalStage params(@NotNull CountEntityTraitsParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public CountEntityTraitsResponse build() { + return new CountEntityTraitsResponse(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/companies/types/DeleteEntityTraitDefinitionResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteEntityTraitDefinitionResponse.java new file mode 100644 index 0000000..f1ca157 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteEntityTraitDefinitionResponse.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.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 = DeleteEntityTraitDefinitionResponse.Builder.class) +public final class DeleteEntityTraitDefinitionResponse { + private final DeleteResponse data; + + private final Map params; + + private final Map additionalProperties; + + private DeleteEntityTraitDefinitionResponse( + 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 DeleteEntityTraitDefinitionResponse + && equalTo((DeleteEntityTraitDefinitionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteEntityTraitDefinitionResponse 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(DeleteEntityTraitDefinitionResponse other); + } + + public interface _FinalStage { + DeleteEntityTraitDefinitionResponse 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(DeleteEntityTraitDefinitionResponse 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 DeleteEntityTraitDefinitionResponse build() { + return new DeleteEntityTraitDefinitionResponse(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/companies/types/GetEntityTraitDefinitionUsageResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitDefinitionUsageResponse.java new file mode 100644 index 0000000..c5c8f20 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitDefinitionUsageResponse.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.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.EntityTraitDefinitionUsage; +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 = GetEntityTraitDefinitionUsageResponse.Builder.class) +public final class GetEntityTraitDefinitionUsageResponse { + private final EntityTraitDefinitionUsage data; + + private final Map params; + + private final Map additionalProperties; + + private GetEntityTraitDefinitionUsageResponse( + EntityTraitDefinitionUsage data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public EntityTraitDefinitionUsage 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 GetEntityTraitDefinitionUsageResponse + && equalTo((GetEntityTraitDefinitionUsageResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetEntityTraitDefinitionUsageResponse 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 EntityTraitDefinitionUsage data); + + Builder from(GetEntityTraitDefinitionUsageResponse other); + } + + public interface _FinalStage { + GetEntityTraitDefinitionUsageResponse 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 EntityTraitDefinitionUsage data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetEntityTraitDefinitionUsageResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull EntityTraitDefinitionUsage 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 GetEntityTraitDefinitionUsageResponse build() { + return new GetEntityTraitDefinitionUsageResponse(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/companies/types/ListPlanChangesParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java index b694f5e..1f3fc96 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java @@ -35,8 +35,6 @@ public final class ListPlanChangesParams { private final Optional offset; - private final Optional> planIds; - private final Map additionalProperties; private ListPlanChangesParams( @@ -46,7 +44,6 @@ private ListPlanChangesParams( Optional> companyIds, Optional limit, Optional offset, - Optional> planIds, Map additionalProperties) { this.action = action; this.basePlanAction = basePlanAction; @@ -54,7 +51,6 @@ private ListPlanChangesParams( this.companyIds = companyIds; this.limit = limit; this.offset = offset; - this.planIds = planIds; this.additionalProperties = additionalProperties; } @@ -94,11 +90,6 @@ public Optional getOffset() { return offset; } - @JsonProperty("plan_ids") - public Optional> getPlanIds() { - return planIds; - } - @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -116,20 +107,12 @@ private boolean equalTo(ListPlanChangesParams other) { && companyId.equals(other.companyId) && companyIds.equals(other.companyIds) && limit.equals(other.limit) - && offset.equals(other.offset) - && planIds.equals(other.planIds); + && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash( - this.action, - this.basePlanAction, - this.companyId, - this.companyIds, - this.limit, - this.offset, - this.planIds); + return Objects.hash(this.action, this.basePlanAction, this.companyId, this.companyIds, this.limit, this.offset); } @java.lang.Override @@ -155,8 +138,6 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional> planIds = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -169,7 +150,6 @@ public Builder from(ListPlanChangesParams other) { companyIds(other.getCompanyIds()); limit(other.getLimit()); offset(other.getOffset()); - planIds(other.getPlanIds()); return this; } @@ -245,20 +225,9 @@ public Builder offset(Long offset) { return this; } - @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; - } - public ListPlanChangesParams build() { return new ListPlanChangesParams( - action, basePlanAction, companyId, companyIds, limit, offset, planIds, additionalProperties); + action, basePlanAction, companyId, companyIds, limit, offset, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java index efa78b1..ebe5357 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java @@ -30,6 +30,8 @@ public final class CreateCreditBundleRequestBody { private final Optional bundleType; + private final Optional> compatiblePlanIds; + private final String creditId; private final String currency; @@ -55,6 +57,7 @@ public final class CreateCreditBundleRequestBody { private CreateCreditBundleRequestBody( String bundleName, Optional bundleType, + Optional> compatiblePlanIds, String creditId, String currency, Optional> currencyPrices, @@ -68,6 +71,7 @@ private CreateCreditBundleRequestBody( Map additionalProperties) { this.bundleName = bundleName; this.bundleType = bundleType; + this.compatiblePlanIds = compatiblePlanIds; this.creditId = creditId; this.currency = currency; this.currencyPrices = currencyPrices; @@ -91,6 +95,14 @@ public Optional getBundleType() { return bundleType; } + /** + * @return Plans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan. + */ + @JsonProperty("compatible_plan_ids") + public Optional> getCompatiblePlanIds() { + return compatiblePlanIds; + } + @JsonProperty("credit_id") public String getCreditId() { return creditId; @@ -155,6 +167,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateCreditBundleRequestBody other) { return bundleName.equals(other.bundleName) && bundleType.equals(other.bundleType) + && compatiblePlanIds.equals(other.compatiblePlanIds) && creditId.equals(other.creditId) && currency.equals(other.currency) && currencyPrices.equals(other.currencyPrices) @@ -172,6 +185,7 @@ public int hashCode() { return Objects.hash( this.bundleName, this.bundleType, + this.compatiblePlanIds, this.creditId, this.currency, this.currencyPrices, @@ -222,6 +236,13 @@ public interface _FinalStage { _FinalStage bundleType(String bundleType); + /** + *

Plans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan.

+ */ + _FinalStage compatiblePlanIds(Optional> compatiblePlanIds); + + _FinalStage compatiblePlanIds(List compatiblePlanIds); + _FinalStage currencyPrices(Optional> currencyPrices); _FinalStage currencyPrices(List currencyPrices); @@ -276,6 +297,8 @@ public static final class Builder private Optional> currencyPrices = Optional.empty(); + private Optional> compatiblePlanIds = Optional.empty(); + private Optional bundleType = Optional.empty(); @JsonAnySetter @@ -287,6 +310,7 @@ private Builder() {} public Builder from(CreateCreditBundleRequestBody other) { bundleName(other.getBundleName()); bundleType(other.getBundleType()); + compatiblePlanIds(other.getCompatiblePlanIds()); creditId(other.getCreditId()); currency(other.getCurrency()); currencyPrices(other.getCurrencyPrices()); @@ -419,6 +443,26 @@ public _FinalStage currencyPrices(OptionalPlans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan.

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

Plans whose companies may purchase this bundle. Omitted or empty means the bundle is purchasable on every plan.

+ */ + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(Optional> compatiblePlanIds) { + this.compatiblePlanIds = compatiblePlanIds; + return this; + } + @java.lang.Override public _FinalStage bundleType(String bundleType) { this.bundleType = Optional.ofNullable(bundleType); @@ -437,6 +481,7 @@ public CreateCreditBundleRequestBody build() { return new CreateCreditBundleRequestBody( bundleName, bundleType, + compatiblePlanIds, creditId, currency, currencyPrices, diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java index 2f78a62..1854ca2 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java @@ -28,6 +28,8 @@ public final class UpdateCreditBundleDetailsRequestBody { private final String bundleName; + private final Optional> compatiblePlanIds; + private final Optional> currencyPrices; private final Optional expiryType; @@ -48,6 +50,7 @@ public final class UpdateCreditBundleDetailsRequestBody { private UpdateCreditBundleDetailsRequestBody( String bundleName, + Optional> compatiblePlanIds, Optional> currencyPrices, Optional expiryType, Optional expiryUnit, @@ -58,6 +61,7 @@ private UpdateCreditBundleDetailsRequestBody( Optional status, Map additionalProperties) { this.bundleName = bundleName; + this.compatiblePlanIds = compatiblePlanIds; this.currencyPrices = currencyPrices; this.expiryType = expiryType; this.expiryUnit = expiryUnit; @@ -74,6 +78,14 @@ public String getBundleName() { return bundleName; } + /** + * @return Plans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan. + */ + @JsonProperty("compatible_plan_ids") + public Optional> getCompatiblePlanIds() { + return compatiblePlanIds; + } + @JsonProperty("currency_prices") public Optional> getCurrencyPrices() { return currencyPrices; @@ -128,6 +140,7 @@ public Map getAdditionalProperties() { private boolean equalTo(UpdateCreditBundleDetailsRequestBody other) { return bundleName.equals(other.bundleName) + && compatiblePlanIds.equals(other.compatiblePlanIds) && currencyPrices.equals(other.currencyPrices) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) @@ -142,6 +155,7 @@ private boolean equalTo(UpdateCreditBundleDetailsRequestBody other) { public int hashCode() { return Objects.hash( this.bundleName, + this.compatiblePlanIds, this.currencyPrices, this.expiryType, this.expiryUnit, @@ -178,6 +192,13 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

Plans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan.

+ */ + _FinalStage compatiblePlanIds(Optional> compatiblePlanIds); + + _FinalStage compatiblePlanIds(List compatiblePlanIds); + _FinalStage currencyPrices(Optional> currencyPrices); _FinalStage currencyPrices(List currencyPrices); @@ -227,6 +248,8 @@ public static final class Builder implements BundleNameStage, PricePerUnitStage, private Optional> currencyPrices = Optional.empty(); + private Optional> compatiblePlanIds = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -235,6 +258,7 @@ private Builder() {} @java.lang.Override public Builder from(UpdateCreditBundleDetailsRequestBody other) { bundleName(other.getBundleName()); + compatiblePlanIds(other.getCompatiblePlanIds()); currencyPrices(other.getCurrencyPrices()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); @@ -351,10 +375,31 @@ public _FinalStage currencyPrices(OptionalPlans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan.

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

Plans whose companies may purchase this bundle. Omitted leaves compatibility unchanged; empty resets the bundle to purchasable on every plan.

+ */ + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(Optional> compatiblePlanIds) { + this.compatiblePlanIds = compatiblePlanIds; + return this; + } + @java.lang.Override public UpdateCreditBundleDetailsRequestBody build() { return new UpdateCreditBundleDetailsRequestBody( bundleName, + compatiblePlanIds, currencyPrices, expiryType, expiryUnit, diff --git a/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java index 943f99e..f61433b 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java @@ -50,14 +50,12 @@ public CompletableFuture createPlanBundle( } public CompletableFuture updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request) { - return this.rawClient.updatePlanBundle(planBundleId, request).thenApply(response -> response.body()); + String planId, UpdatePlanBundleRequestBody request) { + return this.rawClient.updatePlanBundle(planId, request).thenApply(response -> response.body()); } public CompletableFuture updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { - return this.rawClient - .updatePlanBundle(planBundleId, request, requestOptions) - .thenApply(response -> response.body()); + String planId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + return this.rawClient.updatePlanBundle(planId, request, requestOptions).thenApply(response -> response.body()); } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java index f81b282..5b9cf3f 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java @@ -256,16 +256,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } public CompletableFuture> updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request) { - return updatePlanBundle(planBundleId, request, null); + String planId, UpdatePlanBundleRequestBody request) { + return updatePlanBundle(planId, request, null); } public CompletableFuture> updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + String planId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-bundles") - .addPathSegment(planBundleId); + .addPathSegment(planId); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java index e471363..e663643 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java @@ -47,14 +47,12 @@ public CreatePlanBundleResponse createPlanBundle( return this.rawClient.createPlanBundle(request, requestOptions).body(); } - public UpdatePlanBundleResponse updatePlanBundle(String planBundleId, UpdatePlanBundleRequestBody request) { - return this.rawClient.updatePlanBundle(planBundleId, request).body(); + public UpdatePlanBundleResponse updatePlanBundle(String planId, UpdatePlanBundleRequestBody request) { + return this.rawClient.updatePlanBundle(planId, request).body(); } public UpdatePlanBundleResponse updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { - return this.rawClient - .updatePlanBundle(planBundleId, request, requestOptions) - .body(); + String planId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + return this.rawClient.updatePlanBundle(planId, request, requestOptions).body(); } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java index 9f392cb..b5b1784 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java @@ -202,16 +202,16 @@ public BaseSchematicHttpResponse createPlanBundle( } public BaseSchematicHttpResponse updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request) { - return updatePlanBundle(planBundleId, request, null); + String planId, UpdatePlanBundleRequestBody request) { + return updatePlanBundle(planId, request, null); } public BaseSchematicHttpResponse updatePlanBundle( - String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + String planId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-bundles") - .addPathSegment(planBundleId); + .addPathSegment(planId); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java index ffa4df5..c8eb487 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CheckoutBundlePurchaseBehavior; import com.schematic.api.types.CheckoutFieldInput; import com.schematic.api.types.CompatiblePlans; import com.schematic.api.types.CustomPlanConfig; @@ -34,12 +35,16 @@ public final class CreatePlanGroupRequestBody { private final List addOnIds; + private final CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; + private final boolean checkoutCollectAddress; private final boolean checkoutCollectEmail; private final boolean checkoutCollectPhone; + private final boolean checkoutCollectTaxId; + private final Optional> customCheckoutFields; private final Optional customPlanConfig; @@ -107,9 +112,11 @@ public final class CreatePlanGroupRequestBody { private CreatePlanGroupRequestBody( Optional> addOnCompatibilities, List addOnIds, + CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior, boolean checkoutCollectAddress, boolean checkoutCollectEmail, boolean checkoutCollectPhone, + boolean checkoutCollectTaxId, Optional> customCheckoutFields, Optional customPlanConfig, Optional customPlanId, @@ -144,9 +151,11 @@ private CreatePlanGroupRequestBody( Map additionalProperties) { this.addOnCompatibilities = addOnCompatibilities; this.addOnIds = addOnIds; + this.checkoutBundlePurchaseBehavior = checkoutBundlePurchaseBehavior; this.checkoutCollectAddress = checkoutCollectAddress; this.checkoutCollectEmail = checkoutCollectEmail; this.checkoutCollectPhone = checkoutCollectPhone; + this.checkoutCollectTaxId = checkoutCollectTaxId; this.customCheckoutFields = customCheckoutFields; this.customPlanConfig = customPlanConfig; this.customPlanId = customPlanId; @@ -194,6 +203,11 @@ public List getAddOnIds() { return addOnIds; } + @JsonProperty("checkout_bundle_purchase_behavior") + public CheckoutBundlePurchaseBehavior getCheckoutBundlePurchaseBehavior() { + return checkoutBundlePurchaseBehavior; + } + @JsonProperty("checkout_collect_address") public boolean getCheckoutCollectAddress() { return checkoutCollectAddress; @@ -209,6 +223,11 @@ public boolean getCheckoutCollectPhone() { return checkoutCollectPhone; } + @JsonProperty("checkout_collect_tax_id") + public boolean getCheckoutCollectTaxId() { + return checkoutCollectTaxId; + } + @JsonProperty("custom_checkout_fields") public Optional> getCustomCheckoutFields() { return customCheckoutFields; @@ -378,9 +397,11 @@ public Map getAdditionalProperties() { private boolean equalTo(CreatePlanGroupRequestBody other) { return addOnCompatibilities.equals(other.addOnCompatibilities) && addOnIds.equals(other.addOnIds) + && checkoutBundlePurchaseBehavior.equals(other.checkoutBundlePurchaseBehavior) && checkoutCollectAddress == other.checkoutCollectAddress && checkoutCollectEmail == other.checkoutCollectEmail && checkoutCollectPhone == other.checkoutCollectPhone + && checkoutCollectTaxId == other.checkoutCollectTaxId && customCheckoutFields.equals(other.customCheckoutFields) && customPlanConfig.equals(other.customPlanConfig) && customPlanId.equals(other.customPlanId) @@ -419,9 +440,11 @@ public int hashCode() { return Objects.hash( this.addOnCompatibilities, this.addOnIds, + this.checkoutBundlePurchaseBehavior, this.checkoutCollectAddress, this.checkoutCollectEmail, this.checkoutCollectPhone, + this.checkoutCollectTaxId, this.customCheckoutFields, this.customPlanConfig, this.customPlanId, @@ -460,22 +483,31 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CheckoutCollectAddressStage builder() { + public static CheckoutBundlePurchaseBehaviorStage builder() { return new Builder(); } - public interface CheckoutCollectAddressStage { - CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress); + public interface CheckoutBundlePurchaseBehaviorStage { + CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( + @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior); Builder from(CreatePlanGroupRequestBody other); } + public interface CheckoutCollectAddressStage { + CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress); + } + public interface CheckoutCollectEmailStage { CheckoutCollectPhoneStage checkoutCollectEmail(boolean checkoutCollectEmail); } public interface CheckoutCollectPhoneStage { - EnableTaxCollectionStage checkoutCollectPhone(boolean checkoutCollectPhone); + CheckoutCollectTaxIdStage checkoutCollectPhone(boolean checkoutCollectPhone); + } + + public interface CheckoutCollectTaxIdStage { + EnableTaxCollectionStage checkoutCollectTaxId(boolean checkoutCollectTaxId); } public interface EnableTaxCollectionStage { @@ -631,9 +663,11 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CheckoutCollectAddressStage, + implements CheckoutBundlePurchaseBehaviorStage, + CheckoutCollectAddressStage, CheckoutCollectEmailStage, CheckoutCollectPhoneStage, + CheckoutCollectTaxIdStage, EnableTaxCollectionStage, OptInEnabledStage, PreventDowngradesWhenOverLimitStage, @@ -647,12 +681,16 @@ public static final class Builder ShowZeroPriceAsFreeStage, SyncCustomerBillingDetailsStage, _FinalStage { + private CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; + private boolean checkoutCollectAddress; private boolean checkoutCollectEmail; private boolean checkoutCollectPhone; + private boolean checkoutCollectTaxId; + private boolean enableTaxCollection; private boolean optInEnabled; @@ -728,9 +766,11 @@ private Builder() {} public Builder from(CreatePlanGroupRequestBody other) { addOnCompatibilities(other.getAddOnCompatibilities()); addOnIds(other.getAddOnIds()); + checkoutBundlePurchaseBehavior(other.getCheckoutBundlePurchaseBehavior()); checkoutCollectAddress(other.getCheckoutCollectAddress()); checkoutCollectEmail(other.getCheckoutCollectEmail()); checkoutCollectPhone(other.getCheckoutCollectPhone()); + checkoutCollectTaxId(other.getCheckoutCollectTaxId()); customCheckoutFields(other.getCustomCheckoutFields()); customPlanConfig(other.getCustomPlanConfig()); customPlanId(other.getCustomPlanId()); @@ -765,6 +805,15 @@ public Builder from(CreatePlanGroupRequestBody other) { return this; } + @java.lang.Override + @JsonSetter("checkout_bundle_purchase_behavior") + public CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( + @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior) { + this.checkoutBundlePurchaseBehavior = Objects.requireNonNull( + checkoutBundlePurchaseBehavior, "checkoutBundlePurchaseBehavior must not be null"); + return this; + } + @java.lang.Override @JsonSetter("checkout_collect_address") public CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress) { @@ -781,11 +830,18 @@ public CheckoutCollectPhoneStage checkoutCollectEmail(boolean checkoutCollectEma @java.lang.Override @JsonSetter("checkout_collect_phone") - public EnableTaxCollectionStage checkoutCollectPhone(boolean checkoutCollectPhone) { + public CheckoutCollectTaxIdStage checkoutCollectPhone(boolean checkoutCollectPhone) { this.checkoutCollectPhone = checkoutCollectPhone; return this; } + @java.lang.Override + @JsonSetter("checkout_collect_tax_id") + public EnableTaxCollectionStage checkoutCollectTaxId(boolean checkoutCollectTaxId) { + this.checkoutCollectTaxId = checkoutCollectTaxId; + return this; + } + @java.lang.Override @JsonSetter("enable_tax_collection") public OptInEnabledStage enableTaxCollection(boolean enableTaxCollection) { @@ -1206,9 +1262,11 @@ public CreatePlanGroupRequestBody build() { return new CreatePlanGroupRequestBody( addOnCompatibilities, addOnIds, + checkoutBundlePurchaseBehavior, checkoutCollectAddress, checkoutCollectEmail, checkoutCollectPhone, + checkoutCollectTaxId, customCheckoutFields, customPlanConfig, customPlanId, diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java index 67cda9e..f265cb3 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CheckoutBundlePurchaseBehavior; import com.schematic.api.types.CheckoutFieldInput; import com.schematic.api.types.CompatiblePlans; import com.schematic.api.types.CustomPlanConfig; @@ -34,12 +35,16 @@ public final class UpdatePlanGroupRequestBody { private final List addOnIds; + private final CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; + private final boolean checkoutCollectAddress; private final boolean checkoutCollectEmail; private final boolean checkoutCollectPhone; + private final boolean checkoutCollectTaxId; + private final Optional> customCheckoutFields; private final Optional customPlanConfig; @@ -107,9 +112,11 @@ public final class UpdatePlanGroupRequestBody { private UpdatePlanGroupRequestBody( Optional> addOnCompatibilities, List addOnIds, + CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior, boolean checkoutCollectAddress, boolean checkoutCollectEmail, boolean checkoutCollectPhone, + boolean checkoutCollectTaxId, Optional> customCheckoutFields, Optional customPlanConfig, Optional customPlanId, @@ -144,9 +151,11 @@ private UpdatePlanGroupRequestBody( Map additionalProperties) { this.addOnCompatibilities = addOnCompatibilities; this.addOnIds = addOnIds; + this.checkoutBundlePurchaseBehavior = checkoutBundlePurchaseBehavior; this.checkoutCollectAddress = checkoutCollectAddress; this.checkoutCollectEmail = checkoutCollectEmail; this.checkoutCollectPhone = checkoutCollectPhone; + this.checkoutCollectTaxId = checkoutCollectTaxId; this.customCheckoutFields = customCheckoutFields; this.customPlanConfig = customPlanConfig; this.customPlanId = customPlanId; @@ -194,6 +203,11 @@ public List getAddOnIds() { return addOnIds; } + @JsonProperty("checkout_bundle_purchase_behavior") + public CheckoutBundlePurchaseBehavior getCheckoutBundlePurchaseBehavior() { + return checkoutBundlePurchaseBehavior; + } + @JsonProperty("checkout_collect_address") public boolean getCheckoutCollectAddress() { return checkoutCollectAddress; @@ -209,6 +223,11 @@ public boolean getCheckoutCollectPhone() { return checkoutCollectPhone; } + @JsonProperty("checkout_collect_tax_id") + public boolean getCheckoutCollectTaxId() { + return checkoutCollectTaxId; + } + @JsonProperty("custom_checkout_fields") public Optional> getCustomCheckoutFields() { return customCheckoutFields; @@ -378,9 +397,11 @@ public Map getAdditionalProperties() { private boolean equalTo(UpdatePlanGroupRequestBody other) { return addOnCompatibilities.equals(other.addOnCompatibilities) && addOnIds.equals(other.addOnIds) + && checkoutBundlePurchaseBehavior.equals(other.checkoutBundlePurchaseBehavior) && checkoutCollectAddress == other.checkoutCollectAddress && checkoutCollectEmail == other.checkoutCollectEmail && checkoutCollectPhone == other.checkoutCollectPhone + && checkoutCollectTaxId == other.checkoutCollectTaxId && customCheckoutFields.equals(other.customCheckoutFields) && customPlanConfig.equals(other.customPlanConfig) && customPlanId.equals(other.customPlanId) @@ -419,9 +440,11 @@ public int hashCode() { return Objects.hash( this.addOnCompatibilities, this.addOnIds, + this.checkoutBundlePurchaseBehavior, this.checkoutCollectAddress, this.checkoutCollectEmail, this.checkoutCollectPhone, + this.checkoutCollectTaxId, this.customCheckoutFields, this.customPlanConfig, this.customPlanId, @@ -460,22 +483,31 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CheckoutCollectAddressStage builder() { + public static CheckoutBundlePurchaseBehaviorStage builder() { return new Builder(); } - public interface CheckoutCollectAddressStage { - CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress); + public interface CheckoutBundlePurchaseBehaviorStage { + CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( + @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior); Builder from(UpdatePlanGroupRequestBody other); } + public interface CheckoutCollectAddressStage { + CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress); + } + public interface CheckoutCollectEmailStage { CheckoutCollectPhoneStage checkoutCollectEmail(boolean checkoutCollectEmail); } public interface CheckoutCollectPhoneStage { - EnableTaxCollectionStage checkoutCollectPhone(boolean checkoutCollectPhone); + CheckoutCollectTaxIdStage checkoutCollectPhone(boolean checkoutCollectPhone); + } + + public interface CheckoutCollectTaxIdStage { + EnableTaxCollectionStage checkoutCollectTaxId(boolean checkoutCollectTaxId); } public interface EnableTaxCollectionStage { @@ -631,9 +663,11 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CheckoutCollectAddressStage, + implements CheckoutBundlePurchaseBehaviorStage, + CheckoutCollectAddressStage, CheckoutCollectEmailStage, CheckoutCollectPhoneStage, + CheckoutCollectTaxIdStage, EnableTaxCollectionStage, OptInEnabledStage, PreventDowngradesWhenOverLimitStage, @@ -647,12 +681,16 @@ public static final class Builder ShowZeroPriceAsFreeStage, SyncCustomerBillingDetailsStage, _FinalStage { + private CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; + private boolean checkoutCollectAddress; private boolean checkoutCollectEmail; private boolean checkoutCollectPhone; + private boolean checkoutCollectTaxId; + private boolean enableTaxCollection; private boolean optInEnabled; @@ -728,9 +766,11 @@ private Builder() {} public Builder from(UpdatePlanGroupRequestBody other) { addOnCompatibilities(other.getAddOnCompatibilities()); addOnIds(other.getAddOnIds()); + checkoutBundlePurchaseBehavior(other.getCheckoutBundlePurchaseBehavior()); checkoutCollectAddress(other.getCheckoutCollectAddress()); checkoutCollectEmail(other.getCheckoutCollectEmail()); checkoutCollectPhone(other.getCheckoutCollectPhone()); + checkoutCollectTaxId(other.getCheckoutCollectTaxId()); customCheckoutFields(other.getCustomCheckoutFields()); customPlanConfig(other.getCustomPlanConfig()); customPlanId(other.getCustomPlanId()); @@ -765,6 +805,15 @@ public Builder from(UpdatePlanGroupRequestBody other) { return this; } + @java.lang.Override + @JsonSetter("checkout_bundle_purchase_behavior") + public CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( + @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior) { + this.checkoutBundlePurchaseBehavior = Objects.requireNonNull( + checkoutBundlePurchaseBehavior, "checkoutBundlePurchaseBehavior must not be null"); + return this; + } + @java.lang.Override @JsonSetter("checkout_collect_address") public CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress) { @@ -781,11 +830,18 @@ public CheckoutCollectPhoneStage checkoutCollectEmail(boolean checkoutCollectEma @java.lang.Override @JsonSetter("checkout_collect_phone") - public EnableTaxCollectionStage checkoutCollectPhone(boolean checkoutCollectPhone) { + public CheckoutCollectTaxIdStage checkoutCollectPhone(boolean checkoutCollectPhone) { this.checkoutCollectPhone = checkoutCollectPhone; return this; } + @java.lang.Override + @JsonSetter("checkout_collect_tax_id") + public EnableTaxCollectionStage checkoutCollectTaxId(boolean checkoutCollectTaxId) { + this.checkoutCollectTaxId = checkoutCollectTaxId; + return this; + } + @java.lang.Override @JsonSetter("enable_tax_collection") public OptInEnabledStage enableTaxCollection(boolean enableTaxCollection) { @@ -1206,9 +1262,11 @@ public UpdatePlanGroupRequestBody build() { return new UpdatePlanGroupRequestBody( addOnCompatibilities, addOnIds, + checkoutBundlePurchaseBehavior, checkoutCollectAddress, checkoutCollectEmail, checkoutCollectPhone, + checkoutCollectTaxId, customCheckoutFields, customPlanConfig, customPlanId, diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java index adca4fa..54d8e6f 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java @@ -12,27 +12,30 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.MigrationProrationBehavior; import com.schematic.api.types.PlanType; import com.schematic.api.types.PlanVersionMigrationStrategy; -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 = CreateMigrationInput.Builder.class) public final class CreateMigrationInput { - private final List companyIds; + private final Optional> companyIds; - private final List excludedCompanyIds; + private final Optional> excludedCompanyIds; private final String planId; private final String planVersionIdTo; - private final List planVersionIdsFrom; + private final Optional> planVersionIdsFrom; + + private final Optional prorationBehavior; private final PlanVersionMigrationStrategy strategy; @@ -41,11 +44,12 @@ public final class CreateMigrationInput { private final Map additionalProperties; private CreateMigrationInput( - List companyIds, - List excludedCompanyIds, + Optional> companyIds, + Optional> excludedCompanyIds, String planId, String planVersionIdTo, - List planVersionIdsFrom, + Optional> planVersionIdsFrom, + Optional prorationBehavior, PlanVersionMigrationStrategy strategy, PlanType targetPlanType, Map additionalProperties) { @@ -54,18 +58,19 @@ private CreateMigrationInput( this.planId = planId; this.planVersionIdTo = planVersionIdTo; this.planVersionIdsFrom = planVersionIdsFrom; + this.prorationBehavior = prorationBehavior; this.strategy = strategy; this.targetPlanType = targetPlanType; this.additionalProperties = additionalProperties; } @JsonProperty("company_ids") - public List getCompanyIds() { + public Optional> getCompanyIds() { return companyIds; } @JsonProperty("excluded_company_ids") - public List getExcludedCompanyIds() { + public Optional> getExcludedCompanyIds() { return excludedCompanyIds; } @@ -80,10 +85,15 @@ public String getPlanVersionIdTo() { } @JsonProperty("plan_version_ids_from") - public List getPlanVersionIdsFrom() { + public Optional> getPlanVersionIdsFrom() { return planVersionIdsFrom; } + @JsonProperty("proration_behavior") + public Optional getProrationBehavior() { + return prorationBehavior; + } + @JsonProperty("strategy") public PlanVersionMigrationStrategy getStrategy() { return strategy; @@ -111,6 +121,7 @@ private boolean equalTo(CreateMigrationInput other) { && planId.equals(other.planId) && planVersionIdTo.equals(other.planVersionIdTo) && planVersionIdsFrom.equals(other.planVersionIdsFrom) + && prorationBehavior.equals(other.prorationBehavior) && strategy.equals(other.strategy) && targetPlanType.equals(other.targetPlanType); } @@ -123,6 +134,7 @@ public int hashCode() { this.planId, this.planVersionIdTo, this.planVersionIdsFrom, + this.prorationBehavior, this.strategy, this.targetPlanType); } @@ -161,23 +173,21 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); - _FinalStage companyIds(List companyIds); + _FinalStage companyIds(Optional> companyIds); - _FinalStage addCompanyIds(String companyIds); + _FinalStage companyIds(List companyIds); - _FinalStage addAllCompanyIds(List companyIds); + _FinalStage excludedCompanyIds(Optional> excludedCompanyIds); _FinalStage excludedCompanyIds(List excludedCompanyIds); - _FinalStage addExcludedCompanyIds(String excludedCompanyIds); - - _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds); + _FinalStage planVersionIdsFrom(Optional> planVersionIdsFrom); _FinalStage planVersionIdsFrom(List planVersionIdsFrom); - _FinalStage addPlanVersionIdsFrom(String planVersionIdsFrom); + _FinalStage prorationBehavior(Optional prorationBehavior); - _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom); + _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -191,11 +201,13 @@ public static final class Builder private PlanType targetPlanType; - private List planVersionIdsFrom = new ArrayList<>(); + private Optional prorationBehavior = Optional.empty(); + + private Optional> planVersionIdsFrom = Optional.empty(); - private List excludedCompanyIds = new ArrayList<>(); + private Optional> excludedCompanyIds = Optional.empty(); - private List companyIds = new ArrayList<>(); + private Optional> companyIds = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -209,6 +221,7 @@ public Builder from(CreateMigrationInput other) { planId(other.getPlanId()); planVersionIdTo(other.getPlanVersionIdTo()); planVersionIdsFrom(other.getPlanVersionIdsFrom()); + prorationBehavior(other.getProrationBehavior()); strategy(other.getStrategy()); targetPlanType(other.getTargetPlanType()); return this; @@ -243,74 +256,54 @@ public _FinalStage targetPlanType(@NotNull PlanType targetPlanType) { } @java.lang.Override - public _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom) { - if (planVersionIdsFrom != null) { - this.planVersionIdsFrom.addAll(planVersionIdsFrom); - } + public _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior) { + this.prorationBehavior = Optional.ofNullable(prorationBehavior); return this; } @java.lang.Override - public _FinalStage addPlanVersionIdsFrom(String planVersionIdsFrom) { - this.planVersionIdsFrom.add(planVersionIdsFrom); + @JsonSetter(value = "proration_behavior", nulls = Nulls.SKIP) + public _FinalStage prorationBehavior(Optional prorationBehavior) { + this.prorationBehavior = prorationBehavior; return this; } @java.lang.Override - @JsonSetter(value = "plan_version_ids_from", nulls = Nulls.SKIP) public _FinalStage planVersionIdsFrom(List planVersionIdsFrom) { - this.planVersionIdsFrom.clear(); - if (planVersionIdsFrom != null) { - this.planVersionIdsFrom.addAll(planVersionIdsFrom); - } + this.planVersionIdsFrom = Optional.ofNullable(planVersionIdsFrom); return this; } @java.lang.Override - public _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds) { - if (excludedCompanyIds != null) { - this.excludedCompanyIds.addAll(excludedCompanyIds); - } - return this; - } - - @java.lang.Override - public _FinalStage addExcludedCompanyIds(String excludedCompanyIds) { - this.excludedCompanyIds.add(excludedCompanyIds); + @JsonSetter(value = "plan_version_ids_from", nulls = Nulls.SKIP) + public _FinalStage planVersionIdsFrom(Optional> planVersionIdsFrom) { + this.planVersionIdsFrom = planVersionIdsFrom; return this; } @java.lang.Override - @JsonSetter(value = "excluded_company_ids", nulls = Nulls.SKIP) public _FinalStage excludedCompanyIds(List excludedCompanyIds) { - this.excludedCompanyIds.clear(); - if (excludedCompanyIds != null) { - this.excludedCompanyIds.addAll(excludedCompanyIds); - } + this.excludedCompanyIds = Optional.ofNullable(excludedCompanyIds); return this; } @java.lang.Override - public _FinalStage addAllCompanyIds(List companyIds) { - if (companyIds != null) { - this.companyIds.addAll(companyIds); - } + @JsonSetter(value = "excluded_company_ids", nulls = Nulls.SKIP) + public _FinalStage excludedCompanyIds(Optional> excludedCompanyIds) { + this.excludedCompanyIds = excludedCompanyIds; return this; } @java.lang.Override - public _FinalStage addCompanyIds(String companyIds) { - this.companyIds.add(companyIds); + public _FinalStage companyIds(List companyIds) { + this.companyIds = Optional.ofNullable(companyIds); return this; } @java.lang.Override @JsonSetter(value = "company_ids", nulls = Nulls.SKIP) - public _FinalStage companyIds(List companyIds) { - this.companyIds.clear(); - if (companyIds != null) { - this.companyIds.addAll(companyIds); - } + public _FinalStage companyIds(Optional> companyIds) { + this.companyIds = companyIds; return this; } @@ -322,6 +315,7 @@ public CreateMigrationInput build() { planId, planVersionIdTo, planVersionIdsFrom, + prorationBehavior, strategy, targetPlanType, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/PreviewMigrationRequestBody.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/PreviewMigrationRequestBody.java index 0ab803e..e0362dc 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/requests/PreviewMigrationRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/PreviewMigrationRequestBody.java @@ -13,41 +13,45 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.PlanType; -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 = PreviewMigrationRequestBody.Builder.class) public final class PreviewMigrationRequestBody { - private final List companyIds; + private final Optional> companyIds; private final String planId; private final String planVersionIdTo; + private final Optional> planVersionIdsFrom; + private final PlanType targetPlanType; private final Map additionalProperties; private PreviewMigrationRequestBody( - List companyIds, + Optional> companyIds, String planId, String planVersionIdTo, + Optional> planVersionIdsFrom, PlanType targetPlanType, Map additionalProperties) { this.companyIds = companyIds; this.planId = planId; this.planVersionIdTo = planVersionIdTo; + this.planVersionIdsFrom = planVersionIdsFrom; this.targetPlanType = targetPlanType; this.additionalProperties = additionalProperties; } @JsonProperty("company_ids") - public List getCompanyIds() { + public Optional> getCompanyIds() { return companyIds; } @@ -61,6 +65,11 @@ public String getPlanVersionIdTo() { return planVersionIdTo; } + @JsonProperty("plan_version_ids_from") + public Optional> getPlanVersionIdsFrom() { + return planVersionIdsFrom; + } + @JsonProperty("target_plan_type") public PlanType getTargetPlanType() { return targetPlanType; @@ -81,12 +90,14 @@ private boolean equalTo(PreviewMigrationRequestBody other) { return companyIds.equals(other.companyIds) && planId.equals(other.planId) && planVersionIdTo.equals(other.planVersionIdTo) + && planVersionIdsFrom.equals(other.planVersionIdsFrom) && targetPlanType.equals(other.targetPlanType); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyIds, this.planId, this.planVersionIdTo, this.targetPlanType); + return Objects.hash( + this.companyIds, this.planId, this.planVersionIdTo, this.planVersionIdsFrom, this.targetPlanType); } @java.lang.Override @@ -119,11 +130,13 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyIds(Optional> companyIds); + _FinalStage companyIds(List companyIds); - _FinalStage addCompanyIds(String companyIds); + _FinalStage planVersionIdsFrom(Optional> planVersionIdsFrom); - _FinalStage addAllCompanyIds(List companyIds); + _FinalStage planVersionIdsFrom(List planVersionIdsFrom); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -134,7 +147,9 @@ public static final class Builder implements PlanIdStage, PlanVersionIdToStage, private PlanType targetPlanType; - private List companyIds = new ArrayList<>(); + private Optional> planVersionIdsFrom = Optional.empty(); + + private Optional> companyIds = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -146,6 +161,7 @@ public Builder from(PreviewMigrationRequestBody other) { companyIds(other.getCompanyIds()); planId(other.getPlanId()); planVersionIdTo(other.getPlanVersionIdTo()); + planVersionIdsFrom(other.getPlanVersionIdsFrom()); targetPlanType(other.getTargetPlanType()); return this; } @@ -172,33 +188,35 @@ public _FinalStage targetPlanType(@NotNull PlanType targetPlanType) { } @java.lang.Override - public _FinalStage addAllCompanyIds(List companyIds) { - if (companyIds != null) { - this.companyIds.addAll(companyIds); - } + public _FinalStage planVersionIdsFrom(List planVersionIdsFrom) { + this.planVersionIdsFrom = Optional.ofNullable(planVersionIdsFrom); return this; } @java.lang.Override - public _FinalStage addCompanyIds(String companyIds) { - this.companyIds.add(companyIds); + @JsonSetter(value = "plan_version_ids_from", nulls = Nulls.SKIP) + public _FinalStage planVersionIdsFrom(Optional> planVersionIdsFrom) { + this.planVersionIdsFrom = planVersionIdsFrom; return this; } @java.lang.Override - @JsonSetter(value = "company_ids", nulls = Nulls.SKIP) public _FinalStage companyIds(List companyIds) { - this.companyIds.clear(); - if (companyIds != null) { - this.companyIds.addAll(companyIds); - } + this.companyIds = Optional.ofNullable(companyIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_ids", nulls = Nulls.SKIP) + public _FinalStage companyIds(Optional> companyIds) { + this.companyIds = companyIds; return this; } @java.lang.Override public PreviewMigrationRequestBody build() { return new PreviewMigrationRequestBody( - companyIds, planId, planVersionIdTo, targetPlanType, additionalProperties); + companyIds, planId, planVersionIdTo, planVersionIdsFrom, targetPlanType, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java index 8e3b5cc..a0148c5 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java @@ -61,14 +61,14 @@ public AsyncRawPlansClient withRawResponse() { } public CompletableFuture updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request) { - return this.rawClient.updateCompanyPlans(companyPlanId, request).thenApply(response -> response.body()); + String companyId, UpdateCompanyPlansRequestBody request) { + return this.rawClient.updateCompanyPlans(companyId, request).thenApply(response -> response.body()); } public CompletableFuture updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { + String companyId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { return this.rawClient - .updateCompanyPlans(companyPlanId, request, requestOptions) + .updateCompanyPlans(companyId, request, requestOptions) .thenApply(response -> response.body()); } @@ -259,34 +259,36 @@ public CompletableFuture listPlanIssues( return this.rawClient.listPlanIssues(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture deletePlanVersion(String planId) { - return this.rawClient.deletePlanVersion(planId).thenApply(response -> response.body()); + public CompletableFuture deletePlanVersion(String planVersionId) { + return this.rawClient.deletePlanVersion(planVersionId).thenApply(response -> response.body()); } public CompletableFuture deletePlanVersion( - String planId, RequestOptions requestOptions) { - return this.rawClient.deletePlanVersion(planId, requestOptions).thenApply(response -> response.body()); + String planVersionId, RequestOptions requestOptions) { + return this.rawClient.deletePlanVersion(planVersionId, requestOptions).thenApply(response -> response.body()); } public CompletableFuture deletePlanVersion( - String planId, DeletePlanVersionRequest request) { - return this.rawClient.deletePlanVersion(planId, request).thenApply(response -> response.body()); + String planVersionId, DeletePlanVersionRequest request) { + return this.rawClient.deletePlanVersion(planVersionId, request).thenApply(response -> response.body()); } public CompletableFuture deletePlanVersion( - String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { - return this.rawClient.deletePlanVersion(planId, request, requestOptions).thenApply(response -> response.body()); + String planVersionId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + return this.rawClient + .deletePlanVersion(planVersionId, request, requestOptions) + .thenApply(response -> response.body()); } public CompletableFuture publishPlanVersion( - String planId, PublishPlanVersionRequestBody request) { - return this.rawClient.publishPlanVersion(planId, request).thenApply(response -> response.body()); + String planVersionId, PublishPlanVersionRequestBody request) { + return this.rawClient.publishPlanVersion(planVersionId, request).thenApply(response -> response.body()); } public CompletableFuture publishPlanVersion( - String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + String planVersionId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { return this.rawClient - .publishPlanVersion(planId, request, requestOptions) + .publishPlanVersion(planVersionId, request, requestOptions) .thenApply(response -> response.body()); } } diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java index ff4c108..126aac1 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java @@ -76,16 +76,16 @@ public AsyncRawPlansClient(ClientOptions clientOptions) { } public CompletableFuture> updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request) { - return updateCompanyPlans(companyPlanId, request, null); + String companyId, UpdateCompanyPlansRequestBody request) { + return updateCompanyPlans(companyId, request, null); } public CompletableFuture> updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { + String companyId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-plans") - .addPathSegment(companyPlanId); + .addPathSegment(companyId); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -209,6 +209,13 @@ public CompletableFuture> deletePlanVersion(String planId) { - return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build()); + public CompletableFuture> deletePlanVersion( + String planVersionId) { + return deletePlanVersion( + planVersionId, DeletePlanVersionRequest.builder().build()); } public CompletableFuture> deletePlanVersion( - String planId, RequestOptions requestOptions) { - return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build(), requestOptions); + String planVersionId, RequestOptions requestOptions) { + return deletePlanVersion( + planVersionId, DeletePlanVersionRequest.builder().build(), requestOptions); } public CompletableFuture> deletePlanVersion( - String planId, DeletePlanVersionRequest request) { - return deletePlanVersion(planId, request, null); + String planVersionId, DeletePlanVersionRequest request) { + return deletePlanVersion(planVersionId, request, null); } public CompletableFuture> deletePlanVersion( - String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + String planVersionId, DeletePlanVersionRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planId); + .addPathSegment(planVersionId); if (request.getPromoteArchivedVersion().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -2088,16 +2098,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } public CompletableFuture> publishPlanVersion( - String planId, PublishPlanVersionRequestBody request) { - return publishPlanVersion(planId, request, null); + String planVersionId, PublishPlanVersionRequestBody request) { + return publishPlanVersion(planVersionId, request, null); } public CompletableFuture> publishPlanVersion( - String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + String planVersionId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planId) + .addPathSegment(planVersionId) .addPathSegments("publish"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/plans/PlansClient.java b/src/main/java/com/schematic/api/resources/plans/PlansClient.java index c8472d7..3beaf0b 100644 --- a/src/main/java/com/schematic/api/resources/plans/PlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/PlansClient.java @@ -59,14 +59,14 @@ public RawPlansClient withRawResponse() { return this.rawClient; } - public UpdateCompanyPlansResponse updateCompanyPlans(String companyPlanId, UpdateCompanyPlansRequestBody request) { - return this.rawClient.updateCompanyPlans(companyPlanId, request).body(); + public UpdateCompanyPlansResponse updateCompanyPlans(String companyId, UpdateCompanyPlansRequestBody request) { + return this.rawClient.updateCompanyPlans(companyId, request).body(); } public UpdateCompanyPlansResponse updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { + String companyId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { return this.rawClient - .updateCompanyPlans(companyPlanId, request, requestOptions) + .updateCompanyPlans(companyId, request, requestOptions) .body(); } @@ -251,31 +251,33 @@ public ListPlanIssuesResponse listPlanIssues(ListPlanIssuesRequest request, Requ return this.rawClient.listPlanIssues(request, requestOptions).body(); } - public DeletePlanVersionResponse deletePlanVersion(String planId) { - return this.rawClient.deletePlanVersion(planId).body(); + public DeletePlanVersionResponse deletePlanVersion(String planVersionId) { + return this.rawClient.deletePlanVersion(planVersionId).body(); } - public DeletePlanVersionResponse deletePlanVersion(String planId, RequestOptions requestOptions) { - return this.rawClient.deletePlanVersion(planId, requestOptions).body(); + public DeletePlanVersionResponse deletePlanVersion(String planVersionId, RequestOptions requestOptions) { + return this.rawClient.deletePlanVersion(planVersionId, requestOptions).body(); } - public DeletePlanVersionResponse deletePlanVersion(String planId, DeletePlanVersionRequest request) { - return this.rawClient.deletePlanVersion(planId, request).body(); + public DeletePlanVersionResponse deletePlanVersion(String planVersionId, DeletePlanVersionRequest request) { + return this.rawClient.deletePlanVersion(planVersionId, request).body(); } public DeletePlanVersionResponse deletePlanVersion( - String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { - return this.rawClient.deletePlanVersion(planId, request, requestOptions).body(); + String planVersionId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + return this.rawClient + .deletePlanVersion(planVersionId, request, requestOptions) + .body(); } - public PublishPlanVersionResponse publishPlanVersion(String planId, PublishPlanVersionRequestBody request) { - return this.rawClient.publishPlanVersion(planId, request).body(); + public PublishPlanVersionResponse publishPlanVersion(String planVersionId, PublishPlanVersionRequestBody request) { + return this.rawClient.publishPlanVersion(planVersionId, request).body(); } public PublishPlanVersionResponse publishPlanVersion( - String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + String planVersionId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { return this.rawClient - .publishPlanVersion(planId, request, requestOptions) + .publishPlanVersion(planVersionId, request, requestOptions) .body(); } } diff --git a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java index fe8e855..cb170cc 100644 --- a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java @@ -72,16 +72,16 @@ public RawPlansClient(ClientOptions clientOptions) { } public BaseSchematicHttpResponse updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request) { - return updateCompanyPlans(companyPlanId, request, null); + String companyId, UpdateCompanyPlansRequestBody request) { + return updateCompanyPlans(companyId, request, null); } public BaseSchematicHttpResponse updateCompanyPlans( - String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { + String companyId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-plans") - .addPathSegment(companyPlanId); + .addPathSegment(companyId); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -180,6 +180,13 @@ public BaseSchematicHttpResponse listCustomPlanB QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().get(), false); } + if (request.getPlanBillingSource().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "plan_billing_source", + request.getPlanBillingSource().get(), + false); + } if (request.getStatus().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "status", request.getStatus().get(), false); @@ -1563,26 +1570,28 @@ public BaseSchematicHttpResponse listPlanIssues( } } - public BaseSchematicHttpResponse deletePlanVersion(String planId) { - return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build()); + public BaseSchematicHttpResponse deletePlanVersion(String planVersionId) { + return deletePlanVersion( + planVersionId, DeletePlanVersionRequest.builder().build()); } public BaseSchematicHttpResponse deletePlanVersion( - String planId, RequestOptions requestOptions) { - return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build(), requestOptions); + String planVersionId, RequestOptions requestOptions) { + return deletePlanVersion( + planVersionId, DeletePlanVersionRequest.builder().build(), requestOptions); } public BaseSchematicHttpResponse deletePlanVersion( - String planId, DeletePlanVersionRequest request) { - return deletePlanVersion(planId, request, null); + String planVersionId, DeletePlanVersionRequest request) { + return deletePlanVersion(planVersionId, request, null); } public BaseSchematicHttpResponse deletePlanVersion( - String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + String planVersionId, DeletePlanVersionRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planId); + .addPathSegment(planVersionId); if (request.getPromoteArchivedVersion().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -1654,16 +1663,16 @@ public BaseSchematicHttpResponse deletePlanVersion( } public BaseSchematicHttpResponse publishPlanVersion( - String planId, PublishPlanVersionRequestBody request) { - return publishPlanVersion(planId, request, null); + String planVersionId, PublishPlanVersionRequestBody request) { + return publishPlanVersion(planVersionId, request, null); } public BaseSchematicHttpResponse publishPlanVersion( - String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + String planVersionId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planId) + .addPathSegment(planVersionId) .addPathSegments("publish"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListCustomPlanBillingsRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListCustomPlanBillingsRequest.java index 457fed2..b58fc16 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/ListCustomPlanBillingsRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/ListCustomPlanBillingsRequest.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.CustomPlanBillingStatus; +import com.schematic.api.types.PlanBillingSource; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -29,6 +30,8 @@ public final class ListCustomPlanBillingsRequest { private final Optional planId; + private final Optional planBillingSource; + private final Optional status; private final Optional limit; @@ -41,6 +44,7 @@ private ListCustomPlanBillingsRequest( Optional> statuses, Optional companyId, Optional planId, + Optional planBillingSource, Optional status, Optional limit, Optional offset, @@ -48,6 +52,7 @@ private ListCustomPlanBillingsRequest( this.statuses = statuses; this.companyId = companyId; this.planId = planId; + this.planBillingSource = planBillingSource; this.status = status; this.limit = limit; this.offset = offset; @@ -78,6 +83,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter by the flow that created the billing record. Defaults to custom_plan. + */ + @JsonProperty("plan_billing_source") + public Optional getPlanBillingSource() { + return planBillingSource; + } + /** * @return Filter by billing status */ @@ -117,6 +130,7 @@ private boolean equalTo(ListCustomPlanBillingsRequest other) { return statuses.equals(other.statuses) && companyId.equals(other.companyId) && planId.equals(other.planId) + && planBillingSource.equals(other.planBillingSource) && status.equals(other.status) && limit.equals(other.limit) && offset.equals(other.offset); @@ -124,7 +138,14 @@ private boolean equalTo(ListCustomPlanBillingsRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.statuses, this.companyId, this.planId, this.status, this.limit, this.offset); + return Objects.hash( + this.statuses, + this.companyId, + this.planId, + this.planBillingSource, + this.status, + this.limit, + this.offset); } @java.lang.Override @@ -144,6 +165,8 @@ public static final class Builder { private Optional planId = Optional.empty(); + private Optional planBillingSource = Optional.empty(); + private Optional status = Optional.empty(); private Optional limit = Optional.empty(); @@ -159,6 +182,7 @@ public Builder from(ListCustomPlanBillingsRequest other) { statuses(other.getStatuses()); companyId(other.getCompanyId()); planId(other.getPlanId()); + planBillingSource(other.getPlanBillingSource()); status(other.getStatus()); limit(other.getLimit()); offset(other.getOffset()); @@ -212,6 +236,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter by the flow that created the billing record. Defaults to custom_plan.

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

Filter by billing status

*/ @@ -256,7 +294,7 @@ public Builder offset(Long offset) { public ListCustomPlanBillingsRequest build() { return new ListCustomPlanBillingsRequest( - statuses, companyId, planId, status, limit, offset, additionalProperties); + statuses, companyId, planId, planBillingSource, status, limit, offset, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java index 269ac75..dae7b13 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java @@ -15,6 +15,7 @@ import com.schematic.api.types.CheckoutFieldValue; import com.schematic.api.types.CustomPlanActivationStrategy; import com.schematic.api.types.CustomerBillingAddress; +import com.schematic.api.types.MigrationProrationBehavior; import com.schematic.api.types.PlanVersionMigrationStrategy; import com.schematic.api.types.TaxIdInput; import java.util.ArrayList; @@ -46,6 +47,8 @@ public final class PublishPlanVersionRequestBody { private final Optional phone; + private final Optional prorationBehavior; + private final Optional sendInvoice; private final Optional taxId; @@ -62,6 +65,7 @@ private PublishPlanVersionRequestBody( List excludedCompanyIds, PlanVersionMigrationStrategy migrationStrategy, Optional phone, + Optional prorationBehavior, Optional sendInvoice, Optional taxId, Map additionalProperties) { @@ -74,6 +78,7 @@ private PublishPlanVersionRequestBody( this.excludedCompanyIds = excludedCompanyIds; this.migrationStrategy = migrationStrategy; this.phone = phone; + this.prorationBehavior = prorationBehavior; this.sendInvoice = sendInvoice; this.taxId = taxId; this.additionalProperties = additionalProperties; @@ -124,6 +129,11 @@ public Optional getPhone() { return phone; } + @JsonProperty("proration_behavior") + public Optional getProrationBehavior() { + return prorationBehavior; + } + /** * @return Whether Stripe emails the invoice when it is finalized. Defaults to true. */ @@ -158,6 +168,7 @@ private boolean equalTo(PublishPlanVersionRequestBody other) { && excludedCompanyIds.equals(other.excludedCompanyIds) && migrationStrategy.equals(other.migrationStrategy) && phone.equals(other.phone) + && prorationBehavior.equals(other.prorationBehavior) && sendInvoice.equals(other.sendInvoice) && taxId.equals(other.taxId); } @@ -174,6 +185,7 @@ public int hashCode() { this.excludedCompanyIds, this.migrationStrategy, this.phone, + this.prorationBehavior, this.sendInvoice, this.taxId); } @@ -234,6 +246,10 @@ public interface _FinalStage { _FinalStage phone(String phone); + _FinalStage prorationBehavior(Optional prorationBehavior); + + _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior); + /** *

Whether Stripe emails the invoice when it is finalized. Defaults to true.

*/ @@ -254,6 +270,8 @@ public static final class Builder implements MigrationStrategyStage, _FinalStage private Optional sendInvoice = Optional.empty(); + private Optional prorationBehavior = Optional.empty(); + private Optional phone = Optional.empty(); private List excludedCompanyIds = new ArrayList<>(); @@ -286,6 +304,7 @@ public Builder from(PublishPlanVersionRequestBody other) { excludedCompanyIds(other.getExcludedCompanyIds()); migrationStrategy(other.getMigrationStrategy()); phone(other.getPhone()); + prorationBehavior(other.getProrationBehavior()); sendInvoice(other.getSendInvoice()); taxId(other.getTaxId()); return this; @@ -331,6 +350,19 @@ public _FinalStage sendInvoice(Optional sendInvoice) { return this; } + @java.lang.Override + public _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior) { + this.prorationBehavior = Optional.ofNullable(prorationBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "proration_behavior", nulls = Nulls.SKIP) + public _FinalStage prorationBehavior(Optional prorationBehavior) { + this.prorationBehavior = prorationBehavior; + return this; + } + @java.lang.Override public _FinalStage phone(String phone) { this.phone = Optional.ofNullable(phone); @@ -458,6 +490,7 @@ public PublishPlanVersionRequestBody build() { excludedCompanyIds, migrationStrategy, phone, + prorationBehavior, sendInvoice, taxId, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListCustomPlanBillingsParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListCustomPlanBillingsParams.java index 74e0965..a7cb055 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListCustomPlanBillingsParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListCustomPlanBillingsParams.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.CustomPlanBillingStatus; +import com.schematic.api.types.PlanBillingSource; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,6 +29,8 @@ public final class ListCustomPlanBillingsParams { private final Optional offset; + private final Optional planBillingSource; + private final Optional planId; private final Optional status; @@ -40,6 +43,7 @@ private ListCustomPlanBillingsParams( Optional companyId, Optional limit, Optional offset, + Optional planBillingSource, Optional planId, Optional status, Optional> statuses, @@ -47,6 +51,7 @@ private ListCustomPlanBillingsParams( this.companyId = companyId; this.limit = limit; this.offset = offset; + this.planBillingSource = planBillingSource; this.planId = planId; this.status = status; this.statuses = statuses; @@ -77,6 +82,14 @@ public Optional getOffset() { return offset; } + /** + * @return Filter by the flow that created the billing record. Defaults to custom_plan. + */ + @JsonProperty("plan_billing_source") + public Optional getPlanBillingSource() { + return planBillingSource; + } + /** * @return Filter by plan ID */ @@ -116,6 +129,7 @@ private boolean equalTo(ListCustomPlanBillingsParams other) { return companyId.equals(other.companyId) && limit.equals(other.limit) && offset.equals(other.offset) + && planBillingSource.equals(other.planBillingSource) && planId.equals(other.planId) && status.equals(other.status) && statuses.equals(other.statuses); @@ -123,7 +137,14 @@ private boolean equalTo(ListCustomPlanBillingsParams other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.limit, this.offset, this.planId, this.status, this.statuses); + return Objects.hash( + this.companyId, + this.limit, + this.offset, + this.planBillingSource, + this.planId, + this.status, + this.statuses); } @java.lang.Override @@ -143,6 +164,8 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional planBillingSource = Optional.empty(); + private Optional planId = Optional.empty(); private Optional status = Optional.empty(); @@ -158,6 +181,7 @@ public Builder from(ListCustomPlanBillingsParams other) { companyId(other.getCompanyId()); limit(other.getLimit()); offset(other.getOffset()); + planBillingSource(other.getPlanBillingSource()); planId(other.getPlanId()); status(other.getStatus()); statuses(other.getStatuses()); @@ -206,6 +230,20 @@ public Builder offset(Long offset) { return this; } + /** + *

Filter by the flow that created the billing record. Defaults to custom_plan.

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

Filter by plan ID

*/ @@ -250,7 +288,7 @@ public Builder statuses(List statuses) { public ListCustomPlanBillingsParams build() { return new ListCustomPlanBillingsParams( - companyId, limit, offset, planId, status, statuses, additionalProperties); + companyId, limit, offset, planBillingSource, planId, status, statuses, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/BillingCollectionMethod.java b/src/main/java/com/schematic/api/types/BillingCollectionMethod.java new file mode 100644 index 0000000..855fa10 --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingCollectionMethod.java @@ -0,0 +1,86 @@ +/** + * 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 BillingCollectionMethod { + public static final BillingCollectionMethod CHARGE_AUTOMATICALLY = + new BillingCollectionMethod(Value.CHARGE_AUTOMATICALLY, "charge_automatically"); + + public static final BillingCollectionMethod SEND_INVOICE = + new BillingCollectionMethod(Value.SEND_INVOICE, "send_invoice"); + + private final Value value; + + private final String string; + + BillingCollectionMethod(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 BillingCollectionMethod + && this.string.equals(((BillingCollectionMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CHARGE_AUTOMATICALLY: + return visitor.visitChargeAutomatically(); + case SEND_INVOICE: + return visitor.visitSendInvoice(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BillingCollectionMethod valueOf(String value) { + switch (value) { + case "charge_automatically": + return CHARGE_AUTOMATICALLY; + case "send_invoice": + return SEND_INVOICE; + default: + return new BillingCollectionMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + CHARGE_AUTOMATICALLY, + + SEND_INVOICE, + + UNKNOWN + } + + public interface Visitor { + T visitChargeAutomatically(); + + T visitSendInvoice(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java index 4d29635..446fcf9 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java @@ -28,6 +28,8 @@ public final class BillingCreditBundleResponseData { private final String bundleType; + private final List compatiblePlanIds; + private final OffsetDateTime createdAt; private final Optional creditDescription; @@ -71,6 +73,7 @@ public final class BillingCreditBundleResponseData { private BillingCreditBundleResponseData( Optional billingInvoiceId, String bundleType, + List compatiblePlanIds, OffsetDateTime createdAt, Optional creditDescription, Optional creditIcon, @@ -93,6 +96,7 @@ private BillingCreditBundleResponseData( Map additionalProperties) { this.billingInvoiceId = billingInvoiceId; this.bundleType = bundleType; + this.compatiblePlanIds = compatiblePlanIds; this.createdAt = createdAt; this.creditDescription = creditDescription; this.creditIcon = creditIcon; @@ -125,6 +129,14 @@ public String getBundleType() { return bundleType; } + /** + * @return Plans whose companies may purchase this bundle. Empty means the bundle is purchasable on every plan. + */ + @JsonProperty("compatible_plan_ids") + public List getCompatiblePlanIds() { + return compatiblePlanIds; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -234,6 +246,7 @@ public Map getAdditionalProperties() { private boolean equalTo(BillingCreditBundleResponseData other) { return billingInvoiceId.equals(other.billingInvoiceId) && bundleType.equals(other.bundleType) + && compatiblePlanIds.equals(other.compatiblePlanIds) && createdAt.equals(other.createdAt) && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) @@ -260,6 +273,7 @@ public int hashCode() { return Objects.hash( this.billingInvoiceId, this.bundleType, + this.compatiblePlanIds, this.createdAt, this.creditDescription, this.creditIcon, @@ -347,6 +361,15 @@ public interface _FinalStage { _FinalStage billingInvoiceId(String billingInvoiceId); + /** + *

Plans whose companies may purchase this bundle. Empty means the bundle is purchasable on every plan.

+ */ + _FinalStage compatiblePlanIds(List compatiblePlanIds); + + _FinalStage addCompatiblePlanIds(String compatiblePlanIds); + + _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage creditDescription(Optional creditDescription); _FinalStage creditDescription(String creditDescription); @@ -440,6 +463,8 @@ public static final class Builder private Optional creditDescription = Optional.empty(); + private List compatiblePlanIds = new ArrayList<>(); + private Optional billingInvoiceId = Optional.empty(); @JsonAnySetter @@ -451,6 +476,7 @@ private Builder() {} public Builder from(BillingCreditBundleResponseData other) { billingInvoiceId(other.getBillingInvoiceId()); bundleType(other.getBundleType()); + compatiblePlanIds(other.getCompatiblePlanIds()); createdAt(other.getCreatedAt()); creditDescription(other.getCreditDescription()); creditIcon(other.getCreditIcon()); @@ -678,6 +704,41 @@ public _FinalStage creditDescription(Optional creditDescription) { return this; } + /** + *

Plans whose companies may purchase this bundle. Empty means the bundle is purchasable on every plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { + if (compatiblePlanIds != null) { + this.compatiblePlanIds.addAll(compatiblePlanIds); + } + return this; + } + + /** + *

Plans whose companies may purchase this bundle. Empty means the bundle is purchasable on every plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addCompatiblePlanIds(String compatiblePlanIds) { + this.compatiblePlanIds.add(compatiblePlanIds); + return this; + } + + /** + *

Plans whose companies may purchase this bundle. Empty means the bundle is purchasable on every plan.

+ */ + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(List compatiblePlanIds) { + this.compatiblePlanIds.clear(); + if (compatiblePlanIds != null) { + this.compatiblePlanIds.addAll(compatiblePlanIds); + } + return this; + } + @java.lang.Override public _FinalStage billingInvoiceId(String billingInvoiceId) { this.billingInvoiceId = Optional.ofNullable(billingInvoiceId); @@ -696,6 +757,7 @@ public BillingCreditBundleResponseData build() { return new BillingCreditBundleResponseData( billingInvoiceId, bundleType, + compatiblePlanIds, createdAt, creditDescription, creditIcon, diff --git a/src/main/java/com/schematic/api/types/BillingCreditBundleView.java b/src/main/java/com/schematic/api/types/BillingCreditBundleView.java index f177988..cb625f8 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditBundleView.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleView.java @@ -26,6 +26,8 @@ public final class BillingCreditBundleView { private final String bundleType; + private final List compatiblePlanIds; + private final OffsetDateTime createdAt; private final Optional creditDescription; @@ -68,6 +70,7 @@ public final class BillingCreditBundleView { private BillingCreditBundleView( String bundleType, + List compatiblePlanIds, OffsetDateTime createdAt, Optional creditDescription, Optional creditIcon, @@ -89,6 +92,7 @@ private BillingCreditBundleView( OffsetDateTime updatedAt, Map additionalProperties) { this.bundleType = bundleType; + this.compatiblePlanIds = compatiblePlanIds; this.createdAt = createdAt; this.creditDescription = creditDescription; this.creditIcon = creditIcon; @@ -116,6 +120,11 @@ public String getBundleType() { return bundleType; } + @JsonProperty("compatible_plan_ids") + public List getCompatiblePlanIds() { + return compatiblePlanIds; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -224,6 +233,7 @@ public Map getAdditionalProperties() { private boolean equalTo(BillingCreditBundleView other) { return bundleType.equals(other.bundleType) + && compatiblePlanIds.equals(other.compatiblePlanIds) && createdAt.equals(other.createdAt) && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) @@ -249,6 +259,7 @@ private boolean equalTo(BillingCreditBundleView other) { public int hashCode() { return Objects.hash( this.bundleType, + this.compatiblePlanIds, this.createdAt, this.creditDescription, this.creditIcon, @@ -332,6 +343,12 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage compatiblePlanIds(List compatiblePlanIds); + + _FinalStage addCompatiblePlanIds(String compatiblePlanIds); + + _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage creditDescription(Optional creditDescription); _FinalStage creditDescription(String creditDescription); @@ -425,6 +442,8 @@ public static final class Builder private Optional creditDescription = Optional.empty(); + private List compatiblePlanIds = new ArrayList<>(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -433,6 +452,7 @@ private Builder() {} @java.lang.Override public Builder from(BillingCreditBundleView other) { bundleType(other.getBundleType()); + compatiblePlanIds(other.getCompatiblePlanIds()); createdAt(other.getCreatedAt()); creditDescription(other.getCreditDescription()); creditIcon(other.getCreditIcon()); @@ -660,10 +680,35 @@ public _FinalStage creditDescription(Optional creditDescription) { return this; } + @java.lang.Override + public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { + if (compatiblePlanIds != null) { + this.compatiblePlanIds.addAll(compatiblePlanIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addCompatiblePlanIds(String compatiblePlanIds) { + this.compatiblePlanIds.add(compatiblePlanIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(List compatiblePlanIds) { + this.compatiblePlanIds.clear(); + if (compatiblePlanIds != null) { + this.compatiblePlanIds.addAll(compatiblePlanIds); + } + return this; + } + @java.lang.Override public BillingCreditBundleView build() { return new BillingCreditBundleView( bundleType, + compatiblePlanIds, createdAt, creditDescription, creditIcon, diff --git a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java index 6d193a4..cffa22c 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java @@ -25,6 +25,8 @@ public final class BillingCreditGrantResponseData { private final String companyId; + private final Optional companyLicenseId; + private final String companyName; private final OffsetDateTime createdAt; @@ -43,6 +45,8 @@ public final class BillingCreditGrantResponseData { private final String id; + private final Optional licenseName; + private final Optional planId; private final Optional planName; @@ -81,6 +85,7 @@ public final class BillingCreditGrantResponseData { private BillingCreditGrantResponseData( String companyId, + Optional companyLicenseId, String companyName, OffsetDateTime createdAt, Optional creditIcon, @@ -90,6 +95,7 @@ private BillingCreditGrantResponseData( Optional expiresAt, BillingCreditGrantReason grantReason, String id, + Optional licenseName, Optional planId, Optional planName, Optional price, @@ -109,6 +115,7 @@ private BillingCreditGrantResponseData( Optional zeroedOutReason, Map additionalProperties) { this.companyId = companyId; + this.companyLicenseId = companyLicenseId; this.companyName = companyName; this.createdAt = createdAt; this.creditIcon = creditIcon; @@ -118,6 +125,7 @@ private BillingCreditGrantResponseData( this.expiresAt = expiresAt; this.grantReason = grantReason; this.id = id; + this.licenseName = licenseName; this.planId = planId; this.planName = planName; this.price = price; @@ -143,6 +151,14 @@ public String getCompanyId() { return companyId; } + /** + * @return The license instance this grant was issued for. Set only when a per-license plan grant issued it; null on a plan's own grant. + */ + @JsonProperty("company_license_id") + public Optional getCompanyLicenseId() { + return companyLicenseId; + } + @JsonProperty("company_name") public String getCompanyName() { return companyName; @@ -188,6 +204,14 @@ public String getId() { return id; } + /** + * @return Name of the license this grant was issued for, when it came from a per-license plan grant. + */ + @JsonProperty("license_name") + public Optional getLicenseName() { + return licenseName; + } + @JsonProperty("plan_id") public Optional getPlanId() { return planId; @@ -289,6 +313,7 @@ public Map getAdditionalProperties() { private boolean equalTo(BillingCreditGrantResponseData other) { return companyId.equals(other.companyId) + && companyLicenseId.equals(other.companyLicenseId) && companyName.equals(other.companyName) && createdAt.equals(other.createdAt) && creditIcon.equals(other.creditIcon) @@ -298,6 +323,7 @@ private boolean equalTo(BillingCreditGrantResponseData other) { && expiresAt.equals(other.expiresAt) && grantReason.equals(other.grantReason) && id.equals(other.id) + && licenseName.equals(other.licenseName) && planId.equals(other.planId) && planName.equals(other.planName) && price.equals(other.price) @@ -321,6 +347,7 @@ private boolean equalTo(BillingCreditGrantResponseData other) { public int hashCode() { return Objects.hash( this.companyId, + this.companyLicenseId, this.companyName, this.createdAt, this.creditIcon, @@ -330,6 +357,7 @@ public int hashCode() { this.expiresAt, this.grantReason, this.id, + this.licenseName, this.planId, this.planName, this.price, @@ -419,6 +447,13 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

The license instance this grant was issued for. Set only when a per-license plan grant issued it; null on a plan's own grant.

+ */ + _FinalStage companyLicenseId(Optional companyLicenseId); + + _FinalStage companyLicenseId(String companyLicenseId); + _FinalStage creditIcon(Optional creditIcon); _FinalStage creditIcon(String creditIcon); @@ -431,6 +466,13 @@ public interface _FinalStage { _FinalStage expiresAt(OffsetDateTime expiresAt); + /** + *

Name of the license this grant was issued for, when it came from a per-license plan grant.

+ */ + _FinalStage licenseName(Optional licenseName); + + _FinalStage licenseName(String licenseName); + _FinalStage planId(Optional planId); _FinalStage planId(String planId); @@ -543,12 +585,16 @@ public static final class Builder private Optional planId = Optional.empty(); + private Optional licenseName = Optional.empty(); + private Optional expiresAt = Optional.empty(); private Optional currency = Optional.empty(); private Optional creditIcon = Optional.empty(); + private Optional companyLicenseId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -557,6 +603,7 @@ private Builder() {} @java.lang.Override public Builder from(BillingCreditGrantResponseData other) { companyId(other.getCompanyId()); + companyLicenseId(other.getCompanyLicenseId()); companyName(other.getCompanyName()); createdAt(other.getCreatedAt()); creditIcon(other.getCreditIcon()); @@ -566,6 +613,7 @@ public Builder from(BillingCreditGrantResponseData other) { expiresAt(other.getExpiresAt()); grantReason(other.getGrantReason()); id(other.getId()); + licenseName(other.getLicenseName()); planId(other.getPlanId()); planName(other.getPlanName()); price(other.getPrice()); @@ -827,6 +875,26 @@ public _FinalStage planId(Optional planId) { return this; } + /** + *

Name of the license this grant was issued for, when it came from a per-license plan grant.

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

Name of the license this grant was issued for, when it came from a per-license plan grant.

+ */ + @java.lang.Override + @JsonSetter(value = "license_name", nulls = Nulls.SKIP) + public _FinalStage licenseName(Optional licenseName) { + this.licenseName = licenseName; + return this; + } + @java.lang.Override public _FinalStage expiresAt(OffsetDateTime expiresAt) { this.expiresAt = Optional.ofNullable(expiresAt); @@ -866,10 +934,31 @@ public _FinalStage creditIcon(Optional creditIcon) { return this; } + /** + *

The license instance this grant was issued for. Set only when a per-license plan grant issued it; null on a plan's own grant.

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

The license instance this grant was issued for. Set only when a per-license plan grant issued it; null on a plan's own grant.

+ */ + @java.lang.Override + @JsonSetter(value = "company_license_id", nulls = Nulls.SKIP) + public _FinalStage companyLicenseId(Optional companyLicenseId) { + this.companyLicenseId = companyLicenseId; + return this; + } + @java.lang.Override public BillingCreditGrantResponseData build() { return new BillingCreditGrantResponseData( companyId, + companyLicenseId, companyName, createdAt, creditIcon, @@ -879,6 +968,7 @@ public BillingCreditGrantResponseData build() { expiresAt, grantReason, id, + licenseName, planId, planName, price, diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index 06a6970..d6f6a82 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -44,6 +44,8 @@ public final class BillingPlanCreditGrantResponseData { private final boolean canBuyBundles; + private final long companyCreditAmount; + private final OffsetDateTime createdAt; private final Optional credit; @@ -102,6 +104,7 @@ private BillingPlanCreditGrantResponseData( Optional autoTopupThresholdCredits, Optional autoTopupThresholdPercent, boolean canBuyBundles, + long companyCreditAmount, OffsetDateTime createdAt, Optional credit, long creditAmount, @@ -136,6 +139,7 @@ private BillingPlanCreditGrantResponseData( this.autoTopupThresholdCredits = autoTopupThresholdCredits; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.canBuyBundles = canBuyBundles; + this.companyCreditAmount = companyCreditAmount; this.createdAt = createdAt; this.credit = credit; this.creditAmount = creditAmount; @@ -225,6 +229,14 @@ public boolean getCanBuyBundles() { return canBuyBundles; } + /** + * @return Credits granted once per company on top of the per-license amount. Always 0 when scaling is fixed. + */ + @JsonProperty("company_credit_amount") + public long getCompanyCreditAmount() { + return companyCreditAmount; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -380,6 +392,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && autoTopupThresholdCredits.equals(other.autoTopupThresholdCredits) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && canBuyBundles == other.canBuyBundles + && companyCreditAmount == other.companyCreditAmount && createdAt.equals(other.createdAt) && credit.equals(other.credit) && creditAmount == other.creditAmount @@ -418,6 +431,7 @@ public int hashCode() { this.autoTopupThresholdCredits, this.autoTopupThresholdPercent, this.canBuyBundles, + this.companyCreditAmount, this.createdAt, this.credit, this.creditAmount, @@ -475,7 +489,14 @@ public interface CanBuyBundlesStage { /** *

Whether buyers can purchase one-time credit bundles on this grant, independent of auto top-up availability.

*/ - CreatedAtStage canBuyBundles(boolean canBuyBundles); + CompanyCreditAmountStage canBuyBundles(boolean canBuyBundles); + } + + public interface CompanyCreditAmountStage { + /** + *

Credits granted once per company on top of the per-license amount. Always 0 when scaling is fixed.

+ */ + CreatedAtStage companyCreditAmount(long companyCreditAmount); } public interface CreatedAtStage { @@ -629,6 +650,7 @@ public static final class Builder AutoTopupEnabledStage, AutoTopupSelfServiceStage, CanBuyBundlesStage, + CompanyCreditAmountStage, CreatedAtStage, CreditAmountStage, CreditIdStage, @@ -648,6 +670,8 @@ public static final class Builder private boolean canBuyBundles; + private long companyCreditAmount; + private OffsetDateTime createdAt; private long creditAmount; @@ -724,6 +748,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { autoTopupThresholdCredits(other.getAutoTopupThresholdCredits()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); canBuyBundles(other.getCanBuyBundles()); + companyCreditAmount(other.getCompanyCreditAmount()); createdAt(other.getCreatedAt()); credit(other.getCredit()); creditAmount(other.getCreditAmount()); @@ -786,11 +811,22 @@ public CanBuyBundlesStage autoTopupSelfService(boolean autoTopupSelfService) { */ @java.lang.Override @JsonSetter("can_buy_bundles") - public CreatedAtStage canBuyBundles(boolean canBuyBundles) { + public CompanyCreditAmountStage canBuyBundles(boolean canBuyBundles) { this.canBuyBundles = canBuyBundles; return this; } + /** + *

Credits granted once per company on top of the per-license amount. Always 0 when scaling is fixed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_credit_amount") + public CreatedAtStage companyCreditAmount(long companyCreditAmount) { + this.companyCreditAmount = companyCreditAmount; + return this; + } + @java.lang.Override @JsonSetter("created_at") public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -1159,6 +1195,7 @@ public BillingPlanCreditGrantResponseData build() { autoTopupThresholdCredits, autoTopupThresholdPercent, canBuyBundles, + companyCreditAmount, createdAt, credit, creditAmount, diff --git a/src/main/java/com/schematic/api/types/CheckoutBundlePurchaseBehavior.java b/src/main/java/com/schematic/api/types/CheckoutBundlePurchaseBehavior.java new file mode 100644 index 0000000..bb28c9f --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutBundlePurchaseBehavior.java @@ -0,0 +1,86 @@ +/** + * 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 CheckoutBundlePurchaseBehavior { + public static final CheckoutBundlePurchaseBehavior QUANTITY = + new CheckoutBundlePurchaseBehavior(Value.QUANTITY, "quantity"); + + public static final CheckoutBundlePurchaseBehavior INDIVIDUAL = + new CheckoutBundlePurchaseBehavior(Value.INDIVIDUAL, "individual"); + + private final Value value; + + private final String string; + + CheckoutBundlePurchaseBehavior(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 CheckoutBundlePurchaseBehavior + && this.string.equals(((CheckoutBundlePurchaseBehavior) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case QUANTITY: + return visitor.visitQuantity(); + case INDIVIDUAL: + return visitor.visitIndividual(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutBundlePurchaseBehavior valueOf(String value) { + switch (value) { + case "quantity": + return QUANTITY; + case "individual": + return INDIVIDUAL; + default: + return new CheckoutBundlePurchaseBehavior(Value.UNKNOWN, value); + } + } + + public enum Value { + INDIVIDUAL, + + QUANTITY, + + UNKNOWN + } + + public interface Visitor { + T visitIndividual(); + + T visitQuantity(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java b/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java index fd9d53d..bb0dba2 100644 --- a/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java @@ -16,16 +16,21 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CheckoutSettingsResponseData.Builder.class) public final class CheckoutSettingsResponseData { + private final CheckoutBundlePurchaseBehavior bundlePurchaseBehavior; + private final boolean collectAddress; private final boolean collectEmail; private final boolean collectPhone; + private final boolean collectTaxId; + private final boolean optInEnabled; private final Optional optInText; @@ -35,22 +40,31 @@ public final class CheckoutSettingsResponseData { private final Map additionalProperties; private CheckoutSettingsResponseData( + CheckoutBundlePurchaseBehavior bundlePurchaseBehavior, boolean collectAddress, boolean collectEmail, boolean collectPhone, + boolean collectTaxId, boolean optInEnabled, Optional optInText, Optional optInTitle, Map additionalProperties) { + this.bundlePurchaseBehavior = bundlePurchaseBehavior; this.collectAddress = collectAddress; this.collectEmail = collectEmail; this.collectPhone = collectPhone; + this.collectTaxId = collectTaxId; this.optInEnabled = optInEnabled; this.optInText = optInText; this.optInTitle = optInTitle; this.additionalProperties = additionalProperties; } + @JsonProperty("bundle_purchase_behavior") + public CheckoutBundlePurchaseBehavior getBundlePurchaseBehavior() { + return bundlePurchaseBehavior; + } + @JsonProperty("collect_address") public boolean getCollectAddress() { return collectAddress; @@ -66,6 +80,11 @@ public boolean getCollectPhone() { return collectPhone; } + @JsonProperty("collect_tax_id") + public boolean getCollectTaxId() { + return collectTaxId; + } + @JsonProperty("opt_in_enabled") public boolean getOptInEnabled() { return optInEnabled; @@ -93,9 +112,11 @@ public Map getAdditionalProperties() { } private boolean equalTo(CheckoutSettingsResponseData other) { - return collectAddress == other.collectAddress + return bundlePurchaseBehavior.equals(other.bundlePurchaseBehavior) + && collectAddress == other.collectAddress && collectEmail == other.collectEmail && collectPhone == other.collectPhone + && collectTaxId == other.collectTaxId && optInEnabled == other.optInEnabled && optInText.equals(other.optInText) && optInTitle.equals(other.optInTitle); @@ -104,9 +125,11 @@ private boolean equalTo(CheckoutSettingsResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.bundlePurchaseBehavior, this.collectAddress, this.collectEmail, this.collectPhone, + this.collectTaxId, this.optInEnabled, this.optInText, this.optInTitle); @@ -117,22 +140,30 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CollectAddressStage builder() { + public static BundlePurchaseBehaviorStage builder() { return new Builder(); } - public interface CollectAddressStage { - CollectEmailStage collectAddress(boolean collectAddress); + public interface BundlePurchaseBehaviorStage { + CollectAddressStage bundlePurchaseBehavior(@NotNull CheckoutBundlePurchaseBehavior bundlePurchaseBehavior); Builder from(CheckoutSettingsResponseData other); } + public interface CollectAddressStage { + CollectEmailStage collectAddress(boolean collectAddress); + } + public interface CollectEmailStage { CollectPhoneStage collectEmail(boolean collectEmail); } public interface CollectPhoneStage { - OptInEnabledStage collectPhone(boolean collectPhone); + CollectTaxIdStage collectPhone(boolean collectPhone); + } + + public interface CollectTaxIdStage { + OptInEnabledStage collectTaxId(boolean collectTaxId); } public interface OptInEnabledStage { @@ -157,13 +188,23 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CollectAddressStage, CollectEmailStage, CollectPhoneStage, OptInEnabledStage, _FinalStage { + implements BundlePurchaseBehaviorStage, + CollectAddressStage, + CollectEmailStage, + CollectPhoneStage, + CollectTaxIdStage, + OptInEnabledStage, + _FinalStage { + private CheckoutBundlePurchaseBehavior bundlePurchaseBehavior; + private boolean collectAddress; private boolean collectEmail; private boolean collectPhone; + private boolean collectTaxId; + private boolean optInEnabled; private Optional optInTitle = Optional.empty(); @@ -177,15 +218,26 @@ private Builder() {} @java.lang.Override public Builder from(CheckoutSettingsResponseData other) { + bundlePurchaseBehavior(other.getBundlePurchaseBehavior()); collectAddress(other.getCollectAddress()); collectEmail(other.getCollectEmail()); collectPhone(other.getCollectPhone()); + collectTaxId(other.getCollectTaxId()); optInEnabled(other.getOptInEnabled()); optInText(other.getOptInText()); optInTitle(other.getOptInTitle()); return this; } + @java.lang.Override + @JsonSetter("bundle_purchase_behavior") + public CollectAddressStage bundlePurchaseBehavior( + @NotNull CheckoutBundlePurchaseBehavior bundlePurchaseBehavior) { + this.bundlePurchaseBehavior = + Objects.requireNonNull(bundlePurchaseBehavior, "bundlePurchaseBehavior must not be null"); + return this; + } + @java.lang.Override @JsonSetter("collect_address") public CollectEmailStage collectAddress(boolean collectAddress) { @@ -202,11 +254,18 @@ public CollectPhoneStage collectEmail(boolean collectEmail) { @java.lang.Override @JsonSetter("collect_phone") - public OptInEnabledStage collectPhone(boolean collectPhone) { + public CollectTaxIdStage collectPhone(boolean collectPhone) { this.collectPhone = collectPhone; return this; } + @java.lang.Override + @JsonSetter("collect_tax_id") + public OptInEnabledStage collectTaxId(boolean collectTaxId) { + this.collectTaxId = collectTaxId; + return this; + } + @java.lang.Override @JsonSetter("opt_in_enabled") public _FinalStage optInEnabled(boolean optInEnabled) { @@ -243,9 +302,11 @@ public _FinalStage optInText(Optional optInText) { @java.lang.Override public CheckoutSettingsResponseData build() { return new CheckoutSettingsResponseData( + bundlePurchaseBehavior, collectAddress, collectEmail, collectPhone, + collectTaxId, optInEnabled, optInText, optInTitle, diff --git a/src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java b/src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java index f350d68..a06b2dc 100644 --- a/src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java +++ b/src/main/java/com/schematic/api/types/CompanyBillingCheckoutSettings.java @@ -24,16 +24,20 @@ public final class CompanyBillingCheckoutSettings { private final boolean collectPhone; + private final boolean collectTaxId; + private final Map additionalProperties; private CompanyBillingCheckoutSettings( boolean collectAddress, boolean collectEmail, boolean collectPhone, + boolean collectTaxId, Map additionalProperties) { this.collectAddress = collectAddress; this.collectEmail = collectEmail; this.collectPhone = collectPhone; + this.collectTaxId = collectTaxId; this.additionalProperties = additionalProperties; } @@ -52,6 +56,11 @@ public boolean getCollectPhone() { return collectPhone; } + @JsonProperty("collect_tax_id") + public boolean getCollectTaxId() { + return collectTaxId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -66,12 +75,13 @@ public Map getAdditionalProperties() { private boolean equalTo(CompanyBillingCheckoutSettings other) { return collectAddress == other.collectAddress && collectEmail == other.collectEmail - && collectPhone == other.collectPhone; + && collectPhone == other.collectPhone + && collectTaxId == other.collectTaxId; } @java.lang.Override public int hashCode() { - return Objects.hash(this.collectAddress, this.collectEmail, this.collectPhone); + return Objects.hash(this.collectAddress, this.collectEmail, this.collectPhone, this.collectTaxId); } @java.lang.Override @@ -94,7 +104,11 @@ public interface CollectEmailStage { } public interface CollectPhoneStage { - _FinalStage collectPhone(boolean collectPhone); + CollectTaxIdStage collectPhone(boolean collectPhone); + } + + public interface CollectTaxIdStage { + _FinalStage collectTaxId(boolean collectTaxId); } public interface _FinalStage { @@ -107,13 +121,15 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CollectAddressStage, CollectEmailStage, CollectPhoneStage, _FinalStage { + implements CollectAddressStage, CollectEmailStage, CollectPhoneStage, CollectTaxIdStage, _FinalStage { private boolean collectAddress; private boolean collectEmail; private boolean collectPhone; + private boolean collectTaxId; + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,6 +140,7 @@ public Builder from(CompanyBillingCheckoutSettings other) { collectAddress(other.getCollectAddress()); collectEmail(other.getCollectEmail()); collectPhone(other.getCollectPhone()); + collectTaxId(other.getCollectTaxId()); return this; } @@ -143,14 +160,22 @@ public CollectPhoneStage collectEmail(boolean collectEmail) { @java.lang.Override @JsonSetter("collect_phone") - public _FinalStage collectPhone(boolean collectPhone) { + public CollectTaxIdStage collectPhone(boolean collectPhone) { this.collectPhone = collectPhone; return this; } + @java.lang.Override + @JsonSetter("collect_tax_id") + public _FinalStage collectTaxId(boolean collectTaxId) { + this.collectTaxId = collectTaxId; + return this; + } + @java.lang.Override public CompanyBillingCheckoutSettings build() { - return new CompanyBillingCheckoutSettings(collectAddress, collectEmail, collectPhone, additionalProperties); + return new CompanyBillingCheckoutSettings( + collectAddress, collectEmail, collectPhone, collectTaxId, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java b/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java index 7b1e4dc..5f0fa2c 100644 --- a/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java +++ b/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java @@ -25,6 +25,10 @@ public final class CompanyFeatureUsageExportMetadata { private final Optional> creditTypeIds; + private final Optional> entityKeyDefinitionIds; + + private final Optional> entityTraitDefinitionIds; + private final Optional> featureIds; private final Optional hasScheduledDowngrade; @@ -66,6 +70,8 @@ public final class CompanyFeatureUsageExportMetadata { private CompanyFeatureUsageExportMetadata( Optional> companyIds, Optional> creditTypeIds, + Optional> entityKeyDefinitionIds, + Optional> entityTraitDefinitionIds, Optional> featureIds, Optional hasScheduledDowngrade, Optional monetizedSubscriptions, @@ -87,6 +93,8 @@ private CompanyFeatureUsageExportMetadata( Map additionalProperties) { this.companyIds = companyIds; this.creditTypeIds = creditTypeIds; + this.entityKeyDefinitionIds = entityKeyDefinitionIds; + this.entityTraitDefinitionIds = entityTraitDefinitionIds; this.featureIds = featureIds; this.hasScheduledDowngrade = hasScheduledDowngrade; this.monetizedSubscriptions = monetizedSubscriptions; @@ -124,6 +132,22 @@ public Optional> getCreditTypeIds() { return creditTypeIds; } + /** + * @return Company key definition IDs to include as columns, one column per definition, mirroring the companies list + */ + @JsonProperty("entity_key_definition_ids") + public Optional> getEntityKeyDefinitionIds() { + return entityKeyDefinitionIds; + } + + /** + * @return Company trait definition IDs to include as columns, one column per definition, mirroring the companies list + */ + @JsonProperty("entity_trait_definition_ids") + public Optional> getEntityTraitDefinitionIds() { + return entityTraitDefinitionIds; + } + /** * @return Schematic feature IDs (starting with 'feat_') to include as usage columns; empty means no usage columns */ @@ -282,6 +306,8 @@ public Map getAdditionalProperties() { private boolean equalTo(CompanyFeatureUsageExportMetadata other) { return companyIds.equals(other.companyIds) && creditTypeIds.equals(other.creditTypeIds) + && entityKeyDefinitionIds.equals(other.entityKeyDefinitionIds) + && entityTraitDefinitionIds.equals(other.entityTraitDefinitionIds) && featureIds.equals(other.featureIds) && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) && monetizedSubscriptions.equals(other.monetizedSubscriptions) @@ -307,6 +333,8 @@ public int hashCode() { return Objects.hash( this.companyIds, this.creditTypeIds, + this.entityKeyDefinitionIds, + this.entityTraitDefinitionIds, this.featureIds, this.hasScheduledDowngrade, this.monetizedSubscriptions, @@ -342,6 +370,10 @@ public static final class Builder { private Optional> creditTypeIds = Optional.empty(); + private Optional> entityKeyDefinitionIds = Optional.empty(); + + private Optional> entityTraitDefinitionIds = Optional.empty(); + private Optional> featureIds = Optional.empty(); private Optional hasScheduledDowngrade = Optional.empty(); @@ -386,6 +418,8 @@ private Builder() {} public Builder from(CompanyFeatureUsageExportMetadata other) { companyIds(other.getCompanyIds()); creditTypeIds(other.getCreditTypeIds()); + entityKeyDefinitionIds(other.getEntityKeyDefinitionIds()); + entityTraitDefinitionIds(other.getEntityTraitDefinitionIds()); featureIds(other.getFeatureIds()); hasScheduledDowngrade(other.getHasScheduledDowngrade()); monetizedSubscriptions(other.getMonetizedSubscriptions()); @@ -435,6 +469,34 @@ public Builder creditTypeIds(List creditTypeIds) { return this; } + /** + *

Company key definition IDs to include as columns, one column per definition, mirroring the companies list

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

Company trait definition IDs to include as columns, one column per definition, mirroring the companies list

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

Schematic feature IDs (starting with 'feat_') to include as usage columns; empty means no usage columns

*/ @@ -695,6 +757,8 @@ public CompanyFeatureUsageExportMetadata build() { return new CompanyFeatureUsageExportMetadata( companyIds, creditTypeIds, + entityKeyDefinitionIds, + entityTraitDefinitionIds, featureIds, hasScheduledDowngrade, monetizedSubscriptions, diff --git a/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java b/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java index 6275eda..e116aa7 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java @@ -50,6 +50,8 @@ public final class CompanyPlanCreditGrantView { private final Optional companyAutoTopupThresholdCredits; + private final long companyCreditAmount; + private final OffsetDateTime createdAt; private final Optional credit; @@ -113,6 +115,7 @@ private CompanyPlanCreditGrantView( Optional companyAutoTopupAmount, Optional companyAutoTopupEnabled, Optional companyAutoTopupThresholdCredits, + long companyCreditAmount, OffsetDateTime createdAt, Optional credit, long creditAmount, @@ -151,6 +154,7 @@ private CompanyPlanCreditGrantView( this.companyAutoTopupAmount = companyAutoTopupAmount; this.companyAutoTopupEnabled = companyAutoTopupEnabled; this.companyAutoTopupThresholdCredits = companyAutoTopupThresholdCredits; + this.companyCreditAmount = companyCreditAmount; this.createdAt = createdAt; this.credit = credit; this.creditAmount = creditAmount; @@ -247,6 +251,11 @@ public Optional getCompanyAutoTopupThresholdCredits() { return companyAutoTopupThresholdCredits; } + @JsonProperty("company_credit_amount") + public long getCompanyCreditAmount() { + return companyCreditAmount; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -403,6 +412,7 @@ private boolean equalTo(CompanyPlanCreditGrantView other) { && companyAutoTopupAmount.equals(other.companyAutoTopupAmount) && companyAutoTopupEnabled.equals(other.companyAutoTopupEnabled) && companyAutoTopupThresholdCredits.equals(other.companyAutoTopupThresholdCredits) + && companyCreditAmount == other.companyCreditAmount && createdAt.equals(other.createdAt) && credit.equals(other.credit) && creditAmount == other.creditAmount @@ -445,6 +455,7 @@ public int hashCode() { this.companyAutoTopupAmount, this.companyAutoTopupEnabled, this.companyAutoTopupThresholdCredits, + this.companyCreditAmount, this.createdAt, this.credit, this.creditAmount, @@ -490,7 +501,11 @@ public interface BillingCreditAutoTopupSelfServiceStage { } public interface BillingCreditCanBuyBundlesStage { - CreatedAtStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles); + CompanyCreditAmountStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles); + } + + public interface CompanyCreditAmountStage { + CreatedAtStage companyCreditAmount(long companyCreditAmount); } public interface CreatedAtStage { @@ -661,6 +676,7 @@ public static final class Builder implements BillingCreditAutoTopupEnabledStage, BillingCreditAutoTopupSelfServiceStage, BillingCreditCanBuyBundlesStage, + CompanyCreditAmountStage, CreatedAtStage, CreditAmountStage, CreditDescriptionStage, @@ -679,6 +695,8 @@ public static final class Builder private boolean billingCreditCanBuyBundles; + private long companyCreditAmount; + private OffsetDateTime createdAt; private long creditAmount; @@ -768,6 +786,7 @@ public Builder from(CompanyPlanCreditGrantView other) { companyAutoTopupAmount(other.getCompanyAutoTopupAmount()); companyAutoTopupEnabled(other.getCompanyAutoTopupEnabled()); companyAutoTopupThresholdCredits(other.getCompanyAutoTopupThresholdCredits()); + companyCreditAmount(other.getCompanyCreditAmount()); createdAt(other.getCreatedAt()); credit(other.getCredit()); creditAmount(other.getCreditAmount()); @@ -812,11 +831,18 @@ public BillingCreditCanBuyBundlesStage billingCreditAutoTopupSelfService( @java.lang.Override @JsonSetter("billing_credit_can_buy_bundles") - public CreatedAtStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles) { + public CompanyCreditAmountStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles) { this.billingCreditCanBuyBundles = billingCreditCanBuyBundles; return this; } + @java.lang.Override + @JsonSetter("company_credit_amount") + public CreatedAtStage companyCreditAmount(long companyCreditAmount) { + this.companyCreditAmount = companyCreditAmount; + return this; + } + @java.lang.Override @JsonSetter("created_at") public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -1245,6 +1271,7 @@ public CompanyPlanCreditGrantView build() { companyAutoTopupAmount, companyAutoTopupEnabled, companyAutoTopupThresholdCredits, + companyCreditAmount, createdAt, credit, creditAmount, diff --git a/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java b/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java index 8ca0c55..ea7bcfe 100644 --- a/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java +++ b/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java @@ -19,12 +19,16 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ComponentCheckoutSettings.Builder.class) public final class ComponentCheckoutSettings { + private final CheckoutBundlePurchaseBehavior bundlePurchaseBehavior; + private final boolean collectAddress; private final boolean collectEmail; private final boolean collectPhone; + private final boolean collectTaxId; + private final ProrationBehavior prorationBehavior; private final boolean taxCollectionEnabled; @@ -32,20 +36,29 @@ public final class ComponentCheckoutSettings { private final Map additionalProperties; private ComponentCheckoutSettings( + CheckoutBundlePurchaseBehavior bundlePurchaseBehavior, boolean collectAddress, boolean collectEmail, boolean collectPhone, + boolean collectTaxId, ProrationBehavior prorationBehavior, boolean taxCollectionEnabled, Map additionalProperties) { + this.bundlePurchaseBehavior = bundlePurchaseBehavior; this.collectAddress = collectAddress; this.collectEmail = collectEmail; this.collectPhone = collectPhone; + this.collectTaxId = collectTaxId; this.prorationBehavior = prorationBehavior; this.taxCollectionEnabled = taxCollectionEnabled; this.additionalProperties = additionalProperties; } + @JsonProperty("bundle_purchase_behavior") + public CheckoutBundlePurchaseBehavior getBundlePurchaseBehavior() { + return bundlePurchaseBehavior; + } + @JsonProperty("collect_address") public boolean getCollectAddress() { return collectAddress; @@ -61,6 +74,11 @@ public boolean getCollectPhone() { return collectPhone; } + @JsonProperty("collect_tax_id") + public boolean getCollectTaxId() { + return collectTaxId; + } + @JsonProperty("proration_behavior") public ProrationBehavior getProrationBehavior() { return prorationBehavior; @@ -83,9 +101,11 @@ public Map getAdditionalProperties() { } private boolean equalTo(ComponentCheckoutSettings other) { - return collectAddress == other.collectAddress + return bundlePurchaseBehavior.equals(other.bundlePurchaseBehavior) + && collectAddress == other.collectAddress && collectEmail == other.collectEmail && collectPhone == other.collectPhone + && collectTaxId == other.collectTaxId && prorationBehavior.equals(other.prorationBehavior) && taxCollectionEnabled == other.taxCollectionEnabled; } @@ -93,9 +113,11 @@ private boolean equalTo(ComponentCheckoutSettings other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.bundlePurchaseBehavior, this.collectAddress, this.collectEmail, this.collectPhone, + this.collectTaxId, this.prorationBehavior, this.taxCollectionEnabled); } @@ -105,22 +127,30 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CollectAddressStage builder() { + public static BundlePurchaseBehaviorStage builder() { return new Builder(); } - public interface CollectAddressStage { - CollectEmailStage collectAddress(boolean collectAddress); + public interface BundlePurchaseBehaviorStage { + CollectAddressStage bundlePurchaseBehavior(@NotNull CheckoutBundlePurchaseBehavior bundlePurchaseBehavior); Builder from(ComponentCheckoutSettings other); } + public interface CollectAddressStage { + CollectEmailStage collectAddress(boolean collectAddress); + } + public interface CollectEmailStage { CollectPhoneStage collectEmail(boolean collectEmail); } public interface CollectPhoneStage { - ProrationBehaviorStage collectPhone(boolean collectPhone); + CollectTaxIdStage collectPhone(boolean collectPhone); + } + + public interface CollectTaxIdStage { + ProrationBehaviorStage collectTaxId(boolean collectTaxId); } public interface ProrationBehaviorStage { @@ -141,18 +171,24 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CollectAddressStage, + implements BundlePurchaseBehaviorStage, + CollectAddressStage, CollectEmailStage, CollectPhoneStage, + CollectTaxIdStage, ProrationBehaviorStage, TaxCollectionEnabledStage, _FinalStage { + private CheckoutBundlePurchaseBehavior bundlePurchaseBehavior; + private boolean collectAddress; private boolean collectEmail; private boolean collectPhone; + private boolean collectTaxId; + private ProrationBehavior prorationBehavior; private boolean taxCollectionEnabled; @@ -164,14 +200,25 @@ private Builder() {} @java.lang.Override public Builder from(ComponentCheckoutSettings other) { + bundlePurchaseBehavior(other.getBundlePurchaseBehavior()); collectAddress(other.getCollectAddress()); collectEmail(other.getCollectEmail()); collectPhone(other.getCollectPhone()); + collectTaxId(other.getCollectTaxId()); prorationBehavior(other.getProrationBehavior()); taxCollectionEnabled(other.getTaxCollectionEnabled()); return this; } + @java.lang.Override + @JsonSetter("bundle_purchase_behavior") + public CollectAddressStage bundlePurchaseBehavior( + @NotNull CheckoutBundlePurchaseBehavior bundlePurchaseBehavior) { + this.bundlePurchaseBehavior = + Objects.requireNonNull(bundlePurchaseBehavior, "bundlePurchaseBehavior must not be null"); + return this; + } + @java.lang.Override @JsonSetter("collect_address") public CollectEmailStage collectAddress(boolean collectAddress) { @@ -188,11 +235,18 @@ public CollectPhoneStage collectEmail(boolean collectEmail) { @java.lang.Override @JsonSetter("collect_phone") - public ProrationBehaviorStage collectPhone(boolean collectPhone) { + public CollectTaxIdStage collectPhone(boolean collectPhone) { this.collectPhone = collectPhone; return this; } + @java.lang.Override + @JsonSetter("collect_tax_id") + public ProrationBehaviorStage collectTaxId(boolean collectTaxId) { + this.collectTaxId = collectTaxId; + return this; + } + @java.lang.Override @JsonSetter("proration_behavior") public TaxCollectionEnabledStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior) { @@ -210,9 +264,11 @@ public _FinalStage taxCollectionEnabled(boolean taxCollectionEnabled) { @java.lang.Override public ComponentCheckoutSettings build() { return new ComponentCheckoutSettings( + bundlePurchaseBehavior, collectAddress, collectEmail, collectPhone, + collectTaxId, prorationBehavior, taxCollectionEnabled, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index 3e3558b..3195363 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -45,6 +45,8 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional canBuyBundles; + private final Optional companyCreditAmount; + private final long creditAmount; private final String creditId; @@ -86,6 +88,7 @@ private CreateBillingPlanCreditGrantRequestBody( Optional autoTopupThresholdCredits, Optional autoTopupThresholdPercent, Optional canBuyBundles, + Optional companyCreditAmount, long creditAmount, String creditId, Optional expiryType, @@ -112,6 +115,7 @@ private CreateBillingPlanCreditGrantRequestBody( this.autoTopupThresholdCredits = autoTopupThresholdCredits; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.canBuyBundles = canBuyBundles; + this.companyCreditAmount = companyCreditAmount; this.creditAmount = creditAmount; this.creditId = creditId; this.expiryType = expiryType; @@ -188,6 +192,14 @@ public Optional getCanBuyBundles() { return canBuyBundles; } + /** + * @return Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0. + */ + @JsonProperty("company_credit_amount") + public Optional getCompanyCreditAmount() { + return companyCreditAmount; + } + @JsonProperty("credit_amount") public long getCreditAmount() { return creditAmount; @@ -287,6 +299,7 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { && autoTopupThresholdCredits.equals(other.autoTopupThresholdCredits) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && canBuyBundles.equals(other.canBuyBundles) + && companyCreditAmount.equals(other.companyCreditAmount) && creditAmount == other.creditAmount && creditId.equals(other.creditId) && expiryType.equals(other.expiryType) @@ -317,6 +330,7 @@ public int hashCode() { this.autoTopupThresholdCredits, this.autoTopupThresholdPercent, this.canBuyBundles, + this.companyCreditAmount, this.creditAmount, this.creditId, this.expiryType, @@ -418,6 +432,13 @@ public interface _FinalStage { _FinalStage canBuyBundles(Boolean canBuyBundles); + /** + *

Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0.

+ */ + _FinalStage companyCreditAmount(Optional companyCreditAmount); + + _FinalStage companyCreditAmount(Long companyCreditAmount); + _FinalStage expiryType(Optional expiryType); _FinalStage expiryType(BillingCreditExpiryType expiryType); @@ -489,6 +510,8 @@ public static final class Builder private Optional expiryType = Optional.empty(); + private Optional companyCreditAmount = Optional.empty(); + private Optional canBuyBundles = Optional.empty(); private Optional autoTopupThresholdPercent = Optional.empty(); @@ -532,6 +555,7 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { autoTopupThresholdCredits(other.getAutoTopupThresholdCredits()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); canBuyBundles(other.getCanBuyBundles()); + companyCreditAmount(other.getCompanyCreditAmount()); creditAmount(other.getCreditAmount()); creditId(other.getCreditId()); expiryType(other.getExpiryType()); @@ -708,6 +732,26 @@ public _FinalStage expiryType(Optional expiryType) { return this; } + /** + *

Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0.

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

Credits granted once per company on top of the per-license amount. Only valid when scaling is per_license. Defaults to 0.

+ */ + @java.lang.Override + @JsonSetter(value = "company_credit_amount", nulls = Nulls.SKIP) + public _FinalStage companyCreditAmount(Optional companyCreditAmount) { + this.companyCreditAmount = companyCreditAmount; + return this; + } + @java.lang.Override public _FinalStage canBuyBundles(Boolean canBuyBundles) { this.canBuyBundles = Optional.ofNullable(canBuyBundles); @@ -879,6 +923,7 @@ public CreateBillingPlanCreditGrantRequestBody build() { autoTopupThresholdCredits, autoTopupThresholdPercent, canBuyBundles, + companyCreditAmount, creditAmount, creditId, expiryType, diff --git a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java index f6de1cb..ca0acee 100644 --- a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java +++ b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java @@ -29,6 +29,8 @@ public final class CreditCompanyGrantView { private final String companyId; + private final Optional companyLicenseId; + private final String companyName; private final OffsetDateTime createdAt; @@ -55,6 +57,8 @@ public final class CreditCompanyGrantView { private final String id; + private final Optional licenseName; + private final Optional planId; private final Optional planName; @@ -99,6 +103,7 @@ private CreditCompanyGrantView( Optional billingCreditBundleId, String billingCreditId, String companyId, + Optional companyLicenseId, String companyName, OffsetDateTime createdAt, String creditDescription, @@ -112,6 +117,7 @@ private CreditCompanyGrantView( Optional expiryUnitCount, BillingCreditGrantReason grantReason, String id, + Optional licenseName, Optional planId, Optional planName, Optional pluralName, @@ -135,6 +141,7 @@ private CreditCompanyGrantView( this.billingCreditBundleId = billingCreditBundleId; this.billingCreditId = billingCreditId; this.companyId = companyId; + this.companyLicenseId = companyLicenseId; this.companyName = companyName; this.createdAt = createdAt; this.creditDescription = creditDescription; @@ -148,6 +155,7 @@ private CreditCompanyGrantView( this.expiryUnitCount = expiryUnitCount; this.grantReason = grantReason; this.id = id; + this.licenseName = licenseName; this.planId = planId; this.planName = planName; this.pluralName = pluralName; @@ -185,6 +193,11 @@ public String getCompanyId() { return companyId; } + @JsonProperty("company_license_id") + public Optional getCompanyLicenseId() { + return companyLicenseId; + } + @JsonProperty("company_name") public String getCompanyName() { return companyName; @@ -250,6 +263,11 @@ public String getId() { return id; } + @JsonProperty("license_name") + public Optional getLicenseName() { + return licenseName; + } + @JsonProperty("plan_id") public Optional getPlanId() { return planId; @@ -360,6 +378,7 @@ private boolean equalTo(CreditCompanyGrantView other) { return billingCreditBundleId.equals(other.billingCreditBundleId) && billingCreditId.equals(other.billingCreditId) && companyId.equals(other.companyId) + && companyLicenseId.equals(other.companyLicenseId) && companyName.equals(other.companyName) && createdAt.equals(other.createdAt) && creditDescription.equals(other.creditDescription) @@ -373,6 +392,7 @@ private boolean equalTo(CreditCompanyGrantView other) { && expiryUnitCount.equals(other.expiryUnitCount) && grantReason.equals(other.grantReason) && id.equals(other.id) + && licenseName.equals(other.licenseName) && planId.equals(other.planId) && planName.equals(other.planName) && pluralName.equals(other.pluralName) @@ -400,6 +420,7 @@ public int hashCode() { this.billingCreditBundleId, this.billingCreditId, this.companyId, + this.companyLicenseId, this.companyName, this.createdAt, this.creditDescription, @@ -413,6 +434,7 @@ public int hashCode() { this.expiryUnitCount, this.grantReason, this.id, + this.licenseName, this.planId, this.planName, this.pluralName, @@ -512,6 +534,10 @@ public interface _FinalStage { _FinalStage billingCreditBundleId(String billingCreditBundleId); + _FinalStage companyLicenseId(Optional companyLicenseId); + + _FinalStage companyLicenseId(String companyLicenseId); + _FinalStage creditIcon(Optional creditIcon); _FinalStage creditIcon(String creditIcon); @@ -540,6 +566,10 @@ public interface _FinalStage { _FinalStage expiryUnitCount(Long expiryUnitCount); + _FinalStage licenseName(Optional licenseName); + + _FinalStage licenseName(String licenseName); + _FinalStage planId(Optional planId); _FinalStage planId(String planId); @@ -664,6 +694,8 @@ public static final class Builder private Optional planId = Optional.empty(); + private Optional licenseName = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -678,6 +710,8 @@ public static final class Builder private Optional creditIcon = Optional.empty(); + private Optional companyLicenseId = Optional.empty(); + private Optional billingCreditBundleId = Optional.empty(); @JsonAnySetter @@ -690,6 +724,7 @@ public Builder from(CreditCompanyGrantView other) { billingCreditBundleId(other.getBillingCreditBundleId()); billingCreditId(other.getBillingCreditId()); companyId(other.getCompanyId()); + companyLicenseId(other.getCompanyLicenseId()); companyName(other.getCompanyName()); createdAt(other.getCreatedAt()); creditDescription(other.getCreditDescription()); @@ -703,6 +738,7 @@ public Builder from(CreditCompanyGrantView other) { expiryUnitCount(other.getExpiryUnitCount()); grantReason(other.getGrantReason()); id(other.getId()); + licenseName(other.getLicenseName()); planId(other.getPlanId()); planName(other.getPlanName()); pluralName(other.getPluralName()); @@ -992,6 +1028,19 @@ public _FinalStage planId(Optional planId) { return this; } + @java.lang.Override + public _FinalStage licenseName(String licenseName) { + this.licenseName = Optional.ofNullable(licenseName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "license_name", nulls = Nulls.SKIP) + public _FinalStage licenseName(Optional licenseName) { + this.licenseName = licenseName; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -1083,6 +1132,19 @@ public _FinalStage creditIcon(Optional creditIcon) { return this; } + @java.lang.Override + public _FinalStage companyLicenseId(String companyLicenseId) { + this.companyLicenseId = Optional.ofNullable(companyLicenseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_license_id", nulls = Nulls.SKIP) + public _FinalStage companyLicenseId(Optional companyLicenseId) { + this.companyLicenseId = companyLicenseId; + return this; + } + @java.lang.Override public _FinalStage billingCreditBundleId(String billingCreditBundleId) { this.billingCreditBundleId = Optional.ofNullable(billingCreditBundleId); @@ -1102,6 +1164,7 @@ public CreditCompanyGrantView build() { billingCreditBundleId, billingCreditId, companyId, + companyLicenseId, companyName, createdAt, creditDescription, @@ -1115,6 +1178,7 @@ public CreditCompanyGrantView build() { expiryUnitCount, grantReason, id, + licenseName, planId, planName, pluralName, diff --git a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java index 3ec4d9b..56ec3d0 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java @@ -24,6 +24,8 @@ public final class CustomPlanBillingResponseData { private final CustomPlanActivationStrategy activationStrategy; + private final Optional billingCycleAnchor; + private final String companyId; private final OffsetDateTime createdAt; @@ -36,6 +38,8 @@ public final class CustomPlanBillingResponseData { private final Optional paidAt; + private final PlanBillingSource planBillingSource; + private final String planId; private final Optional publishedAt; @@ -52,12 +56,14 @@ public final class CustomPlanBillingResponseData { private CustomPlanBillingResponseData( CustomPlanActivationStrategy activationStrategy, + Optional billingCycleAnchor, String companyId, OffsetDateTime createdAt, long daysUntilDue, Optional externalInvoiceId, String id, Optional paidAt, + PlanBillingSource planBillingSource, String planId, Optional publishedAt, boolean sendInvoice, @@ -66,12 +72,14 @@ private CustomPlanBillingResponseData( OffsetDateTime updatedAt, Map additionalProperties) { this.activationStrategy = activationStrategy; + this.billingCycleAnchor = billingCycleAnchor; this.companyId = companyId; this.createdAt = createdAt; this.daysUntilDue = daysUntilDue; this.externalInvoiceId = externalInvoiceId; this.id = id; this.paidAt = paidAt; + this.planBillingSource = planBillingSource; this.planId = planId; this.publishedAt = publishedAt; this.sendInvoice = sendInvoice; @@ -86,6 +94,14 @@ public CustomPlanActivationStrategy getActivationStrategy() { return activationStrategy; } + /** + * @return The billing period renewal date pinned when the subscription started, when one was set. When no invoice exists yet, the first invoice is raised on this date. + */ + @JsonProperty("billing_cycle_anchor") + public Optional getBillingCycleAnchor() { + return billingCycleAnchor; + } + @JsonProperty("company_id") public String getCompanyId() { return companyId; @@ -116,6 +132,14 @@ public Optional getPaidAt() { return paidAt; } + /** + * @return The flow that created this billing record: a custom plan, or a standard plan assigned by invoice through Manage Plan. + */ + @JsonProperty("plan_billing_source") + public PlanBillingSource getPlanBillingSource() { + return planBillingSource; + } + @JsonProperty("plan_id") public String getPlanId() { return planId; @@ -159,12 +183,14 @@ public Map getAdditionalProperties() { private boolean equalTo(CustomPlanBillingResponseData other) { return activationStrategy.equals(other.activationStrategy) + && billingCycleAnchor.equals(other.billingCycleAnchor) && companyId.equals(other.companyId) && createdAt.equals(other.createdAt) && daysUntilDue == other.daysUntilDue && externalInvoiceId.equals(other.externalInvoiceId) && id.equals(other.id) && paidAt.equals(other.paidAt) + && planBillingSource.equals(other.planBillingSource) && planId.equals(other.planId) && publishedAt.equals(other.publishedAt) && sendInvoice == other.sendInvoice @@ -177,12 +203,14 @@ private boolean equalTo(CustomPlanBillingResponseData other) { public int hashCode() { return Objects.hash( this.activationStrategy, + this.billingCycleAnchor, this.companyId, this.createdAt, this.daysUntilDue, this.externalInvoiceId, this.id, this.paidAt, + this.planBillingSource, this.planId, this.publishedAt, this.sendInvoice, @@ -219,7 +247,14 @@ public interface DaysUntilDueStage { } public interface IdStage { - PlanIdStage id(@NotNull String id); + PlanBillingSourceStage id(@NotNull String id); + } + + public interface PlanBillingSourceStage { + /** + *

The flow that created this billing record: a custom plan, or a standard plan assigned by invoice through Manage Plan.

+ */ + PlanIdStage planBillingSource(@NotNull PlanBillingSource planBillingSource); } public interface PlanIdStage { @@ -245,6 +280,13 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

The billing period renewal date pinned when the subscription started, when one was set. When no invoice exists yet, the first invoice is raised on this date.

+ */ + _FinalStage billingCycleAnchor(Optional billingCycleAnchor); + + _FinalStage billingCycleAnchor(OffsetDateTime billingCycleAnchor); + _FinalStage externalInvoiceId(Optional externalInvoiceId); _FinalStage externalInvoiceId(String externalInvoiceId); @@ -269,6 +311,7 @@ public static final class Builder CreatedAtStage, DaysUntilDueStage, IdStage, + PlanBillingSourceStage, PlanIdStage, SendInvoiceStage, StatusStage, @@ -284,6 +327,8 @@ public static final class Builder private String id; + private PlanBillingSource planBillingSource; + private String planId; private boolean sendInvoice; @@ -300,6 +345,8 @@ public static final class Builder private Optional externalInvoiceId = Optional.empty(); + private Optional billingCycleAnchor = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -308,12 +355,14 @@ private Builder() {} @java.lang.Override public Builder from(CustomPlanBillingResponseData other) { activationStrategy(other.getActivationStrategy()); + billingCycleAnchor(other.getBillingCycleAnchor()); companyId(other.getCompanyId()); createdAt(other.getCreatedAt()); daysUntilDue(other.getDaysUntilDue()); externalInvoiceId(other.getExternalInvoiceId()); id(other.getId()); paidAt(other.getPaidAt()); + planBillingSource(other.getPlanBillingSource()); planId(other.getPlanId()); publishedAt(other.getPublishedAt()); sendInvoice(other.getSendInvoice()); @@ -353,11 +402,22 @@ public IdStage daysUntilDue(long daysUntilDue) { @java.lang.Override @JsonSetter("id") - public PlanIdStage id(@NotNull String id) { + public PlanBillingSourceStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + /** + *

The flow that created this billing record: a custom plan, or a standard plan assigned by invoice through Manage Plan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("plan_billing_source") + public PlanIdStage planBillingSource(@NotNull PlanBillingSource planBillingSource) { + this.planBillingSource = Objects.requireNonNull(planBillingSource, "planBillingSource must not be null"); + return this; + } + @java.lang.Override @JsonSetter("plan_id") public SendInvoiceStage planId(@NotNull String planId) { @@ -438,16 +498,38 @@ public _FinalStage externalInvoiceId(Optional externalInvoiceId) { return this; } + /** + *

The billing period renewal date pinned when the subscription started, when one was set. When no invoice exists yet, the first invoice is raised on this date.

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

The billing period renewal date pinned when the subscription started, when one was set. When no invoice exists yet, the first invoice is raised on this date.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_cycle_anchor", nulls = Nulls.SKIP) + public _FinalStage billingCycleAnchor(Optional billingCycleAnchor) { + this.billingCycleAnchor = billingCycleAnchor; + return this; + } + @java.lang.Override public CustomPlanBillingResponseData build() { return new CustomPlanBillingResponseData( activationStrategy, + billingCycleAnchor, companyId, createdAt, daysUntilDue, externalInvoiceId, id, paidAt, + planBillingSource, planId, publishedAt, sendInvoice, diff --git a/src/main/java/com/schematic/api/types/EntityTraitDefinitionUsage.java b/src/main/java/com/schematic/api/types/EntityTraitDefinitionUsage.java new file mode 100644 index 0000000..74f1315 --- /dev/null +++ b/src/main/java/com/schematic/api/types/EntityTraitDefinitionUsage.java @@ -0,0 +1,259 @@ +/** + * 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 = EntityTraitDefinitionUsage.Builder.class) +public final class EntityTraitDefinitionUsage { + private final long checkoutFieldConfigCount; + + private final long companyOverrideCount; + + private final long featureCount; + + private final long planEntitlementCount; + + private final long planTraitCount; + + private final long ruleConditionCount; + + private final Map additionalProperties; + + private EntityTraitDefinitionUsage( + long checkoutFieldConfigCount, + long companyOverrideCount, + long featureCount, + long planEntitlementCount, + long planTraitCount, + long ruleConditionCount, + Map additionalProperties) { + this.checkoutFieldConfigCount = checkoutFieldConfigCount; + this.companyOverrideCount = companyOverrideCount; + this.featureCount = featureCount; + this.planEntitlementCount = planEntitlementCount; + this.planTraitCount = planTraitCount; + this.ruleConditionCount = ruleConditionCount; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("checkout_field_config_count") + public long getCheckoutFieldConfigCount() { + return checkoutFieldConfigCount; + } + + @JsonProperty("company_override_count") + public long getCompanyOverrideCount() { + return companyOverrideCount; + } + + @JsonProperty("feature_count") + public long getFeatureCount() { + return featureCount; + } + + @JsonProperty("plan_entitlement_count") + public long getPlanEntitlementCount() { + return planEntitlementCount; + } + + @JsonProperty("plan_trait_count") + public long getPlanTraitCount() { + return planTraitCount; + } + + @JsonProperty("rule_condition_count") + public long getRuleConditionCount() { + return ruleConditionCount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntityTraitDefinitionUsage && equalTo((EntityTraitDefinitionUsage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntityTraitDefinitionUsage other) { + return checkoutFieldConfigCount == other.checkoutFieldConfigCount + && companyOverrideCount == other.companyOverrideCount + && featureCount == other.featureCount + && planEntitlementCount == other.planEntitlementCount + && planTraitCount == other.planTraitCount + && ruleConditionCount == other.ruleConditionCount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.checkoutFieldConfigCount, + this.companyOverrideCount, + this.featureCount, + this.planEntitlementCount, + this.planTraitCount, + this.ruleConditionCount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CheckoutFieldConfigCountStage builder() { + return new Builder(); + } + + public interface CheckoutFieldConfigCountStage { + CompanyOverrideCountStage checkoutFieldConfigCount(long checkoutFieldConfigCount); + + Builder from(EntityTraitDefinitionUsage other); + } + + public interface CompanyOverrideCountStage { + FeatureCountStage companyOverrideCount(long companyOverrideCount); + } + + public interface FeatureCountStage { + PlanEntitlementCountStage featureCount(long featureCount); + } + + public interface PlanEntitlementCountStage { + PlanTraitCountStage planEntitlementCount(long planEntitlementCount); + } + + public interface PlanTraitCountStage { + RuleConditionCountStage planTraitCount(long planTraitCount); + } + + public interface RuleConditionCountStage { + _FinalStage ruleConditionCount(long ruleConditionCount); + } + + public interface _FinalStage { + EntityTraitDefinitionUsage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CheckoutFieldConfigCountStage, + CompanyOverrideCountStage, + FeatureCountStage, + PlanEntitlementCountStage, + PlanTraitCountStage, + RuleConditionCountStage, + _FinalStage { + private long checkoutFieldConfigCount; + + private long companyOverrideCount; + + private long featureCount; + + private long planEntitlementCount; + + private long planTraitCount; + + private long ruleConditionCount; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntityTraitDefinitionUsage other) { + checkoutFieldConfigCount(other.getCheckoutFieldConfigCount()); + companyOverrideCount(other.getCompanyOverrideCount()); + featureCount(other.getFeatureCount()); + planEntitlementCount(other.getPlanEntitlementCount()); + planTraitCount(other.getPlanTraitCount()); + ruleConditionCount(other.getRuleConditionCount()); + return this; + } + + @java.lang.Override + @JsonSetter("checkout_field_config_count") + public CompanyOverrideCountStage checkoutFieldConfigCount(long checkoutFieldConfigCount) { + this.checkoutFieldConfigCount = checkoutFieldConfigCount; + return this; + } + + @java.lang.Override + @JsonSetter("company_override_count") + public FeatureCountStage companyOverrideCount(long companyOverrideCount) { + this.companyOverrideCount = companyOverrideCount; + return this; + } + + @java.lang.Override + @JsonSetter("feature_count") + public PlanEntitlementCountStage featureCount(long featureCount) { + this.featureCount = featureCount; + return this; + } + + @java.lang.Override + @JsonSetter("plan_entitlement_count") + public PlanTraitCountStage planEntitlementCount(long planEntitlementCount) { + this.planEntitlementCount = planEntitlementCount; + return this; + } + + @java.lang.Override + @JsonSetter("plan_trait_count") + public RuleConditionCountStage planTraitCount(long planTraitCount) { + this.planTraitCount = planTraitCount; + return this; + } + + @java.lang.Override + @JsonSetter("rule_condition_count") + public _FinalStage ruleConditionCount(long ruleConditionCount) { + this.ruleConditionCount = ruleConditionCount; + return this; + } + + @java.lang.Override + public EntityTraitDefinitionUsage build() { + return new EntityTraitDefinitionUsage( + checkoutFieldConfigCount, + companyOverrideCount, + featureCount, + planEntitlementCount, + planTraitCount, + ruleConditionCount, + 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/GetOnboardingStateResp.java b/src/main/java/com/schematic/api/types/GetOnboardingStateResp.java new file mode 100644 index 0000000..8a3bc1a --- /dev/null +++ b/src/main/java/com/schematic/api/types/GetOnboardingStateResp.java @@ -0,0 +1,261 @@ +/** + * 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 = GetOnboardingStateResp.Builder.class) +public final class GetOnboardingStateResp { + private final Optional environmentId; + + private final List milestones; + + private final Optional path; + + private final List requirements; + + private final List suggestedNext; + + private final Optional track; + + private final Map additionalProperties; + + private GetOnboardingStateResp( + Optional environmentId, + List milestones, + Optional path, + List requirements, + List suggestedNext, + Optional track, + Map additionalProperties) { + this.environmentId = environmentId; + this.milestones = milestones; + this.path = path; + this.requirements = requirements; + this.suggestedNext = suggestedNext; + this.track = track; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + @JsonProperty("milestones") + public List getMilestones() { + return milestones; + } + + @JsonProperty("path") + public Optional getPath() { + return path; + } + + @JsonProperty("requirements") + public List getRequirements() { + return requirements; + } + + @JsonProperty("suggested_next") + public List getSuggestedNext() { + return suggestedNext; + } + + @JsonProperty("track") + public Optional getTrack() { + return track; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetOnboardingStateResp && equalTo((GetOnboardingStateResp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetOnboardingStateResp other) { + return environmentId.equals(other.environmentId) + && milestones.equals(other.milestones) + && path.equals(other.path) + && requirements.equals(other.requirements) + && suggestedNext.equals(other.suggestedNext) + && track.equals(other.track); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.environmentId, this.milestones, this.path, this.requirements, this.suggestedNext, this.track); + } + + @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 environmentId = Optional.empty(); + + private List milestones = new ArrayList<>(); + + private Optional path = Optional.empty(); + + private List requirements = new ArrayList<>(); + + private List suggestedNext = new ArrayList<>(); + + private Optional track = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetOnboardingStateResp other) { + environmentId(other.getEnvironmentId()); + milestones(other.getMilestones()); + path(other.getPath()); + requirements(other.getRequirements()); + suggestedNext(other.getSuggestedNext()); + track(other.getTrack()); + return this; + } + + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public Builder environmentId(Optional environmentId) { + this.environmentId = environmentId; + return this; + } + + public Builder environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); + return this; + } + + @JsonSetter(value = "milestones", nulls = Nulls.SKIP) + public Builder milestones(List milestones) { + this.milestones.clear(); + if (milestones != null) { + this.milestones.addAll(milestones); + } + return this; + } + + public Builder addMilestones(OnboardingMilestoneView milestones) { + this.milestones.add(milestones); + return this; + } + + public Builder addAllMilestones(List milestones) { + if (milestones != null) { + this.milestones.addAll(milestones); + } + return this; + } + + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public Builder path(Optional path) { + this.path = path; + return this; + } + + public Builder path(OnboardingPath path) { + this.path = Optional.ofNullable(path); + return this; + } + + @JsonSetter(value = "requirements", nulls = Nulls.SKIP) + public Builder requirements(List requirements) { + this.requirements.clear(); + if (requirements != null) { + this.requirements.addAll(requirements); + } + return this; + } + + public Builder addRequirements(OnboardingRequirementView requirements) { + this.requirements.add(requirements); + return this; + } + + public Builder addAllRequirements(List requirements) { + if (requirements != null) { + this.requirements.addAll(requirements); + } + return this; + } + + @JsonSetter(value = "suggested_next", nulls = Nulls.SKIP) + public Builder suggestedNext(List suggestedNext) { + this.suggestedNext.clear(); + if (suggestedNext != null) { + this.suggestedNext.addAll(suggestedNext); + } + return this; + } + + public Builder addSuggestedNext(OnboardingRequirement suggestedNext) { + this.suggestedNext.add(suggestedNext); + return this; + } + + public Builder addAllSuggestedNext(List suggestedNext) { + if (suggestedNext != null) { + this.suggestedNext.addAll(suggestedNext); + } + return this; + } + + @JsonSetter(value = "track", nulls = Nulls.SKIP) + public Builder track(Optional track) { + this.track = track; + return this; + } + + public Builder track(OnboardingTrack track) { + this.track = Optional.ofNullable(track); + return this; + } + + public GetOnboardingStateResp build() { + return new GetOnboardingStateResp( + environmentId, milestones, path, requirements, suggestedNext, track, 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/ManagePlanRequest.java b/src/main/java/com/schematic/api/types/ManagePlanRequest.java index 44c41c0..d139a7f 100644 --- a/src/main/java/com/schematic/api/types/ManagePlanRequest.java +++ b/src/main/java/com/schematic/api/types/ManagePlanRequest.java @@ -24,6 +24,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ManagePlanRequest.Builder.class) public final class ManagePlanRequest { + private final Optional activateOnPayment; + private final List addOnSelections; private final Optional basePlanId; @@ -32,10 +34,16 @@ public final class ManagePlanRequest { private final Optional basePlanVersionId; + private final Optional billingCycleAnchor; + + private final Optional billingEmail; + private final Optional billingEntityId; private final Optional cancelImmediately; + private final Optional collectionMethod; + private final String companyId; private final Optional couponExternalId; @@ -44,6 +52,8 @@ public final class ManagePlanRequest { private final List customFieldValues; + private final Optional daysUntilDue; + private final List payInAdvanceEntitlements; private final Optional paymentMethodExternalId; @@ -52,45 +62,71 @@ public final class ManagePlanRequest { private final Optional prorate; + private final Optional prorateFirstPeriod; + + private final Optional sendInvoice; + private final Optional trialEnd; private final Map additionalProperties; private ManagePlanRequest( + Optional activateOnPayment, List addOnSelections, Optional basePlanId, Optional basePlanPriceId, Optional basePlanVersionId, + Optional billingCycleAnchor, + Optional billingEmail, Optional billingEntityId, Optional cancelImmediately, + Optional collectionMethod, String companyId, Optional couponExternalId, List creditBundles, List customFieldValues, + Optional daysUntilDue, List payInAdvanceEntitlements, Optional paymentMethodExternalId, Optional promoCode, Optional prorate, + Optional prorateFirstPeriod, + Optional sendInvoice, Optional trialEnd, Map additionalProperties) { + this.activateOnPayment = activateOnPayment; this.addOnSelections = addOnSelections; this.basePlanId = basePlanId; this.basePlanPriceId = basePlanPriceId; this.basePlanVersionId = basePlanVersionId; + this.billingCycleAnchor = billingCycleAnchor; + this.billingEmail = billingEmail; this.billingEntityId = billingEntityId; this.cancelImmediately = cancelImmediately; + this.collectionMethod = collectionMethod; this.companyId = companyId; this.couponExternalId = couponExternalId; this.creditBundles = creditBundles; this.customFieldValues = customFieldValues; + this.daysUntilDue = daysUntilDue; this.payInAdvanceEntitlements = payInAdvanceEntitlements; this.paymentMethodExternalId = paymentMethodExternalId; this.promoCode = promoCode; this.prorate = prorate; + this.prorateFirstPeriod = prorateFirstPeriod; + this.sendInvoice = sendInvoice; this.trialEnd = trialEnd; this.additionalProperties = additionalProperties; } + /** + * @return If true, the company gets the plan only once the first invoice is paid. Only applies to an invoiced subscription. Defaults to false. + */ + @JsonProperty("activate_on_payment") + public Optional getActivateOnPayment() { + return activateOnPayment; + } + @JsonProperty("add_on_selections") public List getAddOnSelections() { return addOnSelections; @@ -111,6 +147,22 @@ public Optional getBasePlanVersionId() { return basePlanVersionId; } + /** + * @return The date the subscription's billing period renews on. Only honored when starting a new subscription; changing the anchor on an existing subscription is not supported. + */ + @JsonProperty("billing_cycle_anchor") + public Optional getBillingCycleAnchor() { + return billingCycleAnchor; + } + + /** + * @return Address the invoice is sent to. Required when collection_method is send_invoice. + */ + @JsonProperty("billing_email") + public Optional getBillingEmail() { + return billingEmail; + } + /** * @return The company that pays for this subscription. Must already have a Stripe customer. Only honored when starting a new subscription. */ @@ -127,6 +179,14 @@ public Optional getCancelImmediately() { return cancelImmediately; } + /** + * @return How the subscription is paid: charged to a payment method on file, or invoiced with payment terms. Invoicing is only available when starting a new subscription. Defaults to charge_automatically. + */ + @JsonProperty("collection_method") + public Optional getCollectionMethod() { + return collectionMethod; + } + @JsonProperty("company_id") public String getCompanyId() { return companyId; @@ -147,6 +207,14 @@ public List getCustomFieldValues() { return customFieldValues; } + /** + * @return Payment terms in days for an invoiced subscription. Defaults to 30. + */ + @JsonProperty("days_until_due") + public Optional getDaysUntilDue() { + return daysUntilDue; + } + @JsonProperty("pay_in_advance_entitlements") public List getPayInAdvanceEntitlements() { return payInAdvanceEntitlements; @@ -170,6 +238,22 @@ public Optional getProrate() { return prorate; } + /** + * @return When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true. + */ + @JsonProperty("prorate_first_period") + public Optional getProrateFirstPeriod() { + return prorateFirstPeriod; + } + + /** + * @return Whether Stripe emails the invoice when it is finalized. Only applies to an invoiced subscription. Defaults to true. + */ + @JsonProperty("send_invoice") + public Optional getSendInvoice() { + return sendInvoice; + } + @JsonProperty("trial_end") public Optional getTrialEnd() { return trialEnd; @@ -187,40 +271,54 @@ public Map getAdditionalProperties() { } private boolean equalTo(ManagePlanRequest other) { - return addOnSelections.equals(other.addOnSelections) + return activateOnPayment.equals(other.activateOnPayment) + && addOnSelections.equals(other.addOnSelections) && basePlanId.equals(other.basePlanId) && basePlanPriceId.equals(other.basePlanPriceId) && basePlanVersionId.equals(other.basePlanVersionId) + && billingCycleAnchor.equals(other.billingCycleAnchor) + && billingEmail.equals(other.billingEmail) && billingEntityId.equals(other.billingEntityId) && cancelImmediately.equals(other.cancelImmediately) + && collectionMethod.equals(other.collectionMethod) && companyId.equals(other.companyId) && couponExternalId.equals(other.couponExternalId) && creditBundles.equals(other.creditBundles) && customFieldValues.equals(other.customFieldValues) + && daysUntilDue.equals(other.daysUntilDue) && payInAdvanceEntitlements.equals(other.payInAdvanceEntitlements) && paymentMethodExternalId.equals(other.paymentMethodExternalId) && promoCode.equals(other.promoCode) && prorate.equals(other.prorate) + && prorateFirstPeriod.equals(other.prorateFirstPeriod) + && sendInvoice.equals(other.sendInvoice) && trialEnd.equals(other.trialEnd); } @java.lang.Override public int hashCode() { return Objects.hash( + this.activateOnPayment, this.addOnSelections, this.basePlanId, this.basePlanPriceId, this.basePlanVersionId, + this.billingCycleAnchor, + this.billingEmail, this.billingEntityId, this.cancelImmediately, + this.collectionMethod, this.companyId, this.couponExternalId, this.creditBundles, this.customFieldValues, + this.daysUntilDue, this.payInAdvanceEntitlements, this.paymentMethodExternalId, this.promoCode, this.prorate, + this.prorateFirstPeriod, + this.sendInvoice, this.trialEnd); } @@ -246,6 +344,13 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

If true, the company gets the plan only once the first invoice is paid. Only applies to an invoiced subscription. Defaults to false.

+ */ + _FinalStage activateOnPayment(Optional activateOnPayment); + + _FinalStage activateOnPayment(Boolean activateOnPayment); + _FinalStage addOnSelections(List addOnSelections); _FinalStage addAddOnSelections(PlanSelection addOnSelections); @@ -264,6 +369,20 @@ public interface _FinalStage { _FinalStage basePlanVersionId(String basePlanVersionId); + /** + *

The date the subscription's billing period renews on. Only honored when starting a new subscription; changing the anchor on an existing subscription is not supported.

+ */ + _FinalStage billingCycleAnchor(Optional billingCycleAnchor); + + _FinalStage billingCycleAnchor(OffsetDateTime billingCycleAnchor); + + /** + *

Address the invoice is sent to. Required when collection_method is send_invoice.

+ */ + _FinalStage billingEmail(Optional billingEmail); + + _FinalStage billingEmail(String billingEmail); + /** *

The company that pays for this subscription. Must already have a Stripe customer. Only honored when starting a new subscription.

*/ @@ -278,6 +397,13 @@ public interface _FinalStage { _FinalStage cancelImmediately(Boolean cancelImmediately); + /** + *

How the subscription is paid: charged to a payment method on file, or invoiced with payment terms. Invoicing is only available when starting a new subscription. Defaults to charge_automatically.

+ */ + _FinalStage collectionMethod(Optional collectionMethod); + + _FinalStage collectionMethod(BillingCollectionMethod collectionMethod); + _FinalStage couponExternalId(Optional couponExternalId); _FinalStage couponExternalId(String couponExternalId); @@ -294,6 +420,13 @@ public interface _FinalStage { _FinalStage addAllCustomFieldValues(List customFieldValues); + /** + *

Payment terms in days for an invoiced subscription. Defaults to 30.

+ */ + _FinalStage daysUntilDue(Optional daysUntilDue); + + _FinalStage daysUntilDue(Long daysUntilDue); + _FinalStage payInAdvanceEntitlements(List payInAdvanceEntitlements); _FinalStage addPayInAdvanceEntitlements(UpdatePayInAdvanceRequestBody payInAdvanceEntitlements); @@ -315,6 +448,20 @@ public interface _FinalStage { _FinalStage prorate(Boolean prorate); + /** + *

When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true.

+ */ + _FinalStage prorateFirstPeriod(Optional prorateFirstPeriod); + + _FinalStage prorateFirstPeriod(Boolean prorateFirstPeriod); + + /** + *

Whether Stripe emails the invoice when it is finalized. Only applies to an invoiced subscription. Defaults to true.

+ */ + _FinalStage sendInvoice(Optional sendInvoice); + + _FinalStage sendInvoice(Boolean sendInvoice); + _FinalStage trialEnd(Optional trialEnd); _FinalStage trialEnd(OffsetDateTime trialEnd); @@ -326,6 +473,10 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private Optional trialEnd = Optional.empty(); + private Optional sendInvoice = Optional.empty(); + + private Optional prorateFirstPeriod = Optional.empty(); + private Optional prorate = Optional.empty(); private Optional promoCode = Optional.empty(); @@ -334,16 +485,24 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private List payInAdvanceEntitlements = new ArrayList<>(); + private Optional daysUntilDue = Optional.empty(); + private List customFieldValues = new ArrayList<>(); private List creditBundles = new ArrayList<>(); private Optional couponExternalId = Optional.empty(); + private Optional collectionMethod = Optional.empty(); + private Optional cancelImmediately = Optional.empty(); private Optional billingEntityId = Optional.empty(); + private Optional billingEmail = Optional.empty(); + + private Optional billingCycleAnchor = Optional.empty(); + private Optional basePlanVersionId = Optional.empty(); private Optional basePlanPriceId = Optional.empty(); @@ -352,6 +511,8 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private List addOnSelections = new ArrayList<>(); + private Optional activateOnPayment = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -359,20 +520,27 @@ private Builder() {} @java.lang.Override public Builder from(ManagePlanRequest other) { + activateOnPayment(other.getActivateOnPayment()); addOnSelections(other.getAddOnSelections()); basePlanId(other.getBasePlanId()); basePlanPriceId(other.getBasePlanPriceId()); basePlanVersionId(other.getBasePlanVersionId()); + billingCycleAnchor(other.getBillingCycleAnchor()); + billingEmail(other.getBillingEmail()); billingEntityId(other.getBillingEntityId()); cancelImmediately(other.getCancelImmediately()); + collectionMethod(other.getCollectionMethod()); companyId(other.getCompanyId()); couponExternalId(other.getCouponExternalId()); creditBundles(other.getCreditBundles()); customFieldValues(other.getCustomFieldValues()); + daysUntilDue(other.getDaysUntilDue()); payInAdvanceEntitlements(other.getPayInAdvanceEntitlements()); paymentMethodExternalId(other.getPaymentMethodExternalId()); promoCode(other.getPromoCode()); prorate(other.getProrate()); + prorateFirstPeriod(other.getProrateFirstPeriod()); + sendInvoice(other.getSendInvoice()); trialEnd(other.getTrialEnd()); return this; } @@ -397,6 +565,46 @@ public _FinalStage trialEnd(Optional trialEnd) { return this; } + /** + *

Whether Stripe emails the invoice when it is finalized. Only applies to an invoiced subscription. Defaults to true.

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

Whether Stripe emails the invoice when it is finalized. Only applies to an invoiced subscription. Defaults to true.

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

When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true.

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

When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true.

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

If true and cancel_immediately is true, issue prorated credit. Only applies when removing all plans. Defaults to true.

* @return Reference to {@code this} so that method calls can be chained together. @@ -468,6 +676,26 @@ public _FinalStage payInAdvanceEntitlements(List return this; } + /** + *

Payment terms in days for an invoiced subscription. Defaults to 30.

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

Payment terms in days for an invoiced subscription. Defaults to 30.

+ */ + @java.lang.Override + @JsonSetter(value = "days_until_due", nulls = Nulls.SKIP) + public _FinalStage daysUntilDue(Optional daysUntilDue) { + this.daysUntilDue = daysUntilDue; + return this; + } + @java.lang.Override public _FinalStage addAllCustomFieldValues(List customFieldValues) { if (customFieldValues != null) { @@ -529,6 +757,26 @@ public _FinalStage couponExternalId(Optional couponExternalId) { return this; } + /** + *

How the subscription is paid: charged to a payment method on file, or invoiced with payment terms. Invoicing is only available when starting a new subscription. Defaults to charge_automatically.

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

How the subscription is paid: charged to a payment method on file, or invoiced with payment terms. Invoicing is only available when starting a new subscription. Defaults to charge_automatically.

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

If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true.

* @return Reference to {@code this} so that method calls can be chained together. @@ -569,6 +817,46 @@ public _FinalStage billingEntityId(Optional billingEntityId) { return this; } + /** + *

Address the invoice is sent to. Required when collection_method is send_invoice.

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

Address the invoice is sent to. Required when collection_method is send_invoice.

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

The date the subscription's billing period renews on. Only honored when starting a new subscription; changing the anchor on an existing subscription is not supported.

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

The date the subscription's billing period renews on. Only honored when starting a new subscription; changing the anchor on an existing subscription is not supported.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_cycle_anchor", nulls = Nulls.SKIP) + public _FinalStage billingCycleAnchor(Optional billingCycleAnchor) { + this.billingCycleAnchor = billingCycleAnchor; + return this; + } + @java.lang.Override public _FinalStage basePlanVersionId(String basePlanVersionId) { this.basePlanVersionId = Optional.ofNullable(basePlanVersionId); @@ -632,23 +920,50 @@ public _FinalStage addOnSelections(List addOnSelections) { return this; } + /** + *

If true, the company gets the plan only once the first invoice is paid. Only applies to an invoiced subscription. Defaults to false.

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

If true, the company gets the plan only once the first invoice is paid. Only applies to an invoiced subscription. Defaults to false.

+ */ + @java.lang.Override + @JsonSetter(value = "activate_on_payment", nulls = Nulls.SKIP) + public _FinalStage activateOnPayment(Optional activateOnPayment) { + this.activateOnPayment = activateOnPayment; + return this; + } + @java.lang.Override public ManagePlanRequest build() { return new ManagePlanRequest( + activateOnPayment, addOnSelections, basePlanId, basePlanPriceId, basePlanVersionId, + billingCycleAnchor, + billingEmail, billingEntityId, cancelImmediately, + collectionMethod, companyId, couponExternalId, creditBundles, customFieldValues, + daysUntilDue, payInAdvanceEntitlements, paymentMethodExternalId, promoCode, prorate, + prorateFirstPeriod, + sendInvoice, trialEnd, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/MigrationProrationBehavior.java b/src/main/java/com/schematic/api/types/MigrationProrationBehavior.java new file mode 100644 index 0000000..a8ab03f --- /dev/null +++ b/src/main/java/com/schematic/api/types/MigrationProrationBehavior.java @@ -0,0 +1,86 @@ +/** + * 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 MigrationProrationBehavior { + public static final MigrationProrationBehavior ALWAYS_INVOICE = + new MigrationProrationBehavior(Value.ALWAYS_INVOICE, "always_invoice"); + + public static final MigrationProrationBehavior CREATE_PRORATIONS = + new MigrationProrationBehavior(Value.CREATE_PRORATIONS, "create_prorations"); + + private final Value value; + + private final String string; + + MigrationProrationBehavior(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 MigrationProrationBehavior + && this.string.equals(((MigrationProrationBehavior) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ALWAYS_INVOICE: + return visitor.visitAlwaysInvoice(); + case CREATE_PRORATIONS: + return visitor.visitCreateProrations(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MigrationProrationBehavior valueOf(String value) { + switch (value) { + case "always_invoice": + return ALWAYS_INVOICE; + case "create_prorations": + return CREATE_PRORATIONS; + default: + return new MigrationProrationBehavior(Value.UNKNOWN, value); + } + } + + public enum Value { + ALWAYS_INVOICE, + + CREATE_PRORATIONS, + + UNKNOWN + } + + public interface Visitor { + T visitAlwaysInvoice(); + + T visitCreateProrations(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/OnboardingMilestone.java b/src/main/java/com/schematic/api/types/OnboardingMilestone.java new file mode 100644 index 0000000..b2c8b47 --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingMilestone.java @@ -0,0 +1,83 @@ +/** + * 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 OnboardingMilestone { + public static final OnboardingMilestone EVALUATED = new OnboardingMilestone(Value.EVALUATED, "evaluated"); + + public static final OnboardingMilestone IMPLEMENTED = new OnboardingMilestone(Value.IMPLEMENTED, "implemented"); + + private final Value value; + + private final String string; + + OnboardingMilestone(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 OnboardingMilestone && this.string.equals(((OnboardingMilestone) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EVALUATED: + return visitor.visitEvaluated(); + case IMPLEMENTED: + return visitor.visitImplemented(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OnboardingMilestone valueOf(String value) { + switch (value) { + case "evaluated": + return EVALUATED; + case "implemented": + return IMPLEMENTED; + default: + return new OnboardingMilestone(Value.UNKNOWN, value); + } + } + + public enum Value { + EVALUATED, + + IMPLEMENTED, + + UNKNOWN + } + + public interface Visitor { + T visitEvaluated(); + + T visitImplemented(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/OnboardingMilestoneView.java b/src/main/java/com/schematic/api/types/OnboardingMilestoneView.java new file mode 100644 index 0000000..fc25060 --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingMilestoneView.java @@ -0,0 +1,222 @@ +/** + * 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.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 = OnboardingMilestoneView.Builder.class) +public final class OnboardingMilestoneView { + private final OnboardingMilestone id; + + private final List missing; + + private final double progress; + + private final Optional reachedAt; + + private final Map additionalProperties; + + private OnboardingMilestoneView( + OnboardingMilestone id, + List missing, + double progress, + Optional reachedAt, + Map additionalProperties) { + this.id = id; + this.missing = missing; + this.progress = progress; + this.reachedAt = reachedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public OnboardingMilestone getId() { + return id; + } + + @JsonProperty("missing") + public List getMissing() { + return missing; + } + + @JsonProperty("progress") + public double getProgress() { + return progress; + } + + @JsonProperty("reached_at") + public Optional getReachedAt() { + return reachedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OnboardingMilestoneView && equalTo((OnboardingMilestoneView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OnboardingMilestoneView other) { + return id.equals(other.id) + && missing.equals(other.missing) + && progress == other.progress + && reachedAt.equals(other.reachedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.missing, this.progress, this.reachedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + ProgressStage id(@NotNull OnboardingMilestone id); + + Builder from(OnboardingMilestoneView other); + } + + public interface ProgressStage { + _FinalStage progress(double progress); + } + + public interface _FinalStage { + OnboardingMilestoneView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage missing(List missing); + + _FinalStage addMissing(OnboardingRequirement missing); + + _FinalStage addAllMissing(List missing); + + _FinalStage reachedAt(Optional reachedAt); + + _FinalStage reachedAt(OffsetDateTime reachedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ProgressStage, _FinalStage { + private OnboardingMilestone id; + + private double progress; + + private Optional reachedAt = Optional.empty(); + + private List missing = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OnboardingMilestoneView other) { + id(other.getId()); + missing(other.getMissing()); + progress(other.getProgress()); + reachedAt(other.getReachedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ProgressStage id(@NotNull OnboardingMilestone id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("progress") + public _FinalStage progress(double progress) { + this.progress = progress; + return this; + } + + @java.lang.Override + public _FinalStage reachedAt(OffsetDateTime reachedAt) { + this.reachedAt = Optional.ofNullable(reachedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reached_at", nulls = Nulls.SKIP) + public _FinalStage reachedAt(Optional reachedAt) { + this.reachedAt = reachedAt; + return this; + } + + @java.lang.Override + public _FinalStage addAllMissing(List missing) { + if (missing != null) { + this.missing.addAll(missing); + } + return this; + } + + @java.lang.Override + public _FinalStage addMissing(OnboardingRequirement missing) { + this.missing.add(missing); + return this; + } + + @java.lang.Override + @JsonSetter(value = "missing", nulls = Nulls.SKIP) + public _FinalStage missing(List missing) { + this.missing.clear(); + if (missing != null) { + this.missing.addAll(missing); + } + return this; + } + + @java.lang.Override + public OnboardingMilestoneView build() { + return new OnboardingMilestoneView(id, missing, progress, reachedAt, 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/OnboardingPath.java b/src/main/java/com/schematic/api/types/OnboardingPath.java new file mode 100644 index 0000000..cd6d864 --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingPath.java @@ -0,0 +1,83 @@ +/** + * 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 OnboardingPath { + public static final OnboardingPath APP = new OnboardingPath(Value.APP, "app"); + + public static final OnboardingPath AGENT = new OnboardingPath(Value.AGENT, "agent"); + + private final Value value; + + private final String string; + + OnboardingPath(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 OnboardingPath && this.string.equals(((OnboardingPath) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APP: + return visitor.visitApp(); + case AGENT: + return visitor.visitAgent(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OnboardingPath valueOf(String value) { + switch (value) { + case "app": + return APP; + case "agent": + return AGENT; + default: + return new OnboardingPath(Value.UNKNOWN, value); + } + } + + public enum Value { + AGENT, + + APP, + + UNKNOWN + } + + public interface Visitor { + T visitAgent(); + + T visitApp(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/OnboardingRequirement.java b/src/main/java/com/schematic/api/types/OnboardingRequirement.java new file mode 100644 index 0000000..f4332e9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingRequirement.java @@ -0,0 +1,129 @@ +/** + * 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 OnboardingRequirement { + public static final OnboardingRequirement CREATE_API_KEY = + new OnboardingRequirement(Value.CREATE_API_KEY, "create_api_key"); + + public static final OnboardingRequirement IMPORT_COMPANIES = + new OnboardingRequirement(Value.IMPORT_COMPANIES, "import_companies"); + + public static final OnboardingRequirement SEND_EVENTS = new OnboardingRequirement(Value.SEND_EVENTS, "send_events"); + + public static final OnboardingRequirement FIRST_FLAG_CHECK = + new OnboardingRequirement(Value.FIRST_FLAG_CHECK, "first_flag_check"); + + public static final OnboardingRequirement CONNECT_BILLING = + new OnboardingRequirement(Value.CONNECT_BILLING, "connect_billing"); + + public static final OnboardingRequirement MODEL_PACKAGING = + new OnboardingRequirement(Value.MODEL_PACKAGING, "model_packaging"); + + private final Value value; + + private final String string; + + OnboardingRequirement(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 OnboardingRequirement + && this.string.equals(((OnboardingRequirement) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREATE_API_KEY: + return visitor.visitCreateApiKey(); + case IMPORT_COMPANIES: + return visitor.visitImportCompanies(); + case SEND_EVENTS: + return visitor.visitSendEvents(); + case FIRST_FLAG_CHECK: + return visitor.visitFirstFlagCheck(); + case CONNECT_BILLING: + return visitor.visitConnectBilling(); + case MODEL_PACKAGING: + return visitor.visitModelPackaging(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OnboardingRequirement valueOf(String value) { + switch (value) { + case "create_api_key": + return CREATE_API_KEY; + case "import_companies": + return IMPORT_COMPANIES; + case "send_events": + return SEND_EVENTS; + case "first_flag_check": + return FIRST_FLAG_CHECK; + case "connect_billing": + return CONNECT_BILLING; + case "model_packaging": + return MODEL_PACKAGING; + default: + return new OnboardingRequirement(Value.UNKNOWN, value); + } + } + + public enum Value { + CONNECT_BILLING, + + CREATE_API_KEY, + + FIRST_FLAG_CHECK, + + IMPORT_COMPANIES, + + MODEL_PACKAGING, + + SEND_EVENTS, + + UNKNOWN + } + + public interface Visitor { + T visitConnectBilling(); + + T visitCreateApiKey(); + + T visitFirstFlagCheck(); + + T visitImportCompanies(); + + T visitModelPackaging(); + + T visitSendEvents(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/OnboardingRequirementStatus.java b/src/main/java/com/schematic/api/types/OnboardingRequirementStatus.java new file mode 100644 index 0000000..f95550f --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingRequirementStatus.java @@ -0,0 +1,96 @@ +/** + * 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 OnboardingRequirementStatus { + public static final OnboardingRequirementStatus AVAILABLE = + new OnboardingRequirementStatus(Value.AVAILABLE, "available"); + + public static final OnboardingRequirementStatus COMPLETE = + new OnboardingRequirementStatus(Value.COMPLETE, "complete"); + + public static final OnboardingRequirementStatus BLOCKED = new OnboardingRequirementStatus(Value.BLOCKED, "blocked"); + + private final Value value; + + private final String string; + + OnboardingRequirementStatus(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 OnboardingRequirementStatus + && this.string.equals(((OnboardingRequirementStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AVAILABLE: + return visitor.visitAvailable(); + case COMPLETE: + return visitor.visitComplete(); + case BLOCKED: + return visitor.visitBlocked(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OnboardingRequirementStatus valueOf(String value) { + switch (value) { + case "available": + return AVAILABLE; + case "complete": + return COMPLETE; + case "blocked": + return BLOCKED; + default: + return new OnboardingRequirementStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + AVAILABLE, + + BLOCKED, + + COMPLETE, + + UNKNOWN + } + + public interface Visitor { + T visitAvailable(); + + T visitBlocked(); + + T visitComplete(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/OnboardingRequirementView.java b/src/main/java/com/schematic/api/types/OnboardingRequirementView.java new file mode 100644 index 0000000..94f67b6 --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingRequirementView.java @@ -0,0 +1,207 @@ +/** + * 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 = OnboardingRequirementView.Builder.class) +public final class OnboardingRequirementView { + private final Optional> blockedBy; + + private final OnboardingRequirement id; + + private final Optional satisfiedBy; + + private final OnboardingRequirementStatus status; + + private final Map additionalProperties; + + private OnboardingRequirementView( + Optional> blockedBy, + OnboardingRequirement id, + Optional satisfiedBy, + OnboardingRequirementStatus status, + Map additionalProperties) { + this.blockedBy = blockedBy; + this.id = id; + this.satisfiedBy = satisfiedBy; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("blocked_by") + public Optional> getBlockedBy() { + return blockedBy; + } + + @JsonProperty("id") + public OnboardingRequirement getId() { + return id; + } + + @JsonProperty("satisfied_by") + public Optional getSatisfiedBy() { + return satisfiedBy; + } + + @JsonProperty("status") + public OnboardingRequirementStatus getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OnboardingRequirementView && equalTo((OnboardingRequirementView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OnboardingRequirementView other) { + return blockedBy.equals(other.blockedBy) + && id.equals(other.id) + && satisfiedBy.equals(other.satisfiedBy) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.blockedBy, this.id, this.satisfiedBy, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + StatusStage id(@NotNull OnboardingRequirement id); + + Builder from(OnboardingRequirementView other); + } + + public interface StatusStage { + _FinalStage status(@NotNull OnboardingRequirementStatus status); + } + + public interface _FinalStage { + OnboardingRequirementView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage blockedBy(Optional> blockedBy); + + _FinalStage blockedBy(List blockedBy); + + _FinalStage satisfiedBy(Optional satisfiedBy); + + _FinalStage satisfiedBy(String satisfiedBy); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, StatusStage, _FinalStage { + private OnboardingRequirement id; + + private OnboardingRequirementStatus status; + + private Optional satisfiedBy = Optional.empty(); + + private Optional> blockedBy = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OnboardingRequirementView other) { + blockedBy(other.getBlockedBy()); + id(other.getId()); + satisfiedBy(other.getSatisfiedBy()); + status(other.getStatus()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull OnboardingRequirement id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull OnboardingRequirementStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage satisfiedBy(String satisfiedBy) { + this.satisfiedBy = Optional.ofNullable(satisfiedBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "satisfied_by", nulls = Nulls.SKIP) + public _FinalStage satisfiedBy(Optional satisfiedBy) { + this.satisfiedBy = satisfiedBy; + return this; + } + + @java.lang.Override + public _FinalStage blockedBy(List blockedBy) { + this.blockedBy = Optional.ofNullable(blockedBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "blocked_by", nulls = Nulls.SKIP) + public _FinalStage blockedBy(Optional> blockedBy) { + this.blockedBy = blockedBy; + return this; + } + + @java.lang.Override + public OnboardingRequirementView build() { + return new OnboardingRequirementView(blockedBy, id, satisfiedBy, status, 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/OnboardingTrack.java b/src/main/java/com/schematic/api/types/OnboardingTrack.java new file mode 100644 index 0000000..b8d7a9a --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingTrack.java @@ -0,0 +1,83 @@ +/** + * 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 OnboardingTrack { + public static final OnboardingTrack SINGLE_PLAN = new OnboardingTrack(Value.SINGLE_PLAN, "single_plan"); + + public static final OnboardingTrack CATALOG = new OnboardingTrack(Value.CATALOG, "catalog"); + + private final Value value; + + private final String string; + + OnboardingTrack(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 OnboardingTrack && this.string.equals(((OnboardingTrack) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SINGLE_PLAN: + return visitor.visitSinglePlan(); + case CATALOG: + return visitor.visitCatalog(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OnboardingTrack valueOf(String value) { + switch (value) { + case "single_plan": + return SINGLE_PLAN; + case "catalog": + return CATALOG; + default: + return new OnboardingTrack(Value.UNKNOWN, value); + } + } + + public enum Value { + CATALOG, + + SINGLE_PLAN, + + UNKNOWN + } + + public interface Visitor { + T visitCatalog(); + + T visitSinglePlan(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanBillingSource.java b/src/main/java/com/schematic/api/types/PlanBillingSource.java new file mode 100644 index 0000000..0515bc8 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanBillingSource.java @@ -0,0 +1,83 @@ +/** + * 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 PlanBillingSource { + public static final PlanBillingSource CUSTOM_PLAN = new PlanBillingSource(Value.CUSTOM_PLAN, "custom_plan"); + + public static final PlanBillingSource MANAGE_PLAN = new PlanBillingSource(Value.MANAGE_PLAN, "manage_plan"); + + private final Value value; + + private final String string; + + PlanBillingSource(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 PlanBillingSource && this.string.equals(((PlanBillingSource) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CUSTOM_PLAN: + return visitor.visitCustomPlan(); + case MANAGE_PLAN: + return visitor.visitManagePlan(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanBillingSource valueOf(String value) { + switch (value) { + case "custom_plan": + return CUSTOM_PLAN; + case "manage_plan": + return MANAGE_PLAN; + default: + return new PlanBillingSource(Value.UNKNOWN, value); + } + } + + public enum Value { + CUSTOM_PLAN, + + MANAGE_PLAN, + + UNKNOWN + } + + public interface Visitor { + T visitCustomPlan(); + + T visitManagePlan(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanBundleResponseData.java b/src/main/java/com/schematic/api/types/PlanBundleResponseData.java index 015a91d..f849525 100644 --- a/src/main/java/com/schematic/api/types/PlanBundleResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanBundleResponseData.java @@ -29,6 +29,8 @@ public final class PlanBundleResponseData { private final Optional plan; + private final Optional planVersion; + private final Map additionalProperties; private PlanBundleResponseData( @@ -36,11 +38,13 @@ private PlanBundleResponseData( Optional> creditGrants, Optional> entitlements, Optional plan, + Optional planVersion, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; this.entitlements = entitlements; this.plan = plan; + this.planVersion = planVersion; this.additionalProperties = additionalProperties; } @@ -64,6 +68,11 @@ public Optional getPlan() { return plan; } + @JsonProperty("plan_version") + public Optional getPlanVersion() { + return planVersion; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -79,12 +88,13 @@ private boolean equalTo(PlanBundleResponseData other) { return billingProduct.equals(other.billingProduct) && creditGrants.equals(other.creditGrants) && entitlements.equals(other.entitlements) - && plan.equals(other.plan); + && plan.equals(other.plan) + && planVersion.equals(other.planVersion); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan); + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.planVersion); } @java.lang.Override @@ -106,6 +116,8 @@ public static final class Builder { private Optional plan = Optional.empty(); + private Optional planVersion = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -116,6 +128,7 @@ public Builder from(PlanBundleResponseData other) { creditGrants(other.getCreditGrants()); entitlements(other.getEntitlements()); plan(other.getPlan()); + planVersion(other.getPlanVersion()); return this; } @@ -163,8 +176,20 @@ public Builder plan(PlanResponseData plan) { return this; } + @JsonSetter(value = "plan_version", nulls = Nulls.SKIP) + public Builder planVersion(Optional planVersion) { + this.planVersion = planVersion; + return this; + } + + public Builder planVersion(PlanVersionResponseData planVersion) { + this.planVersion = Optional.ofNullable(planVersion); + return this; + } + public PlanBundleResponseData build() { - return new PlanBundleResponseData(billingProduct, creditGrants, entitlements, plan, additionalProperties); + return new PlanBundleResponseData( + billingProduct, creditGrants, entitlements, plan, planVersion, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java index 785952d..de3ce6d 100644 --- a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java @@ -44,6 +44,8 @@ public final class PlanCreditGrantView { private final boolean billingCreditCanBuyBundles; + private final long companyCreditAmount; + private final OffsetDateTime createdAt; private final Optional credit; @@ -104,6 +106,7 @@ private PlanCreditGrantView( Optional billingCreditAutoTopupThresholdCredits, Optional billingCreditAutoTopupThresholdPercent, boolean billingCreditCanBuyBundles, + long companyCreditAmount, OffsetDateTime createdAt, Optional credit, long creditAmount, @@ -139,6 +142,7 @@ private PlanCreditGrantView( this.billingCreditAutoTopupThresholdCredits = billingCreditAutoTopupThresholdCredits; this.billingCreditAutoTopupThresholdPercent = billingCreditAutoTopupThresholdPercent; this.billingCreditCanBuyBundles = billingCreditCanBuyBundles; + this.companyCreditAmount = companyCreditAmount; this.createdAt = createdAt; this.credit = credit; this.creditAmount = creditAmount; @@ -220,6 +224,11 @@ public boolean getBillingCreditCanBuyBundles() { return billingCreditCanBuyBundles; } + @JsonProperty("company_credit_amount") + public long getCompanyCreditAmount() { + return companyCreditAmount; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -373,6 +382,7 @@ private boolean equalTo(PlanCreditGrantView other) { && billingCreditAutoTopupThresholdCredits.equals(other.billingCreditAutoTopupThresholdCredits) && billingCreditAutoTopupThresholdPercent.equals(other.billingCreditAutoTopupThresholdPercent) && billingCreditCanBuyBundles == other.billingCreditCanBuyBundles + && companyCreditAmount == other.companyCreditAmount && createdAt.equals(other.createdAt) && credit.equals(other.credit) && creditAmount == other.creditAmount @@ -412,6 +422,7 @@ public int hashCode() { this.billingCreditAutoTopupThresholdCredits, this.billingCreditAutoTopupThresholdPercent, this.billingCreditCanBuyBundles, + this.companyCreditAmount, this.createdAt, this.credit, this.creditAmount, @@ -457,7 +468,11 @@ public interface BillingCreditAutoTopupSelfServiceStage { } public interface BillingCreditCanBuyBundlesStage { - CreatedAtStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles); + CompanyCreditAmountStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles); + } + + public interface CompanyCreditAmountStage { + CreatedAtStage companyCreditAmount(long companyCreditAmount); } public interface CreatedAtStage { @@ -616,6 +631,7 @@ public static final class Builder implements BillingCreditAutoTopupEnabledStage, BillingCreditAutoTopupSelfServiceStage, BillingCreditCanBuyBundlesStage, + CompanyCreditAmountStage, CreatedAtStage, CreditAmountStage, CreditDescriptionStage, @@ -634,6 +650,8 @@ public static final class Builder private boolean billingCreditCanBuyBundles; + private long companyCreditAmount; + private OffsetDateTime createdAt; private long creditAmount; @@ -714,6 +732,7 @@ public Builder from(PlanCreditGrantView other) { billingCreditAutoTopupThresholdCredits(other.getBillingCreditAutoTopupThresholdCredits()); billingCreditAutoTopupThresholdPercent(other.getBillingCreditAutoTopupThresholdPercent()); billingCreditCanBuyBundles(other.getBillingCreditCanBuyBundles()); + companyCreditAmount(other.getCompanyCreditAmount()); createdAt(other.getCreatedAt()); credit(other.getCredit()); creditAmount(other.getCreditAmount()); @@ -758,11 +777,18 @@ public BillingCreditCanBuyBundlesStage billingCreditAutoTopupSelfService( @java.lang.Override @JsonSetter("billing_credit_can_buy_bundles") - public CreatedAtStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles) { + public CompanyCreditAmountStage billingCreditCanBuyBundles(boolean billingCreditCanBuyBundles) { this.billingCreditCanBuyBundles = billingCreditCanBuyBundles; return this; } + @java.lang.Override + @JsonSetter("company_credit_amount") + public CreatedAtStage companyCreditAmount(long companyCreditAmount) { + this.companyCreditAmount = companyCreditAmount; + return this; + } + @java.lang.Override @JsonSetter("created_at") public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -1149,6 +1175,7 @@ public PlanCreditGrantView build() { billingCreditAutoTopupThresholdCredits, billingCreditAutoTopupThresholdPercent, billingCreditCanBuyBundles, + companyCreditAmount, createdAt, credit, creditAmount, diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewResponseData.java index 4d0c908..55bb4a4 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewResponseData.java @@ -23,11 +23,16 @@ public final class PlanVersionMigrationPreviewResponseData { private final List companies; + private final boolean hasBillingChanges; + private final Map additionalProperties; private PlanVersionMigrationPreviewResponseData( - List companies, Map additionalProperties) { + List companies, + boolean hasBillingChanges, + Map additionalProperties) { this.companies = companies; + this.hasBillingChanges = hasBillingChanges; this.additionalProperties = additionalProperties; } @@ -36,6 +41,11 @@ public List getCompanies() { return companies; } + @JsonProperty("has_billing_changes") + public boolean getHasBillingChanges() { + return hasBillingChanges; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -49,12 +59,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(PlanVersionMigrationPreviewResponseData other) { - return companies.equals(other.companies); + return companies.equals(other.companies) && hasBillingChanges == other.hasBillingChanges; } @java.lang.Override public int hashCode() { - return Objects.hash(this.companies); + return Objects.hash(this.companies, this.hasBillingChanges); } @java.lang.Override @@ -62,12 +72,34 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static HasBillingChangesStage builder() { return new Builder(); } + public interface HasBillingChangesStage { + _FinalStage hasBillingChanges(boolean hasBillingChanges); + + Builder from(PlanVersionMigrationPreviewResponseData other); + } + + public interface _FinalStage { + PlanVersionMigrationPreviewResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage companies(List companies); + + _FinalStage addCompanies(PlanVersionMigrationPreviewCompanyResponseData companies); + + _FinalStage addAllCompanies(List companies); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { + public static final class Builder implements HasBillingChangesStage, _FinalStage { + private boolean hasBillingChanges; + private List companies = new ArrayList<>(); @JsonAnySetter @@ -75,41 +107,56 @@ public static final class Builder { private Builder() {} + @java.lang.Override public Builder from(PlanVersionMigrationPreviewResponseData other) { companies(other.getCompanies()); + hasBillingChanges(other.getHasBillingChanges()); return this; } - @JsonSetter(value = "companies", nulls = Nulls.SKIP) - public Builder companies(List companies) { - this.companies.clear(); + @java.lang.Override + @JsonSetter("has_billing_changes") + public _FinalStage hasBillingChanges(boolean hasBillingChanges) { + this.hasBillingChanges = hasBillingChanges; + return this; + } + + @java.lang.Override + public _FinalStage addAllCompanies(List companies) { if (companies != null) { this.companies.addAll(companies); } return this; } - public Builder addCompanies(PlanVersionMigrationPreviewCompanyResponseData companies) { + @java.lang.Override + public _FinalStage addCompanies(PlanVersionMigrationPreviewCompanyResponseData companies) { this.companies.add(companies); return this; } - public Builder addAllCompanies(List companies) { + @java.lang.Override + @JsonSetter(value = "companies", nulls = Nulls.SKIP) + public _FinalStage companies(List companies) { + this.companies.clear(); if (companies != null) { this.companies.addAll(companies); } return this; } + @java.lang.Override public PlanVersionMigrationPreviewResponseData build() { - return new PlanVersionMigrationPreviewResponseData(companies, additionalProperties); + return new PlanVersionMigrationPreviewResponseData(companies, hasBillingChanges, 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/PlanVersionMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java index f8059b0..3f5882d 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java @@ -44,6 +44,8 @@ public final class PlanVersionMigrationResponseData { private final List planVersionIdsFrom; + private final Optional prorationBehavior; + private final long skippedCompanies; private final Optional startedAt; @@ -69,6 +71,7 @@ private PlanVersionMigrationResponseData( Optional planVersionIdFrom, String planVersionIdTo, List planVersionIdsFrom, + Optional prorationBehavior, long skippedCompanies, Optional startedAt, PlanVersionMigrationStatus status, @@ -86,6 +89,7 @@ private PlanVersionMigrationResponseData( this.planVersionIdFrom = planVersionIdFrom; this.planVersionIdTo = planVersionIdTo; this.planVersionIdsFrom = planVersionIdsFrom; + this.prorationBehavior = prorationBehavior; this.skippedCompanies = skippedCompanies; this.startedAt = startedAt; this.status = status; @@ -145,6 +149,11 @@ public List getPlanVersionIdsFrom() { return planVersionIdsFrom; } + @JsonProperty("proration_behavior") + public Optional getProrationBehavior() { + return prorationBehavior; + } + @JsonProperty("skipped_companies") public long getSkippedCompanies() { return skippedCompanies; @@ -197,6 +206,7 @@ private boolean equalTo(PlanVersionMigrationResponseData other) { && planVersionIdFrom.equals(other.planVersionIdFrom) && planVersionIdTo.equals(other.planVersionIdTo) && planVersionIdsFrom.equals(other.planVersionIdsFrom) + && prorationBehavior.equals(other.prorationBehavior) && skippedCompanies == other.skippedCompanies && startedAt.equals(other.startedAt) && status.equals(other.status) @@ -218,6 +228,7 @@ public int hashCode() { this.planVersionIdFrom, this.planVersionIdTo, this.planVersionIdsFrom, + this.prorationBehavior, this.skippedCompanies, this.startedAt, this.status, @@ -306,6 +317,10 @@ public interface _FinalStage { _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom); + _FinalStage prorationBehavior(Optional prorationBehavior); + + _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior); + _FinalStage startedAt(Optional startedAt); _FinalStage startedAt(OffsetDateTime startedAt); @@ -349,6 +364,8 @@ public static final class Builder private Optional startedAt = Optional.empty(); + private Optional prorationBehavior = Optional.empty(); + private List planVersionIdsFrom = new ArrayList<>(); private Optional planVersionIdFrom = Optional.empty(); @@ -374,6 +391,7 @@ public Builder from(PlanVersionMigrationResponseData other) { planVersionIdFrom(other.getPlanVersionIdFrom()); planVersionIdTo(other.getPlanVersionIdTo()); planVersionIdsFrom(other.getPlanVersionIdsFrom()); + prorationBehavior(other.getProrationBehavior()); skippedCompanies(other.getSkippedCompanies()); startedAt(other.getStartedAt()); status(other.getStatus()); @@ -473,6 +491,19 @@ public _FinalStage startedAt(Optional startedAt) { return this; } + @java.lang.Override + public _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior) { + this.prorationBehavior = Optional.ofNullable(prorationBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "proration_behavior", nulls = Nulls.SKIP) + public _FinalStage prorationBehavior(Optional prorationBehavior) { + this.prorationBehavior = prorationBehavior; + return this; + } + @java.lang.Override public _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom) { if (planVersionIdsFrom != null) { @@ -549,6 +580,7 @@ public PlanVersionMigrationResponseData build() { planVersionIdFrom, planVersionIdTo, planVersionIdsFrom, + prorationBehavior, skippedCompanies, startedAt, status, diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java index 16f8393..5cf2f5f 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java @@ -26,6 +26,8 @@ public final class PreviewSubscriptionFinanceResponseData { private final long amountOff; + private final long discountAmount; + private final List discounts; private final long dueNow; @@ -58,6 +60,7 @@ public final class PreviewSubscriptionFinanceResponseData { private PreviewSubscriptionFinanceResponseData( long amountOff, + long discountAmount, List discounts, long dueNow, long newCharges, @@ -74,6 +77,7 @@ private PreviewSubscriptionFinanceResponseData( List upcomingInvoiceLineItems, Map additionalProperties) { this.amountOff = amountOff; + this.discountAmount = discountAmount; this.discounts = discounts; this.dueNow = dueNow; this.newCharges = newCharges; @@ -96,6 +100,11 @@ public long getAmountOff() { return amountOff; } + @JsonProperty("discount_amount") + public long getDiscountAmount() { + return discountAmount; + } + @JsonProperty("discounts") public List getDiscounts() { return discounts; @@ -180,6 +189,7 @@ public Map getAdditionalProperties() { private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { return amountOff == other.amountOff + && discountAmount == other.discountAmount && discounts.equals(other.discounts) && dueNow == other.dueNow && newCharges == other.newCharges @@ -200,6 +210,7 @@ private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { public int hashCode() { return Objects.hash( this.amountOff, + this.discountAmount, this.discounts, this.dueNow, this.newCharges, @@ -226,11 +237,15 @@ public static AmountOffStage builder() { } public interface AmountOffStage { - DueNowStage amountOff(long amountOff); + DiscountAmountStage amountOff(long amountOff); Builder from(PreviewSubscriptionFinanceResponseData other); } + public interface DiscountAmountStage { + DueNowStage discountAmount(long discountAmount); + } + public interface DueNowStage { NewChargesStage dueNow(long dueNow); } @@ -304,6 +319,7 @@ _FinalStage addAllUpcomingInvoiceLineItems( @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements AmountOffStage, + DiscountAmountStage, DueNowStage, NewChargesStage, PercentOffStage, @@ -316,6 +332,8 @@ public static final class Builder _FinalStage { private long amountOff; + private long discountAmount; + private long dueNow; private long newCharges; @@ -352,6 +370,7 @@ private Builder() {} @java.lang.Override public Builder from(PreviewSubscriptionFinanceResponseData other) { amountOff(other.getAmountOff()); + discountAmount(other.getDiscountAmount()); discounts(other.getDiscounts()); dueNow(other.getDueNow()); newCharges(other.getNewCharges()); @@ -371,11 +390,18 @@ public Builder from(PreviewSubscriptionFinanceResponseData other) { @java.lang.Override @JsonSetter("amount_off") - public DueNowStage amountOff(long amountOff) { + public DiscountAmountStage amountOff(long amountOff) { this.amountOff = amountOff; return this; } + @java.lang.Override + @JsonSetter("discount_amount") + public DueNowStage discountAmount(long discountAmount) { + this.discountAmount = discountAmount; + return this; + } + @java.lang.Override @JsonSetter("due_now") public NewChargesStage dueNow(long dueNow) { @@ -533,6 +559,7 @@ public _FinalStage discounts(List disco public PreviewSubscriptionFinanceResponseData build() { return new PreviewSubscriptionFinanceResponseData( amountOff, + discountAmount, discounts, dueNow, newCharges, diff --git a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java index 32ebcd2..2353d2a 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -45,6 +45,8 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional canBuyBundles; + private final Optional companyCreditAmount; + private final Optional creditAmount; private final Optional expiryType; @@ -80,6 +82,7 @@ private UpdateBillingPlanCreditGrantRequestBody( Optional autoTopupThresholdCredits, Optional autoTopupThresholdPercent, Optional canBuyBundles, + Optional companyCreditAmount, Optional creditAmount, Optional expiryType, Optional expiryUnit, @@ -103,6 +106,7 @@ private UpdateBillingPlanCreditGrantRequestBody( this.autoTopupThresholdCredits = autoTopupThresholdCredits; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.canBuyBundles = canBuyBundles; + this.companyCreditAmount = companyCreditAmount; this.creditAmount = creditAmount; this.expiryType = expiryType; this.expiryUnit = expiryUnit; @@ -176,6 +180,14 @@ public Optional getCanBuyBundles() { return canBuyBundles; } + /** + * @return Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license. + */ + @JsonProperty("company_credit_amount") + public Optional getCompanyCreditAmount() { + return companyCreditAmount; + } + @JsonProperty("credit_amount") public Optional getCreditAmount() { return creditAmount; @@ -197,7 +209,7 @@ public Optional getExpiryUnitCount() { } /** - * @return The license whose quantity scales this grant. Cannot be changed after creation. + * @return The license whose quantity scales this grant. Cleared when the grant moves off per-license scaling. */ @JsonProperty("license_id") public Optional getLicenseId() { @@ -228,7 +240,7 @@ public Optional getRolloverPercentage() { } /** - * @return Whether the grant is a fixed amount per company, or issued once per license the company holds. Cannot be changed after creation. + * @return Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant. */ @JsonProperty("scaling") public Optional getScaling() { @@ -260,6 +272,7 @@ private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { && autoTopupThresholdCredits.equals(other.autoTopupThresholdCredits) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && canBuyBundles.equals(other.canBuyBundles) + && companyCreditAmount.equals(other.companyCreditAmount) && creditAmount.equals(other.creditAmount) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) @@ -287,6 +300,7 @@ public int hashCode() { this.autoTopupThresholdCredits, this.autoTopupThresholdPercent, this.canBuyBundles, + this.companyCreditAmount, this.creditAmount, this.expiryType, this.expiryUnit, @@ -373,6 +387,13 @@ public interface _FinalStage { _FinalStage canBuyBundles(Boolean canBuyBundles); + /** + *

Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license.

+ */ + _FinalStage companyCreditAmount(Optional companyCreditAmount); + + _FinalStage companyCreditAmount(Long companyCreditAmount); + _FinalStage creditAmount(Optional creditAmount); _FinalStage creditAmount(Long creditAmount); @@ -390,7 +411,7 @@ public interface _FinalStage { _FinalStage expiryUnitCount(Long expiryUnitCount); /** - *

The license whose quantity scales this grant. Cannot be changed after creation.

+ *

The license whose quantity scales this grant. Cleared when the grant moves off per-license scaling.

*/ _FinalStage licenseId(Optional licenseId); @@ -408,7 +429,7 @@ public interface _FinalStage { _FinalStage rolloverPercentage(Long rolloverPercentage); /** - *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Cannot be changed after creation.

+ *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant.

*/ _FinalStage scaling(Optional scaling); @@ -437,6 +458,8 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private Optional creditAmount = Optional.empty(); + private Optional companyCreditAmount = Optional.empty(); + private Optional canBuyBundles = Optional.empty(); private Optional autoTopupThresholdPercent = Optional.empty(); @@ -480,6 +503,7 @@ public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { autoTopupThresholdCredits(other.getAutoTopupThresholdCredits()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); canBuyBundles(other.getCanBuyBundles()); + companyCreditAmount(other.getCompanyCreditAmount()); creditAmount(other.getCreditAmount()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); @@ -508,7 +532,7 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta } /** - *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Cannot be changed after creation.

+ *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -518,7 +542,7 @@ public _FinalStage scaling(PlanCreditGrantScaling scaling) { } /** - *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Cannot be changed after creation.

+ *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Changing this re-issues the credits companies already hold for this grant.

*/ @java.lang.Override @JsonSetter(value = "scaling", nulls = Nulls.SKIP) @@ -561,7 +585,7 @@ public _FinalStage resetType(Optional resetType } /** - *

The license whose quantity scales this grant. Cannot be changed after creation.

+ *

The license whose quantity scales this grant. Cleared when the grant moves off per-license scaling.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -571,7 +595,7 @@ public _FinalStage licenseId(String licenseId) { } /** - *

The license whose quantity scales this grant. Cannot be changed after creation.

+ *

The license whose quantity scales this grant. Cleared when the grant moves off per-license scaling.

*/ @java.lang.Override @JsonSetter(value = "license_id", nulls = Nulls.SKIP) @@ -632,6 +656,26 @@ public _FinalStage creditAmount(Optional creditAmount) { return this; } + /** + *

Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license.

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

Credits granted once per company on top of the per-license amount. Only valid when the grant scales per license.

+ */ + @java.lang.Override + @JsonSetter(value = "company_credit_amount", nulls = Nulls.SKIP) + public _FinalStage companyCreditAmount(Optional companyCreditAmount) { + this.companyCreditAmount = companyCreditAmount; + return this; + } + @java.lang.Override public _FinalStage canBuyBundles(Boolean canBuyBundles) { this.canBuyBundles = Optional.ofNullable(canBuyBundles); @@ -803,6 +847,7 @@ public UpdateBillingPlanCreditGrantRequestBody build() { autoTopupThresholdCredits, autoTopupThresholdPercent, canBuyBundles, + companyCreditAmount, creditAmount, expiryType, expiryUnit, diff --git a/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java b/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java index 0df1988..3f4b7c7 100644 --- a/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java @@ -16,6 +16,7 @@ import java.time.OffsetDateTime; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -37,6 +38,8 @@ public final class UpsertCompanyRequestBody { private final Optional preventKeyRemap; + private final Optional> removeKeys; + private final Optional> traits; private final Optional updateOnly; @@ -51,6 +54,7 @@ private UpsertCompanyRequestBody( Optional lastSeenAt, Optional name, Optional preventKeyRemap, + Optional> removeKeys, Optional> traits, Optional updateOnly, Map additionalProperties) { @@ -61,6 +65,7 @@ private UpsertCompanyRequestBody( this.lastSeenAt = lastSeenAt; this.name = name; this.preventKeyRemap = preventKeyRemap; + this.removeKeys = removeKeys; this.traits = traits; this.updateOnly = updateOnly; this.additionalProperties = additionalProperties; @@ -113,6 +118,14 @@ public Optional getPreventKeyRemap() { return preventKeyRemap; } + /** + * @return Names of keys to remove from the company. Removing a key the company does not have does nothing, and a company must keep at least one key. + */ + @JsonProperty("remove_keys") + public Optional> getRemoveKeys() { + return removeKeys; + } + /** * @return A map of trait names to trait values */ @@ -145,6 +158,7 @@ private boolean equalTo(UpsertCompanyRequestBody other) { && lastSeenAt.equals(other.lastSeenAt) && name.equals(other.name) && preventKeyRemap.equals(other.preventKeyRemap) + && removeKeys.equals(other.removeKeys) && traits.equals(other.traits) && updateOnly.equals(other.updateOnly); } @@ -159,6 +173,7 @@ public int hashCode() { this.lastSeenAt, this.name, this.preventKeyRemap, + this.removeKeys, this.traits, this.updateOnly); } @@ -188,6 +203,8 @@ public static final class Builder { private Optional preventKeyRemap = Optional.empty(); + private Optional> removeKeys = Optional.empty(); + private Optional> traits = Optional.empty(); private Optional updateOnly = Optional.empty(); @@ -205,6 +222,7 @@ public Builder from(UpsertCompanyRequestBody other) { lastSeenAt(other.getLastSeenAt()); name(other.getName()); preventKeyRemap(other.getPreventKeyRemap()); + removeKeys(other.getRemoveKeys()); traits(other.getTraits()); updateOnly(other.getUpdateOnly()); return this; @@ -309,6 +327,20 @@ public Builder preventKeyRemap(Boolean preventKeyRemap) { return this; } + /** + *

Names of keys to remove from the company. Removing a key the company does not have does nothing, and a company must keep at least one key.

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

A map of trait names to trait values

*/ @@ -343,6 +375,7 @@ public UpsertCompanyRequestBody build() { lastSeenAt, name, preventKeyRemap, + removeKeys, traits, updateOnly, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java b/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java index 5949d24..d63b240 100644 --- a/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java @@ -40,6 +40,8 @@ public final class UpsertUserRequestBody { private final Optional name; + private final Optional> removeKeys; + private final Optional> traits; private final Optional updateOnly; @@ -55,6 +57,7 @@ private UpsertUserRequestBody( Map keys, Optional lastSeenAt, Optional name, + Optional> removeKeys, Optional> traits, Optional updateOnly, Map additionalProperties) { @@ -66,6 +69,7 @@ private UpsertUserRequestBody( this.keys = keys; this.lastSeenAt = lastSeenAt; this.name = name; + this.removeKeys = removeKeys; this.traits = traits; this.updateOnly = updateOnly; this.additionalProperties = additionalProperties; @@ -129,6 +133,14 @@ public Optional getName() { return name; } + /** + * @return Names of keys to remove from the user. Removing a key the user does not have does nothing, and a user must keep at least one key. + */ + @JsonProperty("remove_keys") + public Optional> getRemoveKeys() { + return removeKeys; + } + /** * @return A map of trait names to trait values */ @@ -162,6 +174,7 @@ private boolean equalTo(UpsertUserRequestBody other) { && keys.equals(other.keys) && lastSeenAt.equals(other.lastSeenAt) && name.equals(other.name) + && removeKeys.equals(other.removeKeys) && traits.equals(other.traits) && updateOnly.equals(other.updateOnly); } @@ -177,6 +190,7 @@ public int hashCode() { this.keys, this.lastSeenAt, this.name, + this.removeKeys, this.traits, this.updateOnly); } @@ -208,6 +222,8 @@ public static final class Builder { private Optional name = Optional.empty(); + private Optional> removeKeys = Optional.empty(); + private Optional> traits = Optional.empty(); private Optional updateOnly = Optional.empty(); @@ -226,6 +242,7 @@ public Builder from(UpsertUserRequestBody other) { keys(other.getKeys()); lastSeenAt(other.getLastSeenAt()); name(other.getName()); + removeKeys(other.getRemoveKeys()); traits(other.getTraits()); updateOnly(other.getUpdateOnly()); return this; @@ -347,6 +364,20 @@ public Builder name(String name) { return this; } + /** + *

Names of keys to remove from the user. Removing a key the user does not have does nothing, and a user must keep at least one key.

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

A map of trait names to trait values

*/ @@ -382,6 +413,7 @@ public UpsertUserRequestBody build() { keys, lastSeenAt, name, + removeKeys, traits, updateOnly, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java b/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java index abd847b..f667e03 100644 --- a/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java @@ -36,6 +36,8 @@ public final class UpsertUserSubRequestBody { private final Optional name; + private final Optional> removeKeys; + private final Optional> traits; private final Optional updateOnly; @@ -49,6 +51,7 @@ private UpsertUserSubRequestBody( Map keys, Optional lastSeenAt, Optional name, + Optional> removeKeys, Optional> traits, Optional updateOnly, Map additionalProperties) { @@ -58,6 +61,7 @@ private UpsertUserSubRequestBody( this.keys = keys; this.lastSeenAt = lastSeenAt; this.name = name; + this.removeKeys = removeKeys; this.traits = traits; this.updateOnly = updateOnly; this.additionalProperties = additionalProperties; @@ -105,6 +109,14 @@ public Optional getName() { return name; } + /** + * @return Names of keys to remove from the user. Removing a key the user does not have does nothing, and a user must keep at least one key. + */ + @JsonProperty("remove_keys") + public Optional> getRemoveKeys() { + return removeKeys; + } + /** * @return A map of trait names to trait values */ @@ -136,6 +148,7 @@ private boolean equalTo(UpsertUserSubRequestBody other) { && keys.equals(other.keys) && lastSeenAt.equals(other.lastSeenAt) && name.equals(other.name) + && removeKeys.equals(other.removeKeys) && traits.equals(other.traits) && updateOnly.equals(other.updateOnly); } @@ -149,6 +162,7 @@ public int hashCode() { this.keys, this.lastSeenAt, this.name, + this.removeKeys, this.traits, this.updateOnly); } @@ -176,6 +190,8 @@ public static final class Builder { private Optional name = Optional.empty(); + private Optional> removeKeys = Optional.empty(); + private Optional> traits = Optional.empty(); private Optional updateOnly = Optional.empty(); @@ -192,6 +208,7 @@ public Builder from(UpsertUserSubRequestBody other) { keys(other.getKeys()); lastSeenAt(other.getLastSeenAt()); name(other.getName()); + removeKeys(other.getRemoveKeys()); traits(other.getTraits()); updateOnly(other.getUpdateOnly()); return this; @@ -285,6 +302,20 @@ public Builder name(String name) { return this; } + /** + *

Names of keys to remove from the user. Removing a key the user does not have does nothing, and a user must keep at least one key.

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

A map of trait names to trait values

*/ @@ -312,7 +343,16 @@ public Builder updateOnly(Boolean updateOnly) { public UpsertUserSubRequestBody build() { return new UpsertUserSubRequestBody( - companyId, companyIds, id, keys, lastSeenAt, name, traits, updateOnly, additionalProperties); + companyId, + companyIds, + id, + keys, + lastSeenAt, + name, + removeKeys, + traits, + updateOnly, + additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/WhoAmIResponseData.java b/src/main/java/com/schematic/api/types/WhoAmIResponseData.java index 57c3d2c..d88081a 100644 --- a/src/main/java/com/schematic/api/types/WhoAmIResponseData.java +++ b/src/main/java/com/schematic/api/types/WhoAmIResponseData.java @@ -35,6 +35,8 @@ public final class WhoAmIResponseData { private final List environments; + private final boolean onboardingComplete; + private final Optional stripeUserId; private final Optional userId; @@ -50,6 +52,7 @@ private WhoAmIResponseData( Optional apiKeyId, Optional environmentId, List environments, + boolean onboardingComplete, Optional stripeUserId, Optional userId, Optional userName, @@ -60,6 +63,7 @@ private WhoAmIResponseData( this.apiKeyId = apiKeyId; this.environmentId = environmentId; this.environments = environments; + this.onboardingComplete = onboardingComplete; this.stripeUserId = stripeUserId; this.userId = userId; this.userName = userName; @@ -96,6 +100,11 @@ public List getEnvironments() { return environments; } + @JsonProperty("onboarding_complete") + public boolean getOnboardingComplete() { + return onboardingComplete; + } + @JsonProperty("stripe_user_id") public Optional getStripeUserId() { return stripeUserId; @@ -129,6 +138,7 @@ private boolean equalTo(WhoAmIResponseData other) { && apiKeyId.equals(other.apiKeyId) && environmentId.equals(other.environmentId) && environments.equals(other.environments) + && onboardingComplete == other.onboardingComplete && stripeUserId.equals(other.stripeUserId) && userId.equals(other.userId) && userName.equals(other.userName); @@ -143,6 +153,7 @@ public int hashCode() { this.apiKeyId, this.environmentId, this.environments, + this.onboardingComplete, this.stripeUserId, this.userId, this.userName); @@ -168,7 +179,11 @@ public interface AccountNameStage { } public interface ActorTypeStage { - _FinalStage actorType(@NotNull ActorType actorType); + OnboardingCompleteStage actorType(@NotNull ActorType actorType); + } + + public interface OnboardingCompleteStage { + _FinalStage onboardingComplete(boolean onboardingComplete); } public interface _FinalStage { @@ -206,13 +221,16 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AccountIdStage, AccountNameStage, ActorTypeStage, _FinalStage { + public static final class Builder + implements AccountIdStage, AccountNameStage, ActorTypeStage, OnboardingCompleteStage, _FinalStage { private String accountId; private String accountName; private ActorType actorType; + private boolean onboardingComplete; + private Optional userName = Optional.empty(); private Optional userId = Optional.empty(); @@ -238,6 +256,7 @@ public Builder from(WhoAmIResponseData other) { apiKeyId(other.getApiKeyId()); environmentId(other.getEnvironmentId()); environments(other.getEnvironments()); + onboardingComplete(other.getOnboardingComplete()); stripeUserId(other.getStripeUserId()); userId(other.getUserId()); userName(other.getUserName()); @@ -260,11 +279,18 @@ public ActorTypeStage accountName(@NotNull String accountName) { @java.lang.Override @JsonSetter("actor_type") - public _FinalStage actorType(@NotNull ActorType actorType) { + public OnboardingCompleteStage actorType(@NotNull ActorType actorType) { this.actorType = Objects.requireNonNull(actorType, "actorType must not be null"); return this; } + @java.lang.Override + @JsonSetter("onboarding_complete") + public _FinalStage onboardingComplete(boolean onboardingComplete) { + this.onboardingComplete = onboardingComplete; + return this; + } + @java.lang.Override public _FinalStage userName(String userName) { this.userName = Optional.ofNullable(userName); @@ -363,6 +389,7 @@ public WhoAmIResponseData build() { apiKeyId, environmentId, environments, + onboardingComplete, stripeUserId, userId, userName,