From 12231b3f2fc6d5cfdf8a81ee8ec4f1e41101cbc0 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 8 Jun 2026 15:21:03 +0000 Subject: [PATCH] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.9.0 --- .fern/metadata.json | 8 +- build.gradle | 4 +- reference.md | 291 ++++++++++++- .../com/schematic/api/core/ClientOptions.java | 4 +- .../resources/accounts/AccountsClient.java | 19 + .../accounts/AsyncAccountsClient.java | 19 + .../accounts/AsyncRawAccountsClient.java | 111 +++++ .../resources/accounts/RawAccountsClient.java | 86 ++++ .../requests/CountAccountMembersRequest.java | 201 +++++++++ .../types/CountAccountMembersParams.java | 195 +++++++++ .../types/CountAccountMembersResponse.java | 153 +++++++ .../AsyncIntegrationsapiClient.java | 42 +- .../AsyncRawIntegrationsapiClient.java | 297 ++++++++++++- .../IntegrationsapiClient.java | 40 +- .../RawIntegrationsapiClient.java | 222 +++++++++- .../types/AssumeStripeInstalledResponse.java | 183 ++++++++ .../types/InstallIntegrationResponse.java | 183 ++++++++ .../types/InstallStripeResponse.java | 183 ++++++++ ...se.java => LoadSampleDataSetResponse.java} | 20 +- .../requests/CreatePlanGroupRequestBody.java | 33 ++ .../requests/UpdatePlanGroupRequestBody.java | 33 ++ .../api/types/AccountMemberResponseData.java | 74 +++- .../api/types/BillingCreditGrantReason.java | 10 + .../types/BillingCreditGrantResponseData.java | 109 +++++ .../types/BillingCreditLedgerAuthority.java | 97 +++++ .../api/types/BillingCreditView.java | 31 +- .../BillingPlanCreditGrantResponseData.java | 42 +- .../api/types/BillingProviderType.java | 10 + ...ChangeSubscriptionInternalRequestBody.java | 45 ++ .../types/ChangeSubscriptionRequestBody.java | 45 ++ .../api/types/CheckoutDataResponseData.java | 36 ++ .../api/types/CheckoutFieldInput.java | 262 ++++++++++++ .../api/types/CheckoutFieldResponseData.java | 396 ++++++++++++++++++ .../api/types/CheckoutFieldValue.java | 140 +++++++ .../api/types/CheckoutFieldWithValue.java | 287 +++++++++++++ .../CompanyCreditBalanceResponseData.java | 60 ++- .../api/types/CompanyPlanCreditGrantView.java | 31 +- .../types/ComponentHydrateResponseData.java | 45 ++ .../types/ComponentPreviewResponseData.java | 45 ++ ...eateBillingPlanCreditGrantRequestBody.java | 49 ++- .../api/types/CreditCompanyGrantView.java | 96 +++++ .../types/CreditEventLedgerResponseData.java | 32 ++ .../api/types/CreditUsageReason.java | 115 +++++ .../api/types/EventDetailResponseData.java | 32 ++ .../api/types/EventResponseData.java | 32 ++ .../types/InstallIntegrationRequestBody.java | 286 +++++++++++++ .../api/types/IntegrationConfig.java | 58 +++ .../api/types/IntegrationInstallConfig.java | 386 +++++++++++++++++ .../types/IntegrationInstallResponseData.java | 168 ++++++++ .../schematic/api/types/IntegrationType.java | 10 + .../api/types/ManagePlanRequest.java | 45 ++ .../api/types/MetronomeIntegrationConfig.java | 69 +++ .../api/types/MigrationErrorCode.java | 11 + .../api/types/PlanCreditGrantView.java | 31 +- .../types/PlanGroupDetailResponseData.java | 45 ++ ...dateBillingPlanCreditGrantRequestBody.java | 49 ++- 56 files changed, 5534 insertions(+), 72 deletions(-) create mode 100644 src/main/java/com/schematic/api/resources/accounts/requests/CountAccountMembersRequest.java create mode 100644 src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersParams.java create mode 100644 src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersResponse.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/types/AssumeStripeInstalledResponse.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/types/InstallIntegrationResponse.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/types/InstallStripeResponse.java rename src/main/java/com/schematic/api/resources/integrationsapi/types/{LoadSampleDataSetV2Response.java => LoadSampleDataSetResponse.java} (88%) create mode 100644 src/main/java/com/schematic/api/types/BillingCreditLedgerAuthority.java create mode 100644 src/main/java/com/schematic/api/types/CheckoutFieldInput.java create mode 100644 src/main/java/com/schematic/api/types/CheckoutFieldResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CheckoutFieldValue.java create mode 100644 src/main/java/com/schematic/api/types/CheckoutFieldWithValue.java create mode 100644 src/main/java/com/schematic/api/types/CreditUsageReason.java create mode 100644 src/main/java/com/schematic/api/types/InstallIntegrationRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/IntegrationInstallConfig.java create mode 100644 src/main/java/com/schematic/api/types/IntegrationInstallResponseData.java create mode 100644 src/main/java/com/schematic/api/types/MetronomeIntegrationConfig.java diff --git a/.fern/metadata.json b/.fern/metadata.json index da30af9..309b806 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.6.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.8.11", + "generatorVersion": "4.9.0", "generatorConfig": { "client-class-name": "BaseSchematic", "generate-unknown-as-json-node": true, @@ -14,10 +14,10 @@ "implementation redis.clients:jedis:5.2.0" ] }, - "originGitCommit": "a3057c10aa6a1daa708dc714c89ce943f67a722a", + "originGitCommit": "a5724e8dfeba2338da634f270044ac597694f772", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.4.1", + "requestedVersion": "1.4.2", "ciProvider": "github", - "sdkVersion": "1.4.1" + "sdkVersion": "1.4.2" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6162f37..8cca5aa 100644 --- a/build.gradle +++ b/build.gradle @@ -52,7 +52,7 @@ java { group = 'com.schematichq' -version = '1.4.1' +version = '1.4.2' jar { dependsOn(":generatePomFileForMavenPublication") @@ -83,7 +83,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.4.1' + version = '1.4.2' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index fe12d17..7b267d5 100644 --- a/reference.md +++ b/reference.md @@ -110,6 +110,80 @@ client.accounts().getAccountMember("account_member_id"); + + + + +
client.accounts.countAccountMembers() -> CountAccountMembersResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().countAccountMembers( + CountAccountMembersRequest + .builder() + .ids( + Arrays.asList("ids") + ) + .q("q") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**ids:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` — Search filter + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ +
@@ -1325,7 +1399,7 @@ client.billing().listCustomersWithSubscriptions( Arrays.asList("company_ids") ) .name("name") - .providerType(BillingProviderType.ORB) + .providerType(BillingProviderType.METRONOME) .q("q") .limit(1000000L) .offset(1000000L) @@ -1417,7 +1491,7 @@ client.billing().countCustomers( Arrays.asList("company_ids") ) .name("name") - .providerType(BillingProviderType.ORB) + .providerType(BillingProviderType.METRONOME) .q("q") .limit(1000000L) .offset(1000000L) @@ -2136,7 +2210,7 @@ client.billing().listBillingPrices( .isActive(true) .price(1000000L) .productId("product_id") - .providerType(BillingProviderType.ORB) + .providerType(BillingProviderType.METRONOME) .q("q") .tiersMode(BillingTiersMode.GRADUATED) .usageType(BillingPriceUsageType.LICENSED) @@ -2549,7 +2623,7 @@ client.billing().listBillingProductPrices( .isActive(true) .price(1000000L) .productId("product_id") - .providerType(BillingProviderType.ORB) + .providerType(BillingProviderType.METRONOME) .q("q") .tiersMode(BillingTiersMode.GRADUATED) .usageType(BillingPriceUsageType.LICENSED) @@ -2844,7 +2918,7 @@ client.billing().listBillingProducts( .isActive(true) .name("name") .priceUsageType(BillingPriceUsageType.LICENSED) - .providerType(BillingProviderType.ORB) + .providerType(BillingProviderType.METRONOME) .q("q") .recurringChargesOnly(true) .withOneTimeCharges(true) @@ -2999,7 +3073,7 @@ client.billing().countBillingProducts( .isActive(true) .name("name") .priceUsageType(BillingPriceUsageType.LICENSED) - .providerType(BillingProviderType.ORB) + .providerType(BillingProviderType.METRONOME) .q("q") .recurringChargesOnly(true) .withOneTimeCharges(true) @@ -6028,6 +6102,15 @@ client.checkout().internal( .build() ) ) + .customFieldValues( + Arrays.asList( + CheckoutFieldValue + .builder() + .id("id") + .value("value") + .build() + ) + ) .payInAdvance( Arrays.asList( UpdatePayInAdvanceRequestBody @@ -6164,6 +6247,15 @@ client.checkout().previewCheckoutInternal( .build() ) ) + .customFieldValues( + Arrays.asList( + CheckoutFieldValue + .builder() + .id("id") + .value("value") + .build() + ) + ) .payInAdvance( Arrays.asList( UpdatePayInAdvanceRequestBody @@ -6235,6 +6327,15 @@ client.checkout().managePlan( .build() ) ) + .customFieldValues( + Arrays.asList( + CheckoutFieldValue + .builder() + .id("id") + .value("value") + .build() + ) + ) .payInAdvanceEntitlements( Arrays.asList( UpdatePayInAdvanceRequestBody @@ -6306,6 +6407,15 @@ client.checkout().previewManagePlan( .build() ) ) + .customFieldValues( + Arrays.asList( + CheckoutFieldValue + .builder() + .id("id") + .value("value") + .build() + ) + ) .payInAdvanceEntitlements( Arrays.asList( UpdatePayInAdvanceRequestBody @@ -9845,7 +9955,7 @@ client.entitlements().listFeatureUsage( ) .companyId("company_id") .includeUsageAggregation(true) - .managedBy(BillingProviderType.ORB) + .managedBy(BillingProviderType.METRONOME) .q("q") .withoutNegativeEntitlements(true) .limit(1000000L) @@ -10044,7 +10154,7 @@ client.entitlements().countFeatureUsage( ) .companyId("company_id") .includeUsageAggregation(true) - .managedBy(BillingProviderType.ORB) + .managedBy(BillingProviderType.METRONOME) .q("q") .withoutNegativeEntitlements(true) .limit(1000000L) @@ -11113,7 +11223,7 @@ client.entitlements().deletePlanEntitlement("plan_entitlement_id"); client.entitlements().upsertPlanEntitlementForBillingProduct( CreateBillingLinkedPlanEntitlementRequestBody .builder() - .billingProvider(BillingProviderType.ORB) + .billingProvider(BillingProviderType.METRONOME) .externalResourceId("external_resource_id") .featureId("feature_id") .planId("plan_id") @@ -12497,7 +12607,7 @@ client.plans().upsertBillingProductPlan( client.plans().upsertPlanForBillingProduct( CreateBillingLinkedPlanRequestBody .builder() - .billingProvider(BillingProviderType.ORB) + .billingProvider(BillingProviderType.METRONOME) .description("description") .externalResourceId("external_resource_id") .name("name") @@ -14256,7 +14366,7 @@ client.features().listFeatures( Arrays.asList("ids") ) .booleanRequireEvent(true) - .managedBy(BillingProviderType.ORB) + .managedBy(BillingProviderType.METRONOME) .planVersionId("plan_version_id") .q("q") .withoutCompanyOverrideFor("without_company_override_for") @@ -14719,7 +14829,7 @@ client.features().deleteFeature("feature_id"); client.features().upsertFeatureForBillingProduct( CreateBillingLinkedFeatureRequestBody .builder() - .billingProvider(BillingProviderType.ORB) + .billingProvider(BillingProviderType.METRONOME) .description("description") .externalResourceId("external_resource_id") .featureType(FeatureType.BOOLEAN) @@ -14871,7 +14981,7 @@ client.features().countFeatures( Arrays.asList("ids") ) .booleanRequireEvent(true) - .managedBy(BillingProviderType.ORB) + .managedBy(BillingProviderType.METRONOME) .planVersionId("plan_version_id") .q("q") .withoutCompanyOverrideFor("without_company_override_for") @@ -16074,6 +16184,51 @@ client.integrationsapi().getIntegrationWebhookUrl("type"); + + + + +
client.integrationsapi.installIntegration(request) -> InstallIntegrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.integrationsapi().installIntegration( + InstallIntegrationRequestBody + .builder() + .type(IntegrationType.CLERK) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `InstallIntegrationRequestBody` + +
+
+
+
+ +
@@ -16139,7 +16294,77 @@ client.integrationsapi().startDataImport( -
client.integrationsapi.loadSampleDataSetV2() -> LoadSampleDataSetV2Response +
client.integrationsapi.loadSampleDataSet() -> LoadSampleDataSetResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.integrationsapi().loadSampleDataSet(); +``` +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.assumeStripeInstalled(request) -> AssumeStripeInstalledResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.integrationsapi().assumeStripeInstalled( + InstallIntegrationRequestBody + .builder() + .type(IntegrationType.CLERK) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `InstallIntegrationRequestBody` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.installStripe(request) -> InstallStripeResponse
@@ -16152,13 +16377,33 @@ client.integrationsapi().startDataImport(
```java -client.integrationsapi().loadSampleDataSetV2(); +client.integrationsapi().installStripe( + InstallIntegrationRequestBody + .builder() + .type(IntegrationType.CLERK) + .build() +); ```
+#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `InstallIntegrationRequestBody` + +
+
+
+
+ @@ -16363,6 +16608,14 @@ client.plangroups().createPlanGroup(
+**customCheckoutFields:** `Optional>` + +
+
+ +
+
+ **customPlanConfig:** `Optional`
@@ -16705,6 +16958,14 @@ client.plangroups().updatePlanGroup(
+**customCheckoutFields:** `Optional>` + +
+
+ +
+
+ **customPlanConfig:** `Optional`
diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index 8a4dc65..0b2f698 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.4.1"); + put("User-Agent", "com.schematichq:schematic-java/1.4.2"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.4.1"); + put("X-Fern-SDK-Version", "1.4.2"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java index 9ecf136..3719aa9 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.accounts.requests.CountAccountMembersRequest; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountAuditLogsRequest; import com.schematic.api.resources.accounts.requests.CreateApiKeyRequestBody; @@ -15,6 +16,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; @@ -76,6 +78,23 @@ public GetAccountMemberResponse getAccountMember(String accountMemberId, Request return this.rawClient.getAccountMember(accountMemberId, requestOptions).body(); } + public CountAccountMembersResponse countAccountMembers() { + return this.rawClient.countAccountMembers().body(); + } + + public CountAccountMembersResponse countAccountMembers(RequestOptions requestOptions) { + return this.rawClient.countAccountMembers(requestOptions).body(); + } + + public CountAccountMembersResponse countAccountMembers(CountAccountMembersRequest request) { + return this.rawClient.countAccountMembers(request).body(); + } + + public CountAccountMembersResponse countAccountMembers( + CountAccountMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.countAccountMembers(request, requestOptions).body(); + } + public ListApiKeysResponse listApiKeys(ListApiKeysRequest request) { return this.rawClient.listApiKeys(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java index d37bb0c..3a5326b 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.accounts.requests.CountAccountMembersRequest; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountAuditLogsRequest; import com.schematic.api.resources.accounts.requests.CreateApiKeyRequestBody; @@ -15,6 +16,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; @@ -78,6 +80,23 @@ public CompletableFuture getAccountMember( return this.rawClient.getAccountMember(accountMemberId, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture countAccountMembers() { + return this.rawClient.countAccountMembers().thenApply(response -> response.body()); + } + + public CompletableFuture countAccountMembers(RequestOptions requestOptions) { + return this.rawClient.countAccountMembers(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countAccountMembers(CountAccountMembersRequest request) { + return this.rawClient.countAccountMembers(request).thenApply(response -> response.body()); + } + + public CompletableFuture countAccountMembers( + CountAccountMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.countAccountMembers(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listApiKeys(ListApiKeysRequest request) { return this.rawClient.listApiKeys(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java index 24bbb7c..74be6fe 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java @@ -17,6 +17,7 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.accounts.requests.CountAccountMembersRequest; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountAuditLogsRequest; import com.schematic.api.resources.accounts.requests.CreateApiKeyRequestBody; @@ -27,6 +28,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; @@ -256,6 +258,115 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> countAccountMembers() { + return countAccountMembers(CountAccountMembersRequest.builder().build()); + } + + public CompletableFuture> countAccountMembers( + RequestOptions requestOptions) { + return countAccountMembers(CountAccountMembersRequest.builder().build(), requestOptions); + } + + public CompletableFuture> countAccountMembers( + CountAccountMembersRequest request) { + return countAccountMembers(request, null); + } + + public CompletableFuture> countAccountMembers( + CountAccountMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account-members/count"); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CountAccountMembersResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (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> listApiKeys(ListApiKeysRequest request) { return listApiKeys(request, null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java index 0569770..f231db6 100644 --- a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java @@ -17,6 +17,7 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.accounts.requests.CountAccountMembersRequest; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountAuditLogsRequest; import com.schematic.api.resources.accounts.requests.CreateApiKeyRequestBody; @@ -27,6 +28,7 @@ import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; +import com.schematic.api.resources.accounts.types.CountAccountMembersResponse; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; @@ -204,6 +206,90 @@ public BaseSchematicHttpResponse getAccountMember( } } + public BaseSchematicHttpResponse countAccountMembers() { + return countAccountMembers(CountAccountMembersRequest.builder().build()); + } + + public BaseSchematicHttpResponse countAccountMembers(RequestOptions requestOptions) { + return countAccountMembers(CountAccountMembersRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse countAccountMembers( + CountAccountMembersRequest request) { + return countAccountMembers(request, null); + } + + public BaseSchematicHttpResponse countAccountMembers( + CountAccountMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account-members/count"); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountAccountMembersResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse listApiKeys(ListApiKeysRequest request) { return listApiKeys(request, null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CountAccountMembersRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/CountAccountMembersRequest.java new file mode 100644 index 0000000..7b8a621 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CountAccountMembersRequest.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.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.Collections; +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 = CountAccountMembersRequest.Builder.class) +public final class CountAccountMembersRequest { + private final Optional> ids; + + private final Optional q; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private CountAccountMembersRequest( + Optional> ids, + Optional q, + Optional limit, + Optional offset, + Map additionalProperties) { + this.ids = ids; + this.q = q; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + /** + * @return Search filter + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountAccountMembersRequest && equalTo((CountAccountMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountAccountMembersRequest other) { + return ids.equals(other.ids) && q.equals(other.q) && limit.equals(other.limit) && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ids, this.q, this.limit, this.offset); + } + + @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> ids = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountAccountMembersRequest other) { + ids(other.getIds()); + q(other.getQ()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @JsonSetter(value = "ids", nulls = Nulls.SKIP) + public Builder ids(Optional> ids) { + this.ids = ids; + return this; + } + + public Builder ids(List ids) { + this.ids = Optional.ofNullable(ids); + return this; + } + + public Builder ids(String ids) { + this.ids = Optional.of(Collections.singletonList(ids)); + return this; + } + + /** + *

Search filter

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

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public CountAccountMembersRequest build() { + return new CountAccountMembersRequest(ids, q, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersParams.java b/src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersParams.java new file mode 100644 index 0000000..4981fc5 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersParams.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountAccountMembersParams.Builder.class) +public final class CountAccountMembersParams { + private final Optional> ids; + + private final Optional limit; + + private final Optional offset; + + private final Optional q; + + private final Map additionalProperties; + + private CountAccountMembersParams( + Optional> ids, + Optional limit, + Optional offset, + Optional q, + Map additionalProperties) { + this.ids = ids; + this.limit = limit; + this.offset = offset; + this.q = q; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return Search filter + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountAccountMembersParams && equalTo((CountAccountMembersParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountAccountMembersParams other) { + return ids.equals(other.ids) && limit.equals(other.limit) && offset.equals(other.offset) && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ids, this.limit, this.offset, this.q); + } + + @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> ids = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountAccountMembersParams other) { + ids(other.getIds()); + limit(other.getLimit()); + offset(other.getOffset()); + q(other.getQ()); + return this; + } + + @JsonSetter(value = "ids", nulls = Nulls.SKIP) + public Builder ids(Optional> ids) { + this.ids = ids; + return this; + } + + public Builder ids(List ids) { + this.ids = Optional.ofNullable(ids); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

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

Search filter

+ */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + public CountAccountMembersParams build() { + return new CountAccountMembersParams(ids, limit, offset, q, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersResponse.java new file mode 100644 index 0000000..049c8f9 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountAccountMembersResponse.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CountResponse; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountAccountMembersResponse.Builder.class) +public final class CountAccountMembersResponse { + private final CountResponse data; + + private final CountAccountMembersParams params; + + private final Map additionalProperties; + + private CountAccountMembersResponse( + CountResponse data, CountAccountMembersParams params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public CountResponse getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public CountAccountMembersParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountAccountMembersResponse && equalTo((CountAccountMembersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountAccountMembersResponse 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 { + ParamsStage data(@NotNull CountResponse data); + + Builder from(CountAccountMembersResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull CountAccountMembersParams params); + } + + public interface _FinalStage { + CountAccountMembersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private CountResponse data; + + private CountAccountMembersParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountAccountMembersResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public ParamsStage data(@NotNull CountResponse data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

Input parameters

+ *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull CountAccountMembersParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public CountAccountMembersResponse build() { + return new CountAccountMembersResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java index e487cd7..a92b682 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java @@ -7,12 +7,16 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.integrationsapi.requests.ListIntegrationsRequest; import com.schematic.api.resources.integrationsapi.requests.StartDataImportRequestBody; +import com.schematic.api.resources.integrationsapi.types.AssumeStripeInstalledResponse; import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import com.schematic.api.resources.integrationsapi.types.InstallIntegrationResponse; +import com.schematic.api.resources.integrationsapi.types.InstallStripeResponse; import com.schematic.api.resources.integrationsapi.types.ListIntegrationsResponse; -import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetV2Response; +import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetResponse; import com.schematic.api.resources.integrationsapi.types.RunIntegrationResponse; import com.schematic.api.resources.integrationsapi.types.StartDataImportResponse; import com.schematic.api.resources.integrationsapi.types.UninstallIntegrationResponse; +import com.schematic.api.types.InstallIntegrationRequestBody; import java.util.concurrent.CompletableFuture; public class AsyncIntegrationsapiClient { @@ -67,6 +71,15 @@ public CompletableFuture getIntegrationWebhook return this.rawClient.getIntegrationWebhookUrl(type, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture installIntegration(InstallIntegrationRequestBody request) { + return this.rawClient.installIntegration(request).thenApply(response -> response.body()); + } + + public CompletableFuture installIntegration( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient.installIntegration(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture startDataImport(StartDataImportRequestBody request) { return this.rawClient.startDataImport(request).thenApply(response -> response.body()); } @@ -76,12 +89,31 @@ public CompletableFuture startDataImport( return this.rawClient.startDataImport(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture loadSampleDataSetV2() { - return this.rawClient.loadSampleDataSetV2().thenApply(response -> response.body()); + public CompletableFuture loadSampleDataSet() { + return this.rawClient.loadSampleDataSet().thenApply(response -> response.body()); + } + + public CompletableFuture loadSampleDataSet(RequestOptions requestOptions) { + return this.rawClient.loadSampleDataSet(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture assumeStripeInstalled( + InstallIntegrationRequestBody request) { + return this.rawClient.assumeStripeInstalled(request).thenApply(response -> response.body()); + } + + public CompletableFuture assumeStripeInstalled( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient.assumeStripeInstalled(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture installStripe(InstallIntegrationRequestBody request) { + return this.rawClient.installStripe(request).thenApply(response -> response.body()); } - public CompletableFuture loadSampleDataSetV2(RequestOptions requestOptions) { - return this.rawClient.loadSampleDataSetV2(requestOptions).thenApply(response -> response.body()); + public CompletableFuture installStripe( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient.installStripe(request, requestOptions).thenApply(response -> response.body()); } public CompletableFuture uninstallIntegration(String integrationId) { diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java index 4c7999b..52cfc62 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java @@ -19,13 +19,17 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.integrationsapi.requests.ListIntegrationsRequest; import com.schematic.api.resources.integrationsapi.requests.StartDataImportRequestBody; +import com.schematic.api.resources.integrationsapi.types.AssumeStripeInstalledResponse; import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import com.schematic.api.resources.integrationsapi.types.InstallIntegrationResponse; +import com.schematic.api.resources.integrationsapi.types.InstallStripeResponse; import com.schematic.api.resources.integrationsapi.types.ListIntegrationsResponse; -import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetV2Response; +import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetResponse; import com.schematic.api.resources.integrationsapi.types.RunIntegrationResponse; import com.schematic.api.resources.integrationsapi.types.StartDataImportResponse; import com.schematic.api.resources.integrationsapi.types.UninstallIntegrationResponse; import com.schematic.api.types.ApiError; +import com.schematic.api.types.InstallIntegrationRequestBody; import java.io.IOException; import java.util.concurrent.CompletableFuture; import okhttp3.Call; @@ -331,6 +335,100 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> installIntegration( + InstallIntegrationRequestBody request) { + return installIntegration(request, null); + } + + public CompletableFuture> installIntegration( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations/install"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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.build()) + .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()) { + 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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, InstallIntegrationResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (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> startDataImport( StartDataImportRequestBody request) { return startDataImport(request, null); @@ -424,11 +522,11 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> loadSampleDataSetV2() { - return loadSampleDataSetV2(null); + public CompletableFuture> loadSampleDataSet() { + return loadSampleDataSet(null); } - public CompletableFuture> loadSampleDataSetV2( + public CompletableFuture> loadSampleDataSet( RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -448,7 +546,7 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -457,7 +555,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, LoadSampleDataSetV2Response.class), + responseBodyString, LoadSampleDataSetResponse.class), response)); return; } @@ -504,6 +602,193 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> assumeStripeInstalled( + InstallIntegrationRequestBody request) { + return assumeStripeInstalled(request, null); + } + + public CompletableFuture> assumeStripeInstalled( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations/stripe/v2/assume-installed"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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.build()) + .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()) { + 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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, AssumeStripeInstalledResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (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> installStripe( + InstallIntegrationRequestBody request) { + return installStripe(request, null); + } + + public CompletableFuture> installStripe( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations/stripe/v2/install"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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.build()) + .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()) { + 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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, InstallStripeResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (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> uninstallIntegration( String integrationId) { return uninstallIntegration(integrationId, null); diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java index 7ce278e..8677ecb 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java @@ -7,12 +7,16 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.integrationsapi.requests.ListIntegrationsRequest; import com.schematic.api.resources.integrationsapi.requests.StartDataImportRequestBody; +import com.schematic.api.resources.integrationsapi.types.AssumeStripeInstalledResponse; import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import com.schematic.api.resources.integrationsapi.types.InstallIntegrationResponse; +import com.schematic.api.resources.integrationsapi.types.InstallStripeResponse; import com.schematic.api.resources.integrationsapi.types.ListIntegrationsResponse; -import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetV2Response; +import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetResponse; import com.schematic.api.resources.integrationsapi.types.RunIntegrationResponse; import com.schematic.api.resources.integrationsapi.types.StartDataImportResponse; import com.schematic.api.resources.integrationsapi.types.UninstallIntegrationResponse; +import com.schematic.api.types.InstallIntegrationRequestBody; public class IntegrationsapiClient { protected final ClientOptions clientOptions; @@ -63,6 +67,15 @@ public GetIntegrationWebhookUrlResponse getIntegrationWebhookUrl(String type, Re return this.rawClient.getIntegrationWebhookUrl(type, requestOptions).body(); } + public InstallIntegrationResponse installIntegration(InstallIntegrationRequestBody request) { + return this.rawClient.installIntegration(request).body(); + } + + public InstallIntegrationResponse installIntegration( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient.installIntegration(request, requestOptions).body(); + } + public StartDataImportResponse startDataImport(StartDataImportRequestBody request) { return this.rawClient.startDataImport(request).body(); } @@ -71,12 +84,29 @@ public StartDataImportResponse startDataImport(StartDataImportRequestBody reques return this.rawClient.startDataImport(request, requestOptions).body(); } - public LoadSampleDataSetV2Response loadSampleDataSetV2() { - return this.rawClient.loadSampleDataSetV2().body(); + public LoadSampleDataSetResponse loadSampleDataSet() { + return this.rawClient.loadSampleDataSet().body(); + } + + public LoadSampleDataSetResponse loadSampleDataSet(RequestOptions requestOptions) { + return this.rawClient.loadSampleDataSet(requestOptions).body(); + } + + public AssumeStripeInstalledResponse assumeStripeInstalled(InstallIntegrationRequestBody request) { + return this.rawClient.assumeStripeInstalled(request).body(); + } + + public AssumeStripeInstalledResponse assumeStripeInstalled( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient.assumeStripeInstalled(request, requestOptions).body(); + } + + public InstallStripeResponse installStripe(InstallIntegrationRequestBody request) { + return this.rawClient.installStripe(request).body(); } - public LoadSampleDataSetV2Response loadSampleDataSetV2(RequestOptions requestOptions) { - return this.rawClient.loadSampleDataSetV2(requestOptions).body(); + public InstallStripeResponse installStripe(InstallIntegrationRequestBody request, RequestOptions requestOptions) { + return this.rawClient.installStripe(request, requestOptions).body(); } public UninstallIntegrationResponse uninstallIntegration(String integrationId) { diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java index 90a6ba8..639ff28 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java @@ -19,13 +19,17 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.integrationsapi.requests.ListIntegrationsRequest; import com.schematic.api.resources.integrationsapi.requests.StartDataImportRequestBody; +import com.schematic.api.resources.integrationsapi.types.AssumeStripeInstalledResponse; import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import com.schematic.api.resources.integrationsapi.types.InstallIntegrationResponse; +import com.schematic.api.resources.integrationsapi.types.InstallStripeResponse; import com.schematic.api.resources.integrationsapi.types.ListIntegrationsResponse; -import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetV2Response; +import com.schematic.api.resources.integrationsapi.types.LoadSampleDataSetResponse; import com.schematic.api.resources.integrationsapi.types.RunIntegrationResponse; import com.schematic.api.resources.integrationsapi.types.StartDataImportResponse; import com.schematic.api.resources.integrationsapi.types.UninstallIntegrationResponse; import com.schematic.api.types.ApiError; +import com.schematic.api.types.InstallIntegrationRequestBody; import java.io.IOException; import okhttp3.Headers; import okhttp3.HttpUrl; @@ -257,6 +261,76 @@ public BaseSchematicHttpResponse getIntegratio } } + public BaseSchematicHttpResponse installIntegration( + InstallIntegrationRequestBody request) { + return installIntegration(request, null); + } + + public BaseSchematicHttpResponse installIntegration( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations/install"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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.build()) + .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()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, InstallIntegrationResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse startDataImport(StartDataImportRequestBody request) { return startDataImport(request, null); } @@ -326,11 +400,11 @@ public BaseSchematicHttpResponse startDataImport( } } - public BaseSchematicHttpResponse loadSampleDataSetV2() { - return loadSampleDataSetV2(null); + public BaseSchematicHttpResponse loadSampleDataSet() { + return loadSampleDataSet(null); } - public BaseSchematicHttpResponse loadSampleDataSetV2(RequestOptions requestOptions) { + public BaseSchematicHttpResponse loadSampleDataSet(RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("integrations/stripe/dataset-sample-v2"); @@ -354,11 +428,149 @@ public BaseSchematicHttpResponse loadSampleDataSetV String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LoadSampleDataSetV2Response.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LoadSampleDataSetResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse assumeStripeInstalled( + InstallIntegrationRequestBody request) { + return assumeStripeInstalled(request, null); + } + + public BaseSchematicHttpResponse assumeStripeInstalled( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations/stripe/v2/assume-installed"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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.build()) + .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()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AssumeStripeInstalledResponse.class), response); } try { switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse installStripe(InstallIntegrationRequestBody request) { + return installStripe(request, null); + } + + public BaseSchematicHttpResponse installStripe( + InstallIntegrationRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations/stripe/v2/install"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + 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.build()) + .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()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, InstallStripeResponse.class), response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); case 401: throw new UnauthorizedError( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/types/AssumeStripeInstalledResponse.java b/src/main/java/com/schematic/api/resources/integrationsapi/types/AssumeStripeInstalledResponse.java new file mode 100644 index 0000000..a5a53dc --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/types/AssumeStripeInstalledResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi.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.IntegrationInstallResponseData; +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 = AssumeStripeInstalledResponse.Builder.class) +public final class AssumeStripeInstalledResponse { + private final IntegrationInstallResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private AssumeStripeInstalledResponse( + IntegrationInstallResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public IntegrationInstallResponseData 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 AssumeStripeInstalledResponse && equalTo((AssumeStripeInstalledResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AssumeStripeInstalledResponse 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 IntegrationInstallResponseData data); + + Builder from(AssumeStripeInstalledResponse other); + } + + public interface _FinalStage { + AssumeStripeInstalledResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

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 IntegrationInstallResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AssumeStripeInstalledResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull IntegrationInstallResponseData 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 AssumeStripeInstalledResponse build() { + return new AssumeStripeInstalledResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/types/InstallIntegrationResponse.java b/src/main/java/com/schematic/api/resources/integrationsapi/types/InstallIntegrationResponse.java new file mode 100644 index 0000000..21afaa6 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/types/InstallIntegrationResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi.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.IntegrationInstallResponseData; +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 = InstallIntegrationResponse.Builder.class) +public final class InstallIntegrationResponse { + private final IntegrationInstallResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private InstallIntegrationResponse( + IntegrationInstallResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public IntegrationInstallResponseData 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 InstallIntegrationResponse && equalTo((InstallIntegrationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InstallIntegrationResponse 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 IntegrationInstallResponseData data); + + Builder from(InstallIntegrationResponse other); + } + + public interface _FinalStage { + InstallIntegrationResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

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 IntegrationInstallResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InstallIntegrationResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull IntegrationInstallResponseData 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 InstallIntegrationResponse build() { + return new InstallIntegrationResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/types/InstallStripeResponse.java b/src/main/java/com/schematic/api/resources/integrationsapi/types/InstallStripeResponse.java new file mode 100644 index 0000000..1f50746 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/types/InstallStripeResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi.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.IntegrationInstallResponseData; +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 = InstallStripeResponse.Builder.class) +public final class InstallStripeResponse { + private final IntegrationInstallResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private InstallStripeResponse( + IntegrationInstallResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public IntegrationInstallResponseData 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 InstallStripeResponse && equalTo((InstallStripeResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InstallStripeResponse 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 IntegrationInstallResponseData data); + + Builder from(InstallStripeResponse other); + } + + public interface _FinalStage { + InstallStripeResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

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 IntegrationInstallResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InstallStripeResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull IntegrationInstallResponseData 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 InstallStripeResponse build() { + return new InstallStripeResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.java b/src/main/java/com/schematic/api/resources/integrationsapi/types/LoadSampleDataSetResponse.java similarity index 88% rename from src/main/java/com/schematic/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.java rename to src/main/java/com/schematic/api/resources/integrationsapi/types/LoadSampleDataSetResponse.java index 7cae563..d1dd77a 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/types/LoadSampleDataSetResponse.java @@ -21,15 +21,15 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = LoadSampleDataSetV2Response.Builder.class) -public final class LoadSampleDataSetV2Response { +@JsonDeserialize(builder = LoadSampleDataSetResponse.Builder.class) +public final class LoadSampleDataSetResponse { private final IntegrationsDataSetResponseData data; private final Map params; private final Map additionalProperties; - private LoadSampleDataSetV2Response( + private LoadSampleDataSetResponse( IntegrationsDataSetResponseData data, Map params, Map additionalProperties) { @@ -54,7 +54,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof LoadSampleDataSetV2Response && equalTo((LoadSampleDataSetV2Response) other); + return other instanceof LoadSampleDataSetResponse && equalTo((LoadSampleDataSetResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(LoadSampleDataSetV2Response other) { + private boolean equalTo(LoadSampleDataSetResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -83,11 +83,11 @@ public static DataStage builder() { public interface DataStage { _FinalStage data(@NotNull IntegrationsDataSetResponseData data); - Builder from(LoadSampleDataSetV2Response other); + Builder from(LoadSampleDataSetResponse other); } public interface _FinalStage { - LoadSampleDataSetV2Response build(); + LoadSampleDataSetResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -115,7 +115,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(LoadSampleDataSetV2Response other) { + public Builder from(LoadSampleDataSetResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -164,8 +164,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public LoadSampleDataSetV2Response build() { - return new LoadSampleDataSetV2Response(data, params, additionalProperties); + public LoadSampleDataSetResponse build() { + return new LoadSampleDataSetResponse(data, params, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java index 9133aa2..1efe1fc 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CheckoutFieldInput; import com.schematic.api.types.CompatiblePlans; import com.schematic.api.types.CustomPlanConfig; import com.schematic.api.types.OrderedPlansInGroup; @@ -39,6 +40,8 @@ public final class CreatePlanGroupRequestBody { private final boolean checkoutCollectPhone; + private final Optional> customCheckoutFields; + private final Optional customPlanConfig; private final Optional customPlanId; @@ -101,6 +104,7 @@ private CreatePlanGroupRequestBody( boolean checkoutCollectAddress, boolean checkoutCollectEmail, boolean checkoutCollectPhone, + Optional> customCheckoutFields, Optional customPlanConfig, Optional customPlanId, boolean enableTaxCollection, @@ -134,6 +138,7 @@ private CreatePlanGroupRequestBody( this.checkoutCollectAddress = checkoutCollectAddress; this.checkoutCollectEmail = checkoutCollectEmail; this.checkoutCollectPhone = checkoutCollectPhone; + this.customCheckoutFields = customCheckoutFields; this.customPlanConfig = customPlanConfig; this.customPlanId = customPlanId; this.enableTaxCollection = enableTaxCollection; @@ -192,6 +197,11 @@ public boolean getCheckoutCollectPhone() { return checkoutCollectPhone; } + @JsonProperty("custom_checkout_fields") + public Optional> getCustomCheckoutFields() { + return customCheckoutFields; + } + @JsonProperty("custom_plan_config") public Optional getCustomPlanConfig() { return customPlanConfig; @@ -344,6 +354,7 @@ private boolean equalTo(CreatePlanGroupRequestBody other) { && checkoutCollectAddress == other.checkoutCollectAddress && checkoutCollectEmail == other.checkoutCollectEmail && checkoutCollectPhone == other.checkoutCollectPhone + && customCheckoutFields.equals(other.customCheckoutFields) && customPlanConfig.equals(other.customPlanConfig) && customPlanId.equals(other.customPlanId) && enableTaxCollection == other.enableTaxCollection @@ -381,6 +392,7 @@ public int hashCode() { this.checkoutCollectAddress, this.checkoutCollectEmail, this.checkoutCollectPhone, + this.customCheckoutFields, this.customPlanConfig, this.customPlanId, this.enableTaxCollection, @@ -497,6 +509,10 @@ public interface _FinalStage { _FinalStage addAllAddOnIds(List addOnIds); + _FinalStage customCheckoutFields(Optional> customCheckoutFields); + + _FinalStage customCheckoutFields(List customCheckoutFields); + _FinalStage customPlanConfig(Optional customPlanConfig); _FinalStage customPlanConfig(CustomPlanConfig customPlanConfig); @@ -645,6 +661,8 @@ public static final class Builder private Optional customPlanConfig = Optional.empty(); + private Optional> customCheckoutFields = Optional.empty(); + private List addOnIds = new ArrayList<>(); private Optional> addOnCompatibilities = Optional.empty(); @@ -661,6 +679,7 @@ public Builder from(CreatePlanGroupRequestBody other) { checkoutCollectAddress(other.getCheckoutCollectAddress()); checkoutCollectEmail(other.getCheckoutCollectEmail()); checkoutCollectPhone(other.getCheckoutCollectPhone()); + customCheckoutFields(other.getCustomCheckoutFields()); customPlanConfig(other.getCustomPlanConfig()); customPlanId(other.getCustomPlanId()); enableTaxCollection(other.getEnableTaxCollection()); @@ -1033,6 +1052,19 @@ public _FinalStage customPlanConfig(Optional customPlanConfig) return this; } + @java.lang.Override + public _FinalStage customCheckoutFields(List customCheckoutFields) { + this.customCheckoutFields = Optional.ofNullable(customCheckoutFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_checkout_fields", nulls = Nulls.SKIP) + public _FinalStage customCheckoutFields(Optional> customCheckoutFields) { + this.customCheckoutFields = customCheckoutFields; + return this; + } + /** *

Use OrderedAddOns instead

* @return Reference to {@code this} so that method calls can be chained together. @@ -1089,6 +1121,7 @@ public CreatePlanGroupRequestBody build() { checkoutCollectAddress, checkoutCollectEmail, checkoutCollectPhone, + customCheckoutFields, customPlanConfig, customPlanId, enableTaxCollection, diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java index 120cf22..a8dc851 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CheckoutFieldInput; import com.schematic.api.types.CompatiblePlans; import com.schematic.api.types.CustomPlanConfig; import com.schematic.api.types.OrderedPlansInGroup; @@ -39,6 +40,8 @@ public final class UpdatePlanGroupRequestBody { private final boolean checkoutCollectPhone; + private final Optional> customCheckoutFields; + private final Optional customPlanConfig; private final Optional customPlanId; @@ -101,6 +104,7 @@ private UpdatePlanGroupRequestBody( boolean checkoutCollectAddress, boolean checkoutCollectEmail, boolean checkoutCollectPhone, + Optional> customCheckoutFields, Optional customPlanConfig, Optional customPlanId, boolean enableTaxCollection, @@ -134,6 +138,7 @@ private UpdatePlanGroupRequestBody( this.checkoutCollectAddress = checkoutCollectAddress; this.checkoutCollectEmail = checkoutCollectEmail; this.checkoutCollectPhone = checkoutCollectPhone; + this.customCheckoutFields = customCheckoutFields; this.customPlanConfig = customPlanConfig; this.customPlanId = customPlanId; this.enableTaxCollection = enableTaxCollection; @@ -192,6 +197,11 @@ public boolean getCheckoutCollectPhone() { return checkoutCollectPhone; } + @JsonProperty("custom_checkout_fields") + public Optional> getCustomCheckoutFields() { + return customCheckoutFields; + } + @JsonProperty("custom_plan_config") public Optional getCustomPlanConfig() { return customPlanConfig; @@ -344,6 +354,7 @@ private boolean equalTo(UpdatePlanGroupRequestBody other) { && checkoutCollectAddress == other.checkoutCollectAddress && checkoutCollectEmail == other.checkoutCollectEmail && checkoutCollectPhone == other.checkoutCollectPhone + && customCheckoutFields.equals(other.customCheckoutFields) && customPlanConfig.equals(other.customPlanConfig) && customPlanId.equals(other.customPlanId) && enableTaxCollection == other.enableTaxCollection @@ -381,6 +392,7 @@ public int hashCode() { this.checkoutCollectAddress, this.checkoutCollectEmail, this.checkoutCollectPhone, + this.customCheckoutFields, this.customPlanConfig, this.customPlanId, this.enableTaxCollection, @@ -497,6 +509,10 @@ public interface _FinalStage { _FinalStage addAllAddOnIds(List addOnIds); + _FinalStage customCheckoutFields(Optional> customCheckoutFields); + + _FinalStage customCheckoutFields(List customCheckoutFields); + _FinalStage customPlanConfig(Optional customPlanConfig); _FinalStage customPlanConfig(CustomPlanConfig customPlanConfig); @@ -645,6 +661,8 @@ public static final class Builder private Optional customPlanConfig = Optional.empty(); + private Optional> customCheckoutFields = Optional.empty(); + private List addOnIds = new ArrayList<>(); private Optional> addOnCompatibilities = Optional.empty(); @@ -661,6 +679,7 @@ public Builder from(UpdatePlanGroupRequestBody other) { checkoutCollectAddress(other.getCheckoutCollectAddress()); checkoutCollectEmail(other.getCheckoutCollectEmail()); checkoutCollectPhone(other.getCheckoutCollectPhone()); + customCheckoutFields(other.getCustomCheckoutFields()); customPlanConfig(other.getCustomPlanConfig()); customPlanId(other.getCustomPlanId()); enableTaxCollection(other.getEnableTaxCollection()); @@ -1033,6 +1052,19 @@ public _FinalStage customPlanConfig(Optional customPlanConfig) return this; } + @java.lang.Override + public _FinalStage customCheckoutFields(List customCheckoutFields) { + this.customCheckoutFields = Optional.ofNullable(customCheckoutFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_checkout_fields", nulls = Nulls.SKIP) + public _FinalStage customCheckoutFields(Optional> customCheckoutFields) { + this.customCheckoutFields = customCheckoutFields; + return this; + } + /** *

Use OrderedAddOns instead

* @return Reference to {@code this} so that method calls can be chained together. @@ -1089,6 +1121,7 @@ public UpdatePlanGroupRequestBody build() { checkoutCollectAddress, checkoutCollectEmail, checkoutCollectPhone, + customCheckoutFields, customPlanConfig, customPlanId, enableTaxCollection, diff --git a/src/main/java/com/schematic/api/types/AccountMemberResponseData.java b/src/main/java/com/schematic/api/types/AccountMemberResponseData.java index 41e14a3..62db8c8 100644 --- a/src/main/java/com/schematic/api/types/AccountMemberResponseData.java +++ b/src/main/java/com/schematic/api/types/AccountMemberResponseData.java @@ -28,10 +28,14 @@ public final class AccountMemberResponseData { private final Optional email; + private final Optional firstName; + private final String id; private final Optional imageUrl; + private final Optional lastName; + private final Optional name; private final Map> permissions; @@ -45,8 +49,10 @@ public final class AccountMemberResponseData { private AccountMemberResponseData( OffsetDateTime createdAt, Optional email, + Optional firstName, String id, Optional imageUrl, + Optional lastName, Optional name, Map> permissions, Optional role, @@ -54,8 +60,10 @@ private AccountMemberResponseData( Map additionalProperties) { this.createdAt = createdAt; this.email = email; + this.firstName = firstName; this.id = id; this.imageUrl = imageUrl; + this.lastName = lastName; this.name = name; this.permissions = permissions; this.role = role; @@ -73,6 +81,11 @@ public Optional getEmail() { return email; } + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + @JsonProperty("id") public String getId() { return id; @@ -83,6 +96,11 @@ public Optional getImageUrl() { return imageUrl; } + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + @JsonProperty("name") public Optional getName() { return name; @@ -117,8 +135,10 @@ public Map getAdditionalProperties() { private boolean equalTo(AccountMemberResponseData other) { return createdAt.equals(other.createdAt) && email.equals(other.email) + && firstName.equals(other.firstName) && id.equals(other.id) && imageUrl.equals(other.imageUrl) + && lastName.equals(other.lastName) && name.equals(other.name) && permissions.equals(other.permissions) && role.equals(other.role) @@ -130,8 +150,10 @@ public int hashCode() { return Objects.hash( this.createdAt, this.email, + this.firstName, this.id, this.imageUrl, + this.lastName, this.name, this.permissions, this.role, @@ -172,10 +194,18 @@ public interface _FinalStage { _FinalStage email(String email); + _FinalStage firstName(Optional firstName); + + _FinalStage firstName(String firstName); + _FinalStage imageUrl(Optional imageUrl); _FinalStage imageUrl(String imageUrl); + _FinalStage lastName(Optional lastName); + + _FinalStage lastName(String lastName); + _FinalStage name(Optional name); _FinalStage name(String name); @@ -205,8 +235,12 @@ public static final class Builder implements CreatedAtStage, IdStage, UpdatedAtS private Optional name = Optional.empty(); + private Optional lastName = Optional.empty(); + private Optional imageUrl = Optional.empty(); + private Optional firstName = Optional.empty(); + private Optional email = Optional.empty(); @JsonAnySetter @@ -218,8 +252,10 @@ private Builder() {} public Builder from(AccountMemberResponseData other) { createdAt(other.getCreatedAt()); email(other.getEmail()); + firstName(other.getFirstName()); id(other.getId()); imageUrl(other.getImageUrl()); + lastName(other.getLastName()); name(other.getName()); permissions(other.getPermissions()); role(other.getRole()); @@ -298,6 +334,19 @@ public _FinalStage name(Optional name) { return this; } + @java.lang.Override + public _FinalStage lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public _FinalStage lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + @java.lang.Override public _FinalStage imageUrl(String imageUrl) { this.imageUrl = Optional.ofNullable(imageUrl); @@ -311,6 +360,19 @@ public _FinalStage imageUrl(Optional imageUrl) { return this; } + @java.lang.Override + public _FinalStage firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public _FinalStage firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + @java.lang.Override public _FinalStage email(String email) { this.email = Optional.ofNullable(email); @@ -327,7 +389,17 @@ public _FinalStage email(Optional email) { @java.lang.Override public AccountMemberResponseData build() { return new AccountMemberResponseData( - createdAt, email, id, imageUrl, name, permissions, role, updatedAt, additionalProperties); + createdAt, + email, + firstName, + id, + imageUrl, + lastName, + name, + permissions, + role, + updatedAt, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java b/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java index 2e93252..f7ee8de 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java @@ -14,6 +14,8 @@ public final class BillingCreditGrantReason { public static final BillingCreditGrantReason PLAN = new BillingCreditGrantReason(Value.PLAN, "plan"); + public static final BillingCreditGrantReason ROLLOVER = new BillingCreditGrantReason(Value.ROLLOVER, "rollover"); + public static final BillingCreditGrantReason BILLING_CREDIT_AUTO_TOPUP = new BillingCreditGrantReason(Value.BILLING_CREDIT_AUTO_TOPUP, "billing_credit_auto_topup"); @@ -58,6 +60,8 @@ public T visit(Visitor visitor) { return visitor.visitAdjustment(); case PLAN: return visitor.visitPlan(); + case ROLLOVER: + return visitor.visitRollover(); case BILLING_CREDIT_AUTO_TOPUP: return visitor.visitBillingCreditAutoTopup(); case FREE: @@ -77,6 +81,8 @@ public static BillingCreditGrantReason valueOf(String value) { return ADJUSTMENT; case "plan": return PLAN; + case "rollover": + return ROLLOVER; case "billing_credit_auto_topup": return BILLING_CREDIT_AUTO_TOPUP; case "free": @@ -97,6 +103,8 @@ public enum Value { PURCHASED, + ROLLOVER, + UNKNOWN } @@ -111,6 +119,8 @@ public interface Visitor { T visitPurchased(); + T visitRollover(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java index 072e5ea..14abebb 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java @@ -59,6 +59,12 @@ public final class BillingCreditGrantResponseData { private final Optional renewalPeriod; + private final Optional reserved; + + private final Optional settled; + + private final Optional sourceGrantId; + private final String sourceLabel; private final Optional> transfers; @@ -92,6 +98,9 @@ private BillingCreditGrantResponseData( double quantityUsed, boolean renewalEnabled, Optional renewalPeriod, + Optional reserved, + Optional settled, + Optional sourceGrantId, String sourceLabel, Optional> transfers, OffsetDateTime updatedAt, @@ -117,6 +126,9 @@ private BillingCreditGrantResponseData( this.quantityUsed = quantityUsed; this.renewalEnabled = renewalEnabled; this.renewalPeriod = renewalPeriod; + this.reserved = reserved; + this.settled = settled; + this.sourceGrantId = sourceGrantId; this.sourceLabel = sourceLabel; this.transfers = transfers; this.updatedAt = updatedAt; @@ -216,6 +228,24 @@ public Optional getRenewalPeriod() { return renewalPeriod; } + @JsonProperty("reserved") + public Optional getReserved() { + return reserved; + } + + @JsonProperty("settled") + public Optional getSettled() { + return settled; + } + + /** + * @return For rollover grants, the ID of the source grant that this grant rolled from. + */ + @JsonProperty("source_grant_id") + public Optional getSourceGrantId() { + return sourceGrantId; + } + @JsonProperty("source_label") public String getSourceLabel() { return sourceLabel; @@ -276,6 +306,9 @@ private boolean equalTo(BillingCreditGrantResponseData other) { && quantityUsed == other.quantityUsed && renewalEnabled == other.renewalEnabled && renewalPeriod.equals(other.renewalPeriod) + && reserved.equals(other.reserved) + && settled.equals(other.settled) + && sourceGrantId.equals(other.sourceGrantId) && sourceLabel.equals(other.sourceLabel) && transfers.equals(other.transfers) && updatedAt.equals(other.updatedAt) @@ -305,6 +338,9 @@ public int hashCode() { this.quantityUsed, this.renewalEnabled, this.renewalPeriod, + this.reserved, + this.settled, + this.sourceGrantId, this.sourceLabel, this.transfers, this.updatedAt, @@ -411,6 +447,21 @@ public interface _FinalStage { _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod); + _FinalStage reserved(Optional reserved); + + _FinalStage reserved(Double reserved); + + _FinalStage settled(Optional settled); + + _FinalStage settled(Double settled); + + /** + *

For rollover grants, the ID of the source grant that this grant rolled from.

+ */ + _FinalStage sourceGrantId(Optional sourceGrantId); + + _FinalStage sourceGrantId(String sourceGrantId); + _FinalStage transfers(Optional> transfers); _FinalStage transfers(List transfers); @@ -478,6 +529,12 @@ public static final class Builder private Optional> transfers = Optional.empty(); + private Optional sourceGrantId = Optional.empty(); + + private Optional settled = Optional.empty(); + + private Optional reserved = Optional.empty(); + private Optional renewalPeriod = Optional.empty(); private Optional price = Optional.empty(); @@ -517,6 +574,9 @@ public Builder from(BillingCreditGrantResponseData other) { quantityUsed(other.getQuantityUsed()); renewalEnabled(other.getRenewalEnabled()); renewalPeriod(other.getRenewalPeriod()); + reserved(other.getReserved()); + settled(other.getSettled()); + sourceGrantId(other.getSourceGrantId()); sourceLabel(other.getSourceLabel()); transfers(other.getTransfers()); updatedAt(other.getUpdatedAt()); @@ -669,6 +729,52 @@ public _FinalStage transfers(Optional> transfer return this; } + /** + *

For rollover grants, the ID of the source grant that this grant rolled from.

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

For rollover grants, the ID of the source grant that this grant rolled from.

+ */ + @java.lang.Override + @JsonSetter(value = "source_grant_id", nulls = Nulls.SKIP) + public _FinalStage sourceGrantId(Optional sourceGrantId) { + this.sourceGrantId = sourceGrantId; + return this; + } + + @java.lang.Override + public _FinalStage settled(Double settled) { + this.settled = Optional.ofNullable(settled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "settled", nulls = Nulls.SKIP) + public _FinalStage settled(Optional settled) { + this.settled = settled; + return this; + } + + @java.lang.Override + public _FinalStage reserved(Double reserved) { + this.reserved = Optional.ofNullable(reserved); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reserved", nulls = Nulls.SKIP) + public _FinalStage reserved(Optional reserved) { + this.reserved = reserved; + return this; + } + @java.lang.Override public _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod) { this.renewalPeriod = Optional.ofNullable(renewalPeriod); @@ -781,6 +887,9 @@ public BillingCreditGrantResponseData build() { quantityUsed, renewalEnabled, renewalPeriod, + reserved, + settled, + sourceGrantId, sourceLabel, transfers, updatedAt, diff --git a/src/main/java/com/schematic/api/types/BillingCreditLedgerAuthority.java b/src/main/java/com/schematic/api/types/BillingCreditLedgerAuthority.java new file mode 100644 index 0000000..f3274e9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingCreditLedgerAuthority.java @@ -0,0 +1,97 @@ +/** + * 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 BillingCreditLedgerAuthority { + public static final BillingCreditLedgerAuthority EXTERNAL_RATED = + new BillingCreditLedgerAuthority(Value.EXTERNAL_RATED, "external_rated"); + + public static final BillingCreditLedgerAuthority EXTERNAL_MIRROR = + new BillingCreditLedgerAuthority(Value.EXTERNAL_MIRROR, "external_mirror"); + + public static final BillingCreditLedgerAuthority SCHEMATIC_AUTHORITATIVE = + new BillingCreditLedgerAuthority(Value.SCHEMATIC_AUTHORITATIVE, "schematic_authoritative"); + + private final Value value; + + private final String string; + + BillingCreditLedgerAuthority(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 BillingCreditLedgerAuthority + && this.string.equals(((BillingCreditLedgerAuthority) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXTERNAL_RATED: + return visitor.visitExternalRated(); + case EXTERNAL_MIRROR: + return visitor.visitExternalMirror(); + case SCHEMATIC_AUTHORITATIVE: + return visitor.visitSchematicAuthoritative(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BillingCreditLedgerAuthority valueOf(String value) { + switch (value) { + case "external_rated": + return EXTERNAL_RATED; + case "external_mirror": + return EXTERNAL_MIRROR; + case "schematic_authoritative": + return SCHEMATIC_AUTHORITATIVE; + default: + return new BillingCreditLedgerAuthority(Value.UNKNOWN, value); + } + } + + public enum Value { + SCHEMATIC_AUTHORITATIVE, + + EXTERNAL_MIRROR, + + EXTERNAL_RATED, + + UNKNOWN + } + + public interface Visitor { + T visitSchematicAuthoritative(); + + T visitExternalMirror(); + + T visitExternalRated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/BillingCreditView.java b/src/main/java/com/schematic/api/types/BillingCreditView.java index cea0d72..89031b6 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditView.java +++ b/src/main/java/com/schematic/api/types/BillingCreditView.java @@ -48,6 +48,8 @@ public final class BillingCreditView { private final String id; + private final BillingCreditLedgerAuthority ledgerAuthority; + private final String name; private final Optional pluralName; @@ -79,6 +81,7 @@ private BillingCreditView( String environmentId, Optional icon, String id, + BillingCreditLedgerAuthority ledgerAuthority, String name, Optional pluralName, Optional price, @@ -100,6 +103,7 @@ private BillingCreditView( this.environmentId = environmentId; this.icon = icon; this.id = id; + this.ledgerAuthority = ledgerAuthority; this.name = name; this.pluralName = pluralName; this.price = price; @@ -171,6 +175,11 @@ public String getId() { return id; } + @JsonProperty("ledger_authority") + public BillingCreditLedgerAuthority getLedgerAuthority() { + return ledgerAuthority; + } + @JsonProperty("name") public String getName() { return name; @@ -235,6 +244,7 @@ private boolean equalTo(BillingCreditView other) { && environmentId.equals(other.environmentId) && icon.equals(other.icon) && id.equals(other.id) + && ledgerAuthority.equals(other.ledgerAuthority) && name.equals(other.name) && pluralName.equals(other.pluralName) && price.equals(other.price) @@ -260,6 +270,7 @@ public int hashCode() { this.environmentId, this.icon, this.id, + this.ledgerAuthority, this.name, this.pluralName, this.price, @@ -314,7 +325,11 @@ public interface EnvironmentIdStage { } public interface IdStage { - NameStage id(@NotNull String id); + LedgerAuthorityStage id(@NotNull String id); + } + + public interface LedgerAuthorityStage { + NameStage ledgerAuthority(@NotNull BillingCreditLedgerAuthority ledgerAuthority); } public interface NameStage { @@ -382,6 +397,7 @@ public static final class Builder DescriptionStage, EnvironmentIdStage, IdStage, + LedgerAuthorityStage, NameStage, UpdatedAtStage, _FinalStage { @@ -403,6 +419,8 @@ public static final class Builder private String id; + private BillingCreditLedgerAuthority ledgerAuthority; + private String name; private OffsetDateTime updatedAt; @@ -444,6 +462,7 @@ public Builder from(BillingCreditView other) { environmentId(other.getEnvironmentId()); icon(other.getIcon()); id(other.getId()); + ledgerAuthority(other.getLedgerAuthority()); name(other.getName()); pluralName(other.getPluralName()); price(other.getPrice()); @@ -514,11 +533,18 @@ public IdStage environmentId(@NotNull String environmentId) { @java.lang.Override @JsonSetter("id") - public NameStage id(@NotNull String id) { + public LedgerAuthorityStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + @java.lang.Override + @JsonSetter("ledger_authority") + public NameStage ledgerAuthority(@NotNull BillingCreditLedgerAuthority ledgerAuthority) { + this.ledgerAuthority = Objects.requireNonNull(ledgerAuthority, "ledgerAuthority must not be null"); + return this; + } + @java.lang.Override @JsonSetter("name") public UpdatedAtStage name(@NotNull String name) { @@ -676,6 +702,7 @@ public BillingCreditView build() { environmentId, icon, id, + ledgerAuthority, name, pluralName, price, diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index 895681a..8e471b4 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -76,6 +76,8 @@ public final class BillingPlanCreditGrantResponseData { private final Optional resetType; + private final long rolloverPercentage; + private final OffsetDateTime updatedAt; private final Map additionalProperties; @@ -108,6 +110,7 @@ private BillingPlanCreditGrantResponseData( Optional resetCadence, Optional resetStart, Optional resetType, + long rolloverPercentage, OffsetDateTime updatedAt, Map additionalProperties) { this.autoTopupAmount = autoTopupAmount; @@ -137,6 +140,7 @@ private BillingPlanCreditGrantResponseData( this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; + this.rolloverPercentage = rolloverPercentage; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -288,6 +292,14 @@ public Optional getResetType() { return resetType; } + /** + * @return Percentage of unused credits that carry over when this grant resets. Only meaningful when reset_type is plan_period. + */ + @JsonProperty("rollover_percentage") + public long getRolloverPercentage() { + return rolloverPercentage; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -333,6 +345,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) + && rolloverPercentage == other.rolloverPercentage && updatedAt.equals(other.updatedAt); } @@ -366,6 +379,7 @@ public int hashCode() { this.resetCadence, this.resetStart, this.resetType, + this.rolloverPercentage, this.updatedAt); } @@ -419,7 +433,14 @@ public interface PlanNameStage { /** *

Use plan.name from the nested plan object instead

*/ - UpdatedAtStage planName(@NotNull String planName); + RolloverPercentageStage planName(@NotNull String planName); + } + + public interface RolloverPercentageStage { + /** + *

Percentage of unused credits that carry over when this grant resets. Only meaningful when reset_type is plan_period.

+ */ + UpdatedAtStage rolloverPercentage(long rolloverPercentage); } public interface UpdatedAtStage { @@ -523,6 +544,7 @@ public static final class Builder IdStage, PlanIdStage, PlanNameStage, + RolloverPercentageStage, UpdatedAtStage, _FinalStage { private boolean autoTopupEnabled; @@ -543,6 +565,8 @@ public static final class Builder private String planName; + private long rolloverPercentage; + private OffsetDateTime updatedAt; private Optional resetType = Optional.empty(); @@ -615,6 +639,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); + rolloverPercentage(other.getRolloverPercentage()); updatedAt(other.getUpdatedAt()); return this; } @@ -687,11 +712,23 @@ public PlanNameStage planId(@NotNull String planId) { */ @java.lang.Override @JsonSetter("plan_name") - public UpdatedAtStage planName(@NotNull String planName) { + public RolloverPercentageStage planName(@NotNull String planName) { this.planName = Objects.requireNonNull(planName, "planName must not be null"); return this; } + /** + *

Percentage of unused credits that carry over when this grant resets. Only meaningful when reset_type is plan_period.

+ *

Percentage of unused credits that carry over when this grant resets. Only meaningful when reset_type is plan_period.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("rollover_percentage") + public UpdatedAtStage rolloverPercentage(long rolloverPercentage) { + this.rolloverPercentage = rolloverPercentage; + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -977,6 +1014,7 @@ public BillingPlanCreditGrantResponseData build() { resetCadence, resetStart, resetType, + rolloverPercentage, updatedAt, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/BillingProviderType.java b/src/main/java/com/schematic/api/types/BillingProviderType.java index 37b44c4..5b7a07b 100644 --- a/src/main/java/com/schematic/api/types/BillingProviderType.java +++ b/src/main/java/com/schematic/api/types/BillingProviderType.java @@ -11,6 +11,8 @@ public final class BillingProviderType { public static final BillingProviderType SCHEMATIC = new BillingProviderType(Value.SCHEMATIC, "schematic"); + public static final BillingProviderType METRONOME = new BillingProviderType(Value.METRONOME, "metronome"); + public static final BillingProviderType STRIPE = new BillingProviderType(Value.STRIPE, "stripe"); private final Value value; @@ -49,6 +51,8 @@ public T visit(Visitor visitor) { return visitor.visitOrb(); case SCHEMATIC: return visitor.visitSchematic(); + case METRONOME: + return visitor.visitMetronome(); case STRIPE: return visitor.visitStripe(); case UNKNOWN: @@ -64,6 +68,8 @@ public static BillingProviderType valueOf(String value) { return ORB; case "schematic": return SCHEMATIC; + case "metronome": + return METRONOME; case "stripe": return STRIPE; default: @@ -72,6 +78,8 @@ public static BillingProviderType valueOf(String value) { } public enum Value { + METRONOME, + ORB, SCHEMATIC, @@ -82,6 +90,8 @@ public enum Value { } public interface Visitor { + T visitMetronome(); + T visitOrb(); T visitSchematic(); diff --git a/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java b/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java index c829e21..7039de1 100644 --- a/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java +++ b/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java @@ -33,6 +33,8 @@ public final class ChangeSubscriptionInternalRequestBody { private final List creditBundles; + private final List customFieldValues; + private final String newPlanId; private final String newPriceId; @@ -53,6 +55,7 @@ private ChangeSubscriptionInternalRequestBody( String companyId, Optional couponExternalId, List creditBundles, + List customFieldValues, String newPlanId, String newPriceId, List payInAdvance, @@ -65,6 +68,7 @@ private ChangeSubscriptionInternalRequestBody( this.companyId = companyId; this.couponExternalId = couponExternalId; this.creditBundles = creditBundles; + this.customFieldValues = customFieldValues; this.newPlanId = newPlanId; this.newPriceId = newPriceId; this.payInAdvance = payInAdvance; @@ -99,6 +103,11 @@ public List getCreditBundles() { return creditBundles; } + @JsonProperty("custom_field_values") + public List getCustomFieldValues() { + return customFieldValues; + } + @JsonProperty("new_plan_id") public String getNewPlanId() { return newPlanId; @@ -147,6 +156,7 @@ private boolean equalTo(ChangeSubscriptionInternalRequestBody other) { && companyId.equals(other.companyId) && couponExternalId.equals(other.couponExternalId) && creditBundles.equals(other.creditBundles) + && customFieldValues.equals(other.customFieldValues) && newPlanId.equals(other.newPlanId) && newPriceId.equals(other.newPriceId) && payInAdvance.equals(other.payInAdvance) @@ -163,6 +173,7 @@ public int hashCode() { this.companyId, this.couponExternalId, this.creditBundles, + this.customFieldValues, this.newPlanId, this.newPriceId, this.payInAdvance, @@ -227,6 +238,12 @@ public interface _FinalStage { _FinalStage addAllCreditBundles(List creditBundles); + _FinalStage customFieldValues(List customFieldValues); + + _FinalStage addCustomFieldValues(CheckoutFieldValue customFieldValues); + + _FinalStage addAllCustomFieldValues(List customFieldValues); + _FinalStage payInAdvance(List payInAdvance); _FinalStage addPayInAdvance(UpdatePayInAdvanceRequestBody payInAdvance); @@ -259,6 +276,8 @@ public static final class Builder private List payInAdvance = new ArrayList<>(); + private List customFieldValues = new ArrayList<>(); + private List creditBundles = new ArrayList<>(); private Optional couponExternalId = Optional.empty(); @@ -279,6 +298,7 @@ public Builder from(ChangeSubscriptionInternalRequestBody other) { companyId(other.getCompanyId()); couponExternalId(other.getCouponExternalId()); creditBundles(other.getCreditBundles()); + customFieldValues(other.getCustomFieldValues()); newPlanId(other.getNewPlanId()); newPriceId(other.getNewPriceId()); payInAdvance(other.getPayInAdvance()); @@ -366,6 +386,30 @@ public _FinalStage payInAdvance(List payInAdvance return this; } + @java.lang.Override + public _FinalStage addAllCustomFieldValues(List customFieldValues) { + if (customFieldValues != null) { + this.customFieldValues.addAll(customFieldValues); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFieldValues(CheckoutFieldValue customFieldValues) { + this.customFieldValues.add(customFieldValues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_field_values", nulls = Nulls.SKIP) + public _FinalStage customFieldValues(List customFieldValues) { + this.customFieldValues.clear(); + if (customFieldValues != null) { + this.customFieldValues.addAll(customFieldValues); + } + return this; + } + @java.lang.Override public _FinalStage addAllCreditBundles(List creditBundles) { if (creditBundles != null) { @@ -459,6 +503,7 @@ public ChangeSubscriptionInternalRequestBody build() { companyId, couponExternalId, creditBundles, + customFieldValues, newPlanId, newPriceId, payInAdvance, diff --git a/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java b/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java index 2261604..4a8d8bc 100644 --- a/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java +++ b/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java @@ -31,6 +31,8 @@ public final class ChangeSubscriptionRequestBody { private final List creditBundles; + private final List customFieldValues; + private final String newPlanId; private final String newPriceId; @@ -50,6 +52,7 @@ private ChangeSubscriptionRequestBody( List autoTopupOverrides, Optional couponExternalId, List creditBundles, + List customFieldValues, String newPlanId, String newPriceId, List payInAdvance, @@ -61,6 +64,7 @@ private ChangeSubscriptionRequestBody( this.autoTopupOverrides = autoTopupOverrides; this.couponExternalId = couponExternalId; this.creditBundles = creditBundles; + this.customFieldValues = customFieldValues; this.newPlanId = newPlanId; this.newPriceId = newPriceId; this.payInAdvance = payInAdvance; @@ -90,6 +94,11 @@ public List getCreditBundles() { return creditBundles; } + @JsonProperty("custom_field_values") + public List getCustomFieldValues() { + return customFieldValues; + } + @JsonProperty("new_plan_id") public String getNewPlanId() { return newPlanId; @@ -136,6 +145,7 @@ private boolean equalTo(ChangeSubscriptionRequestBody other) { && autoTopupOverrides.equals(other.autoTopupOverrides) && couponExternalId.equals(other.couponExternalId) && creditBundles.equals(other.creditBundles) + && customFieldValues.equals(other.customFieldValues) && newPlanId.equals(other.newPlanId) && newPriceId.equals(other.newPriceId) && payInAdvance.equals(other.payInAdvance) @@ -151,6 +161,7 @@ public int hashCode() { this.autoTopupOverrides, this.couponExternalId, this.creditBundles, + this.customFieldValues, this.newPlanId, this.newPriceId, this.payInAdvance, @@ -211,6 +222,12 @@ public interface _FinalStage { _FinalStage addAllCreditBundles(List creditBundles); + _FinalStage customFieldValues(List customFieldValues); + + _FinalStage addCustomFieldValues(CheckoutFieldValue customFieldValues); + + _FinalStage addAllCustomFieldValues(List customFieldValues); + _FinalStage payInAdvance(List payInAdvance); _FinalStage addPayInAdvance(UpdatePayInAdvanceRequestBody payInAdvance); @@ -240,6 +257,8 @@ public static final class Builder implements NewPlanIdStage, NewPriceIdStage, Sk private List payInAdvance = new ArrayList<>(); + private List customFieldValues = new ArrayList<>(); + private List creditBundles = new ArrayList<>(); private Optional couponExternalId = Optional.empty(); @@ -259,6 +278,7 @@ public Builder from(ChangeSubscriptionRequestBody other) { autoTopupOverrides(other.getAutoTopupOverrides()); couponExternalId(other.getCouponExternalId()); creditBundles(other.getCreditBundles()); + customFieldValues(other.getCustomFieldValues()); newPlanId(other.getNewPlanId()); newPriceId(other.getNewPriceId()); payInAdvance(other.getPayInAdvance()); @@ -339,6 +359,30 @@ public _FinalStage payInAdvance(List payInAdvance return this; } + @java.lang.Override + public _FinalStage addAllCustomFieldValues(List customFieldValues) { + if (customFieldValues != null) { + this.customFieldValues.addAll(customFieldValues); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFieldValues(CheckoutFieldValue customFieldValues) { + this.customFieldValues.add(customFieldValues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_field_values", nulls = Nulls.SKIP) + public _FinalStage customFieldValues(List customFieldValues) { + this.customFieldValues.clear(); + if (customFieldValues != null) { + this.customFieldValues.addAll(customFieldValues); + } + return this; + } + @java.lang.Override public _FinalStage addAllCreditBundles(List creditBundles) { if (creditBundles != null) { @@ -431,6 +475,7 @@ public ChangeSubscriptionRequestBody build() { autoTopupOverrides, couponExternalId, creditBundles, + customFieldValues, newPlanId, newPriceId, payInAdvance, diff --git a/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java b/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java index 9926a96..fa2a4a6 100644 --- a/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java @@ -32,6 +32,8 @@ public final class CheckoutDataResponseData { private final Optional company; + private final List customCheckoutFields; + private final Optional featureUsage; private final List selectedCreditBundles; @@ -50,6 +52,7 @@ private CheckoutDataResponseData( List activeUsageBasedEntitlements, List availableCreditBundles, Optional company, + List customCheckoutFields, Optional featureUsage, List selectedCreditBundles, Optional selectedPlan, @@ -61,6 +64,7 @@ private CheckoutDataResponseData( this.activeUsageBasedEntitlements = activeUsageBasedEntitlements; this.availableCreditBundles = availableCreditBundles; this.company = company; + this.customCheckoutFields = customCheckoutFields; this.featureUsage = featureUsage; this.selectedCreditBundles = selectedCreditBundles; this.selectedPlan = selectedPlan; @@ -94,6 +98,11 @@ public Optional getCompany() { return company; } + @JsonProperty("custom_checkout_fields") + public List getCustomCheckoutFields() { + return customCheckoutFields; + } + @JsonProperty("feature_usage") public Optional getFeatureUsage() { return featureUsage; @@ -136,6 +145,7 @@ private boolean equalTo(CheckoutDataResponseData other) { && activeUsageBasedEntitlements.equals(other.activeUsageBasedEntitlements) && availableCreditBundles.equals(other.availableCreditBundles) && company.equals(other.company) + && customCheckoutFields.equals(other.customCheckoutFields) && featureUsage.equals(other.featureUsage) && selectedCreditBundles.equals(other.selectedCreditBundles) && selectedPlan.equals(other.selectedPlan) @@ -151,6 +161,7 @@ public int hashCode() { this.activeUsageBasedEntitlements, this.availableCreditBundles, this.company, + this.customCheckoutFields, this.featureUsage, this.selectedCreditBundles, this.selectedPlan, @@ -179,6 +190,8 @@ public static final class Builder { private Optional company = Optional.empty(); + private List customCheckoutFields = new ArrayList<>(); + private Optional featureUsage = Optional.empty(); private List selectedCreditBundles = new ArrayList<>(); @@ -200,6 +213,7 @@ public Builder from(CheckoutDataResponseData other) { activeUsageBasedEntitlements(other.getActiveUsageBasedEntitlements()); availableCreditBundles(other.getAvailableCreditBundles()); company(other.getCompany()); + customCheckoutFields(other.getCustomCheckoutFields()); featureUsage(other.getFeatureUsage()); selectedCreditBundles(other.getSelectedCreditBundles()); selectedPlan(other.getSelectedPlan()); @@ -295,6 +309,27 @@ public Builder company(CompanyDetailResponseData company) { return this; } + @JsonSetter(value = "custom_checkout_fields", nulls = Nulls.SKIP) + public Builder customCheckoutFields(List customCheckoutFields) { + this.customCheckoutFields.clear(); + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + + public Builder addCustomCheckoutFields(CheckoutFieldWithValue customCheckoutFields) { + this.customCheckoutFields.add(customCheckoutFields); + return this; + } + + public Builder addAllCustomCheckoutFields(List customCheckoutFields) { + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) public Builder featureUsage(Optional featureUsage) { this.featureUsage = featureUsage; @@ -380,6 +415,7 @@ public CheckoutDataResponseData build() { activeUsageBasedEntitlements, availableCreditBundles, company, + customCheckoutFields, featureUsage, selectedCreditBundles, selectedPlan, diff --git a/src/main/java/com/schematic/api/types/CheckoutFieldInput.java b/src/main/java/com/schematic/api/types/CheckoutFieldInput.java new file mode 100644 index 0000000..b2c9833 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutFieldInput.java @@ -0,0 +1,262 @@ +/** + * 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 = CheckoutFieldInput.Builder.class) +public final class CheckoutFieldInput { + private final Optional definitionId; + + private final Optional helperText; + + private final Optional id; + + private final String name; + + private final boolean required; + + private final String stripeMetadataKey; + + private final Map additionalProperties; + + private CheckoutFieldInput( + Optional definitionId, + Optional helperText, + Optional id, + String name, + boolean required, + String stripeMetadataKey, + Map additionalProperties) { + this.definitionId = definitionId; + this.helperText = helperText; + this.id = id; + this.name = name; + this.required = required; + this.stripeMetadataKey = stripeMetadataKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("definition_id") + public Optional getDefinitionId() { + return definitionId; + } + + @JsonProperty("helper_text") + public Optional getHelperText() { + return helperText; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("required") + public boolean getRequired() { + return required; + } + + @JsonProperty("stripe_metadata_key") + public String getStripeMetadataKey() { + return stripeMetadataKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutFieldInput && equalTo((CheckoutFieldInput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutFieldInput other) { + return definitionId.equals(other.definitionId) + && helperText.equals(other.helperText) + && id.equals(other.id) + && name.equals(other.name) + && required == other.required + && stripeMetadataKey.equals(other.stripeMetadataKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.definitionId, this.helperText, this.id, this.name, this.required, this.stripeMetadataKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + RequiredStage name(@NotNull String name); + + Builder from(CheckoutFieldInput other); + } + + public interface RequiredStage { + StripeMetadataKeyStage required(boolean required); + } + + public interface StripeMetadataKeyStage { + _FinalStage stripeMetadataKey(@NotNull String stripeMetadataKey); + } + + public interface _FinalStage { + CheckoutFieldInput build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage definitionId(Optional definitionId); + + _FinalStage definitionId(String definitionId); + + _FinalStage helperText(Optional helperText); + + _FinalStage helperText(String helperText); + + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, RequiredStage, StripeMetadataKeyStage, _FinalStage { + private String name; + + private boolean required; + + private String stripeMetadataKey; + + private Optional id = Optional.empty(); + + private Optional helperText = Optional.empty(); + + private Optional definitionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutFieldInput other) { + definitionId(other.getDefinitionId()); + helperText(other.getHelperText()); + id(other.getId()); + name(other.getName()); + required(other.getRequired()); + stripeMetadataKey(other.getStripeMetadataKey()); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public RequiredStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("required") + public StripeMetadataKeyStage required(boolean required) { + this.required = required; + return this; + } + + @java.lang.Override + @JsonSetter("stripe_metadata_key") + public _FinalStage stripeMetadataKey(@NotNull String stripeMetadataKey) { + this.stripeMetadataKey = Objects.requireNonNull(stripeMetadataKey, "stripeMetadataKey must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public _FinalStage helperText(String helperText) { + this.helperText = Optional.ofNullable(helperText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "helper_text", nulls = Nulls.SKIP) + public _FinalStage helperText(Optional helperText) { + this.helperText = helperText; + return this; + } + + @java.lang.Override + public _FinalStage definitionId(String definitionId) { + this.definitionId = Optional.ofNullable(definitionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "definition_id", nulls = Nulls.SKIP) + public _FinalStage definitionId(Optional definitionId) { + this.definitionId = definitionId; + return this; + } + + @java.lang.Override + public CheckoutFieldInput build() { + return new CheckoutFieldInput( + definitionId, helperText, id, name, required, stripeMetadataKey, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CheckoutFieldResponseData.java b/src/main/java/com/schematic/api/types/CheckoutFieldResponseData.java new file mode 100644 index 0000000..4ea1fef --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutFieldResponseData.java @@ -0,0 +1,396 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutFieldResponseData.Builder.class) +public final class CheckoutFieldResponseData { + private final OffsetDateTime createdAt; + + private final String definitionId; + + private final Optional helperText; + + private final String id; + + private final String name; + + private final long position; + + private final boolean required; + + private final String stripeMetadataKey; + + private final List traitHierarchy; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CheckoutFieldResponseData( + OffsetDateTime createdAt, + String definitionId, + Optional helperText, + String id, + String name, + long position, + boolean required, + String stripeMetadataKey, + List traitHierarchy, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.definitionId = definitionId; + this.helperText = helperText; + this.id = id; + this.name = name; + this.position = position; + this.required = required; + this.stripeMetadataKey = stripeMetadataKey; + this.traitHierarchy = traitHierarchy; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("definition_id") + public String getDefinitionId() { + return definitionId; + } + + @JsonProperty("helper_text") + public Optional getHelperText() { + return helperText; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("position") + public long getPosition() { + return position; + } + + @JsonProperty("required") + public boolean getRequired() { + return required; + } + + @JsonProperty("stripe_metadata_key") + public String getStripeMetadataKey() { + return stripeMetadataKey; + } + + @JsonProperty("trait_hierarchy") + public List getTraitHierarchy() { + return traitHierarchy; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutFieldResponseData && equalTo((CheckoutFieldResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutFieldResponseData other) { + return createdAt.equals(other.createdAt) + && definitionId.equals(other.definitionId) + && helperText.equals(other.helperText) + && id.equals(other.id) + && name.equals(other.name) + && position == other.position + && required == other.required + && stripeMetadataKey.equals(other.stripeMetadataKey) + && traitHierarchy.equals(other.traitHierarchy) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.definitionId, + this.helperText, + this.id, + this.name, + this.position, + this.required, + this.stripeMetadataKey, + this.traitHierarchy, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + DefinitionIdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(CheckoutFieldResponseData other); + } + + public interface DefinitionIdStage { + IdStage definitionId(@NotNull String definitionId); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + PositionStage name(@NotNull String name); + } + + public interface PositionStage { + RequiredStage position(long position); + } + + public interface RequiredStage { + StripeMetadataKeyStage required(boolean required); + } + + public interface StripeMetadataKeyStage { + UpdatedAtStage stripeMetadataKey(@NotNull String stripeMetadataKey); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CheckoutFieldResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage helperText(Optional helperText); + + _FinalStage helperText(String helperText); + + _FinalStage traitHierarchy(List traitHierarchy); + + _FinalStage addTraitHierarchy(String traitHierarchy); + + _FinalStage addAllTraitHierarchy(List traitHierarchy); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + DefinitionIdStage, + IdStage, + NameStage, + PositionStage, + RequiredStage, + StripeMetadataKeyStage, + UpdatedAtStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String definitionId; + + private String id; + + private String name; + + private long position; + + private boolean required; + + private String stripeMetadataKey; + + private OffsetDateTime updatedAt; + + private List traitHierarchy = new ArrayList<>(); + + private Optional helperText = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutFieldResponseData other) { + createdAt(other.getCreatedAt()); + definitionId(other.getDefinitionId()); + helperText(other.getHelperText()); + id(other.getId()); + name(other.getName()); + position(other.getPosition()); + required(other.getRequired()); + stripeMetadataKey(other.getStripeMetadataKey()); + traitHierarchy(other.getTraitHierarchy()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DefinitionIdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("definition_id") + public IdStage definitionId(@NotNull String definitionId) { + this.definitionId = Objects.requireNonNull(definitionId, "definitionId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public PositionStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("position") + public RequiredStage position(long position) { + this.position = position; + return this; + } + + @java.lang.Override + @JsonSetter("required") + public StripeMetadataKeyStage required(boolean required) { + this.required = required; + return this; + } + + @java.lang.Override + @JsonSetter("stripe_metadata_key") + public UpdatedAtStage stripeMetadataKey(@NotNull String stripeMetadataKey) { + this.stripeMetadataKey = Objects.requireNonNull(stripeMetadataKey, "stripeMetadataKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllTraitHierarchy(List traitHierarchy) { + if (traitHierarchy != null) { + this.traitHierarchy.addAll(traitHierarchy); + } + return this; + } + + @java.lang.Override + public _FinalStage addTraitHierarchy(String traitHierarchy) { + this.traitHierarchy.add(traitHierarchy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_hierarchy", nulls = Nulls.SKIP) + public _FinalStage traitHierarchy(List traitHierarchy) { + this.traitHierarchy.clear(); + if (traitHierarchy != null) { + this.traitHierarchy.addAll(traitHierarchy); + } + return this; + } + + @java.lang.Override + public _FinalStage helperText(String helperText) { + this.helperText = Optional.ofNullable(helperText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "helper_text", nulls = Nulls.SKIP) + public _FinalStage helperText(Optional helperText) { + this.helperText = helperText; + return this; + } + + @java.lang.Override + public CheckoutFieldResponseData build() { + return new CheckoutFieldResponseData( + createdAt, + definitionId, + helperText, + id, + name, + position, + required, + stripeMetadataKey, + traitHierarchy, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CheckoutFieldValue.java b/src/main/java/com/schematic/api/types/CheckoutFieldValue.java new file mode 100644 index 0000000..ab5c3a4 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutFieldValue.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckoutFieldValue.Builder.class) +public final class CheckoutFieldValue { + private final String id; + + private final String value; + + private final Map additionalProperties; + + private CheckoutFieldValue(String id, String value, Map additionalProperties) { + this.id = id; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutFieldValue && equalTo((CheckoutFieldValue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutFieldValue other) { + return id.equals(other.id) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + ValueStage id(@NotNull String id); + + Builder from(CheckoutFieldValue other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + CheckoutFieldValue build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ValueStage, _FinalStage { + private String id; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutFieldValue other) { + id(other.getId()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ValueStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public CheckoutFieldValue build() { + return new CheckoutFieldValue(id, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CheckoutFieldWithValue.java b/src/main/java/com/schematic/api/types/CheckoutFieldWithValue.java new file mode 100644 index 0000000..1341ba6 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutFieldWithValue.java @@ -0,0 +1,287 @@ +/** + * 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 = CheckoutFieldWithValue.Builder.class) +public final class CheckoutFieldWithValue { + private final String definitionId; + + private final Optional helperText; + + private final String id; + + private final String name; + + private final boolean required; + + private final String stripeMetadataKey; + + private final Optional value; + + private final Map additionalProperties; + + private CheckoutFieldWithValue( + String definitionId, + Optional helperText, + String id, + String name, + boolean required, + String stripeMetadataKey, + Optional value, + Map additionalProperties) { + this.definitionId = definitionId; + this.helperText = helperText; + this.id = id; + this.name = name; + this.required = required; + this.stripeMetadataKey = stripeMetadataKey; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("definition_id") + public String getDefinitionId() { + return definitionId; + } + + @JsonProperty("helper_text") + public Optional getHelperText() { + return helperText; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("required") + public boolean getRequired() { + return required; + } + + @JsonProperty("stripe_metadata_key") + public String getStripeMetadataKey() { + return stripeMetadataKey; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckoutFieldWithValue && equalTo((CheckoutFieldWithValue) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckoutFieldWithValue other) { + return definitionId.equals(other.definitionId) + && helperText.equals(other.helperText) + && id.equals(other.id) + && name.equals(other.name) + && required == other.required + && stripeMetadataKey.equals(other.stripeMetadataKey) + && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.definitionId, + this.helperText, + this.id, + this.name, + this.required, + this.stripeMetadataKey, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DefinitionIdStage builder() { + return new Builder(); + } + + public interface DefinitionIdStage { + IdStage definitionId(@NotNull String definitionId); + + Builder from(CheckoutFieldWithValue other); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + RequiredStage name(@NotNull String name); + } + + public interface RequiredStage { + StripeMetadataKeyStage required(boolean required); + } + + public interface StripeMetadataKeyStage { + _FinalStage stripeMetadataKey(@NotNull String stripeMetadataKey); + } + + public interface _FinalStage { + CheckoutFieldWithValue build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage helperText(Optional helperText); + + _FinalStage helperText(String helperText); + + _FinalStage value(Optional value); + + _FinalStage value(String value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DefinitionIdStage, IdStage, NameStage, RequiredStage, StripeMetadataKeyStage, _FinalStage { + private String definitionId; + + private String id; + + private String name; + + private boolean required; + + private String stripeMetadataKey; + + private Optional value = Optional.empty(); + + private Optional helperText = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CheckoutFieldWithValue other) { + definitionId(other.getDefinitionId()); + helperText(other.getHelperText()); + id(other.getId()); + name(other.getName()); + required(other.getRequired()); + stripeMetadataKey(other.getStripeMetadataKey()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("definition_id") + public IdStage definitionId(@NotNull String definitionId) { + this.definitionId = Objects.requireNonNull(definitionId, "definitionId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public RequiredStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("required") + public StripeMetadataKeyStage required(boolean required) { + this.required = required; + return this; + } + + @java.lang.Override + @JsonSetter("stripe_metadata_key") + public _FinalStage stripeMetadataKey(@NotNull String stripeMetadataKey) { + this.stripeMetadataKey = Objects.requireNonNull(stripeMetadataKey, "stripeMetadataKey must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public _FinalStage value(Optional value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage helperText(String helperText) { + this.helperText = Optional.ofNullable(helperText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "helper_text", nulls = Nulls.SKIP) + public _FinalStage helperText(Optional helperText) { + this.helperText = helperText; + return this; + } + + @java.lang.Override + public CheckoutFieldWithValue build() { + return new CheckoutFieldWithValue( + definitionId, helperText, id, name, required, stripeMetadataKey, value, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CompanyCreditBalanceResponseData.java b/src/main/java/com/schematic/api/types/CompanyCreditBalanceResponseData.java index 6070a6b..42ee16a 100644 --- a/src/main/java/com/schematic/api/types/CompanyCreditBalanceResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyCreditBalanceResponseData.java @@ -25,6 +25,10 @@ public final class CompanyCreditBalanceResponseData { private final double remaining; + private final double reserved; + + private final double settled; + private final BillingProviderType source; private final Optional total; @@ -34,11 +38,15 @@ public final class CompanyCreditBalanceResponseData { private CompanyCreditBalanceResponseData( String creditId, double remaining, + double reserved, + double settled, BillingProviderType source, Optional total, Map additionalProperties) { this.creditId = creditId; this.remaining = remaining; + this.reserved = reserved; + this.settled = settled; this.source = source; this.total = total; this.additionalProperties = additionalProperties; @@ -54,6 +62,16 @@ public double getRemaining() { return remaining; } + @JsonProperty("reserved") + public double getReserved() { + return reserved; + } + + @JsonProperty("settled") + public double getSettled() { + return settled; + } + @JsonProperty("source") public BillingProviderType getSource() { return source; @@ -78,13 +96,15 @@ public Map getAdditionalProperties() { private boolean equalTo(CompanyCreditBalanceResponseData other) { return creditId.equals(other.creditId) && remaining == other.remaining + && reserved == other.reserved + && settled == other.settled && source.equals(other.source) && total.equals(other.total); } @java.lang.Override public int hashCode() { - return Objects.hash(this.creditId, this.remaining, this.source, this.total); + return Objects.hash(this.creditId, this.remaining, this.reserved, this.settled, this.source, this.total); } @java.lang.Override @@ -103,7 +123,15 @@ public interface CreditIdStage { } public interface RemainingStage { - SourceStage remaining(double remaining); + ReservedStage remaining(double remaining); + } + + public interface ReservedStage { + SettledStage reserved(double reserved); + } + + public interface SettledStage { + SourceStage settled(double settled); } public interface SourceStage { @@ -123,11 +151,16 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CreditIdStage, RemainingStage, SourceStage, _FinalStage { + public static final class Builder + implements CreditIdStage, RemainingStage, ReservedStage, SettledStage, SourceStage, _FinalStage { private String creditId; private double remaining; + private double reserved; + + private double settled; + private BillingProviderType source; private Optional total = Optional.empty(); @@ -141,6 +174,8 @@ private Builder() {} public Builder from(CompanyCreditBalanceResponseData other) { creditId(other.getCreditId()); remaining(other.getRemaining()); + reserved(other.getReserved()); + settled(other.getSettled()); source(other.getSource()); total(other.getTotal()); return this; @@ -155,11 +190,25 @@ public RemainingStage creditId(@NotNull String creditId) { @java.lang.Override @JsonSetter("remaining") - public SourceStage remaining(double remaining) { + public ReservedStage remaining(double remaining) { this.remaining = remaining; return this; } + @java.lang.Override + @JsonSetter("reserved") + public SettledStage reserved(double reserved) { + this.reserved = reserved; + return this; + } + + @java.lang.Override + @JsonSetter("settled") + public SourceStage settled(double settled) { + this.settled = settled; + return this; + } + @java.lang.Override @JsonSetter("source") public _FinalStage source(@NotNull BillingProviderType source) { @@ -182,7 +231,8 @@ public _FinalStage total(Optional total) { @java.lang.Override public CompanyCreditBalanceResponseData build() { - return new CompanyCreditBalanceResponseData(creditId, remaining, source, total, additionalProperties); + return new CompanyCreditBalanceResponseData( + creditId, remaining, reserved, settled, source, total, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java b/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java index 080cb11..5324b63 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanCreditGrantView.java @@ -82,6 +82,8 @@ public final class CompanyPlanCreditGrantView { private final BillingPlanCreditGrantResetType resetType; + private final long rolloverPercentage; + private final Optional singularName; private final OffsetDateTime updatedAt; @@ -119,6 +121,7 @@ private CompanyPlanCreditGrantView( Optional resetCadence, Optional resetStart, BillingPlanCreditGrantResetType resetType, + long rolloverPercentage, Optional singularName, OffsetDateTime updatedAt, Map additionalProperties) { @@ -152,6 +155,7 @@ private CompanyPlanCreditGrantView( this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; + this.rolloverPercentage = rolloverPercentage; this.singularName = singularName; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -319,6 +323,11 @@ public BillingPlanCreditGrantResetType getResetType() { return resetType; } + @JsonProperty("rollover_percentage") + public long getRolloverPercentage() { + return rolloverPercentage; + } + /** * @return Deprecated field, will be removed in the future. Use Credit.SingularName instead. */ @@ -374,6 +383,7 @@ private boolean equalTo(CompanyPlanCreditGrantView other) { && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) + && rolloverPercentage == other.rolloverPercentage && singularName.equals(other.singularName) && updatedAt.equals(other.updatedAt); } @@ -411,6 +421,7 @@ public int hashCode() { this.resetCadence, this.resetStart, this.resetType, + this.rolloverPercentage, this.singularName, this.updatedAt); } @@ -469,7 +480,11 @@ public interface PlanIdStage { } public interface ResetTypeStage { - UpdatedAtStage resetType(@NotNull BillingPlanCreditGrantResetType resetType); + RolloverPercentageStage resetType(@NotNull BillingPlanCreditGrantResetType resetType); + } + + public interface RolloverPercentageStage { + UpdatedAtStage rolloverPercentage(long rolloverPercentage); } public interface UpdatedAtStage { @@ -591,6 +606,7 @@ public static final class Builder IdStage, PlanIdStage, ResetTypeStage, + RolloverPercentageStage, UpdatedAtStage, _FinalStage { private boolean billingCreditAutoTopupEnabled; @@ -613,6 +629,8 @@ public static final class Builder private BillingPlanCreditGrantResetType resetType; + private long rolloverPercentage; + private OffsetDateTime updatedAt; private Optional singularName = Optional.empty(); @@ -694,6 +712,7 @@ public Builder from(CompanyPlanCreditGrantView other) { resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); + rolloverPercentage(other.getRolloverPercentage()); singularName(other.getSingularName()); updatedAt(other.getUpdatedAt()); return this; @@ -775,11 +794,18 @@ public ResetTypeStage planId(@NotNull String planId) { @java.lang.Override @JsonSetter("reset_type") - public UpdatedAtStage resetType(@NotNull BillingPlanCreditGrantResetType resetType) { + public RolloverPercentageStage resetType(@NotNull BillingPlanCreditGrantResetType resetType) { this.resetType = Objects.requireNonNull(resetType, "resetType must not be null"); return this; } + @java.lang.Override + @JsonSetter("rollover_percentage") + public UpdatedAtStage rolloverPercentage(long rolloverPercentage) { + this.rolloverPercentage = rolloverPercentage; + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -1118,6 +1144,7 @@ public CompanyPlanCreditGrantView build() { resetCadence, resetStart, resetType, + rolloverPercentage, singularName, updatedAt, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java index 49bf1d1..9f55e03 100644 --- a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java @@ -43,6 +43,8 @@ public final class ComponentHydrateResponseData { private final List creditGrants; + private final List customCheckoutFields; + private final Optional defaultPlan; private final ComponentDisplaySettings displaySettings; @@ -88,6 +90,7 @@ private ComponentHydrateResponseData( Optional component, List creditBundles, List creditGrants, + List customCheckoutFields, Optional defaultPlan, ComponentDisplaySettings displaySettings, Optional featureUsage, @@ -115,6 +118,7 @@ private ComponentHydrateResponseData( this.component = component; this.creditBundles = creditBundles; this.creditGrants = creditGrants; + this.customCheckoutFields = customCheckoutFields; this.defaultPlan = defaultPlan; this.displaySettings = displaySettings; this.featureUsage = featureUsage; @@ -184,6 +188,11 @@ public List getCreditGrants() { return creditGrants; } + @JsonProperty("custom_checkout_fields") + public List getCustomCheckoutFields() { + return customCheckoutFields; + } + @JsonProperty("default_plan") public Optional getDefaultPlan() { return defaultPlan; @@ -286,6 +295,7 @@ private boolean equalTo(ComponentHydrateResponseData other) { && component.equals(other.component) && creditBundles.equals(other.creditBundles) && creditGrants.equals(other.creditGrants) + && customCheckoutFields.equals(other.customCheckoutFields) && defaultPlan.equals(other.defaultPlan) && displaySettings.equals(other.displaySettings) && featureUsage.equals(other.featureUsage) @@ -317,6 +327,7 @@ public int hashCode() { this.component, this.creditBundles, this.creditGrants, + this.customCheckoutFields, this.defaultPlan, this.displaySettings, this.featureUsage, @@ -430,6 +441,12 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage addAllCreditGrants(List creditGrants); + _FinalStage customCheckoutFields(List customCheckoutFields); + + _FinalStage addCustomCheckoutFields(CheckoutFieldWithValue customCheckoutFields); + + _FinalStage addAllCustomCheckoutFields(List customCheckoutFields); + _FinalStage defaultPlan(Optional defaultPlan); _FinalStage defaultPlan(PlanDetailResponseData defaultPlan); @@ -515,6 +532,8 @@ public static final class Builder private Optional defaultPlan = Optional.empty(); + private List customCheckoutFields = new ArrayList<>(); + private List creditGrants = new ArrayList<>(); private List creditBundles = new ArrayList<>(); @@ -550,6 +569,7 @@ public Builder from(ComponentHydrateResponseData other) { component(other.getComponent()); creditBundles(other.getCreditBundles()); creditGrants(other.getCreditGrants()); + customCheckoutFields(other.getCustomCheckoutFields()); defaultPlan(other.getDefaultPlan()); displaySettings(other.getDisplaySettings()); featureUsage(other.getFeatureUsage()); @@ -749,6 +769,30 @@ public _FinalStage defaultPlan(Optional defaultPlan) { return this; } + @java.lang.Override + public _FinalStage addAllCustomCheckoutFields(List customCheckoutFields) { + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomCheckoutFields(CheckoutFieldWithValue customCheckoutFields) { + this.customCheckoutFields.add(customCheckoutFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_checkout_fields", nulls = Nulls.SKIP) + public _FinalStage customCheckoutFields(List customCheckoutFields) { + this.customCheckoutFields.clear(); + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + @java.lang.Override public _FinalStage addAllCreditGrants(List creditGrants) { if (creditGrants != null) { @@ -948,6 +992,7 @@ public ComponentHydrateResponseData build() { component, creditBundles, creditGrants, + customCheckoutFields, defaultPlan, displaySettings, featureUsage, diff --git a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java index 49e7f16..5d98d9b 100644 --- a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java @@ -43,6 +43,8 @@ public final class ComponentPreviewResponseData { private final List creditGrants; + private final List customCheckoutFields; + private final Optional defaultPlan; private final ComponentDisplaySettings displaySettings; @@ -90,6 +92,7 @@ private ComponentPreviewResponseData( Optional component, List creditBundles, List creditGrants, + List customCheckoutFields, Optional defaultPlan, ComponentDisplaySettings displaySettings, Optional featureUsage, @@ -118,6 +121,7 @@ private ComponentPreviewResponseData( this.component = component; this.creditBundles = creditBundles; this.creditGrants = creditGrants; + this.customCheckoutFields = customCheckoutFields; this.defaultPlan = defaultPlan; this.displaySettings = displaySettings; this.featureUsage = featureUsage; @@ -188,6 +192,11 @@ public List getCreditGrants() { return creditGrants; } + @JsonProperty("custom_checkout_fields") + public List getCustomCheckoutFields() { + return customCheckoutFields; + } + @JsonProperty("default_plan") public Optional getDefaultPlan() { return defaultPlan; @@ -295,6 +304,7 @@ private boolean equalTo(ComponentPreviewResponseData other) { && component.equals(other.component) && creditBundles.equals(other.creditBundles) && creditGrants.equals(other.creditGrants) + && customCheckoutFields.equals(other.customCheckoutFields) && defaultPlan.equals(other.defaultPlan) && displaySettings.equals(other.displaySettings) && featureUsage.equals(other.featureUsage) @@ -327,6 +337,7 @@ public int hashCode() { this.component, this.creditBundles, this.creditGrants, + this.customCheckoutFields, this.defaultPlan, this.displaySettings, this.featureUsage, @@ -441,6 +452,12 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage addAllCreditGrants(List creditGrants); + _FinalStage customCheckoutFields(List customCheckoutFields); + + _FinalStage addCustomCheckoutFields(CheckoutFieldWithValue customCheckoutFields); + + _FinalStage addAllCustomCheckoutFields(List customCheckoutFields); + _FinalStage defaultPlan(Optional defaultPlan); _FinalStage defaultPlan(PlanDetailResponseData defaultPlan); @@ -534,6 +551,8 @@ public static final class Builder private Optional defaultPlan = Optional.empty(); + private List customCheckoutFields = new ArrayList<>(); + private List creditGrants = new ArrayList<>(); private List creditBundles = new ArrayList<>(); @@ -569,6 +588,7 @@ public Builder from(ComponentPreviewResponseData other) { component(other.getComponent()); creditBundles(other.getCreditBundles()); creditGrants(other.getCreditGrants()); + customCheckoutFields(other.getCustomCheckoutFields()); defaultPlan(other.getDefaultPlan()); displaySettings(other.getDisplaySettings()); featureUsage(other.getFeatureUsage()); @@ -793,6 +813,30 @@ public _FinalStage defaultPlan(Optional defaultPlan) { return this; } + @java.lang.Override + public _FinalStage addAllCustomCheckoutFields(List customCheckoutFields) { + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomCheckoutFields(CheckoutFieldWithValue customCheckoutFields) { + this.customCheckoutFields.add(customCheckoutFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_checkout_fields", nulls = Nulls.SKIP) + public _FinalStage customCheckoutFields(List customCheckoutFields) { + this.customCheckoutFields.clear(); + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + @java.lang.Override public _FinalStage addAllCreditGrants(List creditGrants) { if (creditGrants != null) { @@ -992,6 +1036,7 @@ public ComponentPreviewResponseData build() { component, creditBundles, creditGrants, + customCheckoutFields, defaultPlan, displaySettings, featureUsage, diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index b14277a..c336298 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -61,6 +61,8 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional resetType; + private final Optional rolloverPercentage; + private final Map additionalProperties; private CreateBillingPlanCreditGrantRequestBody( @@ -84,6 +86,7 @@ private CreateBillingPlanCreditGrantRequestBody( BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, + Optional rolloverPercentage, Map additionalProperties) { this.applyToExisting = applyToExisting; this.autoTopupAmount = autoTopupAmount; @@ -105,6 +108,7 @@ private CreateBillingPlanCreditGrantRequestBody( this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; + this.rolloverPercentage = rolloverPercentage; this.additionalProperties = additionalProperties; } @@ -208,6 +212,14 @@ public Optional getResetType() { return resetType; } + /** + * @return Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0. + */ + @JsonProperty("rollover_percentage") + public Optional getRolloverPercentage() { + return rolloverPercentage; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -240,7 +252,8 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { && planVersionId.equals(other.planVersionId) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) - && resetType.equals(other.resetType); + && resetType.equals(other.resetType) + && rolloverPercentage.equals(other.rolloverPercentage); } @java.lang.Override @@ -265,7 +278,8 @@ public int hashCode() { this.planVersionId, this.resetCadence, this.resetStart, - this.resetType); + this.resetType, + this.rolloverPercentage); } @java.lang.Override @@ -365,6 +379,13 @@ public interface _FinalStage { _FinalStage resetType(Optional resetType); _FinalStage resetType(BillingPlanCreditGrantResetType resetType); + + /** + *

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0.

+ */ + _FinalStage rolloverPercentage(Optional rolloverPercentage); + + _FinalStage rolloverPercentage(Long rolloverPercentage); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -380,6 +401,8 @@ public static final class Builder private BillingPlanCreditGrantResetStart resetStart; + private Optional rolloverPercentage = Optional.empty(); + private Optional resetType = Optional.empty(); private Optional planVersionId = Optional.empty(); @@ -437,6 +460,7 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); + rolloverPercentage(other.getRolloverPercentage()); return this; } @@ -475,6 +499,26 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta return this; } + /** + *

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0.

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

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. Defaults to 0.

+ */ + @java.lang.Override + @JsonSetter(value = "rollover_percentage", nulls = Nulls.SKIP) + public _FinalStage rolloverPercentage(Optional rolloverPercentage) { + this.rolloverPercentage = rolloverPercentage; + return this; + } + @java.lang.Override public _FinalStage resetType(BillingPlanCreditGrantResetType resetType) { this.resetType = Optional.ofNullable(resetType); @@ -693,6 +737,7 @@ public CreateBillingPlanCreditGrantRequestBody build() { resetCadence, resetStart, resetType, + rolloverPercentage, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java index 7cdca3e..0d06d11 100644 --- a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java +++ b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java @@ -73,8 +73,14 @@ public final class CreditCompanyGrantView { private final Optional renewalPeriod; + private final Optional reserved; + + private final Optional settled; + private final Optional singularName; + private final Optional sourceGrantId; + private final String sourceLabel; private final Optional> transfers; @@ -115,7 +121,10 @@ private CreditCompanyGrantView( double quantityUsed, boolean renewalEnabled, Optional renewalPeriod, + Optional reserved, + Optional settled, Optional singularName, + Optional sourceGrantId, String sourceLabel, Optional> transfers, OffsetDateTime updatedAt, @@ -148,7 +157,10 @@ private CreditCompanyGrantView( this.quantityUsed = quantityUsed; this.renewalEnabled = renewalEnabled; this.renewalPeriod = renewalPeriod; + this.reserved = reserved; + this.settled = settled; this.singularName = singularName; + this.sourceGrantId = sourceGrantId; this.sourceLabel = sourceLabel; this.transfers = transfers; this.updatedAt = updatedAt; @@ -283,11 +295,26 @@ public Optional getRenewalPeriod() { return renewalPeriod; } + @JsonProperty("reserved") + public Optional getReserved() { + return reserved; + } + + @JsonProperty("settled") + public Optional getSettled() { + return settled; + } + @JsonProperty("singular_name") public Optional getSingularName() { return singularName; } + @JsonProperty("source_grant_id") + public Optional getSourceGrantId() { + return sourceGrantId; + } + @JsonProperty("source_label") public String getSourceLabel() { return sourceLabel; @@ -355,7 +382,10 @@ private boolean equalTo(CreditCompanyGrantView other) { && quantityUsed == other.quantityUsed && renewalEnabled == other.renewalEnabled && renewalPeriod.equals(other.renewalPeriod) + && reserved.equals(other.reserved) + && settled.equals(other.settled) && singularName.equals(other.singularName) + && sourceGrantId.equals(other.sourceGrantId) && sourceLabel.equals(other.sourceLabel) && transfers.equals(other.transfers) && updatedAt.equals(other.updatedAt) @@ -392,7 +422,10 @@ public int hashCode() { this.quantityUsed, this.renewalEnabled, this.renewalPeriod, + this.reserved, + this.settled, this.singularName, + this.sourceGrantId, this.sourceLabel, this.transfers, this.updatedAt, @@ -527,10 +560,22 @@ public interface _FinalStage { _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod); + _FinalStage reserved(Optional reserved); + + _FinalStage reserved(Double reserved); + + _FinalStage settled(Optional settled); + + _FinalStage settled(Double settled); + _FinalStage singularName(Optional singularName); _FinalStage singularName(String singularName); + _FinalStage sourceGrantId(Optional sourceGrantId); + + _FinalStage sourceGrantId(String sourceGrantId); + _FinalStage transfers(Optional> transfers); _FinalStage transfers(List transfers); @@ -601,8 +646,14 @@ public static final class Builder private Optional> transfers = Optional.empty(); + private Optional sourceGrantId = Optional.empty(); + private Optional singularName = Optional.empty(); + private Optional settled = Optional.empty(); + + private Optional reserved = Optional.empty(); + private Optional renewalPeriod = Optional.empty(); private Optional price = Optional.empty(); @@ -661,7 +712,10 @@ public Builder from(CreditCompanyGrantView other) { quantityUsed(other.getQuantityUsed()); renewalEnabled(other.getRenewalEnabled()); renewalPeriod(other.getRenewalPeriod()); + reserved(other.getReserved()); + settled(other.getSettled()); singularName(other.getSingularName()); + sourceGrantId(other.getSourceGrantId()); sourceLabel(other.getSourceLabel()); transfers(other.getTransfers()); updatedAt(other.getUpdatedAt()); @@ -821,6 +875,19 @@ public _FinalStage transfers(Optional> transfers) { return this; } + @java.lang.Override + public _FinalStage sourceGrantId(String sourceGrantId) { + this.sourceGrantId = Optional.ofNullable(sourceGrantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "source_grant_id", nulls = Nulls.SKIP) + public _FinalStage sourceGrantId(Optional sourceGrantId) { + this.sourceGrantId = sourceGrantId; + return this; + } + @java.lang.Override public _FinalStage singularName(String singularName) { this.singularName = Optional.ofNullable(singularName); @@ -834,6 +901,32 @@ public _FinalStage singularName(Optional singularName) { return this; } + @java.lang.Override + public _FinalStage settled(Double settled) { + this.settled = Optional.ofNullable(settled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "settled", nulls = Nulls.SKIP) + public _FinalStage settled(Optional settled) { + this.settled = settled; + return this; + } + + @java.lang.Override + public _FinalStage reserved(Double reserved) { + this.reserved = Optional.ofNullable(reserved); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reserved", nulls = Nulls.SKIP) + public _FinalStage reserved(Optional reserved) { + this.reserved = reserved; + return this; + } + @java.lang.Override public _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod) { this.renewalPeriod = Optional.ofNullable(renewalPeriod); @@ -1031,7 +1124,10 @@ public CreditCompanyGrantView build() { quantityUsed, renewalEnabled, renewalPeriod, + reserved, + settled, singularName, + sourceGrantId, sourceLabel, transfers, updatedAt, diff --git a/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java b/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java index 75a5f15..fd523ae 100644 --- a/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java @@ -82,6 +82,8 @@ public final class CreditEventLedgerResponseData { private final Optional usageEventId; + private final Optional usageReason; + private final Optional zeroedOutReason; private final Map additionalProperties; @@ -117,6 +119,7 @@ private CreditEventLedgerResponseData( long sourceId, Optional toGrantId, Optional usageEventId, + Optional usageReason, Optional zeroedOutReason, Map additionalProperties) { this.amount = amount; @@ -149,6 +152,7 @@ private CreditEventLedgerResponseData( this.sourceId = sourceId; this.toGrantId = toGrantId; this.usageEventId = usageEventId; + this.usageReason = usageReason; this.zeroedOutReason = zeroedOutReason; this.additionalProperties = additionalProperties; } @@ -303,6 +307,11 @@ public Optional getUsageEventId() { return usageEventId; } + @JsonProperty("usage_reason") + public Optional getUsageReason() { + return usageReason; + } + @JsonProperty("zeroed_out_reason") public Optional getZeroedOutReason() { return zeroedOutReason; @@ -350,6 +359,7 @@ private boolean equalTo(CreditEventLedgerResponseData other) { && sourceId == other.sourceId && toGrantId.equals(other.toGrantId) && usageEventId.equals(other.usageEventId) + && usageReason.equals(other.usageReason) && zeroedOutReason.equals(other.zeroedOutReason); } @@ -386,6 +396,7 @@ public int hashCode() { this.sourceId, this.toGrantId, this.usageEventId, + this.usageReason, this.zeroedOutReason); } @@ -527,6 +538,10 @@ public interface _FinalStage { _FinalStage usageEventId(String usageEventId); + _FinalStage usageReason(Optional usageReason); + + _FinalStage usageReason(CreditUsageReason usageReason); + _FinalStage zeroedOutReason(Optional zeroedOutReason); _FinalStage zeroedOutReason(BillingCreditGrantZeroedOutReason zeroedOutReason); @@ -564,6 +579,8 @@ public static final class Builder private Optional zeroedOutReason = Optional.empty(); + private Optional usageReason = Optional.empty(); + private Optional usageEventId = Optional.empty(); private Optional toGrantId = Optional.empty(); @@ -643,6 +660,7 @@ public Builder from(CreditEventLedgerResponseData other) { sourceId(other.getSourceId()); toGrantId(other.getToGrantId()); usageEventId(other.getUsageEventId()); + usageReason(other.getUsageReason()); zeroedOutReason(other.getZeroedOutReason()); return this; } @@ -723,6 +741,19 @@ public _FinalStage zeroedOutReason(Optional z return this; } + @java.lang.Override + public _FinalStage usageReason(CreditUsageReason usageReason) { + this.usageReason = Optional.ofNullable(usageReason); + return this; + } + + @java.lang.Override + @JsonSetter(value = "usage_reason", nulls = Nulls.SKIP) + public _FinalStage usageReason(Optional usageReason) { + this.usageReason = usageReason; + return this; + } + @java.lang.Override public _FinalStage usageEventId(String usageEventId) { this.usageEventId = Optional.ofNullable(usageEventId); @@ -1029,6 +1060,7 @@ public CreditEventLedgerResponseData build() { sourceId, toGrantId, usageEventId, + usageReason, zeroedOutReason, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/CreditUsageReason.java b/src/main/java/com/schematic/api/types/CreditUsageReason.java new file mode 100644 index 0000000..b68099c --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditUsageReason.java @@ -0,0 +1,115 @@ +/** + * 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 CreditUsageReason { + public static final CreditUsageReason LEASE_HOLD = new CreditUsageReason(Value.LEASE_HOLD, "lease_hold"); + + public static final CreditUsageReason TRACK = new CreditUsageReason(Value.TRACK, "track"); + + public static final CreditUsageReason MANUAL_ADJUSTMENT = + new CreditUsageReason(Value.MANUAL_ADJUSTMENT, "manual_adjustment"); + + public static final CreditUsageReason LEASE_RELEASE = new CreditUsageReason(Value.LEASE_RELEASE, "lease_release"); + + public static final CreditUsageReason RECONCILIATION = + new CreditUsageReason(Value.RECONCILIATION, "reconciliation"); + + private final Value value; + + private final String string; + + CreditUsageReason(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 CreditUsageReason && this.string.equals(((CreditUsageReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LEASE_HOLD: + return visitor.visitLeaseHold(); + case TRACK: + return visitor.visitTrack(); + case MANUAL_ADJUSTMENT: + return visitor.visitManualAdjustment(); + case LEASE_RELEASE: + return visitor.visitLeaseRelease(); + case RECONCILIATION: + return visitor.visitReconciliation(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditUsageReason valueOf(String value) { + switch (value) { + case "lease_hold": + return LEASE_HOLD; + case "track": + return TRACK; + case "manual_adjustment": + return MANUAL_ADJUSTMENT; + case "lease_release": + return LEASE_RELEASE; + case "reconciliation": + return RECONCILIATION; + default: + return new CreditUsageReason(Value.UNKNOWN, value); + } + } + + public enum Value { + LEASE_HOLD, + + LEASE_RELEASE, + + MANUAL_ADJUSTMENT, + + RECONCILIATION, + + TRACK, + + UNKNOWN + } + + public interface Visitor { + T visitLeaseHold(); + + T visitLeaseRelease(); + + T visitManualAdjustment(); + + T visitReconciliation(); + + T visitTrack(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/EventDetailResponseData.java b/src/main/java/com/schematic/api/types/EventDetailResponseData.java index 4e87284..e6e9d73 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 idempotencyKey; + private final Optional leaseId; + private final Optional loadedAt; private final Optional processedAt; @@ -91,6 +93,7 @@ private EventDetailResponseData( List features, String id, Optional idempotencyKey, + Optional leaseId, Optional loadedAt, Optional processedAt, long quantity, @@ -116,6 +119,7 @@ private EventDetailResponseData( this.features = features; this.id = id; this.idempotencyKey = idempotencyKey; + this.leaseId = leaseId; this.loadedAt = loadedAt; this.processedAt = processedAt; this.quantity = quantity; @@ -199,6 +203,11 @@ public Optional getIdempotencyKey() { return idempotencyKey; } + @JsonProperty("lease_id") + public Optional getLeaseId() { + return leaseId; + } + @JsonProperty("loaded_at") public Optional getLoadedAt() { return loadedAt; @@ -275,6 +284,7 @@ private boolean equalTo(EventDetailResponseData other) { && features.equals(other.features) && id.equals(other.id) && idempotencyKey.equals(other.idempotencyKey) + && leaseId.equals(other.leaseId) && loadedAt.equals(other.loadedAt) && processedAt.equals(other.processedAt) && quantity == other.quantity @@ -304,6 +314,7 @@ public int hashCode() { this.features, this.id, this.idempotencyKey, + this.leaseId, this.loadedAt, this.processedAt, this.quantity, @@ -408,6 +419,10 @@ public interface _FinalStage { _FinalStage idempotencyKey(String idempotencyKey); + _FinalStage leaseId(Optional leaseId); + + _FinalStage leaseId(String leaseId); + _FinalStage loadedAt(Optional loadedAt); _FinalStage loadedAt(OffsetDateTime loadedAt); @@ -466,6 +481,8 @@ public static final class Builder private Optional loadedAt = Optional.empty(); + private Optional leaseId = Optional.empty(); + private Optional idempotencyKey = Optional.empty(); private List features = new ArrayList<>(); @@ -509,6 +526,7 @@ public Builder from(EventDetailResponseData other) { features(other.getFeatures()); id(other.getId()); idempotencyKey(other.getIdempotencyKey()); + leaseId(other.getLeaseId()); loadedAt(other.getLoadedAt()); processedAt(other.getProcessedAt()); quantity(other.getQuantity()); @@ -655,6 +673,19 @@ public _FinalStage loadedAt(Optional loadedAt) { return this; } + @java.lang.Override + public _FinalStage leaseId(String leaseId) { + this.leaseId = Optional.ofNullable(leaseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "lease_id", nulls = Nulls.SKIP) + public _FinalStage leaseId(Optional leaseId) { + this.leaseId = leaseId; + return this; + } + @java.lang.Override public _FinalStage idempotencyKey(String idempotencyKey) { this.idempotencyKey = Optional.ofNullable(idempotencyKey); @@ -848,6 +879,7 @@ public EventDetailResponseData build() { features, id, idempotencyKey, + leaseId, loadedAt, processedAt, quantity, diff --git a/src/main/java/com/schematic/api/types/EventResponseData.java b/src/main/java/com/schematic/api/types/EventResponseData.java index 1beb0dd..ff14bf1 100644 --- a/src/main/java/com/schematic/api/types/EventResponseData.java +++ b/src/main/java/com/schematic/api/types/EventResponseData.java @@ -48,6 +48,8 @@ public final class EventResponseData { private final Optional idempotencyKey; + private final Optional leaseId; + private final Optional loadedAt; private final Optional processedAt; @@ -80,6 +82,7 @@ private EventResponseData( List featureIds, String id, Optional idempotencyKey, + Optional leaseId, Optional loadedAt, Optional processedAt, long quantity, @@ -101,6 +104,7 @@ private EventResponseData( this.featureIds = featureIds; this.id = id; this.idempotencyKey = idempotencyKey; + this.leaseId = leaseId; this.loadedAt = loadedAt; this.processedAt = processedAt; this.quantity = quantity; @@ -168,6 +172,11 @@ public Optional getIdempotencyKey() { return idempotencyKey; } + @JsonProperty("lease_id") + public Optional getLeaseId() { + return leaseId; + } + @JsonProperty("loaded_at") public Optional getLoadedAt() { return loadedAt; @@ -236,6 +245,7 @@ private boolean equalTo(EventResponseData other) { && featureIds.equals(other.featureIds) && id.equals(other.id) && idempotencyKey.equals(other.idempotencyKey) + && leaseId.equals(other.leaseId) && loadedAt.equals(other.loadedAt) && processedAt.equals(other.processedAt) && quantity == other.quantity @@ -261,6 +271,7 @@ public int hashCode() { this.featureIds, this.id, this.idempotencyKey, + this.leaseId, this.loadedAt, this.processedAt, this.quantity, @@ -350,6 +361,10 @@ public interface _FinalStage { _FinalStage idempotencyKey(String idempotencyKey); + _FinalStage leaseId(Optional leaseId); + + _FinalStage leaseId(String leaseId); + _FinalStage loadedAt(Optional loadedAt); _FinalStage loadedAt(OffsetDateTime loadedAt); @@ -402,6 +417,8 @@ public static final class Builder private Optional loadedAt = Optional.empty(); + private Optional leaseId = Optional.empty(); + private Optional idempotencyKey = Optional.empty(); private List featureIds = new ArrayList<>(); @@ -436,6 +453,7 @@ public Builder from(EventResponseData other) { featureIds(other.getFeatureIds()); id(other.getId()); idempotencyKey(other.getIdempotencyKey()); + leaseId(other.getLeaseId()); loadedAt(other.getLoadedAt()); processedAt(other.getProcessedAt()); quantity(other.getQuantity()); @@ -568,6 +586,19 @@ public _FinalStage loadedAt(Optional loadedAt) { return this; } + @java.lang.Override + public _FinalStage leaseId(String leaseId) { + this.leaseId = Optional.ofNullable(leaseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "lease_id", nulls = Nulls.SKIP) + public _FinalStage leaseId(Optional leaseId) { + this.leaseId = leaseId; + return this; + } + @java.lang.Override public _FinalStage idempotencyKey(String idempotencyKey) { this.idempotencyKey = Optional.ofNullable(idempotencyKey); @@ -708,6 +739,7 @@ public EventResponseData build() { featureIds, id, idempotencyKey, + leaseId, loadedAt, processedAt, quantity, diff --git a/src/main/java/com/schematic/api/types/InstallIntegrationRequestBody.java b/src/main/java/com/schematic/api/types/InstallIntegrationRequestBody.java new file mode 100644 index 0000000..b0008f0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/InstallIntegrationRequestBody.java @@ -0,0 +1,286 @@ +/** + * 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.JsonNode; +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 = InstallIntegrationRequestBody.Builder.class) +public final class InstallIntegrationRequestBody { + private final Optional companyMatchingCriteria; + + private final Optional companyMatchingField; + + private final Optional> config; + + private final Optional isSandbox; + + private final Optional liveMode; + + private final IntegrationType type; + + private final Map additionalProperties; + + private InstallIntegrationRequestBody( + Optional companyMatchingCriteria, + Optional companyMatchingField, + Optional> config, + Optional isSandbox, + Optional liveMode, + IntegrationType type, + Map additionalProperties) { + this.companyMatchingCriteria = companyMatchingCriteria; + this.companyMatchingField = companyMatchingField; + this.config = config; + this.isSandbox = isSandbox; + this.liveMode = liveMode; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_matching_criteria") + public Optional getCompanyMatchingCriteria() { + return companyMatchingCriteria; + } + + @JsonProperty("company_matching_field") + public Optional getCompanyMatchingField() { + return companyMatchingField; + } + + @JsonProperty("config") + public Optional> getConfig() { + return config; + } + + @JsonProperty("is_sandbox") + public Optional getIsSandbox() { + return isSandbox; + } + + @JsonProperty("live_mode") + public Optional getLiveMode() { + return liveMode; + } + + @JsonProperty("type") + public IntegrationType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InstallIntegrationRequestBody && equalTo((InstallIntegrationRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InstallIntegrationRequestBody other) { + return companyMatchingCriteria.equals(other.companyMatchingCriteria) + && companyMatchingField.equals(other.companyMatchingField) + && config.equals(other.config) + && isSandbox.equals(other.isSandbox) + && liveMode.equals(other.liveMode) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyMatchingCriteria, + this.companyMatchingField, + this.config, + this.isSandbox, + this.liveMode, + this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull IntegrationType type); + + Builder from(InstallIntegrationRequestBody other); + } + + public interface _FinalStage { + InstallIntegrationRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage companyMatchingCriteria(Optional companyMatchingCriteria); + + _FinalStage companyMatchingCriteria(CompanyMatchingCriteria companyMatchingCriteria); + + _FinalStage companyMatchingField(Optional companyMatchingField); + + _FinalStage companyMatchingField(String companyMatchingField); + + _FinalStage config(Optional> config); + + _FinalStage config(Map config); + + _FinalStage isSandbox(Optional isSandbox); + + _FinalStage isSandbox(Boolean isSandbox); + + _FinalStage liveMode(Optional liveMode); + + _FinalStage liveMode(Boolean liveMode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private IntegrationType type; + + private Optional liveMode = Optional.empty(); + + private Optional isSandbox = Optional.empty(); + + private Optional> config = Optional.empty(); + + private Optional companyMatchingField = Optional.empty(); + + private Optional companyMatchingCriteria = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InstallIntegrationRequestBody other) { + companyMatchingCriteria(other.getCompanyMatchingCriteria()); + companyMatchingField(other.getCompanyMatchingField()); + config(other.getConfig()); + isSandbox(other.getIsSandbox()); + liveMode(other.getLiveMode()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull IntegrationType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage liveMode(Boolean liveMode) { + this.liveMode = Optional.ofNullable(liveMode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "live_mode", nulls = Nulls.SKIP) + public _FinalStage liveMode(Optional liveMode) { + this.liveMode = liveMode; + return this; + } + + @java.lang.Override + public _FinalStage isSandbox(Boolean isSandbox) { + this.isSandbox = Optional.ofNullable(isSandbox); + return this; + } + + @java.lang.Override + @JsonSetter(value = "is_sandbox", nulls = Nulls.SKIP) + public _FinalStage isSandbox(Optional isSandbox) { + this.isSandbox = isSandbox; + return this; + } + + @java.lang.Override + public _FinalStage config(Map config) { + this.config = Optional.ofNullable(config); + return this; + } + + @java.lang.Override + @JsonSetter(value = "config", nulls = Nulls.SKIP) + public _FinalStage config(Optional> config) { + this.config = config; + return this; + } + + @java.lang.Override + public _FinalStage companyMatchingField(String companyMatchingField) { + this.companyMatchingField = Optional.ofNullable(companyMatchingField); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_matching_field", nulls = Nulls.SKIP) + public _FinalStage companyMatchingField(Optional companyMatchingField) { + this.companyMatchingField = companyMatchingField; + return this; + } + + @java.lang.Override + public _FinalStage companyMatchingCriteria(CompanyMatchingCriteria companyMatchingCriteria) { + this.companyMatchingCriteria = Optional.ofNullable(companyMatchingCriteria); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_matching_criteria", nulls = Nulls.SKIP) + public _FinalStage companyMatchingCriteria(Optional companyMatchingCriteria) { + this.companyMatchingCriteria = companyMatchingCriteria; + return this; + } + + @java.lang.Override + public InstallIntegrationRequestBody build() { + return new InstallIntegrationRequestBody( + companyMatchingCriteria, + companyMatchingField, + config, + isSandbox, + liveMode, + type, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/IntegrationConfig.java b/src/main/java/com/schematic/api/types/IntegrationConfig.java index 4f068ca..3d1455d 100644 --- a/src/main/java/com/schematic/api/types/IntegrationConfig.java +++ b/src/main/java/com/schematic/api/types/IntegrationConfig.java @@ -30,6 +30,10 @@ public static IntegrationConfig clerk(ClerkIntegrationConfig value) { return new IntegrationConfig(new ClerkValue(value)); } + public static IntegrationConfig metronome(MetronomeIntegrationConfig value) { + return new IntegrationConfig(new MetronomeValue(value)); + } + public static IntegrationConfig orb(OrbIntegrationConfig value) { return new IntegrationConfig(new OrbValue(value)); } @@ -46,6 +50,10 @@ public boolean isClerk() { return value instanceof ClerkValue; } + public boolean isMetronome() { + return value instanceof MetronomeValue; + } + public boolean isOrb() { return value instanceof OrbValue; } @@ -69,6 +77,13 @@ public Optional getClerk() { return Optional.empty(); } + public Optional getMetronome() { + if (isMetronome()) { + return Optional.of(((MetronomeValue) value).value); + } + return Optional.empty(); + } + public Optional getOrb() { if (isOrb()) { return Optional.of(((OrbValue) value).value); @@ -121,6 +136,8 @@ private Value getValue() { public interface Visitor { T visitClerk(ClerkIntegrationConfig clerk); + T visitMetronome(MetronomeIntegrationConfig metronome); + T visitOrb(OrbIntegrationConfig orb); T visitStripe(StripeIntegrationConfig stripe); @@ -133,6 +150,7 @@ public interface Visitor { @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) @JsonSubTypes({ @JsonSubTypes.Type(ClerkValue.class), + @JsonSubTypes.Type(MetronomeValue.class), @JsonSubTypes.Type(OrbValue.class), @JsonSubTypes.Type(StripeValue.class), @JsonSubTypes.Type(WorkosValue.class) @@ -182,6 +200,46 @@ public String toString() { } } + @JsonTypeName("metronome") + @JsonIgnoreProperties("type") + private static final class MetronomeValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private MetronomeIntegrationConfig value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MetronomeValue() {} + + private MetronomeValue(MetronomeIntegrationConfig value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMetronome(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetronomeValue && equalTo((MetronomeValue) other); + } + + private boolean equalTo(MetronomeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "IntegrationConfig{" + "value: " + value + "}"; + } + } + @JsonTypeName("orb") @JsonIgnoreProperties("type") private static final class OrbValue implements Value { diff --git a/src/main/java/com/schematic/api/types/IntegrationInstallConfig.java b/src/main/java/com/schematic/api/types/IntegrationInstallConfig.java new file mode 100644 index 0000000..363b4ed --- /dev/null +++ b/src/main/java/com/schematic/api/types/IntegrationInstallConfig.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IntegrationInstallConfig.Builder.class) +public final class IntegrationInstallConfig { + private final Optional companyMatchingCriteria; + + private final Optional companyMatchingField; + + private final Optional config; + + private final OffsetDateTime createdAt; + + private final String id; + + private final String integrationId; + + private final boolean isAppInstall; + + private final boolean isConnectInstall; + + private final boolean liveMode; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private IntegrationInstallConfig( + Optional companyMatchingCriteria, + Optional companyMatchingField, + Optional config, + OffsetDateTime createdAt, + String id, + String integrationId, + boolean isAppInstall, + boolean isConnectInstall, + boolean liveMode, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.companyMatchingCriteria = companyMatchingCriteria; + this.companyMatchingField = companyMatchingField; + this.config = config; + this.createdAt = createdAt; + this.id = id; + this.integrationId = integrationId; + this.isAppInstall = isAppInstall; + this.isConnectInstall = isConnectInstall; + this.liveMode = liveMode; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_matching_criteria") + public Optional getCompanyMatchingCriteria() { + return companyMatchingCriteria; + } + + @JsonProperty("company_matching_field") + public Optional getCompanyMatchingField() { + return companyMatchingField; + } + + @JsonProperty("config") + public Optional getConfig() { + return config; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("integration_id") + public String getIntegrationId() { + return integrationId; + } + + @JsonProperty("is_app_install") + public boolean getIsAppInstall() { + return isAppInstall; + } + + @JsonProperty("is_connect_install") + public boolean getIsConnectInstall() { + return isConnectInstall; + } + + @JsonProperty("live_mode") + public boolean getLiveMode() { + return liveMode; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IntegrationInstallConfig && equalTo((IntegrationInstallConfig) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IntegrationInstallConfig other) { + return companyMatchingCriteria.equals(other.companyMatchingCriteria) + && companyMatchingField.equals(other.companyMatchingField) + && config.equals(other.config) + && createdAt.equals(other.createdAt) + && id.equals(other.id) + && integrationId.equals(other.integrationId) + && isAppInstall == other.isAppInstall + && isConnectInstall == other.isConnectInstall + && liveMode == other.liveMode + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyMatchingCriteria, + this.companyMatchingField, + this.config, + this.createdAt, + this.id, + this.integrationId, + this.isAppInstall, + this.isConnectInstall, + this.liveMode, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + IdStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(IntegrationInstallConfig other); + } + + public interface IdStage { + IntegrationIdStage id(@NotNull String id); + } + + public interface IntegrationIdStage { + IsAppInstallStage integrationId(@NotNull String integrationId); + } + + public interface IsAppInstallStage { + IsConnectInstallStage isAppInstall(boolean isAppInstall); + } + + public interface IsConnectInstallStage { + LiveModeStage isConnectInstall(boolean isConnectInstall); + } + + public interface LiveModeStage { + UpdatedAtStage liveMode(boolean liveMode); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + IntegrationInstallConfig build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage companyMatchingCriteria(Optional companyMatchingCriteria); + + _FinalStage companyMatchingCriteria(CompanyMatchingCriteria companyMatchingCriteria); + + _FinalStage companyMatchingField(Optional companyMatchingField); + + _FinalStage companyMatchingField(String companyMatchingField); + + _FinalStage config(Optional config); + + _FinalStage config(IntegrationConfig config); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + IdStage, + IntegrationIdStage, + IsAppInstallStage, + IsConnectInstallStage, + LiveModeStage, + UpdatedAtStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private String integrationId; + + private boolean isAppInstall; + + private boolean isConnectInstall; + + private boolean liveMode; + + private OffsetDateTime updatedAt; + + private Optional config = Optional.empty(); + + private Optional companyMatchingField = Optional.empty(); + + private Optional companyMatchingCriteria = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IntegrationInstallConfig other) { + companyMatchingCriteria(other.getCompanyMatchingCriteria()); + companyMatchingField(other.getCompanyMatchingField()); + config(other.getConfig()); + createdAt(other.getCreatedAt()); + id(other.getId()); + integrationId(other.getIntegrationId()); + isAppInstall(other.getIsAppInstall()); + isConnectInstall(other.getIsConnectInstall()); + liveMode(other.getLiveMode()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IntegrationIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("integration_id") + public IsAppInstallStage integrationId(@NotNull String integrationId) { + this.integrationId = Objects.requireNonNull(integrationId, "integrationId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_app_install") + public IsConnectInstallStage isAppInstall(boolean isAppInstall) { + this.isAppInstall = isAppInstall; + return this; + } + + @java.lang.Override + @JsonSetter("is_connect_install") + public LiveModeStage isConnectInstall(boolean isConnectInstall) { + this.isConnectInstall = isConnectInstall; + return this; + } + + @java.lang.Override + @JsonSetter("live_mode") + public UpdatedAtStage liveMode(boolean liveMode) { + this.liveMode = liveMode; + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage config(IntegrationConfig config) { + this.config = Optional.ofNullable(config); + return this; + } + + @java.lang.Override + @JsonSetter(value = "config", nulls = Nulls.SKIP) + public _FinalStage config(Optional config) { + this.config = config; + return this; + } + + @java.lang.Override + public _FinalStage companyMatchingField(String companyMatchingField) { + this.companyMatchingField = Optional.ofNullable(companyMatchingField); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_matching_field", nulls = Nulls.SKIP) + public _FinalStage companyMatchingField(Optional companyMatchingField) { + this.companyMatchingField = companyMatchingField; + return this; + } + + @java.lang.Override + public _FinalStage companyMatchingCriteria(CompanyMatchingCriteria companyMatchingCriteria) { + this.companyMatchingCriteria = Optional.ofNullable(companyMatchingCriteria); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_matching_criteria", nulls = Nulls.SKIP) + public _FinalStage companyMatchingCriteria(Optional companyMatchingCriteria) { + this.companyMatchingCriteria = companyMatchingCriteria; + return this; + } + + @java.lang.Override + public IntegrationInstallConfig build() { + return new IntegrationInstallConfig( + companyMatchingCriteria, + companyMatchingField, + config, + createdAt, + id, + integrationId, + isAppInstall, + isConnectInstall, + liveMode, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/IntegrationInstallResponseData.java b/src/main/java/com/schematic/api/types/IntegrationInstallResponseData.java new file mode 100644 index 0000000..e4851dc --- /dev/null +++ b/src/main/java/com/schematic/api/types/IntegrationInstallResponseData.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = IntegrationInstallResponseData.Builder.class) +public final class IntegrationInstallResponseData { + private final IntegrationCapabilities capabilities; + + private final IntegrationInstallConfig config; + + private final IntegrationResponseData integration; + + private final Map additionalProperties; + + private IntegrationInstallResponseData( + IntegrationCapabilities capabilities, + IntegrationInstallConfig config, + IntegrationResponseData integration, + Map additionalProperties) { + this.capabilities = capabilities; + this.config = config; + this.integration = integration; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("capabilities") + public IntegrationCapabilities getCapabilities() { + return capabilities; + } + + @JsonProperty("config") + public IntegrationInstallConfig getConfig() { + return config; + } + + @JsonProperty("integration") + public IntegrationResponseData getIntegration() { + return integration; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IntegrationInstallResponseData && equalTo((IntegrationInstallResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IntegrationInstallResponseData other) { + return capabilities.equals(other.capabilities) + && config.equals(other.config) + && integration.equals(other.integration); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.capabilities, this.config, this.integration); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CapabilitiesStage builder() { + return new Builder(); + } + + public interface CapabilitiesStage { + ConfigStage capabilities(@NotNull IntegrationCapabilities capabilities); + + Builder from(IntegrationInstallResponseData other); + } + + public interface ConfigStage { + IntegrationStage config(@NotNull IntegrationInstallConfig config); + } + + public interface IntegrationStage { + _FinalStage integration(@NotNull IntegrationResponseData integration); + } + + public interface _FinalStage { + IntegrationInstallResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CapabilitiesStage, ConfigStage, IntegrationStage, _FinalStage { + private IntegrationCapabilities capabilities; + + private IntegrationInstallConfig config; + + private IntegrationResponseData integration; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IntegrationInstallResponseData other) { + capabilities(other.getCapabilities()); + config(other.getConfig()); + integration(other.getIntegration()); + return this; + } + + @java.lang.Override + @JsonSetter("capabilities") + public ConfigStage capabilities(@NotNull IntegrationCapabilities capabilities) { + this.capabilities = Objects.requireNonNull(capabilities, "capabilities must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("config") + public IntegrationStage config(@NotNull IntegrationInstallConfig config) { + this.config = Objects.requireNonNull(config, "config must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("integration") + public _FinalStage integration(@NotNull IntegrationResponseData integration) { + this.integration = Objects.requireNonNull(integration, "integration must not be null"); + return this; + } + + @java.lang.Override + public IntegrationInstallResponseData build() { + return new IntegrationInstallResponseData(capabilities, config, integration, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/IntegrationType.java b/src/main/java/com/schematic/api/types/IntegrationType.java index d00ec85..6801eab 100644 --- a/src/main/java/com/schematic/api/types/IntegrationType.java +++ b/src/main/java/com/schematic/api/types/IntegrationType.java @@ -13,6 +13,8 @@ public final class IntegrationType { public static final IntegrationType WORKOS = new IntegrationType(Value.WORKOS, "workos"); + public static final IntegrationType METRONOME = new IntegrationType(Value.METRONOME, "metronome"); + public static final IntegrationType CLERK = new IntegrationType(Value.CLERK, "clerk"); public static final IntegrationType STRIPE = new IntegrationType(Value.STRIPE, "stripe"); @@ -55,6 +57,8 @@ public T visit(Visitor visitor) { return visitor.visitUnknown(); case WORKOS: return visitor.visitWorkos(); + case METRONOME: + return visitor.visitMetronome(); case CLERK: return visitor.visitClerk(); case STRIPE: @@ -74,6 +78,8 @@ public static IntegrationType valueOf(String value) { return UNKNOWN; case "workos": return WORKOS; + case "metronome": + return METRONOME; case "clerk": return CLERK; case "stripe": @@ -86,6 +92,8 @@ public static IntegrationType valueOf(String value) { public enum Value { CLERK, + METRONOME, + ORB, STRIPE, @@ -100,6 +108,8 @@ public enum Value { public interface Visitor { T visitClerk(); + T visitMetronome(); + T visitOrb(); T visitStripe(); diff --git a/src/main/java/com/schematic/api/types/ManagePlanRequest.java b/src/main/java/com/schematic/api/types/ManagePlanRequest.java index eaad86b..b03e7c6 100644 --- a/src/main/java/com/schematic/api/types/ManagePlanRequest.java +++ b/src/main/java/com/schematic/api/types/ManagePlanRequest.java @@ -40,6 +40,8 @@ public final class ManagePlanRequest { private final List creditBundles; + private final List customFieldValues; + private final List payInAdvanceEntitlements; private final Optional paymentMethodExternalId; @@ -61,6 +63,7 @@ private ManagePlanRequest( String companyId, Optional couponExternalId, List creditBundles, + List customFieldValues, List payInAdvanceEntitlements, Optional paymentMethodExternalId, Optional promoCode, @@ -75,6 +78,7 @@ private ManagePlanRequest( this.companyId = companyId; this.couponExternalId = couponExternalId; this.creditBundles = creditBundles; + this.customFieldValues = customFieldValues; this.payInAdvanceEntitlements = payInAdvanceEntitlements; this.paymentMethodExternalId = paymentMethodExternalId; this.promoCode = promoCode; @@ -126,6 +130,11 @@ public List getCreditBundles() { return creditBundles; } + @JsonProperty("custom_field_values") + public List getCustomFieldValues() { + return customFieldValues; + } + @JsonProperty("pay_in_advance_entitlements") public List getPayInAdvanceEntitlements() { return payInAdvanceEntitlements; @@ -174,6 +183,7 @@ private boolean equalTo(ManagePlanRequest other) { && companyId.equals(other.companyId) && couponExternalId.equals(other.couponExternalId) && creditBundles.equals(other.creditBundles) + && customFieldValues.equals(other.customFieldValues) && payInAdvanceEntitlements.equals(other.payInAdvanceEntitlements) && paymentMethodExternalId.equals(other.paymentMethodExternalId) && promoCode.equals(other.promoCode) @@ -192,6 +202,7 @@ public int hashCode() { this.companyId, this.couponExternalId, this.creditBundles, + this.customFieldValues, this.payInAdvanceEntitlements, this.paymentMethodExternalId, this.promoCode, @@ -256,6 +267,12 @@ public interface _FinalStage { _FinalStage addAllCreditBundles(List creditBundles); + _FinalStage customFieldValues(List customFieldValues); + + _FinalStage addCustomFieldValues(CheckoutFieldValue customFieldValues); + + _FinalStage addAllCustomFieldValues(List customFieldValues); + _FinalStage payInAdvanceEntitlements(List payInAdvanceEntitlements); _FinalStage addPayInAdvanceEntitlements(UpdatePayInAdvanceRequestBody payInAdvanceEntitlements); @@ -296,6 +313,8 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private List payInAdvanceEntitlements = new ArrayList<>(); + private List customFieldValues = new ArrayList<>(); + private List creditBundles = new ArrayList<>(); private Optional couponExternalId = Optional.empty(); @@ -325,6 +344,7 @@ public Builder from(ManagePlanRequest other) { companyId(other.getCompanyId()); couponExternalId(other.getCouponExternalId()); creditBundles(other.getCreditBundles()); + customFieldValues(other.getCustomFieldValues()); payInAdvanceEntitlements(other.getPayInAdvanceEntitlements()); paymentMethodExternalId(other.getPaymentMethodExternalId()); promoCode(other.getPromoCode()); @@ -424,6 +444,30 @@ public _FinalStage payInAdvanceEntitlements(List return this; } + @java.lang.Override + public _FinalStage addAllCustomFieldValues(List customFieldValues) { + if (customFieldValues != null) { + this.customFieldValues.addAll(customFieldValues); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomFieldValues(CheckoutFieldValue customFieldValues) { + this.customFieldValues.add(customFieldValues); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_field_values", nulls = Nulls.SKIP) + public _FinalStage customFieldValues(List customFieldValues) { + this.customFieldValues.clear(); + if (customFieldValues != null) { + this.customFieldValues.addAll(customFieldValues); + } + return this; + } + @java.lang.Override public _FinalStage addAllCreditBundles(List creditBundles) { if (creditBundles != null) { @@ -555,6 +599,7 @@ public ManagePlanRequest build() { companyId, couponExternalId, creditBundles, + customFieldValues, payInAdvanceEntitlements, paymentMethodExternalId, promoCode, diff --git a/src/main/java/com/schematic/api/types/MetronomeIntegrationConfig.java b/src/main/java/com/schematic/api/types/MetronomeIntegrationConfig.java new file mode 100644 index 0000000..5d4e2ff --- /dev/null +++ b/src/main/java/com/schematic/api/types/MetronomeIntegrationConfig.java @@ -0,0 +1,69 @@ +/** + * 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.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MetronomeIntegrationConfig.Builder.class) +public final class MetronomeIntegrationConfig { + private final Map additionalProperties; + + private MetronomeIntegrationConfig(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetronomeIntegrationConfig; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @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 { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MetronomeIntegrationConfig other) { + return this; + } + + public MetronomeIntegrationConfig build() { + return new MetronomeIntegrationConfig(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/MigrationErrorCode.java b/src/main/java/com/schematic/api/types/MigrationErrorCode.java index 64c7e3e..e967a2b 100644 --- a/src/main/java/com/schematic/api/types/MigrationErrorCode.java +++ b/src/main/java/com/schematic/api/types/MigrationErrorCode.java @@ -28,6 +28,9 @@ public final class MigrationErrorCode { public static final MigrationErrorCode NO_PRICE_FOR_INTERVAL = new MigrationErrorCode(Value.NO_PRICE_FOR_INTERVAL, "no_price_for_interval"); + public static final MigrationErrorCode OPERATION_ITEM_NOT_FOUND = + new MigrationErrorCode(Value.OPERATION_ITEM_NOT_FOUND, "operation_item_not_found"); + public static final MigrationErrorCode PERMANENT_CONFIG = new MigrationErrorCode(Value.PERMANENT_CONFIG, "permanent_config"); @@ -85,6 +88,8 @@ public T visit(Visitor visitor) { return visitor.visitMultipleSubscriptions(); case NO_PRICE_FOR_INTERVAL: return visitor.visitNoPriceForInterval(); + case OPERATION_ITEM_NOT_FOUND: + return visitor.visitOperationItemNotFound(); case PERMANENT_CONFIG: return visitor.visitPermanentConfig(); case UNKNOWN: @@ -116,6 +121,8 @@ public static MigrationErrorCode valueOf(String value) { return MULTIPLE_SUBSCRIPTIONS; case "no_price_for_interval": return NO_PRICE_FOR_INTERVAL; + case "operation_item_not_found": + return OPERATION_ITEM_NOT_FOUND; case "permanent_config": return PERMANENT_CONFIG; case "unknown": @@ -138,6 +145,8 @@ public enum Value { NOT_ON_ORIGIN_VERSION, + OPERATION_ITEM_NOT_FOUND, + PERMANENT_CONFIG, PERMANENT_DECLINE, @@ -164,6 +173,8 @@ public interface Visitor { T visitNotOnOriginVersion(); + T visitOperationItemNotFound(); + T visitPermanentConfig(); T visitPermanentDecline(); diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java index f94f42d..35b87eb 100644 --- a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java @@ -76,6 +76,8 @@ public final class PlanCreditGrantView { private final BillingPlanCreditGrantResetType resetType; + private final long rolloverPercentage; + private final Optional singularName; private final OffsetDateTime updatedAt; @@ -110,6 +112,7 @@ private PlanCreditGrantView( Optional resetCadence, Optional resetStart, BillingPlanCreditGrantResetType resetType, + long rolloverPercentage, Optional singularName, OffsetDateTime updatedAt, Map additionalProperties) { @@ -140,6 +143,7 @@ private PlanCreditGrantView( this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; + this.rolloverPercentage = rolloverPercentage; this.singularName = singularName; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -292,6 +296,11 @@ public BillingPlanCreditGrantResetType getResetType() { return resetType; } + @JsonProperty("rollover_percentage") + public long getRolloverPercentage() { + return rolloverPercentage; + } + /** * @return Deprecated field, will be removed in the future. Use Credit.SingularName instead. */ @@ -344,6 +353,7 @@ private boolean equalTo(PlanCreditGrantView other) { && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) + && rolloverPercentage == other.rolloverPercentage && singularName.equals(other.singularName) && updatedAt.equals(other.updatedAt); } @@ -378,6 +388,7 @@ public int hashCode() { this.resetCadence, this.resetStart, this.resetType, + this.rolloverPercentage, this.singularName, this.updatedAt); } @@ -436,7 +447,11 @@ public interface PlanIdStage { } public interface ResetTypeStage { - UpdatedAtStage resetType(@NotNull BillingPlanCreditGrantResetType resetType); + RolloverPercentageStage resetType(@NotNull BillingPlanCreditGrantResetType resetType); + } + + public interface RolloverPercentageStage { + UpdatedAtStage rolloverPercentage(long rolloverPercentage); } public interface UpdatedAtStage { @@ -546,6 +561,7 @@ public static final class Builder IdStage, PlanIdStage, ResetTypeStage, + RolloverPercentageStage, UpdatedAtStage, _FinalStage { private boolean billingCreditAutoTopupEnabled; @@ -568,6 +584,8 @@ public static final class Builder private BillingPlanCreditGrantResetType resetType; + private long rolloverPercentage; + private OffsetDateTime updatedAt; private Optional singularName = Optional.empty(); @@ -640,6 +658,7 @@ public Builder from(PlanCreditGrantView other) { resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); + rolloverPercentage(other.getRolloverPercentage()); singularName(other.getSingularName()); updatedAt(other.getUpdatedAt()); return this; @@ -721,11 +740,18 @@ public ResetTypeStage planId(@NotNull String planId) { @java.lang.Override @JsonSetter("reset_type") - public UpdatedAtStage resetType(@NotNull BillingPlanCreditGrantResetType resetType) { + public RolloverPercentageStage resetType(@NotNull BillingPlanCreditGrantResetType resetType) { this.resetType = Objects.requireNonNull(resetType, "resetType must not be null"); return this; } + @java.lang.Override + @JsonSetter("rollover_percentage") + public UpdatedAtStage rolloverPercentage(long rolloverPercentage) { + this.rolloverPercentage = rolloverPercentage; + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -1022,6 +1048,7 @@ public PlanCreditGrantView build() { resetCadence, resetStart, resetType, + rolloverPercentage, singularName, updatedAt, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java index fc4658f..8ad8444 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java @@ -29,6 +29,8 @@ public final class PlanGroupDetailResponseData { private final ComponentSettingsResponseData componentSettings; + private final List customCheckoutFields; + private final Optional customPlanConfig; private final Optional customPlanId; @@ -103,6 +105,7 @@ private PlanGroupDetailResponseData( List addOns, CheckoutSettingsResponseData checkoutSettings, ComponentSettingsResponseData componentSettings, + List customCheckoutFields, Optional customPlanConfig, Optional customPlanId, Optional defaultPlan, @@ -141,6 +144,7 @@ private PlanGroupDetailResponseData( this.addOns = addOns; this.checkoutSettings = checkoutSettings; this.componentSettings = componentSettings; + this.customCheckoutFields = customCheckoutFields; this.customPlanConfig = customPlanConfig; this.customPlanId = customPlanId; this.defaultPlan = defaultPlan; @@ -193,6 +197,11 @@ public ComponentSettingsResponseData getComponentSettings() { return componentSettings; } + @JsonProperty("custom_checkout_fields") + public List getCustomCheckoutFields() { + return customCheckoutFields; + } + @JsonProperty("custom_plan_config") public Optional getCustomPlanConfig() { return customPlanConfig; @@ -378,6 +387,7 @@ private boolean equalTo(PlanGroupDetailResponseData other) { return addOns.equals(other.addOns) && checkoutSettings.equals(other.checkoutSettings) && componentSettings.equals(other.componentSettings) + && customCheckoutFields.equals(other.customCheckoutFields) && customPlanConfig.equals(other.customPlanConfig) && customPlanId.equals(other.customPlanId) && defaultPlan.equals(other.defaultPlan) @@ -420,6 +430,7 @@ public int hashCode() { this.addOns, this.checkoutSettings, this.componentSettings, + this.customCheckoutFields, this.customPlanConfig, this.customPlanId, this.defaultPlan, @@ -528,6 +539,12 @@ public interface _FinalStage { _FinalStage addAllAddOns(List addOns); + _FinalStage customCheckoutFields(List customCheckoutFields); + + _FinalStage addCustomCheckoutFields(CheckoutFieldResponseData customCheckoutFields); + + _FinalStage addAllCustomCheckoutFields(List customCheckoutFields); + _FinalStage customPlanConfig(Optional customPlanConfig); _FinalStage customPlanConfig(CustomPlanViewConfigResponseData customPlanConfig); @@ -720,6 +737,8 @@ public static final class Builder private Optional customPlanConfig = Optional.empty(); + private List customCheckoutFields = new ArrayList<>(); + private List addOns = new ArrayList<>(); @JsonAnySetter @@ -732,6 +751,7 @@ public Builder from(PlanGroupDetailResponseData other) { addOns(other.getAddOns()); checkoutSettings(other.getCheckoutSettings()); componentSettings(other.getComponentSettings()); + customCheckoutFields(other.getCustomCheckoutFields()); customPlanConfig(other.getCustomPlanConfig()); customPlanId(other.getCustomPlanId()); defaultPlan(other.getDefaultPlan()); @@ -1211,6 +1231,30 @@ public _FinalStage customPlanConfig(Optional c return this; } + @java.lang.Override + public _FinalStage addAllCustomCheckoutFields(List customCheckoutFields) { + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomCheckoutFields(CheckoutFieldResponseData customCheckoutFields) { + this.customCheckoutFields.add(customCheckoutFields); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_checkout_fields", nulls = Nulls.SKIP) + public _FinalStage customCheckoutFields(List customCheckoutFields) { + this.customCheckoutFields.clear(); + if (customCheckoutFields != null) { + this.customCheckoutFields.addAll(customCheckoutFields); + } + return this; + } + @java.lang.Override public _FinalStage addAllAddOns(List addOns) { if (addOns != null) { @@ -1241,6 +1285,7 @@ public PlanGroupDetailResponseData build() { addOns, checkoutSettings, componentSettings, + customCheckoutFields, customPlanConfig, customPlanId, defaultPlan, diff --git a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java index ff64498..b19f7bd 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -55,6 +55,8 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional resetType; + private final Optional rolloverPercentage; + private final Map additionalProperties; private UpdateBillingPlanCreditGrantRequestBody( @@ -75,6 +77,7 @@ private UpdateBillingPlanCreditGrantRequestBody( BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, + Optional rolloverPercentage, Map additionalProperties) { this.applyToExisting = applyToExisting; this.autoTopupAmount = autoTopupAmount; @@ -93,6 +96,7 @@ private UpdateBillingPlanCreditGrantRequestBody( this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; + this.rolloverPercentage = rolloverPercentage; this.additionalProperties = additionalProperties; } @@ -181,6 +185,14 @@ public Optional getResetType() { return resetType; } + /** + * @return Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again. + */ + @JsonProperty("rollover_percentage") + public Optional getRolloverPercentage() { + return rolloverPercentage; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -210,7 +222,8 @@ private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { && expiryUnitCount.equals(other.expiryUnitCount) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) - && resetType.equals(other.resetType); + && resetType.equals(other.resetType) + && rolloverPercentage.equals(other.rolloverPercentage); } @java.lang.Override @@ -232,7 +245,8 @@ public int hashCode() { this.expiryUnitCount, this.resetCadence, this.resetStart, - this.resetType); + this.resetType, + this.rolloverPercentage); } @java.lang.Override @@ -320,6 +334,13 @@ public interface _FinalStage { _FinalStage resetType(Optional resetType); _FinalStage resetType(BillingPlanCreditGrantResetType resetType); + + /** + *

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again.

+ */ + _FinalStage rolloverPercentage(Optional rolloverPercentage); + + _FinalStage rolloverPercentage(Long rolloverPercentage); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -328,6 +349,8 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private BillingPlanCreditGrantResetStart resetStart; + private Optional rolloverPercentage = Optional.empty(); + private Optional resetType = Optional.empty(); private Optional expiryUnitCount = Optional.empty(); @@ -382,6 +405,7 @@ public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); + rolloverPercentage(other.getRolloverPercentage()); return this; } @@ -399,6 +423,26 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta return this; } + /** + *

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again.

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

Percentage of unused credits that carry over when this grant resets. Only applies when reset_type is plan_period. Rolled-over credits expire at the next reset and are not rolled again.

+ */ + @java.lang.Override + @JsonSetter(value = "rollover_percentage", nulls = Nulls.SKIP) + public _FinalStage rolloverPercentage(Optional rolloverPercentage) { + this.rolloverPercentage = rolloverPercentage; + return this; + } + @java.lang.Override public _FinalStage resetType(BillingPlanCreditGrantResetType resetType) { this.resetType = Optional.ofNullable(resetType); @@ -614,6 +658,7 @@ public UpdateBillingPlanCreditGrantRequestBody build() { resetCadence, resetStart, resetType, + rolloverPercentage, additionalProperties); }