diff --git a/build.gradle b/build.gradle index ceef83a..1d74354 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ java { group = 'com.schematichq' -version = '1.1.4' +version = '1.2.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -80,7 +80,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.1.4' + version = '1.2.0' from components.java pom { name = 'schematic' diff --git a/reference.md b/reference.md index 2c875fc..4960436 100644 --- a/reference.md +++ b/reference.md @@ -4731,6 +4731,14 @@ client.credits().createBillingPlanCreditGrant(
+**applyToExisting:** `Optional` + +
+
+ +
+
+ **creditAmount:** `Integer`
@@ -4803,6 +4811,117 @@ client.credits().createBillingPlanCreditGrant(
+ + + + +
client.credits.updateBillingPlanCreditGrant(planGrantId, request) -> UpdateBillingPlanCreditGrantResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.credits().updateBillingPlanCreditGrant( + "plan_grant_id", + UpdateBillingPlanCreditGrantRequestBody + .builder() + .resetCadence(UpdateBillingPlanCreditGrantRequestBodyResetCadence.MONTHLY) + .resetStart(UpdateBillingPlanCreditGrantRequestBodyResetStart.BILLING_PERIOD) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planGrantId:** `String` — plan_grant_id + +
+
+ +
+
+ +**applyToExisting:** `Optional` + +
+
+ +
+
+ +**creditAmount:** `Optional` + +
+
+ +
+
+ +**expiryType:** `Optional` + +
+
+ +
+
+ +**expiryUnit:** `Optional` + +
+
+ +
+
+ +**expiryUnitCount:** `Optional` + +
+
+ +
+
+ +**resetCadence:** `UpdateBillingPlanCreditGrantRequestBodyResetCadence` + +
+
+ +
+
+ +**resetStart:** `UpdateBillingPlanCreditGrantRequestBodyResetStart` + +
+
+ +
+
+ +**resetType:** `Optional` + +
+
+
+
+ +
@@ -4820,7 +4939,13 @@ client.credits().createBillingPlanCreditGrant(
```java -client.credits().deleteBillingPlanCreditGrant("plan_grant_id"); +client.credits().deleteBillingPlanCreditGrant( + "plan_grant_id", + DeleteBillingPlanCreditGrantRequest + .builder() + .applyToExisting(true) + .build() +); ```
@@ -4837,6 +4962,14 @@ client.credits().deleteBillingPlanCreditGrant("plan_grant_id"); **planGrantId:** `String` — plan_grant_id + + + +
+
+ +**applyToExisting:** `Optional` +
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index ff675a0..a1f67f1 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -32,10 +32,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.1.4"); + put("User-Agent", "com.schematichq:schematic-java/1.2.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.1.4"); + put("X-Fern-SDK-Version", "1.2.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java index 1d38656..2ffb7da 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java @@ -14,6 +14,7 @@ import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; +import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; import com.schematic.api.resources.credits.requests.GetEnrichedCreditLedgerRequest; import com.schematic.api.resources.credits.requests.ListBillingCreditsRequest; import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; @@ -21,6 +22,7 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; +import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; @@ -44,6 +46,7 @@ import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; import java.util.concurrent.CompletableFuture; @@ -306,14 +309,31 @@ public CompletableFuture createBillingPlan .thenApply(response -> response.body()); } + public CompletableFuture updateBillingPlanCreditGrant( + String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { + return this.rawClient.updateBillingPlanCreditGrant(planGrantId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateBillingPlanCreditGrant( + String planGrantId, UpdateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .updateBillingPlanCreditGrant(planGrantId, request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture deleteBillingPlanCreditGrant(String planGrantId) { return this.rawClient.deleteBillingPlanCreditGrant(planGrantId).thenApply(response -> response.body()); } public CompletableFuture deleteBillingPlanCreditGrant( - String planGrantId, RequestOptions requestOptions) { + String planGrantId, DeleteBillingPlanCreditGrantRequest request) { + return this.rawClient.deleteBillingPlanCreditGrant(planGrantId, request).thenApply(response -> response.body()); + } + + public CompletableFuture deleteBillingPlanCreditGrant( + String planGrantId, DeleteBillingPlanCreditGrantRequest request, RequestOptions requestOptions) { return this.rawClient - .deleteBillingPlanCreditGrant(planGrantId, requestOptions) + .deleteBillingPlanCreditGrant(planGrantId, request, requestOptions) .thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java index cd6c911..666c67d 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java @@ -26,6 +26,7 @@ import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; +import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; import com.schematic.api.resources.credits.requests.GetEnrichedCreditLedgerRequest; import com.schematic.api.resources.credits.requests.ListBillingCreditsRequest; import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; @@ -33,6 +34,7 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; +import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; @@ -56,6 +58,7 @@ import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; import com.schematic.api.types.ApiError; @@ -2132,28 +2135,135 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> - deleteBillingPlanCreditGrant(String planGrantId) { - return deleteBillingPlanCreditGrant(planGrantId, null); + public CompletableFuture> + updateBillingPlanCreditGrant(String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { + return updateBillingPlanCreditGrant(planGrantId, request, null); } - public CompletableFuture> - deleteBillingPlanCreditGrant(String planGrantId, RequestOptions requestOptions) { + public CompletableFuture> + updateBillingPlanCreditGrant( + String planGrantId, + UpdateBillingPlanCreditGrantRequestBody request, + RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") .addPathSegment(planGrantId) .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("DELETE", null) + .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); } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), UpdateBillingPlanCreditGrantResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> + deleteBillingPlanCreditGrant(String planGrantId) { + return deleteBillingPlanCreditGrant( + planGrantId, DeleteBillingPlanCreditGrantRequest.builder().build()); + } + + public CompletableFuture> + deleteBillingPlanCreditGrant(String planGrantId, DeleteBillingPlanCreditGrantRequest request) { + return deleteBillingPlanCreditGrant(planGrantId, request, null); + } + + public CompletableFuture> + deleteBillingPlanCreditGrant( + String planGrantId, DeleteBillingPlanCreditGrantRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("billing/credits/plan-grants") + .addPathSegment(planGrantId); + if (request.getApplyToExisting().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "apply_to_existing", request.getApplyToExisting().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { diff --git a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java index 7eabd90..7078b84 100644 --- a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java @@ -14,6 +14,7 @@ import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; +import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; import com.schematic.api.resources.credits.requests.GetEnrichedCreditLedgerRequest; import com.schematic.api.resources.credits.requests.ListBillingCreditsRequest; import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; @@ -21,6 +22,7 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; +import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; @@ -44,6 +46,7 @@ import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; @@ -297,14 +300,31 @@ public CreateBillingPlanCreditGrantResponse createBillingPlanCreditGrant( .body(); } + public UpdateBillingPlanCreditGrantResponse updateBillingPlanCreditGrant( + String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { + return this.rawClient.updateBillingPlanCreditGrant(planGrantId, request).body(); + } + + public UpdateBillingPlanCreditGrantResponse updateBillingPlanCreditGrant( + String planGrantId, UpdateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .updateBillingPlanCreditGrant(planGrantId, request, requestOptions) + .body(); + } + public DeleteBillingPlanCreditGrantResponse deleteBillingPlanCreditGrant(String planGrantId) { return this.rawClient.deleteBillingPlanCreditGrant(planGrantId).body(); } public DeleteBillingPlanCreditGrantResponse deleteBillingPlanCreditGrant( - String planGrantId, RequestOptions requestOptions) { + String planGrantId, DeleteBillingPlanCreditGrantRequest request) { + return this.rawClient.deleteBillingPlanCreditGrant(planGrantId, request).body(); + } + + public DeleteBillingPlanCreditGrantResponse deleteBillingPlanCreditGrant( + String planGrantId, DeleteBillingPlanCreditGrantRequest request, RequestOptions requestOptions) { return this.rawClient - .deleteBillingPlanCreditGrant(planGrantId, requestOptions) + .deleteBillingPlanCreditGrant(planGrantId, request, requestOptions) .body(); } diff --git a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java index b7750a3..6eb2d69 100644 --- a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java @@ -26,6 +26,7 @@ import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; +import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; import com.schematic.api.resources.credits.requests.GetEnrichedCreditLedgerRequest; import com.schematic.api.resources.credits.requests.ListBillingCreditsRequest; import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; @@ -33,6 +34,7 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; +import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; @@ -56,6 +58,7 @@ import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; import com.schematic.api.types.ApiError; @@ -1620,28 +1623,107 @@ public BaseSchematicHttpResponse createBil } } - public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( - String planGrantId) { - return deleteBillingPlanCreditGrant(planGrantId, null); + public BaseSchematicHttpResponse updateBillingPlanCreditGrant( + String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { + return updateBillingPlanCreditGrant(planGrantId, request, null); } - public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( - String planGrantId, RequestOptions requestOptions) { + public BaseSchematicHttpResponse updateBillingPlanCreditGrant( + String planGrantId, UpdateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") .addPathSegment(planGrantId) .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("DELETE", null) + .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 new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), UpdateBillingPlanCreditGrantResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( + String planGrantId) { + return deleteBillingPlanCreditGrant( + planGrantId, DeleteBillingPlanCreditGrantRequest.builder().build()); + } + + public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( + String planGrantId, DeleteBillingPlanCreditGrantRequest request) { + return deleteBillingPlanCreditGrant(planGrantId, request, null); + } + + public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( + String planGrantId, DeleteBillingPlanCreditGrantRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("billing/credits/plan-grants") + .addPathSegment(planGrantId); + if (request.getApplyToExisting().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "apply_to_existing", request.getApplyToExisting().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java index 161949e..25feca8 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java @@ -26,6 +26,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateBillingPlanCreditGrantRequestBody.Builder.class) public final class CreateBillingPlanCreditGrantRequestBody { + private final Optional applyToExisting; + private final int creditAmount; private final String creditId; @@ -47,6 +49,7 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Map additionalProperties; private CreateBillingPlanCreditGrantRequestBody( + Optional applyToExisting, int creditAmount, String creditId, Optional expiryType, @@ -57,6 +60,7 @@ private CreateBillingPlanCreditGrantRequestBody( CreateBillingPlanCreditGrantRequestBodyResetStart resetStart, Optional resetType, Map additionalProperties) { + this.applyToExisting = applyToExisting; this.creditAmount = creditAmount; this.creditId = creditId; this.expiryType = expiryType; @@ -69,6 +73,11 @@ private CreateBillingPlanCreditGrantRequestBody( this.additionalProperties = additionalProperties; } + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + @JsonProperty("credit_amount") public int getCreditAmount() { return creditAmount; @@ -127,7 +136,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { - return creditAmount == other.creditAmount + return applyToExisting.equals(other.applyToExisting) + && creditAmount == other.creditAmount && creditId.equals(other.creditId) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) @@ -141,6 +151,7 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.applyToExisting, this.creditAmount, this.creditId, this.expiryType, @@ -186,6 +197,10 @@ public interface ResetStartStage { public interface _FinalStage { CreateBillingPlanCreditGrantRequestBody build(); + _FinalStage applyToExisting(Optional applyToExisting); + + _FinalStage applyToExisting(Boolean applyToExisting); + _FinalStage expiryType(Optional expiryType); _FinalStage expiryType(CreateBillingPlanCreditGrantRequestBodyExpiryType expiryType); @@ -224,6 +239,8 @@ public static final class Builder private Optional expiryType = Optional.empty(); + private Optional applyToExisting = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -231,6 +248,7 @@ private Builder() {} @java.lang.Override public Builder from(CreateBillingPlanCreditGrantRequestBody other) { + applyToExisting(other.getApplyToExisting()); creditAmount(other.getCreditAmount()); creditId(other.getCreditId()); expiryType(other.getExpiryType()); @@ -330,9 +348,23 @@ public _FinalStage expiryType(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + @java.lang.Override public CreateBillingPlanCreditGrantRequestBody build() { return new CreateBillingPlanCreditGrantRequestBody( + applyToExisting, creditAmount, creditId, expiryType, diff --git a/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java new file mode 100644 index 0000000..f81850f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.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.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteBillingPlanCreditGrantRequest.Builder.class) +public final class DeleteBillingPlanCreditGrantRequest { + private final Optional applyToExisting; + + private final Map additionalProperties; + + private DeleteBillingPlanCreditGrantRequest( + Optional applyToExisting, Map additionalProperties) { + this.applyToExisting = applyToExisting; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteBillingPlanCreditGrantRequest + && equalTo((DeleteBillingPlanCreditGrantRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteBillingPlanCreditGrantRequest other) { + return applyToExisting.equals(other.applyToExisting); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.applyToExisting); + } + + @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 applyToExisting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteBillingPlanCreditGrantRequest other) { + applyToExisting(other.getApplyToExisting()); + return this; + } + + @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) + public Builder applyToExisting(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + + public Builder applyToExisting(Boolean applyToExisting) { + this.applyToExisting = Optional.ofNullable(applyToExisting); + return this; + } + + public DeleteBillingPlanCreditGrantRequest build() { + return new DeleteBillingPlanCreditGrantRequest(applyToExisting, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingPlanCreditGrantRequestBody.java new file mode 100644 index 0000000..9c4eb31 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingPlanCreditGrantRequestBody.java @@ -0,0 +1,333 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyExpiryType; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyExpiryUnit; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyResetCadence; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyResetStart; +import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyResetType; +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 = UpdateBillingPlanCreditGrantRequestBody.Builder.class) +public final class UpdateBillingPlanCreditGrantRequestBody { + private final Optional applyToExisting; + + private final Optional creditAmount; + + private final Optional expiryType; + + private final Optional expiryUnit; + + private final Optional expiryUnitCount; + + private final UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence; + + private final UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart; + + private final Optional resetType; + + private final Map additionalProperties; + + private UpdateBillingPlanCreditGrantRequestBody( + Optional applyToExisting, + Optional creditAmount, + Optional expiryType, + Optional expiryUnit, + Optional expiryUnitCount, + UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence, + UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart, + Optional resetType, + Map additionalProperties) { + this.applyToExisting = applyToExisting; + this.creditAmount = creditAmount; + this.expiryType = expiryType; + this.expiryUnit = expiryUnit; + this.expiryUnitCount = expiryUnitCount; + this.resetCadence = resetCadence; + this.resetStart = resetStart; + this.resetType = resetType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + + @JsonProperty("credit_amount") + public Optional getCreditAmount() { + return creditAmount; + } + + @JsonProperty("expiry_type") + public Optional getExpiryType() { + return expiryType; + } + + @JsonProperty("expiry_unit") + public Optional getExpiryUnit() { + return expiryUnit; + } + + @JsonProperty("expiry_unit_count") + public Optional getExpiryUnitCount() { + return expiryUnitCount; + } + + @JsonProperty("reset_cadence") + public UpdateBillingPlanCreditGrantRequestBodyResetCadence getResetCadence() { + return resetCadence; + } + + @JsonProperty("reset_start") + public UpdateBillingPlanCreditGrantRequestBodyResetStart getResetStart() { + return resetStart; + } + + @JsonProperty("reset_type") + public Optional getResetType() { + return resetType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateBillingPlanCreditGrantRequestBody + && equalTo((UpdateBillingPlanCreditGrantRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { + return applyToExisting.equals(other.applyToExisting) + && creditAmount.equals(other.creditAmount) + && expiryType.equals(other.expiryType) + && expiryUnit.equals(other.expiryUnit) + && expiryUnitCount.equals(other.expiryUnitCount) + && resetCadence.equals(other.resetCadence) + && resetStart.equals(other.resetStart) + && resetType.equals(other.resetType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.applyToExisting, + this.creditAmount, + this.expiryType, + this.expiryUnit, + this.expiryUnitCount, + this.resetCadence, + this.resetStart, + this.resetType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResetCadenceStage builder() { + return new Builder(); + } + + public interface ResetCadenceStage { + ResetStartStage resetCadence(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence); + + Builder from(UpdateBillingPlanCreditGrantRequestBody other); + } + + public interface ResetStartStage { + _FinalStage resetStart(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart); + } + + public interface _FinalStage { + UpdateBillingPlanCreditGrantRequestBody build(); + + _FinalStage applyToExisting(Optional applyToExisting); + + _FinalStage applyToExisting(Boolean applyToExisting); + + _FinalStage creditAmount(Optional creditAmount); + + _FinalStage creditAmount(Integer creditAmount); + + _FinalStage expiryType(Optional expiryType); + + _FinalStage expiryType(UpdateBillingPlanCreditGrantRequestBodyExpiryType expiryType); + + _FinalStage expiryUnit(Optional expiryUnit); + + _FinalStage expiryUnit(UpdateBillingPlanCreditGrantRequestBodyExpiryUnit expiryUnit); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Integer expiryUnitCount); + + _FinalStage resetType(Optional resetType); + + _FinalStage resetType(UpdateBillingPlanCreditGrantRequestBodyResetType resetType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResetCadenceStage, ResetStartStage, _FinalStage { + private UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence; + + private UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart; + + private Optional resetType = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); + + private Optional expiryUnit = Optional.empty(); + + private Optional expiryType = Optional.empty(); + + private Optional creditAmount = Optional.empty(); + + private Optional applyToExisting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { + applyToExisting(other.getApplyToExisting()); + creditAmount(other.getCreditAmount()); + expiryType(other.getExpiryType()); + expiryUnit(other.getExpiryUnit()); + expiryUnitCount(other.getExpiryUnitCount()); + resetCadence(other.getResetCadence()); + resetStart(other.getResetStart()); + resetType(other.getResetType()); + return this; + } + + @java.lang.Override + @JsonSetter("reset_cadence") + public ResetStartStage resetCadence(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence) { + this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reset_start") + public _FinalStage resetStart(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart) { + this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage resetType(UpdateBillingPlanCreditGrantRequestBodyResetType resetType) { + this.resetType = Optional.ofNullable(resetType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) + public _FinalStage resetType(Optional resetType) { + this.resetType = resetType; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + this.expiryUnitCount = expiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnit(UpdateBillingPlanCreditGrantRequestBodyExpiryUnit expiryUnit) { + this.expiryUnit = Optional.ofNullable(expiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) + public _FinalStage expiryUnit(Optional expiryUnit) { + this.expiryUnit = expiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage expiryType(UpdateBillingPlanCreditGrantRequestBodyExpiryType expiryType) { + this.expiryType = Optional.ofNullable(expiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) + public _FinalStage expiryType(Optional expiryType) { + this.expiryType = expiryType; + return this; + } + + @java.lang.Override + public _FinalStage creditAmount(Integer creditAmount) { + this.creditAmount = Optional.ofNullable(creditAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_amount", nulls = Nulls.SKIP) + public _FinalStage creditAmount(Optional creditAmount) { + this.creditAmount = creditAmount; + return this; + } + + @java.lang.Override + public _FinalStage applyToExisting(Boolean applyToExisting) { + this.applyToExisting = Optional.ofNullable(applyToExisting); + return this; + } + + @java.lang.Override + @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) + public _FinalStage applyToExisting(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + + @java.lang.Override + public UpdateBillingPlanCreditGrantRequestBody build() { + return new UpdateBillingPlanCreditGrantRequestBody( + applyToExisting, + creditAmount, + expiryType, + expiryUnit, + expiryUnitCount, + resetCadence, + resetStart, + resetType, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java new file mode 100644 index 0000000..c2aaab4 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.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 = DeleteBillingPlanCreditGrantParams.Builder.class) +public final class DeleteBillingPlanCreditGrantParams { + private final Optional applyToExisting; + + private final Map additionalProperties; + + private DeleteBillingPlanCreditGrantParams( + Optional applyToExisting, Map additionalProperties) { + this.applyToExisting = applyToExisting; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteBillingPlanCreditGrantParams + && equalTo((DeleteBillingPlanCreditGrantParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteBillingPlanCreditGrantParams other) { + return applyToExisting.equals(other.applyToExisting); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.applyToExisting); + } + + @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 applyToExisting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteBillingPlanCreditGrantParams other) { + applyToExisting(other.getApplyToExisting()); + return this; + } + + @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) + public Builder applyToExisting(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + + public Builder applyToExisting(Boolean applyToExisting) { + this.applyToExisting = Optional.ofNullable(applyToExisting); + return this; + } + + public DeleteBillingPlanCreditGrantParams build() { + return new DeleteBillingPlanCreditGrantParams(applyToExisting, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java index 6f4565f..03ed5d8 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java @@ -9,13 +9,10 @@ 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.DeleteResponse; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import org.jetbrains.annotations.NotNull; @@ -25,12 +22,12 @@ public final class DeleteBillingPlanCreditGrantResponse { private final DeleteResponse data; - private final Map params; + private final DeleteBillingPlanCreditGrantParams params; private final Map additionalProperties; private DeleteBillingPlanCreditGrantResponse( - DeleteResponse data, Map params, Map additionalProperties) { + DeleteResponse data, DeleteBillingPlanCreditGrantParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -45,7 +42,7 @@ public DeleteResponse getData() { * @return Input parameters */ @JsonProperty("params") - public Map getParams() { + public DeleteBillingPlanCreditGrantParams getParams() { return params; } @@ -80,29 +77,27 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull DeleteResponse data); + ParamsStage data(@NotNull DeleteResponse data); Builder from(DeleteBillingPlanCreditGrantResponse other); } - public interface _FinalStage { - DeleteBillingPlanCreditGrantResponse build(); - + public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(Map params); - - _FinalStage putAllParams(Map params); + _FinalStage params(@NotNull DeleteBillingPlanCreditGrantParams params); + } - _FinalStage params(String key, JsonNode value); + public interface _FinalStage { + DeleteBillingPlanCreditGrantResponse build(); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DataStage, _FinalStage { + public static final class Builder implements DataStage, ParamsStage, _FinalStage { private DeleteResponse data; - private Map params = new LinkedHashMap<>(); + private DeleteBillingPlanCreditGrantParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -118,43 +113,20 @@ public Builder from(DeleteBillingPlanCreditGrantResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull DeleteResponse data) { + public ParamsStage data(@NotNull DeleteResponse 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) { - if (params != null) { - this.params.putAll(params); - } - return this; - } - - /** - *

Input parameters

- */ - @java.lang.Override - @JsonSetter(value = "params", nulls = Nulls.SKIP) - public _FinalStage params(Map params) { - this.params.clear(); - if (params != null) { - this.params.putAll(params); - } + @JsonSetter("params") + public _FinalStage params(@NotNull DeleteBillingPlanCreditGrantParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.java new file mode 100644 index 0000000..137553e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.java @@ -0,0 +1,120 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBillingPlanCreditGrantRequestBodyExpiryType { + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType END_OF_BILLING_PERIOD = + new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); + + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType DURATION = + new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.DURATION, "duration"); + + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = + new UpdateBillingPlanCreditGrantRequestBodyExpiryType( + Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); + + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType NO_EXPIRY = + new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); + + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType END_OF_TRIAL = + new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); + + private final Value value; + + private final String string; + + UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBillingPlanCreditGrantRequestBodyExpiryType + && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyExpiryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case END_OF_BILLING_PERIOD: + return visitor.visitEndOfBillingPeriod(); + case DURATION: + return visitor.visitDuration(); + case END_OF_NEXT_BILLING_PERIOD: + return visitor.visitEndOfNextBillingPeriod(); + case NO_EXPIRY: + return visitor.visitNoExpiry(); + case END_OF_TRIAL: + return visitor.visitEndOfTrial(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBillingPlanCreditGrantRequestBodyExpiryType valueOf(String value) { + switch (value) { + case "end_of_billing_period": + return END_OF_BILLING_PERIOD; + case "duration": + return DURATION; + case "end_of_next_billing_period": + return END_OF_NEXT_BILLING_PERIOD; + case "no_expiry": + return NO_EXPIRY; + case "end_of_trial": + return END_OF_TRIAL; + default: + return new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.UNKNOWN, value); + } + } + + public enum Value { + DURATION, + + NO_EXPIRY, + + END_OF_TRIAL, + + END_OF_BILLING_PERIOD, + + END_OF_NEXT_BILLING_PERIOD, + + UNKNOWN + } + + public interface Visitor { + T visitDuration(); + + T visitNoExpiry(); + + T visitEndOfTrial(); + + T visitEndOfBillingPeriod(); + + T visitEndOfNextBillingPeriod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.java new file mode 100644 index 0000000..4fc45aa --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBillingPlanCreditGrantRequestBodyExpiryUnit { + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryUnit BILLING_PERIODS = + new UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); + + public static final UpdateBillingPlanCreditGrantRequestBodyExpiryUnit DAYS = + new UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.DAYS, "days"); + + private final Value value; + + private final String string; + + UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBillingPlanCreditGrantRequestBodyExpiryUnit + && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyExpiryUnit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BILLING_PERIODS: + return visitor.visitBillingPeriods(); + case DAYS: + return visitor.visitDays(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBillingPlanCreditGrantRequestBodyExpiryUnit valueOf(String value) { + switch (value) { + case "billing_periods": + return BILLING_PERIODS; + case "days": + return DAYS; + default: + return new UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.UNKNOWN, value); + } + } + + public enum Value { + DAYS, + + BILLING_PERIODS, + + UNKNOWN + } + + public interface Visitor { + T visitDays(); + + T visitBillingPeriods(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.java new file mode 100644 index 0000000..e8740c9 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBillingPlanCreditGrantRequestBodyResetCadence { + public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence YEARLY = + new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.YEARLY, "yearly"); + + public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence MONTHLY = + new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.MONTHLY, "monthly"); + + public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence DAILY = + new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.DAILY, "daily"); + + public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence WEEKLY = + new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.WEEKLY, "weekly"); + + private final Value value; + + private final String string; + + UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBillingPlanCreditGrantRequestBodyResetCadence + && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyResetCadence) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case YEARLY: + return visitor.visitYearly(); + case MONTHLY: + return visitor.visitMonthly(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBillingPlanCreditGrantRequestBodyResetCadence valueOf(String value) { + switch (value) { + case "yearly": + return YEARLY; + case "monthly": + return MONTHLY; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + default: + return new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.UNKNOWN, value); + } + } + + public enum Value { + MONTHLY, + + YEARLY, + + DAILY, + + WEEKLY, + + UNKNOWN + } + + public interface Visitor { + T visitMonthly(); + + T visitYearly(); + + T visitDaily(); + + T visitWeekly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.java new file mode 100644 index 0000000..4659ac1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBillingPlanCreditGrantRequestBodyResetStart { + public static final UpdateBillingPlanCreditGrantRequestBodyResetStart FIRST_OF_MONTH = + new UpdateBillingPlanCreditGrantRequestBodyResetStart(Value.FIRST_OF_MONTH, "first_of_month"); + + public static final UpdateBillingPlanCreditGrantRequestBodyResetStart BILLING_PERIOD = + new UpdateBillingPlanCreditGrantRequestBodyResetStart(Value.BILLING_PERIOD, "billing_period"); + + private final Value value; + + private final String string; + + UpdateBillingPlanCreditGrantRequestBodyResetStart(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBillingPlanCreditGrantRequestBodyResetStart + && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyResetStart) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_OF_MONTH: + return visitor.visitFirstOfMonth(); + case BILLING_PERIOD: + return visitor.visitBillingPeriod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBillingPlanCreditGrantRequestBodyResetStart valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_period": + return BILLING_PERIOD; + default: + return new UpdateBillingPlanCreditGrantRequestBodyResetStart(Value.UNKNOWN, value); + } + } + + public enum Value { + BILLING_PERIOD, + + FIRST_OF_MONTH, + + UNKNOWN + } + + public interface Visitor { + T visitBillingPeriod(); + + T visitFirstOfMonth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.java new file mode 100644 index 0000000..3277aa2 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UpdateBillingPlanCreditGrantRequestBodyResetType { + public static final UpdateBillingPlanCreditGrantRequestBodyResetType NO_RESET = + new UpdateBillingPlanCreditGrantRequestBodyResetType(Value.NO_RESET, "no_reset"); + + public static final UpdateBillingPlanCreditGrantRequestBodyResetType PLAN_PERIOD = + new UpdateBillingPlanCreditGrantRequestBodyResetType(Value.PLAN_PERIOD, "plan_period"); + + private final Value value; + + private final String string; + + UpdateBillingPlanCreditGrantRequestBodyResetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UpdateBillingPlanCreditGrantRequestBodyResetType + && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyResetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_RESET: + return visitor.visitNoReset(); + case PLAN_PERIOD: + return visitor.visitPlanPeriod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UpdateBillingPlanCreditGrantRequestBodyResetType valueOf(String value) { + switch (value) { + case "no_reset": + return NO_RESET; + case "plan_period": + return PLAN_PERIOD; + default: + return new UpdateBillingPlanCreditGrantRequestBodyResetType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLAN_PERIOD, + + NO_RESET, + + UNKNOWN + } + + public interface Visitor { + T visitPlanPeriod(); + + T visitNoReset(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java new file mode 100644 index 0000000..953ead3 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.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.BillingPlanCreditGrantResponseData; +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 = UpdateBillingPlanCreditGrantResponse.Builder.class) +public final class UpdateBillingPlanCreditGrantResponse { + private final BillingPlanCreditGrantResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateBillingPlanCreditGrantResponse( + BillingPlanCreditGrantResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public BillingPlanCreditGrantResponseData 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 UpdateBillingPlanCreditGrantResponse + && equalTo((UpdateBillingPlanCreditGrantResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateBillingPlanCreditGrantResponse 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 BillingPlanCreditGrantResponseData data); + + Builder from(UpdateBillingPlanCreditGrantResponse other); + } + + public interface _FinalStage { + UpdateBillingPlanCreditGrantResponse build(); + + /** + *

Input parameters

+ */ + _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 BillingPlanCreditGrantResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateBillingPlanCreditGrantResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull BillingPlanCreditGrantResponseData 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) { + if (params != null) { + this.params.putAll(params); + } + return this; + } + + /** + *

Input parameters

+ */ + @java.lang.Override + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public _FinalStage params(Map params) { + this.params.clear(); + if (params != null) { + this.params.putAll(params); + } + return this; + } + + @java.lang.Override + public UpdateBillingPlanCreditGrantResponse build() { + return new UpdateBillingPlanCreditGrantResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java new file mode 100644 index 0000000..55dd818 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java @@ -0,0 +1,257 @@ +/** + * 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 = CreditGrantExpiryRequestBody.Builder.class) +public final class CreditGrantExpiryRequestBody { + private final Optional expiryType; + + private final Optional expiryUnit; + + private final Optional expiryUnitCount; + + private final CreditGrantExpiryRequestBodyResetCadence resetCadence; + + private final CreditGrantExpiryRequestBodyResetStart resetStart; + + private final Optional resetType; + + private final Map additionalProperties; + + private CreditGrantExpiryRequestBody( + Optional expiryType, + Optional expiryUnit, + Optional expiryUnitCount, + CreditGrantExpiryRequestBodyResetCadence resetCadence, + CreditGrantExpiryRequestBodyResetStart resetStart, + Optional resetType, + Map additionalProperties) { + this.expiryType = expiryType; + this.expiryUnit = expiryUnit; + this.expiryUnitCount = expiryUnitCount; + this.resetCadence = resetCadence; + this.resetStart = resetStart; + this.resetType = resetType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("expiry_type") + public Optional getExpiryType() { + return expiryType; + } + + @JsonProperty("expiry_unit") + public Optional getExpiryUnit() { + return expiryUnit; + } + + @JsonProperty("expiry_unit_count") + public Optional getExpiryUnitCount() { + return expiryUnitCount; + } + + @JsonProperty("reset_cadence") + public CreditGrantExpiryRequestBodyResetCadence getResetCadence() { + return resetCadence; + } + + @JsonProperty("reset_start") + public CreditGrantExpiryRequestBodyResetStart getResetStart() { + return resetStart; + } + + @JsonProperty("reset_type") + public Optional getResetType() { + return resetType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditGrantExpiryRequestBody && equalTo((CreditGrantExpiryRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditGrantExpiryRequestBody other) { + return expiryType.equals(other.expiryType) + && expiryUnit.equals(other.expiryUnit) + && expiryUnitCount.equals(other.expiryUnitCount) + && resetCadence.equals(other.resetCadence) + && resetStart.equals(other.resetStart) + && resetType.equals(other.resetType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.expiryType, + this.expiryUnit, + this.expiryUnitCount, + this.resetCadence, + this.resetStart, + this.resetType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResetCadenceStage builder() { + return new Builder(); + } + + public interface ResetCadenceStage { + ResetStartStage resetCadence(@NotNull CreditGrantExpiryRequestBodyResetCadence resetCadence); + + Builder from(CreditGrantExpiryRequestBody other); + } + + public interface ResetStartStage { + _FinalStage resetStart(@NotNull CreditGrantExpiryRequestBodyResetStart resetStart); + } + + public interface _FinalStage { + CreditGrantExpiryRequestBody build(); + + _FinalStage expiryType(Optional expiryType); + + _FinalStage expiryType(CreditGrantExpiryRequestBodyExpiryType expiryType); + + _FinalStage expiryUnit(Optional expiryUnit); + + _FinalStage expiryUnit(CreditGrantExpiryRequestBodyExpiryUnit expiryUnit); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Integer expiryUnitCount); + + _FinalStage resetType(Optional resetType); + + _FinalStage resetType(CreditGrantExpiryRequestBodyResetType resetType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResetCadenceStage, ResetStartStage, _FinalStage { + private CreditGrantExpiryRequestBodyResetCadence resetCadence; + + private CreditGrantExpiryRequestBodyResetStart resetStart; + + private Optional resetType = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); + + private Optional expiryUnit = Optional.empty(); + + private Optional expiryType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditGrantExpiryRequestBody other) { + expiryType(other.getExpiryType()); + expiryUnit(other.getExpiryUnit()); + expiryUnitCount(other.getExpiryUnitCount()); + resetCadence(other.getResetCadence()); + resetStart(other.getResetStart()); + resetType(other.getResetType()); + return this; + } + + @java.lang.Override + @JsonSetter("reset_cadence") + public ResetStartStage resetCadence(@NotNull CreditGrantExpiryRequestBodyResetCadence resetCadence) { + this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reset_start") + public _FinalStage resetStart(@NotNull CreditGrantExpiryRequestBodyResetStart resetStart) { + this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage resetType(CreditGrantExpiryRequestBodyResetType resetType) { + this.resetType = Optional.ofNullable(resetType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) + public _FinalStage resetType(Optional resetType) { + this.resetType = resetType; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + this.expiryUnitCount = expiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnit(CreditGrantExpiryRequestBodyExpiryUnit expiryUnit) { + this.expiryUnit = Optional.ofNullable(expiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) + public _FinalStage expiryUnit(Optional expiryUnit) { + this.expiryUnit = expiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage expiryType(CreditGrantExpiryRequestBodyExpiryType expiryType) { + this.expiryType = Optional.ofNullable(expiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) + public _FinalStage expiryType(Optional expiryType) { + this.expiryType = expiryType; + return this; + } + + @java.lang.Override + public CreditGrantExpiryRequestBody build() { + return new CreditGrantExpiryRequestBody( + expiryType, expiryUnit, expiryUnitCount, resetCadence, resetStart, resetType, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryType.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryType.java new file mode 100644 index 0000000..7499c3b --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryType.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreditGrantExpiryRequestBodyExpiryType { + public static final CreditGrantExpiryRequestBodyExpiryType END_OF_BILLING_PERIOD = + new CreditGrantExpiryRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); + + public static final CreditGrantExpiryRequestBodyExpiryType DURATION = + new CreditGrantExpiryRequestBodyExpiryType(Value.DURATION, "duration"); + + public static final CreditGrantExpiryRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = + new CreditGrantExpiryRequestBodyExpiryType(Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); + + public static final CreditGrantExpiryRequestBodyExpiryType NO_EXPIRY = + new CreditGrantExpiryRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); + + public static final CreditGrantExpiryRequestBodyExpiryType END_OF_TRIAL = + new CreditGrantExpiryRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); + + private final Value value; + + private final String string; + + CreditGrantExpiryRequestBodyExpiryType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreditGrantExpiryRequestBodyExpiryType + && this.string.equals(((CreditGrantExpiryRequestBodyExpiryType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case END_OF_BILLING_PERIOD: + return visitor.visitEndOfBillingPeriod(); + case DURATION: + return visitor.visitDuration(); + case END_OF_NEXT_BILLING_PERIOD: + return visitor.visitEndOfNextBillingPeriod(); + case NO_EXPIRY: + return visitor.visitNoExpiry(); + case END_OF_TRIAL: + return visitor.visitEndOfTrial(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditGrantExpiryRequestBodyExpiryType valueOf(String value) { + switch (value) { + case "end_of_billing_period": + return END_OF_BILLING_PERIOD; + case "duration": + return DURATION; + case "end_of_next_billing_period": + return END_OF_NEXT_BILLING_PERIOD; + case "no_expiry": + return NO_EXPIRY; + case "end_of_trial": + return END_OF_TRIAL; + default: + return new CreditGrantExpiryRequestBodyExpiryType(Value.UNKNOWN, value); + } + } + + public enum Value { + DURATION, + + NO_EXPIRY, + + END_OF_TRIAL, + + END_OF_BILLING_PERIOD, + + END_OF_NEXT_BILLING_PERIOD, + + UNKNOWN + } + + public interface Visitor { + T visitDuration(); + + T visitNoExpiry(); + + T visitEndOfTrial(); + + T visitEndOfBillingPeriod(); + + T visitEndOfNextBillingPeriod(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryUnit.java new file mode 100644 index 0000000..f76a711 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryUnit.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreditGrantExpiryRequestBodyExpiryUnit { + public static final CreditGrantExpiryRequestBodyExpiryUnit BILLING_PERIODS = + new CreditGrantExpiryRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); + + public static final CreditGrantExpiryRequestBodyExpiryUnit DAYS = + new CreditGrantExpiryRequestBodyExpiryUnit(Value.DAYS, "days"); + + private final Value value; + + private final String string; + + CreditGrantExpiryRequestBodyExpiryUnit(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreditGrantExpiryRequestBodyExpiryUnit + && this.string.equals(((CreditGrantExpiryRequestBodyExpiryUnit) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BILLING_PERIODS: + return visitor.visitBillingPeriods(); + case DAYS: + return visitor.visitDays(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditGrantExpiryRequestBodyExpiryUnit valueOf(String value) { + switch (value) { + case "billing_periods": + return BILLING_PERIODS; + case "days": + return DAYS; + default: + return new CreditGrantExpiryRequestBodyExpiryUnit(Value.UNKNOWN, value); + } + } + + public enum Value { + DAYS, + + BILLING_PERIODS, + + UNKNOWN + } + + public interface Visitor { + T visitDays(); + + T visitBillingPeriods(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetCadence.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetCadence.java new file mode 100644 index 0000000..f3d9c89 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetCadence.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreditGrantExpiryRequestBodyResetCadence { + public static final CreditGrantExpiryRequestBodyResetCadence YEARLY = + new CreditGrantExpiryRequestBodyResetCadence(Value.YEARLY, "yearly"); + + public static final CreditGrantExpiryRequestBodyResetCadence MONTHLY = + new CreditGrantExpiryRequestBodyResetCadence(Value.MONTHLY, "monthly"); + + public static final CreditGrantExpiryRequestBodyResetCadence DAILY = + new CreditGrantExpiryRequestBodyResetCadence(Value.DAILY, "daily"); + + public static final CreditGrantExpiryRequestBodyResetCadence WEEKLY = + new CreditGrantExpiryRequestBodyResetCadence(Value.WEEKLY, "weekly"); + + private final Value value; + + private final String string; + + CreditGrantExpiryRequestBodyResetCadence(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreditGrantExpiryRequestBodyResetCadence + && this.string.equals(((CreditGrantExpiryRequestBodyResetCadence) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case YEARLY: + return visitor.visitYearly(); + case MONTHLY: + return visitor.visitMonthly(); + case DAILY: + return visitor.visitDaily(); + case WEEKLY: + return visitor.visitWeekly(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditGrantExpiryRequestBodyResetCadence valueOf(String value) { + switch (value) { + case "yearly": + return YEARLY; + case "monthly": + return MONTHLY; + case "daily": + return DAILY; + case "weekly": + return WEEKLY; + default: + return new CreditGrantExpiryRequestBodyResetCadence(Value.UNKNOWN, value); + } + } + + public enum Value { + MONTHLY, + + YEARLY, + + DAILY, + + WEEKLY, + + UNKNOWN + } + + public interface Visitor { + T visitMonthly(); + + T visitYearly(); + + T visitDaily(); + + T visitWeekly(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetStart.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetStart.java new file mode 100644 index 0000000..57c29dd --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetStart.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreditGrantExpiryRequestBodyResetStart { + public static final CreditGrantExpiryRequestBodyResetStart FIRST_OF_MONTH = + new CreditGrantExpiryRequestBodyResetStart(Value.FIRST_OF_MONTH, "first_of_month"); + + public static final CreditGrantExpiryRequestBodyResetStart BILLING_PERIOD = + new CreditGrantExpiryRequestBodyResetStart(Value.BILLING_PERIOD, "billing_period"); + + private final Value value; + + private final String string; + + CreditGrantExpiryRequestBodyResetStart(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreditGrantExpiryRequestBodyResetStart + && this.string.equals(((CreditGrantExpiryRequestBodyResetStart) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_OF_MONTH: + return visitor.visitFirstOfMonth(); + case BILLING_PERIOD: + return visitor.visitBillingPeriod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditGrantExpiryRequestBodyResetStart valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_period": + return BILLING_PERIOD; + default: + return new CreditGrantExpiryRequestBodyResetStart(Value.UNKNOWN, value); + } + } + + public enum Value { + BILLING_PERIOD, + + FIRST_OF_MONTH, + + UNKNOWN + } + + public interface Visitor { + T visitBillingPeriod(); + + T visitFirstOfMonth(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetType.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetType.java new file mode 100644 index 0000000..fed0b4d --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreditGrantExpiryRequestBodyResetType { + public static final CreditGrantExpiryRequestBodyResetType NO_RESET = + new CreditGrantExpiryRequestBodyResetType(Value.NO_RESET, "no_reset"); + + public static final CreditGrantExpiryRequestBodyResetType PLAN_PERIOD = + new CreditGrantExpiryRequestBodyResetType(Value.PLAN_PERIOD, "plan_period"); + + private final Value value; + + private final String string; + + CreditGrantExpiryRequestBodyResetType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CreditGrantExpiryRequestBodyResetType + && this.string.equals(((CreditGrantExpiryRequestBodyResetType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NO_RESET: + return visitor.visitNoReset(); + case PLAN_PERIOD: + return visitor.visitPlanPeriod(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditGrantExpiryRequestBodyResetType valueOf(String value) { + switch (value) { + case "no_reset": + return NO_RESET; + case "plan_period": + return PLAN_PERIOD; + default: + return new CreditGrantExpiryRequestBodyResetType(Value.UNKNOWN, value); + } + } + + public enum Value { + PLAN_PERIOD, + + NO_RESET, + + UNKNOWN + } + + public interface Visitor { + T visitPlanPeriod(); + + T visitNoReset(); + + T visitUnknown(String unknownType); + } +}