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