diff --git a/.fern/metadata.json b/.fern/metadata.json index 5ee5cee..b61fbff 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "340529eacf4f1dcc5522e771872c1dd94b9c4891", + "originGitCommit": "a9fc73b97dcfa602bff97a7d41d980a55c9c9030", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.5.3", + "requestedVersion": "1.5.4", "ciProvider": "github", - "sdkVersion": "1.5.3" + "sdkVersion": "1.5.4" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock index b9fd14a..e55ba63 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -24,5 +24,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.11.1 -current_generation: 89360cf8750d3589d707ec7f8402d9858ed819eb + - commit_sha: 7fc1ea4af8ebf683e8739f2b1fb365bd61e60e98 + tree_hash: 055fadadeb0be970e2d592bfeeb26bd605242d2f + timestamp: 2026-08-03T11:06:30.344Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.11.1 +current_generation: 7fc1ea4af8ebf683e8739f2b1fb365bd61e60e98 patches: [] diff --git a/build.gradle b/build.gradle index a292004..27c828f 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ java { group = 'com.schematichq' -version = '1.5.3' +version = '1.5.4' jar { dependsOn(":generatePomFileForMavenPublication") @@ -93,7 +93,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.5.3' + version = '1.5.4' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index d28f526..ce1f593 100644 --- a/reference.md +++ b/reference.md @@ -360,6 +360,14 @@ client.accounts().createApiKey(
+**rateLimitPercent:** `Optional` + +
+
+ +
+
+ **readonly:** `Optional`
@@ -463,6 +471,14 @@ client.accounts().updateApiKey( **name:** `Optional` + +
+ +
+
+ +**rateLimitPercent:** `Optional` +
@@ -2386,6 +2402,7 @@ client.billing().listBillingPrices( .forInitialPlan(true) .forTrialExpiryPlan(true) .interval("interval") + .intervalCount(1000000L) .isActive(true) .planVersionId("plan_version_id") .price(1000000L) @@ -2453,6 +2470,14 @@ client.billing().listBillingPrices(
+**intervalCount:** `Optional` — Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly) + +
+
+ +
+
+ **isActive:** `Optional` — Filter for active prices on active products (defaults to true if not specified)
@@ -2808,6 +2833,7 @@ client.billing().listBillingProductPrices( .forInitialPlan(true) .forTrialExpiryPlan(true) .interval("interval") + .intervalCount(1000000L) .isActive(true) .planVersionId("plan_version_id") .price(1000000L) @@ -2875,6 +2901,14 @@ client.billing().listBillingProductPrices(
+**intervalCount:** `Optional` — Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly) + +
+
+ +
+
+ **isActive:** `Optional` — Filter for active prices on active products (defaults to true if not specified)
@@ -6133,7 +6167,6 @@ client.catalogs().listCatalogs( client.catalogs().createCatalog( CreateCatalogRequestBody .builder() - .isDefault(true) .name("name") .build() ); @@ -6159,14 +6192,6 @@ client.catalogs().createCatalog(
-**isDefault:** `Boolean` - -
-
- -
-
- **name:** `String`
@@ -7157,6 +7182,14 @@ client.checkout().updateCompanyBillingDetails(
+**taxId:** `Optional` + +
+
+ +
+
+ **values:** `List`
@@ -12760,6 +12793,150 @@ client.entitlements().getFeatureUsageByCompany(
+ +
+ + +
client.entitlements.getUserUsageByCompany() -> GetUserUsageByCompanyResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entitlements().getUserUsageByCompany( + GetUserUsageByCompanyRequest + .builder() + .companyId("company_id") + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .featureId("feature_id") + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — Company to break usage down for + +
+
+ +
+
+ +**endTime:** `Optional` — End of the usage window (exclusive); defaults to now + +
+
+ +
+
+ +**featureId:** `Optional` — Restrict to a single event-based feature + +
+
+ +
+
+ +**startTime:** `Optional` — Start of the usage window; defaults to 30 days before the end + +
+
+
+
+ + +
+
+
+ +
client.entitlements.getUserUsageDetail() -> GetUserUsageDetailResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entitlements().getUserUsageDetail( + GetUserUsageDetailRequest + .builder() + .companyId("company_id") + .userId("user_id") + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` — Company the user belongs to + +
+
+ +
+
+ +**endTime:** `Optional` — End of the usage window (exclusive); defaults to now + +
+
+ +
+
+ +**startTime:** `Optional` — Start of the usage window; defaults to 30 days before the end + +
+
+ +
+
+ +**userId:** `String` — User to break usage down for + +
+
+
+
+ +
@@ -13034,6 +13211,14 @@ client.plans().retryCustomPlanBilling( **daysUntilDue:** `Optional` + +
+ +
+
+ +**sendInvoice:** `Optional` — Whether Stripe emails the invoice when it is finalized. Defaults to true. +
@@ -14157,6 +14342,14 @@ client.plans().publishPlanVersion(
+**address:** `Optional` + +
+
+ +
+
+ **couponExternalId:** `Optional`
@@ -14165,6 +14358,14 @@ client.plans().publishPlanVersion(
+**customFieldValues:** `Optional>` + +
+
+ +
+
+ **customerEmail:** `Optional`
@@ -14191,6 +14392,30 @@ client.plans().publishPlanVersion( **migrationStrategy:** `PlanVersionMigrationStrategy` + +
+ +
+
+ +**phone:** `Optional` + +
+
+ +
+
+ +**sendInvoice:** `Optional` — Whether Stripe emails the invoice when it is finalized. Defaults to true. + +
+
+ +
+
+ +**taxId:** `Optional` +
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index d3dc508..514e4b2 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.5.3"); + put("User-Agent", "com.schematichq:schematic-java/1.5.4"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.5.3"); + put("X-Fern-SDK-Version", "1.5.4"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java index b05963c..11d4a09 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java @@ -27,6 +27,8 @@ public final class CreateApiKeyRequestBody { private final String name; + private final Optional rateLimitPercent; + private final Optional readonly; private final Map additionalProperties; @@ -35,11 +37,13 @@ private CreateApiKeyRequestBody( Optional description, Optional environmentId, String name, + Optional rateLimitPercent, Optional readonly, Map additionalProperties) { this.description = description; this.environmentId = environmentId; this.name = name; + this.rateLimitPercent = rateLimitPercent; this.readonly = readonly; this.additionalProperties = additionalProperties; } @@ -59,6 +63,11 @@ public String getName() { return name; } + @JsonProperty("rate_limit_percent") + public Optional getRateLimitPercent() { + return rateLimitPercent; + } + @JsonProperty("readonly") public Optional getReadonly() { return readonly; @@ -79,12 +88,13 @@ private boolean equalTo(CreateApiKeyRequestBody other) { return description.equals(other.description) && environmentId.equals(other.environmentId) && name.equals(other.name) + && rateLimitPercent.equals(other.rateLimitPercent) && readonly.equals(other.readonly); } @java.lang.Override public int hashCode() { - return Objects.hash(this.description, this.environmentId, this.name, this.readonly); + return Objects.hash(this.description, this.environmentId, this.name, this.rateLimitPercent, this.readonly); } @java.lang.Override @@ -117,6 +127,10 @@ public interface _FinalStage { _FinalStage environmentId(String environmentId); + _FinalStage rateLimitPercent(Optional rateLimitPercent); + + _FinalStage rateLimitPercent(Long rateLimitPercent); + _FinalStage readonly(Optional readonly); _FinalStage readonly(Boolean readonly); @@ -128,6 +142,8 @@ public static final class Builder implements NameStage, _FinalStage { private Optional readonly = Optional.empty(); + private Optional rateLimitPercent = Optional.empty(); + private Optional environmentId = Optional.empty(); private Optional description = Optional.empty(); @@ -142,6 +158,7 @@ public Builder from(CreateApiKeyRequestBody other) { description(other.getDescription()); environmentId(other.getEnvironmentId()); name(other.getName()); + rateLimitPercent(other.getRateLimitPercent()); readonly(other.getReadonly()); return this; } @@ -166,6 +183,19 @@ public _FinalStage readonly(Optional readonly) { return this; } + @java.lang.Override + public _FinalStage rateLimitPercent(Long rateLimitPercent) { + this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) + public _FinalStage rateLimitPercent(Optional rateLimitPercent) { + this.rateLimitPercent = rateLimitPercent; + return this; + } + @java.lang.Override public _FinalStage environmentId(String environmentId) { this.environmentId = Optional.ofNullable(environmentId); @@ -194,7 +224,8 @@ public _FinalStage description(Optional description) { @java.lang.Override public CreateApiKeyRequestBody build() { - return new CreateApiKeyRequestBody(description, environmentId, name, readonly, additionalProperties); + return new CreateApiKeyRequestBody( + description, environmentId, name, rateLimitPercent, readonly, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java index 4da4e9d..1c53d92 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java @@ -24,12 +24,18 @@ public final class UpdateApiKeyRequestBody { private final Optional name; + private final Optional rateLimitPercent; + private final Map additionalProperties; private UpdateApiKeyRequestBody( - Optional description, Optional name, Map additionalProperties) { + Optional description, + Optional name, + Optional rateLimitPercent, + Map additionalProperties) { this.description = description; this.name = name; + this.rateLimitPercent = rateLimitPercent; this.additionalProperties = additionalProperties; } @@ -43,6 +49,11 @@ public Optional getName() { return name; } + @JsonProperty("rate_limit_percent") + public Optional getRateLimitPercent() { + return rateLimitPercent; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -55,12 +66,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(UpdateApiKeyRequestBody other) { - return description.equals(other.description) && name.equals(other.name); + return description.equals(other.description) + && name.equals(other.name) + && rateLimitPercent.equals(other.rateLimitPercent); } @java.lang.Override public int hashCode() { - return Objects.hash(this.description, this.name); + return Objects.hash(this.description, this.name, this.rateLimitPercent); } @java.lang.Override @@ -78,6 +91,8 @@ public static final class Builder { private Optional name = Optional.empty(); + private Optional rateLimitPercent = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -86,6 +101,7 @@ private Builder() {} public Builder from(UpdateApiKeyRequestBody other) { description(other.getDescription()); name(other.getName()); + rateLimitPercent(other.getRateLimitPercent()); return this; } @@ -111,8 +127,19 @@ public Builder name(String name) { return this; } + @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) + public Builder rateLimitPercent(Optional rateLimitPercent) { + this.rateLimitPercent = rateLimitPercent; + return this; + } + + public Builder rateLimitPercent(Long rateLimitPercent) { + this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); + return this; + } + public UpdateApiKeyRequestBody build() { - return new UpdateApiKeyRequestBody(description, name, additionalProperties); + return new UpdateApiKeyRequestBody(description, name, rateLimitPercent, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java index 1fe2b63..f0aa328 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java @@ -1768,6 +1768,10 @@ public CompletableFuture> l QueryStringMapper.addQueryParameter( httpUrl, "interval", request.getInterval().get(), false); } + if (request.getIntervalCount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval_count", request.getIntervalCount().get(), false); + } if (request.getIsActive().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "is_active", request.getIsActive().get(), false); @@ -2151,6 +2155,10 @@ public CompletableFuture listBillingPrices( QueryStringMapper.addQueryParameter( httpUrl, "interval", request.getInterval().get(), false); } + if (request.getIntervalCount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval_count", request.getIntervalCount().get(), false); + } if (request.getIsActive().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "is_active", request.getIsActive().get(), false); @@ -1682,6 +1686,10 @@ public BaseSchematicHttpResponse listBillingPr QueryStringMapper.addQueryParameter( httpUrl, "interval", request.getInterval().get(), false); } + if (request.getIntervalCount().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "interval_count", request.getIntervalCount().get(), false); + } if (request.getIsActive().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "is_active", request.getIsActive().get(), false); diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java index 8c46eee..df8f36a 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java @@ -37,6 +37,8 @@ public final class ListBillingPricesRequest { private final Optional interval; + private final Optional intervalCount; + private final Optional isActive; private final Optional planVersionId; @@ -68,6 +70,7 @@ private ListBillingPricesRequest( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional interval, + Optional intervalCount, Optional isActive, Optional planVersionId, Optional price, @@ -86,6 +89,7 @@ private ListBillingPricesRequest( this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.interval = interval; + this.intervalCount = intervalCount; this.isActive = isActive; this.planVersionId = planVersionId; this.price = price; @@ -139,6 +143,14 @@ public Optional getInterval() { return interval; } + /** + * @return Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly) + */ + @JsonProperty("interval_count") + public Optional getIntervalCount() { + return intervalCount; + } + /** * @return Filter for active prices on active products (defaults to true if not specified) */ @@ -227,6 +239,7 @@ private boolean equalTo(ListBillingPricesRequest other) { && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && interval.equals(other.interval) + && intervalCount.equals(other.intervalCount) && isActive.equals(other.isActive) && planVersionId.equals(other.planVersionId) && price.equals(other.price) @@ -249,6 +262,7 @@ public int hashCode() { this.forInitialPlan, this.forTrialExpiryPlan, this.interval, + this.intervalCount, this.isActive, this.planVersionId, this.price, @@ -285,6 +299,8 @@ public static final class Builder { private Optional interval = Optional.empty(); + private Optional intervalCount = Optional.empty(); + private Optional isActive = Optional.empty(); private Optional planVersionId = Optional.empty(); @@ -319,6 +335,7 @@ public Builder from(ListBillingPricesRequest other) { forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); interval(other.getInterval()); + intervalCount(other.getIntervalCount()); isActive(other.getIsActive()); planVersionId(other.getPlanVersionId()); price(other.getPrice()); @@ -418,6 +435,20 @@ public Builder interval(String interval) { return this; } + /** + *

Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly)

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

Filter for active prices on active products (defaults to true if not specified)

*/ @@ -562,6 +593,7 @@ public ListBillingPricesRequest build() { forInitialPlan, forTrialExpiryPlan, interval, + intervalCount, isActive, planVersionId, price, diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java index a3451cf..8d5bdf9 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java @@ -37,6 +37,8 @@ public final class ListBillingProductPricesRequest { private final Optional interval; + private final Optional intervalCount; + private final Optional isActive; private final Optional planVersionId; @@ -68,6 +70,7 @@ private ListBillingProductPricesRequest( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional interval, + Optional intervalCount, Optional isActive, Optional planVersionId, Optional price, @@ -86,6 +89,7 @@ private ListBillingProductPricesRequest( this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.interval = interval; + this.intervalCount = intervalCount; this.isActive = isActive; this.planVersionId = planVersionId; this.price = price; @@ -139,6 +143,14 @@ public Optional getInterval() { return interval; } + /** + * @return Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly) + */ + @JsonProperty("interval_count") + public Optional getIntervalCount() { + return intervalCount; + } + /** * @return Filter for active prices on active products (defaults to true if not specified) */ @@ -227,6 +239,7 @@ private boolean equalTo(ListBillingProductPricesRequest other) { && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && interval.equals(other.interval) + && intervalCount.equals(other.intervalCount) && isActive.equals(other.isActive) && planVersionId.equals(other.planVersionId) && price.equals(other.price) @@ -249,6 +262,7 @@ public int hashCode() { this.forInitialPlan, this.forTrialExpiryPlan, this.interval, + this.intervalCount, this.isActive, this.planVersionId, this.price, @@ -285,6 +299,8 @@ public static final class Builder { private Optional interval = Optional.empty(); + private Optional intervalCount = Optional.empty(); + private Optional isActive = Optional.empty(); private Optional planVersionId = Optional.empty(); @@ -319,6 +335,7 @@ public Builder from(ListBillingProductPricesRequest other) { forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); interval(other.getInterval()); + intervalCount(other.getIntervalCount()); isActive(other.getIsActive()); planVersionId(other.getPlanVersionId()); price(other.getPrice()); @@ -418,6 +435,20 @@ public Builder interval(String interval) { return this; } + /** + *

Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly)

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

Filter for active prices on active products (defaults to true if not specified)

*/ @@ -562,6 +593,7 @@ public ListBillingProductPricesRequest build() { forInitialPlan, forTrialExpiryPlan, interval, + intervalCount, isActive, planVersionId, price, diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java index bbac8de..3a1476f 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java @@ -34,6 +34,8 @@ public final class ListBillingPricesParams { private final Optional interval; + private final Optional intervalCount; + private final Optional isActive; private final Optional limit; @@ -66,6 +68,7 @@ private ListBillingPricesParams( Optional forTrialExpiryPlan, Optional> ids, Optional interval, + Optional intervalCount, Optional isActive, Optional limit, Optional offset, @@ -84,6 +87,7 @@ private ListBillingPricesParams( this.forTrialExpiryPlan = forTrialExpiryPlan; this.ids = ids; this.interval = interval; + this.intervalCount = intervalCount; this.isActive = isActive; this.limit = limit; this.offset = offset; @@ -133,6 +137,14 @@ public Optional getInterval() { return interval; } + /** + * @return Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly) + */ + @JsonProperty("interval_count") + public Optional getIntervalCount() { + return intervalCount; + } + /** * @return Filter for active prices on active products (defaults to true if not specified) */ @@ -225,6 +237,7 @@ private boolean equalTo(ListBillingPricesParams other) { && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && ids.equals(other.ids) && interval.equals(other.interval) + && intervalCount.equals(other.intervalCount) && isActive.equals(other.isActive) && limit.equals(other.limit) && offset.equals(other.offset) @@ -247,6 +260,7 @@ public int hashCode() { this.forTrialExpiryPlan, this.ids, this.interval, + this.intervalCount, this.isActive, this.limit, this.offset, @@ -282,6 +296,8 @@ public static final class Builder { private Optional interval = Optional.empty(); + private Optional intervalCount = Optional.empty(); + private Optional isActive = Optional.empty(); private Optional limit = Optional.empty(); @@ -317,6 +333,7 @@ public Builder from(ListBillingPricesParams other) { forTrialExpiryPlan(other.getForTrialExpiryPlan()); ids(other.getIds()); interval(other.getInterval()); + intervalCount(other.getIntervalCount()); isActive(other.getIsActive()); limit(other.getLimit()); offset(other.getOffset()); @@ -396,6 +413,20 @@ public Builder interval(String interval) { return this; } + /** + *

Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly)

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

Filter for active prices on active products (defaults to true if not specified)

*/ @@ -550,6 +581,7 @@ public ListBillingPricesParams build() { forTrialExpiryPlan, ids, interval, + intervalCount, isActive, limit, offset, diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java index 0bff5dc..6c74b28 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java @@ -34,6 +34,8 @@ public final class ListBillingProductPricesParams { private final Optional interval; + private final Optional intervalCount; + private final Optional isActive; private final Optional limit; @@ -66,6 +68,7 @@ private ListBillingProductPricesParams( Optional forTrialExpiryPlan, Optional> ids, Optional interval, + Optional intervalCount, Optional isActive, Optional limit, Optional offset, @@ -84,6 +87,7 @@ private ListBillingProductPricesParams( this.forTrialExpiryPlan = forTrialExpiryPlan; this.ids = ids; this.interval = interval; + this.intervalCount = intervalCount; this.isActive = isActive; this.limit = limit; this.offset = offset; @@ -133,6 +137,14 @@ public Optional getInterval() { return interval; } + /** + * @return Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly) + */ + @JsonProperty("interval_count") + public Optional getIntervalCount() { + return intervalCount; + } + /** * @return Filter for active prices on active products (defaults to true if not specified) */ @@ -225,6 +237,7 @@ private boolean equalTo(ListBillingProductPricesParams other) { && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && ids.equals(other.ids) && interval.equals(other.interval) + && intervalCount.equals(other.intervalCount) && isActive.equals(other.isActive) && limit.equals(other.limit) && offset.equals(other.offset) @@ -247,6 +260,7 @@ public int hashCode() { this.forTrialExpiryPlan, this.ids, this.interval, + this.intervalCount, this.isActive, this.limit, this.offset, @@ -282,6 +296,8 @@ public static final class Builder { private Optional interval = Optional.empty(); + private Optional intervalCount = Optional.empty(); + private Optional isActive = Optional.empty(); private Optional limit = Optional.empty(); @@ -317,6 +333,7 @@ public Builder from(ListBillingProductPricesParams other) { forTrialExpiryPlan(other.getForTrialExpiryPlan()); ids(other.getIds()); interval(other.getInterval()); + intervalCount(other.getIntervalCount()); isActive(other.getIsActive()); limit(other.getLimit()); offset(other.getOffset()); @@ -396,6 +413,20 @@ public Builder interval(String interval) { return this; } + /** + *

Filter for prices billed every N intervals; combine with interval (e.g. interval=month, interval_count=3 for quarterly)

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

Filter for active prices on active products (defaults to true if not specified)

*/ @@ -550,6 +581,7 @@ public ListBillingProductPricesParams build() { forTrialExpiryPlan, ids, interval, + intervalCount, isActive, limit, offset, diff --git a/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java b/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java index 3cd18cd..9605a77 100644 --- a/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java +++ b/src/main/java/com/schematic/api/resources/catalogs/requests/CreateCatalogRequestBody.java @@ -23,16 +23,13 @@ public final class CreateCatalogRequestBody { private final Optional description; - private final boolean isDefault; - private final String name; private final Map additionalProperties; private CreateCatalogRequestBody( - Optional description, boolean isDefault, String name, Map additionalProperties) { + Optional description, String name, Map additionalProperties) { this.description = description; - this.isDefault = isDefault; this.name = name; this.additionalProperties = additionalProperties; } @@ -42,11 +39,6 @@ public Optional getDescription() { return description; } - @JsonProperty("is_default") - public boolean getIsDefault() { - return isDefault; - } - @JsonProperty("name") public String getName() { return name; @@ -64,12 +56,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(CreateCatalogRequestBody other) { - return description.equals(other.description) && isDefault == other.isDefault && name.equals(other.name); + return description.equals(other.description) && name.equals(other.name); } @java.lang.Override public int hashCode() { - return Objects.hash(this.description, this.isDefault, this.name); + return Objects.hash(this.description, this.name); } @java.lang.Override @@ -77,18 +69,14 @@ public String toString() { return ObjectMappers.stringify(this); } - public static IsDefaultStage builder() { + public static NameStage builder() { return new Builder(); } - public interface IsDefaultStage { - NameStage isDefault(boolean isDefault); - - Builder from(CreateCatalogRequestBody other); - } - public interface NameStage { _FinalStage name(@NotNull String name); + + Builder from(CreateCatalogRequestBody other); } public interface _FinalStage { @@ -104,9 +92,7 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsDefaultStage, NameStage, _FinalStage { - private boolean isDefault; - + public static final class Builder implements NameStage, _FinalStage { private String name; private Optional description = Optional.empty(); @@ -119,18 +105,10 @@ private Builder() {} @java.lang.Override public Builder from(CreateCatalogRequestBody other) { description(other.getDescription()); - isDefault(other.getIsDefault()); name(other.getName()); return this; } - @java.lang.Override - @JsonSetter("is_default") - public NameStage isDefault(boolean isDefault) { - this.isDefault = isDefault; - return this; - } - @java.lang.Override @JsonSetter("name") public _FinalStage name(@NotNull String name) { @@ -153,7 +131,7 @@ public _FinalStage description(Optional description) { @java.lang.Override public CreateCatalogRequestBody build() { - return new CreateCatalogRequestBody(description, isDefault, name, additionalProperties); + return new CreateCatalogRequestBody(description, name, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java b/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java index afa4bcc..9969ba4 100644 --- a/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java +++ b/src/main/java/com/schematic/api/resources/checkout/requests/UpdateCompanyBillingDetailsRequestBody.java @@ -14,6 +14,7 @@ import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.CheckoutFieldValue; import com.schematic.api.types.CustomerBillingAddress; +import com.schematic.api.types.TaxIdInput; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -30,6 +31,8 @@ public final class UpdateCompanyBillingDetailsRequestBody { private final Optional phone; + private final Optional taxId; + private final List values; private final Map additionalProperties; @@ -38,11 +41,13 @@ private UpdateCompanyBillingDetailsRequestBody( Optional address, Optional email, Optional phone, + Optional taxId, List values, Map additionalProperties) { this.address = address; this.email = email; this.phone = phone; + this.taxId = taxId; this.values = values; this.additionalProperties = additionalProperties; } @@ -62,6 +67,11 @@ public Optional getPhone() { return phone; } + @JsonProperty("tax_id") + public Optional getTaxId() { + return taxId; + } + @JsonProperty("values") public List getValues() { return values; @@ -83,12 +93,13 @@ private boolean equalTo(UpdateCompanyBillingDetailsRequestBody other) { return address.equals(other.address) && email.equals(other.email) && phone.equals(other.phone) + && taxId.equals(other.taxId) && values.equals(other.values); } @java.lang.Override public int hashCode() { - return Objects.hash(this.address, this.email, this.phone, this.values); + return Objects.hash(this.address, this.email, this.phone, this.taxId, this.values); } @java.lang.Override @@ -108,6 +119,8 @@ public static final class Builder { private Optional phone = Optional.empty(); + private Optional taxId = Optional.empty(); + private List values = new ArrayList<>(); @JsonAnySetter @@ -119,6 +132,7 @@ public Builder from(UpdateCompanyBillingDetailsRequestBody other) { address(other.getAddress()); email(other.getEmail()); phone(other.getPhone()); + taxId(other.getTaxId()); values(other.getValues()); return this; } @@ -156,6 +170,17 @@ public Builder phone(String phone) { return this; } + @JsonSetter(value = "tax_id", nulls = Nulls.SKIP) + public Builder taxId(Optional taxId) { + this.taxId = taxId; + return this; + } + + public Builder taxId(TaxIdInput taxId) { + this.taxId = Optional.ofNullable(taxId); + return this; + } + @JsonSetter(value = "values", nulls = Nulls.SKIP) public Builder values(List values) { this.values.clear(); @@ -178,7 +203,8 @@ public Builder addAllValues(List values) { } public UpdateCompanyBillingDetailsRequestBody build() { - return new UpdateCompanyBillingDetailsRequestBody(address, email, phone, values, additionalProperties); + return new UpdateCompanyBillingDetailsRequestBody( + address, email, phone, taxId, values, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java index c6c374f..735fc81 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java @@ -16,6 +16,8 @@ import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageDetailRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -37,6 +39,8 @@ import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageDetailResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; @@ -334,4 +338,23 @@ public CompletableFuture getFeatureUsageByComp GetFeatureUsageByCompanyRequest request, RequestOptions requestOptions) { return this.rawClient.getFeatureUsageByCompany(request, requestOptions).thenApply(response -> response.body()); } + + public CompletableFuture getUserUsageByCompany( + GetUserUsageByCompanyRequest request) { + return this.rawClient.getUserUsageByCompany(request).thenApply(response -> response.body()); + } + + public CompletableFuture getUserUsageByCompany( + GetUserUsageByCompanyRequest request, RequestOptions requestOptions) { + return this.rawClient.getUserUsageByCompany(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture getUserUsageDetail(GetUserUsageDetailRequest request) { + return this.rawClient.getUserUsageDetail(request).thenApply(response -> response.body()); + } + + public CompletableFuture getUserUsageDetail( + GetUserUsageDetailRequest request, RequestOptions requestOptions) { + return this.rawClient.getUserUsageDetail(request, requestOptions).thenApply(response -> response.body()); + } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java index b76b7a4..90c32d4 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java @@ -29,6 +29,8 @@ import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageDetailRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -50,6 +52,8 @@ import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageDetailResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; @@ -2622,4 +2626,213 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } + + public CompletableFuture> getUserUsageByCompany( + GetUserUsageByCompanyRequest request) { + return getUserUsageByCompany(request, null); + } + + public CompletableFuture> getUserUsageByCompany( + GetUserUsageByCompanyRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("user-usage-by-company"); + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getFeatureId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_id", request.getFeatureId().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetUserUsageByCompanyResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> getUserUsageDetail( + GetUserUsageDetailRequest request) { + return getUserUsageDetail(request, null); + } + + public CompletableFuture> getUserUsageDetail( + GetUserUsageDetailRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("user-usage-detail"); + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "user_id", request.getUserId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetUserUsageDetailResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java index eccf611..fa4d7c5 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java @@ -16,6 +16,8 @@ import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageDetailRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -37,6 +39,8 @@ import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageDetailResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; @@ -321,4 +325,22 @@ public GetFeatureUsageByCompanyResponse getFeatureUsageByCompany( GetFeatureUsageByCompanyRequest request, RequestOptions requestOptions) { return this.rawClient.getFeatureUsageByCompany(request, requestOptions).body(); } + + public GetUserUsageByCompanyResponse getUserUsageByCompany(GetUserUsageByCompanyRequest request) { + return this.rawClient.getUserUsageByCompany(request).body(); + } + + public GetUserUsageByCompanyResponse getUserUsageByCompany( + GetUserUsageByCompanyRequest request, RequestOptions requestOptions) { + return this.rawClient.getUserUsageByCompany(request, requestOptions).body(); + } + + public GetUserUsageDetailResponse getUserUsageDetail(GetUserUsageDetailRequest request) { + return this.rawClient.getUserUsageDetail(request).body(); + } + + public GetUserUsageDetailResponse getUserUsageDetail( + GetUserUsageDetailRequest request, RequestOptions requestOptions) { + return this.rawClient.getUserUsageDetail(request, requestOptions).body(); + } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java index 85c3e5c..db5571a 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java @@ -29,6 +29,8 @@ import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetUserUsageDetailRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -50,6 +52,8 @@ import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetUserUsageDetailResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; @@ -2065,4 +2069,166 @@ public BaseSchematicHttpResponse getFeatureUsa throw new BaseSchematicException("Network error executing HTTP request", e); } } + + public BaseSchematicHttpResponse getUserUsageByCompany( + GetUserUsageByCompanyRequest request) { + return getUserUsageByCompany(request, null); + } + + public BaseSchematicHttpResponse getUserUsageByCompany( + GetUserUsageByCompanyRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("user-usage-by-company"); + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getFeatureId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_id", request.getFeatureId().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetUserUsageByCompanyResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getUserUsageDetail(GetUserUsageDetailRequest request) { + return getUserUsageDetail(request, null); + } + + public BaseSchematicHttpResponse getUserUsageDetail( + GetUserUsageDetailRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("user-usage-detail"); + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "user_id", request.getUserId(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetUserUsageDetailResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/GetUserUsageByCompanyRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/GetUserUsageByCompanyRequest.java new file mode 100644 index 0000000..472d66b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/GetUserUsageByCompanyRequest.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetUserUsageByCompanyRequest.Builder.class) +public final class GetUserUsageByCompanyRequest { + private final String companyId; + + private final Optional endTime; + + private final Optional featureId; + + private final Optional startTime; + + private final Map additionalProperties; + + private GetUserUsageByCompanyRequest( + String companyId, + Optional endTime, + Optional featureId, + Optional startTime, + Map additionalProperties) { + this.companyId = companyId; + this.endTime = endTime; + this.featureId = featureId; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return Company to break usage down for + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return End of the usage window (exclusive); defaults to now + */ + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + /** + * @return Restrict to a single event-based feature + */ + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + /** + * @return Start of the usage window; defaults to 30 days before the end + */ + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetUserUsageByCompanyRequest && equalTo((GetUserUsageByCompanyRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetUserUsageByCompanyRequest other) { + return companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && featureId.equals(other.featureId) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.endTime, this.featureId, this.startTime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

Company to break usage down for

+ */ + _FinalStage companyId(@NotNull String companyId); + + Builder from(GetUserUsageByCompanyRequest other); + } + + public interface _FinalStage { + GetUserUsageByCompanyRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

End of the usage window (exclusive); defaults to now

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

Restrict to a single event-based feature

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

Start of the usage window; defaults to 30 days before the end

+ */ + _FinalStage startTime(Optional startTime); + + _FinalStage startTime(OffsetDateTime startTime); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional startTime = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional endTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetUserUsageByCompanyRequest other) { + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + featureId(other.getFeatureId()); + startTime(other.getStartTime()); + return this; + } + + /** + *

Company to break usage down for

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

Start of the usage window; defaults to 30 days before the end

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

Start of the usage window; defaults to 30 days before the end

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

Restrict to a single event-based feature

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

Restrict to a single event-based feature

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

End of the usage window (exclusive); defaults to now

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

End of the usage window (exclusive); defaults to now

+ */ + @java.lang.Override + @JsonSetter(value = "end_time", nulls = Nulls.SKIP) + public _FinalStage endTime(Optional endTime) { + this.endTime = endTime; + return this; + } + + @java.lang.Override + public GetUserUsageByCompanyRequest build() { + return new GetUserUsageByCompanyRequest(companyId, endTime, featureId, startTime, 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/entitlements/requests/GetUserUsageDetailRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/GetUserUsageDetailRequest.java new file mode 100644 index 0000000..56ccd7d --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/GetUserUsageDetailRequest.java @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetUserUsageDetailRequest.Builder.class) +public final class GetUserUsageDetailRequest { + private final String companyId; + + private final Optional endTime; + + private final Optional startTime; + + private final String userId; + + private final Map additionalProperties; + + private GetUserUsageDetailRequest( + String companyId, + Optional endTime, + Optional startTime, + String userId, + Map additionalProperties) { + this.companyId = companyId; + this.endTime = endTime; + this.startTime = startTime; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Company the user belongs to + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return End of the usage window (exclusive); defaults to now + */ + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + /** + * @return Start of the usage window; defaults to 30 days before the end + */ + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + /** + * @return User to break usage down for + */ + @JsonProperty("user_id") + public String getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetUserUsageDetailRequest && equalTo((GetUserUsageDetailRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetUserUsageDetailRequest other) { + return companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && startTime.equals(other.startTime) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.endTime, this.startTime, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

Company the user belongs to

+ */ + UserIdStage companyId(@NotNull String companyId); + + Builder from(GetUserUsageDetailRequest other); + } + + public interface UserIdStage { + /** + *

User to break usage down for

+ */ + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + GetUserUsageDetailRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

End of the usage window (exclusive); defaults to now

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

Start of the usage window; defaults to 30 days before the end

+ */ + _FinalStage startTime(Optional startTime); + + _FinalStage startTime(OffsetDateTime startTime); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, UserIdStage, _FinalStage { + private String companyId; + + private String userId; + + private Optional startTime = Optional.empty(); + + private Optional endTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetUserUsageDetailRequest other) { + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + startTime(other.getStartTime()); + userId(other.getUserId()); + return this; + } + + /** + *

Company the user belongs to

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

User to break usage down for

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

Start of the usage window; defaults to 30 days before the end

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

Start of the usage window; defaults to 30 days before the end

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

End of the usage window (exclusive); defaults to now

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

End of the usage window (exclusive); defaults to now

+ */ + @java.lang.Override + @JsonSetter(value = "end_time", nulls = Nulls.SKIP) + public _FinalStage endTime(Optional endTime) { + this.endTime = endTime; + return this; + } + + @java.lang.Override + public GetUserUsageDetailRequest build() { + return new GetUserUsageDetailRequest(companyId, endTime, startTime, userId, 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/entitlements/types/GetUserUsageByCompanyParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageByCompanyParams.java new file mode 100644 index 0000000..e256cb2 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageByCompanyParams.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetUserUsageByCompanyParams.Builder.class) +public final class GetUserUsageByCompanyParams { + private final Optional companyId; + + private final Optional endTime; + + private final Optional featureId; + + private final Optional startTime; + + private final Map additionalProperties; + + private GetUserUsageByCompanyParams( + Optional companyId, + Optional endTime, + Optional featureId, + Optional startTime, + Map additionalProperties) { + this.companyId = companyId; + this.endTime = endTime; + this.featureId = featureId; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return Company to break usage down for + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return End of the usage window (exclusive); defaults to now + */ + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + /** + * @return Restrict to a single event-based feature + */ + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + /** + * @return Start of the usage window; defaults to 30 days before the end + */ + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetUserUsageByCompanyParams && equalTo((GetUserUsageByCompanyParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetUserUsageByCompanyParams other) { + return companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && featureId.equals(other.featureId) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.endTime, this.featureId, this.startTime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional companyId = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional startTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetUserUsageByCompanyParams other) { + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + featureId(other.getFeatureId()); + startTime(other.getStartTime()); + return this; + } + + /** + *

Company to break usage down for

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

End of the usage window (exclusive); defaults to now

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

Restrict to a single event-based feature

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

Start of the usage window; defaults to 30 days before the end

+ */ + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public Builder startTime(Optional startTime) { + this.startTime = startTime; + return this; + } + + public Builder startTime(OffsetDateTime startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + public GetUserUsageByCompanyParams build() { + return new GetUserUsageByCompanyParams(companyId, endTime, featureId, startTime, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageByCompanyResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageByCompanyResponse.java new file mode 100644 index 0000000..bb1d822 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageByCompanyResponse.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.UserUsageByCompanyResponseData; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetUserUsageByCompanyResponse.Builder.class) +public final class GetUserUsageByCompanyResponse { + private final UserUsageByCompanyResponseData data; + + private final GetUserUsageByCompanyParams params; + + private final Map additionalProperties; + + private GetUserUsageByCompanyResponse( + UserUsageByCompanyResponseData data, + GetUserUsageByCompanyParams params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public UserUsageByCompanyResponseData getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public GetUserUsageByCompanyParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetUserUsageByCompanyResponse && equalTo((GetUserUsageByCompanyResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetUserUsageByCompanyResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + ParamsStage data(@NotNull UserUsageByCompanyResponseData data); + + Builder from(GetUserUsageByCompanyResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull GetUserUsageByCompanyParams params); + } + + public interface _FinalStage { + GetUserUsageByCompanyResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private UserUsageByCompanyResponseData data; + + private GetUserUsageByCompanyParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetUserUsageByCompanyResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public ParamsStage data(@NotNull UserUsageByCompanyResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull GetUserUsageByCompanyParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public GetUserUsageByCompanyResponse build() { + return new GetUserUsageByCompanyResponse(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/entitlements/types/GetUserUsageDetailParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageDetailParams.java new file mode 100644 index 0000000..e19d50b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageDetailParams.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetUserUsageDetailParams.Builder.class) +public final class GetUserUsageDetailParams { + private final Optional companyId; + + private final Optional endTime; + + private final Optional startTime; + + private final Optional userId; + + private final Map additionalProperties; + + private GetUserUsageDetailParams( + Optional companyId, + Optional endTime, + Optional startTime, + Optional userId, + Map additionalProperties) { + this.companyId = companyId; + this.endTime = endTime; + this.startTime = startTime; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Company the user belongs to + */ + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @return End of the usage window (exclusive); defaults to now + */ + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + /** + * @return Start of the usage window; defaults to 30 days before the end + */ + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + /** + * @return User to break usage down for + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetUserUsageDetailParams && equalTo((GetUserUsageDetailParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetUserUsageDetailParams other) { + return companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && startTime.equals(other.startTime) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.endTime, this.startTime, this.userId); + } + + @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 companyId = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional startTime = Optional.empty(); + + private Optional userId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetUserUsageDetailParams other) { + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + startTime(other.getStartTime()); + userId(other.getUserId()); + return this; + } + + /** + *

Company the user belongs to

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

End of the usage window (exclusive); defaults to now

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

Start of the usage window; defaults to 30 days before the end

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

User to break usage down for

+ */ + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public Builder userId(Optional userId) { + this.userId = userId; + return this; + } + + public Builder userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + public GetUserUsageDetailParams build() { + return new GetUserUsageDetailParams(companyId, endTime, startTime, userId, 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/entitlements/types/GetUserUsageDetailResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageDetailResponse.java new file mode 100644 index 0000000..81b3c81 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetUserUsageDetailResponse.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.UserUsageDetailResponseData; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetUserUsageDetailResponse.Builder.class) +public final class GetUserUsageDetailResponse { + private final UserUsageDetailResponseData data; + + private final GetUserUsageDetailParams params; + + private final Map additionalProperties; + + private GetUserUsageDetailResponse( + UserUsageDetailResponseData data, + GetUserUsageDetailParams params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public UserUsageDetailResponseData getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public GetUserUsageDetailParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetUserUsageDetailResponse && equalTo((GetUserUsageDetailResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetUserUsageDetailResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + ParamsStage data(@NotNull UserUsageDetailResponseData data); + + Builder from(GetUserUsageDetailResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull GetUserUsageDetailParams params); + } + + public interface _FinalStage { + GetUserUsageDetailResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private UserUsageDetailResponseData data; + + private GetUserUsageDetailParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetUserUsageDetailResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public ParamsStage data(@NotNull UserUsageDetailResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull GetUserUsageDetailParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public GetUserUsageDetailResponse build() { + return new GetUserUsageDetailResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java index 50856e9..269ac75 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java @@ -12,8 +12,11 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CheckoutFieldValue; import com.schematic.api.types.CustomPlanActivationStrategy; +import com.schematic.api.types.CustomerBillingAddress; import com.schematic.api.types.PlanVersionMigrationStrategy; +import com.schematic.api.types.TaxIdInput; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -27,8 +30,12 @@ public final class PublishPlanVersionRequestBody { private final Optional activationStrategy; + private final Optional address; + private final Optional couponExternalId; + private final Optional> customFieldValues; + private final Optional customerEmail; private final Optional daysUntilDue; @@ -37,22 +44,38 @@ public final class PublishPlanVersionRequestBody { private final PlanVersionMigrationStrategy migrationStrategy; + private final Optional phone; + + private final Optional sendInvoice; + + private final Optional taxId; + private final Map additionalProperties; private PublishPlanVersionRequestBody( Optional activationStrategy, + Optional address, Optional couponExternalId, + Optional> customFieldValues, Optional customerEmail, Optional daysUntilDue, List excludedCompanyIds, PlanVersionMigrationStrategy migrationStrategy, + Optional phone, + Optional sendInvoice, + Optional taxId, Map additionalProperties) { this.activationStrategy = activationStrategy; + this.address = address; this.couponExternalId = couponExternalId; + this.customFieldValues = customFieldValues; this.customerEmail = customerEmail; this.daysUntilDue = daysUntilDue; this.excludedCompanyIds = excludedCompanyIds; this.migrationStrategy = migrationStrategy; + this.phone = phone; + this.sendInvoice = sendInvoice; + this.taxId = taxId; this.additionalProperties = additionalProperties; } @@ -61,11 +84,21 @@ public Optional getActivationStrategy() { return activationStrategy; } + @JsonProperty("address") + public Optional getAddress() { + return address; + } + @JsonProperty("coupon_external_id") public Optional getCouponExternalId() { return couponExternalId; } + @JsonProperty("custom_field_values") + public Optional> getCustomFieldValues() { + return customFieldValues; + } + @JsonProperty("customer_email") public Optional getCustomerEmail() { return customerEmail; @@ -86,6 +119,24 @@ public PlanVersionMigrationStrategy getMigrationStrategy() { return migrationStrategy; } + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + /** + * @return Whether Stripe emails the invoice when it is finalized. Defaults to true. + */ + @JsonProperty("send_invoice") + public Optional getSendInvoice() { + return sendInvoice; + } + + @JsonProperty("tax_id") + public Optional getTaxId() { + return taxId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -99,22 +150,32 @@ public Map getAdditionalProperties() { private boolean equalTo(PublishPlanVersionRequestBody other) { return activationStrategy.equals(other.activationStrategy) + && address.equals(other.address) && couponExternalId.equals(other.couponExternalId) + && customFieldValues.equals(other.customFieldValues) && customerEmail.equals(other.customerEmail) && daysUntilDue.equals(other.daysUntilDue) && excludedCompanyIds.equals(other.excludedCompanyIds) - && migrationStrategy.equals(other.migrationStrategy); + && migrationStrategy.equals(other.migrationStrategy) + && phone.equals(other.phone) + && sendInvoice.equals(other.sendInvoice) + && taxId.equals(other.taxId); } @java.lang.Override public int hashCode() { return Objects.hash( this.activationStrategy, + this.address, this.couponExternalId, + this.customFieldValues, this.customerEmail, this.daysUntilDue, this.excludedCompanyIds, - this.migrationStrategy); + this.migrationStrategy, + this.phone, + this.sendInvoice, + this.taxId); } @java.lang.Override @@ -143,10 +204,18 @@ public interface _FinalStage { _FinalStage activationStrategy(CustomPlanActivationStrategy activationStrategy); + _FinalStage address(Optional address); + + _FinalStage address(CustomerBillingAddress address); + _FinalStage couponExternalId(Optional couponExternalId); _FinalStage couponExternalId(String couponExternalId); + _FinalStage customFieldValues(Optional> customFieldValues); + + _FinalStage customFieldValues(List customFieldValues); + _FinalStage customerEmail(Optional customerEmail); _FinalStage customerEmail(String customerEmail); @@ -160,20 +229,45 @@ public interface _FinalStage { _FinalStage addExcludedCompanyIds(String excludedCompanyIds); _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds); + + _FinalStage phone(Optional phone); + + _FinalStage phone(String phone); + + /** + *

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

+ */ + _FinalStage sendInvoice(Optional sendInvoice); + + _FinalStage sendInvoice(Boolean sendInvoice); + + _FinalStage taxId(Optional taxId); + + _FinalStage taxId(TaxIdInput taxId); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements MigrationStrategyStage, _FinalStage { private PlanVersionMigrationStrategy migrationStrategy; + private Optional taxId = Optional.empty(); + + private Optional sendInvoice = Optional.empty(); + + private Optional phone = Optional.empty(); + private List excludedCompanyIds = new ArrayList<>(); private Optional daysUntilDue = Optional.empty(); private Optional customerEmail = Optional.empty(); + private Optional> customFieldValues = Optional.empty(); + private Optional couponExternalId = Optional.empty(); + private Optional address = Optional.empty(); + private Optional activationStrategy = Optional.empty(); @JsonAnySetter @@ -184,11 +278,16 @@ private Builder() {} @java.lang.Override public Builder from(PublishPlanVersionRequestBody other) { activationStrategy(other.getActivationStrategy()); + address(other.getAddress()); couponExternalId(other.getCouponExternalId()); + customFieldValues(other.getCustomFieldValues()); customerEmail(other.getCustomerEmail()); daysUntilDue(other.getDaysUntilDue()); excludedCompanyIds(other.getExcludedCompanyIds()); migrationStrategy(other.getMigrationStrategy()); + phone(other.getPhone()); + sendInvoice(other.getSendInvoice()); + taxId(other.getTaxId()); return this; } @@ -199,6 +298,52 @@ public _FinalStage migrationStrategy(@NotNull PlanVersionMigrationStrategy migra return this; } + @java.lang.Override + public _FinalStage taxId(TaxIdInput taxId) { + this.taxId = Optional.ofNullable(taxId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tax_id", nulls = Nulls.SKIP) + public _FinalStage taxId(Optional taxId) { + this.taxId = taxId; + return this; + } + + /** + *

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

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

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

+ */ + @java.lang.Override + @JsonSetter(value = "send_invoice", nulls = Nulls.SKIP) + public _FinalStage sendInvoice(Optional sendInvoice) { + this.sendInvoice = sendInvoice; + return this; + } + + @java.lang.Override + public _FinalStage phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public _FinalStage phone(Optional phone) { + this.phone = phone; + return this; + } + @java.lang.Override public _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds) { if (excludedCompanyIds != null) { @@ -249,6 +394,19 @@ public _FinalStage customerEmail(Optional customerEmail) { return this; } + @java.lang.Override + public _FinalStage customFieldValues(List customFieldValues) { + this.customFieldValues = Optional.ofNullable(customFieldValues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_field_values", nulls = Nulls.SKIP) + public _FinalStage customFieldValues(Optional> customFieldValues) { + this.customFieldValues = customFieldValues; + return this; + } + @java.lang.Override public _FinalStage couponExternalId(String couponExternalId) { this.couponExternalId = Optional.ofNullable(couponExternalId); @@ -262,6 +420,19 @@ public _FinalStage couponExternalId(Optional couponExternalId) { return this; } + @java.lang.Override + public _FinalStage address(CustomerBillingAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + @java.lang.Override + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public _FinalStage address(Optional address) { + this.address = address; + return this; + } + @java.lang.Override public _FinalStage activationStrategy(CustomPlanActivationStrategy activationStrategy) { this.activationStrategy = Optional.ofNullable(activationStrategy); @@ -279,11 +450,16 @@ public _FinalStage activationStrategy(Optional act public PublishPlanVersionRequestBody build() { return new PublishPlanVersionRequestBody( activationStrategy, + address, couponExternalId, + customFieldValues, customerEmail, daysUntilDue, excludedCompanyIds, migrationStrategy, + phone, + sendInvoice, + taxId, additionalProperties); } diff --git a/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java index 1866572..eb32e6c 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java @@ -28,16 +28,20 @@ public final class RetryCustomPlanBillingRequestBody { private final Optional daysUntilDue; + private final Optional sendInvoice; + private final Map additionalProperties; private RetryCustomPlanBillingRequestBody( Optional activationStrategy, String customerEmail, Optional daysUntilDue, + Optional sendInvoice, Map additionalProperties) { this.activationStrategy = activationStrategy; this.customerEmail = customerEmail; this.daysUntilDue = daysUntilDue; + this.sendInvoice = sendInvoice; this.additionalProperties = additionalProperties; } @@ -56,6 +60,14 @@ public Optional getDaysUntilDue() { return daysUntilDue; } + /** + * @return Whether Stripe emails the invoice when it is finalized. Defaults to true. + */ + @JsonProperty("send_invoice") + public Optional getSendInvoice() { + return sendInvoice; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -70,12 +82,13 @@ public Map getAdditionalProperties() { private boolean equalTo(RetryCustomPlanBillingRequestBody other) { return activationStrategy.equals(other.activationStrategy) && customerEmail.equals(other.customerEmail) - && daysUntilDue.equals(other.daysUntilDue); + && daysUntilDue.equals(other.daysUntilDue) + && sendInvoice.equals(other.sendInvoice); } @java.lang.Override public int hashCode() { - return Objects.hash(this.activationStrategy, this.customerEmail, this.daysUntilDue); + return Objects.hash(this.activationStrategy, this.customerEmail, this.daysUntilDue, this.sendInvoice); } @java.lang.Override @@ -107,12 +120,21 @@ public interface _FinalStage { _FinalStage daysUntilDue(Optional daysUntilDue); _FinalStage daysUntilDue(Long daysUntilDue); + + /** + *

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

+ */ + _FinalStage sendInvoice(Optional sendInvoice); + + _FinalStage sendInvoice(Boolean sendInvoice); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CustomerEmailStage, _FinalStage { private String customerEmail; + private Optional sendInvoice = Optional.empty(); + private Optional daysUntilDue = Optional.empty(); private Optional activationStrategy = Optional.empty(); @@ -127,6 +149,7 @@ public Builder from(RetryCustomPlanBillingRequestBody other) { activationStrategy(other.getActivationStrategy()); customerEmail(other.getCustomerEmail()); daysUntilDue(other.getDaysUntilDue()); + sendInvoice(other.getSendInvoice()); return this; } @@ -137,6 +160,26 @@ public _FinalStage customerEmail(@NotNull String customerEmail) { return this; } + /** + *

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

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

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

+ */ + @java.lang.Override + @JsonSetter(value = "send_invoice", nulls = Nulls.SKIP) + public _FinalStage sendInvoice(Optional sendInvoice) { + this.sendInvoice = sendInvoice; + return this; + } + @java.lang.Override public _FinalStage daysUntilDue(Long daysUntilDue) { this.daysUntilDue = Optional.ofNullable(daysUntilDue); @@ -166,7 +209,7 @@ public _FinalStage activationStrategy(Optional act @java.lang.Override public RetryCustomPlanBillingRequestBody build() { return new RetryCustomPlanBillingRequestBody( - activationStrategy, customerEmail, daysUntilDue, additionalProperties); + activationStrategy, customerEmail, daysUntilDue, sendInvoice, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java index de29fe3..1952b11 100644 --- a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java +++ b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java @@ -40,6 +40,8 @@ public final class ApiKeyCreateResponseData { private final String name; + private final Optional rateLimitPercent; + private final boolean readonly; private final List scopes; @@ -59,6 +61,7 @@ private ApiKeyCreateResponseData( Optional integration, Optional lastUsedAt, String name, + Optional rateLimitPercent, boolean readonly, List scopes, String secret, @@ -72,6 +75,7 @@ private ApiKeyCreateResponseData( this.integration = integration; this.lastUsedAt = lastUsedAt; this.name = name; + this.rateLimitPercent = rateLimitPercent; this.readonly = readonly; this.scopes = scopes; this.secret = secret; @@ -119,6 +123,11 @@ public String getName() { return name; } + @JsonProperty("rate_limit_percent") + public Optional getRateLimitPercent() { + return rateLimitPercent; + } + @JsonProperty("readonly") public boolean getReadonly() { return readonly; @@ -159,6 +168,7 @@ private boolean equalTo(ApiKeyCreateResponseData other) { && integration.equals(other.integration) && lastUsedAt.equals(other.lastUsedAt) && name.equals(other.name) + && rateLimitPercent.equals(other.rateLimitPercent) && readonly == other.readonly && scopes.equals(other.scopes) && secret.equals(other.secret) @@ -176,6 +186,7 @@ public int hashCode() { this.integration, this.lastUsedAt, this.name, + this.rateLimitPercent, this.readonly, this.scopes, this.secret, @@ -244,6 +255,10 @@ public interface _FinalStage { _FinalStage lastUsedAt(OffsetDateTime lastUsedAt); + _FinalStage rateLimitPercent(Optional rateLimitPercent); + + _FinalStage rateLimitPercent(Long rateLimitPercent); + _FinalStage scopes(List scopes); _FinalStage addScopes(ApiKeyScope scopes); @@ -268,6 +283,8 @@ public static final class Builder private List scopes = new ArrayList<>(); + private Optional rateLimitPercent = Optional.empty(); + private Optional lastUsedAt = Optional.empty(); private Optional integration = Optional.empty(); @@ -293,6 +310,7 @@ public Builder from(ApiKeyCreateResponseData other) { integration(other.getIntegration()); lastUsedAt(other.getLastUsedAt()); name(other.getName()); + rateLimitPercent(other.getRateLimitPercent()); readonly(other.getReadonly()); scopes(other.getScopes()); secret(other.getSecret()); @@ -366,6 +384,19 @@ public _FinalStage scopes(List scopes) { return this; } + @java.lang.Override + public _FinalStage rateLimitPercent(Long rateLimitPercent) { + this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) + public _FinalStage rateLimitPercent(Optional rateLimitPercent) { + this.rateLimitPercent = rateLimitPercent; + return this; + } + @java.lang.Override public _FinalStage lastUsedAt(OffsetDateTime lastUsedAt) { this.lastUsedAt = Optional.ofNullable(lastUsedAt); @@ -442,6 +473,7 @@ public ApiKeyCreateResponseData build() { integration, lastUsedAt, name, + rateLimitPercent, readonly, scopes, secret, diff --git a/src/main/java/com/schematic/api/types/ApiKeyResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyResponseData.java index 0f8dbaf..1cee71c 100644 --- a/src/main/java/com/schematic/api/types/ApiKeyResponseData.java +++ b/src/main/java/com/schematic/api/types/ApiKeyResponseData.java @@ -40,6 +40,8 @@ public final class ApiKeyResponseData { private final String name; + private final Optional rateLimitPercent; + private final boolean readonly; private final List scopes; @@ -57,6 +59,7 @@ private ApiKeyResponseData( Optional integration, Optional lastUsedAt, String name, + Optional rateLimitPercent, boolean readonly, List scopes, OffsetDateTime updatedAt, @@ -69,6 +72,7 @@ private ApiKeyResponseData( this.integration = integration; this.lastUsedAt = lastUsedAt; this.name = name; + this.rateLimitPercent = rateLimitPercent; this.readonly = readonly; this.scopes = scopes; this.updatedAt = updatedAt; @@ -115,6 +119,11 @@ public String getName() { return name; } + @JsonProperty("rate_limit_percent") + public Optional getRateLimitPercent() { + return rateLimitPercent; + } + @JsonProperty("readonly") public boolean getReadonly() { return readonly; @@ -150,6 +159,7 @@ private boolean equalTo(ApiKeyResponseData other) { && integration.equals(other.integration) && lastUsedAt.equals(other.lastUsedAt) && name.equals(other.name) + && rateLimitPercent.equals(other.rateLimitPercent) && readonly == other.readonly && scopes.equals(other.scopes) && updatedAt.equals(other.updatedAt); @@ -166,6 +176,7 @@ public int hashCode() { this.integration, this.lastUsedAt, this.name, + this.rateLimitPercent, this.readonly, this.scopes, this.updatedAt); @@ -229,6 +240,10 @@ public interface _FinalStage { _FinalStage lastUsedAt(OffsetDateTime lastUsedAt); + _FinalStage rateLimitPercent(Optional rateLimitPercent); + + _FinalStage rateLimitPercent(Long rateLimitPercent); + _FinalStage scopes(List scopes); _FinalStage addScopes(ApiKeyScope scopes); @@ -251,6 +266,8 @@ public static final class Builder private List scopes = new ArrayList<>(); + private Optional rateLimitPercent = Optional.empty(); + private Optional lastUsedAt = Optional.empty(); private Optional integration = Optional.empty(); @@ -276,6 +293,7 @@ public Builder from(ApiKeyResponseData other) { integration(other.getIntegration()); lastUsedAt(other.getLastUsedAt()); name(other.getName()); + rateLimitPercent(other.getRateLimitPercent()); readonly(other.getReadonly()); scopes(other.getScopes()); updatedAt(other.getUpdatedAt()); @@ -341,6 +359,19 @@ public _FinalStage scopes(List scopes) { return this; } + @java.lang.Override + public _FinalStage rateLimitPercent(Long rateLimitPercent) { + this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) + public _FinalStage rateLimitPercent(Optional rateLimitPercent) { + this.rateLimitPercent = rateLimitPercent; + return this; + } + @java.lang.Override public _FinalStage lastUsedAt(OffsetDateTime lastUsedAt) { this.lastUsedAt = Optional.ofNullable(lastUsedAt); @@ -417,6 +448,7 @@ public ApiKeyResponseData build() { integration, lastUsedAt, name, + rateLimitPercent, readonly, scopes, updatedAt, diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index 3ec4732..06a6970 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -66,6 +66,8 @@ public final class BillingPlanCreditGrantResponseData { private final String id; + private final Optional licenseId; + private final Optional plan; private final String planId; @@ -82,6 +84,8 @@ public final class BillingPlanCreditGrantResponseData { private final long rolloverPercentage; + private final PlanCreditGrantScaling scaling; + private final OffsetDateTime updatedAt; private final Map additionalProperties; @@ -109,6 +113,7 @@ private BillingPlanCreditGrantResponseData( Optional expiryUnit, Optional expiryUnitCount, String id, + Optional licenseId, Optional plan, String planId, String planName, @@ -117,6 +122,7 @@ private BillingPlanCreditGrantResponseData( Optional resetStart, Optional resetType, long rolloverPercentage, + PlanCreditGrantScaling scaling, OffsetDateTime updatedAt, Map additionalProperties) { this.autoTopupAmount = autoTopupAmount; @@ -141,6 +147,7 @@ private BillingPlanCreditGrantResponseData( this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; this.id = id; + this.licenseId = licenseId; this.plan = plan; this.planId = planId; this.planName = planName; @@ -149,6 +156,7 @@ private BillingPlanCreditGrantResponseData( this.resetStart = resetStart; this.resetType = resetType; this.rolloverPercentage = rolloverPercentage; + this.scaling = scaling; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -281,6 +289,14 @@ public String getId() { return id; } + /** + * @return The license whose quantity scales this grant. Set only when scaling is per_license. + */ + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + @JsonProperty("plan") public Optional getPlan() { return plan; @@ -327,6 +343,14 @@ public long getRolloverPercentage() { return rolloverPercentage; } + /** + * @return Whether the grant is a fixed amount per company, or issued once per license the company holds. + */ + @JsonProperty("scaling") + public PlanCreditGrantScaling getScaling() { + return scaling; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -367,6 +391,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && id.equals(other.id) + && licenseId.equals(other.licenseId) && plan.equals(other.plan) && planId.equals(other.planId) && planName.equals(other.planName) @@ -375,6 +400,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) && rolloverPercentage == other.rolloverPercentage + && scaling.equals(other.scaling) && updatedAt.equals(other.updatedAt); } @@ -403,6 +429,7 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.id, + this.licenseId, this.plan, this.planId, this.planName, @@ -411,6 +438,7 @@ public int hashCode() { this.resetStart, this.resetType, this.rolloverPercentage, + this.scaling, this.updatedAt); } @@ -488,7 +516,14 @@ public interface RolloverPercentageStage { /** *

Percentage of unused credits that carry over when this grant resets. Only meaningful when reset_type is plan_period.

*/ - UpdatedAtStage rolloverPercentage(long rolloverPercentage); + ScalingStage rolloverPercentage(long rolloverPercentage); + } + + public interface ScalingStage { + /** + *

Whether the grant is a fixed amount per company, or issued once per license the company holds.

+ */ + UpdatedAtStage scaling(@NotNull PlanCreditGrantScaling scaling); } public interface UpdatedAtStage { @@ -560,6 +595,13 @@ public interface _FinalStage { _FinalStage expiryUnitCount(Long expiryUnitCount); + /** + *

The license whose quantity scales this grant. Set only when scaling is per_license.

+ */ + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + _FinalStage plan(Optional plan); _FinalStage plan(PreviewObjectResponseData plan); @@ -595,6 +637,7 @@ public static final class Builder PlanIdStage, PlanNameStage, RolloverPercentageStage, + ScalingStage, UpdatedAtStage, _FinalStage { private BillingCreditAutoTopupAvailability autoTopupAvailability; @@ -621,6 +664,8 @@ public static final class Builder private long rolloverPercentage; + private PlanCreditGrantScaling scaling; + private OffsetDateTime updatedAt; private Optional resetType = Optional.empty(); @@ -633,6 +678,8 @@ public static final class Builder private Optional plan = Optional.empty(); + private Optional licenseId = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -688,6 +735,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); id(other.getId()); + licenseId(other.getLicenseId()); plan(other.getPlan()); planId(other.getPlanId()); planName(other.getPlanName()); @@ -696,6 +744,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { resetStart(other.getResetStart()); resetType(other.getResetType()); rolloverPercentage(other.getRolloverPercentage()); + scaling(other.getScaling()); updatedAt(other.getUpdatedAt()); return this; } @@ -805,11 +854,22 @@ public RolloverPercentageStage planName(@NotNull String planName) { */ @java.lang.Override @JsonSetter("rollover_percentage") - public UpdatedAtStage rolloverPercentage(long rolloverPercentage) { + public ScalingStage rolloverPercentage(long rolloverPercentage) { this.rolloverPercentage = rolloverPercentage; return this; } + /** + *

Whether the grant is a fixed amount per company, or issued once per license the company holds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scaling") + public UpdatedAtStage scaling(@NotNull PlanCreditGrantScaling scaling) { + this.scaling = Objects.requireNonNull(scaling, "scaling must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -882,6 +942,26 @@ public _FinalStage plan(Optional plan) { return this; } + /** + *

The license whose quantity scales this grant. Set only when scaling is per_license.

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

The license whose quantity scales this grant. Set only when scaling is per_license.

+ */ + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -1090,6 +1170,7 @@ public BillingPlanCreditGrantResponseData build() { expiryUnit, expiryUnitCount, id, + licenseId, plan, planId, planName, @@ -1098,6 +1179,7 @@ public BillingPlanCreditGrantResponseData build() { resetStart, resetType, rolloverPercentage, + scaling, updatedAt, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java index 8492103..dca05b7 100644 --- a/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlement.java @@ -21,22 +21,22 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CatalogConfigOrderedEntitlement.Builder.class) public final class CatalogConfigOrderedEntitlement { - private final String planEntitlementId; + private final String featureId; private final Optional visible; private final Map additionalProperties; private CatalogConfigOrderedEntitlement( - String planEntitlementId, Optional visible, Map additionalProperties) { - this.planEntitlementId = planEntitlementId; + String featureId, Optional visible, Map additionalProperties) { + this.featureId = featureId; this.visible = visible; this.additionalProperties = additionalProperties; } - @JsonProperty("plan_entitlement_id") - public String getPlanEntitlementId() { - return planEntitlementId; + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; } @JsonProperty("visible") @@ -56,12 +56,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(CatalogConfigOrderedEntitlement other) { - return planEntitlementId.equals(other.planEntitlementId) && visible.equals(other.visible); + return featureId.equals(other.featureId) && visible.equals(other.visible); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planEntitlementId, this.visible); + return Objects.hash(this.featureId, this.visible); } @java.lang.Override @@ -69,12 +69,12 @@ public String toString() { return ObjectMappers.stringify(this); } - public static PlanEntitlementIdStage builder() { + public static FeatureIdStage builder() { return new Builder(); } - public interface PlanEntitlementIdStage { - _FinalStage planEntitlementId(@NotNull String planEntitlementId); + public interface FeatureIdStage { + _FinalStage featureId(@NotNull String featureId); Builder from(CatalogConfigOrderedEntitlement other); } @@ -92,8 +92,8 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PlanEntitlementIdStage, _FinalStage { - private String planEntitlementId; + public static final class Builder implements FeatureIdStage, _FinalStage { + private String featureId; private Optional visible = Optional.empty(); @@ -104,15 +104,15 @@ private Builder() {} @java.lang.Override public Builder from(CatalogConfigOrderedEntitlement other) { - planEntitlementId(other.getPlanEntitlementId()); + featureId(other.getFeatureId()); visible(other.getVisible()); return this; } @java.lang.Override - @JsonSetter("plan_entitlement_id") - public _FinalStage planEntitlementId(@NotNull String planEntitlementId) { - this.planEntitlementId = Objects.requireNonNull(planEntitlementId, "planEntitlementId must not be null"); + @JsonSetter("feature_id") + public _FinalStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); return this; } @@ -131,7 +131,7 @@ public _FinalStage visible(Optional visible) { @java.lang.Override public CatalogConfigOrderedEntitlement build() { - return new CatalogConfigOrderedEntitlement(planEntitlementId, visible, additionalProperties); + return new CatalogConfigOrderedEntitlement(featureId, visible, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java index 59f12f5..94256a6 100644 --- a/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/CatalogConfigOrderedEntitlementResponseData.java @@ -19,22 +19,22 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CatalogConfigOrderedEntitlementResponseData.Builder.class) public final class CatalogConfigOrderedEntitlementResponseData { - private final String planEntitlementId; + private final String featureId; private final boolean visible; private final Map additionalProperties; private CatalogConfigOrderedEntitlementResponseData( - String planEntitlementId, boolean visible, Map additionalProperties) { - this.planEntitlementId = planEntitlementId; + String featureId, boolean visible, Map additionalProperties) { + this.featureId = featureId; this.visible = visible; this.additionalProperties = additionalProperties; } - @JsonProperty("plan_entitlement_id") - public String getPlanEntitlementId() { - return planEntitlementId; + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; } @JsonProperty("visible") @@ -55,12 +55,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(CatalogConfigOrderedEntitlementResponseData other) { - return planEntitlementId.equals(other.planEntitlementId) && visible == other.visible; + return featureId.equals(other.featureId) && visible == other.visible; } @java.lang.Override public int hashCode() { - return Objects.hash(this.planEntitlementId, this.visible); + return Objects.hash(this.featureId, this.visible); } @java.lang.Override @@ -68,12 +68,12 @@ public String toString() { return ObjectMappers.stringify(this); } - public static PlanEntitlementIdStage builder() { + public static FeatureIdStage builder() { return new Builder(); } - public interface PlanEntitlementIdStage { - VisibleStage planEntitlementId(@NotNull String planEntitlementId); + public interface FeatureIdStage { + VisibleStage featureId(@NotNull String featureId); Builder from(CatalogConfigOrderedEntitlementResponseData other); } @@ -91,8 +91,8 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PlanEntitlementIdStage, VisibleStage, _FinalStage { - private String planEntitlementId; + public static final class Builder implements FeatureIdStage, VisibleStage, _FinalStage { + private String featureId; private boolean visible; @@ -103,15 +103,15 @@ private Builder() {} @java.lang.Override public Builder from(CatalogConfigOrderedEntitlementResponseData other) { - planEntitlementId(other.getPlanEntitlementId()); + featureId(other.getFeatureId()); visible(other.getVisible()); return this; } @java.lang.Override - @JsonSetter("plan_entitlement_id") - public VisibleStage planEntitlementId(@NotNull String planEntitlementId) { - this.planEntitlementId = Objects.requireNonNull(planEntitlementId, "planEntitlementId must not be null"); + @JsonSetter("feature_id") + public VisibleStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); return this; } @@ -124,7 +124,7 @@ public _FinalStage visible(boolean visible) { @java.lang.Override public CatalogConfigOrderedEntitlementResponseData build() { - return new CatalogConfigOrderedEntitlementResponseData(planEntitlementId, visible, additionalProperties); + return new CatalogConfigOrderedEntitlementResponseData(featureId, visible, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CatalogResponseData.java b/src/main/java/com/schematic/api/types/CatalogResponseData.java index c4bde29..ada5b40 100644 --- a/src/main/java/com/schematic/api/types/CatalogResponseData.java +++ b/src/main/java/com/schematic/api/types/CatalogResponseData.java @@ -36,8 +36,6 @@ public final class CatalogResponseData { private final Optional description; - private final String environmentId; - private final String id; private final boolean isDefault; @@ -60,7 +58,6 @@ private CatalogResponseData( Optional customPlanPriceText, boolean customPlansVisible, Optional description, - String environmentId, String id, boolean isDefault, String name, @@ -75,7 +72,6 @@ private CatalogResponseData( this.customPlanPriceText = customPlanPriceText; this.customPlansVisible = customPlansVisible; this.description = description; - this.environmentId = environmentId; this.id = id; this.isDefault = isDefault; this.name = name; @@ -120,11 +116,6 @@ public Optional getDescription() { return description; } - @JsonProperty("environment_id") - public String getEnvironmentId() { - return environmentId; - } - @JsonProperty("id") public String getId() { return id; @@ -174,7 +165,6 @@ private boolean equalTo(CatalogResponseData other) { && customPlanPriceText.equals(other.customPlanPriceText) && customPlansVisible == other.customPlansVisible && description.equals(other.description) - && environmentId.equals(other.environmentId) && id.equals(other.id) && isDefault == other.isDefault && name.equals(other.name) @@ -193,7 +183,6 @@ public int hashCode() { this.customPlanPriceText, this.customPlansVisible, this.description, - this.environmentId, this.id, this.isDefault, this.name, @@ -222,11 +211,7 @@ public interface CreatedAtStage { } public interface CustomPlansVisibleStage { - EnvironmentIdStage customPlansVisible(boolean customPlansVisible); - } - - public interface EnvironmentIdStage { - IdStage environmentId(@NotNull String environmentId); + IdStage customPlansVisible(boolean customPlansVisible); } public interface IdStage { @@ -282,7 +267,6 @@ public static final class Builder implements AccountIdStage, CreatedAtStage, CustomPlansVisibleStage, - EnvironmentIdStage, IdStage, IsDefaultStage, NameStage, @@ -294,8 +278,6 @@ public static final class Builder private boolean customPlansVisible; - private String environmentId; - private String id; private boolean isDefault; @@ -330,7 +312,6 @@ public Builder from(CatalogResponseData other) { customPlanPriceText(other.getCustomPlanPriceText()); customPlansVisible(other.getCustomPlansVisible()); description(other.getDescription()); - environmentId(other.getEnvironmentId()); id(other.getId()); isDefault(other.getIsDefault()); name(other.getName()); @@ -356,18 +337,11 @@ public CustomPlansVisibleStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("custom_plans_visible") - public EnvironmentIdStage customPlansVisible(boolean customPlansVisible) { + public IdStage customPlansVisible(boolean customPlansVisible) { this.customPlansVisible = customPlansVisible; return this; } - @java.lang.Override - @JsonSetter("environment_id") - public IdStage environmentId(@NotNull String environmentId) { - this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); - return this; - } - @java.lang.Override @JsonSetter("id") public IsDefaultStage id(@NotNull String id) { @@ -484,7 +458,6 @@ public CatalogResponseData build() { customPlanPriceText, customPlansVisible, description, - environmentId, id, isDefault, name, diff --git a/src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java b/src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java index 33d1aae..f435be2 100644 --- a/src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyBillingDetailsResponseData.java @@ -33,6 +33,8 @@ public final class CompanyBillingDetailsResponseData { private final Optional phone; + private final List taxIds; + private final Map additionalProperties; private CompanyBillingDetailsResponseData( @@ -41,12 +43,14 @@ private CompanyBillingDetailsResponseData( List customFields, Optional email, Optional phone, + List taxIds, Map additionalProperties) { this.address = address; this.checkoutSettings = checkoutSettings; this.customFields = customFields; this.email = email; this.phone = phone; + this.taxIds = taxIds; this.additionalProperties = additionalProperties; } @@ -75,6 +79,11 @@ public Optional getPhone() { return phone; } + @JsonProperty("tax_ids") + public List getTaxIds() { + return taxIds; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -91,12 +100,14 @@ private boolean equalTo(CompanyBillingDetailsResponseData other) { && checkoutSettings.equals(other.checkoutSettings) && customFields.equals(other.customFields) && email.equals(other.email) - && phone.equals(other.phone); + && phone.equals(other.phone) + && taxIds.equals(other.taxIds); } @java.lang.Override public int hashCode() { - return Objects.hash(this.address, this.checkoutSettings, this.customFields, this.email, this.phone); + return Objects.hash( + this.address, this.checkoutSettings, this.customFields, this.email, this.phone, this.taxIds); } @java.lang.Override @@ -138,12 +149,20 @@ public interface _FinalStage { _FinalStage phone(Optional phone); _FinalStage phone(String phone); + + _FinalStage taxIds(List taxIds); + + _FinalStage addTaxIds(CompanyTaxIdView taxIds); + + _FinalStage addAllTaxIds(List taxIds); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CheckoutSettingsStage, _FinalStage { private CompanyBillingCheckoutSettings checkoutSettings; + private List taxIds = new ArrayList<>(); + private Optional phone = Optional.empty(); private Optional email = Optional.empty(); @@ -164,6 +183,7 @@ public Builder from(CompanyBillingDetailsResponseData other) { customFields(other.getCustomFields()); email(other.getEmail()); phone(other.getPhone()); + taxIds(other.getTaxIds()); return this; } @@ -174,6 +194,30 @@ public _FinalStage checkoutSettings(@NotNull CompanyBillingCheckoutSettings chec return this; } + @java.lang.Override + public _FinalStage addAllTaxIds(List taxIds) { + if (taxIds != null) { + this.taxIds.addAll(taxIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addTaxIds(CompanyTaxIdView taxIds) { + this.taxIds.add(taxIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tax_ids", nulls = Nulls.SKIP) + public _FinalStage taxIds(List taxIds) { + this.taxIds.clear(); + if (taxIds != null) { + this.taxIds.addAll(taxIds); + } + return this; + } + @java.lang.Override public _FinalStage phone(String phone) { this.phone = Optional.ofNullable(phone); @@ -240,7 +284,7 @@ public _FinalStage address(Optional address) { @java.lang.Override public CompanyBillingDetailsResponseData build() { return new CompanyBillingDetailsResponseData( - address, checkoutSettings, customFields, email, phone, additionalProperties); + address, checkoutSettings, customFields, email, phone, taxIds, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java b/src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java index be7e803..1b956c0 100644 --- a/src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java +++ b/src/main/java/com/schematic/api/types/CompanyBillingDetailsView.java @@ -33,6 +33,8 @@ public final class CompanyBillingDetailsView { private final Optional phone; + private final List taxIds; + private final Map additionalProperties; private CompanyBillingDetailsView( @@ -41,12 +43,14 @@ private CompanyBillingDetailsView( List customFields, Optional email, Optional phone, + List taxIds, Map additionalProperties) { this.address = address; this.checkoutSettings = checkoutSettings; this.customFields = customFields; this.email = email; this.phone = phone; + this.taxIds = taxIds; this.additionalProperties = additionalProperties; } @@ -75,6 +79,11 @@ public Optional getPhone() { return phone; } + @JsonProperty("tax_ids") + public List getTaxIds() { + return taxIds; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -91,12 +100,14 @@ private boolean equalTo(CompanyBillingDetailsView other) { && checkoutSettings.equals(other.checkoutSettings) && customFields.equals(other.customFields) && email.equals(other.email) - && phone.equals(other.phone); + && phone.equals(other.phone) + && taxIds.equals(other.taxIds); } @java.lang.Override public int hashCode() { - return Objects.hash(this.address, this.checkoutSettings, this.customFields, this.email, this.phone); + return Objects.hash( + this.address, this.checkoutSettings, this.customFields, this.email, this.phone, this.taxIds); } @java.lang.Override @@ -138,12 +149,20 @@ public interface _FinalStage { _FinalStage phone(Optional phone); _FinalStage phone(String phone); + + _FinalStage taxIds(List taxIds); + + _FinalStage addTaxIds(CompanyTaxIdView taxIds); + + _FinalStage addAllTaxIds(List taxIds); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CheckoutSettingsStage, _FinalStage { private CompanyBillingCheckoutSettings checkoutSettings; + private List taxIds = new ArrayList<>(); + private Optional phone = Optional.empty(); private Optional email = Optional.empty(); @@ -164,6 +183,7 @@ public Builder from(CompanyBillingDetailsView other) { customFields(other.getCustomFields()); email(other.getEmail()); phone(other.getPhone()); + taxIds(other.getTaxIds()); return this; } @@ -174,6 +194,30 @@ public _FinalStage checkoutSettings(@NotNull CompanyBillingCheckoutSettings chec return this; } + @java.lang.Override + public _FinalStage addAllTaxIds(List taxIds) { + if (taxIds != null) { + this.taxIds.addAll(taxIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addTaxIds(CompanyTaxIdView taxIds) { + this.taxIds.add(taxIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tax_ids", nulls = Nulls.SKIP) + public _FinalStage taxIds(List taxIds) { + this.taxIds.clear(); + if (taxIds != null) { + this.taxIds.addAll(taxIds); + } + return this; + } + @java.lang.Override public _FinalStage phone(String phone) { this.phone = Optional.ofNullable(phone); @@ -240,7 +284,7 @@ public _FinalStage address(Optional address) { @java.lang.Override public CompanyBillingDetailsView build() { return new CompanyBillingDetailsView( - address, checkoutSettings, customFields, email, phone, additionalProperties); + address, checkoutSettings, customFields, email, phone, taxIds, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java b/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java index abed367..6275eda 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java @@ -72,6 +72,8 @@ public final class CompanyPlanCreditGrantView { private final String id; + private final Optional licenseId; + private final Optional plan; private final String planId; @@ -88,6 +90,8 @@ public final class CompanyPlanCreditGrantView { private final long rolloverPercentage; + private final PlanCreditGrantScaling scaling; + private final Optional singularName; private final OffsetDateTime updatedAt; @@ -120,6 +124,7 @@ private CompanyPlanCreditGrantView( Optional expiryUnit, Optional expiryUnitCount, String id, + Optional licenseId, Optional plan, String planId, Optional planVersionId, @@ -128,6 +133,7 @@ private CompanyPlanCreditGrantView( Optional resetStart, BillingPlanCreditGrantResetType resetType, long rolloverPercentage, + PlanCreditGrantScaling scaling, Optional singularName, OffsetDateTime updatedAt, Map additionalProperties) { @@ -156,6 +162,7 @@ private CompanyPlanCreditGrantView( this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; this.id = id; + this.licenseId = licenseId; this.plan = plan; this.planId = planId; this.planVersionId = planVersionId; @@ -164,6 +171,7 @@ private CompanyPlanCreditGrantView( this.resetStart = resetStart; this.resetType = resetType; this.rolloverPercentage = rolloverPercentage; + this.scaling = scaling; this.singularName = singularName; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -303,6 +311,11 @@ public String getId() { return id; } + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + @JsonProperty("plan") public Optional getPlan() { return plan; @@ -346,6 +359,11 @@ public long getRolloverPercentage() { return rolloverPercentage; } + @JsonProperty("scaling") + public PlanCreditGrantScaling getScaling() { + return scaling; + } + /** * @return Deprecated field, will be removed in the future. Use Credit.SingularName instead. */ @@ -396,6 +414,7 @@ private boolean equalTo(CompanyPlanCreditGrantView other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && id.equals(other.id) + && licenseId.equals(other.licenseId) && plan.equals(other.plan) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) @@ -404,6 +423,7 @@ private boolean equalTo(CompanyPlanCreditGrantView other) { && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) && rolloverPercentage == other.rolloverPercentage + && scaling.equals(other.scaling) && singularName.equals(other.singularName) && updatedAt.equals(other.updatedAt); } @@ -436,6 +456,7 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.id, + this.licenseId, this.plan, this.planId, this.planVersionId, @@ -444,6 +465,7 @@ public int hashCode() { this.resetStart, this.resetType, this.rolloverPercentage, + this.scaling, this.singularName, this.updatedAt); } @@ -510,7 +532,11 @@ public interface ResetTypeStage { } public interface RolloverPercentageStage { - UpdatedAtStage rolloverPercentage(long rolloverPercentage); + ScalingStage rolloverPercentage(long rolloverPercentage); + } + + public interface ScalingStage { + UpdatedAtStage scaling(@NotNull PlanCreditGrantScaling scaling); } public interface UpdatedAtStage { @@ -595,6 +621,10 @@ _FinalStage billingCreditAutoTopupExpiryUnit( _FinalStage expiryUnitCount(Long expiryUnitCount); + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + _FinalStage plan(Optional plan); _FinalStage plan(GenericPreviewObject plan); @@ -640,6 +670,7 @@ public static final class Builder PlanIdStage, ResetTypeStage, RolloverPercentageStage, + ScalingStage, UpdatedAtStage, _FinalStage { private boolean billingCreditAutoTopupEnabled; @@ -666,6 +697,8 @@ public static final class Builder private long rolloverPercentage; + private PlanCreditGrantScaling scaling; + private OffsetDateTime updatedAt; private Optional singularName = Optional.empty(); @@ -680,6 +713,8 @@ public static final class Builder private Optional plan = Optional.empty(); + private Optional licenseId = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -744,6 +779,7 @@ public Builder from(CompanyPlanCreditGrantView other) { expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); id(other.getId()); + licenseId(other.getLicenseId()); plan(other.getPlan()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); @@ -752,6 +788,7 @@ public Builder from(CompanyPlanCreditGrantView other) { resetStart(other.getResetStart()); resetType(other.getResetType()); rolloverPercentage(other.getRolloverPercentage()); + scaling(other.getScaling()); singularName(other.getSingularName()); updatedAt(other.getUpdatedAt()); return this; @@ -846,11 +883,18 @@ public RolloverPercentageStage resetType(@NotNull BillingPlanCreditGrantResetTyp @java.lang.Override @JsonSetter("rollover_percentage") - public UpdatedAtStage rolloverPercentage(long rolloverPercentage) { + public ScalingStage rolloverPercentage(long rolloverPercentage) { this.rolloverPercentage = rolloverPercentage; return this; } + @java.lang.Override + @JsonSetter("scaling") + public UpdatedAtStage scaling(@NotNull PlanCreditGrantScaling scaling) { + this.scaling = Objects.requireNonNull(scaling, "scaling must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -950,6 +994,19 @@ public _FinalStage plan(Optional plan) { return this; } + @java.lang.Override + public _FinalStage licenseId(String licenseId) { + this.licenseId = Optional.ofNullable(licenseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -1199,6 +1256,7 @@ public CompanyPlanCreditGrantView build() { expiryUnit, expiryUnitCount, id, + licenseId, plan, planId, planVersionId, @@ -1207,6 +1265,7 @@ public CompanyPlanCreditGrantView build() { resetStart, resetType, rolloverPercentage, + scaling, singularName, updatedAt, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java index 0b73ba9..9148034 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java @@ -88,7 +88,7 @@ public final class CompanyPlanDetailResponseData { private final boolean isDefault; - private final boolean isFree; + private final Optional isFree; private final boolean isTrialable; @@ -149,7 +149,7 @@ private CompanyPlanDetailResponseData( Optional invalidReason, boolean isCustom, boolean isDefault, - boolean isFree, + Optional isFree, boolean isTrialable, Optional monthlyPrice, String name, @@ -372,10 +372,10 @@ public boolean getIsDefault() { } /** - * @return Deprecated: Use BillingStrategy instead + * @return Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed. */ @JsonProperty("is_free") - public boolean getIsFree() { + public Optional getIsFree() { return isFree; } @@ -483,7 +483,7 @@ private boolean equalTo(CompanyPlanDetailResponseData other) { && invalidReason.equals(other.invalidReason) && isCustom == other.isCustom && isDefault == other.isDefault - && isFree == other.isFree + && isFree.equals(other.isFree) && isTrialable == other.isTrialable && monthlyPrice.equals(other.monthlyPrice) && name.equals(other.name) @@ -608,14 +608,7 @@ public interface IsCustomStage { } public interface IsDefaultStage { - IsFreeStage isDefault(boolean isDefault); - } - - public interface IsFreeStage { - /** - *

Deprecated: Use BillingStrategy instead

- */ - IsTrialableStage isFree(boolean isFree); + IsTrialableStage isDefault(boolean isDefault); } public interface IsTrialableStage { @@ -733,6 +726,13 @@ public interface _FinalStage { _FinalStage invalidReason(CompanyPlanInvalidReason invalidReason); + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + _FinalStage isFree(Optional isFree); + + _FinalStage isFree(Boolean isFree); + _FinalStage monthlyPrice(Optional monthlyPrice); _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); @@ -781,7 +781,6 @@ public static final class Builder IdStage, IsCustomStage, IsDefaultStage, - IsFreeStage, IsTrialableStage, NameStage, PlanTypeStage, @@ -814,8 +813,6 @@ public static final class Builder private boolean isDefault; - private boolean isFree; - private boolean isTrialable; private String name; @@ -840,6 +837,8 @@ public static final class Builder private Optional monthlyPrice = Optional.empty(); + private Optional isFree = Optional.empty(); + private Optional invalidReason = Optional.empty(); private List includedCreditGrants = new ArrayList<>(); @@ -1019,22 +1018,11 @@ public IsDefaultStage isCustom(boolean isCustom) { @java.lang.Override @JsonSetter("is_default") - public IsFreeStage isDefault(boolean isDefault) { + public IsTrialableStage isDefault(boolean isDefault) { this.isDefault = isDefault; return this; } - /** - *

Deprecated: Use BillingStrategy instead

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("is_free") - public IsTrialableStage isFree(boolean isFree) { - this.isFree = isFree; - return this; - } - @java.lang.Override @JsonSetter("is_trialable") public NameStage isTrialable(boolean isTrialable) { @@ -1183,6 +1171,26 @@ public _FinalStage monthlyPrice(Optional monthlyPrice) return this; } + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

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

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + @java.lang.Override + @JsonSetter(value = "is_free", nulls = Nulls.SKIP) + public _FinalStage isFree(Optional isFree) { + this.isFree = isFree; + return this; + } + @java.lang.Override public _FinalStage invalidReason(CompanyPlanInvalidReason invalidReason) { this.invalidReason = Optional.ofNullable(invalidReason); diff --git a/src/main/java/com/schematic/api/types/CompanyTaxIdView.java b/src/main/java/com/schematic/api/types/CompanyTaxIdView.java new file mode 100644 index 0000000..6440920 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyTaxIdView.java @@ -0,0 +1,224 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyTaxIdView.Builder.class) +public final class CompanyTaxIdView { + private final String country; + + private final String id; + + private final String type; + + private final String value; + + private final Optional verificationStatus; + + private final Map additionalProperties; + + private CompanyTaxIdView( + String country, + String id, + String type, + String value, + Optional verificationStatus, + Map additionalProperties) { + this.country = country; + this.id = id; + this.type = type; + this.value = value; + this.verificationStatus = verificationStatus; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("country") + public String getCountry() { + return country; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @JsonProperty("verification_status") + public Optional getVerificationStatus() { + return verificationStatus; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyTaxIdView && equalTo((CompanyTaxIdView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyTaxIdView other) { + return country.equals(other.country) + && id.equals(other.id) + && type.equals(other.type) + && value.equals(other.value) + && verificationStatus.equals(other.verificationStatus); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.country, this.id, this.type, this.value, this.verificationStatus); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CountryStage builder() { + return new Builder(); + } + + public interface CountryStage { + IdStage country(@NotNull String country); + + Builder from(CompanyTaxIdView other); + } + + public interface IdStage { + TypeStage id(@NotNull String id); + } + + public interface TypeStage { + ValueStage type(@NotNull String type); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + CompanyTaxIdView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage verificationStatus(Optional verificationStatus); + + _FinalStage verificationStatus(String verificationStatus); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CountryStage, IdStage, TypeStage, ValueStage, _FinalStage { + private String country; + + private String id; + + private String type; + + private String value; + + private Optional verificationStatus = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyTaxIdView other) { + country(other.getCountry()); + id(other.getId()); + type(other.getType()); + value(other.getValue()); + verificationStatus(other.getVerificationStatus()); + return this; + } + + @java.lang.Override + @JsonSetter("country") + public IdStage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public TypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public ValueStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage verificationStatus(String verificationStatus) { + this.verificationStatus = Optional.ofNullable(verificationStatus); + return this; + } + + @java.lang.Override + @JsonSetter(value = "verification_status", nulls = Nulls.SKIP) + public _FinalStage verificationStatus(Optional verificationStatus) { + this.verificationStatus = verificationStatus; + return this; + } + + @java.lang.Override + public CompanyTaxIdView build() { + return new CompanyTaxIdView(country, id, type, value, verificationStatus, 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/ComponentCheckoutSettings.java b/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java index adf1b65..8ca0c55 100644 --- a/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java +++ b/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ComponentCheckoutSettings.Builder.class) @@ -24,6 +25,8 @@ public final class ComponentCheckoutSettings { private final boolean collectPhone; + private final ProrationBehavior prorationBehavior; + private final boolean taxCollectionEnabled; private final Map additionalProperties; @@ -32,11 +35,13 @@ private ComponentCheckoutSettings( boolean collectAddress, boolean collectEmail, boolean collectPhone, + ProrationBehavior prorationBehavior, boolean taxCollectionEnabled, Map additionalProperties) { this.collectAddress = collectAddress; this.collectEmail = collectEmail; this.collectPhone = collectPhone; + this.prorationBehavior = prorationBehavior; this.taxCollectionEnabled = taxCollectionEnabled; this.additionalProperties = additionalProperties; } @@ -56,6 +61,11 @@ public boolean getCollectPhone() { return collectPhone; } + @JsonProperty("proration_behavior") + public ProrationBehavior getProrationBehavior() { + return prorationBehavior; + } + @JsonProperty("tax_collection_enabled") public boolean getTaxCollectionEnabled() { return taxCollectionEnabled; @@ -76,12 +86,18 @@ private boolean equalTo(ComponentCheckoutSettings other) { return collectAddress == other.collectAddress && collectEmail == other.collectEmail && collectPhone == other.collectPhone + && prorationBehavior.equals(other.prorationBehavior) && taxCollectionEnabled == other.taxCollectionEnabled; } @java.lang.Override public int hashCode() { - return Objects.hash(this.collectAddress, this.collectEmail, this.collectPhone, this.taxCollectionEnabled); + return Objects.hash( + this.collectAddress, + this.collectEmail, + this.collectPhone, + this.prorationBehavior, + this.taxCollectionEnabled); } @java.lang.Override @@ -104,7 +120,11 @@ public interface CollectEmailStage { } public interface CollectPhoneStage { - TaxCollectionEnabledStage collectPhone(boolean collectPhone); + ProrationBehaviorStage collectPhone(boolean collectPhone); + } + + public interface ProrationBehaviorStage { + TaxCollectionEnabledStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior); } public interface TaxCollectionEnabledStage { @@ -124,6 +144,7 @@ public static final class Builder implements CollectAddressStage, CollectEmailStage, CollectPhoneStage, + ProrationBehaviorStage, TaxCollectionEnabledStage, _FinalStage { private boolean collectAddress; @@ -132,6 +153,8 @@ public static final class Builder private boolean collectPhone; + private ProrationBehavior prorationBehavior; + private boolean taxCollectionEnabled; @JsonAnySetter @@ -144,6 +167,7 @@ public Builder from(ComponentCheckoutSettings other) { collectAddress(other.getCollectAddress()); collectEmail(other.getCollectEmail()); collectPhone(other.getCollectPhone()); + prorationBehavior(other.getProrationBehavior()); taxCollectionEnabled(other.getTaxCollectionEnabled()); return this; } @@ -164,11 +188,18 @@ public CollectPhoneStage collectEmail(boolean collectEmail) { @java.lang.Override @JsonSetter("collect_phone") - public TaxCollectionEnabledStage collectPhone(boolean collectPhone) { + public ProrationBehaviorStage collectPhone(boolean collectPhone) { this.collectPhone = collectPhone; return this; } + @java.lang.Override + @JsonSetter("proration_behavior") + public TaxCollectionEnabledStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior) { + this.prorationBehavior = Objects.requireNonNull(prorationBehavior, "prorationBehavior must not be null"); + return this; + } + @java.lang.Override @JsonSetter("tax_collection_enabled") public _FinalStage taxCollectionEnabled(boolean taxCollectionEnabled) { @@ -179,7 +210,12 @@ public _FinalStage taxCollectionEnabled(boolean taxCollectionEnabled) { @java.lang.Override public ComponentCheckoutSettings build() { return new ComponentCheckoutSettings( - collectAddress, collectEmail, collectPhone, taxCollectionEnabled, additionalProperties); + collectAddress, + collectEmail, + collectPhone, + prorationBehavior, + taxCollectionEnabled, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index b191b0e..3e3558b 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -55,6 +55,8 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional expiryUnitCount; + private final Optional licenseId; + private final String planId; private final Optional planVersionId; @@ -67,6 +69,8 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional rolloverPercentage; + private final Optional scaling; + private final Map additionalProperties; private CreateBillingPlanCreditGrantRequestBody( @@ -87,12 +91,14 @@ private CreateBillingPlanCreditGrantRequestBody( Optional expiryType, Optional expiryUnit, Optional expiryUnitCount, + Optional licenseId, String planId, Optional planVersionId, BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, Optional rolloverPercentage, + Optional scaling, Map additionalProperties) { this.applyToExisting = applyToExisting; this.autoTopupAmount = autoTopupAmount; @@ -111,12 +117,14 @@ private CreateBillingPlanCreditGrantRequestBody( this.expiryType = expiryType; this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; + this.licenseId = licenseId; this.planId = planId; this.planVersionId = planVersionId; this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; this.rolloverPercentage = rolloverPercentage; + this.scaling = scaling; this.additionalProperties = additionalProperties; } @@ -205,6 +213,14 @@ public Optional getExpiryUnitCount() { return expiryUnitCount; } + /** + * @return The license whose quantity scales this grant. Required when scaling is per_license. + */ + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + @JsonProperty("plan_id") public String getPlanId() { return planId; @@ -238,6 +254,14 @@ public Optional getRolloverPercentage() { return rolloverPercentage; } + /** + * @return Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed. + */ + @JsonProperty("scaling") + public Optional getScaling() { + return scaling; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -268,12 +292,14 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) + && licenseId.equals(other.licenseId) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) - && rolloverPercentage.equals(other.rolloverPercentage); + && rolloverPercentage.equals(other.rolloverPercentage) + && scaling.equals(other.scaling); } @java.lang.Override @@ -296,12 +322,14 @@ public int hashCode() { this.expiryType, this.expiryUnit, this.expiryUnitCount, + this.licenseId, this.planId, this.planVersionId, this.resetCadence, this.resetStart, this.resetType, - this.rolloverPercentage); + this.rolloverPercentage, + this.scaling); } @java.lang.Override @@ -402,6 +430,13 @@ public interface _FinalStage { _FinalStage expiryUnitCount(Long expiryUnitCount); + /** + *

The license whose quantity scales this grant. Required when scaling is per_license.

+ */ + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + _FinalStage planVersionId(Optional planVersionId); _FinalStage planVersionId(String planVersionId); @@ -416,6 +451,13 @@ public interface _FinalStage { _FinalStage rolloverPercentage(Optional rolloverPercentage); _FinalStage rolloverPercentage(Long rolloverPercentage); + + /** + *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed.

+ */ + _FinalStage scaling(Optional scaling); + + _FinalStage scaling(PlanCreditGrantScaling scaling); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -431,12 +473,16 @@ public static final class Builder private BillingPlanCreditGrantResetStart resetStart; + private Optional scaling = Optional.empty(); + private Optional rolloverPercentage = Optional.empty(); private Optional resetType = Optional.empty(); private Optional planVersionId = Optional.empty(); + private Optional licenseId = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -491,12 +537,14 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); + licenseId(other.getLicenseId()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); rolloverPercentage(other.getRolloverPercentage()); + scaling(other.getScaling()); return this; } @@ -535,6 +583,26 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta return this; } + /** + *

Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed.

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

Whether the grant is a fixed amount per company, or issued once per license the company holds. Defaults to fixed.

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

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0.

* @return Reference to {@code this} so that method calls can be chained together. @@ -581,6 +649,26 @@ public _FinalStage planVersionId(Optional planVersionId) { return this; } + /** + *

The license whose quantity scales this grant. Required when scaling is per_license.

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

The license whose quantity scales this grant. Required when scaling is per_license.

+ */ + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -796,12 +884,14 @@ public CreateBillingPlanCreditGrantRequestBody build() { expiryType, expiryUnit, expiryUnitCount, + licenseId, planId, planVersionId, resetCadence, resetStart, resetType, rolloverPercentage, + scaling, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java index cc1e5e9..3ec4d9b 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java @@ -40,6 +40,8 @@ public final class CustomPlanBillingResponseData { private final Optional publishedAt; + private final boolean sendInvoice; + private final CustomPlanBillingStatus status; private final Optional stripeInvoiceUrl; @@ -58,6 +60,7 @@ private CustomPlanBillingResponseData( Optional paidAt, String planId, Optional publishedAt, + boolean sendInvoice, CustomPlanBillingStatus status, Optional stripeInvoiceUrl, OffsetDateTime updatedAt, @@ -71,6 +74,7 @@ private CustomPlanBillingResponseData( this.paidAt = paidAt; this.planId = planId; this.publishedAt = publishedAt; + this.sendInvoice = sendInvoice; this.status = status; this.stripeInvoiceUrl = stripeInvoiceUrl; this.updatedAt = updatedAt; @@ -122,6 +126,11 @@ public Optional getPublishedAt() { return publishedAt; } + @JsonProperty("send_invoice") + public boolean getSendInvoice() { + return sendInvoice; + } + @JsonProperty("status") public CustomPlanBillingStatus getStatus() { return status; @@ -158,6 +167,7 @@ private boolean equalTo(CustomPlanBillingResponseData other) { && paidAt.equals(other.paidAt) && planId.equals(other.planId) && publishedAt.equals(other.publishedAt) + && sendInvoice == other.sendInvoice && status.equals(other.status) && stripeInvoiceUrl.equals(other.stripeInvoiceUrl) && updatedAt.equals(other.updatedAt); @@ -175,6 +185,7 @@ public int hashCode() { this.paidAt, this.planId, this.publishedAt, + this.sendInvoice, this.status, this.stripeInvoiceUrl, this.updatedAt); @@ -212,7 +223,11 @@ public interface IdStage { } public interface PlanIdStage { - StatusStage planId(@NotNull String planId); + SendInvoiceStage planId(@NotNull String planId); + } + + public interface SendInvoiceStage { + StatusStage sendInvoice(boolean sendInvoice); } public interface StatusStage { @@ -255,6 +270,7 @@ public static final class Builder DaysUntilDueStage, IdStage, PlanIdStage, + SendInvoiceStage, StatusStage, UpdatedAtStage, _FinalStage { @@ -270,6 +286,8 @@ public static final class Builder private String planId; + private boolean sendInvoice; + private CustomPlanBillingStatus status; private OffsetDateTime updatedAt; @@ -298,6 +316,7 @@ public Builder from(CustomPlanBillingResponseData other) { paidAt(other.getPaidAt()); planId(other.getPlanId()); publishedAt(other.getPublishedAt()); + sendInvoice(other.getSendInvoice()); status(other.getStatus()); stripeInvoiceUrl(other.getStripeInvoiceUrl()); updatedAt(other.getUpdatedAt()); @@ -341,11 +360,18 @@ public PlanIdStage id(@NotNull String id) { @java.lang.Override @JsonSetter("plan_id") - public StatusStage planId(@NotNull String planId) { + public SendInvoiceStage planId(@NotNull String planId) { this.planId = Objects.requireNonNull(planId, "planId must not be null"); return this; } + @java.lang.Override + @JsonSetter("send_invoice") + public StatusStage sendInvoice(boolean sendInvoice) { + this.sendInvoice = sendInvoice; + return this; + } + @java.lang.Override @JsonSetter("status") public UpdatedAtStage status(@NotNull CustomPlanBillingStatus status) { @@ -424,6 +450,7 @@ public CustomPlanBillingResponseData build() { paidAt, planId, publishedAt, + sendInvoice, status, stripeInvoiceUrl, updatedAt, diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantScaling.java b/src/main/java/com/schematic/api/types/PlanCreditGrantScaling.java new file mode 100644 index 0000000..e2932e9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantScaling.java @@ -0,0 +1,85 @@ +/** + * 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 PlanCreditGrantScaling { + public static final PlanCreditGrantScaling FIXED = new PlanCreditGrantScaling(Value.FIXED, "fixed"); + + public static final PlanCreditGrantScaling PER_LICENSE = + new PlanCreditGrantScaling(Value.PER_LICENSE, "per_license"); + + private final Value value; + + private final String string; + + PlanCreditGrantScaling(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 PlanCreditGrantScaling + && this.string.equals(((PlanCreditGrantScaling) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIXED: + return visitor.visitFixed(); + case PER_LICENSE: + return visitor.visitPerLicense(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanCreditGrantScaling valueOf(String value) { + switch (value) { + case "fixed": + return FIXED; + case "per_license": + return PER_LICENSE; + default: + return new PlanCreditGrantScaling(Value.UNKNOWN, value); + } + } + + public enum Value { + FIXED, + + PER_LICENSE, + + UNKNOWN + } + + public interface Visitor { + T visitFixed(); + + T visitPerLicense(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java index 6228edd..785952d 100644 --- a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java @@ -66,6 +66,8 @@ public final class PlanCreditGrantView { private final String id; + private final Optional licenseId; + private final Optional plan; private final String planId; @@ -82,6 +84,8 @@ public final class PlanCreditGrantView { private final long rolloverPercentage; + private final PlanCreditGrantScaling scaling; + private final Optional singularName; private final OffsetDateTime updatedAt; @@ -111,6 +115,7 @@ private PlanCreditGrantView( Optional expiryUnit, Optional expiryUnitCount, String id, + Optional licenseId, Optional plan, String planId, Optional planVersionId, @@ -119,6 +124,7 @@ private PlanCreditGrantView( Optional resetStart, BillingPlanCreditGrantResetType resetType, long rolloverPercentage, + PlanCreditGrantScaling scaling, Optional singularName, OffsetDateTime updatedAt, Map additionalProperties) { @@ -144,6 +150,7 @@ private PlanCreditGrantView( this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; this.id = id; + this.licenseId = licenseId; this.plan = plan; this.planId = planId; this.planVersionId = planVersionId; @@ -152,6 +159,7 @@ private PlanCreditGrantView( this.resetStart = resetStart; this.resetType = resetType; this.rolloverPercentage = rolloverPercentage; + this.scaling = scaling; this.singularName = singularName; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -276,6 +284,11 @@ public String getId() { return id; } + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + @JsonProperty("plan") public Optional getPlan() { return plan; @@ -319,6 +332,11 @@ public long getRolloverPercentage() { return rolloverPercentage; } + @JsonProperty("scaling") + public PlanCreditGrantScaling getScaling() { + return scaling; + } + /** * @return Deprecated field, will be removed in the future. Use Credit.SingularName instead. */ @@ -366,6 +384,7 @@ private boolean equalTo(PlanCreditGrantView other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && id.equals(other.id) + && licenseId.equals(other.licenseId) && plan.equals(other.plan) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) @@ -374,6 +393,7 @@ private boolean equalTo(PlanCreditGrantView other) { && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) && rolloverPercentage == other.rolloverPercentage + && scaling.equals(other.scaling) && singularName.equals(other.singularName) && updatedAt.equals(other.updatedAt); } @@ -403,6 +423,7 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.id, + this.licenseId, this.plan, this.planId, this.planVersionId, @@ -411,6 +432,7 @@ public int hashCode() { this.resetStart, this.resetType, this.rolloverPercentage, + this.scaling, this.singularName, this.updatedAt); } @@ -477,7 +499,11 @@ public interface ResetTypeStage { } public interface RolloverPercentageStage { - UpdatedAtStage rolloverPercentage(long rolloverPercentage); + ScalingStage rolloverPercentage(long rolloverPercentage); + } + + public interface ScalingStage { + UpdatedAtStage scaling(@NotNull PlanCreditGrantScaling scaling); } public interface UpdatedAtStage { @@ -550,6 +576,10 @@ _FinalStage billingCreditAutoTopupExpiryUnit( _FinalStage expiryUnitCount(Long expiryUnitCount); + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + _FinalStage plan(Optional plan); _FinalStage plan(GenericPreviewObject plan); @@ -595,6 +625,7 @@ public static final class Builder PlanIdStage, ResetTypeStage, RolloverPercentageStage, + ScalingStage, UpdatedAtStage, _FinalStage { private boolean billingCreditAutoTopupEnabled; @@ -621,6 +652,8 @@ public static final class Builder private long rolloverPercentage; + private PlanCreditGrantScaling scaling; + private OffsetDateTime updatedAt; private Optional singularName = Optional.empty(); @@ -635,6 +668,8 @@ public static final class Builder private Optional plan = Optional.empty(); + private Optional licenseId = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -690,6 +725,7 @@ public Builder from(PlanCreditGrantView other) { expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); id(other.getId()); + licenseId(other.getLicenseId()); plan(other.getPlan()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); @@ -698,6 +734,7 @@ public Builder from(PlanCreditGrantView other) { resetStart(other.getResetStart()); resetType(other.getResetType()); rolloverPercentage(other.getRolloverPercentage()); + scaling(other.getScaling()); singularName(other.getSingularName()); updatedAt(other.getUpdatedAt()); return this; @@ -792,11 +829,18 @@ public RolloverPercentageStage resetType(@NotNull BillingPlanCreditGrantResetTyp @java.lang.Override @JsonSetter("rollover_percentage") - public UpdatedAtStage rolloverPercentage(long rolloverPercentage) { + public ScalingStage rolloverPercentage(long rolloverPercentage) { this.rolloverPercentage = rolloverPercentage; return this; } + @java.lang.Override + @JsonSetter("scaling") + public UpdatedAtStage scaling(@NotNull PlanCreditGrantScaling scaling) { + this.scaling = Objects.requireNonNull(scaling, "scaling must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -896,6 +940,19 @@ public _FinalStage plan(Optional plan) { return this; } + @java.lang.Override + public _FinalStage licenseId(String licenseId) { + this.licenseId = Optional.ofNullable(licenseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -1103,6 +1160,7 @@ public PlanCreditGrantView build() { expiryUnit, expiryUnitCount, id, + licenseId, plan, planId, planVersionId, @@ -1111,6 +1169,7 @@ public PlanCreditGrantView build() { resetStart, resetType, rolloverPercentage, + scaling, singularName, updatedAt, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java index 18e6ea3..a5f69b8 100644 --- a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java @@ -72,7 +72,7 @@ public final class PlanDetailResponseData { private final boolean isDefault; - private final boolean isFree; + private final Optional isFree; private final boolean isTrialable; @@ -121,7 +121,7 @@ private PlanDetailResponseData( String id, Optional> includedCreditGrants, boolean isDefault, - boolean isFree, + Optional isFree, boolean isTrialable, Optional monthlyPrice, String name, @@ -292,10 +292,10 @@ public boolean getIsDefault() { } /** - * @return Deprecated: Use BillingStrategy instead + * @return Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed. */ @JsonProperty("is_free") - public boolean getIsFree() { + public Optional getIsFree() { return isFree; } @@ -385,7 +385,7 @@ private boolean equalTo(PlanDetailResponseData other) { && id.equals(other.id) && includedCreditGrants.equals(other.includedCreditGrants) && isDefault == other.isDefault - && isFree == other.isFree + && isFree.equals(other.isFree) && isTrialable == other.isTrialable && monthlyPrice.equals(other.monthlyPrice) && name.equals(other.name) @@ -482,14 +482,7 @@ public interface IdStage { } public interface IsDefaultStage { - IsFreeStage isDefault(boolean isDefault); - } - - public interface IsFreeStage { - /** - *

Deprecated: Use BillingStrategy instead

- */ - IsTrialableStage isFree(boolean isFree); + IsTrialableStage isDefault(boolean isDefault); } public interface IsTrialableStage { @@ -581,6 +574,13 @@ public interface _FinalStage { _FinalStage includedCreditGrants(List includedCreditGrants); + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + _FinalStage isFree(Optional isFree); + + _FinalStage isFree(Boolean isFree); + _FinalStage monthlyPrice(Optional monthlyPrice); _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); @@ -619,7 +619,6 @@ public static final class Builder IconStage, IdStage, IsDefaultStage, - IsFreeStage, IsTrialableStage, NameStage, PlanTypeStage, @@ -643,8 +642,6 @@ public static final class Builder private boolean isDefault; - private boolean isFree; - private boolean isTrialable; private String name; @@ -665,6 +662,8 @@ public static final class Builder private Optional monthlyPrice = Optional.empty(); + private Optional isFree = Optional.empty(); + private Optional> includedCreditGrants = Optional.empty(); private List features = new ArrayList<>(); @@ -798,22 +797,11 @@ public IsDefaultStage id(@NotNull String id) { @java.lang.Override @JsonSetter("is_default") - public IsFreeStage isDefault(boolean isDefault) { + public IsTrialableStage isDefault(boolean isDefault) { this.isDefault = isDefault; return this; } - /** - *

Deprecated: Use BillingStrategy instead

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("is_free") - public IsTrialableStage isFree(boolean isFree) { - this.isFree = isFree; - return this; - } - @java.lang.Override @JsonSetter("is_trialable") public NameStage isTrialable(boolean isTrialable) { @@ -931,6 +919,26 @@ public _FinalStage monthlyPrice(Optional monthlyPrice) return this; } + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

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

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + @java.lang.Override + @JsonSetter(value = "is_free", nulls = Nulls.SKIP) + public _FinalStage isFree(Optional isFree) { + this.isFree = isFree; + return this; + } + @java.lang.Override public _FinalStage includedCreditGrants(List includedCreditGrants) { this.includedCreditGrants = Optional.ofNullable(includedCreditGrants); diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java index fb7ac91..6008510 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java @@ -80,7 +80,7 @@ public final class PlanGroupPlanDetailResponseData { private final boolean isDefault; - private final boolean isFree; + private final Optional isFree; private final boolean isTrialable; @@ -133,7 +133,7 @@ private PlanGroupPlanDetailResponseData( Optional> includedCreditGrants, boolean isCustom, boolean isDefault, - boolean isFree, + Optional isFree, boolean isTrialable, Optional monthlyPrice, String name, @@ -328,10 +328,10 @@ public boolean getIsDefault() { } /** - * @return Deprecated: Use BillingStrategy instead + * @return Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed. */ @JsonProperty("is_free") - public boolean getIsFree() { + public Optional getIsFree() { return isFree; } @@ -425,7 +425,7 @@ private boolean equalTo(PlanGroupPlanDetailResponseData other) { && includedCreditGrants.equals(other.includedCreditGrants) && isCustom == other.isCustom && isDefault == other.isDefault - && isFree == other.isFree + && isFree.equals(other.isFree) && isTrialable == other.isTrialable && monthlyPrice.equals(other.monthlyPrice) && name.equals(other.name) @@ -530,14 +530,7 @@ public interface IsCustomStage { } public interface IsDefaultStage { - IsFreeStage isDefault(boolean isDefault); - } - - public interface IsFreeStage { - /** - *

Deprecated: Use BillingStrategy instead

- */ - IsTrialableStage isFree(boolean isFree); + IsTrialableStage isDefault(boolean isDefault); } public interface IsTrialableStage { @@ -645,6 +638,13 @@ public interface _FinalStage { _FinalStage includedCreditGrants(List includedCreditGrants); + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + _FinalStage isFree(Optional isFree); + + _FinalStage isFree(Boolean isFree); + _FinalStage monthlyPrice(Optional monthlyPrice); _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); @@ -684,7 +684,6 @@ public static final class Builder IdStage, IsCustomStage, IsDefaultStage, - IsFreeStage, IsTrialableStage, NameStage, PlanTypeStage, @@ -710,8 +709,6 @@ public static final class Builder private boolean isDefault; - private boolean isFree; - private boolean isTrialable; private String name; @@ -732,6 +729,8 @@ public static final class Builder private Optional monthlyPrice = Optional.empty(); + private Optional isFree = Optional.empty(); + private Optional> includedCreditGrants = Optional.empty(); private List features = new ArrayList<>(); @@ -882,22 +881,11 @@ public IsDefaultStage isCustom(boolean isCustom) { @java.lang.Override @JsonSetter("is_default") - public IsFreeStage isDefault(boolean isDefault) { + public IsTrialableStage isDefault(boolean isDefault) { this.isDefault = isDefault; return this; } - /** - *

Deprecated: Use BillingStrategy instead

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("is_free") - public IsTrialableStage isFree(boolean isFree) { - this.isFree = isFree; - return this; - } - @java.lang.Override @JsonSetter("is_trialable") public NameStage isTrialable(boolean isTrialable) { @@ -1015,6 +1003,26 @@ public _FinalStage monthlyPrice(Optional monthlyPrice) return this; } + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

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

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + @java.lang.Override + @JsonSetter(value = "is_free", nulls = Nulls.SKIP) + public _FinalStage isFree(Optional isFree) { + this.isFree = isFree; + return this; + } + @java.lang.Override public _FinalStage includedCreditGrants(List includedCreditGrants) { this.includedCreditGrants = Optional.ofNullable(includedCreditGrants); diff --git a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java index 57ed4a7..903fa07 100644 --- a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java @@ -82,7 +82,7 @@ public final class PlanViewPublicResponseData { private final boolean isDefault; - private final boolean isFree; + private final Optional isFree; private final boolean isTrialable; @@ -136,7 +136,7 @@ private PlanViewPublicResponseData( List includedCreditGrants, boolean isCustom, boolean isDefault, - boolean isFree, + Optional isFree, boolean isTrialable, Optional monthlyPrice, String name, @@ -337,10 +337,10 @@ public boolean getIsDefault() { } /** - * @return Deprecated: Use BillingStrategy instead + * @return Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed. */ @JsonProperty("is_free") - public boolean getIsFree() { + public Optional getIsFree() { return isFree; } @@ -435,7 +435,7 @@ private boolean equalTo(PlanViewPublicResponseData other) { && includedCreditGrants.equals(other.includedCreditGrants) && isCustom == other.isCustom && isDefault == other.isDefault - && isFree == other.isFree + && isFree.equals(other.isFree) && isTrialable == other.isTrialable && monthlyPrice.equals(other.monthlyPrice) && name.equals(other.name) @@ -545,14 +545,7 @@ public interface IsCustomStage { } public interface IsDefaultStage { - IsFreeStage isDefault(boolean isDefault); - } - - public interface IsFreeStage { - /** - *

Deprecated: Use BillingStrategy instead

- */ - IsTrialableStage isFree(boolean isFree); + IsTrialableStage isDefault(boolean isDefault); } public interface IsTrialableStage { @@ -662,6 +655,13 @@ public interface _FinalStage { _FinalStage addAllIncludedCreditGrants(List includedCreditGrants); + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + _FinalStage isFree(Optional isFree); + + _FinalStage isFree(Boolean isFree); + _FinalStage monthlyPrice(Optional monthlyPrice); _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); @@ -702,7 +702,6 @@ public static final class Builder IdStage, IsCustomStage, IsDefaultStage, - IsFreeStage, IsTrialableStage, NameStage, PlanTypeStage, @@ -730,8 +729,6 @@ public static final class Builder private boolean isDefault; - private boolean isFree; - private boolean isTrialable; private String name; @@ -752,6 +749,8 @@ public static final class Builder private Optional monthlyPrice = Optional.empty(); + private Optional isFree = Optional.empty(); + private List includedCreditGrants = new ArrayList<>(); private List features = new ArrayList<>(); @@ -910,22 +909,11 @@ public IsDefaultStage isCustom(boolean isCustom) { @java.lang.Override @JsonSetter("is_default") - public IsFreeStage isDefault(boolean isDefault) { + public IsTrialableStage isDefault(boolean isDefault) { this.isDefault = isDefault; return this; } - /** - *

Deprecated: Use BillingStrategy instead

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("is_free") - public IsTrialableStage isFree(boolean isFree) { - this.isFree = isFree; - return this; - } - @java.lang.Override @JsonSetter("is_trialable") public NameStage isTrialable(boolean isTrialable) { @@ -1043,6 +1031,26 @@ public _FinalStage monthlyPrice(Optional monthlyPrice) return this; } + /** + *

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

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

Deprecated: reports the plan's charge type, not its price. Read the plan's prices to tell whether it costs anything, or billing_strategy to tell how it is billed.

+ */ + @java.lang.Override + @JsonSetter(value = "is_free", nulls = Nulls.SKIP) + public _FinalStage isFree(Optional isFree) { + this.isFree = isFree; + return this; + } + @java.lang.Override public _FinalStage addAllIncludedCreditGrants(List includedCreditGrants) { if (includedCreditGrants != null) { diff --git a/src/main/java/com/schematic/api/types/TaxIdInput.java b/src/main/java/com/schematic/api/types/TaxIdInput.java new file mode 100644 index 0000000..7a3d5c1 --- /dev/null +++ b/src/main/java/com/schematic/api/types/TaxIdInput.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TaxIdInput.Builder.class) +public final class TaxIdInput { + private final TaxIdType type; + + private final String value; + + private final Map additionalProperties; + + private TaxIdInput(TaxIdType type, String value, Map additionalProperties) { + this.type = type; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public TaxIdType getType() { + return type; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TaxIdInput && equalTo((TaxIdInput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TaxIdInput other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + ValueStage type(@NotNull TaxIdType type); + + Builder from(TaxIdInput other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + TaxIdInput build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, ValueStage, _FinalStage { + private TaxIdType type; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TaxIdInput other) { + type(other.getType()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public ValueStage type(@NotNull TaxIdType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public TaxIdInput build() { + return new TaxIdInput(type, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/TaxIdType.java b/src/main/java/com/schematic/api/types/TaxIdType.java new file mode 100644 index 0000000..a4fc5be --- /dev/null +++ b/src/main/java/com/schematic/api/types/TaxIdType.java @@ -0,0 +1,442 @@ +/** + * 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 TaxIdType { + public static final TaxIdType TW_VAT = new TaxIdType(Value.TW_VAT, "tw_vat"); + + public static final TaxIdType KR_BRN = new TaxIdType(Value.KR_BRN, "kr_brn"); + + public static final TaxIdType MY_FRP = new TaxIdType(Value.MY_FRP, "my_frp"); + + public static final TaxIdType SG_UEN = new TaxIdType(Value.SG_UEN, "sg_uen"); + + public static final TaxIdType TH_VAT = new TaxIdType(Value.TH_VAT, "th_vat"); + + public static final TaxIdType JP_RN = new TaxIdType(Value.JP_RN, "jp_rn"); + + public static final TaxIdType SG_GST = new TaxIdType(Value.SG_GST, "sg_gst"); + + public static final TaxIdType AU_ABN = new TaxIdType(Value.AU_ABN, "au_abn"); + + public static final TaxIdType NO_VAT = new TaxIdType(Value.NO_VAT, "no_vat"); + + public static final TaxIdType MY_SST = new TaxIdType(Value.MY_SST, "my_sst"); + + public static final TaxIdType EU_VAT = new TaxIdType(Value.EU_VAT, "eu_vat"); + + public static final TaxIdType IN_GST = new TaxIdType(Value.IN_GST, "in_gst"); + + public static final TaxIdType CA_QST = new TaxIdType(Value.CA_QST, "ca_qst"); + + public static final TaxIdType JP_CN = new TaxIdType(Value.JP_CN, "jp_cn"); + + public static final TaxIdType CH_VAT = new TaxIdType(Value.CH_VAT, "ch_vat"); + + public static final TaxIdType MY_ITN = new TaxIdType(Value.MY_ITN, "my_itn"); + + public static final TaxIdType CA_BN = new TaxIdType(Value.CA_BN, "ca_bn"); + + public static final TaxIdType SA_VAT = new TaxIdType(Value.SA_VAT, "sa_vat"); + + public static final TaxIdType AU_ARN = new TaxIdType(Value.AU_ARN, "au_arn"); + + public static final TaxIdType BR_CNPJ = new TaxIdType(Value.BR_CNPJ, "br_cnpj"); + + public static final TaxIdType MX_RFC = new TaxIdType(Value.MX_RFC, "mx_rfc"); + + public static final TaxIdType CA_PST_SK = new TaxIdType(Value.CA_PST_SK, "ca_pst_sk"); + + public static final TaxIdType BR_CPF = new TaxIdType(Value.BR_CPF, "br_cpf"); + + public static final TaxIdType CA_PST_BC = new TaxIdType(Value.CA_PST_BC, "ca_pst_bc"); + + public static final TaxIdType ID_NPWP = new TaxIdType(Value.ID_NPWP, "id_npwp"); + + public static final TaxIdType TR_TIN = new TaxIdType(Value.TR_TIN, "tr_tin"); + + public static final TaxIdType PH_TIN = new TaxIdType(Value.PH_TIN, "ph_tin"); + + public static final TaxIdType AE_TRN = new TaxIdType(Value.AE_TRN, "ae_trn"); + + public static final TaxIdType CH_UID = new TaxIdType(Value.CH_UID, "ch_uid"); + + public static final TaxIdType CA_PST_MB = new TaxIdType(Value.CA_PST_MB, "ca_pst_mb"); + + public static final TaxIdType JP_TRN = new TaxIdType(Value.JP_TRN, "jp_trn"); + + public static final TaxIdType HK_BR = new TaxIdType(Value.HK_BR, "hk_br"); + + public static final TaxIdType US_EIN = new TaxIdType(Value.US_EIN, "us_ein"); + + public static final TaxIdType GB_VAT = new TaxIdType(Value.GB_VAT, "gb_vat"); + + public static final TaxIdType IL_VAT = new TaxIdType(Value.IL_VAT, "il_vat"); + + public static final TaxIdType ZA_VAT = new TaxIdType(Value.ZA_VAT, "za_vat"); + + public static final TaxIdType CA_GST_HST = new TaxIdType(Value.CA_GST_HST, "ca_gst_hst"); + + public static final TaxIdType NZ_GST = new TaxIdType(Value.NZ_GST, "nz_gst"); + + private final Value value; + + private final String string; + + TaxIdType(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 TaxIdType && this.string.equals(((TaxIdType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TW_VAT: + return visitor.visitTwVat(); + case KR_BRN: + return visitor.visitKrBrn(); + case MY_FRP: + return visitor.visitMyFrp(); + case SG_UEN: + return visitor.visitSgUen(); + case TH_VAT: + return visitor.visitThVat(); + case JP_RN: + return visitor.visitJpRn(); + case SG_GST: + return visitor.visitSgGst(); + case AU_ABN: + return visitor.visitAuAbn(); + case NO_VAT: + return visitor.visitNoVat(); + case MY_SST: + return visitor.visitMySst(); + case EU_VAT: + return visitor.visitEuVat(); + case IN_GST: + return visitor.visitInGst(); + case CA_QST: + return visitor.visitCaQst(); + case JP_CN: + return visitor.visitJpCn(); + case CH_VAT: + return visitor.visitChVat(); + case MY_ITN: + return visitor.visitMyItn(); + case CA_BN: + return visitor.visitCaBn(); + case SA_VAT: + return visitor.visitSaVat(); + case AU_ARN: + return visitor.visitAuArn(); + case BR_CNPJ: + return visitor.visitBrCnpj(); + case MX_RFC: + return visitor.visitMxRfc(); + case CA_PST_SK: + return visitor.visitCaPstSk(); + case BR_CPF: + return visitor.visitBrCpf(); + case CA_PST_BC: + return visitor.visitCaPstBc(); + case ID_NPWP: + return visitor.visitIdNpwp(); + case TR_TIN: + return visitor.visitTrTin(); + case PH_TIN: + return visitor.visitPhTin(); + case AE_TRN: + return visitor.visitAeTrn(); + case CH_UID: + return visitor.visitChUid(); + case CA_PST_MB: + return visitor.visitCaPstMb(); + case JP_TRN: + return visitor.visitJpTrn(); + case HK_BR: + return visitor.visitHkBr(); + case US_EIN: + return visitor.visitUsEin(); + case GB_VAT: + return visitor.visitGbVat(); + case IL_VAT: + return visitor.visitIlVat(); + case ZA_VAT: + return visitor.visitZaVat(); + case CA_GST_HST: + return visitor.visitCaGstHst(); + case NZ_GST: + return visitor.visitNzGst(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TaxIdType valueOf(String value) { + switch (value) { + case "tw_vat": + return TW_VAT; + case "kr_brn": + return KR_BRN; + case "my_frp": + return MY_FRP; + case "sg_uen": + return SG_UEN; + case "th_vat": + return TH_VAT; + case "jp_rn": + return JP_RN; + case "sg_gst": + return SG_GST; + case "au_abn": + return AU_ABN; + case "no_vat": + return NO_VAT; + case "my_sst": + return MY_SST; + case "eu_vat": + return EU_VAT; + case "in_gst": + return IN_GST; + case "ca_qst": + return CA_QST; + case "jp_cn": + return JP_CN; + case "ch_vat": + return CH_VAT; + case "my_itn": + return MY_ITN; + case "ca_bn": + return CA_BN; + case "sa_vat": + return SA_VAT; + case "au_arn": + return AU_ARN; + case "br_cnpj": + return BR_CNPJ; + case "mx_rfc": + return MX_RFC; + case "ca_pst_sk": + return CA_PST_SK; + case "br_cpf": + return BR_CPF; + case "ca_pst_bc": + return CA_PST_BC; + case "id_npwp": + return ID_NPWP; + case "tr_tin": + return TR_TIN; + case "ph_tin": + return PH_TIN; + case "ae_trn": + return AE_TRN; + case "ch_uid": + return CH_UID; + case "ca_pst_mb": + return CA_PST_MB; + case "jp_trn": + return JP_TRN; + case "hk_br": + return HK_BR; + case "us_ein": + return US_EIN; + case "gb_vat": + return GB_VAT; + case "il_vat": + return IL_VAT; + case "za_vat": + return ZA_VAT; + case "ca_gst_hst": + return CA_GST_HST; + case "nz_gst": + return NZ_GST; + default: + return new TaxIdType(Value.UNKNOWN, value); + } + } + + public enum Value { + AE_TRN, + + AU_ABN, + + AU_ARN, + + BR_CNPJ, + + BR_CPF, + + CA_BN, + + CA_GST_HST, + + CA_PST_BC, + + CA_PST_MB, + + CA_PST_SK, + + CA_QST, + + CH_UID, + + CH_VAT, + + EU_VAT, + + GB_VAT, + + HK_BR, + + ID_NPWP, + + IL_VAT, + + IN_GST, + + JP_CN, + + JP_RN, + + JP_TRN, + + KR_BRN, + + MX_RFC, + + MY_FRP, + + MY_ITN, + + MY_SST, + + NO_VAT, + + NZ_GST, + + PH_TIN, + + SA_VAT, + + SG_GST, + + SG_UEN, + + TH_VAT, + + TR_TIN, + + TW_VAT, + + US_EIN, + + ZA_VAT, + + UNKNOWN + } + + public interface Visitor { + T visitAeTrn(); + + T visitAuAbn(); + + T visitAuArn(); + + T visitBrCnpj(); + + T visitBrCpf(); + + T visitCaBn(); + + T visitCaGstHst(); + + T visitCaPstBc(); + + T visitCaPstMb(); + + T visitCaPstSk(); + + T visitCaQst(); + + T visitChUid(); + + T visitChVat(); + + T visitEuVat(); + + T visitGbVat(); + + T visitHkBr(); + + T visitIdNpwp(); + + T visitIlVat(); + + T visitInGst(); + + T visitJpCn(); + + T visitJpRn(); + + T visitJpTrn(); + + T visitKrBrn(); + + T visitMxRfc(); + + T visitMyFrp(); + + T visitMyItn(); + + T visitMySst(); + + T visitNoVat(); + + T visitNzGst(); + + T visitPhTin(); + + T visitSaVat(); + + T visitSgGst(); + + T visitSgUen(); + + T visitThVat(); + + T visitTrTin(); + + T visitTwVat(); + + T visitUsEin(); + + T visitZaVat(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java index 8b2470d..32ebcd2 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -53,6 +53,8 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional expiryUnitCount; + private final Optional licenseId; + private final BillingPlanCreditGrantResetCadence resetCadence; private final BillingPlanCreditGrantResetStart resetStart; @@ -61,6 +63,8 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional rolloverPercentage; + private final Optional scaling; + private final Map additionalProperties; private UpdateBillingPlanCreditGrantRequestBody( @@ -80,10 +84,12 @@ private UpdateBillingPlanCreditGrantRequestBody( Optional expiryType, Optional expiryUnit, Optional expiryUnitCount, + Optional licenseId, BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, Optional rolloverPercentage, + Optional scaling, Map additionalProperties) { this.applyToExisting = applyToExisting; this.autoTopupAmount = autoTopupAmount; @@ -101,10 +107,12 @@ private UpdateBillingPlanCreditGrantRequestBody( this.expiryType = expiryType; this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; + this.licenseId = licenseId; this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; this.rolloverPercentage = rolloverPercentage; + this.scaling = scaling; this.additionalProperties = additionalProperties; } @@ -188,6 +196,14 @@ public Optional getExpiryUnitCount() { return expiryUnitCount; } + /** + * @return The license whose quantity scales this grant. Cannot be changed after creation. + */ + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + @JsonProperty("reset_cadence") public BillingPlanCreditGrantResetCadence getResetCadence() { return resetCadence; @@ -211,6 +227,14 @@ public Optional getRolloverPercentage() { return rolloverPercentage; } + /** + * @return Whether the grant is a fixed amount per company, or issued once per license the company holds. Cannot be changed after creation. + */ + @JsonProperty("scaling") + public Optional getScaling() { + return scaling; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -240,10 +264,12 @@ private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) + && licenseId.equals(other.licenseId) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) - && rolloverPercentage.equals(other.rolloverPercentage); + && rolloverPercentage.equals(other.rolloverPercentage) + && scaling.equals(other.scaling); } @java.lang.Override @@ -265,10 +291,12 @@ public int hashCode() { this.expiryType, this.expiryUnit, this.expiryUnitCount, + this.licenseId, this.resetCadence, this.resetStart, this.resetType, - this.rolloverPercentage); + this.rolloverPercentage, + this.scaling); } @java.lang.Override @@ -361,6 +389,13 @@ public interface _FinalStage { _FinalStage expiryUnitCount(Long expiryUnitCount); + /** + *

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

+ */ + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + _FinalStage resetType(Optional resetType); _FinalStage resetType(BillingPlanCreditGrantResetType resetType); @@ -371,6 +406,13 @@ public interface _FinalStage { _FinalStage rolloverPercentage(Optional rolloverPercentage); _FinalStage rolloverPercentage(Long rolloverPercentage); + + /** + *

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

+ */ + _FinalStage scaling(Optional scaling); + + _FinalStage scaling(PlanCreditGrantScaling scaling); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -379,10 +421,14 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private BillingPlanCreditGrantResetStart resetStart; + private Optional scaling = Optional.empty(); + private Optional rolloverPercentage = Optional.empty(); private Optional resetType = Optional.empty(); + private Optional licenseId = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -438,10 +484,12 @@ public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); + licenseId(other.getLicenseId()); resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); rolloverPercentage(other.getRolloverPercentage()); + scaling(other.getScaling()); return this; } @@ -459,6 +507,26 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta return this; } + /** + *

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

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

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

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

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again.

* @return Reference to {@code this} so that method calls can be chained together. @@ -492,6 +560,26 @@ public _FinalStage resetType(Optional resetType return this; } + /** + *

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

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

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

+ */ + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -719,10 +807,12 @@ public UpdateBillingPlanCreditGrantRequestBody build() { expiryType, expiryUnit, expiryUnitCount, + licenseId, resetCadence, resetStart, resetType, rolloverPercentage, + scaling, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/UserCreditUsageResponseData.java b/src/main/java/com/schematic/api/types/UserCreditUsageResponseData.java new file mode 100644 index 0000000..8d7a781 --- /dev/null +++ b/src/main/java/com/schematic/api/types/UserCreditUsageResponseData.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserCreditUsageResponseData.Builder.class) +public final class UserCreditUsageResponseData { + private final String billingCreditId; + + private final String creditName; + + private final double creditsUsed; + + private final double share; + + private final Optional user; + + private final Optional userId; + + private final Map additionalProperties; + + private UserCreditUsageResponseData( + String billingCreditId, + String creditName, + double creditsUsed, + double share, + Optional user, + Optional userId, + Map additionalProperties) { + this.billingCreditId = billingCreditId; + this.creditName = creditName; + this.creditsUsed = creditsUsed; + this.share = share; + this.user = user; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_credit_id") + public String getBillingCreditId() { + return billingCreditId; + } + + /** + * @return The display name of the credit type + */ + @JsonProperty("credit_name") + public String getCreditName() { + return creditName; + } + + /** + * @return The user's net track-driven consumption of the credit within the window (draws minus refunds) + */ + @JsonProperty("credits_used") + public double getCreditsUsed() { + return creditsUsed; + } + + /** + * @return This row's fraction (0-1) of the company's total track-driven consumption of the credit within the window, including unattributed consumption + */ + @JsonProperty("share") + public double getShare() { + return share; + } + + /** + * @return The user the consumption is attributed to; null for consumption from events sent without a user + */ + @JsonProperty("user") + public Optional getUser() { + return user; + } + + /** + * @return The user the consumption is attributed to; null for unattributed consumption + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserCreditUsageResponseData && equalTo((UserCreditUsageResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserCreditUsageResponseData other) { + return billingCreditId.equals(other.billingCreditId) + && creditName.equals(other.creditName) + && creditsUsed == other.creditsUsed + && share == other.share + && user.equals(other.user) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingCreditId, this.creditName, this.creditsUsed, this.share, this.user, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BillingCreditIdStage builder() { + return new Builder(); + } + + public interface BillingCreditIdStage { + CreditNameStage billingCreditId(@NotNull String billingCreditId); + + Builder from(UserCreditUsageResponseData other); + } + + public interface CreditNameStage { + /** + *

The display name of the credit type

+ */ + CreditsUsedStage creditName(@NotNull String creditName); + } + + public interface CreditsUsedStage { + /** + *

The user's net track-driven consumption of the credit within the window (draws minus refunds)

+ */ + ShareStage creditsUsed(double creditsUsed); + } + + public interface ShareStage { + /** + *

This row's fraction (0-1) of the company's total track-driven consumption of the credit within the window, including unattributed consumption

+ */ + _FinalStage share(double share); + } + + public interface _FinalStage { + UserCreditUsageResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user the consumption is attributed to; null for consumption from events sent without a user

+ */ + _FinalStage user(Optional user); + + _FinalStage user(UserResponseData user); + + /** + *

The user the consumption is attributed to; null for unattributed consumption

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BillingCreditIdStage, CreditNameStage, CreditsUsedStage, ShareStage, _FinalStage { + private String billingCreditId; + + private String creditName; + + private double creditsUsed; + + private double share; + + private Optional userId = Optional.empty(); + + private Optional user = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserCreditUsageResponseData other) { + billingCreditId(other.getBillingCreditId()); + creditName(other.getCreditName()); + creditsUsed(other.getCreditsUsed()); + share(other.getShare()); + user(other.getUser()); + userId(other.getUserId()); + return this; + } + + @java.lang.Override + @JsonSetter("billing_credit_id") + public CreditNameStage billingCreditId(@NotNull String billingCreditId) { + this.billingCreditId = Objects.requireNonNull(billingCreditId, "billingCreditId must not be null"); + return this; + } + + /** + *

The display name of the credit type

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

The user's net track-driven consumption of the credit within the window (draws minus refunds)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credits_used") + public ShareStage creditsUsed(double creditsUsed) { + this.creditsUsed = creditsUsed; + return this; + } + + /** + *

This row's fraction (0-1) of the company's total track-driven consumption of the credit within the window, including unattributed consumption

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

The user the consumption is attributed to; null for unattributed consumption

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

The user the consumption is attributed to; null for unattributed consumption

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

The user the consumption is attributed to; null for consumption from events sent without a user

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

The user the consumption is attributed to; null for consumption from events sent without a user

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public UserCreditUsageResponseData build() { + return new UserCreditUsageResponseData( + billingCreditId, creditName, creditsUsed, share, user, userId, 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/UserDailyCreditPointResponseData.java b/src/main/java/com/schematic/api/types/UserDailyCreditPointResponseData.java new file mode 100644 index 0000000..eda29d1 --- /dev/null +++ b/src/main/java/com/schematic/api/types/UserDailyCreditPointResponseData.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserDailyCreditPointResponseData.Builder.class) +public final class UserDailyCreditPointResponseData { + private final double creditsUsed; + + private final OffsetDateTime date; + + private final Map additionalProperties; + + private UserDailyCreditPointResponseData( + double creditsUsed, OffsetDateTime date, Map additionalProperties) { + this.creditsUsed = creditsUsed; + this.date = date; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's net credit consumption on the day + */ + @JsonProperty("credits_used") + public double getCreditsUsed() { + return creditsUsed; + } + + /** + * @return The UTC day + */ + @JsonProperty("date") + public OffsetDateTime getDate() { + return date; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserDailyCreditPointResponseData && equalTo((UserDailyCreditPointResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserDailyCreditPointResponseData other) { + return creditsUsed == other.creditsUsed && date.equals(other.date); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.creditsUsed, this.date); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreditsUsedStage builder() { + return new Builder(); + } + + public interface CreditsUsedStage { + /** + *

The user's net credit consumption on the day

+ */ + DateStage creditsUsed(double creditsUsed); + + Builder from(UserDailyCreditPointResponseData other); + } + + public interface DateStage { + /** + *

The UTC day

+ */ + _FinalStage date(@NotNull OffsetDateTime date); + } + + public interface _FinalStage { + UserDailyCreditPointResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreditsUsedStage, DateStage, _FinalStage { + private double creditsUsed; + + private OffsetDateTime date; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserDailyCreditPointResponseData other) { + creditsUsed(other.getCreditsUsed()); + date(other.getDate()); + return this; + } + + /** + *

The user's net credit consumption on the day

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credits_used") + public DateStage creditsUsed(double creditsUsed) { + this.creditsUsed = creditsUsed; + return this; + } + + /** + *

The UTC day

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("date") + public _FinalStage date(@NotNull OffsetDateTime date) { + this.date = Objects.requireNonNull(date, "date must not be null"); + return this; + } + + @java.lang.Override + public UserDailyCreditPointResponseData build() { + return new UserDailyCreditPointResponseData(creditsUsed, date, 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/UserDailyUsagePointResponseData.java b/src/main/java/com/schematic/api/types/UserDailyUsagePointResponseData.java new file mode 100644 index 0000000..5bc9031 --- /dev/null +++ b/src/main/java/com/schematic/api/types/UserDailyUsagePointResponseData.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserDailyUsagePointResponseData.Builder.class) +public final class UserDailyUsagePointResponseData { + private final OffsetDateTime date; + + private final Optional feature; + + private final long value; + + private final Map additionalProperties; + + private UserDailyUsagePointResponseData( + OffsetDateTime date, + Optional feature, + long value, + Map additionalProperties) { + this.date = date; + this.feature = feature; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The UTC day + */ + @JsonProperty("date") + public OffsetDateTime getDate() { + return date; + } + + @JsonProperty("feature") + public Optional getFeature() { + return feature; + } + + /** + * @return The user's usage of the feature on the day + */ + @JsonProperty("value") + public long getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserDailyUsagePointResponseData && equalTo((UserDailyUsagePointResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserDailyUsagePointResponseData other) { + return date.equals(other.date) && feature.equals(other.feature) && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.date, this.feature, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DateStage builder() { + return new Builder(); + } + + public interface DateStage { + /** + *

The UTC day

+ */ + ValueStage date(@NotNull OffsetDateTime date); + + Builder from(UserDailyUsagePointResponseData other); + } + + public interface ValueStage { + /** + *

The user's usage of the feature on the day

+ */ + _FinalStage value(long value); + } + + public interface _FinalStage { + UserDailyUsagePointResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage feature(Optional feature); + + _FinalStage feature(FeatureResponseData feature); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DateStage, ValueStage, _FinalStage { + private OffsetDateTime date; + + private long value; + + private Optional feature = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserDailyUsagePointResponseData other) { + date(other.getDate()); + feature(other.getFeature()); + value(other.getValue()); + return this; + } + + /** + *

The UTC day

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

The user's usage of the feature on the day

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(long value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage feature(FeatureResponseData feature) { + this.feature = Optional.ofNullable(feature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature", nulls = Nulls.SKIP) + public _FinalStage feature(Optional feature) { + this.feature = feature; + return this; + } + + @java.lang.Override + public UserDailyUsagePointResponseData build() { + return new UserDailyUsagePointResponseData(date, feature, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/UserFeatureUsageResponseData.java b/src/main/java/com/schematic/api/types/UserFeatureUsageResponseData.java new file mode 100644 index 0000000..76b89d0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/UserFeatureUsageResponseData.java @@ -0,0 +1,318 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserFeatureUsageResponseData.Builder.class) +public final class UserFeatureUsageResponseData { + private final Optional feature; + + private final OffsetDateTime lastSeen; + + private final double share; + + private final Optional user; + + private final Optional userId; + + private final long value; + + private final Map additionalProperties; + + private UserFeatureUsageResponseData( + Optional feature, + OffsetDateTime lastSeen, + double share, + Optional user, + Optional userId, + long value, + Map additionalProperties) { + this.feature = feature; + this.lastSeen = lastSeen; + this.share = share; + this.user = user; + this.userId = userId; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("feature") + public Optional getFeature() { + return feature; + } + + /** + * @return When the user last used the feature within the window + */ + @JsonProperty("last_seen") + public OffsetDateTime getLastSeen() { + return lastSeen; + } + + /** + * @return This row's fraction (0-1) of the company's total usage of the feature within the window, including unattributed usage + */ + @JsonProperty("share") + public double getShare() { + return share; + } + + /** + * @return The user the usage is attributed to; null for usage from events sent without a user + */ + @JsonProperty("user") + public Optional getUser() { + return user; + } + + /** + * @return The user the usage is attributed to; null for unattributed usage + */ + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + /** + * @return The user's usage of the feature within the window + */ + @JsonProperty("value") + public long getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserFeatureUsageResponseData && equalTo((UserFeatureUsageResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserFeatureUsageResponseData other) { + return feature.equals(other.feature) + && lastSeen.equals(other.lastSeen) + && share == other.share + && user.equals(other.user) + && userId.equals(other.userId) + && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.feature, this.lastSeen, this.share, this.user, this.userId, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LastSeenStage builder() { + return new Builder(); + } + + public interface LastSeenStage { + /** + *

When the user last used the feature within the window

+ */ + ShareStage lastSeen(@NotNull OffsetDateTime lastSeen); + + Builder from(UserFeatureUsageResponseData other); + } + + public interface ShareStage { + /** + *

This row's fraction (0-1) of the company's total usage of the feature within the window, including unattributed usage

+ */ + ValueStage share(double share); + } + + public interface ValueStage { + /** + *

The user's usage of the feature within the window

+ */ + _FinalStage value(long value); + } + + public interface _FinalStage { + UserFeatureUsageResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage feature(Optional feature); + + _FinalStage feature(FeatureResponseData feature); + + /** + *

The user the usage is attributed to; null for usage from events sent without a user

+ */ + _FinalStage user(Optional user); + + _FinalStage user(UserResponseData user); + + /** + *

The user the usage is attributed to; null for unattributed usage

+ */ + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LastSeenStage, ShareStage, ValueStage, _FinalStage { + private OffsetDateTime lastSeen; + + private double share; + + private long value; + + private Optional userId = Optional.empty(); + + private Optional user = Optional.empty(); + + private Optional feature = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserFeatureUsageResponseData other) { + feature(other.getFeature()); + lastSeen(other.getLastSeen()); + share(other.getShare()); + user(other.getUser()); + userId(other.getUserId()); + value(other.getValue()); + return this; + } + + /** + *

When the user last used the feature within the window

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

This row's fraction (0-1) of the company's total usage of the feature within the window, including unattributed usage

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("share") + public ValueStage share(double share) { + this.share = share; + return this; + } + + /** + *

The user's usage of the feature within the window

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

The user the usage is attributed to; null for unattributed usage

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

The user the usage is attributed to; null for unattributed usage

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

The user the usage is attributed to; null for usage from events sent without a user

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

The user the usage is attributed to; null for usage from events sent without a user

+ */ + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + @java.lang.Override + public _FinalStage feature(FeatureResponseData feature) { + this.feature = Optional.ofNullable(feature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature", nulls = Nulls.SKIP) + public _FinalStage feature(Optional feature) { + this.feature = feature; + return this; + } + + @java.lang.Override + public UserFeatureUsageResponseData build() { + return new UserFeatureUsageResponseData( + feature, lastSeen, share, user, userId, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/UserUsageByCompanyResponseData.java b/src/main/java/com/schematic/api/types/UserUsageByCompanyResponseData.java new file mode 100644 index 0000000..15a368a --- /dev/null +++ b/src/main/java/com/schematic/api/types/UserUsageByCompanyResponseData.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserUsageByCompanyResponseData.Builder.class) +public final class UserUsageByCompanyResponseData { + private final List credits; + + private final OffsetDateTime endTime; + + private final List rows; + + private final OffsetDateTime startTime; + + private final Map additionalProperties; + + private UserUsageByCompanyResponseData( + List credits, + OffsetDateTime endTime, + List rows, + OffsetDateTime startTime, + Map additionalProperties) { + this.credits = credits; + this.endTime = endTime; + this.rows = rows; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return Per-user net credit consumption within the window + */ + @JsonProperty("credits") + public List getCredits() { + return credits; + } + + /** + * @return End of the usage window (exclusive) + */ + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + /** + * @return Per-user, per-feature usage within the window; rows for a feature sum to the company total + */ + @JsonProperty("rows") + public List getRows() { + return rows; + } + + /** + * @return Start of the usage window + */ + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserUsageByCompanyResponseData && equalTo((UserUsageByCompanyResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserUsageByCompanyResponseData other) { + return credits.equals(other.credits) + && endTime.equals(other.endTime) + && rows.equals(other.rows) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.credits, this.endTime, this.rows, this.startTime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EndTimeStage builder() { + return new Builder(); + } + + public interface EndTimeStage { + /** + *

End of the usage window (exclusive)

+ */ + StartTimeStage endTime(@NotNull OffsetDateTime endTime); + + Builder from(UserUsageByCompanyResponseData other); + } + + public interface StartTimeStage { + /** + *

Start of the usage window

+ */ + _FinalStage startTime(@NotNull OffsetDateTime startTime); + } + + public interface _FinalStage { + UserUsageByCompanyResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Per-user net credit consumption within the window

+ */ + _FinalStage credits(List credits); + + _FinalStage addCredits(UserCreditUsageResponseData credits); + + _FinalStage addAllCredits(List credits); + + /** + *

Per-user, per-feature usage within the window; rows for a feature sum to the company total

+ */ + _FinalStage rows(List rows); + + _FinalStage addRows(UserFeatureUsageResponseData rows); + + _FinalStage addAllRows(List rows); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EndTimeStage, StartTimeStage, _FinalStage { + private OffsetDateTime endTime; + + private OffsetDateTime startTime; + + private List rows = new ArrayList<>(); + + private List credits = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserUsageByCompanyResponseData other) { + credits(other.getCredits()); + endTime(other.getEndTime()); + rows(other.getRows()); + startTime(other.getStartTime()); + return this; + } + + /** + *

End of the usage window (exclusive)

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

Start of the usage window

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

Per-user, per-feature usage within the window; rows for a feature sum to the company total

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

Per-user, per-feature usage within the window; rows for a feature sum to the company total

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

Per-user, per-feature usage within the window; rows for a feature sum to the company total

+ */ + @java.lang.Override + @JsonSetter(value = "rows", nulls = Nulls.SKIP) + public _FinalStage rows(List rows) { + this.rows.clear(); + if (rows != null) { + this.rows.addAll(rows); + } + return this; + } + + /** + *

Per-user net credit consumption within the window

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

Per-user net credit consumption within the window

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

Per-user net credit consumption within the window

+ */ + @java.lang.Override + @JsonSetter(value = "credits", nulls = Nulls.SKIP) + public _FinalStage credits(List credits) { + this.credits.clear(); + if (credits != null) { + this.credits.addAll(credits); + } + return this; + } + + @java.lang.Override + public UserUsageByCompanyResponseData build() { + return new UserUsageByCompanyResponseData(credits, endTime, rows, startTime, 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/UserUsageDetailResponseData.java b/src/main/java/com/schematic/api/types/UserUsageDetailResponseData.java new file mode 100644 index 0000000..11475a9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/UserUsageDetailResponseData.java @@ -0,0 +1,454 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserUsageDetailResponseData.Builder.class) +public final class UserUsageDetailResponseData { + private final List credits; + + private final List dailyCreditPoints; + + private final List dailyPoints; + + private final OffsetDateTime endTime; + + private final List featureTotals; + + private final OffsetDateTime startTime; + + private final Optional user; + + private final Map additionalProperties; + + private UserUsageDetailResponseData( + List credits, + List dailyCreditPoints, + List dailyPoints, + OffsetDateTime endTime, + List featureTotals, + OffsetDateTime startTime, + Optional user, + Map additionalProperties) { + this.credits = credits; + this.dailyCreditPoints = dailyCreditPoints; + this.dailyPoints = dailyPoints; + this.endTime = endTime; + this.featureTotals = featureTotals; + this.startTime = startTime; + this.user = user; + this.additionalProperties = additionalProperties; + } + + /** + * @return The user's net credit consumption within the window + */ + @JsonProperty("credits") + public List getCredits() { + return credits; + } + + /** + * @return The user's net credit consumption by UTC day + */ + @JsonProperty("daily_credit_points") + public List getDailyCreditPoints() { + return dailyCreditPoints; + } + + /** + * @return The user's per-feature usage by UTC day + */ + @JsonProperty("daily_points") + public List getDailyPoints() { + return dailyPoints; + } + + /** + * @return End of the usage window (exclusive) + */ + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + /** + * @return The user's per-feature usage totals within the window + */ + @JsonProperty("feature_totals") + public List getFeatureTotals() { + return featureTotals; + } + + /** + * @return Start of the usage window + */ + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + @JsonProperty("user") + public Optional getUser() { + return user; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserUsageDetailResponseData && equalTo((UserUsageDetailResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserUsageDetailResponseData other) { + return credits.equals(other.credits) + && dailyCreditPoints.equals(other.dailyCreditPoints) + && dailyPoints.equals(other.dailyPoints) + && endTime.equals(other.endTime) + && featureTotals.equals(other.featureTotals) + && startTime.equals(other.startTime) + && user.equals(other.user); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.credits, + this.dailyCreditPoints, + this.dailyPoints, + this.endTime, + this.featureTotals, + this.startTime, + this.user); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EndTimeStage builder() { + return new Builder(); + } + + public interface EndTimeStage { + /** + *

End of the usage window (exclusive)

+ */ + StartTimeStage endTime(@NotNull OffsetDateTime endTime); + + Builder from(UserUsageDetailResponseData other); + } + + public interface StartTimeStage { + /** + *

Start of the usage window

+ */ + _FinalStage startTime(@NotNull OffsetDateTime startTime); + } + + public interface _FinalStage { + UserUsageDetailResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The user's net credit consumption within the window

+ */ + _FinalStage credits(List credits); + + _FinalStage addCredits(UserCreditUsageResponseData credits); + + _FinalStage addAllCredits(List credits); + + /** + *

The user's net credit consumption by UTC day

+ */ + _FinalStage dailyCreditPoints(List dailyCreditPoints); + + _FinalStage addDailyCreditPoints(UserDailyCreditPointResponseData dailyCreditPoints); + + _FinalStage addAllDailyCreditPoints(List dailyCreditPoints); + + /** + *

The user's per-feature usage by UTC day

+ */ + _FinalStage dailyPoints(List dailyPoints); + + _FinalStage addDailyPoints(UserDailyUsagePointResponseData dailyPoints); + + _FinalStage addAllDailyPoints(List dailyPoints); + + /** + *

The user's per-feature usage totals within the window

+ */ + _FinalStage featureTotals(List featureTotals); + + _FinalStage addFeatureTotals(UserFeatureUsageResponseData featureTotals); + + _FinalStage addAllFeatureTotals(List featureTotals); + + _FinalStage user(Optional user); + + _FinalStage user(UserResponseData user); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EndTimeStage, StartTimeStage, _FinalStage { + private OffsetDateTime endTime; + + private OffsetDateTime startTime; + + private Optional user = Optional.empty(); + + private List featureTotals = new ArrayList<>(); + + private List dailyPoints = new ArrayList<>(); + + private List dailyCreditPoints = new ArrayList<>(); + + private List credits = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserUsageDetailResponseData other) { + credits(other.getCredits()); + dailyCreditPoints(other.getDailyCreditPoints()); + dailyPoints(other.getDailyPoints()); + endTime(other.getEndTime()); + featureTotals(other.getFeatureTotals()); + startTime(other.getStartTime()); + user(other.getUser()); + return this; + } + + /** + *

End of the usage window (exclusive)

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

Start of the usage window

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("start_time") + public _FinalStage startTime(@NotNull OffsetDateTime startTime) { + this.startTime = Objects.requireNonNull(startTime, "startTime must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage user(UserResponseData user) { + this.user = Optional.ofNullable(user); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user", nulls = Nulls.SKIP) + public _FinalStage user(Optional user) { + this.user = user; + return this; + } + + /** + *

The user's per-feature usage totals within the window

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

The user's per-feature usage totals within the window

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

The user's per-feature usage totals within the window

+ */ + @java.lang.Override + @JsonSetter(value = "feature_totals", nulls = Nulls.SKIP) + public _FinalStage featureTotals(List featureTotals) { + this.featureTotals.clear(); + if (featureTotals != null) { + this.featureTotals.addAll(featureTotals); + } + return this; + } + + /** + *

The user's per-feature usage by UTC day

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

The user's per-feature usage by UTC day

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

The user's per-feature usage by UTC day

+ */ + @java.lang.Override + @JsonSetter(value = "daily_points", nulls = Nulls.SKIP) + public _FinalStage dailyPoints(List dailyPoints) { + this.dailyPoints.clear(); + if (dailyPoints != null) { + this.dailyPoints.addAll(dailyPoints); + } + return this; + } + + /** + *

The user's net credit consumption by UTC day

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

The user's net credit consumption by UTC day

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

The user's net credit consumption by UTC day

+ */ + @java.lang.Override + @JsonSetter(value = "daily_credit_points", nulls = Nulls.SKIP) + public _FinalStage dailyCreditPoints(List dailyCreditPoints) { + this.dailyCreditPoints.clear(); + if (dailyCreditPoints != null) { + this.dailyCreditPoints.addAll(dailyCreditPoints); + } + return this; + } + + /** + *

The user's net credit consumption within the window

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

The user's net credit consumption within the window

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

The user's net credit consumption within the window

+ */ + @java.lang.Override + @JsonSetter(value = "credits", nulls = Nulls.SKIP) + public _FinalStage credits(List credits) { + this.credits.clear(); + if (credits != null) { + this.credits.addAll(credits); + } + return this; + } + + @java.lang.Override + public UserUsageDetailResponseData build() { + return new UserUsageDetailResponseData( + credits, + dailyCreditPoints, + dailyPoints, + endTime, + featureTotals, + startTime, + user, + 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; + } + } +}