diff --git a/build.gradle b/build.gradle index 46a07fb..6896826 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ java { group = 'com.schematichq' -version = '1.1.0' +version = '1.1.1' jar { dependsOn(":generatePomFileForMavenPublication") @@ -79,7 +79,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.1.0' + version = '1.1.1' from components.java pom { name = 'schematic' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..e18bc25 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/com/schematic/api/Schematic.java b/src/main/java/com/schematic/api/Schematic.java index 283ae44..eac478f 100644 --- a/src/main/java/com/schematic/api/Schematic.java +++ b/src/main/java/com/schematic/api/Schematic.java @@ -137,7 +137,7 @@ private static ClientOptions buildClientOptions(String apiKey, Builder builder) String basePath = builder.basePath != null ? builder.basePath : "https://api.schematichq.com"; return ClientOptions.builder() .environment(Environment.custom(basePath)) - .addHeader("Authorization", "Bearer " + apiKey) + .addHeader("X-Schematic-Api-Key", apiKey) .addHeader("Content-Type", "application/json") .build(); } diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index f685454..653a2c9 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -33,7 +33,7 @@ private ClientOptions( { put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.1.0"); + put("X-Fern-SDK-Version", "1.1.1"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/core/Stream.java b/src/main/java/com/schematic/api/core/Stream.java index 219cda1..89ae9c7 100644 --- a/src/main/java/com/schematic/api/core/Stream.java +++ b/src/main/java/com/schematic/api/core/Stream.java @@ -9,7 +9,7 @@ import java.util.Scanner; /** - * The {@code Stream} class implmenets {@link Iterable} to provide a simple mechanism for reading and parsing + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. *

* {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a @@ -23,7 +23,7 @@ public final class Stream implements Iterable { */ private final Class valueType; /** - * The {@link Scanner} used for reading from the input stream and blocking when neede during iteration. + * The {@link Scanner} used for reading from the input stream and blocking when needed during iteration. */ private final Scanner scanner; diff --git a/src/main/java/com/schematic/api/resources/accesstokens/AccesstokensClient.java b/src/main/java/com/schematic/api/resources/accesstokens/AccesstokensClient.java index 05807ab..6f6bd7a 100644 --- a/src/main/java/com/schematic/api/resources/accesstokens/AccesstokensClient.java +++ b/src/main/java/com/schematic/api/resources/accesstokens/AccesstokensClient.java @@ -55,6 +55,7 @@ public IssueTemporaryAccessTokenResponse issueTemporaryAccessToken( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/billing/BillingClient.java b/src/main/java/com/schematic/api/resources/billing/BillingClient.java index ab399c2..e706a29 100644 --- a/src/main/java/com/schematic/api/resources/billing/BillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/BillingClient.java @@ -88,6 +88,7 @@ public UpsertBillingCouponResponse upsertBillingCoupon( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -148,6 +149,7 @@ public UpsertBillingCustomerResponse upsertBillingCustomer( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -218,7 +220,8 @@ public ListCustomersResponse listCustomers(ListCustomersRequest request, Request .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -289,7 +292,8 @@ public CountCustomersResponse countCustomers(CountCustomersRequest request, Requ .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -355,7 +359,8 @@ public ListInvoicesResponse listInvoices(ListInvoicesRequest request, RequestOpt .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -415,6 +420,7 @@ public UpsertInvoiceResponse upsertInvoice(CreateInvoiceRequestBody request, Req .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -478,7 +484,8 @@ public ListMetersResponse listMeters(ListMetersRequest request, RequestOptions r .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -539,6 +546,7 @@ public UpsertBillingMeterResponse upsertBillingMeter( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -605,7 +613,8 @@ public ListPaymentMethodsResponse listPaymentMethods( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -666,6 +675,7 @@ public UpsertPaymentMethodResponse upsertPaymentMethod( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -739,7 +749,8 @@ public SearchBillingPricesResponse searchBillingPrices( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -800,6 +811,7 @@ public UpsertBillingPriceResponse upsertBillingPrice( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -887,7 +899,8 @@ public ListProductPricesResponse listProductPrices( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -941,6 +954,7 @@ public DeleteProductPriceResponse deleteProductPrice(String billingId, RequestOp .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1001,6 +1015,7 @@ public UpsertBillingProductResponse upsertBillingProduct( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1088,7 +1103,8 @@ public ListBillingProductsResponse listBillingProducts( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1176,7 +1192,8 @@ public CountBillingProductsResponse countBillingProducts( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1237,6 +1254,7 @@ public UpsertBillingSubscriptionResponse upsertBillingSubscription( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java index 4bdf0c1..c64a0c4 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java @@ -25,6 +25,8 @@ public final class CreateBillingPriceRequestBody { private final String interval; + private final boolean isActive; + private final Optional meterId; private final int price; @@ -40,6 +42,7 @@ public final class CreateBillingPriceRequestBody { private CreateBillingPriceRequestBody( String currency, String interval, + boolean isActive, Optional meterId, int price, String priceExternalId, @@ -48,6 +51,7 @@ private CreateBillingPriceRequestBody( Map additionalProperties) { this.currency = currency; this.interval = interval; + this.isActive = isActive; this.meterId = meterId; this.price = price; this.priceExternalId = priceExternalId; @@ -66,6 +70,11 @@ public String getInterval() { return interval; } + @JsonProperty("is_active") + public boolean getIsActive() { + return isActive; + } + @JsonProperty("meter_id") public Optional getMeterId() { return meterId; @@ -105,6 +114,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateBillingPriceRequestBody other) { return currency.equals(other.currency) && interval.equals(other.interval) + && isActive == other.isActive && meterId.equals(other.meterId) && price == other.price && priceExternalId.equals(other.priceExternalId) @@ -117,6 +127,7 @@ public int hashCode() { return Objects.hash( this.currency, this.interval, + this.isActive, this.meterId, this.price, this.priceExternalId, @@ -140,7 +151,11 @@ public interface CurrencyStage { } public interface IntervalStage { - PriceStage interval(@NotNull String interval); + IsActiveStage interval(@NotNull String interval); + } + + public interface IsActiveStage { + PriceStage isActive(boolean isActive); } public interface PriceStage { @@ -171,6 +186,7 @@ public interface _FinalStage { public static final class Builder implements CurrencyStage, IntervalStage, + IsActiveStage, PriceStage, PriceExternalIdStage, ProductExternalIdStage, @@ -180,6 +196,8 @@ public static final class Builder private String interval; + private boolean isActive; + private int price; private String priceExternalId; @@ -199,6 +217,7 @@ private Builder() {} public Builder from(CreateBillingPriceRequestBody other) { currency(other.getCurrency()); interval(other.getInterval()); + isActive(other.getIsActive()); meterId(other.getMeterId()); price(other.getPrice()); priceExternalId(other.getPriceExternalId()); @@ -216,11 +235,18 @@ public IntervalStage currency(@NotNull String currency) { @java.lang.Override @JsonSetter("interval") - public PriceStage interval(@NotNull String interval) { + public IsActiveStage interval(@NotNull String interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } + @java.lang.Override + @JsonSetter("is_active") + public PriceStage isActive(boolean isActive) { + this.isActive = isActive; + return this; + } + @java.lang.Override @JsonSetter("price") public PriceExternalIdStage price(int price) { @@ -267,6 +293,7 @@ public CreateBillingPriceRequestBody build() { return new CreateBillingPriceRequestBody( currency, interval, + isActive, meterId, price, priceExternalId, diff --git a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java index da36bfd..aa0c5f6 100644 --- a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java @@ -17,6 +17,7 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; +import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; import com.schematic.api.resources.checkout.types.PreviewCheckoutInternalResponse; import com.schematic.api.resources.checkout.types.UpdateCustomerSubscriptionTrialEndResponse; import com.schematic.api.types.ApiError; @@ -59,6 +60,7 @@ public CheckoutInternalResponse internal( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -97,6 +99,61 @@ public CheckoutInternalResponse internal( } } + public GetCheckoutDataResponse getCheckoutData(String checkoutInternalId) { + return getCheckoutData(checkoutInternalId, null); + } + + public GetCheckoutDataResponse getCheckoutData(String checkoutInternalId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("checkout-internal") + .addPathSegment(checkoutInternalId) + .addPathSegments("data") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCheckoutDataResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public PreviewCheckoutInternalResponse previewCheckoutInternal(ChangeSubscriptionInternalRequestBody request) { return previewCheckoutInternal(request, null); } @@ -119,6 +176,7 @@ public PreviewCheckoutInternalResponse previewCheckoutInternal( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -158,6 +216,11 @@ public PreviewCheckoutInternalResponse previewCheckoutInternal( } } + public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTrialEnd(String subscriptionId) { + return updateCustomerSubscriptionTrialEnd( + subscriptionId, UpdateTrialEndRequestBody.builder().build()); + } + public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTrialEnd( String subscriptionId, UpdateTrialEndRequestBody request) { return updateCustomerSubscriptionTrialEnd(subscriptionId, request, null); @@ -183,6 +246,7 @@ public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTria .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java new file mode 100644 index 0000000..bb79648 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.checkout.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CheckoutDataResponseData; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetCheckoutDataResponse.Builder.class) +public final class GetCheckoutDataResponse { + private final CheckoutDataResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetCheckoutDataResponse( + CheckoutDataResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CheckoutDataResponseData getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public Map getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetCheckoutDataResponse && equalTo((GetCheckoutDataResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetCheckoutDataResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull CheckoutDataResponseData data); + + Builder from(GetCheckoutDataResponse other); + } + + public interface _FinalStage { + GetCheckoutDataResponse build(); + + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private CheckoutDataResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetCheckoutDataResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CheckoutDataResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage params(String key, JsonNode value) { + this.params.put(key, value); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllParams(Map params) { + this.params.putAll(params); + return this; + } + + @java.lang.Override + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public _FinalStage params(Map params) { + this.params.clear(); + this.params.putAll(params); + return this; + } + + @java.lang.Override + public GetCheckoutDataResponse build() { + return new GetCheckoutDataResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/components/ComponentsClient.java b/src/main/java/com/schematic/api/resources/components/ComponentsClient.java index f556811..8984543 100644 --- a/src/main/java/com/schematic/api/resources/components/ComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/ComponentsClient.java @@ -69,7 +69,8 @@ public ListComponentsResponse listComponents(ListComponentsRequest request, Requ .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -129,6 +130,7 @@ public CreateComponentResponse createComponent(CreateComponentRequestBody reques .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -182,6 +184,7 @@ public GetComponentResponse getComponent(String componentId, RequestOptions requ .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -220,6 +223,10 @@ public GetComponentResponse getComponent(String componentId, RequestOptions requ } } + public UpdateComponentResponse updateComponent(String componentId) { + return updateComponent(componentId, UpdateComponentRequestBody.builder().build()); + } + public UpdateComponentResponse updateComponent(String componentId, UpdateComponentRequestBody request) { return updateComponent(componentId, request, null); } @@ -243,6 +250,7 @@ public UpdateComponentResponse updateComponent( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -299,6 +307,7 @@ public DeleteComponentResponse deleteComponent(String componentId, RequestOption .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -362,7 +371,8 @@ public CountComponentsResponse countComponents(CountComponentsRequest request, R .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -424,7 +434,8 @@ public PreviewComponentDataResponse previewComponentData( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/crm/CrmClient.java b/src/main/java/com/schematic/api/resources/crm/CrmClient.java index fde1ba8..337cdfe 100644 --- a/src/main/java/com/schematic/api/resources/crm/CrmClient.java +++ b/src/main/java/com/schematic/api/resources/crm/CrmClient.java @@ -64,6 +64,7 @@ public UpsertDealLineItemAssociationResponse upsertDealLineItemAssociation( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -124,6 +125,7 @@ public UpsertLineItemResponse upsertLineItem(CreateCrmLineItemRequestBody reques .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -183,6 +185,7 @@ public UpsertCrmDealResponse upsertCrmDeal(CreateCrmDealRequestBody request, Req .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -249,7 +252,8 @@ public ListCrmProductsResponse listCrmProducts(ListCrmProductsRequest request, R .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -310,6 +314,7 @@ public UpsertCrmProductResponse upsertCrmProduct( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/events/EventsClient.java b/src/main/java/com/schematic/api/resources/events/EventsClient.java index e8d8851..e253a96 100644 --- a/src/main/java/com/schematic/api/resources/events/EventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/EventsClient.java @@ -64,6 +64,7 @@ public CreateEventBatchResponse createEventBatch( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -132,7 +133,8 @@ public GetEventSummariesResponse getEventSummaries( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -208,7 +210,8 @@ public ListEventsResponse listEvents(ListEventsRequest request, RequestOptions r .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -268,6 +271,7 @@ public CreateEventResponse createEvent(CreateEventRequestBody request, RequestOp .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -321,6 +325,7 @@ public GetEventResponse getEvent(String eventId, RequestOptions requestOptions) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -373,6 +378,7 @@ public GetSegmentIntegrationStatusResponse getSegmentIntegrationStatus(RequestOp .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/features/FeaturesClient.java b/src/main/java/com/schematic/api/resources/features/FeaturesClient.java index 37ede56..53d8882 100644 --- a/src/main/java/com/schematic/api/resources/features/FeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/FeaturesClient.java @@ -83,6 +83,7 @@ public CountAudienceCompaniesResponse countAudienceCompanies( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -142,6 +143,7 @@ public CountAudienceUsersResponse countAudienceUsers(AudienceRequestBody request .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -202,6 +204,7 @@ public ListAudienceCompaniesResponse listAudienceCompanies( .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -261,6 +264,7 @@ public ListAudienceUsersResponse listAudienceUsers(AudienceRequestBody request, .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -337,7 +341,8 @@ public ListFeaturesResponse listFeatures(ListFeaturesRequest request, RequestOpt .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -397,6 +402,7 @@ public CreateFeatureResponse createFeature(CreateFeatureRequestBody request, Req .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -450,6 +456,7 @@ public GetFeatureResponse getFeature(String featureId, RequestOptions requestOpt .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -488,6 +495,10 @@ public GetFeatureResponse getFeature(String featureId, RequestOptions requestOpt } } + public UpdateFeatureResponse updateFeature(String featureId) { + return updateFeature(featureId, UpdateFeatureRequestBody.builder().build()); + } + public UpdateFeatureResponse updateFeature(String featureId, UpdateFeatureRequestBody request) { return updateFeature(featureId, request, null); } @@ -511,6 +522,7 @@ public UpdateFeatureResponse updateFeature( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -567,6 +579,7 @@ public DeleteFeatureResponse deleteFeature(String featureId, RequestOptions requ .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -643,7 +656,8 @@ public CountFeaturesResponse countFeatures(CountFeaturesRequest request, Request .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -713,7 +727,8 @@ public ListFlagsResponse listFlags(ListFlagsRequest request, RequestOptions requ .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -773,6 +788,7 @@ public CreateFlagResponse createFlag(CreateFlagRequestBody request, RequestOptio .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -826,6 +842,7 @@ public GetFlagResponse getFlag(String flagId, RequestOptions requestOptions) { .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -886,6 +903,7 @@ public UpdateFlagResponse updateFlag(String flagId, CreateFlagRequestBody reques .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -942,6 +960,7 @@ public DeleteFlagResponse deleteFlag(String flagId, RequestOptions requestOption .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1004,6 +1023,7 @@ public UpdateFlagRulesResponse updateFlagRules( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1072,6 +1092,7 @@ public CheckFlagResponse checkFlag(String key, CheckFlagRequestBody request, Req .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1135,6 +1156,7 @@ public CheckFlagsResponse checkFlags(CheckFlagRequestBody request, RequestOption .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -1204,7 +1226,8 @@ public CountFlagsResponse countFlags(CountFlagsRequest request, RequestOptions r .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java index a21ef0b..b9465b6 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java @@ -51,6 +51,7 @@ public GetPlanGroupResponse getPlanGroup(RequestOptions requestOptions) { .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -110,6 +111,7 @@ public CreatePlanGroupResponse createPlanGroup(CreatePlanGroupRequestBody reques .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -171,6 +173,7 @@ public UpdatePlanGroupResponse updatePlanGroup( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/plans/PlansClient.java b/src/main/java/com/schematic/api/resources/plans/PlansClient.java index bfa9075..845ec8b 100644 --- a/src/main/java/com/schematic/api/resources/plans/PlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/PlansClient.java @@ -19,6 +19,7 @@ import com.schematic.api.resources.plans.requests.CreatePlanRequestBody; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.UpdateAudienceRequestBody; +import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; import com.schematic.api.resources.plans.requests.UpdatePlanRequestBody; import com.schematic.api.resources.plans.requests.UpsertBillingProductRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; @@ -29,6 +30,7 @@ import com.schematic.api.resources.plans.types.GetPlanResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; import com.schematic.api.resources.plans.types.UpdateAudienceResponse; +import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; import com.schematic.api.types.ApiError; @@ -48,6 +50,71 @@ public PlansClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public UpdateCompanyPlansResponse updateCompanyPlans(String companyPlanId, UpdateCompanyPlansRequestBody request) { + return updateCompanyPlans(companyPlanId, request, null); + } + + public UpdateCompanyPlansResponse updateCompanyPlans( + String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("company-plans") + .addPathSegment(companyPlanId) + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateCompanyPlansResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class)); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public GetAudienceResponse getAudience(String planAudienceId) { return getAudience(planAudienceId, null); } @@ -63,6 +130,7 @@ public GetAudienceResponse getAudience(String planAudienceId, RequestOptions req .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -124,6 +192,7 @@ public UpdateAudienceResponse updateAudience( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -180,6 +249,7 @@ public DeleteAudienceResponse deleteAudience(String planAudienceId, RequestOptio .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -255,6 +325,11 @@ public ListPlansResponse listPlans(ListPlansRequest request, RequestOptions requ httpUrl.addQueryParameter( "without_product_id", request.getWithoutProductId().get().toString()); } + if (request.getWithoutPaidProductId().isPresent()) { + httpUrl.addQueryParameter( + "without_paid_product_id", + request.getWithoutPaidProductId().get().toString()); + } if (request.getLimit().isPresent()) { httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); } @@ -265,7 +340,8 @@ public ListPlansResponse listPlans(ListPlansRequest request, RequestOptions requ .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -325,6 +401,7 @@ public CreatePlanResponse createPlan(CreatePlanRequestBody request, RequestOptio .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -378,6 +455,7 @@ public GetPlanResponse getPlan(String planId, RequestOptions requestOptions) { .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -438,6 +516,7 @@ public UpdatePlanResponse updatePlan(String planId, UpdatePlanRequestBody reques .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -494,6 +573,7 @@ public DeletePlanResponse deletePlan(String planId, RequestOptions requestOption .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -557,6 +637,7 @@ public UpsertBillingProductPlanResponse upsertBillingProductPlan( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -636,6 +717,11 @@ public CountPlansResponse countPlans(CountPlansRequest request, RequestOptions r httpUrl.addQueryParameter( "without_product_id", request.getWithoutProductId().get().toString()); } + if (request.getWithoutPaidProductId().isPresent()) { + httpUrl.addQueryParameter( + "without_paid_product_id", + request.getWithoutPaidProductId().get().toString()); + } if (request.getLimit().isPresent()) { httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); } @@ -646,7 +732,8 @@ public CountPlansResponse countPlans(CountPlansRequest request, RequestOptions r .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java index dfd6418..f674dc9 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java @@ -35,6 +35,8 @@ public final class CountPlansRequest { private final Optional withoutProductId; + private final Optional withoutPaidProductId; + private final Optional limit; private final Optional offset; @@ -49,6 +51,7 @@ private CountPlansRequest( Optional q, Optional withoutEntitlementFor, Optional withoutProductId, + Optional withoutPaidProductId, Optional limit, Optional offset, Map additionalProperties) { @@ -59,6 +62,7 @@ private CountPlansRequest( this.q = q; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutProductId = withoutProductId; + this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -111,6 +115,14 @@ public Optional getWithoutProductId() { return withoutProductId; } + /** + * @return Filter out plans that have a paid billing product ID + */ + @JsonProperty("without_paid_product_id") + public Optional getWithoutPaidProductId() { + return withoutPaidProductId; + } + /** * @return Page limit (default 100) */ @@ -146,6 +158,7 @@ private boolean equalTo(CountPlansRequest other) { && q.equals(other.q) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutProductId.equals(other.withoutProductId) + && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -160,6 +173,7 @@ public int hashCode() { this.q, this.withoutEntitlementFor, this.withoutProductId, + this.withoutPaidProductId, this.limit, this.offset); } @@ -189,6 +203,8 @@ public static final class Builder { private Optional withoutProductId = Optional.empty(); + private Optional withoutPaidProductId = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -206,6 +222,7 @@ public Builder from(CountPlansRequest other) { q(other.getQ()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutProductId(other.getWithoutProductId()); + withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -288,6 +305,17 @@ public Builder withoutProductId(Boolean withoutProductId) { return this; } + @JsonSetter(value = "without_paid_product_id", nulls = Nulls.SKIP) + public Builder withoutPaidProductId(Optional withoutPaidProductId) { + this.withoutPaidProductId = withoutPaidProductId; + return this; + } + + public Builder withoutPaidProductId(Boolean withoutPaidProductId) { + this.withoutPaidProductId = Optional.ofNullable(withoutPaidProductId); + return this; + } + @JsonSetter(value = "limit", nulls = Nulls.SKIP) public Builder limit(Optional limit) { this.limit = limit; @@ -319,6 +347,7 @@ public CountPlansRequest build() { q, withoutEntitlementFor, withoutProductId, + withoutPaidProductId, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java index cc4b8e3..d2330ad 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java @@ -35,6 +35,8 @@ public final class ListPlansRequest { private final Optional withoutProductId; + private final Optional withoutPaidProductId; + private final Optional limit; private final Optional offset; @@ -49,6 +51,7 @@ private ListPlansRequest( Optional q, Optional withoutEntitlementFor, Optional withoutProductId, + Optional withoutPaidProductId, Optional limit, Optional offset, Map additionalProperties) { @@ -59,6 +62,7 @@ private ListPlansRequest( this.q = q; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutProductId = withoutProductId; + this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -111,6 +115,14 @@ public Optional getWithoutProductId() { return withoutProductId; } + /** + * @return Filter out plans that have a paid billing product ID + */ + @JsonProperty("without_paid_product_id") + public Optional getWithoutPaidProductId() { + return withoutPaidProductId; + } + /** * @return Page limit (default 100) */ @@ -146,6 +158,7 @@ private boolean equalTo(ListPlansRequest other) { && q.equals(other.q) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutProductId.equals(other.withoutProductId) + && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -160,6 +173,7 @@ public int hashCode() { this.q, this.withoutEntitlementFor, this.withoutProductId, + this.withoutPaidProductId, this.limit, this.offset); } @@ -189,6 +203,8 @@ public static final class Builder { private Optional withoutProductId = Optional.empty(); + private Optional withoutPaidProductId = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -206,6 +222,7 @@ public Builder from(ListPlansRequest other) { q(other.getQ()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutProductId(other.getWithoutProductId()); + withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -288,6 +305,17 @@ public Builder withoutProductId(Boolean withoutProductId) { return this; } + @JsonSetter(value = "without_paid_product_id", nulls = Nulls.SKIP) + public Builder withoutPaidProductId(Optional withoutPaidProductId) { + this.withoutPaidProductId = withoutPaidProductId; + return this; + } + + public Builder withoutPaidProductId(Boolean withoutPaidProductId) { + this.withoutPaidProductId = Optional.ofNullable(withoutPaidProductId); + return this; + } + @JsonSetter(value = "limit", nulls = Nulls.SKIP) public Builder limit(Optional limit) { this.limit = limit; @@ -319,6 +347,7 @@ public ListPlansRequest build() { q, withoutEntitlementFor, withoutProductId, + withoutPaidProductId, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java new file mode 100644 index 0000000..318023e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +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 = UpdateCompanyPlansRequestBody.Builder.class) +public final class UpdateCompanyPlansRequestBody { + private final List addOnIds; + + private final Optional basePlanId; + + private final Map additionalProperties; + + private UpdateCompanyPlansRequestBody( + List addOnIds, Optional basePlanId, Map additionalProperties) { + this.addOnIds = addOnIds; + this.basePlanId = basePlanId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("add_on_ids") + public List getAddOnIds() { + return addOnIds; + } + + @JsonProperty("base_plan_id") + public Optional getBasePlanId() { + return basePlanId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompanyPlansRequestBody && equalTo((UpdateCompanyPlansRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompanyPlansRequestBody other) { + return addOnIds.equals(other.addOnIds) && basePlanId.equals(other.basePlanId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.addOnIds, this.basePlanId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List addOnIds = new ArrayList<>(); + + private Optional basePlanId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCompanyPlansRequestBody other) { + addOnIds(other.getAddOnIds()); + basePlanId(other.getBasePlanId()); + return this; + } + + @JsonSetter(value = "add_on_ids", nulls = Nulls.SKIP) + public Builder addOnIds(List addOnIds) { + this.addOnIds.clear(); + this.addOnIds.addAll(addOnIds); + return this; + } + + public Builder addAddOnIds(String addOnIds) { + this.addOnIds.add(addOnIds); + return this; + } + + public Builder addAllAddOnIds(List addOnIds) { + this.addOnIds.addAll(addOnIds); + return this; + } + + @JsonSetter(value = "base_plan_id", nulls = Nulls.SKIP) + public Builder basePlanId(Optional basePlanId) { + this.basePlanId = basePlanId; + return this; + } + + public Builder basePlanId(String basePlanId) { + this.basePlanId = Optional.ofNullable(basePlanId); + return this; + } + + public UpdateCompanyPlansRequestBody build() { + return new UpdateCompanyPlansRequestBody(addOnIds, basePlanId, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java index eda8e7a..c7d73ef 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java @@ -37,6 +37,8 @@ public final class CountPlansParams { private final Optional withoutEntitlementFor; + private final Optional withoutPaidProductId; + private final Optional withoutProductId; private final Map additionalProperties; @@ -50,6 +52,7 @@ private CountPlansParams( Optional planType, Optional q, Optional withoutEntitlementFor, + Optional withoutPaidProductId, Optional withoutProductId, Map additionalProperties) { this.companyId = companyId; @@ -60,6 +63,7 @@ private CountPlansParams( this.planType = planType; this.q = q; this.withoutEntitlementFor = withoutEntitlementFor; + this.withoutPaidProductId = withoutPaidProductId; this.withoutProductId = withoutProductId; this.additionalProperties = additionalProperties; } @@ -119,6 +123,14 @@ public Optional getWithoutEntitlementFor() { return withoutEntitlementFor; } + /** + * @return Filter out plans that have a paid billing product ID + */ + @JsonProperty("without_paid_product_id") + public Optional getWithoutPaidProductId() { + return withoutPaidProductId; + } + /** * @return Filter out plans that have a billing product ID */ @@ -147,6 +159,7 @@ private boolean equalTo(CountPlansParams other) { && planType.equals(other.planType) && q.equals(other.q) && withoutEntitlementFor.equals(other.withoutEntitlementFor) + && withoutPaidProductId.equals(other.withoutPaidProductId) && withoutProductId.equals(other.withoutProductId); } @@ -161,6 +174,7 @@ public int hashCode() { this.planType, this.q, this.withoutEntitlementFor, + this.withoutPaidProductId, this.withoutProductId); } @@ -191,6 +205,8 @@ public static final class Builder { private Optional withoutEntitlementFor = Optional.empty(); + private Optional withoutPaidProductId = Optional.empty(); + private Optional withoutProductId = Optional.empty(); @JsonAnySetter @@ -207,6 +223,7 @@ public Builder from(CountPlansParams other) { planType(other.getPlanType()); q(other.getQ()); withoutEntitlementFor(other.getWithoutEntitlementFor()); + withoutPaidProductId(other.getWithoutPaidProductId()); withoutProductId(other.getWithoutProductId()); return this; } @@ -299,6 +316,17 @@ public Builder withoutEntitlementFor(String withoutEntitlementFor) { return this; } + @JsonSetter(value = "without_paid_product_id", nulls = Nulls.SKIP) + public Builder withoutPaidProductId(Optional withoutPaidProductId) { + this.withoutPaidProductId = withoutPaidProductId; + return this; + } + + public Builder withoutPaidProductId(Boolean withoutPaidProductId) { + this.withoutPaidProductId = Optional.ofNullable(withoutPaidProductId); + return this; + } + @JsonSetter(value = "without_product_id", nulls = Nulls.SKIP) public Builder withoutProductId(Optional withoutProductId) { this.withoutProductId = withoutProductId; @@ -320,6 +348,7 @@ public CountPlansParams build() { planType, q, withoutEntitlementFor, + withoutPaidProductId, withoutProductId, additionalProperties); } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java index bc898a0..c1c57ab 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java @@ -37,6 +37,8 @@ public final class ListPlansParams { private final Optional withoutEntitlementFor; + private final Optional withoutPaidProductId; + private final Optional withoutProductId; private final Map additionalProperties; @@ -50,6 +52,7 @@ private ListPlansParams( Optional planType, Optional q, Optional withoutEntitlementFor, + Optional withoutPaidProductId, Optional withoutProductId, Map additionalProperties) { this.companyId = companyId; @@ -60,6 +63,7 @@ private ListPlansParams( this.planType = planType; this.q = q; this.withoutEntitlementFor = withoutEntitlementFor; + this.withoutPaidProductId = withoutPaidProductId; this.withoutProductId = withoutProductId; this.additionalProperties = additionalProperties; } @@ -119,6 +123,14 @@ public Optional getWithoutEntitlementFor() { return withoutEntitlementFor; } + /** + * @return Filter out plans that have a paid billing product ID + */ + @JsonProperty("without_paid_product_id") + public Optional getWithoutPaidProductId() { + return withoutPaidProductId; + } + /** * @return Filter out plans that have a billing product ID */ @@ -147,6 +159,7 @@ private boolean equalTo(ListPlansParams other) { && planType.equals(other.planType) && q.equals(other.q) && withoutEntitlementFor.equals(other.withoutEntitlementFor) + && withoutPaidProductId.equals(other.withoutPaidProductId) && withoutProductId.equals(other.withoutProductId); } @@ -161,6 +174,7 @@ public int hashCode() { this.planType, this.q, this.withoutEntitlementFor, + this.withoutPaidProductId, this.withoutProductId); } @@ -191,6 +205,8 @@ public static final class Builder { private Optional withoutEntitlementFor = Optional.empty(); + private Optional withoutPaidProductId = Optional.empty(); + private Optional withoutProductId = Optional.empty(); @JsonAnySetter @@ -207,6 +223,7 @@ public Builder from(ListPlansParams other) { planType(other.getPlanType()); q(other.getQ()); withoutEntitlementFor(other.getWithoutEntitlementFor()); + withoutPaidProductId(other.getWithoutPaidProductId()); withoutProductId(other.getWithoutProductId()); return this; } @@ -299,6 +316,17 @@ public Builder withoutEntitlementFor(String withoutEntitlementFor) { return this; } + @JsonSetter(value = "without_paid_product_id", nulls = Nulls.SKIP) + public Builder withoutPaidProductId(Optional withoutPaidProductId) { + this.withoutPaidProductId = withoutPaidProductId; + return this; + } + + public Builder withoutPaidProductId(Boolean withoutPaidProductId) { + this.withoutPaidProductId = Optional.ofNullable(withoutPaidProductId); + return this; + } + @JsonSetter(value = "without_product_id", nulls = Nulls.SKIP) public Builder withoutProductId(Optional withoutProductId) { this.withoutProductId = withoutProductId; @@ -320,6 +348,7 @@ public ListPlansParams build() { planType, q, withoutEntitlementFor, + withoutPaidProductId, withoutProductId, additionalProperties); } diff --git a/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java b/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java new file mode 100644 index 0000000..f03027e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CompanyDetailResponseData; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCompanyPlansResponse.Builder.class) +public final class UpdateCompanyPlansResponse { + private final CompanyDetailResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateCompanyPlansResponse( + CompanyDetailResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CompanyDetailResponseData getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public Map getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCompanyPlansResponse && equalTo((UpdateCompanyPlansResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCompanyPlansResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull CompanyDetailResponseData data); + + Builder from(UpdateCompanyPlansResponse other); + } + + public interface _FinalStage { + UpdateCompanyPlansResponse build(); + + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private CompanyDetailResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCompanyPlansResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull CompanyDetailResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage params(String key, JsonNode value) { + this.params.put(key, value); + return this; + } + + /** + *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllParams(Map params) { + this.params.putAll(params); + return this; + } + + @java.lang.Override + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public _FinalStage params(Map params) { + this.params.clear(); + this.params.putAll(params); + return this; + } + + @java.lang.Override + public UpdateCompanyPlansResponse build() { + return new UpdateCompanyPlansResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java index 3106edf..093a786 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java @@ -79,7 +79,8 @@ public ListWebhookEventsResponse listWebhookEvents( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -133,6 +134,7 @@ public GetWebhookEventResponse getWebhookEvent(String webhookEventId, RequestOpt .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -203,7 +205,8 @@ public CountWebhookEventsResponse countWebhookEvents( .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -267,7 +270,8 @@ public ListWebhooksResponse listWebhooks(ListWebhooksRequest request, RequestOpt .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -327,6 +331,7 @@ public CreateWebhookResponse createWebhook(CreateWebhookRequestBody request, Req .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -380,6 +385,7 @@ public GetWebhookResponse getWebhook(String webhookId, RequestOptions requestOpt .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -418,6 +424,10 @@ public GetWebhookResponse getWebhook(String webhookId, RequestOptions requestOpt } } + public UpdateWebhookResponse updateWebhook(String webhookId) { + return updateWebhook(webhookId, UpdateWebhookRequestBody.builder().build()); + } + public UpdateWebhookResponse updateWebhook(String webhookId, UpdateWebhookRequestBody request) { return updateWebhook(webhookId, request, null); } @@ -441,6 +451,7 @@ public UpdateWebhookResponse updateWebhook( .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -497,6 +508,7 @@ public DeleteWebhookResponse deleteWebhook(String webhookId, RequestOptions requ .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -560,7 +572,8 @@ public CountWebhooksResponse countWebhooks(CountWebhooksRequest request, Request .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java b/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java index bb4757d..adc3bd1 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java @@ -50,7 +50,9 @@ public enum CreateWebhookRequestBodyRequestTypesItem { FLAG_DELETED("flag.deleted"), - TEST_SEND("test.send"); + TEST_SEND("test.send"), + + SUBSCRIPTION_TRIAL_ENDED("subscription.trial.ended"); private final String value; diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java b/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java index d881ae6..426ae36 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java @@ -50,7 +50,9 @@ public enum UpdateWebhookRequestBodyRequestTypesItem { FLAG_DELETED("flag.deleted"), - TEST_SEND("test.send"); + TEST_SEND("test.send"), + + SUBSCRIPTION_TRIAL_ENDED("subscription.trial.ended"); private final String value; diff --git a/src/main/java/com/schematic/api/types/BillingPriceView.java b/src/main/java/com/schematic/api/types/BillingPriceView.java index fa589f2..9436d2d 100644 --- a/src/main/java/com/schematic/api/types/BillingPriceView.java +++ b/src/main/java/com/schematic/api/types/BillingPriceView.java @@ -30,6 +30,8 @@ public final class BillingPriceView { private final String interval; + private final boolean isActive; + private final Optional meterId; private final int price; @@ -55,6 +57,7 @@ private BillingPriceView( String currency, String id, String interval, + boolean isActive, Optional meterId, int price, String priceExternalId, @@ -69,6 +72,7 @@ private BillingPriceView( this.currency = currency; this.id = id; this.interval = interval; + this.isActive = isActive; this.meterId = meterId; this.price = price; this.priceExternalId = priceExternalId; @@ -101,6 +105,11 @@ public String getInterval() { return interval; } + @JsonProperty("is_active") + public boolean getIsActive() { + return isActive; + } + @JsonProperty("meter_id") public Optional getMeterId() { return meterId; @@ -162,6 +171,7 @@ private boolean equalTo(BillingPriceView other) { && currency.equals(other.currency) && id.equals(other.id) && interval.equals(other.interval) + && isActive == other.isActive && meterId.equals(other.meterId) && price == other.price && priceExternalId.equals(other.priceExternalId) @@ -180,6 +190,7 @@ public int hashCode() { this.currency, this.id, this.interval, + this.isActive, this.meterId, this.price, this.priceExternalId, @@ -215,7 +226,11 @@ public interface IdStage { } public interface IntervalStage { - PriceStage interval(@NotNull String interval); + IsActiveStage interval(@NotNull String interval); + } + + public interface IsActiveStage { + PriceStage isActive(boolean isActive); } public interface PriceStage { @@ -264,6 +279,7 @@ public static final class Builder CurrencyStage, IdStage, IntervalStage, + IsActiveStage, PriceStage, PriceExternalIdStage, PriceIdStage, @@ -281,6 +297,8 @@ public static final class Builder private String interval; + private boolean isActive; + private int price; private String priceExternalId; @@ -310,6 +328,7 @@ public Builder from(BillingPriceView other) { currency(other.getCurrency()); id(other.getId()); interval(other.getInterval()); + isActive(other.getIsActive()); meterId(other.getMeterId()); price(other.getPrice()); priceExternalId(other.getPriceExternalId()); @@ -345,11 +364,18 @@ public IntervalStage id(@NotNull String id) { @java.lang.Override @JsonSetter("interval") - public PriceStage interval(@NotNull String interval) { + public IsActiveStage interval(@NotNull String interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } + @java.lang.Override + @JsonSetter("is_active") + public PriceStage isActive(boolean isActive) { + this.isActive = isActive; + return this; + } + @java.lang.Override @JsonSetter("price") public PriceExternalIdStage price(int price) { @@ -426,6 +452,7 @@ public BillingPriceView build() { currency, id, interval, + isActive, meterId, price, priceExternalId, diff --git a/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java index 5429388..016d990 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java @@ -30,6 +30,8 @@ public final class BillingProductPriceResponseData { private final String interval; + private final boolean isActive; + private final Optional meterId; private final int price; @@ -49,6 +51,7 @@ private BillingProductPriceResponseData( String currency, String id, String interval, + boolean isActive, Optional meterId, int price, String priceExternalId, @@ -60,6 +63,7 @@ private BillingProductPriceResponseData( this.currency = currency; this.id = id; this.interval = interval; + this.isActive = isActive; this.meterId = meterId; this.price = price; this.priceExternalId = priceExternalId; @@ -89,6 +93,11 @@ public String getInterval() { return interval; } + @JsonProperty("is_active") + public boolean getIsActive() { + return isActive; + } + @JsonProperty("meter_id") public Optional getMeterId() { return meterId; @@ -135,6 +144,7 @@ private boolean equalTo(BillingProductPriceResponseData other) { && currency.equals(other.currency) && id.equals(other.id) && interval.equals(other.interval) + && isActive == other.isActive && meterId.equals(other.meterId) && price == other.price && priceExternalId.equals(other.priceExternalId) @@ -150,6 +160,7 @@ public int hashCode() { this.currency, this.id, this.interval, + this.isActive, this.meterId, this.price, this.priceExternalId, @@ -182,7 +193,11 @@ public interface IdStage { } public interface IntervalStage { - PriceStage interval(@NotNull String interval); + IsActiveStage interval(@NotNull String interval); + } + + public interface IsActiveStage { + PriceStage isActive(boolean isActive); } public interface PriceStage { @@ -219,6 +234,7 @@ public static final class Builder CurrencyStage, IdStage, IntervalStage, + IsActiveStage, PriceStage, PriceExternalIdStage, ProductExternalIdStage, @@ -233,6 +249,8 @@ public static final class Builder private String interval; + private boolean isActive; + private int price; private String priceExternalId; @@ -256,6 +274,7 @@ public Builder from(BillingProductPriceResponseData other) { currency(other.getCurrency()); id(other.getId()); interval(other.getInterval()); + isActive(other.getIsActive()); meterId(other.getMeterId()); price(other.getPrice()); priceExternalId(other.getPriceExternalId()); @@ -288,11 +307,18 @@ public IntervalStage id(@NotNull String id) { @java.lang.Override @JsonSetter("interval") - public PriceStage interval(@NotNull String interval) { + public IsActiveStage interval(@NotNull String interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } + @java.lang.Override + @JsonSetter("is_active") + public PriceStage isActive(boolean isActive) { + this.isActive = isActive; + return this; + } + @java.lang.Override @JsonSetter("price") public PriceExternalIdStage price(int price) { @@ -348,6 +374,7 @@ public BillingProductPriceResponseData build() { currency, id, interval, + isActive, meterId, price, priceExternalId, diff --git a/src/main/java/com/schematic/api/types/CheckFlagOutputWithFlagKey.java b/src/main/java/com/schematic/api/types/CheckFlagOutputWithFlagKey.java deleted file mode 100644 index 0c21c35..0000000 --- a/src/main/java/com/schematic/api/types/CheckFlagOutputWithFlagKey.java +++ /dev/null @@ -1,306 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CheckFlagOutputWithFlagKey.Builder.class) -public final class CheckFlagOutputWithFlagKey { - private final Optional companyId; - - private final Optional error; - - private final String flag; - - private final Optional flagId; - - private final String reason; - - private final Optional ruleId; - - private final Optional userId; - - private final boolean value; - - private final Map additionalProperties; - - private CheckFlagOutputWithFlagKey( - Optional companyId, - Optional error, - String flag, - Optional flagId, - String reason, - Optional ruleId, - Optional userId, - boolean value, - Map additionalProperties) { - this.companyId = companyId; - this.error = error; - this.flag = flag; - this.flagId = flagId; - this.reason = reason; - this.ruleId = ruleId; - this.userId = userId; - this.value = value; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("company_id") - public Optional getCompanyId() { - return companyId; - } - - @JsonProperty("error") - public Optional getError() { - return error; - } - - @JsonProperty("flag") - public String getFlag() { - return flag; - } - - @JsonProperty("flag_id") - public Optional getFlagId() { - return flagId; - } - - @JsonProperty("reason") - public String getReason() { - return reason; - } - - @JsonProperty("rule_id") - public Optional getRuleId() { - return ruleId; - } - - @JsonProperty("user_id") - public Optional getUserId() { - return userId; - } - - @JsonProperty("value") - public boolean getValue() { - return value; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CheckFlagOutputWithFlagKey && equalTo((CheckFlagOutputWithFlagKey) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CheckFlagOutputWithFlagKey other) { - return companyId.equals(other.companyId) - && error.equals(other.error) - && flag.equals(other.flag) - && flagId.equals(other.flagId) - && reason.equals(other.reason) - && ruleId.equals(other.ruleId) - && userId.equals(other.userId) - && value == other.value; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.companyId, this.error, this.flag, this.flagId, this.reason, this.ruleId, this.userId, this.value); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static FlagStage builder() { - return new Builder(); - } - - public interface FlagStage { - ReasonStage flag(@NotNull String flag); - - Builder from(CheckFlagOutputWithFlagKey other); - } - - public interface ReasonStage { - ValueStage reason(@NotNull String reason); - } - - public interface ValueStage { - _FinalStage value(boolean value); - } - - public interface _FinalStage { - CheckFlagOutputWithFlagKey build(); - - _FinalStage companyId(Optional companyId); - - _FinalStage companyId(String companyId); - - _FinalStage error(Optional error); - - _FinalStage error(String error); - - _FinalStage flagId(Optional flagId); - - _FinalStage flagId(String flagId); - - _FinalStage ruleId(Optional ruleId); - - _FinalStage ruleId(String ruleId); - - _FinalStage userId(Optional userId); - - _FinalStage userId(String userId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements FlagStage, ReasonStage, ValueStage, _FinalStage { - private String flag; - - private String reason; - - private boolean value; - - private Optional userId = Optional.empty(); - - private Optional ruleId = Optional.empty(); - - private Optional flagId = Optional.empty(); - - private Optional error = Optional.empty(); - - private Optional companyId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CheckFlagOutputWithFlagKey other) { - companyId(other.getCompanyId()); - error(other.getError()); - flag(other.getFlag()); - flagId(other.getFlagId()); - reason(other.getReason()); - ruleId(other.getRuleId()); - userId(other.getUserId()); - value(other.getValue()); - return this; - } - - @java.lang.Override - @JsonSetter("flag") - public ReasonStage flag(@NotNull String flag) { - this.flag = Objects.requireNonNull(flag, "flag must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("reason") - public ValueStage reason(@NotNull String reason) { - this.reason = Objects.requireNonNull(reason, "reason must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("value") - public _FinalStage value(boolean value) { - this.value = value; - return this; - } - - @java.lang.Override - public _FinalStage userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "user_id", nulls = Nulls.SKIP) - public _FinalStage userId(Optional userId) { - this.userId = userId; - return this; - } - - @java.lang.Override - public _FinalStage ruleId(String ruleId) { - this.ruleId = Optional.ofNullable(ruleId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "rule_id", nulls = Nulls.SKIP) - public _FinalStage ruleId(Optional ruleId) { - this.ruleId = ruleId; - return this; - } - - @java.lang.Override - public _FinalStage flagId(String flagId) { - this.flagId = Optional.ofNullable(flagId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) - public _FinalStage flagId(Optional flagId) { - this.flagId = flagId; - return this; - } - - @java.lang.Override - public _FinalStage error(String error) { - this.error = Optional.ofNullable(error); - return this; - } - - @java.lang.Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - 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 CheckFlagOutputWithFlagKey build() { - return new CheckFlagOutputWithFlagKey( - companyId, error, flag, flagId, reason, ruleId, userId, value, additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/CheckFlagResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagResponseData.java index a8bbd4d..59f6f4e 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckFlagResponseData.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.Map; import java.util.Objects; @@ -25,12 +26,24 @@ public final class CheckFlagResponseData { private final Optional error; + private final Optional featureAllocation; + + private final Optional featureUsage; + + private final Optional featureUsagePeriod; + + private final Optional featureUsageResetAt; + + private final String flag; + private final Optional flagId; private final String reason; private final Optional ruleId; + private final Optional ruleType; + private final Optional userId; private final boolean value; @@ -40,52 +53,133 @@ public final class CheckFlagResponseData { private CheckFlagResponseData( Optional companyId, Optional error, + Optional featureAllocation, + Optional featureUsage, + Optional featureUsagePeriod, + Optional featureUsageResetAt, + String flag, Optional flagId, String reason, Optional ruleId, + Optional ruleType, Optional userId, boolean value, Map additionalProperties) { this.companyId = companyId; this.error = error; + this.featureAllocation = featureAllocation; + this.featureUsage = featureUsage; + this.featureUsagePeriod = featureUsagePeriod; + this.featureUsageResetAt = featureUsageResetAt; + this.flag = flag; this.flagId = flagId; this.reason = reason; this.ruleId = ruleId; + this.ruleType = ruleType; this.userId = userId; this.value = value; this.additionalProperties = additionalProperties; } + /** + * @return If company keys were provided and matched a company, its ID + */ @JsonProperty("company_id") public Optional getCompanyId() { return companyId; } + /** + * @return If an error occurred while checking the flag, the error message + */ @JsonProperty("error") public Optional getError() { return error; } + /** + * @return If a numeric feature entitlement rule was matched, its allocation + */ + @JsonProperty("feature_allocation") + public Optional getFeatureAllocation() { + return featureAllocation; + } + + /** + * @return If a numeric feature entitlement rule was matched, the company's usage + */ + @JsonProperty("feature_usage") + public Optional getFeatureUsage() { + return featureUsage; + } + + /** + * @return For event-based feature entitlement rules, the period over which usage is tracked (current_month, current_day, current_week, all_time) + */ + @JsonProperty("feature_usage_period") + public Optional getFeatureUsagePeriod() { + return featureUsagePeriod; + } + + /** + * @return For event-based feature entitlement rules, when the usage period will reset + */ + @JsonProperty("feature_usage_reset_at") + public Optional getFeatureUsageResetAt() { + return featureUsageResetAt; + } + + /** + * @return The key used to check the flag + */ + @JsonProperty("flag") + public String getFlag() { + return flag; + } + + /** + * @return If a flag was found, its ID + */ @JsonProperty("flag_id") public Optional getFlagId() { return flagId; } + /** + * @return A human-readable explanation of the result + */ @JsonProperty("reason") public String getReason() { return reason; } + /** + * @return If a rule was found, its ID + */ @JsonProperty("rule_id") public Optional getRuleId() { return ruleId; } + /** + * @return If a rule was found, its type + */ + @JsonProperty("rule_type") + public Optional getRuleType() { + return ruleType; + } + + /** + * @return If user keys were provided and matched a user, its ID + */ @JsonProperty("user_id") public Optional getUserId() { return userId; } + /** + * @return A boolean flag check result; for feature entitlements, this represents whether further consumption of the feature is permitted + */ @JsonProperty("value") public boolean getValue() { return value; @@ -105,16 +199,35 @@ public Map getAdditionalProperties() { private boolean equalTo(CheckFlagResponseData other) { return companyId.equals(other.companyId) && error.equals(other.error) + && featureAllocation.equals(other.featureAllocation) + && featureUsage.equals(other.featureUsage) + && featureUsagePeriod.equals(other.featureUsagePeriod) + && featureUsageResetAt.equals(other.featureUsageResetAt) + && flag.equals(other.flag) && flagId.equals(other.flagId) && reason.equals(other.reason) && ruleId.equals(other.ruleId) + && ruleType.equals(other.ruleType) && userId.equals(other.userId) && value == other.value; } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.error, this.flagId, this.reason, this.ruleId, this.userId, this.value); + return Objects.hash( + this.companyId, + this.error, + this.featureAllocation, + this.featureUsage, + this.featureUsagePeriod, + this.featureUsageResetAt, + this.flag, + this.flagId, + this.reason, + this.ruleId, + this.ruleType, + this.userId, + this.value); } @java.lang.Override @@ -122,16 +235,20 @@ public String toString() { return ObjectMappers.stringify(this); } - public static ReasonStage builder() { + public static FlagStage builder() { return new Builder(); } - public interface ReasonStage { - ValueStage reason(@NotNull String reason); + public interface FlagStage { + ReasonStage flag(@NotNull String flag); Builder from(CheckFlagResponseData other); } + public interface ReasonStage { + ValueStage reason(@NotNull String reason); + } + public interface ValueStage { _FinalStage value(boolean value); } @@ -147,6 +264,22 @@ public interface _FinalStage { _FinalStage error(String error); + _FinalStage featureAllocation(Optional featureAllocation); + + _FinalStage featureAllocation(Integer featureAllocation); + + _FinalStage featureUsage(Optional featureUsage); + + _FinalStage featureUsage(Integer featureUsage); + + _FinalStage featureUsagePeriod(Optional featureUsagePeriod); + + _FinalStage featureUsagePeriod(String featureUsagePeriod); + + _FinalStage featureUsageResetAt(Optional featureUsageResetAt); + + _FinalStage featureUsageResetAt(OffsetDateTime featureUsageResetAt); + _FinalStage flagId(Optional flagId); _FinalStage flagId(String flagId); @@ -155,23 +288,39 @@ public interface _FinalStage { _FinalStage ruleId(String ruleId); + _FinalStage ruleType(Optional ruleType); + + _FinalStage ruleType(String ruleType); + _FinalStage userId(Optional userId); _FinalStage userId(String userId); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ReasonStage, ValueStage, _FinalStage { + public static final class Builder implements FlagStage, ReasonStage, ValueStage, _FinalStage { + private String flag; + private String reason; private boolean value; private Optional userId = Optional.empty(); + private Optional ruleType = Optional.empty(); + private Optional ruleId = Optional.empty(); private Optional flagId = Optional.empty(); + private Optional featureUsageResetAt = Optional.empty(); + + private Optional featureUsagePeriod = Optional.empty(); + + private Optional featureUsage = Optional.empty(); + + private Optional featureAllocation = Optional.empty(); + private Optional error = Optional.empty(); private Optional companyId = Optional.empty(); @@ -185,14 +334,35 @@ private Builder() {} public Builder from(CheckFlagResponseData other) { companyId(other.getCompanyId()); error(other.getError()); + featureAllocation(other.getFeatureAllocation()); + featureUsage(other.getFeatureUsage()); + featureUsagePeriod(other.getFeatureUsagePeriod()); + featureUsageResetAt(other.getFeatureUsageResetAt()); + flag(other.getFlag()); flagId(other.getFlagId()); reason(other.getReason()); ruleId(other.getRuleId()); + ruleType(other.getRuleType()); userId(other.getUserId()); value(other.getValue()); return this; } + /** + *

The key used to check the flag

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

A human-readable explanation of the result

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("reason") public ValueStage reason(@NotNull String reason) { @@ -200,6 +370,10 @@ public ValueStage reason(@NotNull String reason) { return this; } + /** + *

A boolean flag check result; for feature entitlements, this represents whether further consumption of the feature is permitted

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("value") public _FinalStage value(boolean value) { @@ -207,6 +381,10 @@ public _FinalStage value(boolean value) { return this; } + /** + *

If user keys were provided and matched a user, its ID

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

If a rule was found, its type

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

If a rule was found, its ID

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

If a flag was found, its ID

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

For event-based feature entitlement rules, when the usage period will reset

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

For event-based feature entitlement rules, the period over which usage is tracked (current_month, current_day, current_week, all_time)

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

If a numeric feature entitlement rule was matched, the company's usage

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

If a numeric feature entitlement rule was matched, its allocation

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

If an error occurred while checking the flag, the error message

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

If company keys were provided and matched a company, its ID

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override public _FinalStage companyId(String companyId) { this.companyId = Optional.ofNullable(companyId); @@ -275,7 +554,20 @@ public _FinalStage companyId(Optional companyId) { @java.lang.Override public CheckFlagResponseData build() { return new CheckFlagResponseData( - companyId, error, flagId, reason, ruleId, userId, value, additionalProperties); + companyId, + error, + featureAllocation, + featureUsage, + featureUsagePeriod, + featureUsageResetAt, + flag, + flagId, + reason, + ruleId, + ruleType, + userId, + value, + additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java index 822daf5..0375f8f 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java @@ -21,17 +21,17 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CheckFlagsResponseData.Builder.class) public final class CheckFlagsResponseData { - private final List flags; + private final List flags; private final Map additionalProperties; - private CheckFlagsResponseData(List flags, Map additionalProperties) { + private CheckFlagsResponseData(List flags, Map additionalProperties) { this.flags = flags; this.additionalProperties = additionalProperties; } @JsonProperty("flags") - public List getFlags() { + public List getFlags() { return flags; } @@ -66,7 +66,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private List flags = new ArrayList<>(); + private List flags = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -79,18 +79,18 @@ public Builder from(CheckFlagsResponseData other) { } @JsonSetter(value = "flags", nulls = Nulls.SKIP) - public Builder flags(List flags) { + public Builder flags(List flags) { this.flags.clear(); this.flags.addAll(flags); return this; } - public Builder addFlags(CheckFlagOutputWithFlagKey flags) { + public Builder addFlags(CheckFlagResponseData flags) { this.flags.add(flags); return this; } - public Builder addAllFlags(List flags) { + public Builder addAllFlags(List flags) { this.flags.addAll(flags); return this; } diff --git a/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java b/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java new file mode 100644 index 0000000..0785869 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java @@ -0,0 +1,246 @@ +/** + * 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.ArrayList; +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 = CheckoutDataResponseData.Builder.class) +public final class CheckoutDataResponseData { + private final List activeAddOns; + + private final Optional activePlan; + + private final List activeUsageBasedEntitlements; + + private final Optional company; + + private final Optional featureUsage; + + private final Optional subscription; + + private final Map additionalProperties; + + private CheckoutDataResponseData( + List activeAddOns, + Optional activePlan, + List activeUsageBasedEntitlements, + Optional company, + Optional featureUsage, + Optional subscription, + Map additionalProperties) { + this.activeAddOns = activeAddOns; + this.activePlan = activePlan; + this.activeUsageBasedEntitlements = activeUsageBasedEntitlements; + this.company = company; + this.featureUsage = featureUsage; + this.subscription = subscription; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("active_add_ons") + public List getActiveAddOns() { + return activeAddOns; + } + + @JsonProperty("active_plan") + public Optional getActivePlan() { + return activePlan; + } + + @JsonProperty("active_usage_based_entitlements") + public List getActiveUsageBasedEntitlements() { + return activeUsageBasedEntitlements; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("feature_usage") + public Optional getFeatureUsage() { + return featureUsage; + } + + @JsonProperty("subscription") + public Optional getSubscription() { + return subscription; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutDataResponseData && equalTo((CheckoutDataResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutDataResponseData other) { + return activeAddOns.equals(other.activeAddOns) + && activePlan.equals(other.activePlan) + && activeUsageBasedEntitlements.equals(other.activeUsageBasedEntitlements) + && company.equals(other.company) + && featureUsage.equals(other.featureUsage) + && subscription.equals(other.subscription); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.activeAddOns, + this.activePlan, + this.activeUsageBasedEntitlements, + this.company, + this.featureUsage, + this.subscription); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List activeAddOns = new ArrayList<>(); + + private Optional activePlan = Optional.empty(); + + private List activeUsageBasedEntitlements = new ArrayList<>(); + + private Optional company = Optional.empty(); + + private Optional featureUsage = Optional.empty(); + + private Optional subscription = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CheckoutDataResponseData other) { + activeAddOns(other.getActiveAddOns()); + activePlan(other.getActivePlan()); + activeUsageBasedEntitlements(other.getActiveUsageBasedEntitlements()); + company(other.getCompany()); + featureUsage(other.getFeatureUsage()); + subscription(other.getSubscription()); + return this; + } + + @JsonSetter(value = "active_add_ons", nulls = Nulls.SKIP) + public Builder activeAddOns(List activeAddOns) { + this.activeAddOns.clear(); + this.activeAddOns.addAll(activeAddOns); + return this; + } + + public Builder addActiveAddOns(PlanDetailResponseData activeAddOns) { + this.activeAddOns.add(activeAddOns); + return this; + } + + public Builder addAllActiveAddOns(List activeAddOns) { + this.activeAddOns.addAll(activeAddOns); + return this; + } + + @JsonSetter(value = "active_plan", nulls = Nulls.SKIP) + public Builder activePlan(Optional activePlan) { + this.activePlan = activePlan; + return this; + } + + public Builder activePlan(PlanDetailResponseData activePlan) { + this.activePlan = Optional.ofNullable(activePlan); + return this; + } + + @JsonSetter(value = "active_usage_based_entitlements", nulls = Nulls.SKIP) + public Builder activeUsageBasedEntitlements( + List activeUsageBasedEntitlements) { + this.activeUsageBasedEntitlements.clear(); + this.activeUsageBasedEntitlements.addAll(activeUsageBasedEntitlements); + return this; + } + + public Builder addActiveUsageBasedEntitlements(UsageBasedEntitlementResponseData activeUsageBasedEntitlements) { + this.activeUsageBasedEntitlements.add(activeUsageBasedEntitlements); + return this; + } + + public Builder addAllActiveUsageBasedEntitlements( + List activeUsageBasedEntitlements) { + this.activeUsageBasedEntitlements.addAll(activeUsageBasedEntitlements); + return this; + } + + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public Builder company(Optional company) { + this.company = company; + return this; + } + + public Builder company(CompanyDetailResponseData company) { + this.company = Optional.ofNullable(company); + return this; + } + + @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) + public Builder featureUsage(Optional featureUsage) { + this.featureUsage = featureUsage; + return this; + } + + public Builder featureUsage(FeatureUsageDetailResponseData featureUsage) { + this.featureUsage = Optional.ofNullable(featureUsage); + return this; + } + + @JsonSetter(value = "subscription", nulls = Nulls.SKIP) + public Builder subscription(Optional subscription) { + this.subscription = subscription; + return this; + } + + public Builder subscription(CompanySubscriptionResponseData subscription) { + this.subscription = Optional.ofNullable(subscription); + return this; + } + + public CheckoutDataResponseData build() { + return new CheckoutDataResponseData( + activeAddOns, + activePlan, + activeUsageBasedEntitlements, + company, + featureUsage, + subscription, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java b/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java index 4502fe2..cfedbed 100644 --- a/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java @@ -44,6 +44,8 @@ public final class CompanyOverrideResponseData { private final Optional ruleId; + private final Optional ruleIdUsageExceeded; + private final OffsetDateTime updatedAt; private final Optional valueBool; @@ -70,6 +72,7 @@ private CompanyOverrideResponseData( Optional metricPeriod, Optional metricPeriodMonthReset, Optional ruleId, + Optional ruleIdUsageExceeded, OffsetDateTime updatedAt, Optional valueBool, Optional valueNumeric, @@ -88,6 +91,7 @@ private CompanyOverrideResponseData( this.metricPeriod = metricPeriod; this.metricPeriodMonthReset = metricPeriodMonthReset; this.ruleId = ruleId; + this.ruleIdUsageExceeded = ruleIdUsageExceeded; this.updatedAt = updatedAt; this.valueBool = valueBool; this.valueNumeric = valueNumeric; @@ -152,6 +156,11 @@ public Optional getRuleId() { return ruleId; } + @JsonProperty("rule_id_usage_exceeded") + public Optional getRuleIdUsageExceeded() { + return ruleIdUsageExceeded; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -205,6 +214,7 @@ private boolean equalTo(CompanyOverrideResponseData other) { && metricPeriod.equals(other.metricPeriod) && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) && ruleId.equals(other.ruleId) + && ruleIdUsageExceeded.equals(other.ruleIdUsageExceeded) && updatedAt.equals(other.updatedAt) && valueBool.equals(other.valueBool) && valueNumeric.equals(other.valueNumeric) @@ -227,6 +237,7 @@ public int hashCode() { this.metricPeriod, this.metricPeriodMonthReset, this.ruleId, + this.ruleIdUsageExceeded, this.updatedAt, this.valueBool, this.valueNumeric, @@ -301,6 +312,10 @@ public interface _FinalStage { _FinalStage ruleId(String ruleId); + _FinalStage ruleIdUsageExceeded(Optional ruleIdUsageExceeded); + + _FinalStage ruleIdUsageExceeded(String ruleIdUsageExceeded); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -350,6 +365,8 @@ public static final class Builder private Optional valueBool = Optional.empty(); + private Optional ruleIdUsageExceeded = Optional.empty(); + private Optional ruleId = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -380,6 +397,7 @@ public Builder from(CompanyOverrideResponseData other) { metricPeriod(other.getMetricPeriod()); metricPeriodMonthReset(other.getMetricPeriodMonthReset()); ruleId(other.getRuleId()); + ruleIdUsageExceeded(other.getRuleIdUsageExceeded()); updatedAt(other.getUpdatedAt()); valueBool(other.getValueBool()); valueNumeric(other.getValueNumeric()); @@ -490,6 +508,19 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + @java.lang.Override + public _FinalStage ruleIdUsageExceeded(String ruleIdUsageExceeded) { + this.ruleIdUsageExceeded = Optional.ofNullable(ruleIdUsageExceeded); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rule_id_usage_exceeded", nulls = Nulls.SKIP) + public _FinalStage ruleIdUsageExceeded(Optional ruleIdUsageExceeded) { + this.ruleIdUsageExceeded = ruleIdUsageExceeded; + return this; + } + @java.lang.Override public _FinalStage ruleId(String ruleId) { this.ruleId = Optional.ofNullable(ruleId); @@ -582,6 +613,7 @@ public CompanyOverrideResponseData build() { metricPeriod, metricPeriodMonthReset, ruleId, + ruleIdUsageExceeded, updatedAt, valueBool, valueNumeric, diff --git a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java index fef453c..cb6717e 100644 --- a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java @@ -34,6 +34,8 @@ public final class ComponentHydrateResponseData { private final Optional component; + private final Optional defaultPlan; + private final Optional featureUsage; private final Optional stripeEmbed; @@ -53,6 +55,7 @@ private ComponentHydrateResponseData( Optional capabilities, Optional company, Optional component, + Optional defaultPlan, Optional featureUsage, Optional stripeEmbed, Optional subscription, @@ -65,6 +68,7 @@ private ComponentHydrateResponseData( this.capabilities = capabilities; this.company = company; this.component = component; + this.defaultPlan = defaultPlan; this.featureUsage = featureUsage; this.stripeEmbed = stripeEmbed; this.subscription = subscription; @@ -103,6 +107,11 @@ public Optional getComponent() { return component; } + @JsonProperty("default_plan") + public Optional getDefaultPlan() { + return defaultPlan; + } + @JsonProperty("feature_usage") public Optional getFeatureUsage() { return featureUsage; @@ -146,6 +155,7 @@ private boolean equalTo(ComponentHydrateResponseData other) { && capabilities.equals(other.capabilities) && company.equals(other.company) && component.equals(other.component) + && defaultPlan.equals(other.defaultPlan) && featureUsage.equals(other.featureUsage) && stripeEmbed.equals(other.stripeEmbed) && subscription.equals(other.subscription) @@ -162,6 +172,7 @@ public int hashCode() { this.capabilities, this.company, this.component, + this.defaultPlan, this.featureUsage, this.stripeEmbed, this.subscription, @@ -192,6 +203,8 @@ public static final class Builder { private Optional component = Optional.empty(); + private Optional defaultPlan = Optional.empty(); + private Optional featureUsage = Optional.empty(); private Optional stripeEmbed = Optional.empty(); @@ -214,6 +227,7 @@ public Builder from(ComponentHydrateResponseData other) { capabilities(other.getCapabilities()); company(other.getCompany()); component(other.getComponent()); + defaultPlan(other.getDefaultPlan()); featureUsage(other.getFeatureUsage()); stripeEmbed(other.getStripeEmbed()); subscription(other.getSubscription()); @@ -308,6 +322,17 @@ public Builder component(ComponentResponseData component) { return this; } + @JsonSetter(value = "default_plan", nulls = Nulls.SKIP) + public Builder defaultPlan(Optional defaultPlan) { + this.defaultPlan = defaultPlan; + return this; + } + + public Builder defaultPlan(PlanDetailResponseData defaultPlan) { + this.defaultPlan = Optional.ofNullable(defaultPlan); + return this; + } + @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) public Builder featureUsage(Optional featureUsage) { this.featureUsage = featureUsage; @@ -371,6 +396,7 @@ public ComponentHydrateResponseData build() { capabilities, company, component, + defaultPlan, featureUsage, stripeEmbed, subscription, diff --git a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java index 8b625e2..60847ad 100644 --- a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java @@ -34,6 +34,8 @@ public final class ComponentPreviewResponseData { private final Optional component; + private final Optional defaultPlan; + private final Optional featureUsage; private final List invoices; @@ -55,6 +57,7 @@ private ComponentPreviewResponseData( Optional capabilities, Optional company, Optional component, + Optional defaultPlan, Optional featureUsage, List invoices, Optional stripeEmbed, @@ -68,6 +71,7 @@ private ComponentPreviewResponseData( this.capabilities = capabilities; this.company = company; this.component = component; + this.defaultPlan = defaultPlan; this.featureUsage = featureUsage; this.invoices = invoices; this.stripeEmbed = stripeEmbed; @@ -107,6 +111,11 @@ public Optional getComponent() { return component; } + @JsonProperty("default_plan") + public Optional getDefaultPlan() { + return defaultPlan; + } + @JsonProperty("feature_usage") public Optional getFeatureUsage() { return featureUsage; @@ -155,6 +164,7 @@ private boolean equalTo(ComponentPreviewResponseData other) { && capabilities.equals(other.capabilities) && company.equals(other.company) && component.equals(other.component) + && defaultPlan.equals(other.defaultPlan) && featureUsage.equals(other.featureUsage) && invoices.equals(other.invoices) && stripeEmbed.equals(other.stripeEmbed) @@ -172,6 +182,7 @@ public int hashCode() { this.capabilities, this.company, this.component, + this.defaultPlan, this.featureUsage, this.invoices, this.stripeEmbed, @@ -203,6 +214,8 @@ public static final class Builder { private Optional component = Optional.empty(); + private Optional defaultPlan = Optional.empty(); + private Optional featureUsage = Optional.empty(); private List invoices = new ArrayList<>(); @@ -227,6 +240,7 @@ public Builder from(ComponentPreviewResponseData other) { capabilities(other.getCapabilities()); company(other.getCompany()); component(other.getComponent()); + defaultPlan(other.getDefaultPlan()); featureUsage(other.getFeatureUsage()); invoices(other.getInvoices()); stripeEmbed(other.getStripeEmbed()); @@ -322,6 +336,17 @@ public Builder component(ComponentResponseData component) { return this; } + @JsonSetter(value = "default_plan", nulls = Nulls.SKIP) + public Builder defaultPlan(Optional defaultPlan) { + this.defaultPlan = defaultPlan; + return this; + } + + public Builder defaultPlan(PlanDetailResponseData defaultPlan) { + this.defaultPlan = Optional.ofNullable(defaultPlan); + return this; + } + @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) public Builder featureUsage(Optional featureUsage) { this.featureUsage = featureUsage; @@ -402,6 +427,7 @@ public ComponentPreviewResponseData build() { capabilities, company, component, + defaultPlan, featureUsage, invoices, stripeEmbed, diff --git a/src/main/java/com/schematic/api/types/EventBody.java b/src/main/java/com/schematic/api/types/EventBody.java index 095b67a..0dc881f 100644 --- a/src/main/java/com/schematic/api/types/EventBody.java +++ b/src/main/java/com/schematic/api/types/EventBody.java @@ -86,7 +86,7 @@ static final class Deserializer extends StdDeserializer { } @java.lang.Override - public EventBody deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + public EventBody deserialize(JsonParser p, DeserializationContext context) throws IOException { Object value = p.readValueAs(Object.class); try { return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyTrack.class)); diff --git a/src/main/java/com/schematic/api/types/EventBodyTrack.java b/src/main/java/com/schematic/api/types/EventBodyTrack.java index 0e95c17..b1ccba8 100644 --- a/src/main/java/com/schematic/api/types/EventBodyTrack.java +++ b/src/main/java/com/schematic/api/types/EventBodyTrack.java @@ -26,6 +26,8 @@ public final class EventBodyTrack { private final String event; + private final Optional quantity; + private final Optional> traits; private final Optional> user; @@ -35,11 +37,13 @@ public final class EventBodyTrack { private EventBodyTrack( Optional> company, String event, + Optional quantity, Optional> traits, Optional> user, Map additionalProperties) { this.company = company; this.event = event; + this.quantity = quantity; this.traits = traits; this.user = user; this.additionalProperties = additionalProperties; @@ -61,6 +65,14 @@ public String getEvent() { return event; } + /** + * @return Optionally specify the quantity of the event + */ + @JsonProperty("quantity") + public Optional getQuantity() { + return quantity; + } + /** * @return A map of trait names to trait values */ @@ -91,13 +103,14 @@ public Map getAdditionalProperties() { private boolean equalTo(EventBodyTrack other) { return company.equals(other.company) && event.equals(other.event) + && quantity.equals(other.quantity) && traits.equals(other.traits) && user.equals(other.user); } @java.lang.Override public int hashCode() { - return Objects.hash(this.company, this.event, this.traits, this.user); + return Objects.hash(this.company, this.event, this.quantity, this.traits, this.user); } @java.lang.Override @@ -122,6 +135,10 @@ public interface _FinalStage { _FinalStage company(Map company); + _FinalStage quantity(Optional quantity); + + _FinalStage quantity(Integer quantity); + _FinalStage traits(Optional> traits); _FinalStage traits(Map traits); @@ -139,6 +156,8 @@ public static final class Builder implements EventStage, _FinalStage { private Optional> traits = Optional.empty(); + private Optional quantity = Optional.empty(); + private Optional> company = Optional.empty(); @JsonAnySetter @@ -150,6 +169,7 @@ private Builder() {} public Builder from(EventBodyTrack other) { company(other.getCompany()); event(other.getEvent()); + quantity(other.getQuantity()); traits(other.getTraits()); user(other.getUser()); return this; @@ -200,6 +220,23 @@ public _FinalStage traits(Optional> traits) { return this; } + /** + *

Optionally specify the quantity of the event

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

Key-value pairs to identify company associated with track event

* @return Reference to {@code this} so that method calls can be chained together. @@ -219,7 +256,7 @@ public _FinalStage company(Optional> company) { @java.lang.Override public EventBodyTrack build() { - return new EventBodyTrack(company, event, traits, user, additionalProperties); + return new EventBodyTrack(company, event, quantity, traits, user, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/EventDetailResponseData.java b/src/main/java/com/schematic/api/types/EventDetailResponseData.java index 7ef1cbf..9cc34c1 100644 --- a/src/main/java/com/schematic/api/types/EventDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EventDetailResponseData.java @@ -54,6 +54,8 @@ public final class EventDetailResponseData { private final Optional processedAt; + private final int quantity; + private final Optional sentAt; private final String status; @@ -85,6 +87,7 @@ private EventDetailResponseData( String id, Optional loadedAt, Optional processedAt, + int quantity, Optional sentAt, String status, Optional subtype, @@ -107,6 +110,7 @@ private EventDetailResponseData( this.id = id; this.loadedAt = loadedAt; this.processedAt = processedAt; + this.quantity = quantity; this.sentAt = sentAt; this.status = status; this.subtype = subtype; @@ -187,6 +191,11 @@ public Optional getProcessedAt() { return processedAt; } + @JsonProperty("quantity") + public int getQuantity() { + return quantity; + } + @JsonProperty("sent_at") public Optional getSentAt() { return sentAt; @@ -248,6 +257,7 @@ private boolean equalTo(EventDetailResponseData other) { && id.equals(other.id) && loadedAt.equals(other.loadedAt) && processedAt.equals(other.processedAt) + && quantity == other.quantity && sentAt.equals(other.sentAt) && status.equals(other.status) && subtype.equals(other.subtype) @@ -274,6 +284,7 @@ public int hashCode() { this.id, this.loadedAt, this.processedAt, + this.quantity, this.sentAt, this.status, this.subtype, @@ -303,7 +314,11 @@ public interface CapturedAtStage { } public interface IdStage { - StatusStage id(@NotNull String id); + QuantityStage id(@NotNull String id); + } + + public interface QuantityStage { + StatusStage quantity(int quantity); } public interface StatusStage { @@ -390,13 +405,22 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements BodyPreviewStage, CapturedAtStage, IdStage, StatusStage, TypeStage, UpdatedAtStage, _FinalStage { + implements BodyPreviewStage, + CapturedAtStage, + IdStage, + QuantityStage, + StatusStage, + TypeStage, + UpdatedAtStage, + _FinalStage { private String bodyPreview; private OffsetDateTime capturedAt; private String id; + private int quantity; + private String status; private String type; @@ -454,6 +478,7 @@ public Builder from(EventDetailResponseData other) { id(other.getId()); loadedAt(other.getLoadedAt()); processedAt(other.getProcessedAt()); + quantity(other.getQuantity()); sentAt(other.getSentAt()); status(other.getStatus()); subtype(other.getSubtype()); @@ -480,11 +505,18 @@ public IdStage capturedAt(@NotNull OffsetDateTime capturedAt) { @java.lang.Override @JsonSetter("id") - public StatusStage id(@NotNull String id) { + public QuantityStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + @java.lang.Override + @JsonSetter("quantity") + public StatusStage quantity(int quantity) { + this.quantity = quantity; + return this; + } + @java.lang.Override @JsonSetter("status") public TypeStage status(@NotNull String status) { @@ -739,6 +771,7 @@ public EventDetailResponseData build() { id, loadedAt, processedAt, + quantity, sentAt, status, subtype, diff --git a/src/main/java/com/schematic/api/types/EventResponseData.java b/src/main/java/com/schematic/api/types/EventResponseData.java index d53de72..23a4f8a 100644 --- a/src/main/java/com/schematic/api/types/EventResponseData.java +++ b/src/main/java/com/schematic/api/types/EventResponseData.java @@ -50,6 +50,8 @@ public final class EventResponseData { private final Optional processedAt; + private final int quantity; + private final Optional sentAt; private final String status; @@ -77,6 +79,7 @@ private EventResponseData( String id, Optional loadedAt, Optional processedAt, + int quantity, Optional sentAt, String status, Optional subtype, @@ -96,6 +99,7 @@ private EventResponseData( this.id = id; this.loadedAt = loadedAt; this.processedAt = processedAt; + this.quantity = quantity; this.sentAt = sentAt; this.status = status; this.subtype = subtype; @@ -165,6 +169,11 @@ public Optional getProcessedAt() { return processedAt; } + @JsonProperty("quantity") + public int getQuantity() { + return quantity; + } + @JsonProperty("sent_at") public Optional getSentAt() { return sentAt; @@ -219,6 +228,7 @@ private boolean equalTo(EventResponseData other) { && id.equals(other.id) && loadedAt.equals(other.loadedAt) && processedAt.equals(other.processedAt) + && quantity == other.quantity && sentAt.equals(other.sentAt) && status.equals(other.status) && subtype.equals(other.subtype) @@ -242,6 +252,7 @@ public int hashCode() { this.id, this.loadedAt, this.processedAt, + this.quantity, this.sentAt, this.status, this.subtype, @@ -270,7 +281,11 @@ public interface CapturedAtStage { } public interface IdStage { - StatusStage id(@NotNull String id); + QuantityStage id(@NotNull String id); + } + + public interface QuantityStage { + StatusStage quantity(int quantity); } public interface StatusStage { @@ -343,13 +358,22 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements BodyPreviewStage, CapturedAtStage, IdStage, StatusStage, TypeStage, UpdatedAtStage, _FinalStage { + implements BodyPreviewStage, + CapturedAtStage, + IdStage, + QuantityStage, + StatusStage, + TypeStage, + UpdatedAtStage, + _FinalStage { private String bodyPreview; private OffsetDateTime capturedAt; private String id; + private int quantity; + private String status; private String type; @@ -399,6 +423,7 @@ public Builder from(EventResponseData other) { id(other.getId()); loadedAt(other.getLoadedAt()); processedAt(other.getProcessedAt()); + quantity(other.getQuantity()); sentAt(other.getSentAt()); status(other.getStatus()); subtype(other.getSubtype()); @@ -424,11 +449,18 @@ public IdStage capturedAt(@NotNull OffsetDateTime capturedAt) { @java.lang.Override @JsonSetter("id") - public StatusStage id(@NotNull String id) { + public QuantityStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + @java.lang.Override + @JsonSetter("quantity") + public StatusStage quantity(int quantity) { + this.quantity = quantity; + return this; + } + @java.lang.Override @JsonSetter("status") public TypeStage status(@NotNull String status) { @@ -635,6 +667,7 @@ public EventResponseData build() { id, loadedAt, processedAt, + quantity, sentAt, status, subtype, diff --git a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java index 7abff32..fd09ec2 100644 --- a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java @@ -48,6 +48,8 @@ public final class PlanEntitlementResponseData { private final String ruleId; + private final Optional ruleIdUsageExceeded; + private final OffsetDateTime updatedAt; private final Optional valueBool; @@ -76,6 +78,7 @@ private PlanEntitlementResponseData( String planId, Optional priceBehavior, String ruleId, + Optional ruleIdUsageExceeded, OffsetDateTime updatedAt, Optional valueBool, Optional valueNumeric, @@ -96,6 +99,7 @@ private PlanEntitlementResponseData( this.planId = planId; this.priceBehavior = priceBehavior; this.ruleId = ruleId; + this.ruleIdUsageExceeded = ruleIdUsageExceeded; this.updatedAt = updatedAt; this.valueBool = valueBool; this.valueNumeric = valueNumeric; @@ -170,6 +174,11 @@ public String getRuleId() { return ruleId; } + @JsonProperty("rule_id_usage_exceeded") + public Optional getRuleIdUsageExceeded() { + return ruleIdUsageExceeded; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -225,6 +234,7 @@ private boolean equalTo(PlanEntitlementResponseData other) { && planId.equals(other.planId) && priceBehavior.equals(other.priceBehavior) && ruleId.equals(other.ruleId) + && ruleIdUsageExceeded.equals(other.ruleIdUsageExceeded) && updatedAt.equals(other.updatedAt) && valueBool.equals(other.valueBool) && valueNumeric.equals(other.valueNumeric) @@ -249,6 +259,7 @@ public int hashCode() { this.planId, this.priceBehavior, this.ruleId, + this.ruleIdUsageExceeded, this.updatedAt, this.valueBool, this.valueNumeric, @@ -331,6 +342,10 @@ public interface _FinalStage { _FinalStage priceBehavior(String priceBehavior); + _FinalStage ruleIdUsageExceeded(Optional ruleIdUsageExceeded); + + _FinalStage ruleIdUsageExceeded(String ruleIdUsageExceeded); + _FinalStage valueBool(Optional valueBool); _FinalStage valueBool(Boolean valueBool); @@ -383,6 +398,8 @@ public static final class Builder private Optional valueBool = Optional.empty(); + private Optional ruleIdUsageExceeded = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional plan = Optional.empty(); @@ -417,6 +434,7 @@ public Builder from(PlanEntitlementResponseData other) { planId(other.getPlanId()); priceBehavior(other.getPriceBehavior()); ruleId(other.getRuleId()); + ruleIdUsageExceeded(other.getRuleIdUsageExceeded()); updatedAt(other.getUpdatedAt()); valueBool(other.getValueBool()); valueNumeric(other.getValueNumeric()); @@ -534,6 +552,19 @@ public _FinalStage valueBool(Optional valueBool) { return this; } + @java.lang.Override + public _FinalStage ruleIdUsageExceeded(String ruleIdUsageExceeded) { + this.ruleIdUsageExceeded = Optional.ofNullable(ruleIdUsageExceeded); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rule_id_usage_exceeded", nulls = Nulls.SKIP) + public _FinalStage ruleIdUsageExceeded(Optional ruleIdUsageExceeded) { + this.ruleIdUsageExceeded = ruleIdUsageExceeded; + return this; + } + @java.lang.Override public _FinalStage priceBehavior(String priceBehavior) { this.priceBehavior = Optional.ofNullable(priceBehavior); @@ -641,6 +672,7 @@ public PlanEntitlementResponseData build() { planId, priceBehavior, ruleId, + ruleIdUsageExceeded, updatedAt, valueBool, valueNumeric, diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java new file mode 100644 index 0000000..07c7b5f --- /dev/null +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java @@ -0,0 +1,146 @@ +/** + * 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 = UsageBasedEntitlementRequestBody.Builder.class) +public final class UsageBasedEntitlementRequestBody { + private final Optional monthlyMeteredPriceId; + + private final Optional priceBehavior; + + private final Optional yearlyMeteredPriceId; + + private final Map additionalProperties; + + private UsageBasedEntitlementRequestBody( + Optional monthlyMeteredPriceId, + Optional priceBehavior, + Optional yearlyMeteredPriceId, + Map additionalProperties) { + this.monthlyMeteredPriceId = monthlyMeteredPriceId; + this.priceBehavior = priceBehavior; + this.yearlyMeteredPriceId = yearlyMeteredPriceId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("monthly_metered_price_id") + public Optional getMonthlyMeteredPriceId() { + return monthlyMeteredPriceId; + } + + @JsonProperty("price_behavior") + public Optional getPriceBehavior() { + return priceBehavior; + } + + @JsonProperty("yearly_metered_price_id") + public Optional getYearlyMeteredPriceId() { + return yearlyMeteredPriceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageBasedEntitlementRequestBody && equalTo((UsageBasedEntitlementRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageBasedEntitlementRequestBody other) { + return monthlyMeteredPriceId.equals(other.monthlyMeteredPriceId) + && priceBehavior.equals(other.priceBehavior) + && yearlyMeteredPriceId.equals(other.yearlyMeteredPriceId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.monthlyMeteredPriceId, this.priceBehavior, this.yearlyMeteredPriceId); + } + + @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 monthlyMeteredPriceId = Optional.empty(); + + private Optional priceBehavior = Optional.empty(); + + private Optional yearlyMeteredPriceId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageBasedEntitlementRequestBody other) { + monthlyMeteredPriceId(other.getMonthlyMeteredPriceId()); + priceBehavior(other.getPriceBehavior()); + yearlyMeteredPriceId(other.getYearlyMeteredPriceId()); + return this; + } + + @JsonSetter(value = "monthly_metered_price_id", nulls = Nulls.SKIP) + public Builder monthlyMeteredPriceId(Optional monthlyMeteredPriceId) { + this.monthlyMeteredPriceId = monthlyMeteredPriceId; + return this; + } + + public Builder monthlyMeteredPriceId(String monthlyMeteredPriceId) { + this.monthlyMeteredPriceId = Optional.ofNullable(monthlyMeteredPriceId); + return this; + } + + @JsonSetter(value = "price_behavior", nulls = Nulls.SKIP) + public Builder priceBehavior(Optional priceBehavior) { + this.priceBehavior = priceBehavior; + return this; + } + + public Builder priceBehavior(String priceBehavior) { + this.priceBehavior = Optional.ofNullable(priceBehavior); + return this; + } + + @JsonSetter(value = "yearly_metered_price_id", nulls = Nulls.SKIP) + public Builder yearlyMeteredPriceId(Optional yearlyMeteredPriceId) { + this.yearlyMeteredPriceId = yearlyMeteredPriceId; + return this; + } + + public Builder yearlyMeteredPriceId(String yearlyMeteredPriceId) { + this.yearlyMeteredPriceId = Optional.ofNullable(yearlyMeteredPriceId); + return this; + } + + public UsageBasedEntitlementRequestBody build() { + return new UsageBasedEntitlementRequestBody( + monthlyMeteredPriceId, priceBehavior, yearlyMeteredPriceId, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java index 96056a1..2df8855 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java @@ -29,6 +29,8 @@ public final class UsageBasedEntitlementResponseData { private final Optional metricPeriodMonthReset; + private final Optional monthlyUsageBasedPrice; + private final Optional priceBehavior; private final Optional valueBool; @@ -37,6 +39,8 @@ public final class UsageBasedEntitlementResponseData { private final String valueType; + private final Optional yearlyUsageBasedPrice; + private final Map additionalProperties; private UsageBasedEntitlementResponseData( @@ -44,19 +48,23 @@ private UsageBasedEntitlementResponseData( Optional meteredPrice, Optional metricPeriod, Optional metricPeriodMonthReset, + Optional monthlyUsageBasedPrice, Optional priceBehavior, Optional valueBool, Optional valueNumeric, String valueType, + Optional yearlyUsageBasedPrice, Map additionalProperties) { this.featureId = featureId; this.meteredPrice = meteredPrice; this.metricPeriod = metricPeriod; this.metricPeriodMonthReset = metricPeriodMonthReset; + this.monthlyUsageBasedPrice = monthlyUsageBasedPrice; this.priceBehavior = priceBehavior; this.valueBool = valueBool; this.valueNumeric = valueNumeric; this.valueType = valueType; + this.yearlyUsageBasedPrice = yearlyUsageBasedPrice; this.additionalProperties = additionalProperties; } @@ -80,6 +88,11 @@ public Optional getMetricPeriodMonthReset() { return metricPeriodMonthReset; } + @JsonProperty("monthly_usage_based_price") + public Optional getMonthlyUsageBasedPrice() { + return monthlyUsageBasedPrice; + } + @JsonProperty("price_behavior") public Optional getPriceBehavior() { return priceBehavior; @@ -100,6 +113,11 @@ public String getValueType() { return valueType; } + @JsonProperty("yearly_usage_based_price") + public Optional getYearlyUsageBasedPrice() { + return yearlyUsageBasedPrice; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -116,10 +134,12 @@ private boolean equalTo(UsageBasedEntitlementResponseData other) { && meteredPrice.equals(other.meteredPrice) && metricPeriod.equals(other.metricPeriod) && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && monthlyUsageBasedPrice.equals(other.monthlyUsageBasedPrice) && priceBehavior.equals(other.priceBehavior) && valueBool.equals(other.valueBool) && valueNumeric.equals(other.valueNumeric) - && valueType.equals(other.valueType); + && valueType.equals(other.valueType) + && yearlyUsageBasedPrice.equals(other.yearlyUsageBasedPrice); } @java.lang.Override @@ -129,10 +149,12 @@ public int hashCode() { this.meteredPrice, this.metricPeriod, this.metricPeriodMonthReset, + this.monthlyUsageBasedPrice, this.priceBehavior, this.valueBool, this.valueNumeric, - this.valueType); + this.valueType, + this.yearlyUsageBasedPrice); } @java.lang.Override @@ -169,6 +191,10 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); + _FinalStage monthlyUsageBasedPrice(Optional monthlyUsageBasedPrice); + + _FinalStage monthlyUsageBasedPrice(BillingPriceView monthlyUsageBasedPrice); + _FinalStage priceBehavior(Optional priceBehavior); _FinalStage priceBehavior(String priceBehavior); @@ -180,6 +206,10 @@ public interface _FinalStage { _FinalStage valueNumeric(Optional valueNumeric); _FinalStage valueNumeric(Integer valueNumeric); + + _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice); + + _FinalStage yearlyUsageBasedPrice(BillingPriceView yearlyUsageBasedPrice); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -188,12 +218,16 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private String valueType; + private Optional yearlyUsageBasedPrice = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueBool = Optional.empty(); private Optional priceBehavior = Optional.empty(); + private Optional monthlyUsageBasedPrice = Optional.empty(); + private Optional metricPeriodMonthReset = Optional.empty(); private Optional metricPeriod = Optional.empty(); @@ -211,10 +245,12 @@ public Builder from(UsageBasedEntitlementResponseData other) { meteredPrice(other.getMeteredPrice()); metricPeriod(other.getMetricPeriod()); metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + monthlyUsageBasedPrice(other.getMonthlyUsageBasedPrice()); priceBehavior(other.getPriceBehavior()); valueBool(other.getValueBool()); valueNumeric(other.getValueNumeric()); valueType(other.getValueType()); + yearlyUsageBasedPrice(other.getYearlyUsageBasedPrice()); return this; } @@ -232,6 +268,19 @@ public _FinalStage valueType(@NotNull String valueType) { return this; } + @java.lang.Override + public _FinalStage yearlyUsageBasedPrice(BillingPriceView yearlyUsageBasedPrice) { + this.yearlyUsageBasedPrice = Optional.ofNullable(yearlyUsageBasedPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_usage_based_price", nulls = Nulls.SKIP) + public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice) { + this.yearlyUsageBasedPrice = yearlyUsageBasedPrice; + return this; + } + @java.lang.Override public _FinalStage valueNumeric(Integer valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); @@ -271,6 +320,19 @@ public _FinalStage priceBehavior(Optional priceBehavior) { return this; } + @java.lang.Override + public _FinalStage monthlyUsageBasedPrice(BillingPriceView monthlyUsageBasedPrice) { + this.monthlyUsageBasedPrice = Optional.ofNullable(monthlyUsageBasedPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_usage_based_price", nulls = Nulls.SKIP) + public _FinalStage monthlyUsageBasedPrice(Optional monthlyUsageBasedPrice) { + this.monthlyUsageBasedPrice = monthlyUsageBasedPrice; + return this; + } + @java.lang.Override public _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset) { this.metricPeriodMonthReset = Optional.ofNullable(metricPeriodMonthReset); @@ -317,10 +379,12 @@ public UsageBasedEntitlementResponseData build() { meteredPrice, metricPeriod, metricPeriodMonthReset, + monthlyUsageBasedPrice, priceBehavior, valueBool, valueNumeric, valueType, + yearlyUsageBasedPrice, additionalProperties); } } diff --git a/src/test/java/com/schematic/api/TestSchematic.java b/src/test/java/com/schematic/api/TestSchematic.java index 72acccc..0830eb9 100644 --- a/src/test/java/com/schematic/api/TestSchematic.java +++ b/src/test/java/com/schematic/api/TestSchematic.java @@ -65,6 +65,7 @@ void checkFlag_CachesResultIfNotCached() { CheckFlagResponse response = CheckFlagResponse.builder() .data(CheckFlagResponseData.builder() + .flag("test_flag") .reason("test_reason") .value(true) .build())