From 33c4ab9cb21f3c311a58147d61f165b5ca39d4d4 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2026 10:05:57 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.19.2 --- .fern/metadata.json | 8 +- build.gradle | 4 +- reference.md | 145 +++++++++- .../com/schematic/api/core/ClientOptions.java | 4 +- .../UpdateOnboardingStateRequestBody.java | 31 +- .../AsyncPlanmigrationsClient.java | 39 +++ .../AsyncRawPlanmigrationsClient.java | 225 +++++++++++++++ .../planmigrations/PlanmigrationsClient.java | 38 +++ .../RawPlanmigrationsClient.java | 174 +++++++++++ .../CompleteMigrationNowRequestBody.java | 107 +++++++ .../types/CancelMigrationResponse.java | 183 ++++++++++++ .../types/CompleteMigrationNowResponse.java | 183 ++++++++++++ .../PublishPlanVersionRequestBody.java | 91 ++++++ .../RetryCustomPlanBillingRequestBody.java | 103 ++++++- .../api/types/CompanyDetailResponseData.java | 32 +++ .../api/types/CreditLeaseResponseData.java | 31 +- .../types/CustomPlanBillingResponseData.java | 45 +++ .../api/types/GetOnboardingStateResp.java | 150 +++++++++- .../api/types/OnboardingRequirement.java | 11 + .../api/types/OnboardingStripeImport.java | 95 +++++++ .../types/PendingMigrationResponseData.java | 269 ++++++++++++++++++ ...anVersionCompanyMigrationResponseData.java | 45 +++ .../PlanVersionCompanyMigrationStatus.java | 11 + .../PlanVersionMigrationResponseData.java | 32 +++ .../api/types/PlanVersionMigrationStatus.java | 11 + .../types/PlanVersionMigrationStrategy.java | 11 + 26 files changed, 2053 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/requests/CompleteMigrationNowRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/CancelMigrationResponse.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/CompleteMigrationNowResponse.java create mode 100644 src/main/java/com/schematic/api/types/OnboardingStripeImport.java create mode 100644 src/main/java/com/schematic/api/types/PendingMigrationResponseData.java diff --git a/.fern/metadata.json b/.fern/metadata.json index 9fcaa5d4..77fb3fef 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.50.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.19.1", + "generatorVersion": "4.19.2", "generatorConfig": { "client-class-name": "BaseSchematic", "generate-unknown-as-json-node": true, @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "008b7147a27272499bf4b17fa96d4357ca3b62e9", + "originGitCommit": "686551a0297d2f37075b3586b030ff32be5c94f7", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.5.7", + "requestedVersion": "1.5.8", "ciProvider": "github", - "sdkVersion": "1.5.7" + "sdkVersion": "1.5.8" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3bf505ff..028b0a5b 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ java { group = 'com.schematichq' -version = '1.5.7' +version = '1.5.8' jar { dependsOn(":generatePomFileForMavenPublication") @@ -93,7 +93,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.5.7' + version = '1.5.8' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index 911d23c2..7d0e8f6a 100644 --- a/reference.md +++ b/reference.md @@ -1156,6 +1156,14 @@ client.accounts().updateOnboardingState(
+**dismissed:** `Optional` + +
+
+ +
+
+ **path:** `Optional`
@@ -13693,6 +13701,14 @@ client.plans().retryCustomPlanBilling(
+**billingCycleAnchor:** `Optional` — The date the subscription's billing period renews on. Only honored when the retry creates a subscription. + +
+
+ +
+
+ **customerEmail:** `String`
@@ -13709,6 +13725,14 @@ client.plans().retryCustomPlanBilling(
+**prorateFirstPeriod:** `Optional` — 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. + +
+
+ +
+
+ **sendInvoice:** `Optional` — Whether Stripe emails the invoice when it is finalized. Defaults to true.
@@ -14803,7 +14827,7 @@ client.plans().publishPlanVersion( "plan_version_id", PublishPlanVersionRequestBody .builder() - .migrationStrategy(PlanVersionMigrationStrategy.IMMEDIATE) + .migrationStrategy(PlanVersionMigrationStrategy.END_OF_BILLING_PERIOD) .excludedCompanyIds( Arrays.asList("excluded_company_ids") ) @@ -14847,6 +14871,14 @@ client.plans().publishPlanVersion(
+**billingCycleAnchor:** `Optional` — The date the subscription's billing period renews on. Only honored on a first publish that starts a subscription. + +
+
+ +
+
+ **couponExternalId:** `Optional`
@@ -14903,6 +14935,14 @@ client.plans().publishPlanVersion(
+**prorateFirstPeriod:** `Optional` — 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. + +
+
+ +
+
+ **prorationBehavior:** `Optional`
@@ -19385,7 +19425,7 @@ client.planmigrations().listCompanyMigrations( .builder() .migrationId("migration_id") .q("q") - .status(PlanVersionCompanyMigrationStatus.COMPLETED) + .status(PlanVersionCompanyMigrationStatus.CANCELLED) .limit(1000000L) .offset(1000000L) .build() @@ -19506,7 +19546,7 @@ client.planmigrations().countCompanyMigrations( .builder() .migrationId("migration_id") .q("q") - .status(PlanVersionCompanyMigrationStatus.COMPLETED) + .status(PlanVersionCompanyMigrationStatus.CANCELLED) .limit(1000000L) .offset(1000000L) .build() @@ -19586,7 +19626,7 @@ client.planmigrations().listMigrations( ListMigrationsRequest .builder() .planVersionId("plan_version_id") - .status(PlanVersionMigrationStatus.COMPLETED) + .status(PlanVersionMigrationStatus.CANCELLED) .limit(1000000L) .offset(1000000L) .build() @@ -19659,7 +19699,7 @@ client.planmigrations().createMigration( .builder() .planId("plan_id") .planVersionIdTo("plan_version_id_to") - .strategy(PlanVersionMigrationStrategy.IMMEDIATE) + .strategy(PlanVersionMigrationStrategy.END_OF_BILLING_PERIOD) .targetPlanType(PlanType.PLAN) .build() ); @@ -19781,6 +19821,99 @@ client.planmigrations().getMigration("plan_version_migration_id");
+ +
+ + +
client.planmigrations.cancelMigration(planVersionMigrationId) -> CancelMigrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().cancelMigration("plan_version_migration_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planVersionMigrationId:** `String` — plan_version_migration_id + +
+
+
+
+ + +
+
+
+ +
client.planmigrations.completeMigrationNow(planVersionMigrationId, request) -> CompleteMigrationNowResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().completeMigrationNow( + "plan_version_migration_id", + CompleteMigrationNowRequestBody + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planVersionMigrationId:** `String` — plan_version_migration_id + +
+
+ +
+
+ +**prorationBehavior:** `Optional` + +
+
+
+
+ +
@@ -19858,7 +19991,7 @@ client.planmigrations().countMigrations( CountMigrationsRequest .builder() .planVersionId("plan_version_id") - .status(PlanVersionMigrationStatus.COMPLETED) + .status(PlanVersionMigrationStatus.CANCELLED) .limit(1000000L) .offset(1000000L) .build() diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index 0dba5267..32b0d048 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -47,10 +47,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq.schematic-java/1.5.7"); + put("User-Agent", "com.schematichq.schematic-java/1.5.8"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematichq:schematic-java"); - put("X-Fern-SDK-Version", "1.5.7"); + put("X-Fern-SDK-Version", "1.5.8"); } }); this.headerSuppliers = headerSuppliers; 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 index d4db49cf..47ff16cc 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateOnboardingStateRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateOnboardingStateRequestBody.java @@ -22,6 +22,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpdateOnboardingStateRequestBody.Builder.class) public final class UpdateOnboardingStateRequestBody { + private final Optional dismissed; + private final Optional path; private final Optional pricingPageUrl; @@ -33,11 +35,13 @@ public final class UpdateOnboardingStateRequestBody { private final Map additionalProperties; private UpdateOnboardingStateRequestBody( + Optional dismissed, Optional path, Optional pricingPageUrl, Optional track, Optional websiteUrl, Map additionalProperties) { + this.dismissed = dismissed; this.path = path; this.pricingPageUrl = pricingPageUrl; this.track = track; @@ -45,6 +49,11 @@ private UpdateOnboardingStateRequestBody( this.additionalProperties = additionalProperties; } + @JsonProperty("dismissed") + public Optional getDismissed() { + return dismissed; + } + @JsonProperty("path") public Optional getPath() { return path; @@ -77,7 +86,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(UpdateOnboardingStateRequestBody other) { - return path.equals(other.path) + return dismissed.equals(other.dismissed) + && path.equals(other.path) && pricingPageUrl.equals(other.pricingPageUrl) && track.equals(other.track) && websiteUrl.equals(other.websiteUrl); @@ -85,7 +95,7 @@ private boolean equalTo(UpdateOnboardingStateRequestBody other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.path, this.pricingPageUrl, this.track, this.websiteUrl); + return Objects.hash(this.dismissed, this.path, this.pricingPageUrl, this.track, this.websiteUrl); } @java.lang.Override @@ -99,6 +109,8 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional dismissed = Optional.empty(); + private Optional path = Optional.empty(); private Optional pricingPageUrl = Optional.empty(); @@ -113,6 +125,7 @@ public static final class Builder { private Builder() {} public Builder from(UpdateOnboardingStateRequestBody other) { + dismissed(other.getDismissed()); path(other.getPath()); pricingPageUrl(other.getPricingPageUrl()); track(other.getTrack()); @@ -120,6 +133,17 @@ public Builder from(UpdateOnboardingStateRequestBody other) { return this; } + @JsonSetter(value = "dismissed", nulls = Nulls.SKIP) + public Builder dismissed(Optional dismissed) { + this.dismissed = dismissed; + return this; + } + + public Builder dismissed(Boolean dismissed) { + this.dismissed = Optional.ofNullable(dismissed); + return this; + } + @JsonSetter(value = "path", nulls = Nulls.SKIP) public Builder path(Optional path) { this.path = path; @@ -165,7 +189,8 @@ public Builder websiteUrl(String websiteUrl) { } public UpdateOnboardingStateRequestBody build() { - return new UpdateOnboardingStateRequestBody(path, pricingPageUrl, track, websiteUrl, additionalProperties); + return new UpdateOnboardingStateRequestBody( + dismissed, path, pricingPageUrl, track, websiteUrl, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java index e05e8954..c61b48cf 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.planmigrations.requests.CompleteMigrationNowRequestBody; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; @@ -12,6 +13,8 @@ import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.PreviewMigrationRequestBody; import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; +import com.schematic.api.resources.planmigrations.types.CancelMigrationResponse; +import com.schematic.api.resources.planmigrations.types.CompleteMigrationNowResponse; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; @@ -103,6 +106,42 @@ public CompletableFuture getMigration( .thenApply(response -> response.body()); } + public CompletableFuture cancelMigration(String planVersionMigrationId) { + return this.rawClient.cancelMigration(planVersionMigrationId).thenApply(response -> response.body()); + } + + public CompletableFuture cancelMigration( + String planVersionMigrationId, RequestOptions requestOptions) { + return this.rawClient + .cancelMigration(planVersionMigrationId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture completeMigrationNow(String planVersionMigrationId) { + return this.rawClient.completeMigrationNow(planVersionMigrationId).thenApply(response -> response.body()); + } + + public CompletableFuture completeMigrationNow( + String planVersionMigrationId, RequestOptions requestOptions) { + return this.rawClient + .completeMigrationNow(planVersionMigrationId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request) { + return this.rawClient + .completeMigrationNow(planVersionMigrationId, request) + .thenApply(response -> response.body()); + } + + public CompletableFuture completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .completeMigrationNow(planVersionMigrationId, request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture retryMigration( String planVersionMigrationId, RetryMigrationRequestBody request) { return this.rawClient.retryMigration(planVersionMigrationId, request).thenApply(response -> response.body()); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java index ed371d95..b71c869b 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java @@ -18,6 +18,7 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.planmigrations.requests.CompleteMigrationNowRequestBody; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; @@ -25,6 +26,8 @@ import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.PreviewMigrationRequestBody; import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; +import com.schematic.api.resources.planmigrations.types.CancelMigrationResponse; +import com.schematic.api.resources.planmigrations.types.CompleteMigrationNowResponse; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; @@ -691,6 +694,228 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> cancelMigration( + String planVersionMigrationId) { + return cancelMigration(planVersionMigrationId, null); + } + + public CompletableFuture> cancelMigration( + String planVersionMigrationId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId) + .addPathSegments("cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CancelMigrationResponse.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> completeMigrationNow( + String planVersionMigrationId) { + return completeMigrationNow( + planVersionMigrationId, + CompleteMigrationNowRequestBody.builder().build()); + } + + public CompletableFuture> completeMigrationNow( + String planVersionMigrationId, RequestOptions requestOptions) { + return completeMigrationNow( + planVersionMigrationId, + CompleteMigrationNowRequestBody.builder().build(), + requestOptions); + } + + public CompletableFuture> completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request) { + return completeMigrationNow(planVersionMigrationId, request, null); + } + + public CompletableFuture> completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId) + .addPathSegments("complete-now"); + 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, CompleteMigrationNowResponse.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> retryMigration( String planVersionMigrationId, RetryMigrationRequestBody request) { return retryMigration(planVersionMigrationId, request, null); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java index 07730636..1cfad76f 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.planmigrations.requests.CompleteMigrationNowRequestBody; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; @@ -12,6 +13,8 @@ import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.PreviewMigrationRequestBody; import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; +import com.schematic.api.resources.planmigrations.types.CancelMigrationResponse; +import com.schematic.api.resources.planmigrations.types.CompleteMigrationNowResponse; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; @@ -96,6 +99,41 @@ public GetMigrationResponse getMigration(String planVersionMigrationId, RequestO .body(); } + public CancelMigrationResponse cancelMigration(String planVersionMigrationId) { + return this.rawClient.cancelMigration(planVersionMigrationId).body(); + } + + public CancelMigrationResponse cancelMigration(String planVersionMigrationId, RequestOptions requestOptions) { + return this.rawClient + .cancelMigration(planVersionMigrationId, requestOptions) + .body(); + } + + public CompleteMigrationNowResponse completeMigrationNow(String planVersionMigrationId) { + return this.rawClient.completeMigrationNow(planVersionMigrationId).body(); + } + + public CompleteMigrationNowResponse completeMigrationNow( + String planVersionMigrationId, RequestOptions requestOptions) { + return this.rawClient + .completeMigrationNow(planVersionMigrationId, requestOptions) + .body(); + } + + public CompleteMigrationNowResponse completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request) { + return this.rawClient + .completeMigrationNow(planVersionMigrationId, request) + .body(); + } + + public CompleteMigrationNowResponse completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .completeMigrationNow(planVersionMigrationId, request, requestOptions) + .body(); + } + public RetryMigrationResponse retryMigration(String planVersionMigrationId, RetryMigrationRequestBody request) { return this.rawClient.retryMigration(planVersionMigrationId, request).body(); } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java index 8eb193d0..ed0e7087 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java @@ -18,6 +18,7 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.planmigrations.requests.CompleteMigrationNowRequestBody; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; @@ -25,6 +26,8 @@ import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.PreviewMigrationRequestBody; import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; +import com.schematic.api.resources.planmigrations.types.CancelMigrationResponse; +import com.schematic.api.resources.planmigrations.types.CompleteMigrationNowResponse; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; @@ -538,6 +541,177 @@ public BaseSchematicHttpResponse getMigration( } } + public BaseSchematicHttpResponse cancelMigration(String planVersionMigrationId) { + return cancelMigration(planVersionMigrationId, null); + } + + public BaseSchematicHttpResponse cancelMigration( + String planVersionMigrationId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId) + .addPathSegments("cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CancelMigrationResponse.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 completeMigrationNow(String planVersionMigrationId) { + return completeMigrationNow( + planVersionMigrationId, + CompleteMigrationNowRequestBody.builder().build()); + } + + public BaseSchematicHttpResponse completeMigrationNow( + String planVersionMigrationId, RequestOptions requestOptions) { + return completeMigrationNow( + planVersionMigrationId, + CompleteMigrationNowRequestBody.builder().build(), + requestOptions); + } + + public BaseSchematicHttpResponse completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request) { + return completeMigrationNow(planVersionMigrationId, request, null); + } + + public BaseSchematicHttpResponse completeMigrationNow( + String planVersionMigrationId, CompleteMigrationNowRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId) + .addPathSegments("complete-now"); + 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, CompleteMigrationNowResponse.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 retryMigration( String planVersionMigrationId, RetryMigrationRequestBody request) { return retryMigration(planVersionMigrationId, request, null); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/CompleteMigrationNowRequestBody.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CompleteMigrationNowRequestBody.java new file mode 100644 index 00000000..5ab1afba --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CompleteMigrationNowRequestBody.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.MigrationProrationBehavior; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompleteMigrationNowRequestBody.Builder.class) +public final class CompleteMigrationNowRequestBody { + private final Optional prorationBehavior; + + private final Map additionalProperties; + + private CompleteMigrationNowRequestBody( + Optional prorationBehavior, Map additionalProperties) { + this.prorationBehavior = prorationBehavior; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("proration_behavior") + public Optional getProrationBehavior() { + return prorationBehavior; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompleteMigrationNowRequestBody && equalTo((CompleteMigrationNowRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompleteMigrationNowRequestBody other) { + return prorationBehavior.equals(other.prorationBehavior); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.prorationBehavior); + } + + @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 prorationBehavior = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CompleteMigrationNowRequestBody other) { + prorationBehavior(other.getProrationBehavior()); + return this; + } + + @JsonSetter(value = "proration_behavior", nulls = Nulls.SKIP) + public Builder prorationBehavior(Optional prorationBehavior) { + this.prorationBehavior = prorationBehavior; + return this; + } + + public Builder prorationBehavior(MigrationProrationBehavior prorationBehavior) { + this.prorationBehavior = Optional.ofNullable(prorationBehavior); + return this; + } + + public CompleteMigrationNowRequestBody build() { + return new CompleteMigrationNowRequestBody(prorationBehavior, 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/planmigrations/types/CancelMigrationResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CancelMigrationResponse.java new file mode 100644 index 00000000..621d0980 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CancelMigrationResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationResponseData; +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 = CancelMigrationResponse.Builder.class) +public final class CancelMigrationResponse { + private final PlanVersionMigrationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private CancelMigrationResponse( + PlanVersionMigrationResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanVersionMigrationResponseData 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 CancelMigrationResponse && equalTo((CancelMigrationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CancelMigrationResponse 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 PlanVersionMigrationResponseData data); + + Builder from(CancelMigrationResponse other); + } + + public interface _FinalStage { + CancelMigrationResponse 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 PlanVersionMigrationResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CancelMigrationResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanVersionMigrationResponseData 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 CancelMigrationResponse build() { + return new CancelMigrationResponse(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/planmigrations/types/CompleteMigrationNowResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CompleteMigrationNowResponse.java new file mode 100644 index 00000000..ec0adc19 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CompleteMigrationNowResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationResponseData; +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 = CompleteMigrationNowResponse.Builder.class) +public final class CompleteMigrationNowResponse { + private final PlanVersionMigrationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private CompleteMigrationNowResponse( + PlanVersionMigrationResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanVersionMigrationResponseData 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 CompleteMigrationNowResponse && equalTo((CompleteMigrationNowResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompleteMigrationNowResponse 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 PlanVersionMigrationResponseData data); + + Builder from(CompleteMigrationNowResponse other); + } + + public interface _FinalStage { + CompleteMigrationNowResponse 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 PlanVersionMigrationResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompleteMigrationNowResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanVersionMigrationResponseData 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 CompleteMigrationNowResponse build() { + return new CompleteMigrationNowResponse(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/plans/requests/PublishPlanVersionRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java index c6ae5a27..2aafd1ce 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 @@ -18,6 +18,7 @@ import com.schematic.api.types.MigrationProrationBehavior; import com.schematic.api.types.PlanVersionMigrationStrategy; import com.schematic.api.types.TaxIdInput; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -33,6 +34,8 @@ public final class PublishPlanVersionRequestBody { private final Optional address; + private final Optional billingCycleAnchor; + private final Optional couponExternalId; private final Optional> customFieldValues; @@ -47,6 +50,8 @@ public final class PublishPlanVersionRequestBody { private final Optional phone; + private final Optional prorateFirstPeriod; + private final Optional prorationBehavior; private final Optional requireNoMigration; @@ -60,6 +65,7 @@ public final class PublishPlanVersionRequestBody { private PublishPlanVersionRequestBody( Optional activationStrategy, Optional address, + Optional billingCycleAnchor, Optional couponExternalId, Optional> customFieldValues, Optional customerEmail, @@ -67,6 +73,7 @@ private PublishPlanVersionRequestBody( List excludedCompanyIds, PlanVersionMigrationStrategy migrationStrategy, Optional phone, + Optional prorateFirstPeriod, Optional prorationBehavior, Optional requireNoMigration, Optional sendInvoice, @@ -74,6 +81,7 @@ private PublishPlanVersionRequestBody( Map additionalProperties) { this.activationStrategy = activationStrategy; this.address = address; + this.billingCycleAnchor = billingCycleAnchor; this.couponExternalId = couponExternalId; this.customFieldValues = customFieldValues; this.customerEmail = customerEmail; @@ -81,6 +89,7 @@ private PublishPlanVersionRequestBody( this.excludedCompanyIds = excludedCompanyIds; this.migrationStrategy = migrationStrategy; this.phone = phone; + this.prorateFirstPeriod = prorateFirstPeriod; this.prorationBehavior = prorationBehavior; this.requireNoMigration = requireNoMigration; this.sendInvoice = sendInvoice; @@ -98,6 +107,14 @@ public Optional getAddress() { return address; } + /** + * @return The date the subscription's billing period renews on. Only honored on a first publish that starts a subscription. + */ + @JsonProperty("billing_cycle_anchor") + public Optional getBillingCycleAnchor() { + return billingCycleAnchor; + } + @JsonProperty("coupon_external_id") public Optional getCouponExternalId() { return couponExternalId; @@ -133,6 +150,14 @@ public Optional getPhone() { return phone; } + /** + * @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; + } + @JsonProperty("proration_behavior") public Optional getProrationBehavior() { return prorationBehavior; @@ -173,6 +198,7 @@ public Map getAdditionalProperties() { private boolean equalTo(PublishPlanVersionRequestBody other) { return activationStrategy.equals(other.activationStrategy) && address.equals(other.address) + && billingCycleAnchor.equals(other.billingCycleAnchor) && couponExternalId.equals(other.couponExternalId) && customFieldValues.equals(other.customFieldValues) && customerEmail.equals(other.customerEmail) @@ -180,6 +206,7 @@ private boolean equalTo(PublishPlanVersionRequestBody other) { && excludedCompanyIds.equals(other.excludedCompanyIds) && migrationStrategy.equals(other.migrationStrategy) && phone.equals(other.phone) + && prorateFirstPeriod.equals(other.prorateFirstPeriod) && prorationBehavior.equals(other.prorationBehavior) && requireNoMigration.equals(other.requireNoMigration) && sendInvoice.equals(other.sendInvoice) @@ -191,6 +218,7 @@ public int hashCode() { return Objects.hash( this.activationStrategy, this.address, + this.billingCycleAnchor, this.couponExternalId, this.customFieldValues, this.customerEmail, @@ -198,6 +226,7 @@ public int hashCode() { this.excludedCompanyIds, this.migrationStrategy, this.phone, + this.prorateFirstPeriod, this.prorationBehavior, this.requireNoMigration, this.sendInvoice, @@ -234,6 +263,13 @@ public interface _FinalStage { _FinalStage address(CustomerBillingAddress address); + /** + *

The date the subscription's billing period renews on. Only honored on a first publish that starts a subscription.

+ */ + _FinalStage billingCycleAnchor(Optional billingCycleAnchor); + + _FinalStage billingCycleAnchor(OffsetDateTime billingCycleAnchor); + _FinalStage couponExternalId(Optional couponExternalId); _FinalStage couponExternalId(String couponExternalId); @@ -260,6 +296,13 @@ public interface _FinalStage { _FinalStage phone(String phone); + /** + *

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); + _FinalStage prorationBehavior(Optional prorationBehavior); _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior); @@ -295,6 +338,8 @@ public static final class Builder implements MigrationStrategyStage, _FinalStage private Optional prorationBehavior = Optional.empty(); + private Optional prorateFirstPeriod = Optional.empty(); + private Optional phone = Optional.empty(); private List excludedCompanyIds = new ArrayList<>(); @@ -307,6 +352,8 @@ public static final class Builder implements MigrationStrategyStage, _FinalStage private Optional couponExternalId = Optional.empty(); + private Optional billingCycleAnchor = Optional.empty(); + private Optional address = Optional.empty(); private Optional activationStrategy = Optional.empty(); @@ -320,6 +367,7 @@ private Builder() {} public Builder from(PublishPlanVersionRequestBody other) { activationStrategy(other.getActivationStrategy()); address(other.getAddress()); + billingCycleAnchor(other.getBillingCycleAnchor()); couponExternalId(other.getCouponExternalId()); customFieldValues(other.getCustomFieldValues()); customerEmail(other.getCustomerEmail()); @@ -327,6 +375,7 @@ public Builder from(PublishPlanVersionRequestBody other) { excludedCompanyIds(other.getExcludedCompanyIds()); migrationStrategy(other.getMigrationStrategy()); phone(other.getPhone()); + prorateFirstPeriod(other.getProrateFirstPeriod()); prorationBehavior(other.getProrationBehavior()); requireNoMigration(other.getRequireNoMigration()); sendInvoice(other.getSendInvoice()); @@ -407,6 +456,26 @@ public _FinalStage prorationBehavior(Optional prorat 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; + } + @java.lang.Override public _FinalStage phone(String phone) { this.phone = Optional.ofNullable(phone); @@ -496,6 +565,26 @@ public _FinalStage couponExternalId(Optional couponExternalId) { return this; } + /** + *

The date the subscription's billing period renews on. Only honored on a first publish that starts a subscription.

+ * @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 on a first publish that starts a subscription.

+ */ + @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 address(CustomerBillingAddress address) { this.address = Optional.ofNullable(address); @@ -527,6 +616,7 @@ public PublishPlanVersionRequestBody build() { return new PublishPlanVersionRequestBody( activationStrategy, address, + billingCycleAnchor, couponExternalId, customFieldValues, customerEmail, @@ -534,6 +624,7 @@ public PublishPlanVersionRequestBody build() { excludedCompanyIds, migrationStrategy, phone, + prorateFirstPeriod, prorationBehavior, requireNoMigration, sendInvoice, diff --git a/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java index eb32e6cb..6fa29e2b 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.CustomPlanActivationStrategy; +import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -24,23 +25,31 @@ public final class RetryCustomPlanBillingRequestBody { private final Optional activationStrategy; + private final Optional billingCycleAnchor; + private final String customerEmail; private final Optional daysUntilDue; + private final Optional prorateFirstPeriod; + private final Optional sendInvoice; private final Map additionalProperties; private RetryCustomPlanBillingRequestBody( Optional activationStrategy, + Optional billingCycleAnchor, String customerEmail, Optional daysUntilDue, + Optional prorateFirstPeriod, Optional sendInvoice, Map additionalProperties) { this.activationStrategy = activationStrategy; + this.billingCycleAnchor = billingCycleAnchor; this.customerEmail = customerEmail; this.daysUntilDue = daysUntilDue; + this.prorateFirstPeriod = prorateFirstPeriod; this.sendInvoice = sendInvoice; this.additionalProperties = additionalProperties; } @@ -50,6 +59,14 @@ public Optional getActivationStrategy() { return activationStrategy; } + /** + * @return The date the subscription's billing period renews on. Only honored when the retry creates a subscription. + */ + @JsonProperty("billing_cycle_anchor") + public Optional getBillingCycleAnchor() { + return billingCycleAnchor; + } + @JsonProperty("customer_email") public String getCustomerEmail() { return customerEmail; @@ -60,6 +77,14 @@ public Optional getDaysUntilDue() { return daysUntilDue; } + /** + * @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. Defaults to true. */ @@ -81,14 +106,22 @@ public Map getAdditionalProperties() { private boolean equalTo(RetryCustomPlanBillingRequestBody other) { return activationStrategy.equals(other.activationStrategy) + && billingCycleAnchor.equals(other.billingCycleAnchor) && customerEmail.equals(other.customerEmail) && daysUntilDue.equals(other.daysUntilDue) + && prorateFirstPeriod.equals(other.prorateFirstPeriod) && sendInvoice.equals(other.sendInvoice); } @java.lang.Override public int hashCode() { - return Objects.hash(this.activationStrategy, this.customerEmail, this.daysUntilDue, this.sendInvoice); + return Objects.hash( + this.activationStrategy, + this.billingCycleAnchor, + this.customerEmail, + this.daysUntilDue, + this.prorateFirstPeriod, + this.sendInvoice); } @java.lang.Override @@ -117,10 +150,24 @@ public interface _FinalStage { _FinalStage activationStrategy(CustomPlanActivationStrategy activationStrategy); + /** + *

The date the subscription's billing period renews on. Only honored when the retry creates a subscription.

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

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. Defaults to true.

*/ @@ -135,8 +182,12 @@ public static final class Builder implements CustomerEmailStage, _FinalStage { private Optional sendInvoice = Optional.empty(); + private Optional prorateFirstPeriod = Optional.empty(); + private Optional daysUntilDue = Optional.empty(); + private Optional billingCycleAnchor = Optional.empty(); + private Optional activationStrategy = Optional.empty(); @JsonAnySetter @@ -147,8 +198,10 @@ private Builder() {} @java.lang.Override public Builder from(RetryCustomPlanBillingRequestBody other) { activationStrategy(other.getActivationStrategy()); + billingCycleAnchor(other.getBillingCycleAnchor()); customerEmail(other.getCustomerEmail()); daysUntilDue(other.getDaysUntilDue()); + prorateFirstPeriod(other.getProrateFirstPeriod()); sendInvoice(other.getSendInvoice()); return this; } @@ -180,6 +233,26 @@ public _FinalStage sendInvoice(Optional 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; + } + @java.lang.Override public _FinalStage daysUntilDue(Long daysUntilDue) { this.daysUntilDue = Optional.ofNullable(daysUntilDue); @@ -193,6 +266,26 @@ public _FinalStage daysUntilDue(Optional daysUntilDue) { return this; } + /** + *

The date the subscription's billing period renews on. Only honored when the retry creates a subscription.

+ * @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 the retry creates a subscription.

+ */ + @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 activationStrategy(CustomPlanActivationStrategy activationStrategy) { this.activationStrategy = Optional.ofNullable(activationStrategy); @@ -209,7 +302,13 @@ public _FinalStage activationStrategy(Optional act @java.lang.Override public RetryCustomPlanBillingRequestBody build() { return new RetryCustomPlanBillingRequestBody( - activationStrategy, customerEmail, daysUntilDue, sendInvoice, additionalProperties); + activationStrategy, + billingCycleAnchor, + customerEmail, + daysUntilDue, + prorateFirstPeriod, + sendInvoice, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java index 8e875cf4..f3c69286 100644 --- a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java @@ -59,6 +59,8 @@ public final class CompanyDetailResponseData { private final List paymentMethods; + private final Optional pendingMigration; + private final Optional plan; private final List plans; @@ -93,6 +95,7 @@ private CompanyDetailResponseData( List metrics, String name, List paymentMethods, + Optional pendingMigration, Optional plan, List plans, List rules, @@ -118,6 +121,7 @@ private CompanyDetailResponseData( this.metrics = metrics; this.name = name; this.paymentMethods = paymentMethods; + this.pendingMigration = pendingMigration; this.plan = plan; this.plans = plans; this.rules = rules; @@ -213,6 +217,11 @@ public List getPaymentMethods() { return paymentMethods; } + @JsonProperty("pending_migration") + public Optional getPendingMigration() { + return pendingMigration; + } + @JsonProperty("plan") public Optional getPlan() { return plan; @@ -280,6 +289,7 @@ private boolean equalTo(CompanyDetailResponseData other) { && metrics.equals(other.metrics) && name.equals(other.name) && paymentMethods.equals(other.paymentMethods) + && pendingMigration.equals(other.pendingMigration) && plan.equals(other.plan) && plans.equals(other.plans) && rules.equals(other.rules) @@ -309,6 +319,7 @@ public int hashCode() { this.metrics, this.name, this.paymentMethods, + this.pendingMigration, this.plan, this.plans, this.rules, @@ -428,6 +439,10 @@ public interface _FinalStage { _FinalStage addAllPaymentMethods(List paymentMethods); + _FinalStage pendingMigration(Optional pendingMigration); + + _FinalStage pendingMigration(PendingMigrationResponseData pendingMigration); + _FinalStage plan(Optional plan); _FinalStage plan(CompanyPlanWithBillingSubView plan); @@ -487,6 +502,8 @@ public static final class Builder private Optional plan = Optional.empty(); + private Optional pendingMigration = Optional.empty(); + private List paymentMethods = new ArrayList<>(); private List metrics = new ArrayList<>(); @@ -537,6 +554,7 @@ public Builder from(CompanyDetailResponseData other) { metrics(other.getMetrics()); name(other.getName()); paymentMethods(other.getPaymentMethods()); + pendingMigration(other.getPendingMigration()); plan(other.getPlan()); plans(other.getPlans()); rules(other.getRules()); @@ -683,6 +701,19 @@ public _FinalStage plan(Optional plan) { return this; } + @java.lang.Override + public _FinalStage pendingMigration(PendingMigrationResponseData pendingMigration) { + this.pendingMigration = Optional.ofNullable(pendingMigration); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pending_migration", nulls = Nulls.SKIP) + public _FinalStage pendingMigration(Optional pendingMigration) { + this.pendingMigration = pendingMigration; + return this; + } + @java.lang.Override public _FinalStage addAllPaymentMethods(List paymentMethods) { if (paymentMethods != null) { @@ -960,6 +991,7 @@ public CompanyDetailResponseData build() { metrics, name, paymentMethods, + pendingMigration, plan, plans, rules, diff --git a/src/main/java/com/schematic/api/types/CreditLeaseResponseData.java b/src/main/java/com/schematic/api/types/CreditLeaseResponseData.java index 3b6c1bef..050a2961 100644 --- a/src/main/java/com/schematic/api/types/CreditLeaseResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditLeaseResponseData.java @@ -36,6 +36,8 @@ public final class CreditLeaseResponseData { private final Optional releasedAt; + private final double trackedAmount; + private final OffsetDateTime updatedAt; private final Map additionalProperties; @@ -48,6 +50,7 @@ private CreditLeaseResponseData( double grantedAmount, String id, Optional releasedAt, + double trackedAmount, OffsetDateTime updatedAt, Map additionalProperties) { this.companyId = companyId; @@ -57,6 +60,7 @@ private CreditLeaseResponseData( this.grantedAmount = grantedAmount; this.id = id; this.releasedAt = releasedAt; + this.trackedAmount = trackedAmount; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -96,6 +100,11 @@ public Optional getReleasedAt() { return releasedAt; } + @JsonProperty("tracked_amount") + public double getTrackedAmount() { + return trackedAmount; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -120,6 +129,7 @@ private boolean equalTo(CreditLeaseResponseData other) { && grantedAmount == other.grantedAmount && id.equals(other.id) && releasedAt.equals(other.releasedAt) + && trackedAmount == other.trackedAmount && updatedAt.equals(other.updatedAt); } @@ -133,6 +143,7 @@ public int hashCode() { this.grantedAmount, this.id, this.releasedAt, + this.trackedAmount, this.updatedAt); } @@ -168,7 +179,11 @@ public interface GrantedAmountStage { } public interface IdStage { - UpdatedAtStage id(@NotNull String id); + TrackedAmountStage id(@NotNull String id); + } + + public interface TrackedAmountStage { + UpdatedAtStage trackedAmount(double trackedAmount); } public interface UpdatedAtStage { @@ -195,6 +210,7 @@ public static final class Builder ExpiresAtStage, GrantedAmountStage, IdStage, + TrackedAmountStage, UpdatedAtStage, _FinalStage { private String companyId; @@ -209,6 +225,8 @@ public static final class Builder private String id; + private double trackedAmount; + private OffsetDateTime updatedAt; private Optional releasedAt = Optional.empty(); @@ -227,6 +245,7 @@ public Builder from(CreditLeaseResponseData other) { grantedAmount(other.getGrantedAmount()); id(other.getId()); releasedAt(other.getReleasedAt()); + trackedAmount(other.getTrackedAmount()); updatedAt(other.getUpdatedAt()); return this; } @@ -268,11 +287,18 @@ public IdStage grantedAmount(double grantedAmount) { @java.lang.Override @JsonSetter("id") - public UpdatedAtStage id(@NotNull String id) { + public TrackedAmountStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + @java.lang.Override + @JsonSetter("tracked_amount") + public UpdatedAtStage trackedAmount(double trackedAmount) { + this.trackedAmount = trackedAmount; + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -303,6 +329,7 @@ public CreditLeaseResponseData build() { grantedAmount, id, releasedAt, + trackedAmount, updatedAt, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java index 56ec3d01..2346bb5d 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java @@ -42,6 +42,8 @@ public final class CustomPlanBillingResponseData { private final String planId; + private final Optional prorateFirstPeriod; + private final Optional publishedAt; private final boolean sendInvoice; @@ -65,6 +67,7 @@ private CustomPlanBillingResponseData( Optional paidAt, PlanBillingSource planBillingSource, String planId, + Optional prorateFirstPeriod, Optional publishedAt, boolean sendInvoice, CustomPlanBillingStatus status, @@ -81,6 +84,7 @@ private CustomPlanBillingResponseData( this.paidAt = paidAt; this.planBillingSource = planBillingSource; this.planId = planId; + this.prorateFirstPeriod = prorateFirstPeriod; this.publishedAt = publishedAt; this.sendInvoice = sendInvoice; this.status = status; @@ -145,6 +149,14 @@ public String getPlanId() { return planId; } + /** + * @return Whether the shortened period the renewal date created was billed pro rata when the subscription started. False means that period is free and the first invoice is the one raised on the renewal date. + */ + @JsonProperty("prorate_first_period") + public Optional getProrateFirstPeriod() { + return prorateFirstPeriod; + } + @JsonProperty("published_at") public Optional getPublishedAt() { return publishedAt; @@ -192,6 +204,7 @@ private boolean equalTo(CustomPlanBillingResponseData other) { && paidAt.equals(other.paidAt) && planBillingSource.equals(other.planBillingSource) && planId.equals(other.planId) + && prorateFirstPeriod.equals(other.prorateFirstPeriod) && publishedAt.equals(other.publishedAt) && sendInvoice == other.sendInvoice && status.equals(other.status) @@ -212,6 +225,7 @@ public int hashCode() { this.paidAt, this.planBillingSource, this.planId, + this.prorateFirstPeriod, this.publishedAt, this.sendInvoice, this.status, @@ -295,6 +309,13 @@ public interface _FinalStage { _FinalStage paidAt(OffsetDateTime paidAt); + /** + *

Whether the shortened period the renewal date created was billed pro rata when the subscription started. False means that period is free and the first invoice is the one raised on the renewal date.

+ */ + _FinalStage prorateFirstPeriod(Optional prorateFirstPeriod); + + _FinalStage prorateFirstPeriod(Boolean prorateFirstPeriod); + _FinalStage publishedAt(Optional publishedAt); _FinalStage publishedAt(OffsetDateTime publishedAt); @@ -341,6 +362,8 @@ public static final class Builder private Optional publishedAt = Optional.empty(); + private Optional prorateFirstPeriod = Optional.empty(); + private Optional paidAt = Optional.empty(); private Optional externalInvoiceId = Optional.empty(); @@ -364,6 +387,7 @@ public Builder from(CustomPlanBillingResponseData other) { paidAt(other.getPaidAt()); planBillingSource(other.getPlanBillingSource()); planId(other.getPlanId()); + prorateFirstPeriod(other.getProrateFirstPeriod()); publishedAt(other.getPublishedAt()); sendInvoice(other.getSendInvoice()); status(other.getStatus()); @@ -472,6 +496,26 @@ public _FinalStage publishedAt(Optional publishedAt) { return this; } + /** + *

Whether the shortened period the renewal date created was billed pro rata when the subscription started. False means that period is free and the first invoice is the one raised on the renewal date.

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

Whether the shortened period the renewal date created was billed pro rata when the subscription started. False means that period is free and the first invoice is the one raised on the renewal date.

+ */ + @java.lang.Override + @JsonSetter(value = "prorate_first_period", nulls = Nulls.SKIP) + public _FinalStage prorateFirstPeriod(Optional prorateFirstPeriod) { + this.prorateFirstPeriod = prorateFirstPeriod; + return this; + } + @java.lang.Override public _FinalStage paidAt(OffsetDateTime paidAt) { this.paidAt = Optional.ofNullable(paidAt); @@ -531,6 +575,7 @@ public CustomPlanBillingResponseData build() { paidAt, planBillingSource, planId, + prorateFirstPeriod, publishedAt, sendInvoice, status, diff --git a/src/main/java/com/schematic/api/types/GetOnboardingStateResp.java b/src/main/java/com/schematic/api/types/GetOnboardingStateResp.java index 8a3bc1ab..78649fa1 100644 --- a/src/main/java/com/schematic/api/types/GetOnboardingStateResp.java +++ b/src/main/java/com/schematic/api/types/GetOnboardingStateResp.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 java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -22,37 +23,67 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = GetOnboardingStateResp.Builder.class) public final class GetOnboardingStateResp { + private final Optional agentConnectedAt; + + private final Optional dismissedAt; + private final Optional environmentId; private final List milestones; private final Optional path; + private final Optional pricingPageUrl; + private final List requirements; + private final Optional stripeImport; + private final List suggestedNext; private final Optional track; + private final Optional websiteUrl; + private final Map additionalProperties; private GetOnboardingStateResp( + Optional agentConnectedAt, + Optional dismissedAt, Optional environmentId, List milestones, Optional path, + Optional pricingPageUrl, List requirements, + Optional stripeImport, List suggestedNext, Optional track, + Optional websiteUrl, Map additionalProperties) { + this.agentConnectedAt = agentConnectedAt; + this.dismissedAt = dismissedAt; this.environmentId = environmentId; this.milestones = milestones; this.path = path; + this.pricingPageUrl = pricingPageUrl; this.requirements = requirements; + this.stripeImport = stripeImport; this.suggestedNext = suggestedNext; this.track = track; + this.websiteUrl = websiteUrl; this.additionalProperties = additionalProperties; } + @JsonProperty("agent_connected_at") + public Optional getAgentConnectedAt() { + return agentConnectedAt; + } + + @JsonProperty("dismissed_at") + public Optional getDismissedAt() { + return dismissedAt; + } + @JsonProperty("environment_id") public Optional getEnvironmentId() { return environmentId; @@ -68,11 +99,21 @@ public Optional getPath() { return path; } + @JsonProperty("pricing_page_url") + public Optional getPricingPageUrl() { + return pricingPageUrl; + } + @JsonProperty("requirements") public List getRequirements() { return requirements; } + @JsonProperty("stripe_import") + public Optional getStripeImport() { + return stripeImport; + } + @JsonProperty("suggested_next") public List getSuggestedNext() { return suggestedNext; @@ -83,6 +124,11 @@ 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; @@ -95,18 +141,33 @@ public Map getAdditionalProperties() { } private boolean equalTo(GetOnboardingStateResp other) { - return environmentId.equals(other.environmentId) + return agentConnectedAt.equals(other.agentConnectedAt) + && dismissedAt.equals(other.dismissedAt) + && environmentId.equals(other.environmentId) && milestones.equals(other.milestones) && path.equals(other.path) + && pricingPageUrl.equals(other.pricingPageUrl) && requirements.equals(other.requirements) + && stripeImport.equals(other.stripeImport) && suggestedNext.equals(other.suggestedNext) - && track.equals(other.track); + && track.equals(other.track) + && websiteUrl.equals(other.websiteUrl); } @java.lang.Override public int hashCode() { return Objects.hash( - this.environmentId, this.milestones, this.path, this.requirements, this.suggestedNext, this.track); + this.agentConnectedAt, + this.dismissedAt, + this.environmentId, + this.milestones, + this.path, + this.pricingPageUrl, + this.requirements, + this.stripeImport, + this.suggestedNext, + this.track, + this.websiteUrl); } @java.lang.Override @@ -120,30 +181,67 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional agentConnectedAt = Optional.empty(); + + private Optional dismissedAt = Optional.empty(); + private Optional environmentId = Optional.empty(); private List milestones = new ArrayList<>(); private Optional path = Optional.empty(); + private Optional pricingPageUrl = Optional.empty(); + private List requirements = new ArrayList<>(); + private Optional stripeImport = Optional.empty(); + private List suggestedNext = new ArrayList<>(); private Optional track = Optional.empty(); + private Optional websiteUrl = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} public Builder from(GetOnboardingStateResp other) { + agentConnectedAt(other.getAgentConnectedAt()); + dismissedAt(other.getDismissedAt()); environmentId(other.getEnvironmentId()); milestones(other.getMilestones()); path(other.getPath()); + pricingPageUrl(other.getPricingPageUrl()); requirements(other.getRequirements()); + stripeImport(other.getStripeImport()); suggestedNext(other.getSuggestedNext()); track(other.getTrack()); + websiteUrl(other.getWebsiteUrl()); + return this; + } + + @JsonSetter(value = "agent_connected_at", nulls = Nulls.SKIP) + public Builder agentConnectedAt(Optional agentConnectedAt) { + this.agentConnectedAt = agentConnectedAt; + return this; + } + + public Builder agentConnectedAt(OffsetDateTime agentConnectedAt) { + this.agentConnectedAt = Optional.ofNullable(agentConnectedAt); + return this; + } + + @JsonSetter(value = "dismissed_at", nulls = Nulls.SKIP) + public Builder dismissedAt(Optional dismissedAt) { + this.dismissedAt = dismissedAt; + return this; + } + + public Builder dismissedAt(OffsetDateTime dismissedAt) { + this.dismissedAt = Optional.ofNullable(dismissedAt); return this; } @@ -190,6 +288,17 @@ public Builder path(OnboardingPath 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 = "requirements", nulls = Nulls.SKIP) public Builder requirements(List requirements) { this.requirements.clear(); @@ -211,6 +320,17 @@ public Builder addAllRequirements(List requirements) return this; } + @JsonSetter(value = "stripe_import", nulls = Nulls.SKIP) + public Builder stripeImport(Optional stripeImport) { + this.stripeImport = stripeImport; + return this; + } + + public Builder stripeImport(OnboardingStripeImport stripeImport) { + this.stripeImport = Optional.ofNullable(stripeImport); + return this; + } + @JsonSetter(value = "suggested_next", nulls = Nulls.SKIP) public Builder suggestedNext(List suggestedNext) { this.suggestedNext.clear(); @@ -243,9 +363,31 @@ public Builder track(OnboardingTrack 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 GetOnboardingStateResp build() { return new GetOnboardingStateResp( - environmentId, milestones, path, requirements, suggestedNext, track, additionalProperties); + agentConnectedAt, + dismissedAt, + environmentId, + milestones, + path, + pricingPageUrl, + requirements, + stripeImport, + suggestedNext, + track, + websiteUrl, + additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/OnboardingRequirement.java b/src/main/java/com/schematic/api/types/OnboardingRequirement.java index f4332e9b..55d3f07a 100644 --- a/src/main/java/com/schematic/api/types/OnboardingRequirement.java +++ b/src/main/java/com/schematic/api/types/OnboardingRequirement.java @@ -18,6 +18,9 @@ public final class OnboardingRequirement { public static final OnboardingRequirement FIRST_FLAG_CHECK = new OnboardingRequirement(Value.FIRST_FLAG_CHECK, "first_flag_check"); + public static final OnboardingRequirement CONNECT_AGENT = + new OnboardingRequirement(Value.CONNECT_AGENT, "connect_agent"); + public static final OnboardingRequirement CONNECT_BILLING = new OnboardingRequirement(Value.CONNECT_BILLING, "connect_billing"); @@ -65,6 +68,8 @@ public T visit(Visitor visitor) { return visitor.visitSendEvents(); case FIRST_FLAG_CHECK: return visitor.visitFirstFlagCheck(); + case CONNECT_AGENT: + return visitor.visitConnectAgent(); case CONNECT_BILLING: return visitor.visitConnectBilling(); case MODEL_PACKAGING: @@ -86,6 +91,8 @@ public static OnboardingRequirement valueOf(String value) { return SEND_EVENTS; case "first_flag_check": return FIRST_FLAG_CHECK; + case "connect_agent": + return CONNECT_AGENT; case "connect_billing": return CONNECT_BILLING; case "model_packaging": @@ -96,6 +103,8 @@ public static OnboardingRequirement valueOf(String value) { } public enum Value { + CONNECT_AGENT, + CONNECT_BILLING, CREATE_API_KEY, @@ -112,6 +121,8 @@ public enum Value { } public interface Visitor { + T visitConnectAgent(); + T visitConnectBilling(); T visitCreateApiKey(); diff --git a/src/main/java/com/schematic/api/types/OnboardingStripeImport.java b/src/main/java/com/schematic/api/types/OnboardingStripeImport.java new file mode 100644 index 00000000..4c4fdae4 --- /dev/null +++ b/src/main/java/com/schematic/api/types/OnboardingStripeImport.java @@ -0,0 +1,95 @@ +/** + * 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 OnboardingStripeImport { + public static final OnboardingStripeImport COMPLETE = new OnboardingStripeImport(Value.COMPLETE, "complete"); + + public static final OnboardingStripeImport NOT_STARTED = + new OnboardingStripeImport(Value.NOT_STARTED, "not_started"); + + public static final OnboardingStripeImport RUNNING = new OnboardingStripeImport(Value.RUNNING, "running"); + + private final Value value; + + private final String string; + + OnboardingStripeImport(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 OnboardingStripeImport + && this.string.equals(((OnboardingStripeImport) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPLETE: + return visitor.visitComplete(); + case NOT_STARTED: + return visitor.visitNotStarted(); + case RUNNING: + return visitor.visitRunning(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OnboardingStripeImport valueOf(String value) { + switch (value) { + case "complete": + return COMPLETE; + case "not_started": + return NOT_STARTED; + case "running": + return RUNNING; + default: + return new OnboardingStripeImport(Value.UNKNOWN, value); + } + } + + public enum Value { + COMPLETE, + + NOT_STARTED, + + RUNNING, + + UNKNOWN + } + + public interface Visitor { + T visitComplete(); + + T visitNotStarted(); + + T visitRunning(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PendingMigrationResponseData.java b/src/main/java/com/schematic/api/types/PendingMigrationResponseData.java new file mode 100644 index 00000000..b209d81c --- /dev/null +++ b/src/main/java/com/schematic/api/types/PendingMigrationResponseData.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PendingMigrationResponseData.Builder.class) +public final class PendingMigrationResponseData { + private final String migrationId; + + private final Optional scheduledFor; + + private final String toPlanId; + + private final String toPlanName; + + private final String toPlanVersionId; + + private final Optional toPlanVersionNumber; + + private final Map additionalProperties; + + private PendingMigrationResponseData( + String migrationId, + Optional scheduledFor, + String toPlanId, + String toPlanName, + String toPlanVersionId, + Optional toPlanVersionNumber, + Map additionalProperties) { + this.migrationId = migrationId; + this.scheduledFor = scheduledFor; + this.toPlanId = toPlanId; + this.toPlanName = toPlanName; + this.toPlanVersionId = toPlanVersionId; + this.toPlanVersionNumber = toPlanVersionNumber; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("migration_id") + public String getMigrationId() { + return migrationId; + } + + @JsonProperty("scheduled_for") + public Optional getScheduledFor() { + return scheduledFor; + } + + @JsonProperty("to_plan_id") + public String getToPlanId() { + return toPlanId; + } + + @JsonProperty("to_plan_name") + public String getToPlanName() { + return toPlanName; + } + + @JsonProperty("to_plan_version_id") + public String getToPlanVersionId() { + return toPlanVersionId; + } + + @JsonProperty("to_plan_version_number") + public Optional getToPlanVersionNumber() { + return toPlanVersionNumber; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PendingMigrationResponseData && equalTo((PendingMigrationResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PendingMigrationResponseData other) { + return migrationId.equals(other.migrationId) + && scheduledFor.equals(other.scheduledFor) + && toPlanId.equals(other.toPlanId) + && toPlanName.equals(other.toPlanName) + && toPlanVersionId.equals(other.toPlanVersionId) + && toPlanVersionNumber.equals(other.toPlanVersionNumber); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.migrationId, + this.scheduledFor, + this.toPlanId, + this.toPlanName, + this.toPlanVersionId, + this.toPlanVersionNumber); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MigrationIdStage builder() { + return new Builder(); + } + + public interface MigrationIdStage { + ToPlanIdStage migrationId(@NotNull String migrationId); + + Builder from(PendingMigrationResponseData other); + } + + public interface ToPlanIdStage { + ToPlanNameStage toPlanId(@NotNull String toPlanId); + } + + public interface ToPlanNameStage { + ToPlanVersionIdStage toPlanName(@NotNull String toPlanName); + } + + public interface ToPlanVersionIdStage { + _FinalStage toPlanVersionId(@NotNull String toPlanVersionId); + } + + public interface _FinalStage { + PendingMigrationResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage scheduledFor(Optional scheduledFor); + + _FinalStage scheduledFor(OffsetDateTime scheduledFor); + + _FinalStage toPlanVersionNumber(Optional toPlanVersionNumber); + + _FinalStage toPlanVersionNumber(Long toPlanVersionNumber); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements MigrationIdStage, ToPlanIdStage, ToPlanNameStage, ToPlanVersionIdStage, _FinalStage { + private String migrationId; + + private String toPlanId; + + private String toPlanName; + + private String toPlanVersionId; + + private Optional toPlanVersionNumber = Optional.empty(); + + private Optional scheduledFor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PendingMigrationResponseData other) { + migrationId(other.getMigrationId()); + scheduledFor(other.getScheduledFor()); + toPlanId(other.getToPlanId()); + toPlanName(other.getToPlanName()); + toPlanVersionId(other.getToPlanVersionId()); + toPlanVersionNumber(other.getToPlanVersionNumber()); + return this; + } + + @java.lang.Override + @JsonSetter("migration_id") + public ToPlanIdStage migrationId(@NotNull String migrationId) { + this.migrationId = Objects.requireNonNull(migrationId, "migrationId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_id") + public ToPlanNameStage toPlanId(@NotNull String toPlanId) { + this.toPlanId = Objects.requireNonNull(toPlanId, "toPlanId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_name") + public ToPlanVersionIdStage toPlanName(@NotNull String toPlanName) { + this.toPlanName = Objects.requireNonNull(toPlanName, "toPlanName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_version_id") + public _FinalStage toPlanVersionId(@NotNull String toPlanVersionId) { + this.toPlanVersionId = Objects.requireNonNull(toPlanVersionId, "toPlanVersionId must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage toPlanVersionNumber(Long toPlanVersionNumber) { + this.toPlanVersionNumber = Optional.ofNullable(toPlanVersionNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "to_plan_version_number", nulls = Nulls.SKIP) + public _FinalStage toPlanVersionNumber(Optional toPlanVersionNumber) { + this.toPlanVersionNumber = toPlanVersionNumber; + return this; + } + + @java.lang.Override + public _FinalStage scheduledFor(OffsetDateTime scheduledFor) { + this.scheduledFor = Optional.ofNullable(scheduledFor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_for", nulls = Nulls.SKIP) + public _FinalStage scheduledFor(Optional scheduledFor) { + this.scheduledFor = scheduledFor; + return this; + } + + @java.lang.Override + public PendingMigrationResponseData build() { + return new PendingMigrationResponseData( + migrationId, + scheduledFor, + toPlanId, + toPlanName, + toPlanVersionId, + toPlanVersionNumber, + 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/PlanVersionCompanyMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java index 4210eb65..78fcae45 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java @@ -40,6 +40,8 @@ public final class PlanVersionCompanyMigrationResponseData { private final Optional planVersionIdFrom; + private final Optional scheduledFor; + private final Optional startedAt; private final PlanVersionCompanyMigrationStatus status; @@ -58,6 +60,7 @@ private PlanVersionCompanyMigrationResponseData( String id, String migrationId, Optional planVersionIdFrom, + Optional scheduledFor, Optional startedAt, PlanVersionCompanyMigrationStatus status, OffsetDateTime updatedAt, @@ -71,6 +74,7 @@ private PlanVersionCompanyMigrationResponseData( this.id = id; this.migrationId = migrationId; this.planVersionIdFrom = planVersionIdFrom; + this.scheduledFor = scheduledFor; this.startedAt = startedAt; this.status = status; this.updatedAt = updatedAt; @@ -122,6 +126,14 @@ public Optional getPlanVersionIdFrom() { return planVersionIdFrom; } + /** + * @return When this company is expected to migrate, for a migration scheduled at the end of the billing period: the end of the company's current billing period. Only set while both the company and the migration are still pending. A value at or before the time of the request means the company has no active subscription and migrates as soon as processing runs. Null means no upcoming renewal could be determined from the company's current billing status (for example, a past-due subscription or one set to cancel); it does not mean the company will never migrate. + */ + @JsonProperty("scheduled_for") + public Optional getScheduledFor() { + return scheduledFor; + } + @JsonProperty("started_at") public Optional getStartedAt() { return startedAt; @@ -159,6 +171,7 @@ private boolean equalTo(PlanVersionCompanyMigrationResponseData other) { && id.equals(other.id) && migrationId.equals(other.migrationId) && planVersionIdFrom.equals(other.planVersionIdFrom) + && scheduledFor.equals(other.scheduledFor) && startedAt.equals(other.startedAt) && status.equals(other.status) && updatedAt.equals(other.updatedAt); @@ -176,6 +189,7 @@ public int hashCode() { this.id, this.migrationId, this.planVersionIdFrom, + this.scheduledFor, this.startedAt, this.status, this.updatedAt); @@ -243,6 +257,13 @@ public interface _FinalStage { _FinalStage planVersionIdFrom(String planVersionIdFrom); + /** + *

When this company is expected to migrate, for a migration scheduled at the end of the billing period: the end of the company's current billing period. Only set while both the company and the migration are still pending. A value at or before the time of the request means the company has no active subscription and migrates as soon as processing runs. Null means no upcoming renewal could be determined from the company's current billing status (for example, a past-due subscription or one set to cancel); it does not mean the company will never migrate.

+ */ + _FinalStage scheduledFor(Optional scheduledFor); + + _FinalStage scheduledFor(OffsetDateTime scheduledFor); + _FinalStage startedAt(Optional startedAt); _FinalStage startedAt(OffsetDateTime startedAt); @@ -274,6 +295,8 @@ public static final class Builder private Optional startedAt = Optional.empty(); + private Optional scheduledFor = Optional.empty(); + private Optional planVersionIdFrom = Optional.empty(); private Optional errorCode = Optional.empty(); @@ -298,6 +321,7 @@ public Builder from(PlanVersionCompanyMigrationResponseData other) { id(other.getId()); migrationId(other.getMigrationId()); planVersionIdFrom(other.getPlanVersionIdFrom()); + scheduledFor(other.getScheduledFor()); startedAt(other.getStartedAt()); status(other.getStatus()); updatedAt(other.getUpdatedAt()); @@ -366,6 +390,26 @@ public _FinalStage startedAt(Optional startedAt) { return this; } + /** + *

When this company is expected to migrate, for a migration scheduled at the end of the billing period: the end of the company's current billing period. Only set while both the company and the migration are still pending. A value at or before the time of the request means the company has no active subscription and migrates as soon as processing runs. Null means no upcoming renewal could be determined from the company's current billing status (for example, a past-due subscription or one set to cancel); it does not mean the company will never migrate.

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

When this company is expected to migrate, for a migration scheduled at the end of the billing period: the end of the company's current billing period. Only set while both the company and the migration are still pending. A value at or before the time of the request means the company has no active subscription and migrates as soon as processing runs. Null means no upcoming renewal could be determined from the company's current billing status (for example, a past-due subscription or one set to cancel); it does not mean the company will never migrate.

+ */ + @java.lang.Override + @JsonSetter(value = "scheduled_for", nulls = Nulls.SKIP) + public _FinalStage scheduledFor(Optional scheduledFor) { + this.scheduledFor = scheduledFor; + return this; + } + @java.lang.Override public _FinalStage planVersionIdFrom(String planVersionIdFrom) { this.planVersionIdFrom = Optional.ofNullable(planVersionIdFrom); @@ -430,6 +474,7 @@ public PlanVersionCompanyMigrationResponseData build() { id, migrationId, planVersionIdFrom, + scheduledFor, startedAt, status, updatedAt, diff --git a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java index 460d25f1..29dc6864 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java +++ b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java @@ -22,6 +22,9 @@ public final class PlanVersionCompanyMigrationStatus { public static final PlanVersionCompanyMigrationStatus COMPLETED = new PlanVersionCompanyMigrationStatus(Value.COMPLETED, "completed"); + public static final PlanVersionCompanyMigrationStatus CANCELLED = + new PlanVersionCompanyMigrationStatus(Value.CANCELLED, "cancelled"); + private final Value value; private final String string; @@ -65,6 +68,8 @@ public T visit(Visitor visitor) { return visitor.visitPending(); case COMPLETED: return visitor.visitCompleted(); + case CANCELLED: + return visitor.visitCancelled(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -84,12 +89,16 @@ public static PlanVersionCompanyMigrationStatus valueOf(String value) { return PENDING; case "completed": return COMPLETED; + case "cancelled": + return CANCELLED; default: return new PlanVersionCompanyMigrationStatus(Value.UNKNOWN, value); } } public enum Value { + CANCELLED, + COMPLETED, FAILED, @@ -104,6 +113,8 @@ public enum Value { } public interface Visitor { + T visitCancelled(); + T visitCompleted(); T visitFailed(); diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java index 3f5882de..1fac81d2 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java @@ -36,6 +36,8 @@ public final class PlanVersionMigrationResponseData { private final String id; + private final Optional nextDueAt; + private final String planId; private final Optional planVersionIdFrom; @@ -67,6 +69,7 @@ private PlanVersionMigrationResponseData( Optional error, long failedCompanies, String id, + Optional nextDueAt, String planId, Optional planVersionIdFrom, String planVersionIdTo, @@ -85,6 +88,7 @@ private PlanVersionMigrationResponseData( this.error = error; this.failedCompanies = failedCompanies; this.id = id; + this.nextDueAt = nextDueAt; this.planId = planId; this.planVersionIdFrom = planVersionIdFrom; this.planVersionIdTo = planVersionIdTo; @@ -129,6 +133,11 @@ public String getId() { return id; } + @JsonProperty("next_due_at") + public Optional getNextDueAt() { + return nextDueAt; + } + @JsonProperty("plan_id") public String getPlanId() { return planId; @@ -202,6 +211,7 @@ private boolean equalTo(PlanVersionMigrationResponseData other) { && error.equals(other.error) && failedCompanies == other.failedCompanies && id.equals(other.id) + && nextDueAt.equals(other.nextDueAt) && planId.equals(other.planId) && planVersionIdFrom.equals(other.planVersionIdFrom) && planVersionIdTo.equals(other.planVersionIdTo) @@ -224,6 +234,7 @@ public int hashCode() { this.error, this.failedCompanies, this.id, + this.nextDueAt, this.planId, this.planVersionIdFrom, this.planVersionIdTo, @@ -307,6 +318,10 @@ public interface _FinalStage { _FinalStage error(String error); + _FinalStage nextDueAt(Optional nextDueAt); + + _FinalStage nextDueAt(OffsetDateTime nextDueAt); + _FinalStage planVersionIdFrom(Optional planVersionIdFrom); _FinalStage planVersionIdFrom(String planVersionIdFrom); @@ -370,6 +385,8 @@ public static final class Builder private Optional planVersionIdFrom = Optional.empty(); + private Optional nextDueAt = Optional.empty(); + private Optional error = Optional.empty(); private Optional completedAt = Optional.empty(); @@ -387,6 +404,7 @@ public Builder from(PlanVersionMigrationResponseData other) { error(other.getError()); failedCompanies(other.getFailedCompanies()); id(other.getId()); + nextDueAt(other.getNextDueAt()); planId(other.getPlanId()); planVersionIdFrom(other.getPlanVersionIdFrom()); planVersionIdTo(other.getPlanVersionIdTo()); @@ -541,6 +559,19 @@ public _FinalStage planVersionIdFrom(Optional planVersionIdFrom) { return this; } + @java.lang.Override + public _FinalStage nextDueAt(OffsetDateTime nextDueAt) { + this.nextDueAt = Optional.ofNullable(nextDueAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "next_due_at", nulls = Nulls.SKIP) + public _FinalStage nextDueAt(Optional nextDueAt) { + this.nextDueAt = nextDueAt; + return this; + } + @java.lang.Override public _FinalStage error(String error) { this.error = Optional.ofNullable(error); @@ -576,6 +607,7 @@ public PlanVersionMigrationResponseData build() { error, failedCompanies, id, + nextDueAt, planId, planVersionIdFrom, planVersionIdTo, diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java index f0c7f533..95836580 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java @@ -17,6 +17,9 @@ public final class PlanVersionMigrationStatus { public static final PlanVersionMigrationStatus COMPLETED = new PlanVersionMigrationStatus(Value.COMPLETED, "completed"); + public static final PlanVersionMigrationStatus CANCELLED = + new PlanVersionMigrationStatus(Value.CANCELLED, "cancelled"); + private final Value value; private final String string; @@ -58,6 +61,8 @@ public T visit(Visitor visitor) { return visitor.visitPending(); case COMPLETED: return visitor.visitCompleted(); + case CANCELLED: + return visitor.visitCancelled(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -75,12 +80,16 @@ public static PlanVersionMigrationStatus valueOf(String value) { return PENDING; case "completed": return COMPLETED; + case "cancelled": + return CANCELLED; default: return new PlanVersionMigrationStatus(Value.UNKNOWN, value); } } public enum Value { + CANCELLED, + COMPLETED, FAILED, @@ -93,6 +102,8 @@ public enum Value { } public interface Visitor { + T visitCancelled(); + T visitCompleted(); T visitFailed(); diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java index 6d2b82e6..d5a13417 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java @@ -10,6 +10,9 @@ public final class PlanVersionMigrationStrategy { public static final PlanVersionMigrationStrategy IMMEDIATE = new PlanVersionMigrationStrategy(Value.IMMEDIATE, "immediate"); + public static final PlanVersionMigrationStrategy END_OF_BILLING_PERIOD = + new PlanVersionMigrationStrategy(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); + public static final PlanVersionMigrationStrategy LEAVE = new PlanVersionMigrationStrategy(Value.LEAVE, "leave"); private final Value value; @@ -47,6 +50,8 @@ public T visit(Visitor visitor) { switch (value) { case IMMEDIATE: return visitor.visitImmediate(); + case END_OF_BILLING_PERIOD: + return visitor.visitEndOfBillingPeriod(); case LEAVE: return visitor.visitLeave(); case UNKNOWN: @@ -60,6 +65,8 @@ public static PlanVersionMigrationStrategy valueOf(String value) { switch (value) { case "immediate": return IMMEDIATE; + case "end_of_billing_period": + return END_OF_BILLING_PERIOD; case "leave": return LEAVE; default: @@ -68,6 +75,8 @@ public static PlanVersionMigrationStrategy valueOf(String value) { } public enum Value { + END_OF_BILLING_PERIOD, + IMMEDIATE, LEAVE, @@ -76,6 +85,8 @@ public enum Value { } public interface Visitor { + T visitEndOfBillingPeriod(); + T visitImmediate(); T visitLeave(); From a6c63c76a52e55fda73b2482f8db805b23554eaa Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2026 10:05:57 +0000 Subject: [PATCH 2/2] [fern-replay] advance lockfile --- .fern/replay.lock | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.fern/replay.lock b/.fern/replay.lock index f89d935f..4d7431c0 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -48,5 +48,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.19.1 -current_generation: 7a38b7c515a80d831d371307d9a21782f33b2f7b + - commit_sha: 075a15a28676baf75bb4cf01a59dba1440bff350 + tree_hash: c21d611a7dc5e0265874b505959829cc947d33ee + timestamp: 2026-08-31T10:05:54.410Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.19.2 +current_generation: 075a15a28676baf75bb4cf01a59dba1440bff350 patches: []