From 4db31b80b3498376dd6c82960867f7f79f058181 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:30:22 +0000 Subject: [PATCH] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.8.11 --- .fern/metadata.json | 8 +- build.gradle | 4 +- reference.md | 318 ++++++++++++++++ .../com/schematic/api/core/ClientOptions.java | 4 +- .../companies/AsyncRawCompaniesClient.java | 8 + .../companies/RawCompaniesClient.java | 8 + .../requests/CountCompaniesRequest.java | 37 ++ .../requests/ListCompaniesRequest.java | 37 ++ .../companies/types/CountCompaniesParams.java | 32 ++ .../companies/types/ListCompaniesParams.java | 32 ++ ...llingLinkedPlanEntitlementRequestBody.java | 45 +++ .../CreatePlanEntitlementRequestBody.java | 45 +++ .../UpdatePlanEntitlementRequestBody.java | 45 +++ .../AsyncPlanmigrationsClient.java | 40 ++ .../AsyncRawPlanmigrationsClient.java | 283 +++++++++++++++ .../planmigrations/PlanmigrationsClient.java | 37 ++ .../RawPlanmigrationsClient.java | 212 +++++++++++ .../requests/CreateMigrationInput.java | 342 ++++++++++++++++++ .../requests/RetryMigrationRequestBody.java | 117 ++++++ .../types/CreateMigrationResponse.java | 183 ++++++++++ .../types/RetryCompanyMigrationResponse.java | 183 ++++++++++ .../types/RetryMigrationResponse.java | 183 ++++++++++ .../api/resources/plans/AsyncPlansClient.java | 17 + .../resources/plans/AsyncRawPlansClient.java | 108 ++++++ .../api/resources/plans/PlansClient.java | 17 + .../api/resources/plans/RawPlansClient.java | 84 +++++ .../plans/requests/CountPlansRequest.java | 32 ++ .../plans/requests/ListPlansRequest.java | 32 ++ .../plans/types/CountPlansParams.java | 32 ++ .../plans/types/ListPlansParams.java | 32 ++ .../MarkCustomPlanBillingPaidResponse.java | 183 ++++++++++ .../api/types/CheckoutSubscription.java | 32 ++ .../types/CompanyPlanDetailResponseData.java | 78 ++-- .../CreateEntitlementInBundleRequestBody.java | 45 +++ .../types/CustomPlanBillingResponseData.java | 32 ++ .../api/types/IntegrationConfig.java | 60 ++- .../schematic/api/types/IntegrationType.java | 10 + .../api/types/MigrationErrorCode.java | 183 ++++++++++ .../api/types/PlanDetailResponseData.java | 32 ++ .../types/PlanEntitlementResponseData.java | 45 +++ .../PlanGroupPlanDetailResponseData.java | 78 ++-- .../schematic/api/types/PlanPriceCadence.java | 93 +++++ ...anVersionCompanyMigrationResponseData.java | 32 ++ .../PlanVersionMigrationResponseData.java | 47 +++ .../api/types/PlanViewPublicResponseData.java | 78 ++-- .../api/types/StripeIntegrationConfig.java | 55 +-- .../UsageBasedEntitlementRequestBody.java | 32 ++ .../UsageBasedEntitlementResponseData.java | 45 +++ .../api/types/WorkOsIntegrationConfig.java | 142 ++++++++ 49 files changed, 3732 insertions(+), 127 deletions(-) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/requests/RetryMigrationRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/CreateMigrationResponse.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/RetryCompanyMigrationResponse.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/RetryMigrationResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/MarkCustomPlanBillingPaidResponse.java create mode 100644 src/main/java/com/schematic/api/types/MigrationErrorCode.java create mode 100644 src/main/java/com/schematic/api/types/PlanPriceCadence.java create mode 100644 src/main/java/com/schematic/api/types/WorkOsIntegrationConfig.java diff --git a/.fern/metadata.json b/.fern/metadata.json index 4187eb6..da30af9 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.6.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.8.10", + "generatorVersion": "4.8.11", "generatorConfig": { "client-class-name": "BaseSchematic", "generate-unknown-as-json-node": true, @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "470e0f433ab9bb0e88784674fa2e1efce62ebd9b", + "originGitCommit": "a3057c10aa6a1daa708dc714c89ce943f67a722a", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.4.0", + "requestedVersion": "1.4.1", "ciProvider": "github", - "sdkVersion": "1.4.0" + "sdkVersion": "1.4.1" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 672a8ee..6162f37 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ java { group = 'com.schematichq' -version = '1.4.0' +version = '1.4.1' jar { dependsOn(":generatePomFileForMavenPublication") @@ -83,7 +83,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.4.0' + version = '1.4.1' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index 52ed1da..fe12d17 100644 --- a/reference.md +++ b/reference.md @@ -6483,6 +6483,9 @@ client.companies().listCompanies( .planIds( Arrays.asList("plan_ids") ) + .planVersionIds( + Arrays.asList("plan_version_ids") + ) .subscriptionStatuses( Arrays.asList(SubscriptionStatus.ACTIVE) ) @@ -6575,6 +6578,14 @@ client.companies().listCompanies(
+**planVersionIds:** `Optional` — Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -6852,6 +6863,9 @@ client.companies().countCompanies( .planIds( Arrays.asList("plan_ids") ) + .planVersionIds( + Arrays.asList("plan_version_ids") + ) .subscriptionStatuses( Arrays.asList(SubscriptionStatus.ACTIVE) ) @@ -6944,6 +6958,14 @@ client.companies().countCompanies(
+**planVersionIds:** `Optional` — Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -10625,6 +10647,14 @@ client.entitlements().createPlanEntitlement(
+**usageQuantity:** `Optional` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + +
+
+ +
+
+ **valueBool:** `Optional`
@@ -10943,6 +10973,14 @@ client.entitlements().updatePlanEntitlement(
+**usageQuantity:** `Optional` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + +
+
+ +
+
+ **valueBool:** `Optional`
@@ -11296,6 +11334,14 @@ client.entitlements().upsertPlanEntitlementForBillingProduct(
+**usageQuantity:** `Optional` — The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + +
+
+ +
+
+ **valueBool:** `Optional`
@@ -11771,6 +11817,59 @@ client.plans().listCustomPlanBillings(
+ +
+ + +
client.plans.markCustomPlanBillingPaid(customPlanBillingId, request) -> MarkCustomPlanBillingPaidResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().markCustomPlanBillingPaid( + "custom_plan_billing_id", + new HashMap() {{ + put("key", ObjectMappers.JSON_MAPPER.valueToTree("value")); + }} +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**customPlanBillingId:** `String` — custom_plan_billing_id + +
+
+ +
+
+ +**request:** `Map` + +
+
+
+
+ +
@@ -11971,6 +12070,7 @@ client.plans().listPlans( .planType(PlanType.PLAN) .q("q") .scopedToCompanyId("scoped_to_company_id") + .withEntitlements(true) .withoutEntitlementFor("without_entitlement_for") .withoutPaidProductId(true) .limit(1000000L) @@ -12087,6 +12187,14 @@ client.plans().listPlans(
+**withEntitlements:** `Optional` — Include each plan's entitlements in the response + +
+
+ +
+
+ **withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -12644,6 +12752,7 @@ client.plans().countPlans( .planType(PlanType.PLAN) .q("q") .scopedToCompanyId("scoped_to_company_id") + .withEntitlements(true) .withoutEntitlementFor("without_entitlement_for") .withoutPaidProductId(true) .limit(1000000L) @@ -12760,6 +12869,14 @@ client.plans().countPlans(
+**withEntitlements:** `Optional` — Include each plan's entitlements in the response + +
+
+ +
+
+ **withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -16886,6 +17003,46 @@ client.planmigrations().listCompanyMigrations(
+ +
+ + +
client.planmigrations.retryCompanyMigration(planVersionCompanyMigrationId) -> RetryCompanyMigrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().retryCompanyMigration("plan_version_company_migration_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planVersionCompanyMigrationId:** `String` — plan_version_company_migration_id + +
+
+
+
+ +
@@ -17039,6 +17196,111 @@ client.planmigrations().listMigrations(
+ +
+ + +
client.planmigrations.createMigration(request) -> CreateMigrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().createMigration( + CreateMigrationInput + .builder() + .planId("plan_id") + .planVersionIdTo("plan_version_id_to") + .strategy(PlanVersionMigrationStrategy.IMMEDIATE) + .targetPlanType(PlanType.PLAN) + .companyIds( + Arrays.asList("company_ids") + ) + .excludedCompanyIds( + Arrays.asList("excluded_company_ids") + ) + .planVersionIdsFrom( + Arrays.asList("plan_version_ids_from") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyIds:** `List` + +
+
+ +
+
+ +**excludedCompanyIds:** `List` + +
+
+ +
+
+ +**planId:** `String` + +
+
+ +
+
+ +**planVersionIdTo:** `String` + +
+
+ +
+
+ +**planVersionIdsFrom:** `List` + +
+
+ +
+
+ +**strategy:** `PlanVersionMigrationStrategy` + +
+
+ +
+
+ +**targetPlanType:** `PlanType` + +
+
+
+
+ +
@@ -17079,6 +17341,62 @@ client.planmigrations().getMigration("plan_version_migration_id");
+ + + + +
client.planmigrations.retryMigration(planVersionMigrationId, request) -> RetryMigrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().retryMigration( + "plan_version_migration_id", + RetryMigrationRequestBody + .builder() + .errorCodes( + Arrays.asList(MigrationErrorCode.AMBIGUOUS_SUBSCRIPTION_ITEM) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planVersionMigrationId:** `String` — plan_version_migration_id + +
+
+ +
+
+ +**errorCodes:** `List` + +
+
+
+
+ +
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index b5d94b9..8a4dc65 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.4.0"); + put("User-Agent", "com.schematichq:schematic-java/1.4.1"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.4.0"); + put("X-Fern-SDK-Version", "1.4.1"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java index 8080ce8..84ed57d 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -202,6 +202,10 @@ public CompletableFuture> listC QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } if (request.getSubscriptionStatuses().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -673,6 +677,10 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } if (request.getSubscriptionStatuses().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java index 99aed3b..b513da1 100644 --- a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java @@ -196,6 +196,10 @@ public BaseSchematicHttpResponse listCompanies( QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } if (request.getSubscriptionStatuses().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -569,6 +573,10 @@ public BaseSchematicHttpResponse countCompanies( QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } if (request.getSubscriptionStatuses().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java index fb2b7bc..933d8b1 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java @@ -31,6 +31,8 @@ public final class CountCompaniesRequest { private final Optional> planIds; + private final Optional> planVersionIds; + private final Optional> subscriptionStatuses; private final Optional> subscriptionTypes; @@ -69,6 +71,7 @@ private CountCompaniesRequest( Optional> creditTypeIds, Optional> ids, Optional> planIds, + Optional> planVersionIds, Optional> subscriptionStatuses, Optional> subscriptionTypes, Optional hasScheduledDowngrade, @@ -89,6 +92,7 @@ private CountCompaniesRequest( this.creditTypeIds = creditTypeIds; this.ids = ids; this.planIds = planIds; + this.planVersionIds = planVersionIds; this.subscriptionStatuses = subscriptionStatuses; this.subscriptionTypes = subscriptionTypes; this.hasScheduledDowngrade = hasScheduledDowngrade; @@ -132,6 +136,14 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Filter companies by one or more subscription statuses */ @@ -275,6 +287,7 @@ private boolean equalTo(CountCompaniesRequest other) { return creditTypeIds.equals(other.creditTypeIds) && ids.equals(other.ids) && planIds.equals(other.planIds) + && planVersionIds.equals(other.planVersionIds) && subscriptionStatuses.equals(other.subscriptionStatuses) && subscriptionTypes.equals(other.subscriptionTypes) && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) @@ -299,6 +312,7 @@ public int hashCode() { this.creditTypeIds, this.ids, this.planIds, + this.planVersionIds, this.subscriptionStatuses, this.subscriptionTypes, this.hasScheduledDowngrade, @@ -334,6 +348,8 @@ public static final class Builder { private Optional> planIds = Optional.empty(); + private Optional> planVersionIds = Optional.empty(); + private Optional> subscriptionStatuses = Optional.empty(); private Optional> subscriptionTypes = Optional.empty(); @@ -375,6 +391,7 @@ public Builder from(CountCompaniesRequest other) { creditTypeIds(other.getCreditTypeIds()); ids(other.getIds()); planIds(other.getPlanIds()); + planVersionIds(other.getPlanVersionIds()); subscriptionStatuses(other.getSubscriptionStatuses()); subscriptionTypes(other.getSubscriptionTypes()); hasScheduledDowngrade(other.getHasScheduledDowngrade()); @@ -451,6 +468,25 @@ public Builder planIds(String planIds) { return this; } + /** + *

Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set.

+ */ + @JsonSetter(value = "plan_version_ids", nulls = Nulls.SKIP) + public Builder planVersionIds(Optional> planVersionIds) { + this.planVersionIds = planVersionIds; + return this; + } + + public Builder planVersionIds(List planVersionIds) { + this.planVersionIds = Optional.ofNullable(planVersionIds); + return this; + } + + public Builder planVersionIds(String planVersionIds) { + this.planVersionIds = Optional.of(Collections.singletonList(planVersionIds)); + return this; + } + /** *

Filter companies by one or more subscription statuses

*/ @@ -690,6 +726,7 @@ public CountCompaniesRequest build() { creditTypeIds, ids, planIds, + planVersionIds, subscriptionStatuses, subscriptionTypes, hasScheduledDowngrade, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java index 28ee241..67fe63f 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java @@ -31,6 +31,8 @@ public final class ListCompaniesRequest { private final Optional> planIds; + private final Optional> planVersionIds; + private final Optional> subscriptionStatuses; private final Optional> subscriptionTypes; @@ -69,6 +71,7 @@ private ListCompaniesRequest( Optional> creditTypeIds, Optional> ids, Optional> planIds, + Optional> planVersionIds, Optional> subscriptionStatuses, Optional> subscriptionTypes, Optional hasScheduledDowngrade, @@ -89,6 +92,7 @@ private ListCompaniesRequest( this.creditTypeIds = creditTypeIds; this.ids = ids; this.planIds = planIds; + this.planVersionIds = planVersionIds; this.subscriptionStatuses = subscriptionStatuses; this.subscriptionTypes = subscriptionTypes; this.hasScheduledDowngrade = hasScheduledDowngrade; @@ -132,6 +136,14 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Filter companies by one or more subscription statuses */ @@ -275,6 +287,7 @@ private boolean equalTo(ListCompaniesRequest other) { return creditTypeIds.equals(other.creditTypeIds) && ids.equals(other.ids) && planIds.equals(other.planIds) + && planVersionIds.equals(other.planVersionIds) && subscriptionStatuses.equals(other.subscriptionStatuses) && subscriptionTypes.equals(other.subscriptionTypes) && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) @@ -299,6 +312,7 @@ public int hashCode() { this.creditTypeIds, this.ids, this.planIds, + this.planVersionIds, this.subscriptionStatuses, this.subscriptionTypes, this.hasScheduledDowngrade, @@ -334,6 +348,8 @@ public static final class Builder { private Optional> planIds = Optional.empty(); + private Optional> planVersionIds = Optional.empty(); + private Optional> subscriptionStatuses = Optional.empty(); private Optional> subscriptionTypes = Optional.empty(); @@ -375,6 +391,7 @@ public Builder from(ListCompaniesRequest other) { creditTypeIds(other.getCreditTypeIds()); ids(other.getIds()); planIds(other.getPlanIds()); + planVersionIds(other.getPlanVersionIds()); subscriptionStatuses(other.getSubscriptionStatuses()); subscriptionTypes(other.getSubscriptionTypes()); hasScheduledDowngrade(other.getHasScheduledDowngrade()); @@ -451,6 +468,25 @@ public Builder planIds(String planIds) { return this; } + /** + *

Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set.

+ */ + @JsonSetter(value = "plan_version_ids", nulls = Nulls.SKIP) + public Builder planVersionIds(Optional> planVersionIds) { + this.planVersionIds = planVersionIds; + return this; + } + + public Builder planVersionIds(List planVersionIds) { + this.planVersionIds = Optional.ofNullable(planVersionIds); + return this; + } + + public Builder planVersionIds(String planVersionIds) { + this.planVersionIds = Optional.of(Collections.singletonList(planVersionIds)); + return this; + } + /** *

Filter companies by one or more subscription statuses

*/ @@ -690,6 +726,7 @@ public ListCompaniesRequest build() { creditTypeIds, ids, planIds, + planVersionIds, subscriptionStatuses, subscriptionTypes, hasScheduledDowngrade, diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java index 3b58715..d4a60ff 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java @@ -42,6 +42,8 @@ public final class CountCompaniesParams { private final Optional planVersionId; + private final Optional> planVersionIds; + private final Optional q; private final Optional sortOrderColumn; @@ -74,6 +76,7 @@ private CountCompaniesParams( Optional planId, Optional> planIds, Optional planVersionId, + Optional> planVersionIds, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -94,6 +97,7 @@ private CountCompaniesParams( this.planId = planId; this.planIds = planIds; this.planVersionId = planVersionId; + this.planVersionIds = planVersionIds; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -179,6 +183,14 @@ public Optional getPlanVersionId() { return planVersionId; } + /** + * @return Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Search for companies by name, keys or string traits */ @@ -280,6 +292,7 @@ private boolean equalTo(CountCompaniesParams other) { && planId.equals(other.planId) && planIds.equals(other.planIds) && planVersionId.equals(other.planVersionId) + && planVersionIds.equals(other.planVersionIds) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -304,6 +317,7 @@ public int hashCode() { this.planId, this.planIds, this.planVersionId, + this.planVersionIds, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -345,6 +359,8 @@ public static final class Builder { private Optional planVersionId = Optional.empty(); + private Optional> planVersionIds = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -380,6 +396,7 @@ public Builder from(CountCompaniesParams other) { planId(other.getPlanId()); planIds(other.getPlanIds()); planVersionId(other.getPlanVersionId()); + planVersionIds(other.getPlanVersionIds()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -519,6 +536,20 @@ public Builder planVersionId(String planVersionId) { return this; } + /** + *

Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set.

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

Search for companies by name, keys or string traits

*/ @@ -670,6 +701,7 @@ public CountCompaniesParams build() { planId, planIds, planVersionId, + planVersionIds, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java index c6ae112..9bf973a 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java @@ -42,6 +42,8 @@ public final class ListCompaniesParams { private final Optional planVersionId; + private final Optional> planVersionIds; + private final Optional q; private final Optional sortOrderColumn; @@ -74,6 +76,7 @@ private ListCompaniesParams( Optional planId, Optional> planIds, Optional planVersionId, + Optional> planVersionIds, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -94,6 +97,7 @@ private ListCompaniesParams( this.planId = planId; this.planIds = planIds; this.planVersionId = planVersionId; + this.planVersionIds = planVersionIds; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -179,6 +183,14 @@ public Optional getPlanVersionId() { return planVersionId; } + /** + * @return Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set. + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Search for companies by name, keys or string traits */ @@ -280,6 +292,7 @@ private boolean equalTo(ListCompaniesParams other) { && planId.equals(other.planId) && planIds.equals(other.planIds) && planVersionId.equals(other.planVersionId) + && planVersionIds.equals(other.planVersionIds) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -304,6 +317,7 @@ public int hashCode() { this.planId, this.planIds, this.planVersionId, + this.planVersionIds, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -345,6 +359,8 @@ public static final class Builder { private Optional planVersionId = Optional.empty(); + private Optional> planVersionIds = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -380,6 +396,7 @@ public Builder from(ListCompaniesParams other) { planId(other.getPlanId()); planIds(other.getPlanIds()); planVersionId(other.getPlanVersionId()); + planVersionIds(other.getPlanVersionIds()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -519,6 +536,20 @@ public Builder planVersionId(String planVersionId) { return this; } + /** + *

Filter companies by one or more plan version IDs (each ID starts with plvr_). Takes precedence over plan_version_id when set.

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

Search for companies by name, keys or string traits

*/ @@ -670,6 +701,7 @@ public ListCompaniesParams build() { planId, planIds, planVersionId, + planVersionIds, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java index 88a4a4b..96a25bf 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java @@ -80,6 +80,8 @@ public final class CreateBillingLinkedPlanEntitlementRequestBody { private final Optional tierMode; + private final Optional usageQuantity; + private final Optional valueBool; private final Optional valueCreditId; @@ -126,6 +128,7 @@ private CreateBillingLinkedPlanEntitlementRequestBody( Optional quarterlyUnitPriceDecimal, Optional softLimit, Optional tierMode, + Optional usageQuantity, Optional valueBool, Optional valueCreditId, Optional valueNumeric, @@ -161,6 +164,7 @@ private CreateBillingLinkedPlanEntitlementRequestBody( this.quarterlyUnitPriceDecimal = quarterlyUnitPriceDecimal; this.softLimit = softLimit; this.tierMode = tierMode; + this.usageQuantity = usageQuantity; this.valueBool = valueBool; this.valueCreditId = valueCreditId; this.valueNumeric = valueNumeric; @@ -301,6 +305,14 @@ public Optional getTierMode() { return tierMode; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("value_bool") public Optional getValueBool() { return valueBool; @@ -384,6 +396,7 @@ private boolean equalTo(CreateBillingLinkedPlanEntitlementRequestBody other) { && quarterlyUnitPriceDecimal.equals(other.quarterlyUnitPriceDecimal) && softLimit.equals(other.softLimit) && tierMode.equals(other.tierMode) + && usageQuantity.equals(other.usageQuantity) && valueBool.equals(other.valueBool) && valueCreditId.equals(other.valueCreditId) && valueNumeric.equals(other.valueNumeric) @@ -423,6 +436,7 @@ public int hashCode() { this.quarterlyUnitPriceDecimal, this.softLimit, this.tierMode, + this.usageQuantity, this.valueBool, this.valueCreditId, this.valueNumeric, @@ -559,6 +573,13 @@ public interface _FinalStage { _FinalStage tierMode(BillingTiersMode tierMode); + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + _FinalStage usageQuantity(Optional usageQuantity); + + _FinalStage usageQuantity(Long usageQuantity); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -626,6 +647,8 @@ public static final class Builder private Optional valueBool = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -700,6 +723,7 @@ public Builder from(CreateBillingLinkedPlanEntitlementRequestBody other) { quarterlyUnitPriceDecimal(other.getQuarterlyUnitPriceDecimal()); softLimit(other.getSoftLimit()); tierMode(other.getTierMode()); + usageQuantity(other.getUsageQuantity()); valueBool(other.getValueBool()); valueCreditId(other.getValueCreditId()); valueNumeric(other.getValueNumeric()); @@ -851,6 +875,26 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

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

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @java.lang.Override + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public _FinalStage usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + @java.lang.Override public _FinalStage tierMode(BillingTiersMode tierMode) { this.tierMode = Optional.ofNullable(tierMode); @@ -1159,6 +1203,7 @@ public CreateBillingLinkedPlanEntitlementRequestBody build() { quarterlyUnitPriceDecimal, softLimit, tierMode, + usageQuantity, valueBool, valueCreditId, valueNumeric, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java index 67b6de5..bae882b 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java @@ -75,6 +75,8 @@ public final class CreatePlanEntitlementRequestBody { private final Optional tierMode; + private final Optional usageQuantity; + private final Optional valueBool; private final Optional valueCreditId; @@ -119,6 +121,7 @@ private CreatePlanEntitlementRequestBody( Optional quarterlyUnitPriceDecimal, Optional softLimit, Optional tierMode, + Optional usageQuantity, Optional valueBool, Optional valueCreditId, Optional valueNumeric, @@ -152,6 +155,7 @@ private CreatePlanEntitlementRequestBody( this.quarterlyUnitPriceDecimal = quarterlyUnitPriceDecimal; this.softLimit = softLimit; this.tierMode = tierMode; + this.usageQuantity = usageQuantity; this.valueBool = valueBool; this.valueCreditId = valueCreditId; this.valueNumeric = valueNumeric; @@ -282,6 +286,14 @@ public Optional getTierMode() { return tierMode; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("value_bool") public Optional getValueBool() { return valueBool; @@ -362,6 +374,7 @@ private boolean equalTo(CreatePlanEntitlementRequestBody other) { && quarterlyUnitPriceDecimal.equals(other.quarterlyUnitPriceDecimal) && softLimit.equals(other.softLimit) && tierMode.equals(other.tierMode) + && usageQuantity.equals(other.usageQuantity) && valueBool.equals(other.valueBool) && valueCreditId.equals(other.valueCreditId) && valueNumeric.equals(other.valueNumeric) @@ -399,6 +412,7 @@ public int hashCode() { this.quarterlyUnitPriceDecimal, this.softLimit, this.tierMode, + this.usageQuantity, this.valueBool, this.valueCreditId, this.valueNumeric, @@ -527,6 +541,13 @@ public interface _FinalStage { _FinalStage tierMode(BillingTiersMode tierMode); + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + _FinalStage usageQuantity(Optional usageQuantity); + + _FinalStage usageQuantity(Long usageQuantity); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -584,6 +605,8 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional valueBool = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -656,6 +679,7 @@ public Builder from(CreatePlanEntitlementRequestBody other) { quarterlyUnitPriceDecimal(other.getQuarterlyUnitPriceDecimal()); softLimit(other.getSoftLimit()); tierMode(other.getTierMode()); + usageQuantity(other.getUsageQuantity()); valueBool(other.getValueBool()); valueCreditId(other.getValueCreditId()); valueNumeric(other.getValueNumeric()); @@ -793,6 +817,26 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

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

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @java.lang.Override + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public _FinalStage usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + @java.lang.Override public _FinalStage tierMode(BillingTiersMode tierMode) { this.tierMode = Optional.ofNullable(tierMode); @@ -1099,6 +1143,7 @@ public CreatePlanEntitlementRequestBody build() { quarterlyUnitPriceDecimal, softLimit, tierMode, + usageQuantity, valueBool, valueCreditId, valueNumeric, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java index 2a39f38..2f80d73 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java @@ -69,6 +69,8 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional tierMode; + private final Optional usageQuantity; + private final Optional valueBool; private final Optional valueCreditId; @@ -110,6 +112,7 @@ private UpdatePlanEntitlementRequestBody( Optional quarterlyUnitPriceDecimal, Optional softLimit, Optional tierMode, + Optional usageQuantity, Optional valueBool, Optional valueCreditId, Optional valueNumeric, @@ -140,6 +143,7 @@ private UpdatePlanEntitlementRequestBody( this.quarterlyUnitPriceDecimal = quarterlyUnitPriceDecimal; this.softLimit = softLimit; this.tierMode = tierMode; + this.usageQuantity = usageQuantity; this.valueBool = valueBool; this.valueCreditId = valueCreditId; this.valueNumeric = valueNumeric; @@ -255,6 +259,14 @@ public Optional getTierMode() { return tierMode; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("value_bool") public Optional getValueBool() { return valueBool; @@ -332,6 +344,7 @@ private boolean equalTo(UpdatePlanEntitlementRequestBody other) { && quarterlyUnitPriceDecimal.equals(other.quarterlyUnitPriceDecimal) && softLimit.equals(other.softLimit) && tierMode.equals(other.tierMode) + && usageQuantity.equals(other.usageQuantity) && valueBool.equals(other.valueBool) && valueCreditId.equals(other.valueCreditId) && valueNumeric.equals(other.valueNumeric) @@ -366,6 +379,7 @@ public int hashCode() { this.quarterlyUnitPriceDecimal, this.softLimit, this.tierMode, + this.usageQuantity, this.valueBool, this.valueCreditId, this.valueNumeric, @@ -482,6 +496,13 @@ public interface _FinalStage { _FinalStage tierMode(BillingTiersMode tierMode); + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + _FinalStage usageQuantity(Optional usageQuantity); + + _FinalStage usageQuantity(Long usageQuantity); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -535,6 +556,8 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional valueBool = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -602,6 +625,7 @@ public Builder from(UpdatePlanEntitlementRequestBody other) { quarterlyUnitPriceDecimal(other.getQuarterlyUnitPriceDecimal()); softLimit(other.getSoftLimit()); tierMode(other.getTierMode()); + usageQuantity(other.getUsageQuantity()); valueBool(other.getValueBool()); valueCreditId(other.getValueCreditId()); valueNumeric(other.getValueNumeric()); @@ -725,6 +749,26 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

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

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @java.lang.Override + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public _FinalStage usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + @java.lang.Override public _FinalStage tierMode(BillingTiersMode tierMode) { this.tierMode = Optional.ofNullable(tierMode); @@ -1015,6 +1059,7 @@ public UpdatePlanEntitlementRequestBody build() { quarterlyUnitPriceDecimal, softLimit, tierMode, + usageQuantity, valueBool, valueCreditId, valueNumeric, 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 448e672..cfb395c 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java @@ -7,13 +7,18 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.RetryCompanyMigrationResponse; +import com.schematic.api.resources.planmigrations.types.RetryMigrationResponse; import java.util.concurrent.CompletableFuture; public class AsyncPlanmigrationsClient { @@ -51,6 +56,20 @@ public CompletableFuture listCompanyMigrations( return this.rawClient.listCompanyMigrations(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture retryCompanyMigration( + String planVersionCompanyMigrationId) { + return this.rawClient + .retryCompanyMigration(planVersionCompanyMigrationId) + .thenApply(response -> response.body()); + } + + public CompletableFuture retryCompanyMigration( + String planVersionCompanyMigrationId, RequestOptions requestOptions) { + return this.rawClient + .retryCompanyMigration(planVersionCompanyMigrationId, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture countCompanyMigrations() { return this.rawClient.countCompanyMigrations().thenApply(response -> response.body()); } @@ -86,6 +105,15 @@ public CompletableFuture listMigrations( return this.rawClient.listMigrations(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture createMigration(CreateMigrationInput request) { + return this.rawClient.createMigration(request).thenApply(response -> response.body()); + } + + public CompletableFuture createMigration( + CreateMigrationInput request, RequestOptions requestOptions) { + return this.rawClient.createMigration(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture getMigration(String planVersionMigrationId) { return this.rawClient.getMigration(planVersionMigrationId).thenApply(response -> response.body()); } @@ -97,6 +125,18 @@ public CompletableFuture getMigration( .thenApply(response -> response.body()); } + public CompletableFuture retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request) { + return this.rawClient.retryMigration(planVersionMigrationId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .retryMigration(planVersionMigrationId, request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture countMigrations() { return this.rawClient.countMigrations().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 b948f0b..0d21687 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java @@ -8,6 +8,7 @@ import com.schematic.api.core.BaseSchematicException; import com.schematic.api.core.BaseSchematicHttpResponse; import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; @@ -18,13 +19,18 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.RetryCompanyMigrationResponse; +import com.schematic.api.resources.planmigrations.types.RetryMigrationResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -34,6 +40,7 @@ import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; import org.jetbrains.annotations.NotNull; @@ -159,6 +166,94 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> retryCompanyMigration( + String planVersionCompanyMigrationId) { + return retryCompanyMigration(planVersionCompanyMigrationId, null); + } + + public CompletableFuture> retryCompanyMigration( + String planVersionCompanyMigrationId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-company-migrations") + .addPathSegment(planVersionCompanyMigrationId) + .addPathSegments("retry"); + 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); + } + 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, RetryCompanyMigrationResponse.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 (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> countCompanyMigrations() { return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build()); } @@ -383,6 +478,99 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> createMigration( + CreateMigrationInput request) { + return createMigration(request, null); + } + + public CompletableFuture> createMigration( + CreateMigrationInput request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations"); + 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); + } + 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, CreateMigrationResponse.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 (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> getMigration( String planVersionMigrationId) { return getMigration(planVersionMigrationId, null); @@ -464,6 +652,101 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request) { + return retryMigration(planVersionMigrationId, request, null); + } + + public CompletableFuture> retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId) + .addPathSegments("retry"); + 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); + } + 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, RetryMigrationResponse.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 (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> countMigrations() { return countMigrations(CountMigrationsRequest.builder().build()); } 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 b837657..689508b 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java @@ -7,13 +7,18 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.RetryCompanyMigrationResponse; +import com.schematic.api.resources.planmigrations.types.RetryMigrationResponse; public class PlanmigrationsClient { protected final ClientOptions clientOptions; @@ -49,6 +54,19 @@ public ListCompanyMigrationsResponse listCompanyMigrations( return this.rawClient.listCompanyMigrations(request, requestOptions).body(); } + public RetryCompanyMigrationResponse retryCompanyMigration(String planVersionCompanyMigrationId) { + return this.rawClient + .retryCompanyMigration(planVersionCompanyMigrationId) + .body(); + } + + public RetryCompanyMigrationResponse retryCompanyMigration( + String planVersionCompanyMigrationId, RequestOptions requestOptions) { + return this.rawClient + .retryCompanyMigration(planVersionCompanyMigrationId, requestOptions) + .body(); + } + public CountCompanyMigrationsResponse countCompanyMigrations() { return this.rawClient.countCompanyMigrations().body(); } @@ -82,6 +100,14 @@ public ListMigrationsResponse listMigrations(ListMigrationsRequest request, Requ return this.rawClient.listMigrations(request, requestOptions).body(); } + public CreateMigrationResponse createMigration(CreateMigrationInput request) { + return this.rawClient.createMigration(request).body(); + } + + public CreateMigrationResponse createMigration(CreateMigrationInput request, RequestOptions requestOptions) { + return this.rawClient.createMigration(request, requestOptions).body(); + } + public GetMigrationResponse getMigration(String planVersionMigrationId) { return this.rawClient.getMigration(planVersionMigrationId).body(); } @@ -92,6 +118,17 @@ public GetMigrationResponse getMigration(String planVersionMigrationId, RequestO .body(); } + public RetryMigrationResponse retryMigration(String planVersionMigrationId, RetryMigrationRequestBody request) { + return this.rawClient.retryMigration(planVersionMigrationId, request).body(); + } + + public RetryMigrationResponse retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .retryMigration(planVersionMigrationId, request, requestOptions) + .body(); + } + public CountMigrationsResponse countMigrations() { return this.rawClient.countMigrations().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 964fae3..28deea0 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java @@ -8,6 +8,7 @@ import com.schematic.api.core.BaseSchematicException; import com.schematic.api.core.BaseSchematicHttpResponse; import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; @@ -18,19 +19,25 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CreateMigrationInput; import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.RetryMigrationRequestBody; import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CreateMigrationResponse; import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.RetryCompanyMigrationResponse; +import com.schematic.api.resources.planmigrations.types.RetryMigrationResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import okhttp3.Headers; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; @@ -131,6 +138,70 @@ public BaseSchematicHttpResponse listCompanyMigra } } + public BaseSchematicHttpResponse retryCompanyMigration( + String planVersionCompanyMigrationId) { + return retryCompanyMigration(planVersionCompanyMigrationId, null); + } + + public BaseSchematicHttpResponse retryCompanyMigration( + String planVersionCompanyMigrationId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-company-migrations") + .addPathSegment(planVersionCompanyMigrationId) + .addPathSegments("retry"); + 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); + } + 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, RetryCompanyMigrationResponse.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 (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countCompanyMigrations() { return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build()); } @@ -306,6 +377,75 @@ public BaseSchematicHttpResponse listMigrations( } } + public BaseSchematicHttpResponse createMigration(CreateMigrationInput request) { + return createMigration(request, null); + } + + public BaseSchematicHttpResponse createMigration( + CreateMigrationInput request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations"); + 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); + } + 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, CreateMigrationResponse.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 (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse getMigration(String planVersionMigrationId) { return getMigration(planVersionMigrationId, null); } @@ -364,6 +504,78 @@ public BaseSchematicHttpResponse getMigration( } } + public BaseSchematicHttpResponse retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request) { + return retryMigration(planVersionMigrationId, request, null); + } + + public BaseSchematicHttpResponse retryMigration( + String planVersionMigrationId, RetryMigrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId) + .addPathSegments("retry"); + 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); + } + 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, RetryMigrationResponse.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 (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countMigrations() { return countMigrations(CountMigrationsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java new file mode 100644 index 0000000..adca4fa --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CreateMigrationInput.java @@ -0,0 +1,342 @@ +/** + * 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.PlanType; +import com.schematic.api.types.PlanVersionMigrationStrategy; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMigrationInput.Builder.class) +public final class CreateMigrationInput { + private final List companyIds; + + private final List excludedCompanyIds; + + private final String planId; + + private final String planVersionIdTo; + + private final List planVersionIdsFrom; + + private final PlanVersionMigrationStrategy strategy; + + private final PlanType targetPlanType; + + private final Map additionalProperties; + + private CreateMigrationInput( + List companyIds, + List excludedCompanyIds, + String planId, + String planVersionIdTo, + List planVersionIdsFrom, + PlanVersionMigrationStrategy strategy, + PlanType targetPlanType, + Map additionalProperties) { + this.companyIds = companyIds; + this.excludedCompanyIds = excludedCompanyIds; + this.planId = planId; + this.planVersionIdTo = planVersionIdTo; + this.planVersionIdsFrom = planVersionIdsFrom; + this.strategy = strategy; + this.targetPlanType = targetPlanType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_ids") + public List getCompanyIds() { + return companyIds; + } + + @JsonProperty("excluded_company_ids") + public List getExcludedCompanyIds() { + return excludedCompanyIds; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonProperty("plan_version_id_to") + public String getPlanVersionIdTo() { + return planVersionIdTo; + } + + @JsonProperty("plan_version_ids_from") + public List getPlanVersionIdsFrom() { + return planVersionIdsFrom; + } + + @JsonProperty("strategy") + public PlanVersionMigrationStrategy getStrategy() { + return strategy; + } + + @JsonProperty("target_plan_type") + public PlanType getTargetPlanType() { + return targetPlanType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMigrationInput && equalTo((CreateMigrationInput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMigrationInput other) { + return companyIds.equals(other.companyIds) + && excludedCompanyIds.equals(other.excludedCompanyIds) + && planId.equals(other.planId) + && planVersionIdTo.equals(other.planVersionIdTo) + && planVersionIdsFrom.equals(other.planVersionIdsFrom) + && strategy.equals(other.strategy) + && targetPlanType.equals(other.targetPlanType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyIds, + this.excludedCompanyIds, + this.planId, + this.planVersionIdTo, + this.planVersionIdsFrom, + this.strategy, + this.targetPlanType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + PlanVersionIdToStage planId(@NotNull String planId); + + Builder from(CreateMigrationInput other); + } + + public interface PlanVersionIdToStage { + StrategyStage planVersionIdTo(@NotNull String planVersionIdTo); + } + + public interface StrategyStage { + TargetPlanTypeStage strategy(@NotNull PlanVersionMigrationStrategy strategy); + } + + public interface TargetPlanTypeStage { + _FinalStage targetPlanType(@NotNull PlanType targetPlanType); + } + + public interface _FinalStage { + CreateMigrationInput build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage companyIds(List companyIds); + + _FinalStage addCompanyIds(String companyIds); + + _FinalStage addAllCompanyIds(List companyIds); + + _FinalStage excludedCompanyIds(List excludedCompanyIds); + + _FinalStage addExcludedCompanyIds(String excludedCompanyIds); + + _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds); + + _FinalStage planVersionIdsFrom(List planVersionIdsFrom); + + _FinalStage addPlanVersionIdsFrom(String planVersionIdsFrom); + + _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements PlanIdStage, PlanVersionIdToStage, StrategyStage, TargetPlanTypeStage, _FinalStage { + private String planId; + + private String planVersionIdTo; + + private PlanVersionMigrationStrategy strategy; + + private PlanType targetPlanType; + + private List planVersionIdsFrom = new ArrayList<>(); + + private List excludedCompanyIds = new ArrayList<>(); + + private List companyIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMigrationInput other) { + companyIds(other.getCompanyIds()); + excludedCompanyIds(other.getExcludedCompanyIds()); + planId(other.getPlanId()); + planVersionIdTo(other.getPlanVersionIdTo()); + planVersionIdsFrom(other.getPlanVersionIdsFrom()); + strategy(other.getStrategy()); + targetPlanType(other.getTargetPlanType()); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public PlanVersionIdToStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_version_id_to") + public StrategyStage planVersionIdTo(@NotNull String planVersionIdTo) { + this.planVersionIdTo = Objects.requireNonNull(planVersionIdTo, "planVersionIdTo must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("strategy") + public TargetPlanTypeStage strategy(@NotNull PlanVersionMigrationStrategy strategy) { + this.strategy = Objects.requireNonNull(strategy, "strategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("target_plan_type") + public _FinalStage targetPlanType(@NotNull PlanType targetPlanType) { + this.targetPlanType = Objects.requireNonNull(targetPlanType, "targetPlanType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom) { + if (planVersionIdsFrom != null) { + this.planVersionIdsFrom.addAll(planVersionIdsFrom); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlanVersionIdsFrom(String planVersionIdsFrom) { + this.planVersionIdsFrom.add(planVersionIdsFrom); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_ids_from", nulls = Nulls.SKIP) + public _FinalStage planVersionIdsFrom(List planVersionIdsFrom) { + this.planVersionIdsFrom.clear(); + if (planVersionIdsFrom != null) { + this.planVersionIdsFrom.addAll(planVersionIdsFrom); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds) { + if (excludedCompanyIds != null) { + this.excludedCompanyIds.addAll(excludedCompanyIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addExcludedCompanyIds(String excludedCompanyIds) { + this.excludedCompanyIds.add(excludedCompanyIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "excluded_company_ids", nulls = Nulls.SKIP) + public _FinalStage excludedCompanyIds(List excludedCompanyIds) { + this.excludedCompanyIds.clear(); + if (excludedCompanyIds != null) { + this.excludedCompanyIds.addAll(excludedCompanyIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllCompanyIds(List companyIds) { + if (companyIds != null) { + this.companyIds.addAll(companyIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addCompanyIds(String companyIds) { + this.companyIds.add(companyIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_ids", nulls = Nulls.SKIP) + public _FinalStage companyIds(List companyIds) { + this.companyIds.clear(); + if (companyIds != null) { + this.companyIds.addAll(companyIds); + } + return this; + } + + @java.lang.Override + public CreateMigrationInput build() { + return new CreateMigrationInput( + companyIds, + excludedCompanyIds, + planId, + planVersionIdTo, + planVersionIdsFrom, + strategy, + targetPlanType, + 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/requests/RetryMigrationRequestBody.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/RetryMigrationRequestBody.java new file mode 100644 index 0000000..69822eb --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/RetryMigrationRequestBody.java @@ -0,0 +1,117 @@ +/** + * 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.MigrationErrorCode; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RetryMigrationRequestBody.Builder.class) +public final class RetryMigrationRequestBody { + private final List errorCodes; + + private final Map additionalProperties; + + private RetryMigrationRequestBody(List errorCodes, Map additionalProperties) { + this.errorCodes = errorCodes; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("error_codes") + public List getErrorCodes() { + return errorCodes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RetryMigrationRequestBody && equalTo((RetryMigrationRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetryMigrationRequestBody other) { + return errorCodes.equals(other.errorCodes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.errorCodes); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List errorCodes = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RetryMigrationRequestBody other) { + errorCodes(other.getErrorCodes()); + return this; + } + + @JsonSetter(value = "error_codes", nulls = Nulls.SKIP) + public Builder errorCodes(List errorCodes) { + this.errorCodes.clear(); + if (errorCodes != null) { + this.errorCodes.addAll(errorCodes); + } + return this; + } + + public Builder addErrorCodes(MigrationErrorCode errorCodes) { + this.errorCodes.add(errorCodes); + return this; + } + + public Builder addAllErrorCodes(List errorCodes) { + if (errorCodes != null) { + this.errorCodes.addAll(errorCodes); + } + return this; + } + + public RetryMigrationRequestBody build() { + return new RetryMigrationRequestBody(errorCodes, 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/CreateMigrationResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CreateMigrationResponse.java new file mode 100644 index 0000000..46897a5 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CreateMigrationResponse.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 = CreateMigrationResponse.Builder.class) +public final class CreateMigrationResponse { + private final PlanVersionMigrationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private CreateMigrationResponse( + 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 CreateMigrationResponse && equalTo((CreateMigrationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMigrationResponse 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(CreateMigrationResponse other); + } + + public interface _FinalStage { + CreateMigrationResponse 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(CreateMigrationResponse 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 CreateMigrationResponse build() { + return new CreateMigrationResponse(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/RetryCompanyMigrationResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/RetryCompanyMigrationResponse.java new file mode 100644 index 0000000..ced059d --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/RetryCompanyMigrationResponse.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.PlanVersionCompanyMigrationResponseData; +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 = RetryCompanyMigrationResponse.Builder.class) +public final class RetryCompanyMigrationResponse { + private final PlanVersionCompanyMigrationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private RetryCompanyMigrationResponse( + PlanVersionCompanyMigrationResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanVersionCompanyMigrationResponseData 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 RetryCompanyMigrationResponse && equalTo((RetryCompanyMigrationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetryCompanyMigrationResponse 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 PlanVersionCompanyMigrationResponseData data); + + Builder from(RetryCompanyMigrationResponse other); + } + + public interface _FinalStage { + RetryCompanyMigrationResponse 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 PlanVersionCompanyMigrationResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RetryCompanyMigrationResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanVersionCompanyMigrationResponseData 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 RetryCompanyMigrationResponse build() { + return new RetryCompanyMigrationResponse(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/RetryMigrationResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/RetryMigrationResponse.java new file mode 100644 index 0000000..79449d7 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/RetryMigrationResponse.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 = RetryMigrationResponse.Builder.class) +public final class RetryMigrationResponse { + private final PlanVersionMigrationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private RetryMigrationResponse( + 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 RetryMigrationResponse && equalTo((RetryMigrationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RetryMigrationResponse 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(RetryMigrationResponse other); + } + + public interface _FinalStage { + RetryMigrationResponse 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(RetryMigrationResponse 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 RetryMigrationResponse build() { + return new RetryMigrationResponse(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/AsyncPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java index 19e2e04..8e3b5cc 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java @@ -3,6 +3,7 @@ */ package com.schematic.api.resources.plans; +import com.fasterxml.jackson.databind.JsonNode; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.plans.requests.CountBillingProductMatchCompaniesRequest; @@ -29,6 +30,7 @@ import com.schematic.api.resources.plans.types.ListCustomPlanBillingsResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.MarkCustomPlanBillingPaidResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.RetryCustomPlanBillingResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; @@ -38,6 +40,7 @@ import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; +import java.util.Map; import java.util.concurrent.CompletableFuture; public class AsyncPlansClient { @@ -87,6 +90,20 @@ public CompletableFuture listCustomPlanBillings( return this.rawClient.listCustomPlanBillings(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture markCustomPlanBillingPaid( + String customPlanBillingId, Map request) { + return this.rawClient + .markCustomPlanBillingPaid(customPlanBillingId, request) + .thenApply(response -> response.body()); + } + + public CompletableFuture markCustomPlanBillingPaid( + String customPlanBillingId, Map request, RequestOptions requestOptions) { + return this.rawClient + .markCustomPlanBillingPaid(customPlanBillingId, request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture retryCustomPlanBilling( String customPlanBillingId, RetryCustomPlanBillingRequestBody request) { return this.rawClient diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java index c814beb..cef9a06 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java @@ -4,6 +4,7 @@ package com.schematic.api.resources.plans; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.schematic.api.core.BaseSchematicApiException; import com.schematic.api.core.BaseSchematicException; import com.schematic.api.core.BaseSchematicHttpResponse; @@ -41,6 +42,7 @@ import com.schematic.api.resources.plans.types.ListCustomPlanBillingsResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.MarkCustomPlanBillingPaidResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.RetryCustomPlanBillingResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; @@ -52,6 +54,7 @@ import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; import java.io.IOException; +import java.util.Map; import java.util.concurrent.CompletableFuture; import okhttp3.Call; import okhttp3.Callback; @@ -285,6 +288,103 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> markCustomPlanBillingPaid( + String customPlanBillingId, Map request) { + return markCustomPlanBillingPaid(customPlanBillingId, request, null); + } + + public CompletableFuture> markCustomPlanBillingPaid( + String customPlanBillingId, Map request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("custom-plan-billings") + .addPathSegment(customPlanBillingId) + .addPathSegments("mark-paid"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + 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, MarkCustomPlanBillingPaidResponse.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 (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> retryCustomPlanBilling( String customPlanBillingId, RetryCustomPlanBillingRequestBody request) { return retryCustomPlanBilling(customPlanBillingId, request, null); @@ -549,6 +649,10 @@ public CompletableFuture> listPlans request.getScopedToCompanyId().get(), false); } + if (request.getWithEntitlements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_entitlements", request.getWithEntitlements().get(), false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -1481,6 +1585,10 @@ public CompletableFuture> countPla request.getScopedToCompanyId().get(), false); } + if (request.getWithEntitlements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_entitlements", request.getWithEntitlements().get(), false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/plans/PlansClient.java b/src/main/java/com/schematic/api/resources/plans/PlansClient.java index 464a1b6..c8472d7 100644 --- a/src/main/java/com/schematic/api/resources/plans/PlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/PlansClient.java @@ -3,6 +3,7 @@ */ package com.schematic.api.resources.plans; +import com.fasterxml.jackson.databind.JsonNode; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.plans.requests.CountBillingProductMatchCompaniesRequest; @@ -29,6 +30,7 @@ import com.schematic.api.resources.plans.types.ListCustomPlanBillingsResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.MarkCustomPlanBillingPaidResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.RetryCustomPlanBillingResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; @@ -38,6 +40,7 @@ import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; +import java.util.Map; public class PlansClient { protected final ClientOptions clientOptions; @@ -84,6 +87,20 @@ public ListCustomPlanBillingsResponse listCustomPlanBillings( return this.rawClient.listCustomPlanBillings(request, requestOptions).body(); } + public MarkCustomPlanBillingPaidResponse markCustomPlanBillingPaid( + String customPlanBillingId, Map request) { + return this.rawClient + .markCustomPlanBillingPaid(customPlanBillingId, request) + .body(); + } + + public MarkCustomPlanBillingPaidResponse markCustomPlanBillingPaid( + String customPlanBillingId, Map request, RequestOptions requestOptions) { + return this.rawClient + .markCustomPlanBillingPaid(customPlanBillingId, request, requestOptions) + .body(); + } + public RetryCustomPlanBillingResponse retryCustomPlanBilling( String customPlanBillingId, RetryCustomPlanBillingRequestBody request) { return this.rawClient diff --git a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java index 30de07b..eec7295 100644 --- a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java @@ -4,6 +4,7 @@ package com.schematic.api.resources.plans; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.schematic.api.core.BaseSchematicApiException; import com.schematic.api.core.BaseSchematicException; import com.schematic.api.core.BaseSchematicHttpResponse; @@ -41,6 +42,7 @@ import com.schematic.api.resources.plans.types.ListCustomPlanBillingsResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.MarkCustomPlanBillingPaidResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.RetryCustomPlanBillingResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; @@ -52,6 +54,7 @@ import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; import java.io.IOException; +import java.util.Map; import okhttp3.Headers; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @@ -233,6 +236,79 @@ public BaseSchematicHttpResponse listCustomPlanB } } + public BaseSchematicHttpResponse markCustomPlanBillingPaid( + String customPlanBillingId, Map request) { + return markCustomPlanBillingPaid(customPlanBillingId, request, null); + } + + public BaseSchematicHttpResponse markCustomPlanBillingPaid( + String customPlanBillingId, Map request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("custom-plan-billings") + .addPathSegment(customPlanBillingId) + .addPathSegments("mark-paid"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + 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, MarkCustomPlanBillingPaidResponse.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 (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse retryCustomPlanBilling( String customPlanBillingId, RetryCustomPlanBillingRequestBody request) { return retryCustomPlanBilling(customPlanBillingId, request, null); @@ -449,6 +525,10 @@ public BaseSchematicHttpResponse listPlans( request.getScopedToCompanyId().get(), false); } + if (request.getWithEntitlements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_entitlements", request.getWithEntitlements().get(), false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -1160,6 +1240,10 @@ public BaseSchematicHttpResponse countPlans( request.getScopedToCompanyId().get(), false); } + if (request.getWithEntitlements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_entitlements", request.getWithEntitlements().get(), false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java index fd3afa2..18e42c7 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java @@ -47,6 +47,8 @@ public final class CountPlansRequest { private final Optional scopedToCompanyId; + private final Optional withEntitlements; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -70,6 +72,7 @@ private CountPlansRequest( Optional planType, Optional q, Optional scopedToCompanyId, + Optional withEntitlements, Optional withoutEntitlementFor, Optional withoutPaidProductId, Optional limit, @@ -87,6 +90,7 @@ private CountPlansRequest( this.planType = planType; this.q = q; this.scopedToCompanyId = scopedToCompanyId; + this.withEntitlements = withEntitlements; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; @@ -181,6 +185,14 @@ public Optional getScopedToCompanyId() { return scopedToCompanyId; } + /** + * @return Include each plan's entitlements in the response + */ + @JsonProperty("with_entitlements") + public Optional getWithEntitlements() { + return withEntitlements; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -237,6 +249,7 @@ private boolean equalTo(CountPlansRequest other) { && planType.equals(other.planType) && q.equals(other.q) && scopedToCompanyId.equals(other.scopedToCompanyId) + && withEntitlements.equals(other.withEntitlements) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) @@ -258,6 +271,7 @@ public int hashCode() { this.planType, this.q, this.scopedToCompanyId, + this.withEntitlements, this.withoutEntitlementFor, this.withoutPaidProductId, this.limit, @@ -299,6 +313,8 @@ public static final class Builder { private Optional scopedToCompanyId = Optional.empty(); + private Optional withEntitlements = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -325,6 +341,7 @@ public Builder from(CountPlansRequest other) { planType(other.getPlanType()); q(other.getQ()); scopedToCompanyId(other.getScopedToCompanyId()); + withEntitlements(other.getWithEntitlements()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); @@ -496,6 +513,20 @@ public Builder scopedToCompanyId(String scopedToCompanyId) { return this; } + /** + *

Include each plan's entitlements in the response

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -566,6 +597,7 @@ public CountPlansRequest build() { planType, q, scopedToCompanyId, + withEntitlements, withoutEntitlementFor, withoutPaidProductId, limit, diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java index db7de96..b335011 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java @@ -47,6 +47,8 @@ public final class ListPlansRequest { private final Optional scopedToCompanyId; + private final Optional withEntitlements; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -70,6 +72,7 @@ private ListPlansRequest( Optional planType, Optional q, Optional scopedToCompanyId, + Optional withEntitlements, Optional withoutEntitlementFor, Optional withoutPaidProductId, Optional limit, @@ -87,6 +90,7 @@ private ListPlansRequest( this.planType = planType; this.q = q; this.scopedToCompanyId = scopedToCompanyId; + this.withEntitlements = withEntitlements; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; @@ -181,6 +185,14 @@ public Optional getScopedToCompanyId() { return scopedToCompanyId; } + /** + * @return Include each plan's entitlements in the response + */ + @JsonProperty("with_entitlements") + public Optional getWithEntitlements() { + return withEntitlements; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -237,6 +249,7 @@ private boolean equalTo(ListPlansRequest other) { && planType.equals(other.planType) && q.equals(other.q) && scopedToCompanyId.equals(other.scopedToCompanyId) + && withEntitlements.equals(other.withEntitlements) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) @@ -258,6 +271,7 @@ public int hashCode() { this.planType, this.q, this.scopedToCompanyId, + this.withEntitlements, this.withoutEntitlementFor, this.withoutPaidProductId, this.limit, @@ -299,6 +313,8 @@ public static final class Builder { private Optional scopedToCompanyId = Optional.empty(); + private Optional withEntitlements = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -325,6 +341,7 @@ public Builder from(ListPlansRequest other) { planType(other.getPlanType()); q(other.getQ()); scopedToCompanyId(other.getScopedToCompanyId()); + withEntitlements(other.getWithEntitlements()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); @@ -496,6 +513,20 @@ public Builder scopedToCompanyId(String scopedToCompanyId) { return this; } + /** + *

Include each plan's entitlements in the response

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -566,6 +597,7 @@ public ListPlansRequest build() { planType, q, scopedToCompanyId, + withEntitlements, withoutEntitlementFor, withoutPaidProductId, limit, diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java index ae611ff..c852aa6 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java @@ -50,6 +50,8 @@ public final class CountPlansParams { private final Optional scopedToCompanyId; + private final Optional withEntitlements; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -71,6 +73,7 @@ private CountPlansParams( Optional planType, Optional q, Optional scopedToCompanyId, + Optional withEntitlements, Optional withoutEntitlementFor, Optional withoutPaidProductId, Map additionalProperties) { @@ -88,6 +91,7 @@ private CountPlansParams( this.planType = planType; this.q = q; this.scopedToCompanyId = scopedToCompanyId; + this.withEntitlements = withEntitlements; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.additionalProperties = additionalProperties; @@ -196,6 +200,14 @@ public Optional getScopedToCompanyId() { return scopedToCompanyId; } + /** + * @return Include each plan's entitlements in the response + */ + @JsonProperty("with_entitlements") + public Optional getWithEntitlements() { + return withEntitlements; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -238,6 +250,7 @@ private boolean equalTo(CountPlansParams other) { && planType.equals(other.planType) && q.equals(other.q) && scopedToCompanyId.equals(other.scopedToCompanyId) + && withEntitlements.equals(other.withEntitlements) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId); } @@ -259,6 +272,7 @@ public int hashCode() { this.planType, this.q, this.scopedToCompanyId, + this.withEntitlements, this.withoutEntitlementFor, this.withoutPaidProductId); } @@ -302,6 +316,8 @@ public static final class Builder { private Optional scopedToCompanyId = Optional.empty(); + private Optional withEntitlements = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -326,6 +342,7 @@ public Builder from(CountPlansParams other) { planType(other.getPlanType()); q(other.getQ()); scopedToCompanyId(other.getScopedToCompanyId()); + withEntitlements(other.getWithEntitlements()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); return this; @@ -518,6 +535,20 @@ public Builder scopedToCompanyId(String scopedToCompanyId) { return this; } + /** + *

Include each plan's entitlements in the response

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -562,6 +593,7 @@ public CountPlansParams build() { planType, q, scopedToCompanyId, + withEntitlements, withoutEntitlementFor, withoutPaidProductId, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java index 39ca210..8c48a99 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java @@ -50,6 +50,8 @@ public final class ListPlansParams { private final Optional scopedToCompanyId; + private final Optional withEntitlements; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -71,6 +73,7 @@ private ListPlansParams( Optional planType, Optional q, Optional scopedToCompanyId, + Optional withEntitlements, Optional withoutEntitlementFor, Optional withoutPaidProductId, Map additionalProperties) { @@ -88,6 +91,7 @@ private ListPlansParams( this.planType = planType; this.q = q; this.scopedToCompanyId = scopedToCompanyId; + this.withEntitlements = withEntitlements; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.additionalProperties = additionalProperties; @@ -196,6 +200,14 @@ public Optional getScopedToCompanyId() { return scopedToCompanyId; } + /** + * @return Include each plan's entitlements in the response + */ + @JsonProperty("with_entitlements") + public Optional getWithEntitlements() { + return withEntitlements; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -238,6 +250,7 @@ private boolean equalTo(ListPlansParams other) { && planType.equals(other.planType) && q.equals(other.q) && scopedToCompanyId.equals(other.scopedToCompanyId) + && withEntitlements.equals(other.withEntitlements) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId); } @@ -259,6 +272,7 @@ public int hashCode() { this.planType, this.q, this.scopedToCompanyId, + this.withEntitlements, this.withoutEntitlementFor, this.withoutPaidProductId); } @@ -302,6 +316,8 @@ public static final class Builder { private Optional scopedToCompanyId = Optional.empty(); + private Optional withEntitlements = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -326,6 +342,7 @@ public Builder from(ListPlansParams other) { planType(other.getPlanType()); q(other.getQ()); scopedToCompanyId(other.getScopedToCompanyId()); + withEntitlements(other.getWithEntitlements()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); return this; @@ -518,6 +535,20 @@ public Builder scopedToCompanyId(String scopedToCompanyId) { return this; } + /** + *

Include each plan's entitlements in the response

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -562,6 +593,7 @@ public ListPlansParams build() { planType, q, scopedToCompanyId, + withEntitlements, withoutEntitlementFor, withoutPaidProductId, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/types/MarkCustomPlanBillingPaidResponse.java b/src/main/java/com/schematic/api/resources/plans/types/MarkCustomPlanBillingPaidResponse.java new file mode 100644 index 0000000..15df000 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/MarkCustomPlanBillingPaidResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.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.CustomPlanBillingResponseData; +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 = MarkCustomPlanBillingPaidResponse.Builder.class) +public final class MarkCustomPlanBillingPaidResponse { + private final CustomPlanBillingResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private MarkCustomPlanBillingPaidResponse( + CustomPlanBillingResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CustomPlanBillingResponseData 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 MarkCustomPlanBillingPaidResponse && equalTo((MarkCustomPlanBillingPaidResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MarkCustomPlanBillingPaidResponse 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 CustomPlanBillingResponseData data); + + Builder from(MarkCustomPlanBillingPaidResponse other); + } + + public interface _FinalStage { + MarkCustomPlanBillingPaidResponse 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 CustomPlanBillingResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MarkCustomPlanBillingPaidResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CustomPlanBillingResponseData 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 MarkCustomPlanBillingPaidResponse build() { + return new MarkCustomPlanBillingPaidResponse(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/types/CheckoutSubscription.java b/src/main/java/com/schematic/api/types/CheckoutSubscription.java index e0b8120..4b26734 100644 --- a/src/main/java/com/schematic/api/types/CheckoutSubscription.java +++ b/src/main/java/com/schematic/api/types/CheckoutSubscription.java @@ -49,6 +49,8 @@ public final class CheckoutSubscription { private final String interval; + private final Optional invoiceId; + private final Optional invoiceUrl; private final Optional> metadata; @@ -85,6 +87,7 @@ private CheckoutSubscription( Optional expiredAt, String id, String interval, + Optional invoiceId, Optional invoiceUrl, Optional> metadata, long periodEnd, @@ -109,6 +112,7 @@ private CheckoutSubscription( this.expiredAt = expiredAt; this.id = id; this.interval = interval; + this.invoiceId = invoiceId; this.invoiceUrl = invoiceUrl; this.metadata = metadata; this.periodEnd = periodEnd; @@ -187,6 +191,11 @@ public String getInterval() { return interval; } + @JsonProperty("invoice_id") + public Optional getInvoiceId() { + return invoiceId; + } + @JsonProperty("invoice_url") public Optional getInvoiceUrl() { return invoiceUrl; @@ -262,6 +271,7 @@ private boolean equalTo(CheckoutSubscription other) { && expiredAt.equals(other.expiredAt) && id.equals(other.id) && interval.equals(other.interval) + && invoiceId.equals(other.invoiceId) && invoiceUrl.equals(other.invoiceUrl) && metadata.equals(other.metadata) && periodEnd == other.periodEnd @@ -290,6 +300,7 @@ public int hashCode() { this.expiredAt, this.id, this.interval, + this.invoiceId, this.invoiceUrl, this.metadata, this.periodEnd, @@ -396,6 +407,10 @@ public interface _FinalStage { _FinalStage expiredAt(OffsetDateTime expiredAt); + _FinalStage invoiceId(Optional invoiceId); + + _FinalStage invoiceId(String invoiceId); + _FinalStage invoiceUrl(Optional invoiceUrl); _FinalStage invoiceUrl(String invoiceUrl); @@ -460,6 +475,8 @@ public static final class Builder private Optional invoiceUrl = Optional.empty(); + private Optional invoiceId = Optional.empty(); + private Optional expiredAt = Optional.empty(); private Optional defaultPaymentMethodId = Optional.empty(); @@ -494,6 +511,7 @@ public Builder from(CheckoutSubscription other) { expiredAt(other.getExpiredAt()); id(other.getId()); interval(other.getInterval()); + invoiceId(other.getInvoiceId()); invoiceUrl(other.getInvoiceUrl()); metadata(other.getMetadata()); periodEnd(other.getPeriodEnd()); @@ -644,6 +662,19 @@ public _FinalStage invoiceUrl(Optional invoiceUrl) { return this; } + @java.lang.Override + public _FinalStage invoiceId(String invoiceId) { + this.invoiceId = Optional.ofNullable(invoiceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "invoice_id", nulls = Nulls.SKIP) + public _FinalStage invoiceId(Optional invoiceId) { + this.invoiceId = invoiceId; + return this; + } + @java.lang.Override public _FinalStage expiredAt(OffsetDateTime expiredAt) { this.expiredAt = Optional.ofNullable(expiredAt); @@ -751,6 +782,7 @@ public CheckoutSubscription build() { expiredAt, id, interval, + invoiceId, invoiceUrl, metadata, periodEnd, diff --git a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java index 1ef196f..852d06b 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java @@ -28,6 +28,8 @@ public final class CompanyPlanDetailResponseData { private final Optional audienceType; + private final List availablePeriods; + private final Optional billingLinkedResource; private final Optional billingProduct; @@ -64,7 +66,7 @@ public final class CompanyPlanDetailResponseData { private final Optional draftVersion; - private final List entitlements; + private final Optional> entitlements; private final List features; @@ -111,6 +113,7 @@ public final class CompanyPlanDetailResponseData { private CompanyPlanDetailResponseData( Optional activeVersion, Optional audienceType, + List availablePeriods, Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, @@ -129,7 +132,7 @@ private CompanyPlanDetailResponseData( Optional customPlanConfig, String description, Optional draftVersion, - List entitlements, + Optional> entitlements, List features, PlanIcon icon, String id, @@ -153,6 +156,7 @@ private CompanyPlanDetailResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.availablePeriods = availablePeriods; this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; @@ -205,6 +209,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("available_periods") + public List getAvailablePeriods() { + return availablePeriods; + } + @JsonProperty("billing_linked_resource") public Optional getBillingLinkedResource() { return billingLinkedResource; @@ -296,7 +305,7 @@ public Optional getDraftVersion() { } @JsonProperty("entitlements") - public List getEntitlements() { + public Optional> getEntitlements() { return entitlements; } @@ -417,6 +426,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CompanyPlanDetailResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && availablePeriods.equals(other.availablePeriods) && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) @@ -463,6 +473,7 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.availablePeriods, this.billingLinkedResource, this.billingProduct, this.billingStrategy, @@ -609,6 +620,12 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage availablePeriods(List availablePeriods); + + _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods); + + _FinalStage addAllAvailablePeriods(List availablePeriods); + _FinalStage billingLinkedResource(Optional billingLinkedResource); _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); @@ -649,11 +666,9 @@ public interface _FinalStage { _FinalStage draftVersion(PlanVersionResponseData draftVersion); - _FinalStage entitlements(List entitlements); - - _FinalStage addEntitlements(PlanEntitlementResponseData entitlements); + _FinalStage entitlements(Optional> entitlements); - _FinalStage addAllEntitlements(List entitlements); + _FinalStage entitlements(List entitlements); _FinalStage features(List features); @@ -784,7 +799,7 @@ public static final class Builder private List features = new ArrayList<>(); - private List entitlements = new ArrayList<>(); + private Optional> entitlements = Optional.empty(); private Optional draftVersion = Optional.empty(); @@ -804,6 +819,8 @@ public static final class Builder private Optional billingLinkedResource = Optional.empty(); + private List availablePeriods = new ArrayList<>(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -817,6 +834,7 @@ private Builder() {} public Builder from(CompanyPlanDetailResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + availablePeriods(other.getAvailablePeriods()); billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); @@ -1172,26 +1190,15 @@ public _FinalStage features(List features) { } @java.lang.Override - public _FinalStage addAllEntitlements(List entitlements) { - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } - return this; - } - - @java.lang.Override - public _FinalStage addEntitlements(PlanEntitlementResponseData entitlements) { - this.entitlements.add(entitlements); + public _FinalStage entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); return this; } @java.lang.Override @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) - public _FinalStage entitlements(List entitlements) { - this.entitlements.clear(); - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } + public _FinalStage entitlements(Optional> entitlements) { + this.entitlements = entitlements; return this; } @@ -1334,6 +1341,30 @@ public _FinalStage billingLinkedResource(Optional availablePeriods) { + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + + @java.lang.Override + public _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods) { + this.availablePeriods.add(availablePeriods); + return this; + } + + @java.lang.Override + @JsonSetter(value = "available_periods", nulls = Nulls.SKIP) + public _FinalStage availablePeriods(List availablePeriods) { + this.availablePeriods.clear(); + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -1365,6 +1396,7 @@ public CompanyPlanDetailResponseData build() { return new CompanyPlanDetailResponseData( activeVersion, audienceType, + availablePeriods, billingLinkedResource, billingProduct, billingStrategy, diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java index c89ff19..1031f6d 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java @@ -68,6 +68,8 @@ public final class CreateEntitlementInBundleRequestBody { private final Optional tierMode; + private final Optional usageQuantity; + private final Optional valueBool; private final Optional valueCreditId; @@ -112,6 +114,7 @@ private CreateEntitlementInBundleRequestBody( Optional quarterlyUnitPriceDecimal, Optional softLimit, Optional tierMode, + Optional usageQuantity, Optional valueBool, Optional valueCreditId, Optional valueNumeric, @@ -145,6 +148,7 @@ private CreateEntitlementInBundleRequestBody( this.quarterlyUnitPriceDecimal = quarterlyUnitPriceDecimal; this.softLimit = softLimit; this.tierMode = tierMode; + this.usageQuantity = usageQuantity; this.valueBool = valueBool; this.valueCreditId = valueCreditId; this.valueNumeric = valueNumeric; @@ -275,6 +279,14 @@ public Optional getTierMode() { return tierMode; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("value_bool") public Optional getValueBool() { return valueBool; @@ -356,6 +368,7 @@ private boolean equalTo(CreateEntitlementInBundleRequestBody other) { && quarterlyUnitPriceDecimal.equals(other.quarterlyUnitPriceDecimal) && softLimit.equals(other.softLimit) && tierMode.equals(other.tierMode) + && usageQuantity.equals(other.usageQuantity) && valueBool.equals(other.valueBool) && valueCreditId.equals(other.valueCreditId) && valueNumeric.equals(other.valueNumeric) @@ -393,6 +406,7 @@ public int hashCode() { this.quarterlyUnitPriceDecimal, this.softLimit, this.tierMode, + this.usageQuantity, this.valueBool, this.valueCreditId, this.valueNumeric, @@ -521,6 +535,13 @@ public interface _FinalStage { _FinalStage tierMode(BillingTiersMode tierMode); + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + _FinalStage usageQuantity(Optional usageQuantity); + + _FinalStage usageQuantity(Long usageQuantity); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -578,6 +599,8 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional valueBool = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -650,6 +673,7 @@ public Builder from(CreateEntitlementInBundleRequestBody other) { quarterlyUnitPriceDecimal(other.getQuarterlyUnitPriceDecimal()); softLimit(other.getSoftLimit()); tierMode(other.getTierMode()); + usageQuantity(other.getUsageQuantity()); valueBool(other.getValueBool()); valueCreditId(other.getValueCreditId()); valueNumeric(other.getValueNumeric()); @@ -787,6 +811,26 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

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

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @java.lang.Override + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public _FinalStage usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + @java.lang.Override public _FinalStage tierMode(BillingTiersMode tierMode) { this.tierMode = Optional.ofNullable(tierMode); @@ -1093,6 +1137,7 @@ public CreateEntitlementInBundleRequestBody build() { quarterlyUnitPriceDecimal, softLimit, tierMode, + usageQuantity, valueBool, valueCreditId, valueNumeric, diff --git a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java index 82bd8f7..cc1e5e9 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java @@ -30,6 +30,8 @@ public final class CustomPlanBillingResponseData { private final long daysUntilDue; + private final Optional externalInvoiceId; + private final String id; private final Optional paidAt; @@ -51,6 +53,7 @@ private CustomPlanBillingResponseData( String companyId, OffsetDateTime createdAt, long daysUntilDue, + Optional externalInvoiceId, String id, Optional paidAt, String planId, @@ -63,6 +66,7 @@ private CustomPlanBillingResponseData( this.companyId = companyId; this.createdAt = createdAt; this.daysUntilDue = daysUntilDue; + this.externalInvoiceId = externalInvoiceId; this.id = id; this.paidAt = paidAt; this.planId = planId; @@ -93,6 +97,11 @@ public long getDaysUntilDue() { return daysUntilDue; } + @JsonProperty("external_invoice_id") + public Optional getExternalInvoiceId() { + return externalInvoiceId; + } + @JsonProperty("id") public String getId() { return id; @@ -144,6 +153,7 @@ private boolean equalTo(CustomPlanBillingResponseData other) { && companyId.equals(other.companyId) && createdAt.equals(other.createdAt) && daysUntilDue == other.daysUntilDue + && externalInvoiceId.equals(other.externalInvoiceId) && id.equals(other.id) && paidAt.equals(other.paidAt) && planId.equals(other.planId) @@ -160,6 +170,7 @@ public int hashCode() { this.companyId, this.createdAt, this.daysUntilDue, + this.externalInvoiceId, this.id, this.paidAt, this.planId, @@ -219,6 +230,10 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage externalInvoiceId(Optional externalInvoiceId); + + _FinalStage externalInvoiceId(String externalInvoiceId); + _FinalStage paidAt(Optional paidAt); _FinalStage paidAt(OffsetDateTime paidAt); @@ -265,6 +280,8 @@ public static final class Builder private Optional paidAt = Optional.empty(); + private Optional externalInvoiceId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -276,6 +293,7 @@ public Builder from(CustomPlanBillingResponseData other) { companyId(other.getCompanyId()); createdAt(other.getCreatedAt()); daysUntilDue(other.getDaysUntilDue()); + externalInvoiceId(other.getExternalInvoiceId()); id(other.getId()); paidAt(other.getPaidAt()); planId(other.getPlanId()); @@ -381,6 +399,19 @@ public _FinalStage paidAt(Optional paidAt) { return this; } + @java.lang.Override + public _FinalStage externalInvoiceId(String externalInvoiceId) { + this.externalInvoiceId = Optional.ofNullable(externalInvoiceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "external_invoice_id", nulls = Nulls.SKIP) + public _FinalStage externalInvoiceId(Optional externalInvoiceId) { + this.externalInvoiceId = externalInvoiceId; + return this; + } + @java.lang.Override public CustomPlanBillingResponseData build() { return new CustomPlanBillingResponseData( @@ -388,6 +419,7 @@ public CustomPlanBillingResponseData build() { companyId, createdAt, daysUntilDue, + externalInvoiceId, id, paidAt, planId, diff --git a/src/main/java/com/schematic/api/types/IntegrationConfig.java b/src/main/java/com/schematic/api/types/IntegrationConfig.java index f479f5c..4f068ca 100644 --- a/src/main/java/com/schematic/api/types/IntegrationConfig.java +++ b/src/main/java/com/schematic/api/types/IntegrationConfig.java @@ -38,6 +38,10 @@ public static IntegrationConfig stripe(StripeIntegrationConfig value) { return new IntegrationConfig(new StripeValue(value)); } + public static IntegrationConfig workos(WorkOsIntegrationConfig value) { + return new IntegrationConfig(new WorkosValue(value)); + } + public boolean isClerk() { return value instanceof ClerkValue; } @@ -50,6 +54,10 @@ public boolean isStripe() { return value instanceof StripeValue; } + public boolean isWorkos() { + return value instanceof WorkosValue; + } + public boolean _isUnknown() { return value instanceof _UnknownValue; } @@ -75,6 +83,13 @@ public Optional getStripe() { return Optional.empty(); } + public Optional getWorkos() { + if (isWorkos()) { + return Optional.of(((WorkosValue) value).value); + } + return Optional.empty(); + } + public Optional _getUnknown() { if (_isUnknown()) { return Optional.of(((_UnknownValue) value).value); @@ -110,6 +125,8 @@ public interface Visitor { T visitStripe(StripeIntegrationConfig stripe); + T visitWorkos(WorkOsIntegrationConfig workos); + T _visitUnknown(Object unknownType); } @@ -117,7 +134,8 @@ public interface Visitor { @JsonSubTypes({ @JsonSubTypes.Type(ClerkValue.class), @JsonSubTypes.Type(OrbValue.class), - @JsonSubTypes.Type(StripeValue.class) + @JsonSubTypes.Type(StripeValue.class), + @JsonSubTypes.Type(WorkosValue.class) }) @JsonIgnoreProperties(ignoreUnknown = true) private interface Value { @@ -244,6 +262,46 @@ public String toString() { } } + @JsonTypeName("workos") + @JsonIgnoreProperties("type") + private static final class WorkosValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private WorkOsIntegrationConfig value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkosValue() {} + + private WorkosValue(WorkOsIntegrationConfig value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkos(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkosValue && equalTo((WorkosValue) other); + } + + private boolean equalTo(WorkosValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "IntegrationConfig{" + "value: " + value + "}"; + } + } + @JsonIgnoreProperties("type") private static final class _UnknownValue implements Value { private String type; diff --git a/src/main/java/com/schematic/api/types/IntegrationType.java b/src/main/java/com/schematic/api/types/IntegrationType.java index 77420b6..d00ec85 100644 --- a/src/main/java/com/schematic/api/types/IntegrationType.java +++ b/src/main/java/com/schematic/api/types/IntegrationType.java @@ -11,6 +11,8 @@ public final class IntegrationType { public static final IntegrationType UNKNOWN = new IntegrationType(Value.UNKNOWN, "unknown"); + public static final IntegrationType WORKOS = new IntegrationType(Value.WORKOS, "workos"); + public static final IntegrationType CLERK = new IntegrationType(Value.CLERK, "clerk"); public static final IntegrationType STRIPE = new IntegrationType(Value.STRIPE, "stripe"); @@ -51,6 +53,8 @@ public T visit(Visitor visitor) { return visitor.visitOrb(); case UNKNOWN: return visitor.visitUnknown(); + case WORKOS: + return visitor.visitWorkos(); case CLERK: return visitor.visitClerk(); case STRIPE: @@ -68,6 +72,8 @@ public static IntegrationType valueOf(String value) { return ORB; case "unknown": return UNKNOWN; + case "workos": + return WORKOS; case "clerk": return CLERK; case "stripe": @@ -86,6 +92,8 @@ public enum Value { UNKNOWN, + WORKOS, + _UNKNOWN } @@ -98,6 +106,8 @@ public interface Visitor { T visitUnknown(); + T visitWorkos(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/MigrationErrorCode.java b/src/main/java/com/schematic/api/types/MigrationErrorCode.java new file mode 100644 index 0000000..64c7e3e --- /dev/null +++ b/src/main/java/com/schematic/api/types/MigrationErrorCode.java @@ -0,0 +1,183 @@ +/** + * 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 MigrationErrorCode { + public static final MigrationErrorCode NOT_ON_ORIGIN_VERSION = + new MigrationErrorCode(Value.NOT_ON_ORIGIN_VERSION, "not_on_origin_version"); + + public static final MigrationErrorCode TRANSIENT_INFRA = + new MigrationErrorCode(Value.TRANSIENT_INFRA, "transient_infra"); + + public static final MigrationErrorCode PERMANENT_DECLINE = + new MigrationErrorCode(Value.PERMANENT_DECLINE, "permanent_decline"); + + public static final MigrationErrorCode TRANSIENT_DECLINE = + new MigrationErrorCode(Value.TRANSIENT_DECLINE, "transient_decline"); + + public static final MigrationErrorCode AMBIGUOUS_SUBSCRIPTION_ITEM = + new MigrationErrorCode(Value.AMBIGUOUS_SUBSCRIPTION_ITEM, "ambiguous_subscription_item"); + + public static final MigrationErrorCode MULTIPLE_SUBSCRIPTIONS = + new MigrationErrorCode(Value.MULTIPLE_SUBSCRIPTIONS, "multiple_subscriptions"); + + public static final MigrationErrorCode NO_PRICE_FOR_INTERVAL = + new MigrationErrorCode(Value.NO_PRICE_FOR_INTERVAL, "no_price_for_interval"); + + public static final MigrationErrorCode PERMANENT_CONFIG = + new MigrationErrorCode(Value.PERMANENT_CONFIG, "permanent_config"); + + public static final MigrationErrorCode UNKNOWN = new MigrationErrorCode(Value.UNKNOWN, "unknown"); + + public static final MigrationErrorCode WOULD_LEAVE_EMPTY_SUBSCRIPTION = + new MigrationErrorCode(Value.WOULD_LEAVE_EMPTY_SUBSCRIPTION, "would_leave_empty_subscription"); + + public static final MigrationErrorCode TRANSIENT_STRIPE = + new MigrationErrorCode(Value.TRANSIENT_STRIPE, "transient_stripe"); + + private final Value value; + + private final String string; + + MigrationErrorCode(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 MigrationErrorCode && this.string.equals(((MigrationErrorCode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOT_ON_ORIGIN_VERSION: + return visitor.visitNotOnOriginVersion(); + case TRANSIENT_INFRA: + return visitor.visitTransientInfra(); + case PERMANENT_DECLINE: + return visitor.visitPermanentDecline(); + case TRANSIENT_DECLINE: + return visitor.visitTransientDecline(); + case AMBIGUOUS_SUBSCRIPTION_ITEM: + return visitor.visitAmbiguousSubscriptionItem(); + case MULTIPLE_SUBSCRIPTIONS: + return visitor.visitMultipleSubscriptions(); + case NO_PRICE_FOR_INTERVAL: + return visitor.visitNoPriceForInterval(); + case PERMANENT_CONFIG: + return visitor.visitPermanentConfig(); + case UNKNOWN: + return visitor.visitUnknown(); + case WOULD_LEAVE_EMPTY_SUBSCRIPTION: + return visitor.visitWouldLeaveEmptySubscription(); + case TRANSIENT_STRIPE: + return visitor.visitTransientStripe(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MigrationErrorCode valueOf(String value) { + switch (value) { + case "not_on_origin_version": + return NOT_ON_ORIGIN_VERSION; + case "transient_infra": + return TRANSIENT_INFRA; + case "permanent_decline": + return PERMANENT_DECLINE; + case "transient_decline": + return TRANSIENT_DECLINE; + case "ambiguous_subscription_item": + return AMBIGUOUS_SUBSCRIPTION_ITEM; + case "multiple_subscriptions": + return MULTIPLE_SUBSCRIPTIONS; + case "no_price_for_interval": + return NO_PRICE_FOR_INTERVAL; + case "permanent_config": + return PERMANENT_CONFIG; + case "unknown": + return UNKNOWN; + case "would_leave_empty_subscription": + return WOULD_LEAVE_EMPTY_SUBSCRIPTION; + case "transient_stripe": + return TRANSIENT_STRIPE; + default: + return new MigrationErrorCode(Value._UNKNOWN, value); + } + } + + public enum Value { + AMBIGUOUS_SUBSCRIPTION_ITEM, + + MULTIPLE_SUBSCRIPTIONS, + + NO_PRICE_FOR_INTERVAL, + + NOT_ON_ORIGIN_VERSION, + + PERMANENT_CONFIG, + + PERMANENT_DECLINE, + + TRANSIENT_DECLINE, + + TRANSIENT_INFRA, + + TRANSIENT_STRIPE, + + UNKNOWN, + + WOULD_LEAVE_EMPTY_SUBSCRIPTION, + + _UNKNOWN + } + + public interface Visitor { + T visitAmbiguousSubscriptionItem(); + + T visitMultipleSubscriptions(); + + T visitNoPriceForInterval(); + + T visitNotOnOriginVersion(); + + T visitPermanentConfig(); + + T visitPermanentDecline(); + + T visitTransientDecline(); + + T visitTransientInfra(); + + T visitTransientStripe(); + + T visitUnknown(); + + T visitWouldLeaveEmptySubscription(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java index a75bfa5..c615a3a 100644 --- a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java @@ -54,6 +54,8 @@ public final class PlanDetailResponseData { private final Optional draftVersion; + private final Optional> entitlements; + private final List features; private final PlanIcon icon; @@ -104,6 +106,7 @@ private PlanDetailResponseData( List currencyPrices, String description, Optional draftVersion, + Optional> entitlements, List features, PlanIcon icon, String id, @@ -136,6 +139,7 @@ private PlanDetailResponseData( this.currencyPrices = currencyPrices; this.description = description; this.draftVersion = draftVersion; + this.entitlements = entitlements; this.features = features; this.icon = icon; this.id = id; @@ -230,6 +234,11 @@ public Optional getDraftVersion() { return draftVersion; } + @JsonProperty("entitlements") + public Optional> getEntitlements() { + return entitlements; + } + @JsonProperty("features") public List getFeatures() { return features; @@ -340,6 +349,7 @@ private boolean equalTo(PlanDetailResponseData other) { && currencyPrices.equals(other.currencyPrices) && description.equals(other.description) && draftVersion.equals(other.draftVersion) + && entitlements.equals(other.entitlements) && features.equals(other.features) && icon.equals(other.icon) && id.equals(other.id) @@ -376,6 +386,7 @@ public int hashCode() { this.currencyPrices, this.description, this.draftVersion, + this.entitlements, this.features, this.icon, this.id, @@ -509,6 +520,10 @@ public interface _FinalStage { _FinalStage draftVersion(PlanVersionResponseData draftVersion); + _FinalStage entitlements(Optional> entitlements); + + _FinalStage entitlements(List entitlements); + _FinalStage features(List features); _FinalStage addFeatures(FeatureInPlanResponseData features); @@ -607,6 +622,8 @@ public static final class Builder private List features = new ArrayList<>(); + private Optional> entitlements = Optional.empty(); + private Optional draftVersion = Optional.empty(); private List currencyPrices = new ArrayList<>(); @@ -647,6 +664,7 @@ public Builder from(PlanDetailResponseData other) { currencyPrices(other.getCurrencyPrices()); description(other.getDescription()); draftVersion(other.getDraftVersion()); + entitlements(other.getEntitlements()); features(other.getFeatures()); icon(other.getIcon()); id(other.getId()); @@ -896,6 +914,19 @@ public _FinalStage features(List features) { return this; } + @java.lang.Override + public _FinalStage entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(Optional> entitlements) { + this.entitlements = entitlements; + return this; + } + @java.lang.Override public _FinalStage draftVersion(PlanVersionResponseData draftVersion) { this.draftVersion = Optional.ofNullable(draftVersion); @@ -1042,6 +1073,7 @@ public PlanDetailResponseData build() { currencyPrices, description, draftVersion, + entitlements, features, icon, id, diff --git a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java index 71e1921..e868b60 100644 --- a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java @@ -68,6 +68,8 @@ public final class PlanEntitlementResponseData { private final Optional usageBasedProduct; + private final Optional usageQuantity; + private final Optional valueBool; private final Optional valueCredit; @@ -105,6 +107,7 @@ private PlanEntitlementResponseData( Optional softLimit, OffsetDateTime updatedAt, Optional usageBasedProduct, + Optional usageQuantity, Optional valueBool, Optional valueCredit, Optional valueNumeric, @@ -134,6 +137,7 @@ private PlanEntitlementResponseData( this.softLimit = softLimit; this.updatedAt = updatedAt; this.usageBasedProduct = usageBasedProduct; + this.usageQuantity = usageQuantity; this.valueBool = valueBool; this.valueCredit = valueCredit; this.valueNumeric = valueNumeric; @@ -253,6 +257,14 @@ public Optional getUsageBasedProduct() { return usageBasedProduct; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("value_bool") public Optional getValueBool() { return valueBool; @@ -317,6 +329,7 @@ private boolean equalTo(PlanEntitlementResponseData other) { && softLimit.equals(other.softLimit) && updatedAt.equals(other.updatedAt) && usageBasedProduct.equals(other.usageBasedProduct) + && usageQuantity.equals(other.usageQuantity) && valueBool.equals(other.valueBool) && valueCredit.equals(other.valueCredit) && valueNumeric.equals(other.valueNumeric) @@ -350,6 +363,7 @@ public int hashCode() { this.softLimit, this.updatedAt, this.usageBasedProduct, + this.usageQuantity, this.valueBool, this.valueCredit, this.valueNumeric, @@ -470,6 +484,13 @@ public interface _FinalStage { _FinalStage usageBasedProduct(BillingProductResponseData usageBasedProduct); + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + _FinalStage usageQuantity(Optional usageQuantity); + + _FinalStage usageQuantity(Long usageQuantity); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -528,6 +549,8 @@ public static final class Builder private Optional valueBool = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional usageBasedProduct = Optional.empty(); private Optional softLimit = Optional.empty(); @@ -587,6 +610,7 @@ public Builder from(PlanEntitlementResponseData other) { softLimit(other.getSoftLimit()); updatedAt(other.getUpdatedAt()); usageBasedProduct(other.getUsageBasedProduct()); + usageQuantity(other.getUsageQuantity()); valueBool(other.getValueBool()); valueCredit(other.getValueCredit()); valueNumeric(other.getValueNumeric()); @@ -717,6 +741,26 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

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

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @java.lang.Override + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public _FinalStage usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + @java.lang.Override public _FinalStage usageBasedProduct(BillingProductResponseData usageBasedProduct) { this.usageBasedProduct = Optional.ofNullable(usageBasedProduct); @@ -948,6 +992,7 @@ public PlanEntitlementResponseData build() { softLimit, updatedAt, usageBasedProduct, + usageQuantity, valueBool, valueCredit, valueNumeric, diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java index 3d1f86e..1f242b6 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java @@ -28,6 +28,8 @@ public final class PlanGroupPlanDetailResponseData { private final Optional audienceType; + private final List availablePeriods; + private final Optional billingLinkedResource; private final Optional billingProduct; @@ -58,7 +60,7 @@ public final class PlanGroupPlanDetailResponseData { private final Optional draftVersion; - private final List entitlements; + private final Optional> entitlements; private final List features; @@ -99,6 +101,7 @@ public final class PlanGroupPlanDetailResponseData { private PlanGroupPlanDetailResponseData( Optional activeVersion, Optional audienceType, + List availablePeriods, Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, @@ -114,7 +117,7 @@ private PlanGroupPlanDetailResponseData( Optional customPlanConfig, String description, Optional draftVersion, - List entitlements, + Optional> entitlements, List features, PlanIcon icon, String id, @@ -135,6 +138,7 @@ private PlanGroupPlanDetailResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.availablePeriods = availablePeriods; this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; @@ -181,6 +185,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("available_periods") + public List getAvailablePeriods() { + return availablePeriods; + } + @JsonProperty("billing_linked_resource") public Optional getBillingLinkedResource() { return billingLinkedResource; @@ -257,7 +266,7 @@ public Optional getDraftVersion() { } @JsonProperty("entitlements") - public List getEntitlements() { + public Optional> getEntitlements() { return entitlements; } @@ -363,6 +372,7 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanGroupPlanDetailResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && availablePeriods.equals(other.availablePeriods) && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) @@ -403,6 +413,7 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.availablePeriods, this.billingLinkedResource, this.billingProduct, this.billingStrategy, @@ -527,6 +538,12 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage availablePeriods(List availablePeriods); + + _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods); + + _FinalStage addAllAvailablePeriods(List availablePeriods); + _FinalStage billingLinkedResource(Optional billingLinkedResource); _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); @@ -567,11 +584,9 @@ public interface _FinalStage { _FinalStage draftVersion(PlanVersionResponseData draftVersion); - _FinalStage entitlements(List entitlements); - - _FinalStage addEntitlements(PlanEntitlementResponseData entitlements); + _FinalStage entitlements(Optional> entitlements); - _FinalStage addAllEntitlements(List entitlements); + _FinalStage entitlements(List entitlements); _FinalStage features(List features); @@ -674,7 +689,7 @@ public static final class Builder private List features = new ArrayList<>(); - private List entitlements = new ArrayList<>(); + private Optional> entitlements = Optional.empty(); private Optional draftVersion = Optional.empty(); @@ -694,6 +709,8 @@ public static final class Builder private Optional billingLinkedResource = Optional.empty(); + private List availablePeriods = new ArrayList<>(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -707,6 +724,7 @@ private Builder() {} public Builder from(PlanGroupPlanDetailResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + availablePeriods(other.getAvailablePeriods()); billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); @@ -981,26 +999,15 @@ public _FinalStage features(List features) { } @java.lang.Override - public _FinalStage addAllEntitlements(List entitlements) { - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } - return this; - } - - @java.lang.Override - public _FinalStage addEntitlements(PlanEntitlementResponseData entitlements) { - this.entitlements.add(entitlements); + public _FinalStage entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); return this; } @java.lang.Override @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) - public _FinalStage entitlements(List entitlements) { - this.entitlements.clear(); - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } + public _FinalStage entitlements(Optional> entitlements) { + this.entitlements = entitlements; return this; } @@ -1143,6 +1150,30 @@ public _FinalStage billingLinkedResource(Optional availablePeriods) { + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + + @java.lang.Override + public _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods) { + this.availablePeriods.add(availablePeriods); + return this; + } + + @java.lang.Override + @JsonSetter(value = "available_periods", nulls = Nulls.SKIP) + public _FinalStage availablePeriods(List availablePeriods) { + this.availablePeriods.clear(); + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -1174,6 +1205,7 @@ public PlanGroupPlanDetailResponseData build() { return new PlanGroupPlanDetailResponseData( activeVersion, audienceType, + availablePeriods, billingLinkedResource, billingProduct, billingStrategy, diff --git a/src/main/java/com/schematic/api/types/PlanPriceCadence.java b/src/main/java/com/schematic/api/types/PlanPriceCadence.java new file mode 100644 index 0000000..6d60836 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanPriceCadence.java @@ -0,0 +1,93 @@ +/** + * 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 PlanPriceCadence { + public static final PlanPriceCadence YEARLY = new PlanPriceCadence(Value.YEARLY, "yearly"); + + public static final PlanPriceCadence QUARTERLY = new PlanPriceCadence(Value.QUARTERLY, "quarterly"); + + public static final PlanPriceCadence MONTHLY = new PlanPriceCadence(Value.MONTHLY, "monthly"); + + private final Value value; + + private final String string; + + PlanPriceCadence(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 PlanPriceCadence && this.string.equals(((PlanPriceCadence) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case YEARLY: + return visitor.visitYearly(); + case QUARTERLY: + return visitor.visitQuarterly(); + case MONTHLY: + return visitor.visitMonthly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanPriceCadence valueOf(String value) { + switch (value) { + case "yearly": + return YEARLY; + case "quarterly": + return QUARTERLY; + case "monthly": + return MONTHLY; + default: + return new PlanPriceCadence(Value.UNKNOWN, value); + } + } + + public enum Value { + MONTHLY, + + QUARTERLY, + + YEARLY, + + UNKNOWN + } + + public interface Visitor { + T visitMonthly(); + + T visitQuarterly(); + + T visitYearly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java index 8e039ee..4210eb6 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java @@ -32,6 +32,8 @@ public final class PlanVersionCompanyMigrationResponseData { private final Optional error; + private final Optional errorCode; + private final String id; private final String migrationId; @@ -52,6 +54,7 @@ private PlanVersionCompanyMigrationResponseData( Optional completedAt, OffsetDateTime createdAt, Optional error, + Optional errorCode, String id, String migrationId, Optional planVersionIdFrom, @@ -64,6 +67,7 @@ private PlanVersionCompanyMigrationResponseData( this.completedAt = completedAt; this.createdAt = createdAt; this.error = error; + this.errorCode = errorCode; this.id = id; this.migrationId = migrationId; this.planVersionIdFrom = planVersionIdFrom; @@ -98,6 +102,11 @@ public Optional getError() { return error; } + @JsonProperty("error_code") + public Optional getErrorCode() { + return errorCode; + } + @JsonProperty("id") public String getId() { return id; @@ -146,6 +155,7 @@ private boolean equalTo(PlanVersionCompanyMigrationResponseData other) { && completedAt.equals(other.completedAt) && createdAt.equals(other.createdAt) && error.equals(other.error) + && errorCode.equals(other.errorCode) && id.equals(other.id) && migrationId.equals(other.migrationId) && planVersionIdFrom.equals(other.planVersionIdFrom) @@ -162,6 +172,7 @@ public int hashCode() { this.completedAt, this.createdAt, this.error, + this.errorCode, this.id, this.migrationId, this.planVersionIdFrom, @@ -224,6 +235,10 @@ public interface _FinalStage { _FinalStage error(String error); + _FinalStage errorCode(Optional errorCode); + + _FinalStage errorCode(MigrationErrorCode errorCode); + _FinalStage planVersionIdFrom(Optional planVersionIdFrom); _FinalStage planVersionIdFrom(String planVersionIdFrom); @@ -261,6 +276,8 @@ public static final class Builder private Optional planVersionIdFrom = Optional.empty(); + private Optional errorCode = Optional.empty(); + private Optional error = Optional.empty(); private Optional completedAt = Optional.empty(); @@ -277,6 +294,7 @@ public Builder from(PlanVersionCompanyMigrationResponseData other) { completedAt(other.getCompletedAt()); createdAt(other.getCreatedAt()); error(other.getError()); + errorCode(other.getErrorCode()); id(other.getId()); migrationId(other.getMigrationId()); planVersionIdFrom(other.getPlanVersionIdFrom()); @@ -361,6 +379,19 @@ public _FinalStage planVersionIdFrom(Optional planVersionIdFrom) { return this; } + @java.lang.Override + public _FinalStage errorCode(MigrationErrorCode errorCode) { + this.errorCode = Optional.ofNullable(errorCode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "error_code", nulls = Nulls.SKIP) + public _FinalStage errorCode(Optional errorCode) { + this.errorCode = errorCode; + return this; + } + @java.lang.Override public _FinalStage error(String error) { this.error = Optional.ofNullable(error); @@ -395,6 +426,7 @@ public PlanVersionCompanyMigrationResponseData build() { completedAt, createdAt, error, + errorCode, id, migrationId, planVersionIdFrom, diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java index 3fe1394..f8059b0 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java @@ -13,7 +13,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -40,6 +42,8 @@ public final class PlanVersionMigrationResponseData { private final String planVersionIdTo; + private final List planVersionIdsFrom; + private final long skippedCompanies; private final Optional startedAt; @@ -64,6 +68,7 @@ private PlanVersionMigrationResponseData( String planId, Optional planVersionIdFrom, String planVersionIdTo, + List planVersionIdsFrom, long skippedCompanies, Optional startedAt, PlanVersionMigrationStatus status, @@ -80,6 +85,7 @@ private PlanVersionMigrationResponseData( this.planId = planId; this.planVersionIdFrom = planVersionIdFrom; this.planVersionIdTo = planVersionIdTo; + this.planVersionIdsFrom = planVersionIdsFrom; this.skippedCompanies = skippedCompanies; this.startedAt = startedAt; this.status = status; @@ -134,6 +140,11 @@ public String getPlanVersionIdTo() { return planVersionIdTo; } + @JsonProperty("plan_version_ids_from") + public List getPlanVersionIdsFrom() { + return planVersionIdsFrom; + } + @JsonProperty("skipped_companies") public long getSkippedCompanies() { return skippedCompanies; @@ -185,6 +196,7 @@ private boolean equalTo(PlanVersionMigrationResponseData other) { && planId.equals(other.planId) && planVersionIdFrom.equals(other.planVersionIdFrom) && planVersionIdTo.equals(other.planVersionIdTo) + && planVersionIdsFrom.equals(other.planVersionIdsFrom) && skippedCompanies == other.skippedCompanies && startedAt.equals(other.startedAt) && status.equals(other.status) @@ -205,6 +217,7 @@ public int hashCode() { this.planId, this.planVersionIdFrom, this.planVersionIdTo, + this.planVersionIdsFrom, this.skippedCompanies, this.startedAt, this.status, @@ -287,6 +300,12 @@ public interface _FinalStage { _FinalStage planVersionIdFrom(String planVersionIdFrom); + _FinalStage planVersionIdsFrom(List planVersionIdsFrom); + + _FinalStage addPlanVersionIdsFrom(String planVersionIdsFrom); + + _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom); + _FinalStage startedAt(Optional startedAt); _FinalStage startedAt(OffsetDateTime startedAt); @@ -330,6 +349,8 @@ public static final class Builder private Optional startedAt = Optional.empty(); + private List planVersionIdsFrom = new ArrayList<>(); + private Optional planVersionIdFrom = Optional.empty(); private Optional error = Optional.empty(); @@ -352,6 +373,7 @@ public Builder from(PlanVersionMigrationResponseData other) { planId(other.getPlanId()); planVersionIdFrom(other.getPlanVersionIdFrom()); planVersionIdTo(other.getPlanVersionIdTo()); + planVersionIdsFrom(other.getPlanVersionIdsFrom()); skippedCompanies(other.getSkippedCompanies()); startedAt(other.getStartedAt()); status(other.getStatus()); @@ -451,6 +473,30 @@ public _FinalStage startedAt(Optional startedAt) { return this; } + @java.lang.Override + public _FinalStage addAllPlanVersionIdsFrom(List planVersionIdsFrom) { + if (planVersionIdsFrom != null) { + this.planVersionIdsFrom.addAll(planVersionIdsFrom); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlanVersionIdsFrom(String planVersionIdsFrom) { + this.planVersionIdsFrom.add(planVersionIdsFrom); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_ids_from", nulls = Nulls.SKIP) + public _FinalStage planVersionIdsFrom(List planVersionIdsFrom) { + this.planVersionIdsFrom.clear(); + if (planVersionIdsFrom != null) { + this.planVersionIdsFrom.addAll(planVersionIdsFrom); + } + return this; + } + @java.lang.Override public _FinalStage planVersionIdFrom(String planVersionIdFrom) { this.planVersionIdFrom = Optional.ofNullable(planVersionIdFrom); @@ -502,6 +548,7 @@ public PlanVersionMigrationResponseData build() { planId, planVersionIdFrom, planVersionIdTo, + planVersionIdsFrom, skippedCompanies, startedAt, status, diff --git a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java index 00d0ab8..7e1fe8e 100644 --- a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java @@ -28,6 +28,8 @@ public final class PlanViewPublicResponseData { private final Optional audienceType; + private final List availablePeriods; + private final Optional billingLinkedResource; private final Optional billingProduct; @@ -60,7 +62,7 @@ public final class PlanViewPublicResponseData { private final Optional draftVersion; - private final List entitlements; + private final Optional> entitlements; private final List features; @@ -101,6 +103,7 @@ public final class PlanViewPublicResponseData { private PlanViewPublicResponseData( Optional activeVersion, Optional audienceType, + List availablePeriods, Optional billingLinkedResource, Optional billingProduct, BillingStrategy billingStrategy, @@ -117,7 +120,7 @@ private PlanViewPublicResponseData( Optional customPlanConfig, String description, Optional draftVersion, - List entitlements, + Optional> entitlements, List features, PlanIcon icon, String id, @@ -138,6 +141,7 @@ private PlanViewPublicResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.availablePeriods = availablePeriods; this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.billingStrategy = billingStrategy; @@ -185,6 +189,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("available_periods") + public List getAvailablePeriods() { + return availablePeriods; + } + @JsonProperty("billing_linked_resource") public Optional getBillingLinkedResource() { return billingLinkedResource; @@ -266,7 +275,7 @@ public Optional getDraftVersion() { } @JsonProperty("entitlements") - public List getEntitlements() { + public Optional> getEntitlements() { return entitlements; } @@ -372,6 +381,7 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanViewPublicResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && availablePeriods.equals(other.availablePeriods) && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && billingStrategy.equals(other.billingStrategy) @@ -413,6 +423,7 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.availablePeriods, this.billingLinkedResource, this.billingProduct, this.billingStrategy, @@ -542,6 +553,12 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage availablePeriods(List availablePeriods); + + _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods); + + _FinalStage addAllAvailablePeriods(List availablePeriods); + _FinalStage billingLinkedResource(Optional billingLinkedResource); _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); @@ -582,11 +599,9 @@ public interface _FinalStage { _FinalStage draftVersion(PlanVersionResponseData draftVersion); - _FinalStage entitlements(List entitlements); - - _FinalStage addEntitlements(PlanEntitlementResponseData entitlements); + _FinalStage entitlements(Optional> entitlements); - _FinalStage addAllEntitlements(List entitlements); + _FinalStage entitlements(List entitlements); _FinalStage features(List features); @@ -694,7 +709,7 @@ public static final class Builder private List features = new ArrayList<>(); - private List entitlements = new ArrayList<>(); + private Optional> entitlements = Optional.empty(); private Optional draftVersion = Optional.empty(); @@ -714,6 +729,8 @@ public static final class Builder private Optional billingLinkedResource = Optional.empty(); + private List availablePeriods = new ArrayList<>(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -727,6 +744,7 @@ private Builder() {} public Builder from(PlanViewPublicResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + availablePeriods(other.getAvailablePeriods()); billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); billingStrategy(other.getBillingStrategy()); @@ -1019,26 +1037,15 @@ public _FinalStage features(List features) { } @java.lang.Override - public _FinalStage addAllEntitlements(List entitlements) { - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } - return this; - } - - @java.lang.Override - public _FinalStage addEntitlements(PlanEntitlementResponseData entitlements) { - this.entitlements.add(entitlements); + public _FinalStage entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); return this; } @java.lang.Override @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) - public _FinalStage entitlements(List entitlements) { - this.entitlements.clear(); - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } + public _FinalStage entitlements(Optional> entitlements) { + this.entitlements = entitlements; return this; } @@ -1181,6 +1188,30 @@ public _FinalStage billingLinkedResource(Optional availablePeriods) { + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + + @java.lang.Override + public _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods) { + this.availablePeriods.add(availablePeriods); + return this; + } + + @java.lang.Override + @JsonSetter(value = "available_periods", nulls = Nulls.SKIP) + public _FinalStage availablePeriods(List availablePeriods) { + this.availablePeriods.clear(); + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -1212,6 +1243,7 @@ public PlanViewPublicResponseData build() { return new PlanViewPublicResponseData( activeVersion, audienceType, + availablePeriods, billingLinkedResource, billingProduct, billingStrategy, diff --git a/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java b/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java index 6b9d469..07480b0 100644 --- a/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java +++ b/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java @@ -32,8 +32,6 @@ public final class StripeIntegrationConfig { private final Optional onboardUrl; - private final int version; - private final Map additionalProperties; private StripeIntegrationConfig( @@ -43,7 +41,6 @@ private StripeIntegrationConfig( boolean isSandbox, boolean liveMode, Optional onboardUrl, - int version, Map additionalProperties) { this.accountId = accountId; this.accountName = accountName; @@ -51,7 +48,6 @@ private StripeIntegrationConfig( this.isSandbox = isSandbox; this.liveMode = liveMode; this.onboardUrl = onboardUrl; - this.version = version; this.additionalProperties = additionalProperties; } @@ -103,14 +99,6 @@ public Optional getOnboardUrl() { return onboardUrl; } - /** - * @return Stripe integration config version (1 = legacy API key install, 2 = Connect/App install) - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -128,8 +116,7 @@ private boolean equalTo(StripeIntegrationConfig other) { && companyUpdateOnly.equals(other.companyUpdateOnly) && isSandbox == other.isSandbox && liveMode == other.liveMode - && onboardUrl.equals(other.onboardUrl) - && version == other.version; + && onboardUrl.equals(other.onboardUrl); } @java.lang.Override @@ -140,8 +127,7 @@ public int hashCode() { this.companyUpdateOnly, this.isSandbox, this.liveMode, - this.onboardUrl, - this.version); + this.onboardUrl); } @java.lang.Override @@ -166,14 +152,7 @@ public interface LiveModeStage { /** *

Whether the integration is connected to a live Stripe account

*/ - VersionStage liveMode(boolean liveMode); - } - - public interface VersionStage { - /** - *

Stripe integration config version (1 = legacy API key install, 2 = Connect/App install)

- */ - _FinalStage version(int version); + _FinalStage liveMode(boolean liveMode); } public interface _FinalStage { @@ -213,13 +192,11 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsSandboxStage, LiveModeStage, VersionStage, _FinalStage { + public static final class Builder implements IsSandboxStage, LiveModeStage, _FinalStage { private boolean isSandbox; private boolean liveMode; - private int version; - private Optional onboardUrl = Optional.empty(); private Optional companyUpdateOnly = Optional.empty(); @@ -241,7 +218,6 @@ public Builder from(StripeIntegrationConfig other) { isSandbox(other.getIsSandbox()); liveMode(other.getLiveMode()); onboardUrl(other.getOnboardUrl()); - version(other.getVersion()); return this; } @@ -264,23 +240,11 @@ public LiveModeStage isSandbox(boolean isSandbox) { */ @java.lang.Override @JsonSetter("live_mode") - public VersionStage liveMode(boolean liveMode) { + public _FinalStage liveMode(boolean liveMode) { this.liveMode = liveMode; return this; } - /** - *

Stripe integration config version (1 = legacy API key install, 2 = Connect/App install)

- *

Stripe integration config version (1 = legacy API key install, 2 = Connect/App install)

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - /** *

Onboarding URL returned during the v2 (Connect) install flow before activation

* @return Reference to {@code this} so that method calls can be chained together. @@ -364,14 +328,7 @@ public _FinalStage accountId(Optional accountId) { @java.lang.Override public StripeIntegrationConfig build() { return new StripeIntegrationConfig( - accountId, - accountName, - companyUpdateOnly, - isSandbox, - liveMode, - onboardUrl, - version, - additionalProperties); + accountId, accountName, companyUpdateOnly, isSandbox, liveMode, onboardUrl, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java index e3d29f4..d22b2c3 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java @@ -55,6 +55,8 @@ public final class UsageBasedEntitlementRequestBody { private final Optional tierMode; + private final Optional usageQuantity; + private final Optional yearlyMeteredPriceId; private final Optional> yearlyPriceTiers; @@ -83,6 +85,7 @@ private UsageBasedEntitlementRequestBody( Optional quarterlyUnitPriceDecimal, Optional softLimit, Optional tierMode, + Optional usageQuantity, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, Optional yearlyUnitPrice, @@ -105,6 +108,7 @@ private UsageBasedEntitlementRequestBody( this.quarterlyUnitPriceDecimal = quarterlyUnitPriceDecimal; this.softLimit = softLimit; this.tierMode = tierMode; + this.usageQuantity = usageQuantity; this.yearlyMeteredPriceId = yearlyMeteredPriceId; this.yearlyPriceTiers = yearlyPriceTiers; this.yearlyUnitPrice = yearlyUnitPrice; @@ -200,6 +204,14 @@ public Optional getTierMode() { return tierMode; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("yearly_metered_price_id") public Optional getYearlyMeteredPriceId() { return yearlyMeteredPriceId; @@ -249,6 +261,7 @@ private boolean equalTo(UsageBasedEntitlementRequestBody other) { && quarterlyUnitPriceDecimal.equals(other.quarterlyUnitPriceDecimal) && softLimit.equals(other.softLimit) && tierMode.equals(other.tierMode) + && usageQuantity.equals(other.usageQuantity) && yearlyMeteredPriceId.equals(other.yearlyMeteredPriceId) && yearlyPriceTiers.equals(other.yearlyPriceTiers) && yearlyUnitPrice.equals(other.yearlyUnitPrice) @@ -275,6 +288,7 @@ public int hashCode() { this.quarterlyUnitPriceDecimal, this.softLimit, this.tierMode, + this.usageQuantity, this.yearlyMeteredPriceId, this.yearlyPriceTiers, this.yearlyUnitPrice, @@ -326,6 +340,8 @@ public static final class Builder { private Optional tierMode = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional yearlyMeteredPriceId = Optional.empty(); private Optional> yearlyPriceTiers = Optional.empty(); @@ -357,6 +373,7 @@ public Builder from(UsageBasedEntitlementRequestBody other) { quarterlyUnitPriceDecimal(other.getQuarterlyUnitPriceDecimal()); softLimit(other.getSoftLimit()); tierMode(other.getTierMode()); + usageQuantity(other.getUsageQuantity()); yearlyMeteredPriceId(other.getYearlyMeteredPriceId()); yearlyPriceTiers(other.getYearlyPriceTiers()); yearlyUnitPrice(other.getYearlyUnitPrice()); @@ -554,6 +571,20 @@ public Builder tierMode(BillingTiersMode tierMode) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public Builder usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + + public Builder usageQuantity(Long usageQuantity) { + this.usageQuantity = Optional.ofNullable(usageQuantity); + return this; + } + @JsonSetter(value = "yearly_metered_price_id", nulls = Nulls.SKIP) public Builder yearlyMeteredPriceId(Optional yearlyMeteredPriceId) { this.yearlyMeteredPriceId = yearlyMeteredPriceId; @@ -617,6 +648,7 @@ public UsageBasedEntitlementRequestBody build() { quarterlyUnitPriceDecimal, softLimit, tierMode, + usageQuantity, yearlyMeteredPriceId, yearlyPriceTiers, yearlyUnitPrice, diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java index 6c3b134..921bbb6 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java @@ -39,6 +39,8 @@ public final class UsageBasedEntitlementResponseData { private final Optional quarterlyUsageBasedPrice; + private final Optional usageQuantity; + private final Optional valueBool; private final Optional valueNumeric; @@ -59,6 +61,7 @@ private UsageBasedEntitlementResponseData( Optional monthlyUsageBasedPrice, Optional priceBehavior, Optional quarterlyUsageBasedPrice, + Optional usageQuantity, Optional valueBool, Optional valueNumeric, EntitlementValueType valueType, @@ -73,6 +76,7 @@ private UsageBasedEntitlementResponseData( this.monthlyUsageBasedPrice = monthlyUsageBasedPrice; this.priceBehavior = priceBehavior; this.quarterlyUsageBasedPrice = quarterlyUsageBasedPrice; + this.usageQuantity = usageQuantity; this.valueBool = valueBool; this.valueNumeric = valueNumeric; this.valueType = valueType; @@ -125,6 +129,14 @@ public Optional getQuarterlyUsageBasedPrice() { return quarterlyUsageBasedPrice; } + /** + * @return The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use. + */ + @JsonProperty("usage_quantity") + public Optional getUsageQuantity() { + return usageQuantity; + } + @JsonProperty("value_bool") public Optional getValueBool() { return valueBool; @@ -166,6 +178,7 @@ private boolean equalTo(UsageBasedEntitlementResponseData other) { && monthlyUsageBasedPrice.equals(other.monthlyUsageBasedPrice) && priceBehavior.equals(other.priceBehavior) && quarterlyUsageBasedPrice.equals(other.quarterlyUsageBasedPrice) + && usageQuantity.equals(other.usageQuantity) && valueBool.equals(other.valueBool) && valueNumeric.equals(other.valueNumeric) && valueType.equals(other.valueType) @@ -184,6 +197,7 @@ public int hashCode() { this.monthlyUsageBasedPrice, this.priceBehavior, this.quarterlyUsageBasedPrice, + this.usageQuantity, this.valueBool, this.valueNumeric, this.valueType, @@ -248,6 +262,13 @@ public interface _FinalStage { _FinalStage quarterlyUsageBasedPrice(BillingPriceView quarterlyUsageBasedPrice); + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + _FinalStage usageQuantity(Optional usageQuantity); + + _FinalStage usageQuantity(Long usageQuantity); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -273,6 +294,8 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional valueBool = Optional.empty(); + private Optional usageQuantity = Optional.empty(); + private Optional quarterlyUsageBasedPrice = Optional.empty(); private Optional priceBehavior = Optional.empty(); @@ -305,6 +328,7 @@ public Builder from(UsageBasedEntitlementResponseData other) { monthlyUsageBasedPrice(other.getMonthlyUsageBasedPrice()); priceBehavior(other.getPriceBehavior()); quarterlyUsageBasedPrice(other.getQuarterlyUsageBasedPrice()); + usageQuantity(other.getUsageQuantity()); valueBool(other.getValueBool()); valueNumeric(other.getValueNumeric()); valueType(other.getValueType()); @@ -365,6 +389,26 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + /** + *

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

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

The committed unit quantity for this entitlement. For custom plans this is the quantity the company is contractually committed to; for standard plans it is the quantity pre-filled when subscribing. Only applies to pay-in-advance entitlements. Note: this is not yet enforced/auto-provisioned as a true default — it is currently stored for downstream billing use.

+ */ + @java.lang.Override + @JsonSetter(value = "usage_quantity", nulls = Nulls.SKIP) + public _FinalStage usageQuantity(Optional usageQuantity) { + this.usageQuantity = usageQuantity; + return this; + } + @java.lang.Override public _FinalStage quarterlyUsageBasedPrice(BillingPriceView quarterlyUsageBasedPrice) { this.quarterlyUsageBasedPrice = Optional.ofNullable(quarterlyUsageBasedPrice); @@ -481,6 +525,7 @@ public UsageBasedEntitlementResponseData build() { monthlyUsageBasedPrice, priceBehavior, quarterlyUsageBasedPrice, + usageQuantity, valueBool, valueNumeric, valueType, diff --git a/src/main/java/com/schematic/api/types/WorkOsIntegrationConfig.java b/src/main/java/com/schematic/api/types/WorkOsIntegrationConfig.java new file mode 100644 index 0000000..1775796 --- /dev/null +++ b/src/main/java/com/schematic/api/types/WorkOsIntegrationConfig.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WorkOsIntegrationConfig.Builder.class) +public final class WorkOsIntegrationConfig { + private final Optional firstEventsReceived; + + private final Optional webhookUrl; + + private final Map additionalProperties; + + private WorkOsIntegrationConfig( + Optional firstEventsReceived, + Optional webhookUrl, + Map additionalProperties) { + this.firstEventsReceived = firstEventsReceived; + this.webhookUrl = webhookUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether Schematic has received the first webhook event from WorkOS after install + */ + @JsonProperty("first_events_received") + public Optional getFirstEventsReceived() { + return firstEventsReceived; + } + + /** + * @return URL configured on the WorkOS webhook endpoint that delivers events to Schematic + */ + @JsonProperty("webhook_url") + public Optional getWebhookUrl() { + return webhookUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkOsIntegrationConfig && equalTo((WorkOsIntegrationConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WorkOsIntegrationConfig other) { + return firstEventsReceived.equals(other.firstEventsReceived) && webhookUrl.equals(other.webhookUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.firstEventsReceived, this.webhookUrl); + } + + @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 firstEventsReceived = Optional.empty(); + + private Optional webhookUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(WorkOsIntegrationConfig other) { + firstEventsReceived(other.getFirstEventsReceived()); + webhookUrl(other.getWebhookUrl()); + return this; + } + + /** + *

Whether Schematic has received the first webhook event from WorkOS after install

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

URL configured on the WorkOS webhook endpoint that delivers events to Schematic

+ */ + @JsonSetter(value = "webhook_url", nulls = Nulls.SKIP) + public Builder webhookUrl(Optional webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + + public Builder webhookUrl(String webhookUrl) { + this.webhookUrl = Optional.ofNullable(webhookUrl); + return this; + } + + public WorkOsIntegrationConfig build() { + return new WorkOsIntegrationConfig(firstEventsReceived, webhookUrl, 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; + } + } +}