diff --git a/.fern/metadata.json b/.fern/metadata.json index 5537d0e..9fcaa5d 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.50.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.11.1", + "generatorVersion": "4.19.1", "generatorConfig": { "client-class-name": "BaseSchematic", "generate-unknown-as-json-node": true, @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "1ab5d36abb4de887dde605f8b82a71dce464a26b", + "originGitCommit": "008b7147a27272499bf4b17fa96d4357ca3b62e9", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.5.6", + "requestedVersion": "1.5.7", "ciProvider": "github", - "sdkVersion": "1.5.6" + "sdkVersion": "1.5.7" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock index dc4a2c1..f89d935 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -42,5 +42,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.11.1 -current_generation: 9ef584d5a4b3d7cf1b53e9667a766da9dce2ce09 + - commit_sha: 7a38b7c515a80d831d371307d9a21782f33b2f7b + tree_hash: 36efdbff203fc25a72aa0e42d88107265bb20a9c + timestamp: 2026-08-24T10:17:54.684Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.19.1 +current_generation: 7a38b7c515a80d831d371307d9a21782f33b2f7b patches: [] diff --git a/build.gradle b/build.gradle index 0a98126..3bf505f 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ java { group = 'com.schematichq' -version = '1.5.6' +version = '1.5.7' jar { dependsOn(":generatePomFileForMavenPublication") @@ -93,7 +93,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.5.6' + version = '1.5.7' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index 38875f7..911d23c 100644 --- a/reference.md +++ b/reference.md @@ -5086,7 +5086,7 @@ client.credits().countCompanyGrants(
-**companyId:** `Optional` +**companyId:** `String`
@@ -5167,7 +5167,7 @@ client.credits().listCompanyGrants(
-**companyId:** `Optional` +**companyId:** `String`
@@ -7624,6 +7624,7 @@ client.companies().listCompanies( .monetizedSubscriptions(true) .planId("plan_id") .planVersionId("plan_version_id") + .planVersionUnpublished(true) .q("q") .sortOrderColumn("sort_order_column") .sortOrderDirection(SortDirection.ASC) @@ -7714,6 +7715,14 @@ client.companies().listCompanies(
+**planVersionUnpublished:** `Optional` — Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -8004,6 +8013,7 @@ client.companies().countCompanies( .monetizedSubscriptions(true) .planId("plan_id") .planVersionId("plan_version_id") + .planVersionUnpublished(true) .q("q") .sortOrderColumn("sort_order_column") .sortOrderDirection(SortDirection.ASC) @@ -8094,6 +8104,14 @@ client.companies().countCompanies(
+**planVersionUnpublished:** `Optional` — Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -8392,7 +8410,7 @@ client.companies().getCompanyBillingEntity(
-**companyId:** `Optional` +**companyId:** `String`
@@ -8437,7 +8455,7 @@ client.companies().getBillingEntityChildSubscriptions(
-**companyId:** `Optional` +**companyId:** `String`
@@ -11409,6 +11427,109 @@ client.entitlements().listFeatureUsage(
+ +
+ + +
client.entitlements.listFeatureUsageHistory() -> ListFeatureUsageHistoryResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entitlements().listFeatureUsageHistory( + ListFeatureUsageHistoryRequest + .builder() + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .companyIds( + Arrays.asList("company_ids") + ) + .featureIds( + Arrays.asList("feature_ids") + ) + .granularity(TimeSeriesGranularity.DAILY) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyIds:** `Optional` — Restrict to these company IDs; omit for every company in the environment + +
+
+ +
+
+ +**endTime:** `OffsetDateTime` — Exclusive end of the window; must fall on an hour boundary + +
+
+ +
+
+ +**featureIds:** `Optional` — Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit + +
+
+ +
+
+ +**granularity:** `Optional` — Bucket the window; omit for a single total per company and feature + +
+
+ +
+
+ +**startTime:** `OffsetDateTime` — Inclusive start of the window; must fall on an hour boundary + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ +
@@ -13617,7 +13738,6 @@ client.plans().createCustomPlan( CreateCustomPlanRequestBody .builder() .companyId("company_id") - .description("description") .name("name") .build() ); @@ -13651,7 +13771,15 @@ client.plans().createCustomPlan(
-**description:** `String` +**copiedPriceId:** `Optional` + +
+
+ +
+
+ +**description:** `Optional`
@@ -13886,7 +14014,6 @@ client.plans().listPlans( client.plans().createPlan( CreatePlanRequestBody .builder() - .description("description") .name("name") .planType(PlanType.PLAN) .build() @@ -14137,7 +14264,6 @@ client.plans().upsertPlanForBillingProduct( CreateBillingLinkedPlanRequestBody .builder() .billingProvider(BillingProviderType.METRONOME) - .description("description") .externalResourceId("external_resource_id") .name("name") .planType(PlanType.PLAN) @@ -14165,7 +14291,7 @@ client.plans().upsertPlanForBillingProduct(
-**description:** `String` +**description:** `Optional`
@@ -14785,6 +14911,14 @@ client.plans().publishPlanVersion(
+**requireNoMigration:** `Optional` — Refuse the publish if any company would be migrated onto the new version + +
+
+ +
+
+ **sendInvoice:** `Optional` — Whether Stripe emails the invoice when it is finalized. Defaults to true.
@@ -15275,6 +15409,20 @@ client.components().previewComponentData( client.planbundle().createCustomPlanBundle( CreateCustomPlanBundleRequestBody .builder() + .billingProduct( + UpsertBillingProductRequestBody + .builder() + .chargeType(ChargeType.FREE) + .isTrialable(true) + .build() + ) + .plan( + CreateCustomPlanBundlePlanRequestBody + .builder() + .companyId("company_id") + .name("name") + .build() + ) .entitlements( Arrays.asList( PlanBundleEntitlementRequestBody @@ -15299,7 +15447,7 @@ client.planbundle().createCustomPlanBundle(
-**billingProduct:** `Optional` +**billingProduct:** `UpsertBillingProductRequestBody`
@@ -15323,7 +15471,7 @@ client.planbundle().createCustomPlanBundle(
-**plan:** `Optional` +**plan:** `CreateCustomPlanBundlePlanRequestBody`
@@ -15351,6 +15499,13 @@ client.planbundle().createCustomPlanBundle( client.planbundle().createPlanBundle( CreatePlanBundleRequestBody .builder() + .plan( + CreatePlanRequestBody + .builder() + .name("name") + .planType(PlanType.PLAN) + .build() + ) .entitlements( Arrays.asList( PlanBundleEntitlementRequestBody @@ -15399,7 +15554,7 @@ client.planbundle().createPlanBundle(
-**plan:** `Optional` +**plan:** `CreatePlanRequestBody`
@@ -15428,6 +15583,12 @@ client.planbundle().updatePlanBundle( "plan_id", UpdatePlanBundleRequestBody .builder() + .plan( + UpdatePlanRequestBody + .builder() + .name("name") + .build() + ) .entitlements( Arrays.asList( PlanBundleEntitlementRequestBody @@ -15484,7 +15645,7 @@ client.planbundle().updatePlanBundle(
-**plan:** `Optional` +**plan:** `UpdatePlanRequestBody`
@@ -18446,7 +18607,6 @@ client.plangroups().getPlanGroup( client.plangroups().createPlanGroup( CreatePlanGroupRequestBody .builder() - .checkoutBundlePurchaseBehavior(CheckoutBundlePurchaseBehavior.INDIVIDUAL) .checkoutCollectAddress(true) .checkoutCollectEmail(true) .checkoutCollectPhone(true) @@ -18522,7 +18682,7 @@ client.plangroups().createPlanGroup(
-**checkoutBundlePurchaseBehavior:** `CheckoutBundlePurchaseBehavior` +**checkoutBundlePurchaseBehavior:** `Optional`
@@ -18831,7 +18991,6 @@ client.plangroups().updatePlanGroup( "plan_group_id", UpdatePlanGroupRequestBody .builder() - .checkoutBundlePurchaseBehavior(CheckoutBundlePurchaseBehavior.INDIVIDUAL) .checkoutCollectAddress(true) .checkoutCollectEmail(true) .checkoutCollectPhone(true) @@ -18915,7 +19074,7 @@ client.plangroups().updatePlanGroup(
-**checkoutBundlePurchaseBehavior:** `CheckoutBundlePurchaseBehavior` +**checkoutBundlePurchaseBehavior:** `Optional`
@@ -19245,7 +19404,7 @@ client.planmigrations().listCompanyMigrations(
-**migrationId:** `Optional` +**migrationId:** `String`
@@ -19366,7 +19525,7 @@ client.planmigrations().countCompanyMigrations(
-**migrationId:** `Optional` +**migrationId:** `String`
@@ -19446,7 +19605,7 @@ client.planmigrations().listMigrations(
-**planVersionId:** `Optional` +**planVersionId:** `String`
@@ -19718,7 +19877,7 @@ client.planmigrations().countMigrations(
-**planVersionId:** `Optional` +**planVersionId:** `String`
diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java b/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java index d6a3436..36480b0 100644 --- a/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java +++ b/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java @@ -16,6 +16,12 @@ public class AsyncBaseSchematicBuilder { private Optional maxRetries = Optional.empty(); + private Optional initialRetryDelayMillis = Optional.empty(); + + private Optional maxRetryDelayMillis = Optional.empty(); + + private Optional retryJitterFactor = Optional.empty(); + private final Map customHeaders = new HashMap<>(); private String apiKey = null; @@ -60,6 +66,30 @@ public AsyncBaseSchematicBuilder maxRetries(int maxRetries) { return this; } + /** + * Sets the initial delay (in milliseconds) used for exponential backoff between retries. Defaults to 1000 milliseconds. + */ + public AsyncBaseSchematicBuilder initialRetryDelayMillis(long initialRetryDelayMillis) { + this.initialRetryDelayMillis = Optional.of(initialRetryDelayMillis); + return this; + } + + /** + * Sets the maximum delay (in milliseconds) between retries. Defaults to 60000 milliseconds. + */ + public AsyncBaseSchematicBuilder maxRetryDelayMillis(long maxRetryDelayMillis) { + this.maxRetryDelayMillis = Optional.of(maxRetryDelayMillis); + return this; + } + + /** + * Sets the jitter factor (between 0 and 1) applied to retry delays. Defaults to 0.2. + */ + public AsyncBaseSchematicBuilder retryJitterFactor(double retryJitterFactor) { + this.retryJitterFactor = Optional.of(retryJitterFactor); + return this; + } + /** * Sets the underlying OkHttp client */ @@ -130,7 +160,9 @@ protected void setEnvironment(ClientOptions.Builder builder) { * } */ protected void setAuthentication(ClientOptions.Builder builder) { - builder.addHeader("X-Schematic-Api-Key", this.apiKey); + if (this.apiKey != null) { + builder.addHeader("X-Schematic-Api-Key", this.apiKey); + } } /** @@ -155,6 +187,15 @@ protected void setRetries(ClientOptions.Builder builder) { if (this.maxRetries.isPresent()) { builder.maxRetries(this.maxRetries.get()); } + if (this.initialRetryDelayMillis.isPresent()) { + builder.initialRetryDelayMillis(this.initialRetryDelayMillis.get()); + } + if (this.maxRetryDelayMillis.isPresent()) { + builder.maxRetryDelayMillis(this.maxRetryDelayMillis.get()); + } + if (this.retryJitterFactor.isPresent()) { + builder.retryJitterFactor(this.retryJitterFactor.get()); + } } /** diff --git a/src/main/java/com/schematic/api/BaseSchematicBuilder.java b/src/main/java/com/schematic/api/BaseSchematicBuilder.java index a3c398b..4fa8f6a 100644 --- a/src/main/java/com/schematic/api/BaseSchematicBuilder.java +++ b/src/main/java/com/schematic/api/BaseSchematicBuilder.java @@ -16,6 +16,12 @@ public class BaseSchematicBuilder { private Optional maxRetries = Optional.empty(); + private Optional initialRetryDelayMillis = Optional.empty(); + + private Optional maxRetryDelayMillis = Optional.empty(); + + private Optional retryJitterFactor = Optional.empty(); + private final Map customHeaders = new HashMap<>(); private String apiKey = null; @@ -60,6 +66,30 @@ public BaseSchematicBuilder maxRetries(int maxRetries) { return this; } + /** + * Sets the initial delay (in milliseconds) used for exponential backoff between retries. Defaults to 1000 milliseconds. + */ + public BaseSchematicBuilder initialRetryDelayMillis(long initialRetryDelayMillis) { + this.initialRetryDelayMillis = Optional.of(initialRetryDelayMillis); + return this; + } + + /** + * Sets the maximum delay (in milliseconds) between retries. Defaults to 60000 milliseconds. + */ + public BaseSchematicBuilder maxRetryDelayMillis(long maxRetryDelayMillis) { + this.maxRetryDelayMillis = Optional.of(maxRetryDelayMillis); + return this; + } + + /** + * Sets the jitter factor (between 0 and 1) applied to retry delays. Defaults to 0.2. + */ + public BaseSchematicBuilder retryJitterFactor(double retryJitterFactor) { + this.retryJitterFactor = Optional.of(retryJitterFactor); + return this; + } + /** * Sets the underlying OkHttp client */ @@ -130,7 +160,9 @@ protected void setEnvironment(ClientOptions.Builder builder) { * } */ protected void setAuthentication(ClientOptions.Builder builder) { - builder.addHeader("X-Schematic-Api-Key", this.apiKey); + if (this.apiKey != null) { + builder.addHeader("X-Schematic-Api-Key", this.apiKey); + } } /** @@ -155,6 +187,15 @@ protected void setRetries(ClientOptions.Builder builder) { if (this.maxRetries.isPresent()) { builder.maxRetries(this.maxRetries.get()); } + if (this.initialRetryDelayMillis.isPresent()) { + builder.initialRetryDelayMillis(this.initialRetryDelayMillis.get()); + } + if (this.maxRetryDelayMillis.isPresent()) { + builder.maxRetryDelayMillis(this.maxRetryDelayMillis.get()); + } + if (this.retryJitterFactor.isPresent()) { + builder.retryJitterFactor(this.retryJitterFactor.get()); + } } /** diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index 63ecbd4..0dba526 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -23,6 +23,12 @@ public final class ClientOptions { private final int maxRetries; + private final Optional initialRetryDelayMillis; + + private final Optional maxRetryDelayMillis; + + private final Optional retryJitterFactor; + private final Optional logging; private ClientOptions( @@ -32,22 +38,28 @@ private ClientOptions( OkHttpClient httpClient, int timeout, int maxRetries, + Optional initialRetryDelayMillis, + Optional maxRetryDelayMillis, + Optional retryJitterFactor, Optional logging) { this.environment = environment; this.headers = new HashMap<>(); this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.5.6"); + put("User-Agent", "com.schematichq.schematic-java/1.5.7"); put("X-Fern-Language", "JAVA"); - put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.5.6"); + put("X-Fern-SDK-Name", "com.schematichq:schematic-java"); + put("X-Fern-SDK-Version", "1.5.7"); } }); this.headerSuppliers = headerSuppliers; this.httpClient = httpClient; this.timeout = timeout; this.maxRetries = maxRetries; + this.initialRetryDelayMillis = initialRetryDelayMillis; + this.maxRetryDelayMillis = maxRetryDelayMillis; + this.retryJitterFactor = retryJitterFactor; this.logging = logging; } @@ -94,6 +106,18 @@ public int maxRetries() { return this.maxRetries; } + public Optional initialRetryDelayMillis() { + return this.initialRetryDelayMillis; + } + + public Optional maxRetryDelayMillis() { + return this.maxRetryDelayMillis; + } + + public Optional retryJitterFactor() { + return this.retryJitterFactor; + } + public Optional logging() { return this.logging; } @@ -111,6 +135,12 @@ public static class Builder { private int maxRetries = 2; + private Optional initialRetryDelayMillis = Optional.empty(); + + private Optional maxRetryDelayMillis = Optional.empty(); + + private Optional retryJitterFactor = Optional.empty(); + private Optional timeout = Optional.empty(); private OkHttpClient httpClient = null; @@ -123,7 +153,9 @@ public Builder environment(Environment environment) { } public Builder addHeader(String key, String value) { - this.headers.put(key, value); + if (value != null) { + this.headers.put(key, value); + } return this; } @@ -156,6 +188,30 @@ public Builder maxRetries(int maxRetries) { return this; } + /** + * Override the initial delay (in milliseconds) used for exponential backoff between retries. Defaults to 1000 milliseconds. + */ + public Builder initialRetryDelayMillis(long initialRetryDelayMillis) { + this.initialRetryDelayMillis = Optional.of(initialRetryDelayMillis); + return this; + } + + /** + * Override the maximum delay (in milliseconds) between retries. Defaults to 60000 milliseconds. + */ + public Builder maxRetryDelayMillis(long maxRetryDelayMillis) { + this.maxRetryDelayMillis = Optional.of(maxRetryDelayMillis); + return this; + } + + /** + * Override the jitter factor (between 0 and 1) applied to retry delays. Defaults to 0.2. + */ + public Builder retryJitterFactor(double retryJitterFactor) { + this.retryJitterFactor = Optional.of(retryJitterFactor); + return this; + } + public Builder httpClient(OkHttpClient httpClient) { this.httpClient = httpClient; return this; @@ -185,11 +241,16 @@ public ClientOptions build() { .connectTimeout(0, TimeUnit.SECONDS) .writeTimeout(0, TimeUnit.SECONDS) .readTimeout(0, TimeUnit.SECONDS) - .addInterceptor(new RetryInterceptor(this.maxRetries)); + .addInterceptor(new RetryInterceptor( + this.maxRetries, + this.initialRetryDelayMillis, + this.maxRetryDelayMillis, + this.retryJitterFactor)); } Logger logger = Logger.from(this.logging); httpClientBuilder.addInterceptor(new LoggingInterceptor(logger)); + httpClientBuilder.addInterceptor(new ResponseDecompressionInterceptor()); this.httpClient = httpClientBuilder.build(); this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); @@ -201,6 +262,9 @@ public ClientOptions build() { httpClient, this.timeout.get(), this.maxRetries, + this.initialRetryDelayMillis, + this.maxRetryDelayMillis, + this.retryJitterFactor, this.logging); } @@ -215,6 +279,9 @@ public static Builder from(ClientOptions clientOptions) { builder.headers.putAll(clientOptions.headers); builder.headerSuppliers.putAll(clientOptions.headerSuppliers); builder.maxRetries = clientOptions.maxRetries(); + builder.initialRetryDelayMillis = clientOptions.initialRetryDelayMillis(); + builder.maxRetryDelayMillis = clientOptions.maxRetryDelayMillis(); + builder.retryJitterFactor = clientOptions.retryJitterFactor(); builder.logging = clientOptions.logging(); return builder; } diff --git a/src/main/java/com/schematic/api/core/ConsoleLogger.java b/src/main/java/com/schematic/api/core/ConsoleLogger.java index 89a22b6..8664363 100644 --- a/src/main/java/com/schematic/api/core/ConsoleLogger.java +++ b/src/main/java/com/schematic/api/core/ConsoleLogger.java @@ -23,6 +23,7 @@ public String format(java.util.logging.LogRecord record) { return record.getLevel() + " - " + record.getMessage() + System.lineSeparator(); } }); + handler.setLevel(Level.ALL); logger.addHandler(handler); logger.setUseParentHandlers(false); logger.setLevel(Level.ALL); diff --git a/src/main/java/com/schematic/api/core/ResponseDecompressionInterceptor.java b/src/main/java/com/schematic/api/core/ResponseDecompressionInterceptor.java new file mode 100644 index 0000000..24dbcb3 --- /dev/null +++ b/src/main/java/com/schematic/api/core/ResponseDecompressionInterceptor.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import java.io.IOException; +import java.util.zip.Inflater; +import okhttp3.Interceptor; +import okhttp3.Response; +import okhttp3.ResponseBody; +import okio.GzipSource; +import okio.InflaterSource; +import okio.Okio; +import okio.Source; + +/** + * Decompresses gzip and deflate encoded response bodies. OkHttp only performs + * transparent decompression when it adds the Accept-Encoding header itself, so + * responses to requests with an explicitly set Accept-Encoding header would + * otherwise be returned as raw compressed bytes. + */ +public class ResponseDecompressionInterceptor implements Interceptor { + + @Override + public Response intercept(Chain chain) throws IOException { + return decompress(chain.proceed(chain.request())); + } + + private Response decompress(Response response) { + ResponseBody body = response.body(); + if (body == null) { + return response; + } + String encoding = response.header("Content-Encoding"); + if (encoding == null) { + return response; + } + Source decompressedSource; + if (encoding.equalsIgnoreCase("gzip") || encoding.equalsIgnoreCase("x-gzip")) { + decompressedSource = new GzipSource(body.source()); + } else if (encoding.equalsIgnoreCase("deflate")) { + decompressedSource = new InflaterSource(body.source(), new Inflater()); + } else { + return response; + } + ResponseBody decompressedBody = ResponseBody.create(body.contentType(), -1L, Okio.buffer(decompressedSource)); + return response.newBuilder() + .headers(response.headers() + .newBuilder() + .removeAll("Content-Encoding") + .removeAll("Content-Length") + .build()) + .body(decompressedBody) + .build(); + } +} diff --git a/src/main/java/com/schematic/api/core/RetryInterceptor.java b/src/main/java/com/schematic/api/core/RetryInterceptor.java index de9aa09..b1c720a 100644 --- a/src/main/java/com/schematic/api/core/RetryInterceptor.java +++ b/src/main/java/com/schematic/api/core/RetryInterceptor.java @@ -16,15 +16,44 @@ public class RetryInterceptor implements Interceptor { - private static final Duration INITIAL_RETRY_DELAY = Duration.ofMillis(1000); - private static final Duration MAX_RETRY_DELAY = Duration.ofMillis(60000); - private static final double JITTER_FACTOR = 0.2; + private static final Duration DEFAULT_INITIAL_RETRY_DELAY = Duration.ofMillis(1000); + private static final Duration DEFAULT_MAX_RETRY_DELAY = Duration.ofMillis(60000); + private static final double DEFAULT_JITTER_FACTOR = 0.2; private final int maxRetries; + private final Duration initialRetryDelay; + private final Duration maxRetryDelay; + private final double jitterFactor; private final Random random = new Random(); public RetryInterceptor(int maxRetries) { + this(maxRetries, Optional.empty(), Optional.empty(), Optional.empty()); + } + + public RetryInterceptor( + int maxRetries, + Optional initialRetryDelayMillis, + Optional maxRetryDelayMillis, + Optional jitterFactor) { + initialRetryDelayMillis.ifPresent(delay -> { + if (delay < 0) { + throw new IllegalArgumentException("initialRetryDelayMillis must be non-negative"); + } + }); + maxRetryDelayMillis.ifPresent(delay -> { + if (delay < 0) { + throw new IllegalArgumentException("maxRetryDelayMillis must be non-negative"); + } + }); + jitterFactor.ifPresent(factor -> { + if (factor < 0 || factor > 1) { + throw new IllegalArgumentException("jitterFactor must be between 0 and 1"); + } + }); this.maxRetries = maxRetries; + this.initialRetryDelay = initialRetryDelayMillis.map(Duration::ofMillis).orElse(DEFAULT_INITIAL_RETRY_DELAY); + this.maxRetryDelay = maxRetryDelayMillis.map(Duration::ofMillis).orElse(DEFAULT_MAX_RETRY_DELAY); + this.jitterFactor = jitterFactor.orElse(DEFAULT_JITTER_FACTOR); } @Override @@ -78,7 +107,7 @@ private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { Optional secondsDelay = tryParseLong(retryAfter) .map(seconds -> seconds * 1000) .filter(delayMs -> delayMs > 0) - .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(delayMs -> Math.min(delayMs, maxRetryDelay.toMillis())) .map(Duration::ofMillis); if (secondsDelay.isPresent()) { return secondsDelay.get(); @@ -88,7 +117,7 @@ private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { Optional dateDelay = tryParseHttpDate(retryAfter) .map(resetTime -> resetTime.toInstant().toEpochMilli() - System.currentTimeMillis()) .filter(delayMs -> delayMs > 0) - .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(delayMs -> Math.min(delayMs, maxRetryDelay.toMillis())) .map(Duration::ofMillis); if (dateDelay.isPresent()) { return dateDelay.get(); @@ -102,7 +131,7 @@ private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { Optional rateLimitDelay = tryParseLong(rateLimitReset) .map(resetTimeSeconds -> (resetTimeSeconds * 1000) - System.currentTimeMillis()) .filter(delayMs -> delayMs > 0) - .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(delayMs -> Math.min(delayMs, maxRetryDelay.toMillis())) .map(this::addPositiveJitter) .map(Duration::ofMillis); if (rateLimitDelay.isPresent()) { @@ -111,8 +140,15 @@ private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { } // Fall back to exponential backoff, with symmetric jitter - long baseDelay = INITIAL_RETRY_DELAY.toMillis() * (1L << retryAttempt); // 2^retryAttempt - long cappedDelay = Math.min(baseDelay, MAX_RETRY_DELAY.toMillis()); + long initialDelayMillis = initialRetryDelay.toMillis(); + long maxDelayMillis = maxRetryDelay.toMillis(); + long cappedDelay; + if (retryAttempt >= Long.SIZE - 1 || initialDelayMillis > (maxDelayMillis >> retryAttempt)) { + // initialDelayMillis * 2^retryAttempt would exceed maxDelayMillis (or overflow) + cappedDelay = maxDelayMillis; + } else { + cappedDelay = Math.min(initialDelayMillis << retryAttempt, maxDelayMillis); // 2^retryAttempt + } return Duration.ofMillis(addSymmetricJitter(cappedDelay)); } @@ -149,7 +185,7 @@ private Optional tryParseHttpDate(String value) { * Used for X-RateLimit-Reset header delays. */ private long addPositiveJitter(long delayMs) { - double jitterMultiplier = 1.0 + (random.nextDouble() * JITTER_FACTOR); + double jitterMultiplier = 1.0 + (random.nextDouble() * jitterFactor); return (long) (delayMs * jitterMultiplier); } @@ -158,7 +194,7 @@ private long addPositiveJitter(long delayMs) { * Used for exponential backoff delays. */ private long addSymmetricJitter(long delayMs) { - double jitterMultiplier = 1.0 + ((random.nextDouble() - 0.5) * JITTER_FACTOR); + double jitterMultiplier = 1.0 + ((random.nextDouble() - 0.5) * jitterFactor); return (long) (delayMs * jitterMultiplier); } diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java index 720d24e..7ee2d18 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java @@ -209,14 +209,6 @@ public CompletableFuture lookupCompany( return this.rawClient.lookupCompany(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture getCompanyBillingEntity() { - return this.rawClient.getCompanyBillingEntity().thenApply(response -> response.body()); - } - - public CompletableFuture getCompanyBillingEntity(RequestOptions requestOptions) { - return this.rawClient.getCompanyBillingEntity(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture getCompanyBillingEntity( GetCompanyBillingEntityRequest request) { return this.rawClient.getCompanyBillingEntity(request).thenApply(response -> response.body()); @@ -227,15 +219,6 @@ public CompletableFuture getCompanyBillingEntit return this.rawClient.getCompanyBillingEntity(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture getBillingEntityChildSubscriptions() { - return this.rawClient.getBillingEntityChildSubscriptions().thenApply(response -> response.body()); - } - - public CompletableFuture getBillingEntityChildSubscriptions( - RequestOptions requestOptions) { - return this.rawClient.getBillingEntityChildSubscriptions(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture getBillingEntityChildSubscriptions( GetBillingEntityChildSubscriptionsRequest request) { return this.rawClient.getBillingEntityChildSubscriptions(request).thenApply(response -> response.body()); diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java index 918ac74..7685ba3 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -152,6 +152,13 @@ public CompletableFuture> listC QueryStringMapper.addQueryParameter( httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); } + if (request.getPlanVersionUnpublished().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "plan_version_unpublished", + request.getPlanVersionUnpublished().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -675,6 +682,13 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); } + if (request.getPlanVersionUnpublished().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "plan_version_unpublished", + request.getPlanVersionUnpublished().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -1164,15 +1178,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> getCompanyBillingEntity() { - return getCompanyBillingEntity(GetCompanyBillingEntityRequest.builder().build()); - } - - public CompletableFuture> getCompanyBillingEntity( - RequestOptions requestOptions) { - return getCompanyBillingEntity(GetCompanyBillingEntityRequest.builder().build(), requestOptions); - } - public CompletableFuture> getCompanyBillingEntity( GetCompanyBillingEntityRequest request) { return getCompanyBillingEntity(request, null); @@ -1183,10 +1188,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -1276,18 +1278,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> - getBillingEntityChildSubscriptions() { - return getBillingEntityChildSubscriptions( - GetBillingEntityChildSubscriptionsRequest.builder().build()); - } - - public CompletableFuture> - getBillingEntityChildSubscriptions(RequestOptions requestOptions) { - return getBillingEntityChildSubscriptions( - GetBillingEntityChildSubscriptionsRequest.builder().build(), requestOptions); - } - public CompletableFuture> getBillingEntityChildSubscriptions(GetBillingEntityChildSubscriptionsRequest request) { return getBillingEntityChildSubscriptions(request, null); @@ -1299,10 +1289,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-billing-entity-subscriptions"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java index 85fcf08..7b6fe1c 100644 --- a/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java @@ -202,14 +202,6 @@ public LookupCompanyResponse lookupCompany(LookupCompanyRequest request, Request return this.rawClient.lookupCompany(request, requestOptions).body(); } - public GetCompanyBillingEntityResponse getCompanyBillingEntity() { - return this.rawClient.getCompanyBillingEntity().body(); - } - - public GetCompanyBillingEntityResponse getCompanyBillingEntity(RequestOptions requestOptions) { - return this.rawClient.getCompanyBillingEntity(requestOptions).body(); - } - public GetCompanyBillingEntityResponse getCompanyBillingEntity(GetCompanyBillingEntityRequest request) { return this.rawClient.getCompanyBillingEntity(request).body(); } @@ -219,15 +211,6 @@ public GetCompanyBillingEntityResponse getCompanyBillingEntity( return this.rawClient.getCompanyBillingEntity(request, requestOptions).body(); } - public GetBillingEntityChildSubscriptionsResponse getBillingEntityChildSubscriptions() { - return this.rawClient.getBillingEntityChildSubscriptions().body(); - } - - public GetBillingEntityChildSubscriptionsResponse getBillingEntityChildSubscriptions( - RequestOptions requestOptions) { - return this.rawClient.getBillingEntityChildSubscriptions(requestOptions).body(); - } - public GetBillingEntityChildSubscriptionsResponse getBillingEntityChildSubscriptions( GetBillingEntityChildSubscriptionsRequest request) { return this.rawClient.getBillingEntityChildSubscriptions(request).body(); diff --git a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java index da74552..f13cbf6 100644 --- a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java @@ -146,6 +146,13 @@ public BaseSchematicHttpResponse listCompanies( QueryStringMapper.addQueryParameter( httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); } + if (request.getPlanVersionUnpublished().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "plan_version_unpublished", + request.getPlanVersionUnpublished().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -567,6 +574,13 @@ public BaseSchematicHttpResponse countCompanies( QueryStringMapper.addQueryParameter( httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); } + if (request.getPlanVersionUnpublished().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "plan_version_unpublished", + request.getPlanVersionUnpublished().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -956,15 +970,6 @@ public BaseSchematicHttpResponse lookupCompany( } } - public BaseSchematicHttpResponse getCompanyBillingEntity() { - return getCompanyBillingEntity(GetCompanyBillingEntityRequest.builder().build()); - } - - public BaseSchematicHttpResponse getCompanyBillingEntity( - RequestOptions requestOptions) { - return getCompanyBillingEntity(GetCompanyBillingEntityRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse getCompanyBillingEntity( GetCompanyBillingEntityRequest request) { return getCompanyBillingEntity(request, null); @@ -975,10 +980,7 @@ public BaseSchematicHttpResponse getCompanyBill HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-billing-entity"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1042,17 +1044,6 @@ public BaseSchematicHttpResponse getCompanyBill } } - public BaseSchematicHttpResponse getBillingEntityChildSubscriptions() { - return getBillingEntityChildSubscriptions( - GetBillingEntityChildSubscriptionsRequest.builder().build()); - } - - public BaseSchematicHttpResponse getBillingEntityChildSubscriptions( - RequestOptions requestOptions) { - return getBillingEntityChildSubscriptions( - GetBillingEntityChildSubscriptionsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse getBillingEntityChildSubscriptions( GetBillingEntityChildSubscriptionsRequest request) { return getBillingEntityChildSubscriptions(request, null); @@ -1063,10 +1054,7 @@ public BaseSchematicHttpResponse get HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-billing-entity-subscriptions"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java index 933d8b1..9bdf92a 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java @@ -45,6 +45,8 @@ public final class CountCompaniesRequest { private final Optional planVersionId; + private final Optional planVersionUnpublished; + private final Optional q; private final Optional sortOrderColumn; @@ -78,6 +80,7 @@ private CountCompaniesRequest( Optional monetizedSubscriptions, Optional planId, Optional planVersionId, + Optional planVersionUnpublished, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -99,6 +102,7 @@ private CountCompaniesRequest( this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; this.planVersionId = planVersionId; + this.planVersionUnpublished = planVersionUnpublished; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -192,6 +196,14 @@ public Optional getPlanVersionId() { return planVersionId; } + /** + * @return Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version + */ + @JsonProperty("plan_version_unpublished") + public Optional getPlanVersionUnpublished() { + return planVersionUnpublished; + } + /** * @return Search for companies by name, keys or string traits */ @@ -294,6 +306,7 @@ private boolean equalTo(CountCompaniesRequest other) { && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) + && planVersionUnpublished.equals(other.planVersionUnpublished) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -319,6 +332,7 @@ public int hashCode() { this.monetizedSubscriptions, this.planId, this.planVersionId, + this.planVersionUnpublished, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -362,6 +376,8 @@ public static final class Builder { private Optional planVersionId = Optional.empty(); + private Optional planVersionUnpublished = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -398,6 +414,7 @@ public Builder from(CountCompaniesRequest other) { monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); + planVersionUnpublished(other.getPlanVersionUnpublished()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -581,6 +598,20 @@ public Builder planVersionId(String planVersionId) { return this; } + /** + *

Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version

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

Search for companies by name, keys or string traits

*/ @@ -733,6 +764,7 @@ public CountCompaniesRequest build() { monetizedSubscriptions, planId, planVersionId, + planVersionUnpublished, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/GetBillingEntityChildSubscriptionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/GetBillingEntityChildSubscriptionsRequest.java index d2e186a..4268643 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/GetBillingEntityChildSubscriptionsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/GetBillingEntityChildSubscriptionsRequest.java @@ -9,29 +9,27 @@ 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 = GetBillingEntityChildSubscriptionsRequest.Builder.class) public final class GetBillingEntityChildSubscriptionsRequest { - private final Optional companyId; + private final String companyId; private final Map additionalProperties; - private GetBillingEntityChildSubscriptionsRequest( - Optional companyId, Map additionalProperties) { + private GetBillingEntityChildSubscriptionsRequest(String companyId, Map additionalProperties) { this.companyId = companyId; this.additionalProperties = additionalProperties; } @JsonProperty("company_id") - public Optional getCompanyId() { + public String getCompanyId() { return companyId; } @@ -61,44 +59,58 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static CompanyIdStage builder() { return new Builder(); } + public interface CompanyIdStage { + _FinalStage companyId(@NotNull String companyId); + + Builder from(GetBillingEntityChildSubscriptionsRequest other); + } + + public interface _FinalStage { + GetBillingEntityChildSubscriptionsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional companyId = Optional.empty(); + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(GetBillingEntityChildSubscriptionsRequest other) { companyId(other.getCompanyId()); return this; } - @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); + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } + @java.lang.Override public GetBillingEntityChildSubscriptionsRequest build() { return new GetBillingEntityChildSubscriptionsRequest(companyId, additionalProperties); } + @java.lang.Override public Builder additionalProperty(String key, Object value) { this.additionalProperties.put(key, value); return this; } + @java.lang.Override public Builder additionalProperties(Map additionalProperties) { this.additionalProperties.putAll(additionalProperties); return this; diff --git a/src/main/java/com/schematic/api/resources/companies/requests/GetCompanyBillingEntityRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/GetCompanyBillingEntityRequest.java index 2f99212..39bce77 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/GetCompanyBillingEntityRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/GetCompanyBillingEntityRequest.java @@ -9,28 +9,27 @@ 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 = GetCompanyBillingEntityRequest.Builder.class) public final class GetCompanyBillingEntityRequest { - private final Optional companyId; + private final String companyId; private final Map additionalProperties; - private GetCompanyBillingEntityRequest(Optional companyId, Map additionalProperties) { + private GetCompanyBillingEntityRequest(String companyId, Map additionalProperties) { this.companyId = companyId; this.additionalProperties = additionalProperties; } @JsonProperty("company_id") - public Optional getCompanyId() { + public String getCompanyId() { return companyId; } @@ -59,44 +58,58 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static CompanyIdStage builder() { return new Builder(); } + public interface CompanyIdStage { + _FinalStage companyId(@NotNull String companyId); + + Builder from(GetCompanyBillingEntityRequest other); + } + + public interface _FinalStage { + GetCompanyBillingEntityRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional companyId = Optional.empty(); + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(GetCompanyBillingEntityRequest other) { companyId(other.getCompanyId()); return this; } - @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); + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } + @java.lang.Override public GetCompanyBillingEntityRequest build() { return new GetCompanyBillingEntityRequest(companyId, additionalProperties); } + @java.lang.Override public Builder additionalProperty(String key, Object value) { this.additionalProperties.put(key, value); return this; } + @java.lang.Override public Builder additionalProperties(Map additionalProperties) { this.additionalProperties.putAll(additionalProperties); return this; diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java index 67fe63f..1216f80 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java @@ -45,6 +45,8 @@ public final class ListCompaniesRequest { private final Optional planVersionId; + private final Optional planVersionUnpublished; + private final Optional q; private final Optional sortOrderColumn; @@ -78,6 +80,7 @@ private ListCompaniesRequest( Optional monetizedSubscriptions, Optional planId, Optional planVersionId, + Optional planVersionUnpublished, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -99,6 +102,7 @@ private ListCompaniesRequest( this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; this.planVersionId = planVersionId; + this.planVersionUnpublished = planVersionUnpublished; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -192,6 +196,14 @@ public Optional getPlanVersionId() { return planVersionId; } + /** + * @return Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version + */ + @JsonProperty("plan_version_unpublished") + public Optional getPlanVersionUnpublished() { + return planVersionUnpublished; + } + /** * @return Search for companies by name, keys or string traits */ @@ -294,6 +306,7 @@ private boolean equalTo(ListCompaniesRequest other) { && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) + && planVersionUnpublished.equals(other.planVersionUnpublished) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -319,6 +332,7 @@ public int hashCode() { this.monetizedSubscriptions, this.planId, this.planVersionId, + this.planVersionUnpublished, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -362,6 +376,8 @@ public static final class Builder { private Optional planVersionId = Optional.empty(); + private Optional planVersionUnpublished = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -398,6 +414,7 @@ public Builder from(ListCompaniesRequest other) { monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); + planVersionUnpublished(other.getPlanVersionUnpublished()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -581,6 +598,20 @@ public Builder planVersionId(String planVersionId) { return this; } + /** + *

Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version

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

Search for companies by name, keys or string traits

*/ @@ -733,6 +764,7 @@ public ListCompaniesRequest build() { monetizedSubscriptions, planId, planVersionId, + planVersionUnpublished, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java index d4a60ff..3dc019a 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java @@ -44,6 +44,8 @@ public final class CountCompaniesParams { private final Optional> planVersionIds; + private final Optional planVersionUnpublished; + private final Optional q; private final Optional sortOrderColumn; @@ -77,6 +79,7 @@ private CountCompaniesParams( Optional> planIds, Optional planVersionId, Optional> planVersionIds, + Optional planVersionUnpublished, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -98,6 +101,7 @@ private CountCompaniesParams( this.planIds = planIds; this.planVersionId = planVersionId; this.planVersionIds = planVersionIds; + this.planVersionUnpublished = planVersionUnpublished; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -191,6 +195,14 @@ public Optional> getPlanVersionIds() { return planVersionIds; } + /** + * @return Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version + */ + @JsonProperty("plan_version_unpublished") + public Optional getPlanVersionUnpublished() { + return planVersionUnpublished; + } + /** * @return Search for companies by name, keys or string traits */ @@ -293,6 +305,7 @@ private boolean equalTo(CountCompaniesParams other) { && planIds.equals(other.planIds) && planVersionId.equals(other.planVersionId) && planVersionIds.equals(other.planVersionIds) + && planVersionUnpublished.equals(other.planVersionUnpublished) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -318,6 +331,7 @@ public int hashCode() { this.planIds, this.planVersionId, this.planVersionIds, + this.planVersionUnpublished, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -361,6 +375,8 @@ public static final class Builder { private Optional> planVersionIds = Optional.empty(); + private Optional planVersionUnpublished = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -397,6 +413,7 @@ public Builder from(CountCompaniesParams other) { planIds(other.getPlanIds()); planVersionId(other.getPlanVersionId()); planVersionIds(other.getPlanVersionIds()); + planVersionUnpublished(other.getPlanVersionUnpublished()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -550,6 +567,20 @@ public Builder planVersionIds(List planVersionIds) { return this; } + /** + *

Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version

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

Search for companies by name, keys or string traits

*/ @@ -702,6 +733,7 @@ public CountCompaniesParams build() { planIds, planVersionId, planVersionIds, + planVersionUnpublished, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java index 9bf973a..f2688c7 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java @@ -44,6 +44,8 @@ public final class ListCompaniesParams { private final Optional> planVersionIds; + private final Optional planVersionUnpublished; + private final Optional q; private final Optional sortOrderColumn; @@ -77,6 +79,7 @@ private ListCompaniesParams( Optional> planIds, Optional planVersionId, Optional> planVersionIds, + Optional planVersionUnpublished, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -98,6 +101,7 @@ private ListCompaniesParams( this.planIds = planIds; this.planVersionId = planVersionId; this.planVersionIds = planVersionIds; + this.planVersionUnpublished = planVersionUnpublished; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -191,6 +195,14 @@ public Optional> getPlanVersionIds() { return planVersionIds; } + /** + * @return Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version + */ + @JsonProperty("plan_version_unpublished") + public Optional getPlanVersionUnpublished() { + return planVersionUnpublished; + } + /** * @return Search for companies by name, keys or string traits */ @@ -293,6 +305,7 @@ private boolean equalTo(ListCompaniesParams other) { && planIds.equals(other.planIds) && planVersionId.equals(other.planVersionId) && planVersionIds.equals(other.planVersionIds) + && planVersionUnpublished.equals(other.planVersionUnpublished) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -318,6 +331,7 @@ public int hashCode() { this.planIds, this.planVersionId, this.planVersionIds, + this.planVersionUnpublished, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -361,6 +375,8 @@ public static final class Builder { private Optional> planVersionIds = Optional.empty(); + private Optional planVersionUnpublished = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -397,6 +413,7 @@ public Builder from(ListCompaniesParams other) { planIds(other.getPlanIds()); planVersionId(other.getPlanVersionId()); planVersionIds(other.getPlanVersionIds()); + planVersionUnpublished(other.getPlanVersionUnpublished()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -550,6 +567,20 @@ public Builder planVersionIds(List planVersionIds) { return this; } + /** + *

Filter companies assigned to a plan version that is no longer published, meaning the plan has since moved on to a newer version

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

Search for companies by name, keys or string traits

*/ @@ -702,6 +733,7 @@ public ListCompaniesParams build() { planIds, planVersionId, planVersionIds, + planVersionUnpublished, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java index 015e66d..1ee266c 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java @@ -264,14 +264,6 @@ public CompletableFuture grantBillingCredi .thenApply(response -> response.body()); } - public CompletableFuture countCompanyGrants() { - return this.rawClient.countCompanyGrants().thenApply(response -> response.body()); - } - - public CompletableFuture countCompanyGrants(RequestOptions requestOptions) { - return this.rawClient.countCompanyGrants(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture countCompanyGrants(CountCompanyGrantsRequest request) { return this.rawClient.countCompanyGrants(request).thenApply(response -> response.body()); } @@ -281,14 +273,6 @@ public CompletableFuture countCompanyGrants( return this.rawClient.countCompanyGrants(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture listCompanyGrants() { - return this.rawClient.listCompanyGrants().thenApply(response -> response.body()); - } - - public CompletableFuture listCompanyGrants(RequestOptions requestOptions) { - return this.rawClient.listCompanyGrants(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture listCompanyGrants(ListCompanyGrantsRequest request) { return this.rawClient.listCompanyGrants(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java index d792b26..3b6fc3c 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java @@ -1734,15 +1734,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> countCompanyGrants() { - return countCompanyGrants(CountCompanyGrantsRequest.builder().build()); - } - - public CompletableFuture> countCompanyGrants( - RequestOptions requestOptions) { - return countCompanyGrants(CountCompanyGrantsRequest.builder().build(), requestOptions); - } - public CompletableFuture> countCompanyGrants( CountCompanyGrantsRequest request) { return countCompanyGrants(request, null); @@ -1753,10 +1744,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants/company/count"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (request.getOrder().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "order", request.getOrder().get(), false); @@ -1860,15 +1848,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> listCompanyGrants() { - return listCompanyGrants(ListCompanyGrantsRequest.builder().build()); - } - - public CompletableFuture> listCompanyGrants( - RequestOptions requestOptions) { - return listCompanyGrants(ListCompanyGrantsRequest.builder().build(), requestOptions); - } - public CompletableFuture> listCompanyGrants( ListCompanyGrantsRequest request) { return listCompanyGrants(request, null); @@ -1879,10 +1858,7 @@ public CompletableFuture> l HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants/company/list"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (request.getOrder().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "order", request.getOrder().get(), false); diff --git a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java index f9ce4fa..8889d90 100644 --- a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java @@ -257,14 +257,6 @@ public GrantBillingCreditsToCompanyResponse grantBillingCreditsToCompany( .body(); } - public CountCompanyGrantsResponse countCompanyGrants() { - return this.rawClient.countCompanyGrants().body(); - } - - public CountCompanyGrantsResponse countCompanyGrants(RequestOptions requestOptions) { - return this.rawClient.countCompanyGrants(requestOptions).body(); - } - public CountCompanyGrantsResponse countCompanyGrants(CountCompanyGrantsRequest request) { return this.rawClient.countCompanyGrants(request).body(); } @@ -274,14 +266,6 @@ public CountCompanyGrantsResponse countCompanyGrants( return this.rawClient.countCompanyGrants(request, requestOptions).body(); } - public ListCompanyGrantsResponse listCompanyGrants() { - return this.rawClient.listCompanyGrants().body(); - } - - public ListCompanyGrantsResponse listCompanyGrants(RequestOptions requestOptions) { - return this.rawClient.listCompanyGrants(requestOptions).body(); - } - public ListCompanyGrantsResponse listCompanyGrants(ListCompanyGrantsRequest request) { return this.rawClient.listCompanyGrants(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java index d0d9daa..fd6f7ed 100644 --- a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java @@ -1348,14 +1348,6 @@ public BaseSchematicHttpResponse grantBill } } - public BaseSchematicHttpResponse countCompanyGrants() { - return countCompanyGrants(CountCompanyGrantsRequest.builder().build()); - } - - public BaseSchematicHttpResponse countCompanyGrants(RequestOptions requestOptions) { - return countCompanyGrants(CountCompanyGrantsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse countCompanyGrants(CountCompanyGrantsRequest request) { return countCompanyGrants(request, null); } @@ -1365,10 +1357,7 @@ public BaseSchematicHttpResponse countCompanyGrants( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants/company/count"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (request.getOrder().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "order", request.getOrder().get(), false); @@ -1447,14 +1436,6 @@ public BaseSchematicHttpResponse countCompanyGrants( } } - public BaseSchematicHttpResponse listCompanyGrants() { - return listCompanyGrants(ListCompanyGrantsRequest.builder().build()); - } - - public BaseSchematicHttpResponse listCompanyGrants(RequestOptions requestOptions) { - return listCompanyGrants(ListCompanyGrantsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse listCompanyGrants(ListCompanyGrantsRequest request) { return listCompanyGrants(request, null); } @@ -1464,10 +1445,7 @@ public BaseSchematicHttpResponse listCompanyGrants( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants/company/list"); - if (request.getCompanyId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "company_id", request.getCompanyId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); if (request.getOrder().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "order", request.getOrder().get(), false); diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java index 8a7a48d..104a8f9 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java @@ -18,11 +18,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountCompanyGrantsRequest.Builder.class) public final class CountCompanyGrantsRequest { - private final Optional companyId; + private final String companyId; private final Optional order; @@ -35,7 +36,7 @@ public final class CountCompanyGrantsRequest { private final Map additionalProperties; private CountCompanyGrantsRequest( - Optional companyId, + String companyId, Optional order, Optional dir, Optional limit, @@ -50,7 +51,7 @@ private CountCompanyGrantsRequest( } @JsonProperty("company_id") - public Optional getCompanyId() { + public String getCompanyId() { return companyId; } @@ -109,27 +110,64 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static CompanyIdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional companyId = Optional.empty(); + public interface CompanyIdStage { + _FinalStage companyId(@NotNull String companyId); - private Optional order = Optional.empty(); + Builder from(CountCompanyGrantsRequest other); + } - private Optional dir = Optional.empty(); + public interface _FinalStage { + CountCompanyGrantsRequest build(); - private Optional limit = Optional.empty(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage order(Optional order); + + _FinalStage order(CreditGrantSortOrder order); + + _FinalStage dir(Optional dir); + + _FinalStage dir(SortDirection dir); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; private Optional offset = Optional.empty(); + private Optional limit = Optional.empty(); + + private Optional dir = Optional.empty(); + + private Optional order = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(CountCompanyGrantsRequest other) { companyId(other.getCompanyId()); order(other.getOrder()); @@ -139,76 +177,91 @@ public Builder from(CountCompanyGrantsRequest other) { return this; } - @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; - } - - @JsonSetter(value = "order", nulls = Nulls.SKIP) - public Builder order(Optional order) { - this.order = order; + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } - public Builder order(CreditGrantSortOrder order) { - this.order = Optional.ofNullable(order); + /** + *

Page offset (default 0)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offset(Long offset) { + this.offset = Optional.ofNullable(offset); return this; } - @JsonSetter(value = "dir", nulls = Nulls.SKIP) - public Builder dir(Optional dir) { - this.dir = dir; + /** + *

Page offset (default 0)

+ */ + @java.lang.Override + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public _FinalStage offset(Optional offset) { + this.offset = offset; return this; } - public Builder dir(SortDirection dir) { - this.dir = Optional.ofNullable(dir); + /** + *

Page limit (default 100)

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

Page limit (default 100)

*/ + @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public Builder limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } - public Builder limit(Long limit) { - this.limit = Optional.ofNullable(limit); + @java.lang.Override + public _FinalStage dir(SortDirection dir) { + this.dir = Optional.ofNullable(dir); return this; } - /** - *

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; + @java.lang.Override + @JsonSetter(value = "dir", nulls = Nulls.SKIP) + public _FinalStage dir(Optional dir) { + this.dir = dir; return this; } - public Builder offset(Long offset) { - this.offset = Optional.ofNullable(offset); + @java.lang.Override + public _FinalStage order(CreditGrantSortOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; return this; } + @java.lang.Override public CountCompanyGrantsRequest build() { return new CountCompanyGrantsRequest(companyId, order, dir, limit, offset, 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/credits/requests/ListCompanyGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java index 9942d53..7fb731c 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java @@ -18,11 +18,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListCompanyGrantsRequest.Builder.class) public final class ListCompanyGrantsRequest { - private final Optional companyId; + private final String companyId; private final Optional order; @@ -35,7 +36,7 @@ public final class ListCompanyGrantsRequest { private final Map additionalProperties; private ListCompanyGrantsRequest( - Optional companyId, + String companyId, Optional order, Optional dir, Optional limit, @@ -50,7 +51,7 @@ private ListCompanyGrantsRequest( } @JsonProperty("company_id") - public Optional getCompanyId() { + public String getCompanyId() { return companyId; } @@ -109,27 +110,64 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static CompanyIdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional companyId = Optional.empty(); + public interface CompanyIdStage { + _FinalStage companyId(@NotNull String companyId); - private Optional order = Optional.empty(); + Builder from(ListCompanyGrantsRequest other); + } - private Optional dir = Optional.empty(); + public interface _FinalStage { + ListCompanyGrantsRequest build(); - private Optional limit = Optional.empty(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage order(Optional order); + + _FinalStage order(CreditGrantSortOrder order); + + _FinalStage dir(Optional dir); + + _FinalStage dir(SortDirection dir); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; private Optional offset = Optional.empty(); + private Optional limit = Optional.empty(); + + private Optional dir = Optional.empty(); + + private Optional order = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ListCompanyGrantsRequest other) { companyId(other.getCompanyId()); order(other.getOrder()); @@ -139,76 +177,91 @@ public Builder from(ListCompanyGrantsRequest other) { return this; } - @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; - } - - @JsonSetter(value = "order", nulls = Nulls.SKIP) - public Builder order(Optional order) { - this.order = order; + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } - public Builder order(CreditGrantSortOrder order) { - this.order = Optional.ofNullable(order); + /** + *

Page offset (default 0)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offset(Long offset) { + this.offset = Optional.ofNullable(offset); return this; } - @JsonSetter(value = "dir", nulls = Nulls.SKIP) - public Builder dir(Optional dir) { - this.dir = dir; + /** + *

Page offset (default 0)

+ */ + @java.lang.Override + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public _FinalStage offset(Optional offset) { + this.offset = offset; return this; } - public Builder dir(SortDirection dir) { - this.dir = Optional.ofNullable(dir); + /** + *

Page limit (default 100)

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

Page limit (default 100)

*/ + @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public Builder limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } - public Builder limit(Long limit) { - this.limit = Optional.ofNullable(limit); + @java.lang.Override + public _FinalStage dir(SortDirection dir) { + this.dir = Optional.ofNullable(dir); return this; } - /** - *

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; + @java.lang.Override + @JsonSetter(value = "dir", nulls = Nulls.SKIP) + public _FinalStage dir(Optional dir) { + this.dir = dir; return this; } - public Builder offset(Long offset) { - this.offset = Optional.ofNullable(offset); + @java.lang.Override + public _FinalStage order(CreditGrantSortOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + @java.lang.Override + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public _FinalStage order(Optional order) { + this.order = order; return this; } + @java.lang.Override public ListCompanyGrantsRequest build() { return new ListCompanyGrantsRequest(companyId, order, dir, limit, offset, 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/AsyncEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java index 735fc81..fd8f4a1 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java @@ -20,6 +20,7 @@ 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.ListFeatureUsageHistoryRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.ListPlanEntitlementsRequest; @@ -43,6 +44,7 @@ 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.ListFeatureUsageHistoryResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsersResponse; import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; @@ -183,6 +185,16 @@ public CompletableFuture listFeatureUsage( return this.rawClient.listFeatureUsage(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request) { + return this.rawClient.listFeatureUsageHistory(request).thenApply(response -> response.body()); + } + + public CompletableFuture listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request, RequestOptions requestOptions) { + return this.rawClient.listFeatureUsageHistory(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture getFeatureUsageTimeSeries( GetFeatureUsageTimeSeriesRequest request) { return this.rawClient.getFeatureUsageTimeSeries(request).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 90c32d4..edd85d0 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java @@ -33,6 +33,7 @@ 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.ListFeatureUsageHistoryRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.ListPlanEntitlementsRequest; @@ -56,6 +57,7 @@ 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.ListFeatureUsageHistoryResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsersResponse; import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; @@ -1138,6 +1140,127 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request) { + return listFeatureUsageHistory(request, null); + } + + public CompletableFuture> listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("feature-usage-history"); + QueryStringMapper.addQueryParameter(httpUrl, "end_time", request.getEndTime(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "start_time", request.getStartTime(), false); + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getCompanyIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_ids", request.getCompanyIds().get(), true); + } + if (request.getFeatureIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_ids", request.getFeatureIds().get(), true); + } + 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, ListFeatureUsageHistoryResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> getFeatureUsageTimeSeries( GetFeatureUsageTimeSeriesRequest request) { return getFeatureUsageTimeSeries(request, null); 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 fa4d7c5..3b67efc 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java @@ -20,6 +20,7 @@ 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.ListFeatureUsageHistoryRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.ListPlanEntitlementsRequest; @@ -43,6 +44,7 @@ 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.ListFeatureUsageHistoryResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsersResponse; import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; @@ -177,6 +179,15 @@ public ListFeatureUsageResponse listFeatureUsage(ListFeatureUsageRequest request return this.rawClient.listFeatureUsage(request, requestOptions).body(); } + public ListFeatureUsageHistoryResponse listFeatureUsageHistory(ListFeatureUsageHistoryRequest request) { + return this.rawClient.listFeatureUsageHistory(request).body(); + } + + public ListFeatureUsageHistoryResponse listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request, RequestOptions requestOptions) { + return this.rawClient.listFeatureUsageHistory(request, requestOptions).body(); + } + public GetFeatureUsageTimeSeriesResponse getFeatureUsageTimeSeries(GetFeatureUsageTimeSeriesRequest request) { return this.rawClient.getFeatureUsageTimeSeries(request).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 db5571a..ea94c58 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java @@ -33,6 +33,7 @@ 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.ListFeatureUsageHistoryRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.ListPlanEntitlementsRequest; @@ -56,6 +57,7 @@ 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.ListFeatureUsageHistoryResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsageResponse; import com.schematic.api.resources.entitlements.types.ListFeatureUsersResponse; import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; @@ -907,6 +909,101 @@ public BaseSchematicHttpResponse listFeatureUsage( } } + public BaseSchematicHttpResponse listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request) { + return listFeatureUsageHistory(request, null); + } + + public BaseSchematicHttpResponse listFeatureUsageHistory( + ListFeatureUsageHistoryRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("feature-usage-history"); + QueryStringMapper.addQueryParameter(httpUrl, "end_time", request.getEndTime(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "start_time", request.getStartTime(), false); + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getCompanyIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_ids", request.getCompanyIds().get(), true); + } + if (request.getFeatureIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_ids", request.getFeatureIds().get(), true); + } + 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, ListFeatureUsageHistoryResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse getFeatureUsageTimeSeries( GetFeatureUsageTimeSeriesRequest request) { return getFeatureUsageTimeSeries(request, null); diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageHistoryRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageHistoryRequest.java new file mode 100644 index 0000000..d29babe --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageHistoryRequest.java @@ -0,0 +1,409 @@ +/** + * 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 com.schematic.api.types.TimeSeriesGranularity; +import java.time.OffsetDateTime; +import java.util.Collections; +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 = ListFeatureUsageHistoryRequest.Builder.class) +public final class ListFeatureUsageHistoryRequest { + private final Optional> companyIds; + + private final Optional> featureIds; + + private final OffsetDateTime endTime; + + private final Optional granularity; + + private final OffsetDateTime startTime; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListFeatureUsageHistoryRequest( + Optional> companyIds, + Optional> featureIds, + OffsetDateTime endTime, + Optional granularity, + OffsetDateTime startTime, + Optional limit, + Optional offset, + Map additionalProperties) { + this.companyIds = companyIds; + this.featureIds = featureIds; + this.endTime = endTime; + this.granularity = granularity; + this.startTime = startTime; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + /** + * @return Restrict to these company IDs; omit for every company in the environment + */ + @JsonProperty("company_ids") + public Optional> getCompanyIds() { + return companyIds; + } + + /** + * @return Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit + */ + @JsonProperty("feature_ids") + public Optional> getFeatureIds() { + return featureIds; + } + + /** + * @return Exclusive end of the window; must fall on an hour boundary + */ + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + /** + * @return Bucket the window; omit for a single total per company and feature + */ + @JsonProperty("granularity") + public Optional getGranularity() { + return granularity; + } + + /** + * @return Inclusive start of the window; must fall on an hour boundary + */ + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeatureUsageHistoryRequest && equalTo((ListFeatureUsageHistoryRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeatureUsageHistoryRequest other) { + return companyIds.equals(other.companyIds) + && featureIds.equals(other.featureIds) + && endTime.equals(other.endTime) + && granularity.equals(other.granularity) + && startTime.equals(other.startTime) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyIds, + this.featureIds, + this.endTime, + this.granularity, + this.startTime, + this.limit, + this.offset); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EndTimeStage builder() { + return new Builder(); + } + + public interface EndTimeStage { + /** + *

Exclusive end of the window; must fall on an hour boundary

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

Inclusive start of the window; must fall on an hour boundary

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

Restrict to these company IDs; omit for every company in the environment

+ */ + _FinalStage companyIds(Optional> companyIds); + + _FinalStage companyIds(List companyIds); + + _FinalStage companyIds(String companyIds); + + /** + *

Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit

+ */ + _FinalStage featureIds(Optional> featureIds); + + _FinalStage featureIds(List featureIds); + + _FinalStage featureIds(String featureIds); + + /** + *

Bucket the window; omit for a single total per company and feature

+ */ + _FinalStage granularity(Optional granularity); + + _FinalStage granularity(TimeSeriesGranularity granularity); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EndTimeStage, StartTimeStage, _FinalStage { + private OffsetDateTime endTime; + + private OffsetDateTime startTime; + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional granularity = Optional.empty(); + + private Optional> featureIds = Optional.empty(); + + private Optional> companyIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFeatureUsageHistoryRequest other) { + companyIds(other.getCompanyIds()); + featureIds(other.getFeatureIds()); + endTime(other.getEndTime()); + granularity(other.getGranularity()); + startTime(other.getStartTime()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + /** + *

Exclusive end of the window; must fall on an hour boundary

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

Inclusive start of the window; must fall on an hour boundary

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

Page offset (default 0)

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

Page offset (default 0)

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

Page limit (default 100)

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

Page limit (default 100)

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

Bucket the window; omit for a single total per company and feature

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

Bucket the window; omit for a single total per company and feature

+ */ + @java.lang.Override + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public _FinalStage granularity(Optional granularity) { + this.granularity = granularity; + return this; + } + + @java.lang.Override + public _FinalStage featureIds(String featureIds) { + this.featureIds = Optional.of(Collections.singletonList(featureIds)); + return this; + } + + /** + *

Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit

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

Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit

+ */ + @java.lang.Override + @JsonSetter(value = "feature_ids", nulls = Nulls.SKIP) + public _FinalStage featureIds(Optional> featureIds) { + this.featureIds = featureIds; + return this; + } + + @java.lang.Override + public _FinalStage companyIds(String companyIds) { + this.companyIds = Optional.of(Collections.singletonList(companyIds)); + return this; + } + + /** + *

Restrict to these company IDs; omit for every company in the environment

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

Restrict to these company IDs; omit for every company in the environment

+ */ + @java.lang.Override + @JsonSetter(value = "company_ids", nulls = Nulls.SKIP) + public _FinalStage companyIds(Optional> companyIds) { + this.companyIds = companyIds; + return this; + } + + @java.lang.Override + public ListFeatureUsageHistoryRequest build() { + return new ListFeatureUsageHistoryRequest( + companyIds, featureIds, endTime, granularity, startTime, limit, offset, 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/ListFeatureUsageHistoryParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageHistoryParams.java new file mode 100644 index 0000000..04f8f7a --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageHistoryParams.java @@ -0,0 +1,304 @@ +/** + * 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 com.schematic.api.types.TimeSeriesGranularity; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListFeatureUsageHistoryParams.Builder.class) +public final class ListFeatureUsageHistoryParams { + private final Optional> companyIds; + + private final Optional endTime; + + private final Optional> featureIds; + + private final Optional granularity; + + private final Optional limit; + + private final Optional offset; + + private final Optional startTime; + + private final Map additionalProperties; + + private ListFeatureUsageHistoryParams( + Optional> companyIds, + Optional endTime, + Optional> featureIds, + Optional granularity, + Optional limit, + Optional offset, + Optional startTime, + Map additionalProperties) { + this.companyIds = companyIds; + this.endTime = endTime; + this.featureIds = featureIds; + this.granularity = granularity; + this.limit = limit; + this.offset = offset; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + /** + * @return Restrict to these company IDs; omit for every company in the environment + */ + @JsonProperty("company_ids") + public Optional> getCompanyIds() { + return companyIds; + } + + /** + * @return Exclusive end of the window; must fall on an hour boundary + */ + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + /** + * @return Restrict to these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit + */ + @JsonProperty("feature_ids") + public Optional> getFeatureIds() { + return featureIds; + } + + /** + * @return Bucket the window; omit for a single total per company and feature + */ + @JsonProperty("granularity") + public Optional getGranularity() { + return granularity; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return Inclusive start of the window; must fall on an hour boundary + */ + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeatureUsageHistoryParams && equalTo((ListFeatureUsageHistoryParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeatureUsageHistoryParams other) { + return companyIds.equals(other.companyIds) + && endTime.equals(other.endTime) + && featureIds.equals(other.featureIds) + && granularity.equals(other.granularity) + && limit.equals(other.limit) + && offset.equals(other.offset) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyIds, + this.endTime, + this.featureIds, + this.granularity, + this.limit, + this.offset, + 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> companyIds = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional> featureIds = Optional.empty(); + + private Optional granularity = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional startTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListFeatureUsageHistoryParams other) { + companyIds(other.getCompanyIds()); + endTime(other.getEndTime()); + featureIds(other.getFeatureIds()); + granularity(other.getGranularity()); + limit(other.getLimit()); + offset(other.getOffset()); + startTime(other.getStartTime()); + return this; + } + + /** + *

Restrict to these company IDs; omit for every company in the environment

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

Exclusive end of the window; must fall on an hour boundary

+ */ + @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 these event features; omit for every event feature in the environment. Where several features measure the same event, each is reported separately and a page may carry more rows than the requested limit

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

Bucket the window; omit for a single total per company and feature

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

Page limit (default 100)

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

Page offset (default 0)

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

Inclusive start of the window; must fall on an hour boundary

+ */ + @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 ListFeatureUsageHistoryParams build() { + return new ListFeatureUsageHistoryParams( + companyIds, endTime, featureIds, granularity, limit, offset, 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/ListFeatureUsageHistoryResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageHistoryResponse.java new file mode 100644 index 0000000..e20e1e2 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageHistoryResponse.java @@ -0,0 +1,176 @@ +/** + * 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 com.schematic.api.types.FeatureUsageHistoryResponseData; +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 = ListFeatureUsageHistoryResponse.Builder.class) +public final class ListFeatureUsageHistoryResponse { + private final List data; + + private final ListFeatureUsageHistoryParams params; + + private final Map additionalProperties; + + private ListFeatureUsageHistoryResponse( + List data, + ListFeatureUsageHistoryParams params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public ListFeatureUsageHistoryParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListFeatureUsageHistoryResponse && equalTo((ListFeatureUsageHistoryResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListFeatureUsageHistoryResponse 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 ParamsStage builder() { + return new Builder(); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull ListFeatureUsageHistoryParams params); + + Builder from(ListFeatureUsageHistoryResponse other); + } + + public interface _FinalStage { + ListFeatureUsageHistoryResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(FeatureUsageHistoryResponseData data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ParamsStage, _FinalStage { + private ListFeatureUsageHistoryParams params; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListFeatureUsageHistoryResponse other) { + data(other.getData()); + params(other.getParams()); + 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 ListFeatureUsageHistoryParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(FeatureUsageHistoryResponseData data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListFeatureUsageHistoryResponse build() { + return new ListFeatureUsageHistoryResponse(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/planbundle/requests/CreateCustomPlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java index 368c067..b15dd81 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java @@ -22,25 +22,26 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateCustomPlanBundleRequestBody.Builder.class) public final class CreateCustomPlanBundleRequestBody { - private final Optional billingProduct; + private final UpsertBillingProductRequestBody billingProduct; private final Optional> creditGrants; private final List entitlements; - private final Optional plan; + private final CreateCustomPlanBundlePlanRequestBody plan; private final Map additionalProperties; private CreateCustomPlanBundleRequestBody( - Optional billingProduct, + UpsertBillingProductRequestBody billingProduct, Optional> creditGrants, List entitlements, - Optional plan, + CreateCustomPlanBundlePlanRequestBody plan, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; @@ -50,7 +51,7 @@ private CreateCustomPlanBundleRequestBody( } @JsonProperty("billing_product") - public Optional getBillingProduct() { + public UpsertBillingProductRequestBody getBillingProduct() { return billingProduct; } @@ -65,7 +66,7 @@ public List getEntitlements() { } @JsonProperty("plan") - public Optional getPlan() { + public CreateCustomPlanBundlePlanRequestBody getPlan() { return plan; } @@ -97,25 +98,54 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static BillingProductStage builder() { return new Builder(); } + public interface BillingProductStage { + PlanStage billingProduct(@NotNull UpsertBillingProductRequestBody billingProduct); + + Builder from(CreateCustomPlanBundleRequestBody other); + } + + public interface PlanStage { + _FinalStage plan(@NotNull CreateCustomPlanBundlePlanRequestBody plan); + } + + public interface _FinalStage { + CreateCustomPlanBundleRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage creditGrants(Optional> creditGrants); + + _FinalStage creditGrants(List creditGrants); + + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements); + + _FinalStage addAllEntitlements(List entitlements); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional billingProduct = Optional.empty(); + public static final class Builder implements BillingProductStage, PlanStage, _FinalStage { + private UpsertBillingProductRequestBody billingProduct; - private Optional> creditGrants = Optional.empty(); + private CreateCustomPlanBundlePlanRequestBody plan; private List entitlements = new ArrayList<>(); - private Optional plan = Optional.empty(); + private Optional> creditGrants = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(CreateCustomPlanBundleRequestBody other) { billingProduct(other.getBillingProduct()); creditGrants(other.getCreditGrants()); @@ -124,70 +154,70 @@ public Builder from(CreateCustomPlanBundleRequestBody other) { return this; } - @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) - public Builder billingProduct(Optional billingProduct) { - this.billingProduct = billingProduct; + @java.lang.Override + @JsonSetter("billing_product") + public PlanStage billingProduct(@NotNull UpsertBillingProductRequestBody billingProduct) { + this.billingProduct = Objects.requireNonNull(billingProduct, "billingProduct must not be null"); return this; } - public Builder billingProduct(UpsertBillingProductRequestBody billingProduct) { - this.billingProduct = Optional.ofNullable(billingProduct); + @java.lang.Override + @JsonSetter("plan") + public _FinalStage plan(@NotNull CreateCustomPlanBundlePlanRequestBody plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); return this; } - @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) - public Builder creditGrants(Optional> creditGrants) { - this.creditGrants = creditGrants; - return this; - } - - public Builder creditGrants(List creditGrants) { - this.creditGrants = Optional.ofNullable(creditGrants); - return this; - } - - @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) - public Builder entitlements(List entitlements) { - this.entitlements.clear(); + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { if (entitlements != null) { this.entitlements.addAll(entitlements); } return this; } - public Builder addEntitlements(PlanBundleEntitlementRequestBody entitlements) { + @java.lang.Override + public _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements) { this.entitlements.add(entitlements); return this; } - public Builder addAllEntitlements(List entitlements) { + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(List entitlements) { + this.entitlements.clear(); if (entitlements != null) { this.entitlements.addAll(entitlements); } return this; } - @JsonSetter(value = "plan", nulls = Nulls.SKIP) - public Builder plan(Optional plan) { - this.plan = plan; + @java.lang.Override + public _FinalStage creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); return this; } - public Builder plan(CreateCustomPlanBundlePlanRequestBody plan) { - this.plan = Optional.ofNullable(plan); + @java.lang.Override + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public _FinalStage creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; return this; } + @java.lang.Override public CreateCustomPlanBundleRequestBody build() { return new CreateCustomPlanBundleRequestBody( billingProduct, creditGrants, entitlements, plan, 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/planbundle/requests/CreatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java index f6465d4..791cc5a 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreatePlanBundleRequestBody.Builder.class) @@ -32,7 +33,7 @@ public final class CreatePlanBundleRequestBody { private final List entitlements; - private final Optional plan; + private final CreatePlanRequestBody plan; private final Map additionalProperties; @@ -40,7 +41,7 @@ private CreatePlanBundleRequestBody( Optional billingProduct, Optional> creditGrants, List entitlements, - Optional plan, + CreatePlanRequestBody plan, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; @@ -65,7 +66,7 @@ public List getEntitlements() { } @JsonProperty("plan") - public Optional getPlan() { + public CreatePlanRequestBody getPlan() { return plan; } @@ -97,25 +98,54 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static PlanStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional billingProduct = Optional.empty(); + public interface PlanStage { + _FinalStage plan(@NotNull CreatePlanRequestBody plan); - private Optional> creditGrants = Optional.empty(); + Builder from(CreatePlanBundleRequestBody other); + } + + public interface _FinalStage { + CreatePlanBundleRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingProduct(Optional billingProduct); + + _FinalStage billingProduct(UpsertBillingProductRequestBody billingProduct); + + _FinalStage creditGrants(Optional> creditGrants); + + _FinalStage creditGrants(List creditGrants); + + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements); + + _FinalStage addAllEntitlements(List entitlements); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanStage, _FinalStage { + private CreatePlanRequestBody plan; private List entitlements = new ArrayList<>(); - private Optional plan = Optional.empty(); + private Optional> creditGrants = Optional.empty(); + + private Optional billingProduct = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(CreatePlanBundleRequestBody other) { billingProduct(other.getBillingProduct()); creditGrants(other.getCreditGrants()); @@ -124,30 +154,30 @@ public Builder from(CreatePlanBundleRequestBody other) { return this; } - @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) - public Builder billingProduct(Optional billingProduct) { - this.billingProduct = billingProduct; + @java.lang.Override + @JsonSetter("plan") + public _FinalStage plan(@NotNull CreatePlanRequestBody plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); return this; } - public Builder billingProduct(UpsertBillingProductRequestBody billingProduct) { - this.billingProduct = Optional.ofNullable(billingProduct); - return this; - } - - @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) - public Builder creditGrants(Optional> creditGrants) { - this.creditGrants = creditGrants; + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } return this; } - public Builder creditGrants(List creditGrants) { - this.creditGrants = Optional.ofNullable(creditGrants); + @java.lang.Override + public _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements) { + this.entitlements.add(entitlements); return this; } + @java.lang.Override @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) - public Builder entitlements(List entitlements) { + public _FinalStage entitlements(List entitlements) { this.entitlements.clear(); if (entitlements != null) { this.entitlements.addAll(entitlements); @@ -155,39 +185,45 @@ public Builder entitlements(List entitlements) return this; } - public Builder addEntitlements(PlanBundleEntitlementRequestBody entitlements) { - this.entitlements.add(entitlements); + @java.lang.Override + public _FinalStage creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); return this; } - public Builder addAllEntitlements(List entitlements) { - if (entitlements != null) { - this.entitlements.addAll(entitlements); - } + @java.lang.Override + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public _FinalStage creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; return this; } - @JsonSetter(value = "plan", nulls = Nulls.SKIP) - public Builder plan(Optional plan) { - this.plan = plan; + @java.lang.Override + public _FinalStage billingProduct(UpsertBillingProductRequestBody billingProduct) { + this.billingProduct = Optional.ofNullable(billingProduct); return this; } - public Builder plan(CreatePlanRequestBody plan) { - this.plan = Optional.ofNullable(plan); + @java.lang.Override + @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) + public _FinalStage billingProduct(Optional billingProduct) { + this.billingProduct = billingProduct; return this; } + @java.lang.Override public CreatePlanBundleRequestBody build() { return new CreatePlanBundleRequestBody( billingProduct, creditGrants, entitlements, plan, 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/planbundle/requests/UpdatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java index c711040..2369e6a 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpdatePlanBundleRequestBody.Builder.class) @@ -32,7 +33,7 @@ public final class UpdatePlanBundleRequestBody { private final List entitlements; - private final Optional plan; + private final UpdatePlanRequestBody plan; private final Optional planVersionId; @@ -42,7 +43,7 @@ private UpdatePlanBundleRequestBody( Optional billingProduct, Optional> creditGrants, List entitlements, - Optional plan, + UpdatePlanRequestBody plan, Optional planVersionId, Map additionalProperties) { this.billingProduct = billingProduct; @@ -69,7 +70,7 @@ public List getEntitlements() { } @JsonProperty("plan") - public Optional getPlan() { + public UpdatePlanRequestBody getPlan() { return plan; } @@ -107,27 +108,60 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static PlanStage builder() { return new Builder(); } + public interface PlanStage { + _FinalStage plan(@NotNull UpdatePlanRequestBody plan); + + Builder from(UpdatePlanBundleRequestBody other); + } + + public interface _FinalStage { + UpdatePlanBundleRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingProduct(Optional billingProduct); + + _FinalStage billingProduct(UpsertBillingProductRequestBody billingProduct); + + _FinalStage creditGrants(Optional> creditGrants); + + _FinalStage creditGrants(List creditGrants); + + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements); + + _FinalStage addAllEntitlements(List entitlements); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional billingProduct = Optional.empty(); + public static final class Builder implements PlanStage, _FinalStage { + private UpdatePlanRequestBody plan; - private Optional> creditGrants = Optional.empty(); + private Optional planVersionId = Optional.empty(); private List entitlements = new ArrayList<>(); - private Optional plan = Optional.empty(); + private Optional> creditGrants = Optional.empty(); - private Optional planVersionId = Optional.empty(); + private Optional billingProduct = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(UpdatePlanBundleRequestBody other) { billingProduct(other.getBillingProduct()); creditGrants(other.getCreditGrants()); @@ -137,81 +171,89 @@ public Builder from(UpdatePlanBundleRequestBody other) { return this; } - @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) - public Builder billingProduct(Optional billingProduct) { - this.billingProduct = billingProduct; + @java.lang.Override + @JsonSetter("plan") + public _FinalStage plan(@NotNull UpdatePlanRequestBody plan) { + this.plan = Objects.requireNonNull(plan, "plan must not be null"); return this; } - public Builder billingProduct(UpsertBillingProductRequestBody billingProduct) { - this.billingProduct = Optional.ofNullable(billingProduct); - return this; - } - - @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) - public Builder creditGrants(Optional> creditGrants) { - this.creditGrants = creditGrants; + @java.lang.Override + public _FinalStage planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); return this; } - public Builder creditGrants(List creditGrants) { - this.creditGrants = Optional.ofNullable(creditGrants); + @java.lang.Override + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public _FinalStage planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; return this; } - @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) - public Builder entitlements(List entitlements) { - this.entitlements.clear(); + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { if (entitlements != null) { this.entitlements.addAll(entitlements); } return this; } - public Builder addEntitlements(PlanBundleEntitlementRequestBody entitlements) { + @java.lang.Override + public _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements) { this.entitlements.add(entitlements); return this; } - public Builder addAllEntitlements(List entitlements) { + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(List entitlements) { + this.entitlements.clear(); if (entitlements != null) { this.entitlements.addAll(entitlements); } return this; } - @JsonSetter(value = "plan", nulls = Nulls.SKIP) - public Builder plan(Optional plan) { - this.plan = plan; + @java.lang.Override + public _FinalStage creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); return this; } - public Builder plan(UpdatePlanRequestBody plan) { - this.plan = Optional.ofNullable(plan); + @java.lang.Override + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public _FinalStage creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; return this; } - @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) - public Builder planVersionId(Optional planVersionId) { - this.planVersionId = planVersionId; + @java.lang.Override + public _FinalStage billingProduct(UpsertBillingProductRequestBody billingProduct) { + this.billingProduct = Optional.ofNullable(billingProduct); return this; } - public Builder planVersionId(String planVersionId) { - this.planVersionId = Optional.ofNullable(planVersionId); + @java.lang.Override + @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) + public _FinalStage billingProduct(Optional billingProduct) { + this.billingProduct = billingProduct; return this; } + @java.lang.Override public UpdatePlanBundleRequestBody build() { return new UpdatePlanBundleRequestBody( billingProduct, creditGrants, entitlements, plan, planVersionId, 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/plangroups/requests/CreatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java index c8eb487..4220643 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java @@ -35,7 +35,7 @@ public final class CreatePlanGroupRequestBody { private final List addOnIds; - private final CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; + private final Optional checkoutBundlePurchaseBehavior; private final boolean checkoutCollectAddress; @@ -112,7 +112,7 @@ public final class CreatePlanGroupRequestBody { private CreatePlanGroupRequestBody( Optional> addOnCompatibilities, List addOnIds, - CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior, + Optional checkoutBundlePurchaseBehavior, boolean checkoutCollectAddress, boolean checkoutCollectEmail, boolean checkoutCollectPhone, @@ -204,7 +204,7 @@ public List getAddOnIds() { } @JsonProperty("checkout_bundle_purchase_behavior") - public CheckoutBundlePurchaseBehavior getCheckoutBundlePurchaseBehavior() { + public Optional getCheckoutBundlePurchaseBehavior() { return checkoutBundlePurchaseBehavior; } @@ -483,19 +483,14 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CheckoutBundlePurchaseBehaviorStage builder() { + public static CheckoutCollectAddressStage builder() { return new Builder(); } - public interface CheckoutBundlePurchaseBehaviorStage { - CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( - @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior); - - Builder from(CreatePlanGroupRequestBody other); - } - public interface CheckoutCollectAddressStage { CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress); + + Builder from(CreatePlanGroupRequestBody other); } public interface CheckoutCollectEmailStage { @@ -578,6 +573,11 @@ public interface _FinalStage { _FinalStage addAllAddOnIds(List addOnIds); + _FinalStage checkoutBundlePurchaseBehavior( + Optional checkoutBundlePurchaseBehavior); + + _FinalStage checkoutBundlePurchaseBehavior(CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior); + _FinalStage customCheckoutFields(Optional> customCheckoutFields); _FinalStage customCheckoutFields(List customCheckoutFields); @@ -663,8 +663,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CheckoutBundlePurchaseBehaviorStage, - CheckoutCollectAddressStage, + implements CheckoutCollectAddressStage, CheckoutCollectEmailStage, CheckoutCollectPhoneStage, CheckoutCollectTaxIdStage, @@ -681,8 +680,6 @@ public static final class Builder ShowZeroPriceAsFreeStage, SyncCustomerBillingDetailsStage, _FinalStage { - private CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; - private boolean checkoutCollectAddress; private boolean checkoutCollectEmail; @@ -753,6 +750,8 @@ public static final class Builder private Optional> customCheckoutFields = Optional.empty(); + private Optional checkoutBundlePurchaseBehavior = Optional.empty(); + private List addOnIds = new ArrayList<>(); private Optional> addOnCompatibilities = Optional.empty(); @@ -805,15 +804,6 @@ public Builder from(CreatePlanGroupRequestBody other) { return this; } - @java.lang.Override - @JsonSetter("checkout_bundle_purchase_behavior") - public CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( - @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior) { - this.checkoutBundlePurchaseBehavior = Objects.requireNonNull( - checkoutBundlePurchaseBehavior, "checkoutBundlePurchaseBehavior must not be null"); - return this; - } - @java.lang.Override @JsonSetter("checkout_collect_address") public CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress) { @@ -1209,6 +1199,21 @@ public _FinalStage customCheckoutFields(Optional> custo return this; } + @java.lang.Override + public _FinalStage checkoutBundlePurchaseBehavior( + CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior) { + this.checkoutBundlePurchaseBehavior = Optional.ofNullable(checkoutBundlePurchaseBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "checkout_bundle_purchase_behavior", nulls = Nulls.SKIP) + public _FinalStage checkoutBundlePurchaseBehavior( + Optional checkoutBundlePurchaseBehavior) { + this.checkoutBundlePurchaseBehavior = checkoutBundlePurchaseBehavior; + return this; + } + /** *

Use OrderedAddOns instead

* @return Reference to {@code this} so that method calls can be chained together. diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java index f265cb3..116528f 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java @@ -35,7 +35,7 @@ public final class UpdatePlanGroupRequestBody { private final List addOnIds; - private final CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; + private final Optional checkoutBundlePurchaseBehavior; private final boolean checkoutCollectAddress; @@ -112,7 +112,7 @@ public final class UpdatePlanGroupRequestBody { private UpdatePlanGroupRequestBody( Optional> addOnCompatibilities, List addOnIds, - CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior, + Optional checkoutBundlePurchaseBehavior, boolean checkoutCollectAddress, boolean checkoutCollectEmail, boolean checkoutCollectPhone, @@ -204,7 +204,7 @@ public List getAddOnIds() { } @JsonProperty("checkout_bundle_purchase_behavior") - public CheckoutBundlePurchaseBehavior getCheckoutBundlePurchaseBehavior() { + public Optional getCheckoutBundlePurchaseBehavior() { return checkoutBundlePurchaseBehavior; } @@ -483,19 +483,14 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CheckoutBundlePurchaseBehaviorStage builder() { + public static CheckoutCollectAddressStage builder() { return new Builder(); } - public interface CheckoutBundlePurchaseBehaviorStage { - CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( - @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior); - - Builder from(UpdatePlanGroupRequestBody other); - } - public interface CheckoutCollectAddressStage { CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress); + + Builder from(UpdatePlanGroupRequestBody other); } public interface CheckoutCollectEmailStage { @@ -578,6 +573,11 @@ public interface _FinalStage { _FinalStage addAllAddOnIds(List addOnIds); + _FinalStage checkoutBundlePurchaseBehavior( + Optional checkoutBundlePurchaseBehavior); + + _FinalStage checkoutBundlePurchaseBehavior(CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior); + _FinalStage customCheckoutFields(Optional> customCheckoutFields); _FinalStage customCheckoutFields(List customCheckoutFields); @@ -663,8 +663,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CheckoutBundlePurchaseBehaviorStage, - CheckoutCollectAddressStage, + implements CheckoutCollectAddressStage, CheckoutCollectEmailStage, CheckoutCollectPhoneStage, CheckoutCollectTaxIdStage, @@ -681,8 +680,6 @@ public static final class Builder ShowZeroPriceAsFreeStage, SyncCustomerBillingDetailsStage, _FinalStage { - private CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior; - private boolean checkoutCollectAddress; private boolean checkoutCollectEmail; @@ -753,6 +750,8 @@ public static final class Builder private Optional> customCheckoutFields = Optional.empty(); + private Optional checkoutBundlePurchaseBehavior = Optional.empty(); + private List addOnIds = new ArrayList<>(); private Optional> addOnCompatibilities = Optional.empty(); @@ -805,15 +804,6 @@ public Builder from(UpdatePlanGroupRequestBody other) { return this; } - @java.lang.Override - @JsonSetter("checkout_bundle_purchase_behavior") - public CheckoutCollectAddressStage checkoutBundlePurchaseBehavior( - @NotNull CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior) { - this.checkoutBundlePurchaseBehavior = Objects.requireNonNull( - checkoutBundlePurchaseBehavior, "checkoutBundlePurchaseBehavior must not be null"); - return this; - } - @java.lang.Override @JsonSetter("checkout_collect_address") public CheckoutCollectEmailStage checkoutCollectAddress(boolean checkoutCollectAddress) { @@ -1209,6 +1199,21 @@ public _FinalStage customCheckoutFields(Optional> custo return this; } + @java.lang.Override + public _FinalStage checkoutBundlePurchaseBehavior( + CheckoutBundlePurchaseBehavior checkoutBundlePurchaseBehavior) { + this.checkoutBundlePurchaseBehavior = Optional.ofNullable(checkoutBundlePurchaseBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "checkout_bundle_purchase_behavior", nulls = Nulls.SKIP) + public _FinalStage checkoutBundlePurchaseBehavior( + Optional checkoutBundlePurchaseBehavior) { + this.checkoutBundlePurchaseBehavior = checkoutBundlePurchaseBehavior; + return this; + } + /** *

Use OrderedAddOns instead

* @return Reference to {@code this} so that method calls can be chained together. diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java index 18c38ba..e05e895 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java @@ -40,14 +40,6 @@ public AsyncRawPlanmigrationsClient withRawResponse() { return this.rawClient; } - public CompletableFuture listCompanyMigrations() { - return this.rawClient.listCompanyMigrations().thenApply(response -> response.body()); - } - - public CompletableFuture listCompanyMigrations(RequestOptions requestOptions) { - return this.rawClient.listCompanyMigrations(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture listCompanyMigrations( ListCompanyMigrationsRequest request) { return this.rawClient.listCompanyMigrations(request).thenApply(response -> response.body()); @@ -72,14 +64,6 @@ public CompletableFuture retryCompanyMigration( .thenApply(response -> response.body()); } - public CompletableFuture countCompanyMigrations() { - return this.rawClient.countCompanyMigrations().thenApply(response -> response.body()); - } - - public CompletableFuture countCompanyMigrations(RequestOptions requestOptions) { - return this.rawClient.countCompanyMigrations(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture countCompanyMigrations( CountCompanyMigrationsRequest request) { return this.rawClient.countCompanyMigrations(request).thenApply(response -> response.body()); @@ -90,14 +74,6 @@ public CompletableFuture countCompanyMigrations( return this.rawClient.countCompanyMigrations(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture listMigrations() { - return this.rawClient.listMigrations().thenApply(response -> response.body()); - } - - public CompletableFuture listMigrations(RequestOptions requestOptions) { - return this.rawClient.listMigrations(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture listMigrations(ListMigrationsRequest request) { return this.rawClient.listMigrations(request).thenApply(response -> response.body()); } @@ -139,14 +115,6 @@ public CompletableFuture retryMigration( .thenApply(response -> response.body()); } - public CompletableFuture countMigrations() { - return this.rawClient.countMigrations().thenApply(response -> response.body()); - } - - public CompletableFuture countMigrations(RequestOptions requestOptions) { - return this.rawClient.countMigrations(requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture countMigrations(CountMigrationsRequest request) { return this.rawClient.countMigrations(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java index 3bd7f09..ed371d9 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java @@ -55,15 +55,6 @@ public AsyncRawPlanmigrationsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public CompletableFuture> listCompanyMigrations() { - return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build()); - } - - public CompletableFuture> listCompanyMigrations( - RequestOptions requestOptions) { - return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build(), requestOptions); - } - public CompletableFuture> listCompanyMigrations( ListCompanyMigrationsRequest request) { return listCompanyMigrations(request, null); @@ -74,10 +65,7 @@ public CompletableFuture> countCompanyMigrations() { - return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build()); - } - - public CompletableFuture> countCompanyMigrations( - RequestOptions requestOptions) { - return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build(), requestOptions); - } - public CompletableFuture> countCompanyMigrations( CountCompanyMigrationsRequest request) { return countCompanyMigrations(request, null); @@ -300,10 +279,7 @@ public CompletableFuture> listMigrations() { - return listMigrations(ListMigrationsRequest.builder().build()); - } - - public CompletableFuture> listMigrations( - RequestOptions requestOptions) { - return listMigrations(ListMigrationsRequest.builder().build(), requestOptions); - } - public CompletableFuture> listMigrations( ListMigrationsRequest request) { return listMigrations(request, null); @@ -426,10 +393,7 @@ public CompletableFuture> list HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations"); - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "plan_version_id", request.getPlanVersionId(), false); if (request.getStatus().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "status", request.getStatus().get(), false); @@ -834,15 +798,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> countMigrations() { - return countMigrations(CountMigrationsRequest.builder().build()); - } - - public CompletableFuture> countMigrations( - RequestOptions requestOptions) { - return countMigrations(CountMigrationsRequest.builder().build(), requestOptions); - } - public CompletableFuture> countMigrations( CountMigrationsRequest request) { return countMigrations(request, null); @@ -853,10 +808,7 @@ public CompletableFuture> cou HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations/count"); - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "plan_version_id", request.getPlanVersionId(), false); if (request.getStatus().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "status", request.getStatus().get(), false); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java index b5917b5..0773063 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java @@ -39,14 +39,6 @@ public RawPlanmigrationsClient withRawResponse() { return this.rawClient; } - public ListCompanyMigrationsResponse listCompanyMigrations() { - return this.rawClient.listCompanyMigrations().body(); - } - - public ListCompanyMigrationsResponse listCompanyMigrations(RequestOptions requestOptions) { - return this.rawClient.listCompanyMigrations(requestOptions).body(); - } - public ListCompanyMigrationsResponse listCompanyMigrations(ListCompanyMigrationsRequest request) { return this.rawClient.listCompanyMigrations(request).body(); } @@ -69,14 +61,6 @@ public RetryCompanyMigrationResponse retryCompanyMigration( .body(); } - public CountCompanyMigrationsResponse countCompanyMigrations() { - return this.rawClient.countCompanyMigrations().body(); - } - - public CountCompanyMigrationsResponse countCompanyMigrations(RequestOptions requestOptions) { - return this.rawClient.countCompanyMigrations(requestOptions).body(); - } - public CountCompanyMigrationsResponse countCompanyMigrations(CountCompanyMigrationsRequest request) { return this.rawClient.countCompanyMigrations(request).body(); } @@ -86,14 +70,6 @@ public CountCompanyMigrationsResponse countCompanyMigrations( return this.rawClient.countCompanyMigrations(request, requestOptions).body(); } - public ListMigrationsResponse listMigrations() { - return this.rawClient.listMigrations().body(); - } - - public ListMigrationsResponse listMigrations(RequestOptions requestOptions) { - return this.rawClient.listMigrations(requestOptions).body(); - } - public ListMigrationsResponse listMigrations(ListMigrationsRequest request) { return this.rawClient.listMigrations(request).body(); } @@ -131,14 +107,6 @@ public RetryMigrationResponse retryMigration( .body(); } - public CountMigrationsResponse countMigrations() { - return this.rawClient.countMigrations().body(); - } - - public CountMigrationsResponse countMigrations(RequestOptions requestOptions) { - return this.rawClient.countMigrations(requestOptions).body(); - } - public CountMigrationsResponse countMigrations(CountMigrationsRequest request) { return this.rawClient.countMigrations(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java index 64bbeab..8eb193d 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java @@ -51,15 +51,6 @@ public RawPlanmigrationsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - public BaseSchematicHttpResponse listCompanyMigrations() { - return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build()); - } - - public BaseSchematicHttpResponse listCompanyMigrations( - RequestOptions requestOptions) { - return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse listCompanyMigrations( ListCompanyMigrationsRequest request) { return listCompanyMigrations(request, null); @@ -70,10 +61,7 @@ public BaseSchematicHttpResponse listCompanyMigra HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-company-migrations"); - if (request.getMigrationId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "migration_id", request.getMigrationId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "migration_id", request.getMigrationId(), false); if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -227,15 +215,6 @@ public BaseSchematicHttpResponse retryCompanyMigr } } - public BaseSchematicHttpResponse countCompanyMigrations() { - return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build()); - } - - public BaseSchematicHttpResponse countCompanyMigrations( - RequestOptions requestOptions) { - return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse countCompanyMigrations( CountCompanyMigrationsRequest request) { return countCompanyMigrations(request, null); @@ -246,10 +225,7 @@ public BaseSchematicHttpResponse countCompanyMig HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-company-migrations/count"); - if (request.getMigrationId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "migration_id", request.getMigrationId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "migration_id", request.getMigrationId(), false); if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -328,14 +304,6 @@ public BaseSchematicHttpResponse countCompanyMig } } - public BaseSchematicHttpResponse listMigrations() { - return listMigrations(ListMigrationsRequest.builder().build()); - } - - public BaseSchematicHttpResponse listMigrations(RequestOptions requestOptions) { - return listMigrations(ListMigrationsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse listMigrations(ListMigrationsRequest request) { return listMigrations(request, null); } @@ -345,10 +313,7 @@ public BaseSchematicHttpResponse listMigrations( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations"); - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "plan_version_id", request.getPlanVersionId(), false); if (request.getStatus().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "status", request.getStatus().get(), false); @@ -656,14 +621,6 @@ public BaseSchematicHttpResponse retryMigration( } } - public BaseSchematicHttpResponse countMigrations() { - return countMigrations(CountMigrationsRequest.builder().build()); - } - - public BaseSchematicHttpResponse countMigrations(RequestOptions requestOptions) { - return countMigrations(CountMigrationsRequest.builder().build(), requestOptions); - } - public BaseSchematicHttpResponse countMigrations(CountMigrationsRequest request) { return countMigrations(request, null); } @@ -673,10 +630,7 @@ public BaseSchematicHttpResponse countMigrations( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations/count"); - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "plan_version_id", request.getPlanVersionId(), false); if (request.getStatus().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "status", request.getStatus().get(), false); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java index 91d85ff..4d940cd 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java @@ -17,11 +17,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountCompanyMigrationsRequest.Builder.class) public final class CountCompanyMigrationsRequest { - private final Optional migrationId; + private final String migrationId; private final Optional q; @@ -34,7 +35,7 @@ public final class CountCompanyMigrationsRequest { private final Map additionalProperties; private CountCompanyMigrationsRequest( - Optional migrationId, + String migrationId, Optional q, Optional status, Optional limit, @@ -49,7 +50,7 @@ private CountCompanyMigrationsRequest( } @JsonProperty("migration_id") - public Optional getMigrationId() { + public String getMigrationId() { return migrationId; } @@ -108,27 +109,64 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static MigrationIdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional migrationId = Optional.empty(); + public interface MigrationIdStage { + _FinalStage migrationId(@NotNull String migrationId); - private Optional q = Optional.empty(); + Builder from(CountCompanyMigrationsRequest other); + } - private Optional status = Optional.empty(); + public interface _FinalStage { + CountCompanyMigrationsRequest build(); - private Optional limit = Optional.empty(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage q(Optional q); + + _FinalStage q(String q); + + _FinalStage status(Optional status); + + _FinalStage status(PlanVersionCompanyMigrationStatus status); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MigrationIdStage, _FinalStage { + private String migrationId; private Optional offset = Optional.empty(); + private Optional limit = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional q = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(CountCompanyMigrationsRequest other) { migrationId(other.getMigrationId()); q(other.getQ()); @@ -138,76 +176,91 @@ public Builder from(CountCompanyMigrationsRequest other) { return this; } - @JsonSetter(value = "migration_id", nulls = Nulls.SKIP) - public Builder migrationId(Optional migrationId) { - this.migrationId = migrationId; - return this; - } - - public Builder migrationId(String migrationId) { - this.migrationId = Optional.ofNullable(migrationId); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @java.lang.Override + @JsonSetter("migration_id") + public _FinalStage migrationId(@NotNull String migrationId) { + this.migrationId = Objects.requireNonNull(migrationId, "migrationId must not be null"); return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + /** + *

Page offset (default 0)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offset(Long offset) { + this.offset = Optional.ofNullable(offset); return this; } - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; + /** + *

Page offset (default 0)

+ */ + @java.lang.Override + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public _FinalStage offset(Optional offset) { + this.offset = offset; return this; } - public Builder status(PlanVersionCompanyMigrationStatus status) { - this.status = Optional.ofNullable(status); + /** + *

Page limit (default 100)

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

Page limit (default 100)

*/ + @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public Builder limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } - public Builder limit(Long limit) { - this.limit = Optional.ofNullable(limit); + @java.lang.Override + public _FinalStage status(PlanVersionCompanyMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } - /** - *

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; return this; } - public Builder offset(Long offset) { - this.offset = Optional.ofNullable(offset); + @java.lang.Override + public _FinalStage q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + @java.lang.Override + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public _FinalStage q(Optional q) { + this.q = q; return this; } + @java.lang.Override public CountCompanyMigrationsRequest build() { return new CountCompanyMigrationsRequest(migrationId, q, status, limit, offset, additionalProperties); } + @java.lang.Override public Builder additionalProperty(String key, Object value) { this.additionalProperties.put(key, value); return this; } + @java.lang.Override public Builder additionalProperties(Map additionalProperties) { this.additionalProperties.putAll(additionalProperties); return this; diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java index 85886dc..42b2173 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java @@ -17,11 +17,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountMigrationsRequest.Builder.class) public final class CountMigrationsRequest { - private final Optional planVersionId; + private final String planVersionId; private final Optional status; @@ -32,7 +33,7 @@ public final class CountMigrationsRequest { private final Map additionalProperties; private CountMigrationsRequest( - Optional planVersionId, + String planVersionId, Optional status, Optional limit, Optional offset, @@ -45,7 +46,7 @@ private CountMigrationsRequest( } @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { + public String getPlanVersionId() { return planVersionId; } @@ -98,25 +99,58 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static PlanVersionIdStage builder() { return new Builder(); } + public interface PlanVersionIdStage { + _FinalStage planVersionId(@NotNull String planVersionId); + + Builder from(CountMigrationsRequest other); + } + + public interface _FinalStage { + CountMigrationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage status(Optional status); + + _FinalStage status(PlanVersionMigrationStatus status); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional planVersionId = Optional.empty(); + public static final class Builder implements PlanVersionIdStage, _FinalStage { + private String planVersionId; - private Optional status = Optional.empty(); + private Optional offset = Optional.empty(); private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional status = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(CountMigrationsRequest other) { planVersionId(other.getPlanVersionId()); status(other.getStatus()); @@ -125,65 +159,78 @@ public Builder from(CountMigrationsRequest other) { return this; } - @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) - public Builder planVersionId(Optional planVersionId) { - this.planVersionId = planVersionId; + @java.lang.Override + @JsonSetter("plan_version_id") + public _FinalStage planVersionId(@NotNull String planVersionId) { + this.planVersionId = Objects.requireNonNull(planVersionId, "planVersionId must not be null"); return this; } - public Builder planVersionId(String planVersionId) { - this.planVersionId = Optional.ofNullable(planVersionId); + /** + *

Page offset (default 0)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offset(Long offset) { + this.offset = Optional.ofNullable(offset); return this; } - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; + /** + *

Page offset (default 0)

+ */ + @java.lang.Override + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public _FinalStage offset(Optional offset) { + this.offset = offset; return this; } - public Builder status(PlanVersionMigrationStatus status) { - this.status = Optional.ofNullable(status); + /** + *

Page limit (default 100)

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

Page limit (default 100)

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

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; + @java.lang.Override + public _FinalStage status(PlanVersionMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } - public Builder offset(Long offset) { - this.offset = Optional.ofNullable(offset); + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; return this; } + @java.lang.Override public CountMigrationsRequest build() { return new CountMigrationsRequest(planVersionId, status, limit, offset, additionalProperties); } + @java.lang.Override public Builder additionalProperty(String key, Object value) { this.additionalProperties.put(key, value); return this; } + @java.lang.Override public Builder additionalProperties(Map additionalProperties) { this.additionalProperties.putAll(additionalProperties); return this; diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java index 6c93fb6..1457ea9 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java @@ -17,11 +17,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListCompanyMigrationsRequest.Builder.class) public final class ListCompanyMigrationsRequest { - private final Optional migrationId; + private final String migrationId; private final Optional q; @@ -34,7 +35,7 @@ public final class ListCompanyMigrationsRequest { private final Map additionalProperties; private ListCompanyMigrationsRequest( - Optional migrationId, + String migrationId, Optional q, Optional status, Optional limit, @@ -49,7 +50,7 @@ private ListCompanyMigrationsRequest( } @JsonProperty("migration_id") - public Optional getMigrationId() { + public String getMigrationId() { return migrationId; } @@ -108,27 +109,64 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static MigrationIdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional migrationId = Optional.empty(); + public interface MigrationIdStage { + _FinalStage migrationId(@NotNull String migrationId); - private Optional q = Optional.empty(); + Builder from(ListCompanyMigrationsRequest other); + } - private Optional status = Optional.empty(); + public interface _FinalStage { + ListCompanyMigrationsRequest build(); - private Optional limit = Optional.empty(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage q(Optional q); + + _FinalStage q(String q); + + _FinalStage status(Optional status); + + _FinalStage status(PlanVersionCompanyMigrationStatus status); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MigrationIdStage, _FinalStage { + private String migrationId; private Optional offset = Optional.empty(); + private Optional limit = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional q = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ListCompanyMigrationsRequest other) { migrationId(other.getMigrationId()); q(other.getQ()); @@ -138,76 +176,91 @@ public Builder from(ListCompanyMigrationsRequest other) { return this; } - @JsonSetter(value = "migration_id", nulls = Nulls.SKIP) - public Builder migrationId(Optional migrationId) { - this.migrationId = migrationId; - return this; - } - - public Builder migrationId(String migrationId) { - this.migrationId = Optional.ofNullable(migrationId); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @java.lang.Override + @JsonSetter("migration_id") + public _FinalStage migrationId(@NotNull String migrationId) { + this.migrationId = Objects.requireNonNull(migrationId, "migrationId must not be null"); return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + /** + *

Page offset (default 0)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offset(Long offset) { + this.offset = Optional.ofNullable(offset); return this; } - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; + /** + *

Page offset (default 0)

+ */ + @java.lang.Override + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public _FinalStage offset(Optional offset) { + this.offset = offset; return this; } - public Builder status(PlanVersionCompanyMigrationStatus status) { - this.status = Optional.ofNullable(status); + /** + *

Page limit (default 100)

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

Page limit (default 100)

*/ + @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public Builder limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } - public Builder limit(Long limit) { - this.limit = Optional.ofNullable(limit); + @java.lang.Override + public _FinalStage status(PlanVersionCompanyMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } - /** - *

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; return this; } - public Builder offset(Long offset) { - this.offset = Optional.ofNullable(offset); + @java.lang.Override + public _FinalStage q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + @java.lang.Override + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public _FinalStage q(Optional q) { + this.q = q; return this; } + @java.lang.Override public ListCompanyMigrationsRequest build() { return new ListCompanyMigrationsRequest(migrationId, q, status, limit, offset, additionalProperties); } + @java.lang.Override public Builder additionalProperty(String key, Object value) { this.additionalProperties.put(key, value); return this; } + @java.lang.Override public Builder additionalProperties(Map additionalProperties) { this.additionalProperties.putAll(additionalProperties); return this; diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java index 6e63f5b..8a8198a 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java @@ -17,11 +17,12 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListMigrationsRequest.Builder.class) public final class ListMigrationsRequest { - private final Optional planVersionId; + private final String planVersionId; private final Optional status; @@ -32,7 +33,7 @@ public final class ListMigrationsRequest { private final Map additionalProperties; private ListMigrationsRequest( - Optional planVersionId, + String planVersionId, Optional status, Optional limit, Optional offset, @@ -45,7 +46,7 @@ private ListMigrationsRequest( } @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { + public String getPlanVersionId() { return planVersionId; } @@ -98,25 +99,58 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static PlanVersionIdStage builder() { return new Builder(); } + public interface PlanVersionIdStage { + _FinalStage planVersionId(@NotNull String planVersionId); + + Builder from(ListMigrationsRequest other); + } + + public interface _FinalStage { + ListMigrationsRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage status(Optional status); + + _FinalStage status(PlanVersionMigrationStatus status); + + /** + *

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional planVersionId = Optional.empty(); + public static final class Builder implements PlanVersionIdStage, _FinalStage { + private String planVersionId; - private Optional status = Optional.empty(); + private Optional offset = Optional.empty(); private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional status = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ListMigrationsRequest other) { planVersionId(other.getPlanVersionId()); status(other.getStatus()); @@ -125,65 +159,78 @@ public Builder from(ListMigrationsRequest other) { return this; } - @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) - public Builder planVersionId(Optional planVersionId) { - this.planVersionId = planVersionId; + @java.lang.Override + @JsonSetter("plan_version_id") + public _FinalStage planVersionId(@NotNull String planVersionId) { + this.planVersionId = Objects.requireNonNull(planVersionId, "planVersionId must not be null"); return this; } - public Builder planVersionId(String planVersionId) { - this.planVersionId = Optional.ofNullable(planVersionId); + /** + *

Page offset (default 0)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage offset(Long offset) { + this.offset = Optional.ofNullable(offset); return this; } - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; + /** + *

Page offset (default 0)

+ */ + @java.lang.Override + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public _FinalStage offset(Optional offset) { + this.offset = offset; return this; } - public Builder status(PlanVersionMigrationStatus status) { - this.status = Optional.ofNullable(status); + /** + *

Page limit (default 100)

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

Page limit (default 100)

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

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; + @java.lang.Override + public _FinalStage status(PlanVersionMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } - public Builder offset(Long offset) { - this.offset = Optional.ofNullable(offset); + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; return this; } + @java.lang.Override public ListMigrationsRequest build() { return new ListMigrationsRequest(planVersionId, status, limit, offset, 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/CreateBillingLinkedPlanRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java index 26efd95..ff4074d 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java @@ -26,7 +26,7 @@ public final class CreateBillingLinkedPlanRequestBody { private final BillingProviderType billingProvider; - private final String description; + private final Optional description; private final String externalResourceId; @@ -42,7 +42,7 @@ public final class CreateBillingLinkedPlanRequestBody { private CreateBillingLinkedPlanRequestBody( BillingProviderType billingProvider, - String description, + Optional description, String externalResourceId, Optional externalResourceVersion, Optional icon, @@ -65,7 +65,7 @@ public BillingProviderType getBillingProvider() { } @JsonProperty("description") - public String getDescription() { + public Optional getDescription() { return description; } @@ -138,15 +138,11 @@ public static BillingProviderStage builder() { } public interface BillingProviderStage { - DescriptionStage billingProvider(@NotNull BillingProviderType billingProvider); + ExternalResourceIdStage billingProvider(@NotNull BillingProviderType billingProvider); Builder from(CreateBillingLinkedPlanRequestBody other); } - public interface DescriptionStage { - ExternalResourceIdStage description(@NotNull String description); - } - public interface ExternalResourceIdStage { NameStage externalResourceId(@NotNull String externalResourceId); } @@ -166,6 +162,10 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); + + _FinalStage description(String description); + _FinalStage externalResourceVersion(Optional externalResourceVersion); _FinalStage externalResourceVersion(String externalResourceVersion); @@ -177,16 +177,9 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements BillingProviderStage, - DescriptionStage, - ExternalResourceIdStage, - NameStage, - PlanTypeStage, - _FinalStage { + implements BillingProviderStage, ExternalResourceIdStage, NameStage, PlanTypeStage, _FinalStage { private BillingProviderType billingProvider; - private String description; - private String externalResourceId; private String name; @@ -197,6 +190,8 @@ public static final class Builder private Optional externalResourceVersion = Optional.empty(); + private Optional description = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -216,18 +211,11 @@ public Builder from(CreateBillingLinkedPlanRequestBody other) { @java.lang.Override @JsonSetter("billing_provider") - public DescriptionStage billingProvider(@NotNull BillingProviderType billingProvider) { + public ExternalResourceIdStage billingProvider(@NotNull BillingProviderType billingProvider) { this.billingProvider = Objects.requireNonNull(billingProvider, "billingProvider must not be null"); return this; } - @java.lang.Override - @JsonSetter("description") - public ExternalResourceIdStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - @java.lang.Override @JsonSetter("external_resource_id") public NameStage externalResourceId(@NotNull String externalResourceId) { @@ -275,6 +263,19 @@ public _FinalStage externalResourceVersion(Optional externalResourceVers return this; } + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + @java.lang.Override public CreateBillingLinkedPlanRequestBody build() { return new CreateBillingLinkedPlanRequestBody( diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java index 78cfee7..a261548 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java @@ -26,7 +26,9 @@ public final class CreateCustomPlanRequestBody { private final Optional copiedFromPlanId; - private final String description; + private final Optional copiedPriceId; + + private final Optional description; private final Optional icon; @@ -37,12 +39,14 @@ public final class CreateCustomPlanRequestBody { private CreateCustomPlanRequestBody( String companyId, Optional copiedFromPlanId, - String description, + Optional copiedPriceId, + Optional description, Optional icon, String name, Map additionalProperties) { this.companyId = companyId; this.copiedFromPlanId = copiedFromPlanId; + this.copiedPriceId = copiedPriceId; this.description = description; this.icon = icon; this.name = name; @@ -59,8 +63,13 @@ public Optional getCopiedFromPlanId() { return copiedFromPlanId; } + @JsonProperty("copied_price_id") + public Optional getCopiedPriceId() { + return copiedPriceId; + } + @JsonProperty("description") - public String getDescription() { + public Optional getDescription() { return description; } @@ -88,6 +97,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateCustomPlanRequestBody other) { return companyId.equals(other.companyId) && copiedFromPlanId.equals(other.copiedFromPlanId) + && copiedPriceId.equals(other.copiedPriceId) && description.equals(other.description) && icon.equals(other.icon) && name.equals(other.name); @@ -95,7 +105,8 @@ private boolean equalTo(CreateCustomPlanRequestBody other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.copiedFromPlanId, this.description, this.icon, this.name); + return Objects.hash( + this.companyId, this.copiedFromPlanId, this.copiedPriceId, this.description, this.icon, this.name); } @java.lang.Override @@ -108,15 +119,11 @@ public static CompanyIdStage builder() { } public interface CompanyIdStage { - DescriptionStage companyId(@NotNull String companyId); + NameStage companyId(@NotNull String companyId); Builder from(CreateCustomPlanRequestBody other); } - public interface DescriptionStage { - NameStage description(@NotNull String description); - } - public interface NameStage { _FinalStage name(@NotNull String name); } @@ -132,21 +139,31 @@ public interface _FinalStage { _FinalStage copiedFromPlanId(String copiedFromPlanId); + _FinalStage copiedPriceId(Optional copiedPriceId); + + _FinalStage copiedPriceId(String copiedPriceId); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + _FinalStage icon(Optional icon); _FinalStage icon(PlanIcon icon); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CompanyIdStage, DescriptionStage, NameStage, _FinalStage { + public static final class Builder implements CompanyIdStage, NameStage, _FinalStage { private String companyId; - private String description; - private String name; private Optional icon = Optional.empty(); + private Optional description = Optional.empty(); + + private Optional copiedPriceId = Optional.empty(); + private Optional copiedFromPlanId = Optional.empty(); @JsonAnySetter @@ -158,6 +175,7 @@ private Builder() {} public Builder from(CreateCustomPlanRequestBody other) { companyId(other.getCompanyId()); copiedFromPlanId(other.getCopiedFromPlanId()); + copiedPriceId(other.getCopiedPriceId()); description(other.getDescription()); icon(other.getIcon()); name(other.getName()); @@ -166,18 +184,11 @@ public Builder from(CreateCustomPlanRequestBody other) { @java.lang.Override @JsonSetter("company_id") - public DescriptionStage companyId(@NotNull String companyId) { + public NameStage companyId(@NotNull String companyId) { this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } - @java.lang.Override - @JsonSetter("description") - public NameStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - @java.lang.Override @JsonSetter("name") public _FinalStage name(@NotNull String name) { @@ -198,6 +209,32 @@ public _FinalStage icon(Optional icon) { return this; } + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage copiedPriceId(String copiedPriceId) { + this.copiedPriceId = Optional.ofNullable(copiedPriceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_price_id", nulls = Nulls.SKIP) + public _FinalStage copiedPriceId(Optional copiedPriceId) { + this.copiedPriceId = copiedPriceId; + return this; + } + @java.lang.Override public _FinalStage copiedFromPlanId(String copiedFromPlanId) { this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); @@ -214,7 +251,7 @@ public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { @java.lang.Override public CreateCustomPlanRequestBody build() { return new CreateCustomPlanRequestBody( - companyId, copiedFromPlanId, description, icon, name, additionalProperties); + companyId, copiedFromPlanId, copiedPriceId, description, icon, name, additionalProperties); } @java.lang.Override 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 dae7b13..c6ae5a2 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 @@ -49,6 +49,8 @@ public final class PublishPlanVersionRequestBody { private final Optional prorationBehavior; + private final Optional requireNoMigration; + private final Optional sendInvoice; private final Optional taxId; @@ -66,6 +68,7 @@ private PublishPlanVersionRequestBody( PlanVersionMigrationStrategy migrationStrategy, Optional phone, Optional prorationBehavior, + Optional requireNoMigration, Optional sendInvoice, Optional taxId, Map additionalProperties) { @@ -79,6 +82,7 @@ private PublishPlanVersionRequestBody( this.migrationStrategy = migrationStrategy; this.phone = phone; this.prorationBehavior = prorationBehavior; + this.requireNoMigration = requireNoMigration; this.sendInvoice = sendInvoice; this.taxId = taxId; this.additionalProperties = additionalProperties; @@ -134,6 +138,14 @@ public Optional getProrationBehavior() { return prorationBehavior; } + /** + * @return Refuse the publish if any company would be migrated onto the new version + */ + @JsonProperty("require_no_migration") + public Optional getRequireNoMigration() { + return requireNoMigration; + } + /** * @return Whether Stripe emails the invoice when it is finalized. Defaults to true. */ @@ -169,6 +181,7 @@ private boolean equalTo(PublishPlanVersionRequestBody other) { && migrationStrategy.equals(other.migrationStrategy) && phone.equals(other.phone) && prorationBehavior.equals(other.prorationBehavior) + && requireNoMigration.equals(other.requireNoMigration) && sendInvoice.equals(other.sendInvoice) && taxId.equals(other.taxId); } @@ -186,6 +199,7 @@ public int hashCode() { this.migrationStrategy, this.phone, this.prorationBehavior, + this.requireNoMigration, this.sendInvoice, this.taxId); } @@ -250,6 +264,13 @@ public interface _FinalStage { _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior); + /** + *

Refuse the publish if any company would be migrated onto the new version

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

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

*/ @@ -270,6 +291,8 @@ public static final class Builder implements MigrationStrategyStage, _FinalStage private Optional sendInvoice = Optional.empty(); + private Optional requireNoMigration = Optional.empty(); + private Optional prorationBehavior = Optional.empty(); private Optional phone = Optional.empty(); @@ -305,6 +328,7 @@ public Builder from(PublishPlanVersionRequestBody other) { migrationStrategy(other.getMigrationStrategy()); phone(other.getPhone()); prorationBehavior(other.getProrationBehavior()); + requireNoMigration(other.getRequireNoMigration()); sendInvoice(other.getSendInvoice()); taxId(other.getTaxId()); return this; @@ -350,6 +374,26 @@ public _FinalStage sendInvoice(Optional sendInvoice) { return this; } + /** + *

Refuse the publish if any company would be migrated onto the new version

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

Refuse the publish if any company would be migrated onto the new version

+ */ + @java.lang.Override + @JsonSetter(value = "require_no_migration", nulls = Nulls.SKIP) + public _FinalStage requireNoMigration(Optional requireNoMigration) { + this.requireNoMigration = requireNoMigration; + return this; + } + @java.lang.Override public _FinalStage prorationBehavior(MigrationProrationBehavior prorationBehavior) { this.prorationBehavior = Optional.ofNullable(prorationBehavior); @@ -491,6 +535,7 @@ public PublishPlanVersionRequestBody build() { migrationStrategy, phone, prorationBehavior, + requireNoMigration, sendInvoice, taxId, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/AuditLogResponseData.java b/src/main/java/com/schematic/api/types/AuditLogResponseData.java index 9d92f0c..69c26d6 100644 --- a/src/main/java/com/schematic/api/types/AuditLogResponseData.java +++ b/src/main/java/com/schematic/api/types/AuditLogResponseData.java @@ -22,6 +22,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = AuditLogResponseData.Builder.class) public final class AuditLogResponseData { + private final Optional accountMemberId; + private final ActorType actorType; private final Optional apiKey; @@ -65,6 +67,7 @@ public final class AuditLogResponseData { private final Map additionalProperties; private AuditLogResponseData( + Optional accountMemberId, ActorType actorType, Optional apiKey, Optional apiKeyId, @@ -86,6 +89,7 @@ private AuditLogResponseData( Optional userId, Optional userName, Map additionalProperties) { + this.accountMemberId = accountMemberId; this.actorType = actorType; this.apiKey = apiKey; this.apiKeyId = apiKeyId; @@ -109,6 +113,11 @@ private AuditLogResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("account_member_id") + public Optional getAccountMemberId() { + return accountMemberId; + } + @JsonProperty("actor_type") public ActorType getActorType() { return actorType; @@ -221,7 +230,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(AuditLogResponseData other) { - return actorType.equals(other.actorType) + return accountMemberId.equals(other.accountMemberId) + && actorType.equals(other.actorType) && apiKey.equals(other.apiKey) && apiKeyId.equals(other.apiKeyId) && endedAt.equals(other.endedAt) @@ -246,6 +256,7 @@ private boolean equalTo(AuditLogResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.accountMemberId, this.actorType, this.apiKey, this.apiKeyId, @@ -306,6 +317,10 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage accountMemberId(Optional accountMemberId); + + _FinalStage accountMemberId(String accountMemberId); + _FinalStage apiKey(Optional apiKey); _FinalStage apiKey(ApiKeyResponseData apiKey); @@ -410,6 +425,8 @@ public static final class Builder private Optional apiKey = Optional.empty(); + private Optional accountMemberId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -417,6 +434,7 @@ private Builder() {} @java.lang.Override public Builder from(AuditLogResponseData other) { + accountMemberId(other.getAccountMemberId()); actorType(other.getActorType()); apiKey(other.getApiKey()); apiKeyId(other.getApiKeyId()); @@ -670,9 +688,23 @@ public _FinalStage apiKey(Optional apiKey) { return this; } + @java.lang.Override + public _FinalStage accountMemberId(String accountMemberId) { + this.accountMemberId = Optional.ofNullable(accountMemberId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "account_member_id", nulls = Nulls.SKIP) + public _FinalStage accountMemberId(Optional accountMemberId) { + this.accountMemberId = accountMemberId; + return this; + } + @java.lang.Override public AuditLogResponseData build() { return new AuditLogResponseData( + accountMemberId, actorType, apiKey, apiKeyId, diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index d6f6a82..cc78c07 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -222,7 +222,7 @@ public Optional getAutoTopupThresholdPercent() { } /** - * @return Whether buyers can purchase one-time credit bundles on this grant, independent of auto top-up availability. + * @return Deprecated: bundle availability is a per-bundle plan compatibility set now; use compatible_plan_ids on credit bundles instead. */ @JsonProperty("can_buy_bundles") public boolean getCanBuyBundles() { @@ -487,7 +487,7 @@ public interface AutoTopupSelfServiceStage { public interface CanBuyBundlesStage { /** - *

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

+ *

Deprecated: bundle availability is a per-bundle plan compatibility set now; use compatible_plan_ids on credit bundles instead.

*/ CompanyCreditAmountStage canBuyBundles(boolean canBuyBundles); } @@ -806,7 +806,7 @@ public CanBuyBundlesStage autoTopupSelfService(boolean autoTopupSelfService) { } /** - *

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

+ *

Deprecated: bundle availability is a per-bundle plan compatibility set now; use compatible_plan_ids on credit bundles instead.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java b/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java index 70813ee..0ceb8c5 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java +++ b/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java @@ -22,15 +22,19 @@ public final class CheckFlagRequestBody { private final Optional> company; + private final Optional preflight; + private final Optional> user; private final Map additionalProperties; private CheckFlagRequestBody( Optional> company, + Optional preflight, Optional> user, Map additionalProperties) { this.company = company; + this.preflight = preflight; this.user = user; this.additionalProperties = additionalProperties; } @@ -40,6 +44,14 @@ public Optional> getCompany() { return company; } + /** + * @return Hypothetical usage to evaluate the flag against, for answering "would this action be allowed?" before performing it. Only supported when checking a single flag. Values are caller-asserted and can widen a verdict as well as narrow it, so do not forward untrusted input here when the result gates access. Only the flag value reflects the preflight; the entitlement and usage figures in the response are the company's current, unsimulated ones + */ + @JsonProperty("preflight") + public Optional getPreflight() { + return preflight; + } + @JsonProperty("user") public Optional> getUser() { return user; @@ -57,12 +69,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(CheckFlagRequestBody other) { - return company.equals(other.company) && user.equals(other.user); + return company.equals(other.company) && preflight.equals(other.preflight) && user.equals(other.user); } @java.lang.Override public int hashCode() { - return Objects.hash(this.company, this.user); + return Objects.hash(this.company, this.preflight, this.user); } @java.lang.Override @@ -78,6 +90,8 @@ public static Builder builder() { public static final class Builder { private Optional> company = Optional.empty(); + private Optional preflight = Optional.empty(); + private Optional> user = Optional.empty(); @JsonAnySetter @@ -87,6 +101,7 @@ private Builder() {} public Builder from(CheckFlagRequestBody other) { company(other.getCompany()); + preflight(other.getPreflight()); user(other.getUser()); return this; } @@ -102,6 +117,20 @@ public Builder company(Map company) { return this; } + /** + *

Hypothetical usage to evaluate the flag against, for answering "would this action be allowed?" before performing it. Only supported when checking a single flag. Values are caller-asserted and can widen a verdict as well as narrow it, so do not forward untrusted input here when the result gates access. Only the flag value reflects the preflight; the entitlement and usage figures in the response are the company's current, unsimulated ones

+ */ + @JsonSetter(value = "preflight", nulls = Nulls.SKIP) + public Builder preflight(Optional preflight) { + this.preflight = preflight; + return this; + } + + public Builder preflight(PreflightRequestBody preflight) { + this.preflight = Optional.ofNullable(preflight); + return this; + } + @JsonSetter(value = "user", nulls = Nulls.SKIP) public Builder user(Optional> user) { this.user = user; @@ -114,7 +143,7 @@ public Builder user(Map user) { } public CheckFlagRequestBody build() { - return new CheckFlagRequestBody(company, user, additionalProperties); + return new CheckFlagRequestBody(company, preflight, user, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java b/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java index 5f0fa2c..5b14804 100644 --- a/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java +++ b/src/main/java/com/schematic/api/types/CompanyFeatureUsageExportMetadata.java @@ -43,6 +43,8 @@ public final class CompanyFeatureUsageExportMetadata { private final Optional planVersionId; + private final Optional planVersionUnpublished; + private final Optional q; private final Optional sortOrderColumn; @@ -79,6 +81,7 @@ private CompanyFeatureUsageExportMetadata( Optional planId, Optional> planIds, Optional planVersionId, + Optional planVersionUnpublished, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, @@ -102,6 +105,7 @@ private CompanyFeatureUsageExportMetadata( this.planId = planId; this.planIds = planIds; this.planVersionId = planVersionId; + this.planVersionUnpublished = planVersionUnpublished; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; @@ -204,6 +208,14 @@ public Optional getPlanVersionId() { return planVersionId; } + /** + * @return Restrict the export to companies on a plan version that is no longer published + */ + @JsonProperty("plan_version_unpublished") + public Optional getPlanVersionUnpublished() { + return planVersionUnpublished; + } + /** * @return Free-text search over company name and keys */ @@ -315,6 +327,7 @@ private boolean equalTo(CompanyFeatureUsageExportMetadata other) { && planId.equals(other.planId) && planIds.equals(other.planIds) && planVersionId.equals(other.planVersionId) + && planVersionUnpublished.equals(other.planVersionUnpublished) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) @@ -342,6 +355,7 @@ public int hashCode() { this.planId, this.planIds, this.planVersionId, + this.planVersionUnpublished, this.q, this.sortOrderColumn, this.sortOrderDirection, @@ -388,6 +402,8 @@ public static final class Builder { private Optional planVersionId = Optional.empty(); + private Optional planVersionUnpublished = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -427,6 +443,7 @@ public Builder from(CompanyFeatureUsageExportMetadata other) { planId(other.getPlanId()); planIds(other.getPlanIds()); planVersionId(other.getPlanVersionId()); + planVersionUnpublished(other.getPlanVersionUnpublished()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); @@ -597,6 +614,20 @@ public Builder planVersionId(String planVersionId) { return this; } + /** + *

Restrict the export to companies on a plan version that is no longer published

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

Free-text search over company name and keys

*/ @@ -766,6 +797,7 @@ public CompanyFeatureUsageExportMetadata build() { planId, planIds, planVersionId, + planVersionUnpublished, q, sortOrderColumn, sortOrderDirection, diff --git a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java index 9f55e03..6706733 100644 --- a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java @@ -75,7 +75,7 @@ public final class ComponentHydrateResponseData { private final Optional trialPaymentMethodRequired; - private final Optional upcomingInvoice; + private final Optional upcomingInvoice; private final Map additionalProperties; @@ -106,7 +106,7 @@ private ComponentHydrateResponseData( Optional stripeEmbed, Optional subscription, Optional trialPaymentMethodRequired, - Optional upcomingInvoice, + Optional upcomingInvoice, Map additionalProperties) { this.activeAddOns = activeAddOns; this.activePlans = activePlans; @@ -269,7 +269,7 @@ public Optional getTrialPaymentMethodRequired() { } @JsonProperty("upcoming_invoice") - public Optional getUpcomingInvoice() { + public Optional getUpcomingInvoice() { return upcomingInvoice; } @@ -483,9 +483,9 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage trialPaymentMethodRequired(Boolean trialPaymentMethodRequired); - _FinalStage upcomingInvoice(Optional upcomingInvoice); + _FinalStage upcomingInvoice(Optional upcomingInvoice); - _FinalStage upcomingInvoice(InvoiceResponseData upcomingInvoice); + _FinalStage upcomingInvoice(UpcomingInvoiceResponseData upcomingInvoice); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -512,7 +512,7 @@ public static final class Builder private boolean showZeroPriceAsFree; - private Optional upcomingInvoice = Optional.empty(); + private Optional upcomingInvoice = Optional.empty(); private Optional trialPaymentMethodRequired = Optional.empty(); @@ -639,14 +639,14 @@ public _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { } @java.lang.Override - public _FinalStage upcomingInvoice(InvoiceResponseData upcomingInvoice) { + public _FinalStage upcomingInvoice(UpcomingInvoiceResponseData upcomingInvoice) { this.upcomingInvoice = Optional.ofNullable(upcomingInvoice); return this; } @java.lang.Override @JsonSetter(value = "upcoming_invoice", nulls = Nulls.SKIP) - public _FinalStage upcomingInvoice(Optional upcomingInvoice) { + public _FinalStage upcomingInvoice(Optional upcomingInvoice) { this.upcomingInvoice = upcomingInvoice; return this; } diff --git a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java index 5d98d9b..0dc3486 100644 --- a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java @@ -77,7 +77,7 @@ public final class ComponentPreviewResponseData { private final Optional trialPaymentMethodRequired; - private final Optional upcomingInvoice; + private final Optional upcomingInvoice; private final Map additionalProperties; @@ -109,7 +109,7 @@ private ComponentPreviewResponseData( Optional stripeEmbed, Optional subscription, Optional trialPaymentMethodRequired, - Optional upcomingInvoice, + Optional upcomingInvoice, Map additionalProperties) { this.activeAddOns = activeAddOns; this.activePlans = activePlans; @@ -278,7 +278,7 @@ public Optional getTrialPaymentMethodRequired() { } @JsonProperty("upcoming_invoice") - public Optional getUpcomingInvoice() { + public Optional getUpcomingInvoice() { return upcomingInvoice; } @@ -500,9 +500,9 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage trialPaymentMethodRequired(Boolean trialPaymentMethodRequired); - _FinalStage upcomingInvoice(Optional upcomingInvoice); + _FinalStage upcomingInvoice(Optional upcomingInvoice); - _FinalStage upcomingInvoice(InvoiceResponseData upcomingInvoice); + _FinalStage upcomingInvoice(UpcomingInvoiceResponseData upcomingInvoice); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -529,7 +529,7 @@ public static final class Builder private boolean showZeroPriceAsFree; - private Optional upcomingInvoice = Optional.empty(); + private Optional upcomingInvoice = Optional.empty(); private Optional trialPaymentMethodRequired = Optional.empty(); @@ -659,14 +659,14 @@ public _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { } @java.lang.Override - public _FinalStage upcomingInvoice(InvoiceResponseData upcomingInvoice) { + public _FinalStage upcomingInvoice(UpcomingInvoiceResponseData upcomingInvoice) { this.upcomingInvoice = Optional.ofNullable(upcomingInvoice); return this; } @java.lang.Override @JsonSetter(value = "upcoming_invoice", nulls = Nulls.SKIP) - public _FinalStage upcomingInvoice(Optional upcomingInvoice) { + public _FinalStage upcomingInvoice(Optional upcomingInvoice) { this.upcomingInvoice = upcomingInvoice; return this; } diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index 3195363..eb44a31 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -187,6 +187,9 @@ public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; } + /** + * @return Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. + */ @JsonProperty("can_buy_bundles") public Optional getCanBuyBundles() { return canBuyBundles; @@ -428,6 +431,9 @@ public interface _FinalStage { _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); + /** + *

Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility.

+ */ _FinalStage canBuyBundles(Optional canBuyBundles); _FinalStage canBuyBundles(Boolean canBuyBundles); @@ -752,12 +758,19 @@ public _FinalStage companyCreditAmount(Optional companyCreditAmount) { return this; } + /** + *

Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility.

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

Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility.

+ */ @java.lang.Override @JsonSetter(value = "can_buy_bundles", nulls = Nulls.SKIP) public _FinalStage canBuyBundles(Optional canBuyBundles) { diff --git a/src/main/java/com/schematic/api/types/CreateCustomPlanBundlePlanRequestBody.java b/src/main/java/com/schematic/api/types/CreateCustomPlanBundlePlanRequestBody.java index 7f016fc..778c0f1 100644 --- a/src/main/java/com/schematic/api/types/CreateCustomPlanBundlePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateCustomPlanBundlePlanRequestBody.java @@ -23,7 +23,7 @@ public final class CreateCustomPlanBundlePlanRequestBody { private final String companyId; - private final String description; + private final Optional description; private final Optional icon; @@ -33,7 +33,7 @@ public final class CreateCustomPlanBundlePlanRequestBody { private CreateCustomPlanBundlePlanRequestBody( String companyId, - String description, + Optional description, Optional icon, String name, Map additionalProperties) { @@ -50,7 +50,7 @@ public String getCompanyId() { } @JsonProperty("description") - public String getDescription() { + public Optional getDescription() { return description; } @@ -98,15 +98,11 @@ public static CompanyIdStage builder() { } public interface CompanyIdStage { - DescriptionStage companyId(@NotNull String companyId); + NameStage companyId(@NotNull String companyId); Builder from(CreateCustomPlanBundlePlanRequestBody other); } - public interface DescriptionStage { - NameStage description(@NotNull String description); - } - public interface NameStage { _FinalStage name(@NotNull String name); } @@ -118,21 +114,25 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); + + _FinalStage description(String description); + _FinalStage icon(Optional icon); _FinalStage icon(PlanIcon icon); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CompanyIdStage, DescriptionStage, NameStage, _FinalStage { + public static final class Builder implements CompanyIdStage, NameStage, _FinalStage { private String companyId; - private String description; - private String name; private Optional icon = Optional.empty(); + private Optional description = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -149,18 +149,11 @@ public Builder from(CreateCustomPlanBundlePlanRequestBody other) { @java.lang.Override @JsonSetter("company_id") - public DescriptionStage companyId(@NotNull String companyId) { + public NameStage companyId(@NotNull String companyId) { this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } - @java.lang.Override - @JsonSetter("description") - public NameStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - @java.lang.Override @JsonSetter("name") public _FinalStage name(@NotNull String name) { @@ -181,6 +174,19 @@ public _FinalStage icon(Optional icon) { return this; } + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + @java.lang.Override public CreateCustomPlanBundlePlanRequestBody build() { return new CreateCustomPlanBundlePlanRequestBody(companyId, description, icon, name, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java index 132ad6f..68b3eb8 100644 --- a/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java @@ -21,7 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreatePlanRequestBody.Builder.class) public final class CreatePlanRequestBody { - private final String description; + private final Optional description; private final Optional icon; @@ -32,7 +32,7 @@ public final class CreatePlanRequestBody { private final Map additionalProperties; private CreatePlanRequestBody( - String description, + Optional description, Optional icon, String name, PlanType planType, @@ -45,7 +45,7 @@ private CreatePlanRequestBody( } @JsonProperty("description") - public String getDescription() { + public Optional getDescription() { return description; } @@ -92,18 +92,14 @@ public String toString() { return ObjectMappers.stringify(this); } - public static DescriptionStage builder() { + public static NameStage builder() { return new Builder(); } - public interface DescriptionStage { - NameStage description(@NotNull String description); - - Builder from(CreatePlanRequestBody other); - } - public interface NameStage { PlanTypeStage name(@NotNull String name); + + Builder from(CreatePlanRequestBody other); } public interface PlanTypeStage { @@ -117,21 +113,25 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); + + _FinalStage description(String description); + _FinalStage icon(Optional icon); _FinalStage icon(PlanIcon icon); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DescriptionStage, NameStage, PlanTypeStage, _FinalStage { - private String description; - + public static final class Builder implements NameStage, PlanTypeStage, _FinalStage { private String name; private PlanType planType; private Optional icon = Optional.empty(); + private Optional description = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -146,13 +146,6 @@ public Builder from(CreatePlanRequestBody other) { return this; } - @java.lang.Override - @JsonSetter("description") - public NameStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - @java.lang.Override @JsonSetter("name") public PlanTypeStage name(@NotNull String name) { @@ -180,6 +173,19 @@ public _FinalStage icon(Optional icon) { return this; } + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + @java.lang.Override public CreatePlanRequestBody build() { return new CreatePlanRequestBody(description, icon, name, planType, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java b/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java index 391ee2c..c121417 100644 --- a/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java +++ b/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java @@ -29,6 +29,8 @@ public final class EventBodyFlagCheck { private final String flagKey; + private final Optional preflight; + private final String reason; private final Optional> reqCompany; @@ -48,6 +50,7 @@ private EventBodyFlagCheck( Optional error, Optional flagId, String flagKey, + Optional preflight, String reason, Optional> reqCompany, Optional> reqUser, @@ -59,6 +62,7 @@ private EventBodyFlagCheck( this.error = error; this.flagId = flagId; this.flagKey = flagKey; + this.preflight = preflight; this.reason = reason; this.reqCompany = reqCompany; this.reqUser = reqUser; @@ -100,6 +104,14 @@ public String getFlagKey() { return flagKey; } + /** + * @return Whether the check was a preflight, asking whether an action would be allowed rather than reporting one that happened. Absent on ordinary checks + */ + @JsonProperty("preflight") + public Optional getPreflight() { + return preflight; + } + /** * @return The reason why the value was returned */ @@ -164,6 +176,7 @@ private boolean equalTo(EventBodyFlagCheck other) { && error.equals(other.error) && flagId.equals(other.flagId) && flagKey.equals(other.flagKey) + && preflight.equals(other.preflight) && reason.equals(other.reason) && reqCompany.equals(other.reqCompany) && reqUser.equals(other.reqUser) @@ -179,6 +192,7 @@ public int hashCode() { this.error, this.flagId, this.flagKey, + this.preflight, this.reason, this.reqCompany, this.reqUser, @@ -247,6 +261,13 @@ public interface _FinalStage { _FinalStage flagId(String flagId); + /** + *

Whether the check was a preflight, asking whether an action would be allowed rather than reporting one that happened. Absent on ordinary checks

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

Key-value pairs used to to identify company for which the flag was checked

*/ @@ -292,6 +313,8 @@ public static final class Builder implements FlagKeyStage, ReasonStage, ValueSta private Optional> reqCompany = Optional.empty(); + private Optional preflight = Optional.empty(); + private Optional flagId = Optional.empty(); private Optional error = Optional.empty(); @@ -309,6 +332,7 @@ public Builder from(EventBodyFlagCheck other) { error(other.getError()); flagId(other.getFlagId()); flagKey(other.getFlagKey()); + preflight(other.getPreflight()); reason(other.getReason()); reqCompany(other.getReqCompany()); reqUser(other.getReqUser()); @@ -431,6 +455,26 @@ public _FinalStage reqCompany(Optional> reqCompany) { return this; } + /** + *

Whether the check was a preflight, asking whether an action would be allowed rather than reporting one that happened. Absent on ordinary checks

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

Whether the check was a preflight, asking whether an action would be allowed rather than reporting one that happened. Absent on ordinary checks

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

Schematic flag ID (starting with 'flag_') for the flag matching the key, if any

* @return Reference to {@code this} so that method calls can be chained together. @@ -498,6 +542,7 @@ public EventBodyFlagCheck build() { error, flagId, flagKey, + preflight, reason, reqCompany, reqUser, diff --git a/src/main/java/com/schematic/api/types/FeatureUsageHistoryResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageHistoryResponseData.java new file mode 100644 index 0000000..6a0e5e9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/FeatureUsageHistoryResponseData.java @@ -0,0 +1,290 @@ +/** + * 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 = FeatureUsageHistoryResponseData.Builder.class) +public final class FeatureUsageHistoryResponseData { + private final String companyId; + + private final String eventSubtype; + + private final String featureId; + + private final OffsetDateTime periodEnd; + + private final OffsetDateTime periodStart; + + private final long usage; + + private final Map additionalProperties; + + private FeatureUsageHistoryResponseData( + String companyId, + String eventSubtype, + String featureId, + OffsetDateTime periodEnd, + OffsetDateTime periodStart, + long usage, + Map additionalProperties) { + this.companyId = companyId; + this.eventSubtype = eventSubtype; + this.featureId = featureId; + this.periodEnd = periodEnd; + this.periodStart = periodStart; + this.usage = usage; + this.additionalProperties = additionalProperties; + } + + /** + * @return Companies are identified by ID only. To report against your own identifiers, resolve them once via the companies API and cache the mapping; keys are not repeated on every row. + */ + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("event_subtype") + public String getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + /** + * @return Exclusive end of the period this usage covers + */ + @JsonProperty("period_end") + public OffsetDateTime getPeriodEnd() { + return periodEnd; + } + + /** + * @return Inclusive start of the period this usage covers + */ + @JsonProperty("period_start") + public OffsetDateTime getPeriodStart() { + return periodStart; + } + + /** + * @return Usage recorded within this period; an incremental total, not a running one + */ + @JsonProperty("usage") + public long getUsage() { + return usage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureUsageHistoryResponseData && equalTo((FeatureUsageHistoryResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureUsageHistoryResponseData other) { + return companyId.equals(other.companyId) + && eventSubtype.equals(other.eventSubtype) + && featureId.equals(other.featureId) + && periodEnd.equals(other.periodEnd) + && periodStart.equals(other.periodStart) + && usage == other.usage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, this.eventSubtype, this.featureId, this.periodEnd, this.periodStart, this.usage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + /** + *

Companies are identified by ID only. To report against your own identifiers, resolve them once via the companies API and cache the mapping; keys are not repeated on every row.

+ */ + EventSubtypeStage companyId(@NotNull String companyId); + + Builder from(FeatureUsageHistoryResponseData other); + } + + public interface EventSubtypeStage { + FeatureIdStage eventSubtype(@NotNull String eventSubtype); + } + + public interface FeatureIdStage { + PeriodEndStage featureId(@NotNull String featureId); + } + + public interface PeriodEndStage { + /** + *

Exclusive end of the period this usage covers

+ */ + PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd); + } + + public interface PeriodStartStage { + /** + *

Inclusive start of the period this usage covers

+ */ + UsageStage periodStart(@NotNull OffsetDateTime periodStart); + } + + public interface UsageStage { + /** + *

Usage recorded within this period; an incremental total, not a running one

+ */ + _FinalStage usage(long usage); + } + + public interface _FinalStage { + FeatureUsageHistoryResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyIdStage, + EventSubtypeStage, + FeatureIdStage, + PeriodEndStage, + PeriodStartStage, + UsageStage, + _FinalStage { + private String companyId; + + private String eventSubtype; + + private String featureId; + + private OffsetDateTime periodEnd; + + private OffsetDateTime periodStart; + + private long usage; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureUsageHistoryResponseData other) { + companyId(other.getCompanyId()); + eventSubtype(other.getEventSubtype()); + featureId(other.getFeatureId()); + periodEnd(other.getPeriodEnd()); + periodStart(other.getPeriodStart()); + usage(other.getUsage()); + return this; + } + + /** + *

Companies are identified by ID only. To report against your own identifiers, resolve them once via the companies API and cache the mapping; keys are not repeated on every row.

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

Exclusive end of the period this usage covers

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

Inclusive start of the period this usage covers

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

Usage recorded within this period; an incremental total, not a running one

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("usage") + public _FinalStage usage(long usage) { + this.usage = usage; + return this; + } + + @java.lang.Override + public FeatureUsageHistoryResponseData build() { + return new FeatureUsageHistoryResponseData( + companyId, eventSubtype, featureId, periodEnd, periodStart, usage, 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/MigrationProrationBehavior.java b/src/main/java/com/schematic/api/types/MigrationProrationBehavior.java index a8ab03f..cd58fb7 100644 --- a/src/main/java/com/schematic/api/types/MigrationProrationBehavior.java +++ b/src/main/java/com/schematic/api/types/MigrationProrationBehavior.java @@ -13,6 +13,8 @@ public final class MigrationProrationBehavior { public static final MigrationProrationBehavior CREATE_PRORATIONS = new MigrationProrationBehavior(Value.CREATE_PRORATIONS, "create_prorations"); + public static final MigrationProrationBehavior NONE = new MigrationProrationBehavior(Value.NONE, "none"); + private final Value value; private final String string; @@ -50,6 +52,8 @@ public T visit(Visitor visitor) { return visitor.visitAlwaysInvoice(); case CREATE_PRORATIONS: return visitor.visitCreateProrations(); + case NONE: + return visitor.visitNone(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -63,6 +67,8 @@ public static MigrationProrationBehavior valueOf(String value) { return ALWAYS_INVOICE; case "create_prorations": return CREATE_PRORATIONS; + case "none": + return NONE; default: return new MigrationProrationBehavior(Value.UNKNOWN, value); } @@ -73,6 +79,8 @@ public enum Value { CREATE_PRORATIONS, + NONE, + UNKNOWN } @@ -81,6 +89,8 @@ public interface Visitor { T visitCreateProrations(); + T visitNone(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/OnboardingRequirementView.java b/src/main/java/com/schematic/api/types/OnboardingRequirementView.java index 94f67b6..c6b2842 100644 --- a/src/main/java/com/schematic/api/types/OnboardingRequirementView.java +++ b/src/main/java/com/schematic/api/types/OnboardingRequirementView.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -26,6 +27,8 @@ public final class OnboardingRequirementView { private final OnboardingRequirement id; + private final Optional reachedAt; + private final Optional satisfiedBy; private final OnboardingRequirementStatus status; @@ -35,11 +38,13 @@ public final class OnboardingRequirementView { private OnboardingRequirementView( Optional> blockedBy, OnboardingRequirement id, + Optional reachedAt, Optional satisfiedBy, OnboardingRequirementStatus status, Map additionalProperties) { this.blockedBy = blockedBy; this.id = id; + this.reachedAt = reachedAt; this.satisfiedBy = satisfiedBy; this.status = status; this.additionalProperties = additionalProperties; @@ -55,6 +60,11 @@ public OnboardingRequirement getId() { return id; } + @JsonProperty("reached_at") + public Optional getReachedAt() { + return reachedAt; + } + @JsonProperty("satisfied_by") public Optional getSatisfiedBy() { return satisfiedBy; @@ -79,13 +89,14 @@ public Map getAdditionalProperties() { private boolean equalTo(OnboardingRequirementView other) { return blockedBy.equals(other.blockedBy) && id.equals(other.id) + && reachedAt.equals(other.reachedAt) && satisfiedBy.equals(other.satisfiedBy) && status.equals(other.status); } @java.lang.Override public int hashCode() { - return Objects.hash(this.blockedBy, this.id, this.satisfiedBy, this.status); + return Objects.hash(this.blockedBy, this.id, this.reachedAt, this.satisfiedBy, this.status); } @java.lang.Override @@ -118,6 +129,10 @@ public interface _FinalStage { _FinalStage blockedBy(List blockedBy); + _FinalStage reachedAt(Optional reachedAt); + + _FinalStage reachedAt(OffsetDateTime reachedAt); + _FinalStage satisfiedBy(Optional satisfiedBy); _FinalStage satisfiedBy(String satisfiedBy); @@ -131,6 +146,8 @@ public static final class Builder implements IdStage, StatusStage, _FinalStage { private Optional satisfiedBy = Optional.empty(); + private Optional reachedAt = Optional.empty(); + private Optional> blockedBy = Optional.empty(); @JsonAnySetter @@ -142,6 +159,7 @@ private Builder() {} public Builder from(OnboardingRequirementView other) { blockedBy(other.getBlockedBy()); id(other.getId()); + reachedAt(other.getReachedAt()); satisfiedBy(other.getSatisfiedBy()); status(other.getStatus()); return this; @@ -174,6 +192,19 @@ public _FinalStage satisfiedBy(Optional satisfiedBy) { return this; } + @java.lang.Override + public _FinalStage reachedAt(OffsetDateTime reachedAt) { + this.reachedAt = Optional.ofNullable(reachedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reached_at", nulls = Nulls.SKIP) + public _FinalStage reachedAt(Optional reachedAt) { + this.reachedAt = reachedAt; + return this; + } + @java.lang.Override public _FinalStage blockedBy(List blockedBy) { this.blockedBy = Optional.ofNullable(blockedBy); @@ -189,7 +220,7 @@ public _FinalStage blockedBy(Optional> blockedBy) { @java.lang.Override public OnboardingRequirementView build() { - return new OnboardingRequirementView(blockedBy, id, satisfiedBy, status, additionalProperties); + return new OnboardingRequirementView(blockedBy, id, reachedAt, satisfiedBy, status, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseData.java b/src/main/java/com/schematic/api/types/PlanChangeResponseData.java index 43c81e5..cbade19 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanChangeResponseData.java @@ -66,6 +66,12 @@ public final class PlanChangeResponseData { private final List traitsUpdated; + private final Optional trialConvertedAt; + + private final Optional trialExpiresAt; + + private final Optional trialStatus; + private final OffsetDateTime updatedAt; private final Optional userId; @@ -96,6 +102,9 @@ private PlanChangeResponseData( Optional requestId, Optional subscriptionChangeAction, List traitsUpdated, + Optional trialConvertedAt, + Optional trialExpiresAt, + Optional trialStatus, OffsetDateTime updatedAt, Optional userId, Optional userName, @@ -121,6 +130,9 @@ private PlanChangeResponseData( this.requestId = requestId; this.subscriptionChangeAction = subscriptionChangeAction; this.traitsUpdated = traitsUpdated; + this.trialConvertedAt = trialConvertedAt; + this.trialExpiresAt = trialExpiresAt; + this.trialStatus = trialStatus; this.updatedAt = updatedAt; this.userId = userId; this.userName = userName; @@ -253,6 +265,30 @@ public List getTraitsUpdated() { return traitsUpdated; } + /** + * @return When the company's trial had converted to a paid subscription as of this change. Null when the trial had not converted, or for changes recorded before trial status was tracked. + */ + @JsonProperty("trial_converted_at") + public Optional getTrialConvertedAt() { + return trialConvertedAt; + } + + /** + * @return When the company's trial was set to end as of this change. Null when the company had never trialed, or for changes recorded before trial status was tracked. + */ + @JsonProperty("trial_expires_at") + public Optional getTrialExpiresAt() { + return trialExpiresAt; + } + + /** + * @return The company's trial status. Null when the company had never trialed, or for changes recorded before trial status was tracked. + */ + @JsonProperty("trial_status") + public Optional getTrialStatus() { + return trialStatus; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -301,6 +337,9 @@ private boolean equalTo(PlanChangeResponseData other) { && requestId.equals(other.requestId) && subscriptionChangeAction.equals(other.subscriptionChangeAction) && traitsUpdated.equals(other.traitsUpdated) + && trialConvertedAt.equals(other.trialConvertedAt) + && trialExpiresAt.equals(other.trialExpiresAt) + && trialStatus.equals(other.trialStatus) && updatedAt.equals(other.updatedAt) && userId.equals(other.userId) && userName.equals(other.userName); @@ -330,6 +369,9 @@ public int hashCode() { this.requestId, this.subscriptionChangeAction, this.traitsUpdated, + this.trialConvertedAt, + this.trialExpiresAt, + this.trialStatus, this.updatedAt, this.userId, this.userName); @@ -468,6 +510,27 @@ public interface _FinalStage { _FinalStage addAllTraitsUpdated(List traitsUpdated); + /** + *

When the company's trial had converted to a paid subscription as of this change. Null when the trial had not converted, or for changes recorded before trial status was tracked.

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

When the company's trial was set to end as of this change. Null when the company had never trialed, or for changes recorded before trial status was tracked.

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

The company's trial status. Null when the company had never trialed, or for changes recorded before trial status was tracked.

+ */ + _FinalStage trialStatus(Optional trialStatus); + + _FinalStage trialStatus(TrialStatus trialStatus); + _FinalStage userId(Optional userId); _FinalStage userId(String userId); @@ -508,6 +571,12 @@ public static final class Builder private Optional userId = Optional.empty(); + private Optional trialStatus = Optional.empty(); + + private Optional trialExpiresAt = Optional.empty(); + + private Optional trialConvertedAt = Optional.empty(); + private List traitsUpdated = new ArrayList<>(); private Optional subscriptionChangeAction = Optional.empty(); @@ -564,6 +633,9 @@ public Builder from(PlanChangeResponseData other) { requestId(other.getRequestId()); subscriptionChangeAction(other.getSubscriptionChangeAction()); traitsUpdated(other.getTraitsUpdated()); + trialConvertedAt(other.getTrialConvertedAt()); + trialExpiresAt(other.getTrialExpiresAt()); + trialStatus(other.getTrialStatus()); updatedAt(other.getUpdatedAt()); userId(other.getUserId()); userName(other.getUserName()); @@ -656,6 +728,66 @@ public _FinalStage userId(Optional userId) { return this; } + /** + *

The company's trial status. Null when the company had never trialed, or for changes recorded before trial status was tracked.

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

The company's trial status. Null when the company had never trialed, or for changes recorded before trial status was tracked.

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

When the company's trial was set to end as of this change. Null when the company had never trialed, or for changes recorded before trial status was tracked.

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

When the company's trial was set to end as of this change. Null when the company had never trialed, or for changes recorded before trial status was tracked.

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

When the company's trial had converted to a paid subscription as of this change. Null when the trial had not converted, or for changes recorded before trial status was tracked.

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

When the company's trial had converted to a paid subscription as of this change. Null when the trial had not converted, or for changes recorded before trial status was tracked.

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

Any traits were updated as part of this plan change (via pay-in-advance entitlements).

* @return Reference to {@code this} so that method calls can be chained together. @@ -941,6 +1073,9 @@ public PlanChangeResponseData build() { requestId, subscriptionChangeAction, traitsUpdated, + trialConvertedAt, + trialExpiresAt, + trialStatus, updatedAt, userId, userName, diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java index 0877e31..fd1acd4 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java @@ -33,6 +33,8 @@ public final class PlanVersionMigrationPreviewCompanyResponseData { private final boolean willUpdateSubscription; + private final boolean wouldFail; + private final Map additionalProperties; private PlanVersionMigrationPreviewCompanyResponseData( @@ -42,6 +44,7 @@ private PlanVersionMigrationPreviewCompanyResponseData( Optional note, Optional planVersionIdFrom, boolean willUpdateSubscription, + boolean wouldFail, Map additionalProperties) { this.companyId = companyId; this.hasBillingChanges = hasBillingChanges; @@ -49,6 +52,7 @@ private PlanVersionMigrationPreviewCompanyResponseData( this.note = note; this.planVersionIdFrom = planVersionIdFrom; this.willUpdateSubscription = willUpdateSubscription; + this.wouldFail = wouldFail; this.additionalProperties = additionalProperties; } @@ -82,6 +86,11 @@ public boolean getWillUpdateSubscription() { return willUpdateSubscription; } + @JsonProperty("would_fail") + public boolean getWouldFail() { + return wouldFail; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -100,7 +109,8 @@ private boolean equalTo(PlanVersionMigrationPreviewCompanyResponseData other) { && hasCustomPricing == other.hasCustomPricing && note.equals(other.note) && planVersionIdFrom.equals(other.planVersionIdFrom) - && willUpdateSubscription == other.willUpdateSubscription; + && willUpdateSubscription == other.willUpdateSubscription + && wouldFail == other.wouldFail; } @java.lang.Override @@ -111,7 +121,8 @@ public int hashCode() { this.hasCustomPricing, this.note, this.planVersionIdFrom, - this.willUpdateSubscription); + this.willUpdateSubscription, + this.wouldFail); } @java.lang.Override @@ -138,7 +149,11 @@ public interface HasCustomPricingStage { } public interface WillUpdateSubscriptionStage { - _FinalStage willUpdateSubscription(boolean willUpdateSubscription); + WouldFailStage willUpdateSubscription(boolean willUpdateSubscription); + } + + public interface WouldFailStage { + _FinalStage wouldFail(boolean wouldFail); } public interface _FinalStage { @@ -163,6 +178,7 @@ public static final class Builder HasBillingChangesStage, HasCustomPricingStage, WillUpdateSubscriptionStage, + WouldFailStage, _FinalStage { private String companyId; @@ -172,6 +188,8 @@ public static final class Builder private boolean willUpdateSubscription; + private boolean wouldFail; + private Optional planVersionIdFrom = Optional.empty(); private Optional note = Optional.empty(); @@ -189,6 +207,7 @@ public Builder from(PlanVersionMigrationPreviewCompanyResponseData other) { note(other.getNote()); planVersionIdFrom(other.getPlanVersionIdFrom()); willUpdateSubscription(other.getWillUpdateSubscription()); + wouldFail(other.getWouldFail()); return this; } @@ -215,11 +234,18 @@ public WillUpdateSubscriptionStage hasCustomPricing(boolean hasCustomPricing) { @java.lang.Override @JsonSetter("will_update_subscription") - public _FinalStage willUpdateSubscription(boolean willUpdateSubscription) { + public WouldFailStage willUpdateSubscription(boolean willUpdateSubscription) { this.willUpdateSubscription = willUpdateSubscription; return this; } + @java.lang.Override + @JsonSetter("would_fail") + public _FinalStage wouldFail(boolean wouldFail) { + this.wouldFail = wouldFail; + return this; + } + @java.lang.Override public _FinalStage planVersionIdFrom(String planVersionIdFrom) { this.planVersionIdFrom = Optional.ofNullable(planVersionIdFrom); @@ -255,6 +281,7 @@ public PlanVersionMigrationPreviewCompanyResponseData build() { note, planVersionIdFrom, willUpdateSubscription, + wouldFail, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/PreflightEventUsageRequestBody.java b/src/main/java/com/schematic/api/types/PreflightEventUsageRequestBody.java new file mode 100644 index 0000000..412c8e2 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PreflightEventUsageRequestBody.java @@ -0,0 +1,161 @@ +/** + * 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 = PreflightEventUsageRequestBody.Builder.class) +public final class PreflightEventUsageRequestBody { + private final String eventSubtype; + + private final long quantity; + + private final Map additionalProperties; + + private PreflightEventUsageRequestBody( + String eventSubtype, long quantity, Map additionalProperties) { + this.eventSubtype = eventSubtype; + this.quantity = quantity; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event subtype the usage would be recorded under + */ + @JsonProperty("event_subtype") + public String getEventSubtype() { + return eventSubtype; + } + + /** + * @return How many units of the event subtype the action would record. Zero has no effect + */ + @JsonProperty("quantity") + public long getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PreflightEventUsageRequestBody && equalTo((PreflightEventUsageRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PreflightEventUsageRequestBody other) { + return eventSubtype.equals(other.eventSubtype) && quantity == other.quantity; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.eventSubtype, this.quantity); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EventSubtypeStage builder() { + return new Builder(); + } + + public interface EventSubtypeStage { + /** + *

The event subtype the usage would be recorded under

+ */ + QuantityStage eventSubtype(@NotNull String eventSubtype); + + Builder from(PreflightEventUsageRequestBody other); + } + + public interface QuantityStage { + /** + *

How many units of the event subtype the action would record. Zero has no effect

+ */ + _FinalStage quantity(long quantity); + } + + public interface _FinalStage { + PreflightEventUsageRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EventSubtypeStage, QuantityStage, _FinalStage { + private String eventSubtype; + + private long quantity; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PreflightEventUsageRequestBody other) { + eventSubtype(other.getEventSubtype()); + quantity(other.getQuantity()); + return this; + } + + /** + *

The event subtype the usage would be recorded under

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

How many units of the event subtype the action would record. Zero has no effect

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("quantity") + public _FinalStage quantity(long quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public PreflightEventUsageRequestBody build() { + return new PreflightEventUsageRequestBody(eventSubtype, quantity, 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/PreflightRequestBody.java b/src/main/java/com/schematic/api/types/PreflightRequestBody.java new file mode 100644 index 0000000..c7f65ac --- /dev/null +++ b/src/main/java/com/schematic/api/types/PreflightRequestBody.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PreflightRequestBody.Builder.class) +public final class PreflightRequestBody { + private final Optional> creditCost; + + private final Optional eventUsage; + + private final Optional usage; + + private final Map additionalProperties; + + private PreflightRequestBody( + Optional> creditCost, + Optional eventUsage, + Optional usage, + Map additionalProperties) { + this.creditCost = creditCost; + this.eventUsage = eventUsage; + this.usage = usage; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cost in credits of the action, keyed by credit ID, for callers that have already computed it. Takes precedence over usage and event_usage on credit balance conditions for the same credit. A cost of zero means the action is free, not that the input is absent + */ + @JsonProperty("credit_cost") + public Optional> getCreditCost() { + return creditCost; + } + + /** + * @return Usage of a specific event subtype. Preferred over usage when the subtype is known, since it only affects conditions measuring that subtype + */ + @JsonProperty("event_usage") + public Optional getEventUsage() { + return eventUsage; + } + + /** + * @return Quantity of usage to simulate against any numeric condition encountered while evaluating the flag. Zero has no effect + */ + @JsonProperty("usage") + public Optional getUsage() { + return usage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PreflightRequestBody && equalTo((PreflightRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PreflightRequestBody other) { + return creditCost.equals(other.creditCost) && eventUsage.equals(other.eventUsage) && usage.equals(other.usage); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.creditCost, this.eventUsage, this.usage); + } + + @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> creditCost = Optional.empty(); + + private Optional eventUsage = Optional.empty(); + + private Optional usage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PreflightRequestBody other) { + creditCost(other.getCreditCost()); + eventUsage(other.getEventUsage()); + usage(other.getUsage()); + return this; + } + + /** + *

Cost in credits of the action, keyed by credit ID, for callers that have already computed it. Takes precedence over usage and event_usage on credit balance conditions for the same credit. A cost of zero means the action is free, not that the input is absent

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

Usage of a specific event subtype. Preferred over usage when the subtype is known, since it only affects conditions measuring that subtype

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

Quantity of usage to simulate against any numeric condition encountered while evaluating the flag. Zero has no effect

+ */ + @JsonSetter(value = "usage", nulls = Nulls.SKIP) + public Builder usage(Optional usage) { + this.usage = usage; + return this; + } + + public Builder usage(Long usage) { + this.usage = Optional.ofNullable(usage); + return this; + } + + public PreflightRequestBody build() { + return new PreflightRequestBody(creditCost, eventUsage, usage, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java index 5cf2f5f..f6a5ca6 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java @@ -44,6 +44,8 @@ public final class PreviewSubscriptionFinanceResponseData { private final long proration; + private final Optional prorationBilledAt; + private final Optional taxAmount; private final Optional taxDisplayName; @@ -69,6 +71,7 @@ private PreviewSubscriptionFinanceResponseData( OffsetDateTime periodStart, boolean promoCodeApplied, long proration, + Optional prorationBilledAt, Optional taxAmount, Optional taxDisplayName, boolean taxRequireBillingDetails, @@ -86,6 +89,7 @@ private PreviewSubscriptionFinanceResponseData( this.periodStart = periodStart; this.promoCodeApplied = promoCodeApplied; this.proration = proration; + this.prorationBilledAt = prorationBilledAt; this.taxAmount = taxAmount; this.taxDisplayName = taxDisplayName; this.taxRequireBillingDetails = taxRequireBillingDetails; @@ -145,6 +149,11 @@ public long getProration() { return proration; } + @JsonProperty("proration_billed_at") + public Optional getProrationBilledAt() { + return prorationBilledAt; + } + @JsonProperty("tax_amount") public Optional getTaxAmount() { return taxAmount; @@ -198,6 +207,7 @@ private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { && periodStart.equals(other.periodStart) && promoCodeApplied == other.promoCodeApplied && proration == other.proration + && prorationBilledAt.equals(other.prorationBilledAt) && taxAmount.equals(other.taxAmount) && taxDisplayName.equals(other.taxDisplayName) && taxRequireBillingDetails == other.taxRequireBillingDetails @@ -219,6 +229,7 @@ public int hashCode() { this.periodStart, this.promoCodeApplied, this.proration, + this.prorationBilledAt, this.taxAmount, this.taxDisplayName, this.taxRequireBillingDetails, @@ -295,6 +306,10 @@ public interface _FinalStage { _FinalStage addAllDiscounts(List discounts); + _FinalStage prorationBilledAt(Optional prorationBilledAt); + + _FinalStage prorationBilledAt(OffsetDateTime prorationBilledAt); + _FinalStage taxAmount(Optional taxAmount); _FinalStage taxAmount(Long taxAmount); @@ -360,6 +375,8 @@ public static final class Builder private Optional taxAmount = Optional.empty(); + private Optional prorationBilledAt = Optional.empty(); + private List discounts = new ArrayList<>(); @JsonAnySetter @@ -379,6 +396,7 @@ public Builder from(PreviewSubscriptionFinanceResponseData other) { periodStart(other.getPeriodStart()); promoCodeApplied(other.getPromoCodeApplied()); proration(other.getProration()); + prorationBilledAt(other.getProrationBilledAt()); taxAmount(other.getTaxAmount()); taxDisplayName(other.getTaxDisplayName()); taxRequireBillingDetails(other.getTaxRequireBillingDetails()); @@ -531,6 +549,19 @@ public _FinalStage taxAmount(Optional taxAmount) { return this; } + @java.lang.Override + public _FinalStage prorationBilledAt(OffsetDateTime prorationBilledAt) { + this.prorationBilledAt = Optional.ofNullable(prorationBilledAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "proration_billed_at", nulls = Nulls.SKIP) + public _FinalStage prorationBilledAt(Optional prorationBilledAt) { + this.prorationBilledAt = prorationBilledAt; + return this; + } + @java.lang.Override public _FinalStage addAllDiscounts(List discounts) { if (discounts != null) { @@ -568,6 +599,7 @@ public PreviewSubscriptionFinanceResponseData build() { periodStart, promoCodeApplied, proration, + prorationBilledAt, taxAmount, taxDisplayName, taxRequireBillingDetails, diff --git a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java index 63dcb73..215bcd5 100644 --- a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java +++ b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java @@ -7,8 +7,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class RulesEngineSchemaVersion { - public static final RulesEngineSchemaVersion V_5_B_3_E_7220 = - new RulesEngineSchemaVersion(Value.V_5_B_3_E_7220, "v5b3e7220"); + public static final RulesEngineSchemaVersion VC_8_EB_8_DF_4 = + new RulesEngineSchemaVersion(Value.VC_8_EB_8_DF_4, "vc8eb8df4"); public static final RulesEngineSchemaVersion PLACEHOLDER_FOR_FERN_COMPATIBILITY = new RulesEngineSchemaVersion( Value.PLACEHOLDER_FOR_FERN_COMPATIBILITY, "placeholder-for-fern-compatibility"); @@ -46,8 +46,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case V_5_B_3_E_7220: - return visitor.visitV5B3E7220(); + case VC_8_EB_8_DF_4: + return visitor.visitVc8Eb8Df4(); case PLACEHOLDER_FOR_FERN_COMPATIBILITY: return visitor.visitPlaceholderForFernCompatibility(); case UNKNOWN: @@ -59,8 +59,8 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static RulesEngineSchemaVersion valueOf(String value) { switch (value) { - case "v5b3e7220": - return V_5_B_3_E_7220; + case "vc8eb8df4": + return VC_8_EB_8_DF_4; case "placeholder-for-fern-compatibility": return PLACEHOLDER_FOR_FERN_COMPATIBILITY; default: @@ -69,7 +69,7 @@ public static RulesEngineSchemaVersion valueOf(String value) { } public enum Value { - V_5_B_3_E_7220, + VC_8_EB_8_DF_4, PLACEHOLDER_FOR_FERN_COMPATIBILITY, @@ -77,7 +77,7 @@ public enum Value { } public interface Visitor { - T visitV5B3E7220(); + T visitVc8Eb8Df4(); T visitPlaceholderForFernCompatibility(); diff --git a/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java b/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java index 32ca1ee..444349b 100644 --- a/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java +++ b/src/main/java/com/schematic/api/types/StripeIntegrationConfig.java @@ -32,6 +32,8 @@ public final class StripeIntegrationConfig { private final Optional onboardUrl; + private final Optional returnTo; + private final Map additionalProperties; private StripeIntegrationConfig( @@ -41,6 +43,7 @@ private StripeIntegrationConfig( boolean isSandbox, boolean liveMode, Optional onboardUrl, + Optional returnTo, Map additionalProperties) { this.accountId = accountId; this.accountName = accountName; @@ -48,6 +51,7 @@ private StripeIntegrationConfig( this.isSandbox = isSandbox; this.liveMode = liveMode; this.onboardUrl = onboardUrl; + this.returnTo = returnTo; this.additionalProperties = additionalProperties; } @@ -99,6 +103,14 @@ public Optional getOnboardUrl() { return onboardUrl; } + /** + * @return App location that started the connect flow; the OAuth callback redirects back there on success + */ + @JsonProperty("return_to") + public Optional getReturnTo() { + return returnTo; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -116,7 +128,8 @@ private boolean equalTo(StripeIntegrationConfig other) { && companyUpdateOnly.equals(other.companyUpdateOnly) && isSandbox == other.isSandbox && liveMode == other.liveMode - && onboardUrl.equals(other.onboardUrl); + && onboardUrl.equals(other.onboardUrl) + && returnTo.equals(other.returnTo); } @java.lang.Override @@ -127,7 +140,8 @@ public int hashCode() { this.companyUpdateOnly, this.isSandbox, this.liveMode, - this.onboardUrl); + this.onboardUrl, + this.returnTo); } @java.lang.Override @@ -189,6 +203,13 @@ public interface _FinalStage { _FinalStage onboardUrl(Optional onboardUrl); _FinalStage onboardUrl(String onboardUrl); + + /** + *

App location that started the connect flow; the OAuth callback redirects back there on success

+ */ + _FinalStage returnTo(Optional returnTo); + + _FinalStage returnTo(String returnTo); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -197,6 +218,8 @@ public static final class Builder implements IsSandboxStage, LiveModeStage, _Fin private boolean liveMode; + private Optional returnTo = Optional.empty(); + private Optional onboardUrl = Optional.empty(); private Optional companyUpdateOnly = Optional.empty(); @@ -218,6 +241,7 @@ public Builder from(StripeIntegrationConfig other) { isSandbox(other.getIsSandbox()); liveMode(other.getLiveMode()); onboardUrl(other.getOnboardUrl()); + returnTo(other.getReturnTo()); return this; } @@ -243,6 +267,26 @@ public _FinalStage liveMode(boolean liveMode) { return this; } + /** + *

App location that started the connect flow; the OAuth callback redirects back there on success

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

App location that started the connect flow; the OAuth callback redirects back there on success

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

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

* @return Reference to {@code this} so that method calls can be chained together. @@ -326,7 +370,14 @@ public _FinalStage accountId(Optional accountId) { @java.lang.Override public StripeIntegrationConfig build() { return new StripeIntegrationConfig( - accountId, accountName, companyUpdateOnly, isSandbox, liveMode, onboardUrl, additionalProperties); + accountId, + accountName, + companyUpdateOnly, + isSandbox, + liveMode, + onboardUrl, + returnTo, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/UpcomingInvoiceResponseData.java b/src/main/java/com/schematic/api/types/UpcomingInvoiceResponseData.java new file mode 100644 index 0000000..a7f56cf --- /dev/null +++ b/src/main/java/com/schematic/api/types/UpcomingInvoiceResponseData.java @@ -0,0 +1,676 @@ +/** + * 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 = UpcomingInvoiceResponseData.Builder.class) +public final class UpcomingInvoiceResponseData { + private final long amountDue; + + private final long amountPaid; + + private final long amountRemaining; + + private final String collectionMethod; + + private final Optional companyId; + + private final OffsetDateTime createdAt; + + private final String currency; + + private final String customerExternalId; + + private final Optional dueDate; + + private final long endingBalance; + + private final String environmentId; + + private final Optional externalId; + + private final Optional paymentMethodExternalId; + + private final BillingProviderType providerType; + + private final long startingBalance; + + private final Optional status; + + private final Optional subscriptionExternalId; + + private final long subtotal; + + private final OffsetDateTime updatedAt; + + private final Optional url; + + private final Map additionalProperties; + + private UpcomingInvoiceResponseData( + long amountDue, + long amountPaid, + long amountRemaining, + String collectionMethod, + Optional companyId, + OffsetDateTime createdAt, + String currency, + String customerExternalId, + Optional dueDate, + long endingBalance, + String environmentId, + Optional externalId, + Optional paymentMethodExternalId, + BillingProviderType providerType, + long startingBalance, + Optional status, + Optional subscriptionExternalId, + long subtotal, + OffsetDateTime updatedAt, + Optional url, + Map additionalProperties) { + this.amountDue = amountDue; + this.amountPaid = amountPaid; + this.amountRemaining = amountRemaining; + this.collectionMethod = collectionMethod; + this.companyId = companyId; + this.createdAt = createdAt; + this.currency = currency; + this.customerExternalId = customerExternalId; + this.dueDate = dueDate; + this.endingBalance = endingBalance; + this.environmentId = environmentId; + this.externalId = externalId; + this.paymentMethodExternalId = paymentMethodExternalId; + this.providerType = providerType; + this.startingBalance = startingBalance; + this.status = status; + this.subscriptionExternalId = subscriptionExternalId; + this.subtotal = subtotal; + this.updatedAt = updatedAt; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount_due") + public long getAmountDue() { + return amountDue; + } + + @JsonProperty("amount_paid") + public long getAmountPaid() { + return amountPaid; + } + + @JsonProperty("amount_remaining") + public long getAmountRemaining() { + return amountRemaining; + } + + @JsonProperty("collection_method") + public String getCollectionMethod() { + return collectionMethod; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("customer_external_id") + public String getCustomerExternalId() { + return customerExternalId; + } + + @JsonProperty("due_date") + public Optional getDueDate() { + return dueDate; + } + + @JsonProperty("ending_balance") + public long getEndingBalance() { + return endingBalance; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + + @JsonProperty("payment_method_external_id") + public Optional getPaymentMethodExternalId() { + return paymentMethodExternalId; + } + + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + + @JsonProperty("starting_balance") + public long getStartingBalance() { + return startingBalance; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @JsonProperty("subscription_external_id") + public Optional getSubscriptionExternalId() { + return subscriptionExternalId; + } + + @JsonProperty("subtotal") + public long getSubtotal() { + return subtotal; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpcomingInvoiceResponseData && equalTo((UpcomingInvoiceResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpcomingInvoiceResponseData other) { + return amountDue == other.amountDue + && amountPaid == other.amountPaid + && amountRemaining == other.amountRemaining + && collectionMethod.equals(other.collectionMethod) + && companyId.equals(other.companyId) + && createdAt.equals(other.createdAt) + && currency.equals(other.currency) + && customerExternalId.equals(other.customerExternalId) + && dueDate.equals(other.dueDate) + && endingBalance == other.endingBalance + && environmentId.equals(other.environmentId) + && externalId.equals(other.externalId) + && paymentMethodExternalId.equals(other.paymentMethodExternalId) + && providerType.equals(other.providerType) + && startingBalance == other.startingBalance + && status.equals(other.status) + && subscriptionExternalId.equals(other.subscriptionExternalId) + && subtotal == other.subtotal + && updatedAt.equals(other.updatedAt) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amountDue, + this.amountPaid, + this.amountRemaining, + this.collectionMethod, + this.companyId, + this.createdAt, + this.currency, + this.customerExternalId, + this.dueDate, + this.endingBalance, + this.environmentId, + this.externalId, + this.paymentMethodExternalId, + this.providerType, + this.startingBalance, + this.status, + this.subscriptionExternalId, + this.subtotal, + this.updatedAt, + this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountDueStage builder() { + return new Builder(); + } + + public interface AmountDueStage { + AmountPaidStage amountDue(long amountDue); + + Builder from(UpcomingInvoiceResponseData other); + } + + public interface AmountPaidStage { + AmountRemainingStage amountPaid(long amountPaid); + } + + public interface AmountRemainingStage { + CollectionMethodStage amountRemaining(long amountRemaining); + } + + public interface CollectionMethodStage { + CreatedAtStage collectionMethod(@NotNull String collectionMethod); + } + + public interface CreatedAtStage { + CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CurrencyStage { + CustomerExternalIdStage currency(@NotNull String currency); + } + + public interface CustomerExternalIdStage { + EndingBalanceStage customerExternalId(@NotNull String customerExternalId); + } + + public interface EndingBalanceStage { + EnvironmentIdStage endingBalance(long endingBalance); + } + + public interface EnvironmentIdStage { + ProviderTypeStage environmentId(@NotNull String environmentId); + } + + public interface ProviderTypeStage { + StartingBalanceStage providerType(@NotNull BillingProviderType providerType); + } + + public interface StartingBalanceStage { + SubtotalStage startingBalance(long startingBalance); + } + + public interface SubtotalStage { + UpdatedAtStage subtotal(long subtotal); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + UpcomingInvoiceResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage dueDate(Optional dueDate); + + _FinalStage dueDate(OffsetDateTime dueDate); + + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + + _FinalStage paymentMethodExternalId(Optional paymentMethodExternalId); + + _FinalStage paymentMethodExternalId(String paymentMethodExternalId); + + _FinalStage status(Optional status); + + _FinalStage status(InvoiceStatus status); + + _FinalStage subscriptionExternalId(Optional subscriptionExternalId); + + _FinalStage subscriptionExternalId(String subscriptionExternalId); + + _FinalStage url(Optional url); + + _FinalStage url(String url); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountDueStage, + AmountPaidStage, + AmountRemainingStage, + CollectionMethodStage, + CreatedAtStage, + CurrencyStage, + CustomerExternalIdStage, + EndingBalanceStage, + EnvironmentIdStage, + ProviderTypeStage, + StartingBalanceStage, + SubtotalStage, + UpdatedAtStage, + _FinalStage { + private long amountDue; + + private long amountPaid; + + private long amountRemaining; + + private String collectionMethod; + + private OffsetDateTime createdAt; + + private String currency; + + private String customerExternalId; + + private long endingBalance; + + private String environmentId; + + private BillingProviderType providerType; + + private long startingBalance; + + private long subtotal; + + private OffsetDateTime updatedAt; + + private Optional url = Optional.empty(); + + private Optional subscriptionExternalId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional paymentMethodExternalId = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional dueDate = Optional.empty(); + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpcomingInvoiceResponseData other) { + amountDue(other.getAmountDue()); + amountPaid(other.getAmountPaid()); + amountRemaining(other.getAmountRemaining()); + collectionMethod(other.getCollectionMethod()); + companyId(other.getCompanyId()); + createdAt(other.getCreatedAt()); + currency(other.getCurrency()); + customerExternalId(other.getCustomerExternalId()); + dueDate(other.getDueDate()); + endingBalance(other.getEndingBalance()); + environmentId(other.getEnvironmentId()); + externalId(other.getExternalId()); + paymentMethodExternalId(other.getPaymentMethodExternalId()); + providerType(other.getProviderType()); + startingBalance(other.getStartingBalance()); + status(other.getStatus()); + subscriptionExternalId(other.getSubscriptionExternalId()); + subtotal(other.getSubtotal()); + updatedAt(other.getUpdatedAt()); + url(other.getUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("amount_due") + public AmountPaidStage amountDue(long amountDue) { + this.amountDue = amountDue; + return this; + } + + @java.lang.Override + @JsonSetter("amount_paid") + public AmountRemainingStage amountPaid(long amountPaid) { + this.amountPaid = amountPaid; + return this; + } + + @java.lang.Override + @JsonSetter("amount_remaining") + public CollectionMethodStage amountRemaining(long amountRemaining) { + this.amountRemaining = amountRemaining; + return this; + } + + @java.lang.Override + @JsonSetter("collection_method") + public CreatedAtStage collectionMethod(@NotNull String collectionMethod) { + this.collectionMethod = Objects.requireNonNull(collectionMethod, "collectionMethod must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public CustomerExternalIdStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("customer_external_id") + public EndingBalanceStage customerExternalId(@NotNull String customerExternalId) { + this.customerExternalId = Objects.requireNonNull(customerExternalId, "customerExternalId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("ending_balance") + public EnvironmentIdStage endingBalance(long endingBalance) { + this.endingBalance = endingBalance; + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public ProviderTypeStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("provider_type") + public StartingBalanceStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("starting_balance") + public SubtotalStage startingBalance(long startingBalance) { + this.startingBalance = startingBalance; + return this; + } + + @java.lang.Override + @JsonSetter("subtotal") + public UpdatedAtStage subtotal(long subtotal) { + this.subtotal = subtotal; + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + @java.lang.Override + public _FinalStage subscriptionExternalId(String subscriptionExternalId) { + this.subscriptionExternalId = Optional.ofNullable(subscriptionExternalId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "subscription_external_id", nulls = Nulls.SKIP) + public _FinalStage subscriptionExternalId(Optional subscriptionExternalId) { + this.subscriptionExternalId = subscriptionExternalId; + return this; + } + + @java.lang.Override + public _FinalStage status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public _FinalStage paymentMethodExternalId(String paymentMethodExternalId) { + this.paymentMethodExternalId = Optional.ofNullable(paymentMethodExternalId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "payment_method_external_id", nulls = Nulls.SKIP) + public _FinalStage paymentMethodExternalId(Optional paymentMethodExternalId) { + this.paymentMethodExternalId = paymentMethodExternalId; + return this; + } + + @java.lang.Override + public _FinalStage externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + @java.lang.Override + public _FinalStage dueDate(OffsetDateTime dueDate) { + this.dueDate = Optional.ofNullable(dueDate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "due_date", nulls = Nulls.SKIP) + public _FinalStage dueDate(Optional dueDate) { + this.dueDate = dueDate; + return this; + } + + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + @java.lang.Override + public UpcomingInvoiceResponseData build() { + return new UpcomingInvoiceResponseData( + amountDue, + amountPaid, + amountRemaining, + collectionMethod, + companyId, + createdAt, + currency, + customerExternalId, + dueDate, + endingBalance, + environmentId, + externalId, + paymentMethodExternalId, + providerType, + startingBalance, + status, + subscriptionExternalId, + subtotal, + updatedAt, + url, + 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/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java index 2353d2a..16a488e 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -175,6 +175,9 @@ public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; } + /** + * @return Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility. + */ @JsonProperty("can_buy_bundles") public Optional getCanBuyBundles() { return canBuyBundles; @@ -383,6 +386,9 @@ public interface _FinalStage { _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); + /** + *

Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility.

+ */ _FinalStage canBuyBundles(Optional canBuyBundles); _FinalStage canBuyBundles(Boolean canBuyBundles); @@ -676,12 +682,19 @@ public _FinalStage companyCreditAmount(Optional companyCreditAmount) { return this; } + /** + *

Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility.

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

Deprecated: use compatible_plan_ids on credit bundles instead. Still accepted; writes through to the credit's bundle compatibility.

+ */ @java.lang.Override @JsonSetter(value = "can_buy_bundles", nulls = Nulls.SKIP) public _FinalStage canBuyBundles(Optional canBuyBundles) {