diff --git a/.fern/metadata.json b/.fern/metadata.json index ffd7149..21ea3fa 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.6.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.9.1", + "generatorVersion": "4.10.7", "generatorConfig": { "client-class-name": "BaseSchematic", "generate-unknown-as-json-node": true, @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "786b643cc0bf17aff1114597108246b5cf8af395", + "originGitCommit": "221a7c7d042bcb7d7609c93552e3c148814df3f5", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.4.3", + "requestedVersion": "1.4.4", "ciProvider": "github", - "sdkVersion": "1.4.3" + "sdkVersion": "1.4.4" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index b581265..cc851a1 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ java { group = 'com.schematichq' -version = '1.4.3' +version = '1.4.4' jar { dependsOn(":generatePomFileForMavenPublication") @@ -83,7 +83,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.4.3' + version = '1.4.4' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index dc2ff1f..9ef8052 100644 --- a/reference.md +++ b/reference.md @@ -2233,6 +2233,7 @@ client.billing().listBillingPrices( .forTrialExpiryPlan(true) .interval("interval") .isActive(true) + .planVersionId("plan_version_id") .price(1000000L) .productId("product_id") .providerType(BillingProviderType.METRONOME) @@ -2306,6 +2307,14 @@ client.billing().listBillingPrices(
+**planVersionId:** `Optional` — Filter for prices belonging to a specific plan version (e.g. the latest published version) + +
+
+ +
+
+ **price:** `Optional`
@@ -2646,6 +2655,7 @@ client.billing().listBillingProductPrices( .forTrialExpiryPlan(true) .interval("interval") .isActive(true) + .planVersionId("plan_version_id") .price(1000000L) .productId("product_id") .providerType(BillingProviderType.METRONOME) @@ -2719,6 +2729,14 @@ client.billing().listBillingProductPrices(
+**planVersionId:** `Optional` — Filter for prices belonging to a specific plan version (e.g. the latest published version) + +
+
+ +
+
+ **price:** `Optional`
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index f832217..b0e5fc5 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.4.3"); + put("User-Agent", "com.schematichq:schematic-java/1.4.4"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.4.3"); + put("X-Fern-SDK-Version", "1.4.4"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/core/DateTimeDeserializer.java b/src/main/java/com/schematic/api/core/DateTimeDeserializer.java index b1c8e04..c60a3a4 100644 --- a/src/main/java/com/schematic/api/core/DateTimeDeserializer.java +++ b/src/main/java/com/schematic/api/core/DateTimeDeserializer.java @@ -14,6 +14,7 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalQueries; @@ -42,8 +43,15 @@ public OffsetDateTime deserialize(JsonParser parser, DeserializationContext cont if (token == JsonToken.VALUE_NUMBER_INT) { return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); } else { - TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( - parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + String value = parser.getValueAsString(); + TemporalAccessor temporal; + try { + temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(value, OffsetDateTime::from, LocalDateTime::from); + } catch (DateTimeParseException e) { + // Fall back to space-separated format (e.g. "2025-02-15 10:30:00+00:00"). + temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + value.replace(' ', 'T'), OffsetDateTime::from, LocalDateTime::from); + } if (temporal.query(TemporalQueries.offset()) == null) { return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); 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 c3f35c3..4bc1bf0 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java @@ -1327,6 +1327,10 @@ public CompletableFuture> l QueryStringMapper.addQueryParameter( httpUrl, "is_active", request.getIsActive().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price", request.getPrice().get(), false); @@ -1670,6 +1674,10 @@ public CompletableFuture listBillingPrices( QueryStringMapper.addQueryParameter( httpUrl, "is_active", request.getIsActive().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price", request.getPrice().get(), false); @@ -1294,6 +1298,10 @@ public BaseSchematicHttpResponse listBillingPr QueryStringMapper.addQueryParameter( httpUrl, "is_active", request.getIsActive().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price", request.getPrice().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 c438be3..8c46eee 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 @@ -39,6 +39,8 @@ public final class ListBillingPricesRequest { private final Optional isActive; + private final Optional planVersionId; + private final Optional price; private final Optional productId; @@ -67,6 +69,7 @@ private ListBillingPricesRequest( Optional forTrialExpiryPlan, Optional interval, Optional isActive, + Optional planVersionId, Optional price, Optional productId, Optional providerType, @@ -84,6 +87,7 @@ private ListBillingPricesRequest( this.forTrialExpiryPlan = forTrialExpiryPlan; this.interval = interval; this.isActive = isActive; + this.planVersionId = planVersionId; this.price = price; this.productId = productId; this.providerType = providerType; @@ -143,6 +147,14 @@ public Optional getIsActive() { return isActive; } + /** + * @return Filter for prices belonging to a specific plan version (e.g. the latest published version) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("price") public Optional getPrice() { return price; @@ -216,6 +228,7 @@ private boolean equalTo(ListBillingPricesRequest other) { && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && interval.equals(other.interval) && isActive.equals(other.isActive) + && planVersionId.equals(other.planVersionId) && price.equals(other.price) && productId.equals(other.productId) && providerType.equals(other.providerType) @@ -237,6 +250,7 @@ public int hashCode() { this.forTrialExpiryPlan, this.interval, this.isActive, + this.planVersionId, this.price, this.productId, this.providerType, @@ -273,6 +287,8 @@ public static final class Builder { private Optional isActive = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -304,6 +320,7 @@ public Builder from(ListBillingPricesRequest other) { forTrialExpiryPlan(other.getForTrialExpiryPlan()); interval(other.getInterval()); isActive(other.getIsActive()); + planVersionId(other.getPlanVersionId()); price(other.getPrice()); productId(other.getProductId()); providerType(other.getProviderType()); @@ -415,6 +432,20 @@ public Builder isActive(Boolean isActive) { return this; } + /** + *

Filter for prices belonging to a specific plan version (e.g. the latest published version)

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + @JsonSetter(value = "price", nulls = Nulls.SKIP) public Builder price(Optional price) { this.price = price; @@ -532,6 +563,7 @@ public ListBillingPricesRequest build() { forTrialExpiryPlan, interval, isActive, + planVersionId, price, productId, providerType, 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 a70372c..a3451cf 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 @@ -39,6 +39,8 @@ public final class ListBillingProductPricesRequest { private final Optional isActive; + private final Optional planVersionId; + private final Optional price; private final Optional productId; @@ -67,6 +69,7 @@ private ListBillingProductPricesRequest( Optional forTrialExpiryPlan, Optional interval, Optional isActive, + Optional planVersionId, Optional price, Optional productId, Optional providerType, @@ -84,6 +87,7 @@ private ListBillingProductPricesRequest( this.forTrialExpiryPlan = forTrialExpiryPlan; this.interval = interval; this.isActive = isActive; + this.planVersionId = planVersionId; this.price = price; this.productId = productId; this.providerType = providerType; @@ -143,6 +147,14 @@ public Optional getIsActive() { return isActive; } + /** + * @return Filter for prices belonging to a specific plan version (e.g. the latest published version) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("price") public Optional getPrice() { return price; @@ -216,6 +228,7 @@ private boolean equalTo(ListBillingProductPricesRequest other) { && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && interval.equals(other.interval) && isActive.equals(other.isActive) + && planVersionId.equals(other.planVersionId) && price.equals(other.price) && productId.equals(other.productId) && providerType.equals(other.providerType) @@ -237,6 +250,7 @@ public int hashCode() { this.forTrialExpiryPlan, this.interval, this.isActive, + this.planVersionId, this.price, this.productId, this.providerType, @@ -273,6 +287,8 @@ public static final class Builder { private Optional isActive = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -304,6 +320,7 @@ public Builder from(ListBillingProductPricesRequest other) { forTrialExpiryPlan(other.getForTrialExpiryPlan()); interval(other.getInterval()); isActive(other.getIsActive()); + planVersionId(other.getPlanVersionId()); price(other.getPrice()); productId(other.getProductId()); providerType(other.getProviderType()); @@ -415,6 +432,20 @@ public Builder isActive(Boolean isActive) { return this; } + /** + *

Filter for prices belonging to a specific plan version (e.g. the latest published version)

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + @JsonSetter(value = "price", nulls = Nulls.SKIP) public Builder price(Optional price) { this.price = price; @@ -532,6 +563,7 @@ public ListBillingProductPricesRequest build() { forTrialExpiryPlan, interval, isActive, + planVersionId, price, productId, providerType, 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 4c94058..bbac8de 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 @@ -40,6 +40,8 @@ public final class ListBillingPricesParams { private final Optional offset; + private final Optional planVersionId; + private final Optional price; private final Optional productId; @@ -67,6 +69,7 @@ private ListBillingPricesParams( Optional isActive, Optional limit, Optional offset, + Optional planVersionId, Optional price, Optional productId, Optional> productIds, @@ -84,6 +87,7 @@ private ListBillingPricesParams( this.isActive = isActive; this.limit = limit; this.offset = offset; + this.planVersionId = planVersionId; this.price = price; this.productId = productId; this.productIds = productIds; @@ -153,6 +157,14 @@ public Optional getOffset() { return offset; } + /** + * @return Filter for prices belonging to a specific plan version (e.g. the latest published version) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("price") public Optional getPrice() { return price; @@ -216,6 +228,7 @@ private boolean equalTo(ListBillingPricesParams other) { && isActive.equals(other.isActive) && limit.equals(other.limit) && offset.equals(other.offset) + && planVersionId.equals(other.planVersionId) && price.equals(other.price) && productId.equals(other.productId) && productIds.equals(other.productIds) @@ -237,6 +250,7 @@ public int hashCode() { this.isActive, this.limit, this.offset, + this.planVersionId, this.price, this.productId, this.productIds, @@ -274,6 +288,8 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -304,6 +320,7 @@ public Builder from(ListBillingPricesParams other) { isActive(other.getIsActive()); limit(other.getLimit()); offset(other.getOffset()); + planVersionId(other.getPlanVersionId()); price(other.getPrice()); productId(other.getProductId()); productIds(other.getProductIds()); @@ -421,6 +438,20 @@ public Builder offset(Long offset) { return this; } + /** + *

Filter for prices belonging to a specific plan version (e.g. the latest published version)

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + @JsonSetter(value = "price", nulls = Nulls.SKIP) public Builder price(Optional price) { this.price = price; @@ -522,6 +553,7 @@ public ListBillingPricesParams build() { isActive, limit, offset, + planVersionId, price, productId, productIds, 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 1684699..0bff5dc 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 @@ -40,6 +40,8 @@ public final class ListBillingProductPricesParams { private final Optional offset; + private final Optional planVersionId; + private final Optional price; private final Optional productId; @@ -67,6 +69,7 @@ private ListBillingProductPricesParams( Optional isActive, Optional limit, Optional offset, + Optional planVersionId, Optional price, Optional productId, Optional> productIds, @@ -84,6 +87,7 @@ private ListBillingProductPricesParams( this.isActive = isActive; this.limit = limit; this.offset = offset; + this.planVersionId = planVersionId; this.price = price; this.productId = productId; this.productIds = productIds; @@ -153,6 +157,14 @@ public Optional getOffset() { return offset; } + /** + * @return Filter for prices belonging to a specific plan version (e.g. the latest published version) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("price") public Optional getPrice() { return price; @@ -216,6 +228,7 @@ private boolean equalTo(ListBillingProductPricesParams other) { && isActive.equals(other.isActive) && limit.equals(other.limit) && offset.equals(other.offset) + && planVersionId.equals(other.planVersionId) && price.equals(other.price) && productId.equals(other.productId) && productIds.equals(other.productIds) @@ -237,6 +250,7 @@ public int hashCode() { this.isActive, this.limit, this.offset, + this.planVersionId, this.price, this.productId, this.productIds, @@ -274,6 +288,8 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -304,6 +320,7 @@ public Builder from(ListBillingProductPricesParams other) { isActive(other.getIsActive()); limit(other.getLimit()); offset(other.getOffset()); + planVersionId(other.getPlanVersionId()); price(other.getPrice()); productId(other.getProductId()); productIds(other.getProductIds()); @@ -421,6 +438,20 @@ public Builder offset(Long offset) { return this; } + /** + *

Filter for prices belonging to a specific plan version (e.g. the latest published version)

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + @JsonSetter(value = "price", nulls = Nulls.SKIP) public Builder price(Optional price) { this.price = price; @@ -522,6 +553,7 @@ public ListBillingProductPricesParams build() { isActive, limit, offset, + planVersionId, price, productId, productIds, diff --git a/src/main/java/com/schematic/api/types/AccountMemberPermission.java b/src/main/java/com/schematic/api/types/AccountMemberPermission.java index 158b92a..9767bbe 100644 --- a/src/main/java/com/schematic/api/types/AccountMemberPermission.java +++ b/src/main/java/com/schematic/api/types/AccountMemberPermission.java @@ -46,9 +46,6 @@ public final class AccountMemberPermission { public static final AccountMemberPermission OVERRIDES_EDIT = new AccountMemberPermission(Value.OVERRIDES_EDIT, "overrides_edit"); - public static final AccountMemberPermission BILLING_CREDITS_EDIT = - new AccountMemberPermission(Value.BILLING_CREDITS_EDIT, "billing_credits_edit"); - public static final AccountMemberPermission DATA_EXPORTS_EDIT = new AccountMemberPermission(Value.DATA_EXPORTS_EDIT, "data_exports_edit"); @@ -111,8 +108,6 @@ public T visit(Visitor visitor) { return visitor.visitComponentsEdit(); case OVERRIDES_EDIT: return visitor.visitOverridesEdit(); - case BILLING_CREDITS_EDIT: - return visitor.visitBillingCreditsEdit(); case DATA_EXPORTS_EDIT: return visitor.visitDataExportsEdit(); case UNKNOWN: @@ -150,8 +145,6 @@ public static AccountMemberPermission valueOf(String value) { return COMPONENTS_EDIT; case "overrides_edit": return OVERRIDES_EDIT; - case "billing_credits_edit": - return BILLING_CREDITS_EDIT; case "data_exports_edit": return DATA_EXPORTS_EDIT; default: @@ -160,8 +153,6 @@ public static AccountMemberPermission valueOf(String value) { } public enum Value { - BILLING_CREDITS_EDIT, - COMPANIES_EDIT, COMPANY_USERS_EDIT, @@ -194,8 +185,6 @@ public enum Value { } public interface Visitor { - T visitBillingCreditsEdit(); - T visitCompaniesEdit(); T visitCompanyUsersEdit(); diff --git a/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java index 787e5e2..5c3d639 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java @@ -22,6 +22,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CheckFlagsResponseData.Builder.class) public final class CheckFlagsResponseData { + private final Optional> creditBalances; + private final List flags; private final Optional plan; @@ -29,14 +31,24 @@ public final class CheckFlagsResponseData { private final Map additionalProperties; private CheckFlagsResponseData( + Optional> creditBalances, List flags, Optional plan, Map additionalProperties) { + this.creditBalances = creditBalances; this.flags = flags; this.plan = plan; this.additionalProperties = additionalProperties; } + /** + * @return Lease-aware credit balances keyed by credit ID, covering every credit type the company holds a balance in + */ + @JsonProperty("credit_balances") + public Optional> getCreditBalances() { + return creditBalances; + } + @JsonProperty("flags") public List getFlags() { return flags; @@ -59,12 +71,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(CheckFlagsResponseData other) { - return flags.equals(other.flags) && plan.equals(other.plan); + return creditBalances.equals(other.creditBalances) && flags.equals(other.flags) && plan.equals(other.plan); } @java.lang.Override public int hashCode() { - return Objects.hash(this.flags, this.plan); + return Objects.hash(this.creditBalances, this.flags, this.plan); } @java.lang.Override @@ -78,6 +90,8 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> creditBalances = Optional.empty(); + private List flags = new ArrayList<>(); private Optional plan = Optional.empty(); @@ -88,11 +102,26 @@ public static final class Builder { private Builder() {} public Builder from(CheckFlagsResponseData other) { + creditBalances(other.getCreditBalances()); flags(other.getFlags()); plan(other.getPlan()); return this; } + /** + *

Lease-aware credit balances keyed by credit ID, covering every credit type the company holds a balance in

+ */ + @JsonSetter(value = "credit_balances", nulls = Nulls.SKIP) + public Builder creditBalances(Optional> creditBalances) { + this.creditBalances = creditBalances; + return this; + } + + public Builder creditBalances(Map creditBalances) { + this.creditBalances = Optional.ofNullable(creditBalances); + return this; + } + @JsonSetter(value = "flags", nulls = Nulls.SKIP) public Builder flags(List flags) { this.flags.clear(); @@ -126,7 +155,7 @@ public Builder plan(DatastreamCompanyPlan plan) { } public CheckFlagsResponseData build() { - return new CheckFlagsResponseData(flags, plan, additionalProperties); + return new CheckFlagsResponseData(creditBalances, flags, plan, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/CompanyCreditBalance.java b/src/main/java/com/schematic/api/types/CompanyCreditBalance.java new file mode 100644 index 0000000..e650756 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyCreditBalance.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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CompanyCreditBalance.Builder.class) +public final class CompanyCreditBalance { + private final double remaining; + + private final double reserved; + + private final double settled; + + private final Map additionalProperties; + + private CompanyCreditBalance( + double remaining, double reserved, double settled, Map additionalProperties) { + this.remaining = remaining; + this.reserved = reserved; + this.settled = settled; + this.additionalProperties = additionalProperties; + } + + /** + * @return Remaining credit, excluding any open lease hold (the value SDKs gate on) + */ + @JsonProperty("remaining") + public double getRemaining() { + return remaining; + } + + /** + * @return Amount held by the company's open credit lease, 0 when none is open + */ + @JsonProperty("reserved") + public double getReserved() { + return reserved; + } + + /** + * @return Spendable balance including the open lease hold (remaining + reserved) + */ + @JsonProperty("settled") + public double getSettled() { + return settled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CompanyCreditBalance && equalTo((CompanyCreditBalance) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CompanyCreditBalance other) { + return remaining == other.remaining && reserved == other.reserved && settled == other.settled; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.remaining, this.reserved, this.settled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RemainingStage builder() { + return new Builder(); + } + + public interface RemainingStage { + /** + *

Remaining credit, excluding any open lease hold (the value SDKs gate on)

+ */ + ReservedStage remaining(double remaining); + + Builder from(CompanyCreditBalance other); + } + + public interface ReservedStage { + /** + *

Amount held by the company's open credit lease, 0 when none is open

+ */ + SettledStage reserved(double reserved); + } + + public interface SettledStage { + /** + *

Spendable balance including the open lease hold (remaining + reserved)

+ */ + _FinalStage settled(double settled); + } + + public interface _FinalStage { + CompanyCreditBalance build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RemainingStage, ReservedStage, SettledStage, _FinalStage { + private double remaining; + + private double reserved; + + private double settled; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CompanyCreditBalance other) { + remaining(other.getRemaining()); + reserved(other.getReserved()); + settled(other.getSettled()); + return this; + } + + /** + *

Remaining credit, excluding any open lease hold (the value SDKs gate on)

+ *

Remaining credit, excluding any open lease hold (the value SDKs gate on)

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

Amount held by the company's open credit lease, 0 when none is open

+ *

Amount held by the company's open credit lease, 0 when none is open

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

Spendable balance including the open lease hold (remaining + reserved)

+ *

Spendable balance including the open lease hold (remaining + reserved)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("settled") + public _FinalStage settled(double settled) { + this.settled = settled; + return this; + } + + @java.lang.Override + public CompanyCreditBalance build() { + return new CompanyCreditBalance(remaining, reserved, settled, 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/CompanySubscriptionResponseData.java b/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java index b36264a..917e04f 100644 --- a/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java @@ -38,6 +38,8 @@ public final class CompanySubscriptionResponseData { private final String interval; + private final boolean isInitial; + private final Optional latestInvoice; private final Optional paymentMethod; @@ -64,6 +66,7 @@ private CompanySubscriptionResponseData( List discounts, Optional expiredAt, String interval, + boolean isInitial, Optional latestInvoice, Optional paymentMethod, List products, @@ -80,6 +83,7 @@ private CompanySubscriptionResponseData( this.discounts = discounts; this.expiredAt = expiredAt; this.interval = interval; + this.isInitial = isInitial; this.latestInvoice = latestInvoice; this.paymentMethod = paymentMethod; this.products = products; @@ -126,6 +130,11 @@ public String getInterval() { return interval; } + @JsonProperty("is_initial") + public boolean getIsInitial() { + return isInitial; + } + @JsonProperty("latest_invoice") public Optional getLatestInvoice() { return latestInvoice; @@ -185,6 +194,7 @@ private boolean equalTo(CompanySubscriptionResponseData other) { && discounts.equals(other.discounts) && expiredAt.equals(other.expiredAt) && interval.equals(other.interval) + && isInitial == other.isInitial && latestInvoice.equals(other.latestInvoice) && paymentMethod.equals(other.paymentMethod) && products.equals(other.products) @@ -205,6 +215,7 @@ public int hashCode() { this.discounts, this.expiredAt, this.interval, + this.isInitial, this.latestInvoice, this.paymentMethod, this.products, @@ -239,7 +250,11 @@ public interface CustomerExternalIdStage { } public interface IntervalStage { - ProviderTypeStage interval(@NotNull String interval); + IsInitialStage interval(@NotNull String interval); + } + + public interface IsInitialStage { + ProviderTypeStage isInitial(boolean isInitial); } public interface ProviderTypeStage { @@ -304,6 +319,7 @@ public static final class Builder CurrencyStage, CustomerExternalIdStage, IntervalStage, + IsInitialStage, ProviderTypeStage, StatusStage, SubscriptionExternalIdStage, @@ -317,6 +333,8 @@ public static final class Builder private String interval; + private boolean isInitial; + private BillingProviderType providerType; private String status; @@ -353,6 +371,7 @@ public Builder from(CompanySubscriptionResponseData other) { discounts(other.getDiscounts()); expiredAt(other.getExpiredAt()); interval(other.getInterval()); + isInitial(other.getIsInitial()); latestInvoice(other.getLatestInvoice()); paymentMethod(other.getPaymentMethod()); products(other.getProducts()); @@ -387,11 +406,18 @@ public IntervalStage customerExternalId(@NotNull String customerExternalId) { @java.lang.Override @JsonSetter("interval") - public ProviderTypeStage interval(@NotNull String interval) { + public IsInitialStage interval(@NotNull String interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } + @java.lang.Override + @JsonSetter("is_initial") + public ProviderTypeStage isInitial(boolean isInitial) { + this.isInitial = isInitial; + return this; + } + @java.lang.Override @JsonSetter("provider_type") public StatusStage providerType(@NotNull BillingProviderType providerType) { @@ -544,6 +570,7 @@ public CompanySubscriptionResponseData build() { discounts, expiredAt, interval, + isInitial, latestInvoice, paymentMethod, products, diff --git a/src/main/java/com/schematic/api/types/FeatureEntitlement.java b/src/main/java/com/schematic/api/types/FeatureEntitlement.java index 5b13904..e2dedba 100644 --- a/src/main/java/com/schematic/api/types/FeatureEntitlement.java +++ b/src/main/java/com/schematic/api/types/FeatureEntitlement.java @@ -24,6 +24,8 @@ public final class FeatureEntitlement { private final Optional allocation; + private final Optional consumptionRate; + private final Optional creditId; private final Optional creditRemaining; @@ -38,6 +40,8 @@ public final class FeatureEntitlement { private final Optional eventName; + private final Optional eventSubtype; + private final String featureId; private final String featureKey; @@ -58,6 +62,7 @@ public final class FeatureEntitlement { private FeatureEntitlement( Optional allocation, + Optional consumptionRate, Optional creditId, Optional creditRemaining, Optional creditReserved, @@ -65,6 +70,7 @@ private FeatureEntitlement( Optional creditTotal, Optional creditUsed, Optional eventName, + Optional eventSubtype, String featureId, String featureKey, Optional metricPeriod, @@ -75,6 +81,7 @@ private FeatureEntitlement( EntitlementValueType valueType, Map additionalProperties) { this.allocation = allocation; + this.consumptionRate = consumptionRate; this.creditId = creditId; this.creditRemaining = creditRemaining; this.creditReserved = creditReserved; @@ -82,6 +89,7 @@ private FeatureEntitlement( this.creditTotal = creditTotal; this.creditUsed = creditUsed; this.eventName = eventName; + this.eventSubtype = eventSubtype; this.featureId = featureId; this.featureKey = featureKey; this.metricPeriod = metricPeriod; @@ -101,6 +109,14 @@ public Optional getAllocation() { return allocation; } + /** + * @return If the company has a credit-based entitlement for this feature, the credit cost per unit of usage + */ + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + /** * @return If the company has a credit-based entitlement for this feature, the ID of the credit */ @@ -157,6 +173,14 @@ public Optional getEventName() { return eventName; } + /** + * @return For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked + */ + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + /** * @return The ID of the feature */ @@ -234,6 +258,7 @@ public Map getAdditionalProperties() { private boolean equalTo(FeatureEntitlement other) { return allocation.equals(other.allocation) + && consumptionRate.equals(other.consumptionRate) && creditId.equals(other.creditId) && creditRemaining.equals(other.creditRemaining) && creditReserved.equals(other.creditReserved) @@ -241,6 +266,7 @@ private boolean equalTo(FeatureEntitlement other) { && creditTotal.equals(other.creditTotal) && creditUsed.equals(other.creditUsed) && eventName.equals(other.eventName) + && eventSubtype.equals(other.eventSubtype) && featureId.equals(other.featureId) && featureKey.equals(other.featureKey) && metricPeriod.equals(other.metricPeriod) @@ -255,6 +281,7 @@ private boolean equalTo(FeatureEntitlement other) { public int hashCode() { return Objects.hash( this.allocation, + this.consumptionRate, this.creditId, this.creditRemaining, this.creditReserved, @@ -262,6 +289,7 @@ public int hashCode() { this.creditTotal, this.creditUsed, this.eventName, + this.eventSubtype, this.featureId, this.featureKey, this.metricPeriod, @@ -318,6 +346,13 @@ public interface _FinalStage { _FinalStage allocation(Long allocation); + /** + *

If the company has a credit-based entitlement for this feature, the credit cost per unit of usage

+ */ + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + /** *

If the company has a credit-based entitlement for this feature, the ID of the credit

*/ @@ -367,6 +402,13 @@ public interface _FinalStage { _FinalStage eventName(String eventName); + /** + *

For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked

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

For event-based feature entitlements, the period over which usage is tracked

*/ @@ -421,6 +463,8 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private Optional metricPeriod = Optional.empty(); + private Optional eventSubtype = Optional.empty(); + private Optional eventName = Optional.empty(); private Optional creditUsed = Optional.empty(); @@ -435,6 +479,8 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private Optional creditId = Optional.empty(); + private Optional consumptionRate = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter @@ -445,6 +491,7 @@ private Builder() {} @java.lang.Override public Builder from(FeatureEntitlement other) { allocation(other.getAllocation()); + consumptionRate(other.getConsumptionRate()); creditId(other.getCreditId()); creditRemaining(other.getCreditRemaining()); creditReserved(other.getCreditReserved()); @@ -452,6 +499,7 @@ public Builder from(FeatureEntitlement other) { creditTotal(other.getCreditTotal()); creditUsed(other.getCreditUsed()); eventName(other.getEventName()); + eventSubtype(other.getEventSubtype()); featureId(other.getFeatureId()); featureKey(other.getFeatureKey()); metricPeriod(other.getMetricPeriod()); @@ -599,6 +647,26 @@ public _FinalStage metricPeriod(Optional metricPeriod) { return this; } + /** + *

For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked

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

For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked

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

If the feature is event-based, the name of the event tracked for usage

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

If the company has a credit-based entitlement for this feature, the credit cost per unit of usage

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

If the company has a credit-based entitlement for this feature, the credit cost per unit of usage

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

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

* @return Reference to {@code this} so that method calls can be chained together. @@ -763,6 +851,7 @@ public _FinalStage allocation(Optional allocation) { public FeatureEntitlement build() { return new FeatureEntitlement( allocation, + consumptionRate, creditId, creditRemaining, creditReserved, @@ -770,6 +859,7 @@ public FeatureEntitlement build() { creditTotal, creditUsed, eventName, + eventSubtype, featureId, featureKey, metricPeriod, diff --git a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java index f871640..0f3b433 100644 --- a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java +++ b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java @@ -24,6 +24,8 @@ public final class RulesengineFeatureEntitlement { private final Optional allocation; + private final Optional consumptionRate; + private final Optional creditId; private final Optional creditRemaining; @@ -38,6 +40,8 @@ public final class RulesengineFeatureEntitlement { private final Optional eventName; + private final Optional eventSubtype; + private final String featureId; private final String featureKey; @@ -58,6 +62,7 @@ public final class RulesengineFeatureEntitlement { private RulesengineFeatureEntitlement( Optional allocation, + Optional consumptionRate, Optional creditId, Optional creditRemaining, Optional creditReserved, @@ -65,6 +70,7 @@ private RulesengineFeatureEntitlement( Optional creditTotal, Optional creditUsed, Optional eventName, + Optional eventSubtype, String featureId, String featureKey, Optional metricPeriod, @@ -75,6 +81,7 @@ private RulesengineFeatureEntitlement( RulesengineEntitlementValueType valueType, Map additionalProperties) { this.allocation = allocation; + this.consumptionRate = consumptionRate; this.creditId = creditId; this.creditRemaining = creditRemaining; this.creditReserved = creditReserved; @@ -82,6 +89,7 @@ private RulesengineFeatureEntitlement( this.creditTotal = creditTotal; this.creditUsed = creditUsed; this.eventName = eventName; + this.eventSubtype = eventSubtype; this.featureId = featureId; this.featureKey = featureKey; this.metricPeriod = metricPeriod; @@ -101,6 +109,14 @@ public Optional getAllocation() { return allocation; } + /** + * @return If the company has a credit-based entitlement for this feature, the credit cost per unit of usage + */ + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + /** * @return If the company has a credit-based entitlement for this feature, the ID of the credit */ @@ -157,6 +173,14 @@ public Optional getEventName() { return eventName; } + /** + * @return For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked + */ + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + /** * @return The ID of the feature */ @@ -234,6 +258,7 @@ public Map getAdditionalProperties() { private boolean equalTo(RulesengineFeatureEntitlement other) { return allocation.equals(other.allocation) + && consumptionRate.equals(other.consumptionRate) && creditId.equals(other.creditId) && creditRemaining.equals(other.creditRemaining) && creditReserved.equals(other.creditReserved) @@ -241,6 +266,7 @@ private boolean equalTo(RulesengineFeatureEntitlement other) { && creditTotal.equals(other.creditTotal) && creditUsed.equals(other.creditUsed) && eventName.equals(other.eventName) + && eventSubtype.equals(other.eventSubtype) && featureId.equals(other.featureId) && featureKey.equals(other.featureKey) && metricPeriod.equals(other.metricPeriod) @@ -255,6 +281,7 @@ private boolean equalTo(RulesengineFeatureEntitlement other) { public int hashCode() { return Objects.hash( this.allocation, + this.consumptionRate, this.creditId, this.creditRemaining, this.creditReserved, @@ -262,6 +289,7 @@ public int hashCode() { this.creditTotal, this.creditUsed, this.eventName, + this.eventSubtype, this.featureId, this.featureKey, this.metricPeriod, @@ -318,6 +346,13 @@ public interface _FinalStage { _FinalStage allocation(Long allocation); + /** + *

If the company has a credit-based entitlement for this feature, the credit cost per unit of usage

+ */ + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + /** *

If the company has a credit-based entitlement for this feature, the ID of the credit

*/ @@ -367,6 +402,13 @@ public interface _FinalStage { _FinalStage eventName(String eventName); + /** + *

For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked

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

For event-based feature entitlements, the period over which usage is tracked

*/ @@ -421,6 +463,8 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private Optional metricPeriod = Optional.empty(); + private Optional eventSubtype = Optional.empty(); + private Optional eventName = Optional.empty(); private Optional creditUsed = Optional.empty(); @@ -435,6 +479,8 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private Optional creditId = Optional.empty(); + private Optional consumptionRate = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter @@ -445,6 +491,7 @@ private Builder() {} @java.lang.Override public Builder from(RulesengineFeatureEntitlement other) { allocation(other.getAllocation()); + consumptionRate(other.getConsumptionRate()); creditId(other.getCreditId()); creditRemaining(other.getCreditRemaining()); creditReserved(other.getCreditReserved()); @@ -452,6 +499,7 @@ public Builder from(RulesengineFeatureEntitlement other) { creditTotal(other.getCreditTotal()); creditUsed(other.getCreditUsed()); eventName(other.getEventName()); + eventSubtype(other.getEventSubtype()); featureId(other.getFeatureId()); featureKey(other.getFeatureKey()); metricPeriod(other.getMetricPeriod()); @@ -599,6 +647,26 @@ public _FinalStage metricPeriod(Optional metricPeriod) return this; } + /** + *

For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked

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

For event-based or credit-metered feature entitlements, the event subtype whose usage is tracked

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

If the feature is event-based, the name of the event tracked for usage

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

If the company has a credit-based entitlement for this feature, the credit cost per unit of usage

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

If the company has a credit-based entitlement for this feature, the credit cost per unit of usage

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

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

* @return Reference to {@code this} so that method calls can be chained together. @@ -763,6 +851,7 @@ public _FinalStage allocation(Optional allocation) { public RulesengineFeatureEntitlement build() { return new RulesengineFeatureEntitlement( allocation, + consumptionRate, creditId, creditRemaining, creditReserved, @@ -770,6 +859,7 @@ public RulesengineFeatureEntitlement build() { creditTotal, creditUsed, eventName, + eventSubtype, featureId, featureKey, metricPeriod,