From 42874116a8f53bb07efbb73add2fedb204649c05 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:10:19 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.32.4 --- .fern/metadata.json | 8 +- build.gradle | 4 +- reference.md | 706 ++++++----- .../com/schematic/api/AsyncBaseSchematic.java | 139 +++ .../schematic/api/AsyncRawBaseSchematic.java | 435 +++++++ .../com/schematic/api/RawBaseSchematic.java | 313 +++++ .../com/schematic/api/core/ClientOptions.java | 4 +- .../com/schematic/api/core/PathSegments.java | 21 + .../resources/accounts/AccountsClient.java | 79 -- .../accounts/AsyncAccountsClient.java | 209 ---- .../accounts/AsyncRawAccountsClient.java | 992 +++------------- .../resources/accounts/RawAccountsClient.java | 521 +------- .../requests/CreateApiKeyRequestBody.java | 254 ---- .../requests/UpdateApiKeyRequestBody.java | 164 --- .../UpdateEnvironmentRequestBody.java | 166 --- .../accounts/types/DeleteApiKeyResponse.java | 188 --- .../accounts/types/UpdateApiKeyResponse.java | 188 --- .../types/UpdateEnvironmentResponse.java | 188 --- .../resources/billing/AsyncBillingClient.java | 112 +- .../billing/AsyncRawBillingClient.java | 136 ++- .../api/resources/billing/BillingClient.java | 64 +- .../resources/billing/RawBillingClient.java | 126 +- ....java => CountBillingInvoicesRequest.java} | 158 ++- .../CreatePaymentMethodRequestBody.java | 35 + ...t.java => ListBillingInvoicesRequest.java} | 158 ++- ...s.java => CountBillingInvoicesParams.java} | 162 ++- ...java => CountBillingInvoicesResponse.java} | 32 +- ...se.java => GetBillingInvoiceResponse.java} | 20 +- ...ms.java => ListBillingInvoicesParams.java} | 162 ++- ....java => ListBillingInvoicesResponse.java} | 32 +- ...va => MarkBillingInvoicePaidResponse.java} | 20 +- .../catalogs/AsyncCatalogsClient.java | 51 + .../catalogs/AsyncRawCatalogsClient.java | 232 +++- .../resources/catalogs/CatalogsClient.java | 18 + .../resources/catalogs/RawCatalogsClient.java | 173 ++- .../types/GetPublicCatalogByIdResponse.java} | 36 +- .../types/GetPublicCatalogResponse.java} | 36 +- .../checkout/AsyncRawCheckoutClient.java | 7 +- .../resources/checkout/RawCheckoutClient.java | 7 +- .../companies/AsyncRawCompaniesClient.java | 25 +- .../companies/RawCompaniesClient.java | 25 +- .../components/AsyncRawComponentsClient.java | 9 +- .../components/RawComponentsClient.java | 9 +- .../resources/credits/AsyncCreditsClient.java | 26 + .../credits/AsyncRawCreditsClient.java | 143 ++- .../api/resources/credits/CreditsClient.java | 12 + .../resources/credits/RawCreditsClient.java | 114 +- .../CountCreditEventLedgerRequest.java | 46 + .../CreateCreditSpendPolicyRequestBody.java | 8 +- .../ListCreditEventLedgerRequest.java | 46 + .../types/CountCreditEventLedgerParams.java | 33 + .../GetCreditEventLedgerEntryResponse.java} | 36 +- .../types/ListCreditEventLedgerParams.java | 33 + .../AsyncRawDataexportsClient.java | 5 +- .../dataexports/RawDataexportsClient.java | 5 +- .../AsyncRawEntitlementsClient.java | 13 +- .../entitlements/RawEntitlementsClient.java | 13 +- .../events/AsyncRawEventsClient.java | 3 +- .../api/resources/events/RawEventsClient.java | 3 +- .../features/AsyncRawFeaturesClient.java | 19 +- .../resources/features/RawFeaturesClient.java | 19 +- .../AsyncRawIntegrationsapiClient.java | 7 +- .../RawIntegrationsapiClient.java | 7 +- .../licenses/AsyncRawLicensesClient.java | 3 +- .../resources/licenses/RawLicensesClient.java | 3 +- .../planbundle/AsyncRawPlanbundleClient.java | 3 +- .../planbundle/RawPlanbundleClient.java | 3 +- .../CreateCustomPlanBundleRequestBody.java | 40 +- .../requests/CreatePlanBundleRequestBody.java | 40 +- .../requests/UpdatePlanBundleRequestBody.java | 52 +- .../plangroups/AsyncRawPlangroupsClient.java | 3 +- .../plangroups/RawPlangroupsClient.java | 3 +- .../AsyncRawPlanmigrationsClient.java | 11 +- .../RawPlanmigrationsClient.java | 11 +- .../resources/plans/AsyncRawPlansClient.java | 23 +- .../api/resources/plans/RawPlansClient.java | 23 +- .../RetryCustomPlanBillingRequestBody.java | 46 + .../AsyncRawScheduledcheckoutClient.java | 5 +- .../RawScheduledcheckoutClient.java | 5 +- .../webhooks/AsyncRawWebhooksClient.java | 11 +- .../resources/webhooks/RawWebhooksClient.java | 11 +- .../api/types/ApiKeyCreateResponseData.java | 515 -------- .../BillingInvoiceAddressResponseData.java | 254 ++++ ...lingInvoiceBillingDetailsResponseData.java | 202 ++++ .../BillingInvoiceDetailResponseData.java | 552 +++++++-- .../types/BillingInvoiceLineResponseData.java | 149 ++- .../api/types/BillingInvoiceResponseData.java | 386 ++++-- .../BillingInvoiceSettlementResponseData.java | 57 +- .../BillingInvoiceTaxIdResponseData.java} | 82 +- .../BillingInvoiceTermsResponseData.java | 50 +- .../BillingPlanCreditGrantResponseData.java | 69 +- ...lanCreditGrantWarningTierResponseData.java | 181 +++ ...atalogBundleCurrencyPriceResponseData.java | 190 +++ .../CatalogCapabilitiesResponseData.java | 157 +++ .../CatalogCreditBundleResponseData.java | 640 ++++++++++ .../types/CatalogCreditGrantResponseData.java | 459 +++++++ .../CatalogCurrencyPricesResponseData.java | 254 ++++ .../CatalogCustomPlanCtaResponseData.java | 162 +++ .../api/types/CatalogDetailResponseData.java | 369 ++++++ .../types/CatalogEntitlementResponseData.java | 1021 ++++++++++++++++ .../CatalogPlanEntitlementResponseData.java | 1050 +++++++++++++++++ .../api/types/CatalogPlanResponseData.java | 699 +++++++++++ .../api/types/CatalogPriceResponseData.java | 472 ++++++++ .../types/CatalogPriceTierResponseData.java | 276 +++++ .../api/types/CheckoutChargeTiming.java | 93 ++ .../api/types/CheckoutProblemCode.java | 44 + ...eateBillingPlanCreditGrantRequestBody.java | 52 +- .../api/types/CreditSpendWindowUnit.java | 20 + .../types/CustomPlanBillingResponseData.java | 46 + .../schematic/api/types/EntitlementType.java | 11 + .../types/EnvironmentDetailResponseData.java | 322 ----- .../com/schematic/api/types/EventBody.java | 40 +- ...aymentMethodBillingDetailsRequestBody.java | 161 +++ ...PlanCreditGrantWarningTierRequestBody.java | 168 +++ ...onMigrationPreviewCompanyResponseData.java | 61 + ...rsionMigrationPreviewNoteResponseData.java | 205 ++++ .../api/types/PlanVersionResponseData.java | 32 +- ...reviewSubscriptionFinanceResponseData.java | 126 +- ...SubscriptionProrationLineResponseData.java | 349 ++++++ ...viewSubscriptionProrationResponseData.java | 364 ++++++ .../api/types/ProrationLineKind.java | 83 ++ .../api/types/PublicCatalogResponseData.java | 509 ++++++++ .../types/PublishPlanVersionRequestBody.java | 46 + .../api/types/PublishPreviewResponseData.java | 46 + .../schematic/api/types/RenewalPolicy.java | 94 ++ ...dateBillingPlanCreditGrantRequestBody.java | 52 +- .../api/types/WebhookRequestType.java | 11 + .../api/UndiscriminatedUnionTest.java | 20 +- .../schematic/api/core/PathSegmentsTest.java | 36 + 129 files changed, 13779 insertions(+), 4769 deletions(-) create mode 100644 src/main/java/com/schematic/api/core/PathSegments.java delete mode 100644 src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java delete mode 100644 src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java delete mode 100644 src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java delete mode 100644 src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java delete mode 100644 src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java delete mode 100644 src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java rename src/main/java/com/schematic/api/resources/billing/requests/{ListNativeInvoicesRequest.java => CountBillingInvoicesRequest.java} (56%) rename src/main/java/com/schematic/api/resources/billing/requests/{CountNativeInvoicesRequest.java => ListBillingInvoicesRequest.java} (56%) rename src/main/java/com/schematic/api/resources/billing/types/{ListNativeInvoicesParams.java => CountBillingInvoicesParams.java} (55%) rename src/main/java/com/schematic/api/resources/billing/types/{CountNativeInvoicesResponse.java => CountBillingInvoicesResponse.java} (78%) rename src/main/java/com/schematic/api/resources/billing/types/{GetNativeInvoiceResponse.java => GetBillingInvoiceResponse.java} (89%) rename src/main/java/com/schematic/api/resources/billing/types/{CountNativeInvoicesParams.java => ListBillingInvoicesParams.java} (55%) rename src/main/java/com/schematic/api/resources/billing/types/{ListNativeInvoicesResponse.java => ListBillingInvoicesResponse.java} (82%) rename src/main/java/com/schematic/api/resources/billing/types/{MarkNativeInvoicePaidResponse.java => MarkBillingInvoicePaidResponse.java} (88%) rename src/main/java/com/schematic/api/resources/{accounts/types/DeleteEnvironmentResponse.java => catalogs/types/GetPublicCatalogByIdResponse.java} (80%) rename src/main/java/com/schematic/api/resources/{accounts/types/CreateApiKeyResponse.java => catalogs/types/GetPublicCatalogResponse.java} (80%) rename src/main/java/com/schematic/api/resources/{accounts/types/CreateEnvironmentResponse.java => credits/types/GetCreditEventLedgerEntryResponse.java} (80%) delete mode 100644 src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java create mode 100644 src/main/java/com/schematic/api/types/BillingInvoiceAddressResponseData.java create mode 100644 src/main/java/com/schematic/api/types/BillingInvoiceBillingDetailsResponseData.java rename src/main/java/com/schematic/api/{resources/accounts/requests/CreateEnvironmentRequestBody.java => types/BillingInvoiceTaxIdResponseData.java} (51%) create mode 100644 src/main/java/com/schematic/api/types/BillingPlanCreditGrantWarningTierResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogBundleCurrencyPriceResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogCapabilitiesResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogCreditBundleResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogCreditGrantResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogCurrencyPricesResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogCustomPlanCtaResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogDetailResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogEntitlementResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogPlanEntitlementResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogPlanResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogPriceResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CatalogPriceTierResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CheckoutChargeTiming.java delete mode 100644 src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PaymentMethodBillingDetailsRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/PlanCreditGrantWarningTierRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewNoteResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PreviewSubscriptionProrationLineResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PreviewSubscriptionProrationResponseData.java create mode 100644 src/main/java/com/schematic/api/types/ProrationLineKind.java create mode 100644 src/main/java/com/schematic/api/types/PublicCatalogResponseData.java create mode 100644 src/main/java/com/schematic/api/types/RenewalPolicy.java create mode 100644 src/test/java/com/schematic/api/core/PathSegmentsTest.java diff --git a/.fern/metadata.json b/.fern/metadata.json index 9283be5e..bbb3460f 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.50.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.32.2", + "generatorVersion": "4.32.4", "generatorConfig": { "client-class-name": "BaseSchematic", "generate-unknown-as-json-node": true, @@ -15,10 +15,10 @@ "testImplementation com.github.codemonstur:embedded-redis:1.4.3" ] }, - "originGitCommit": "5df5ee39faba7ee0d2fd40aa455ee0a1b1a00034", + "originGitCommit": "9c3d404a6ed3ff63811ecbef9e2814ea8607f22d", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.6.5", + "requestedVersion": "1.6.6", "ciProvider": "github", - "sdkVersion": "1.6.5" + "sdkVersion": "1.6.6" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4921cadf..e22ec55b 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ java { group = 'com.schematichq' -version = '1.6.5' +version = '1.6.6' jar { dependsOn(":generatePomFileForMavenPublication") @@ -94,7 +94,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.6.5' + version = '1.6.6' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index 7a189984..312d1b0d 100644 --- a/reference.md +++ b/reference.md @@ -1,5 +1,5 @@ # Reference -
client.getCreditLedger() +
client.postApiKeys()
@@ -12,7 +12,7 @@
```java -client.getCreditLedger(); +client.postApiKeys(); ```
@@ -24,8 +24,7 @@ client.getCreditLedger();
-## accounts -
client.accounts.listAccountMembers() -> ListAccountMembersResponse +
client.putApiKeysApiKeyId(apiKeyId)
@@ -38,18 +37,7 @@ client.getCreditLedger();
```java -client.accounts().listAccountMembers( - ListAccountMembersRequest - .builder() - .ids( - Arrays.asList("ids") - ) - .q("q") - .role(AccountMemberRole.ADMIN) - .limit(1000000L) - .offset(1000000L) - .build() -); +client.putApiKeysApiKeyId("api_key_id"); ```
@@ -64,39 +52,7 @@ client.accounts().listAccountMembers(
-**ids:** `Optional` - -
-
- -
-
- -**q:** `Optional` — Search filter - -
-
- -
-
- -**role:** `Optional` — Filter by member role - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) +**apiKeyId:** `String`
@@ -108,7 +64,7 @@ client.accounts().listAccountMembers(
-
client.accounts.getAccountMember(accountMemberId) -> GetAccountMemberResponse +
client.deleteApiKeysApiKeyId(apiKeyId)
@@ -121,7 +77,7 @@ client.accounts().listAccountMembers(
```java -client.accounts().getAccountMember("account_member_id"); +client.deleteApiKeysApiKeyId("api_key_id"); ```
@@ -136,7 +92,7 @@ client.accounts().getAccountMember("account_member_id");
-**accountMemberId:** `String` — account_member_id +**apiKeyId:** `String`
@@ -148,7 +104,7 @@ client.accounts().getAccountMember("account_member_id");
-
client.accounts.countAccountMembers() -> CountAccountMembersResponse +
client.postEnvironments()
@@ -161,65 +117,47 @@ client.accounts().getAccountMember("account_member_id");
```java -client.accounts().countAccountMembers( - CountAccountMembersRequest - .builder() - .ids( - Arrays.asList("ids") - ) - .q("q") - .role(AccountMemberRole.ADMIN) - .limit(1000000L) - .offset(1000000L) - .build() -); +client.postEnvironments(); ```
-#### ⚙️ Parameters -
-
+
+
+
+
client.putEnvironmentsEnvironmentId(environmentId)
-**ids:** `Optional` - -
-
+#### 🔌 Usage
-**q:** `Optional` — Search filter - -
-
-
-**role:** `Optional` — Filter by member role - +```java +client.putEnvironmentsEnvironmentId("environment_id"); +```
+ + + +#### ⚙️ Parameters
-**limit:** `Optional` — Page limit (default 100) - -
-
-
-**offset:** `Optional` — Page offset (default 0) +**environmentId:** `String`
@@ -231,7 +169,7 @@ client.accounts().countAccountMembers(
-
client.accounts.listApiKeys() -> ListApiKeysResponse +
client.deleteEnvironmentsEnvironmentId(environmentId)
@@ -244,15 +182,7 @@ client.accounts().countAccountMembers(
```java -client.accounts().listApiKeys( - ListApiKeysRequest - .builder() - .requireEnvironment(true) - .environmentId("environment_id") - .limit(1000000L) - .offset(1000000L) - .build() -); +client.deleteEnvironmentsEnvironmentId("environment_id"); ```
@@ -267,32 +197,33 @@ client.accounts().listApiKeys(
-**environmentId:** `Optional` +**environmentId:** `String`
+ + -
-
-**requireEnvironment:** `Boolean` -
+
+
client.getCreditLedger()
-**limit:** `Optional` — Page limit (default 100) - -
-
+#### 🔌 Usage
-**offset:** `Optional` — Page offset (default 0) - +
+
+ +```java +client.getCreditLedger(); +```
@@ -303,7 +234,8 @@ client.accounts().listApiKeys(
-
client.accounts.createApiKey(request) -> CreateApiKeyResponse +## accounts +
client.accounts.listAccountMembers() -> ListAccountMembersResponse
@@ -316,10 +248,16 @@ client.accounts().listApiKeys(
```java -client.accounts().createApiKey( - CreateApiKeyRequestBody +client.accounts().listAccountMembers( + ListAccountMembersRequest .builder() - .name("name") + .ids( + Arrays.asList("ids") + ) + .q("q") + .role(AccountMemberRole.ADMIN) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -336,7 +274,7 @@ client.accounts().createApiKey(
-**description:** `Optional` +**ids:** `Optional`
@@ -344,7 +282,7 @@ client.accounts().createApiKey(
-**environmentId:** `Optional` +**q:** `Optional` — Search filter
@@ -352,7 +290,7 @@ client.accounts().createApiKey(
-**name:** `String` +**role:** `Optional` — Filter by member role
@@ -360,7 +298,7 @@ client.accounts().createApiKey(
-**rateLimitPercent:** `Optional` +**limit:** `Optional` — Page limit (default 100)
@@ -368,7 +306,7 @@ client.accounts().createApiKey(
-**readonly:** `Optional` +**offset:** `Optional` — Page offset (default 0)
@@ -380,7 +318,7 @@ client.accounts().createApiKey(
-
client.accounts.getApiKey(apiKeyId) -> GetApiKeyResponse +
client.accounts.getAccountMember(accountMemberId) -> GetAccountMemberResponse
@@ -393,7 +331,7 @@ client.accounts().createApiKey(
```java -client.accounts().getApiKey("api_key_id"); +client.accounts().getAccountMember("account_member_id"); ```
@@ -408,7 +346,7 @@ client.accounts().getApiKey("api_key_id");
-**apiKeyId:** `String` — api_key_id +**accountMemberId:** `String` — account_member_id
@@ -420,7 +358,7 @@ client.accounts().getApiKey("api_key_id");
-
client.accounts.updateApiKey(apiKeyId, request) -> UpdateApiKeyResponse +
client.accounts.countAccountMembers() -> CountAccountMembersResponse
@@ -433,10 +371,16 @@ client.accounts().getApiKey("api_key_id");
```java -client.accounts().updateApiKey( - "api_key_id", - UpdateApiKeyRequestBody +client.accounts().countAccountMembers( + CountAccountMembersRequest .builder() + .ids( + Arrays.asList("ids") + ) + .q("q") + .role(AccountMemberRole.ADMIN) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -453,7 +397,7 @@ client.accounts().updateApiKey(
-**apiKeyId:** `String` — api_key_id +**ids:** `Optional`
@@ -461,7 +405,7 @@ client.accounts().updateApiKey(
-**description:** `Optional` +**q:** `Optional` — Search filter
@@ -469,7 +413,7 @@ client.accounts().updateApiKey(
-**name:** `Optional` +**role:** `Optional` — Filter by member role
@@ -477,47 +421,15 @@ client.accounts().updateApiKey(
-**rateLimitPercent:** `Optional` +**limit:** `Optional` — Page limit (default 100)
-
-
- - - -
- -
client.accounts.deleteApiKey(apiKeyId) -> DeleteApiKeyResponse
-#### 🔌 Usage - -
-
- -
-
- -```java -client.accounts().deleteApiKey("api_key_id"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**apiKeyId:** `String` — api_key_id +**offset:** `Optional` — Page offset (default 0)
@@ -529,7 +441,7 @@ client.accounts().deleteApiKey("api_key_id");
-
client.accounts.countApiKeys() -> CountApiKeysResponse +
client.accounts.listApiKeys() -> ListApiKeysResponse
@@ -542,8 +454,8 @@ client.accounts().deleteApiKey("api_key_id");
```java -client.accounts().countApiKeys( - CountApiKeysRequest +client.accounts().listApiKeys( + ListApiKeysRequest .builder() .requireEnvironment(true) .environmentId("environment_id") @@ -601,7 +513,7 @@ client.accounts().countApiKeys(
-
client.accounts.listAuditLogs() -> ListAuditLogsResponse +
client.accounts.getApiKey(apiKeyId) -> GetApiKeyResponse
@@ -614,18 +526,7 @@ client.accounts().countApiKeys(
```java -client.accounts().listAuditLogs( - ListAuditLogsRequest - .builder() - .actorType(ActorType.API_KEY) - .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) - .environmentId("environment_id") - .q("q") - .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) - .limit(1000000L) - .offset(1000000L) - .build() -); +client.accounts().getApiKey("api_key_id"); ```
@@ -640,95 +541,79 @@ client.accounts().listAuditLogs(
-**actorType:** `Optional` - -
-
- -
-
- -**endTime:** `Optional` +**apiKeyId:** `String` — api_key_id
- -
-
- -**environmentId:** `Optional` -
-
-
-**q:** `Optional` -
+
+
client.accounts.countApiKeys() -> CountApiKeysResponse
-**startTime:** `Optional` - -
-
+#### 🔌 Usage
-**limit:** `Optional` — Page limit (default 100) - -
-
-
-**offset:** `Optional` — Page offset (default 0) - +```java +client.accounts().countApiKeys( + CountApiKeysRequest + .builder() + .requireEnvironment(true) + .environmentId("environment_id") + .limit(1000000L) + .offset(1000000L) + .build() +); +```
+#### ⚙️ Parameters - - -
- -
client.accounts.getAuditLog(auditLogId) -> GetAuditLogResponse
-#### 🔌 Usage -
+**environmentId:** `Optional` + +
+
+
-```java -client.accounts().getAuditLog("audit_log_id"); -``` -
-
+**requireEnvironment:** `Boolean` +
-#### ⚙️ Parameters -
+**limit:** `Optional` — Page limit (default 100) + +
+
+
-**auditLogId:** `String` — audit_log_id +**offset:** `Optional` — Page offset (default 0)
@@ -740,7 +625,7 @@ client.accounts().getAuditLog("audit_log_id");
-
client.accounts.countAuditLogs() -> CountAuditLogsResponse +
client.accounts.listAuditLogs() -> ListAuditLogsResponse
@@ -753,8 +638,8 @@ client.accounts().getAuditLog("audit_log_id");
```java -client.accounts().countAuditLogs( - CountAuditLogsRequest +client.accounts().listAuditLogs( + ListAuditLogsRequest .builder() .actorType(ActorType.API_KEY) .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) @@ -839,7 +724,7 @@ client.accounts().countAuditLogs(
-
client.accounts.listEnvironments() -> ListEnvironmentsResponse +
client.accounts.getAuditLog(auditLogId) -> GetAuditLogResponse
@@ -852,16 +737,7 @@ client.accounts().countAuditLogs(
```java -client.accounts().listEnvironments( - ListEnvironmentsRequest - .builder() - .ids( - Arrays.asList("ids") - ) - .limit(1000000L) - .offset(1000000L) - .build() -); +client.accounts().getAuditLog("audit_log_id"); ```
@@ -876,23 +752,7 @@ client.accounts().listEnvironments(
-**ids:** `Optional` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) +**auditLogId:** `String` — audit_log_id
@@ -904,7 +764,7 @@ client.accounts().listEnvironments(
-
client.accounts.createEnvironment(request) -> CreateEnvironmentResponse +
client.accounts.countAuditLogs() -> CountAuditLogsResponse
@@ -917,11 +777,16 @@ client.accounts().listEnvironments(
```java -client.accounts().createEnvironment( - CreateEnvironmentRequestBody +client.accounts().countAuditLogs( + CountAuditLogsRequest .builder() - .environmentType(EnvironmentType.DEVELOPMENT) - .name("name") + .actorType(ActorType.API_KEY) + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .environmentId("environment_id") + .q("q") + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -938,7 +803,7 @@ client.accounts().createEnvironment(
-**environmentType:** `EnvironmentType` +**actorType:** `Optional`
@@ -946,47 +811,47 @@ client.accounts().createEnvironment(
-**name:** `String` +**endTime:** `Optional`
-
-
- - - - -
- -
client.accounts.getEnvironment(environmentId) -> GetEnvironmentResponse -
-
- -#### 🔌 Usage
+**environmentId:** `Optional` + +
+
+
-```java -client.accounts().getEnvironment("environment_id"); -``` +**q:** `Optional` +
+ +
+
+ +**startTime:** `Optional` +
-#### ⚙️ Parameters -
+**limit:** `Optional` — Page limit (default 100) + +
+
+
-**environmentId:** `String` — environment_id +**offset:** `Optional` — Page offset (default 0)
@@ -998,7 +863,7 @@ client.accounts().getEnvironment("environment_id");
-
client.accounts.updateEnvironment(environmentId, request) -> UpdateEnvironmentResponse +
client.accounts.listEnvironments() -> ListEnvironmentsResponse
@@ -1011,10 +876,14 @@ client.accounts().getEnvironment("environment_id");
```java -client.accounts().updateEnvironment( - "environment_id", - UpdateEnvironmentRequestBody +client.accounts().listEnvironments( + ListEnvironmentsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1031,15 +900,7 @@ client.accounts().updateEnvironment(
-**environmentId:** `String` — environment_id - -
-
- -
-
- -**environmentType:** `Optional` +**ids:** `Optional`
@@ -1047,7 +908,7 @@ client.accounts().updateEnvironment(
-**name:** `Optional` +**limit:** `Optional` — Page limit (default 100)
@@ -1055,7 +916,7 @@ client.accounts().updateEnvironment(
-**requireContextSignature:** `Optional` +**offset:** `Optional` — Page offset (default 0)
@@ -1067,7 +928,7 @@ client.accounts().updateEnvironment(
-
client.accounts.deleteEnvironment(environmentId) -> DeleteEnvironmentResponse +
client.accounts.getEnvironment(environmentId) -> GetEnvironmentResponse
@@ -1080,7 +941,7 @@ client.accounts().updateEnvironment(
```java -client.accounts().deleteEnvironment("environment_id"); +client.accounts().getEnvironment("environment_id"); ```
@@ -2433,6 +2294,14 @@ client.billing().upsertPaymentMethod(
+**customerBillingDetails:** `Optional` + +
+
+ +
+
+ **customerExternalId:** `String`
@@ -4089,7 +3958,7 @@ client.billing().getCompanyNativeSubscription("company_id");
-
client.billing.listNativeInvoices() -> ListNativeInvoicesResponse +
client.billing.listBillingInvoices() -> ListBillingInvoicesResponse
@@ -4102,12 +3971,16 @@ client.billing().getCompanyNativeSubscription("company_id");
```java -client.billing().listNativeInvoices( - ListNativeInvoicesRequest +client.billing().listBillingInvoices( + ListBillingInvoicesRequest .builder() .companyId("company_id") .contractId("contract_id") .documentState(InvoiceDocumentState.CREDITED) + .pastDue(true) + .providerType(BillingProviderType.METRONOME) + .q("q") + .status(InvoiceStatus.DRAFT) .limit(1000000L) .offset(1000000L) .build() @@ -4150,6 +4023,38 @@ client.billing().listNativeInvoices(
+**pastDue:** `Optional` — Only open invoices with an amount left to pay whose due date has passed. + +
+
+ +
+
+ +**providerType:** `Optional` — Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe. + +
+
+ +
+
+ +**q:** `Optional` — Search by invoice number, provider invoice ID or company name. + +
+
+ +
+
+ +**status:** `Optional` + +
+
+ +
+
+ **limit:** `Optional` — Page limit (default 100)
@@ -4170,7 +4075,7 @@ client.billing().listNativeInvoices(
-
client.billing.getNativeInvoice(invoiceId) -> GetNativeInvoiceResponse +
client.billing.getBillingInvoice(invoiceId) -> GetBillingInvoiceResponse
@@ -4183,7 +4088,7 @@ client.billing().listNativeInvoices(
```java -client.billing().getNativeInvoice("invoice_id"); +client.billing().getBillingInvoice("invoice_id"); ```
@@ -4290,7 +4195,7 @@ client.billing().finalizeNativeInvoice("invoice_id");
-
client.billing.markNativeInvoicePaid(invoiceId, request) -> MarkNativeInvoicePaidResponse +
client.billing.markBillingInvoicePaid(invoiceId, request) -> MarkBillingInvoicePaidResponse
@@ -4303,7 +4208,7 @@ client.billing().finalizeNativeInvoice("invoice_id");
```java -client.billing().markNativeInvoicePaid( +client.billing().markBillingInvoicePaid( "invoice_id", MarkInvoicePaidRequestBody .builder() @@ -4448,7 +4353,7 @@ client.billing().voidNativeInvoice("invoice_id");
-
client.billing.countNativeInvoices() -> CountNativeInvoicesResponse +
client.billing.countBillingInvoices() -> CountBillingInvoicesResponse
@@ -4461,12 +4366,16 @@ client.billing().voidNativeInvoice("invoice_id");
```java -client.billing().countNativeInvoices( - CountNativeInvoicesRequest +client.billing().countBillingInvoices( + CountBillingInvoicesRequest .builder() .companyId("company_id") .contractId("contract_id") .documentState(InvoiceDocumentState.CREDITED) + .pastDue(true) + .providerType(BillingProviderType.METRONOME) + .q("q") + .status(InvoiceStatus.DRAFT) .limit(1000000L) .offset(1000000L) .build() @@ -4509,6 +4418,38 @@ client.billing().countNativeInvoices(
+**pastDue:** `Optional` — Only open invoices with an amount left to pay whose due date has passed. + +
+
+ +
+
+ +**providerType:** `Optional` — Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe. + +
+
+ +
+
+ +**q:** `Optional` — Search by invoice number, provider invoice ID or company name. + +
+
+ +
+
+ +**status:** `Optional` + +
+
+ +
+
+ **limit:** `Optional` — Page limit (default 100)
@@ -7127,7 +7068,7 @@ client.credits().createCreditSpendPolicy(
-**windowUnit:** `Optional` — The window that window_amount applies to: one UTC hour or one UTC day. Required with window_amount. +**windowUnit:** `Optional` — The window that window_amount applies to: one UTC hour, one UTC day, one week from Monday 00:00 UTC, one calendar month from the 1st 00:00 UTC, or the company's current billing period. billing_period applies to company policies only, and a company without an active subscription falls back to the calendar month. Required with window_amount.
@@ -7483,6 +7424,7 @@ client.credits().listCreditEventLedger( .endTime("end_time") .eventType(CreditEventType.ADJUSTMENT) .featureId("feature_id") + .sourceEventId("source_event_id") .startTime("start_time") .limit(1000000L) .offset(1000000L) @@ -7542,6 +7484,14 @@ client.credits().listCreditEventLedger(
+**sourceEventId:** `Optional` — Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it. + +
+
+ +
+
+ **startTime:** `Optional`
@@ -7566,6 +7516,46 @@ client.credits().listCreditEventLedger(
+
+
+
+ +
client.credits.getCreditEventLedgerEntry(ledgerEntryId) -> GetCreditEventLedgerEntryResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.credits().getCreditEventLedgerEntry("ledger_entry_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**ledgerEntryId:** `String` — ledger_entry_id + +
+
+
+
+ +
@@ -7591,6 +7581,7 @@ client.credits().countCreditEventLedger( .endTime("end_time") .eventType(CreditEventType.ADJUSTMENT) .featureId("feature_id") + .sourceEventId("source_event_id") .startTime("start_time") .limit(1000000L) .offset(1000000L) @@ -7650,6 +7641,14 @@ client.credits().countCreditEventLedger(
+**sourceEventId:** `Optional` — Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it. + +
+
+ +
+
+ **startTime:** `Optional`
@@ -8418,6 +8417,71 @@ client.catalogs().removePlan("catalog_id", "plan_id");
+ + +
+ +
client.catalogs.getPublicCatalog() -> GetPublicCatalogResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.catalogs().getPublicCatalog(); +``` +
+
+
+
+ + +
+
+
+ +
client.catalogs.getPublicCatalogById(catalogId) -> GetPublicCatalogByIdResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.catalogs().getPublicCatalogById("catalog_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalogId:** `String` — catalog_id + +
+
+
+
+ +
@@ -15585,6 +15649,14 @@ client.plans().retryCustomPlanBilling(
+**endDate:** `Optional` — When a plan that doesn't renew ends. Moved back to the last renewal on or before it. When omitted, the end date set at finalize is reissued. Only honored when the retry creates a subscription. + +
+
+ +
+
+ **prorateFirstPeriod:** `Optional` — When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true.
@@ -17426,6 +17498,14 @@ client.planbundle().createCustomPlanBundle( **plan:** `CreateCustomPlanBundlePlanRequestBody` + +
+ +
+
+ +**renewalPolicy:** `Optional` +
@@ -17509,6 +17589,14 @@ client.planbundle().createPlanBundle( **plan:** `CreatePlanRequestBody` + + + +
+
+ +**renewalPolicy:** `Optional` +
@@ -17608,6 +17696,14 @@ client.planbundle().updatePlanBundle( **planVersionId:** `Optional` + + + +
+
+ +**renewalPolicy:** `Optional` +
diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematic.java b/src/main/java/com/schematic/api/AsyncBaseSchematic.java index 4b2d9a1f..8f807ca4 100644 --- a/src/main/java/com/schematic/api/AsyncBaseSchematic.java +++ b/src/main/java/com/schematic/api/AsyncBaseSchematic.java @@ -115,6 +115,145 @@ public AsyncRawBaseSchematic withRawResponse() { return this.rawClient; } + public CompletableFuture postApiKeys() { + CompletableFuture> rawFuture = this.rawClient.postApiKeys(); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture postApiKeys(RequestOptions requestOptions) { + CompletableFuture> rawFuture = this.rawClient.postApiKeys(requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture putApiKeysApiKeyId(String apiKeyId) { + CompletableFuture> rawFuture = this.rawClient.putApiKeysApiKeyId(apiKeyId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture putApiKeysApiKeyId(String apiKeyId, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.putApiKeysApiKeyId(apiKeyId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture deleteApiKeysApiKeyId(String apiKeyId) { + CompletableFuture> rawFuture = this.rawClient.deleteApiKeysApiKeyId(apiKeyId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture deleteApiKeysApiKeyId(String apiKeyId, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.deleteApiKeysApiKeyId(apiKeyId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture postEnvironments() { + CompletableFuture> rawFuture = this.rawClient.postEnvironments(); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture postEnvironments(RequestOptions requestOptions) { + CompletableFuture> rawFuture = this.rawClient.postEnvironments(requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture putEnvironmentsEnvironmentId(String environmentId) { + CompletableFuture> rawFuture = + this.rawClient.putEnvironmentsEnvironmentId(environmentId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture putEnvironmentsEnvironmentId(String environmentId, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.putEnvironmentsEnvironmentId(environmentId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture deleteEnvironmentsEnvironmentId(String environmentId) { + CompletableFuture> rawFuture = + this.rawClient.deleteEnvironmentsEnvironmentId(environmentId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture deleteEnvironmentsEnvironmentId( + String environmentId, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.deleteEnvironmentsEnvironmentId(environmentId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + public CompletableFuture getCreditLedger() { CompletableFuture> rawFuture = this.rawClient.getCreditLedger(); CompletableFuture future = rawFuture.thenApply(response -> response.body()); diff --git a/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java b/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java index a538bb17..49de235b 100644 --- a/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java +++ b/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java @@ -7,8 +7,10 @@ import com.schematic.api.core.BaseSchematicApiException; import com.schematic.api.core.BaseSchematicException; import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.BodyProperties; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; import java.io.IOException; @@ -19,6 +21,7 @@ import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; import org.jetbrains.annotations.NotNull; @@ -30,6 +33,438 @@ public AsyncRawBaseSchematic(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public CompletableFuture> postApiKeys() { + return postApiKeys(null); + } + + public CompletableFuture> postApiKeys(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api-keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "POST", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + + public CompletableFuture> putApiKeysApiKeyId(String apiKeyId) { + return putApiKeysApiKeyId(apiKeyId, null); + } + + public CompletableFuture> putApiKeysApiKeyId( + String apiKeyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api-keys") + .addPathSegment(PathSegments.validate(apiKeyId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "PUT", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + + public CompletableFuture> deleteApiKeysApiKeyId(String apiKeyId) { + return deleteApiKeysApiKeyId(apiKeyId, null); + } + + public CompletableFuture> deleteApiKeysApiKeyId( + String apiKeyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api-keys") + .addPathSegment(PathSegments.validate(apiKeyId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "DELETE", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + + public CompletableFuture> postEnvironments() { + return postEnvironments(null); + } + + public CompletableFuture> postEnvironments(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("environments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "POST", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + + public CompletableFuture> putEnvironmentsEnvironmentId(String environmentId) { + return putEnvironmentsEnvironmentId(environmentId, null); + } + + public CompletableFuture> putEnvironmentsEnvironmentId( + String environmentId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("environments") + .addPathSegment(PathSegments.validate(environmentId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "PUT", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + + public CompletableFuture> deleteEnvironmentsEnvironmentId(String environmentId) { + return deleteEnvironmentsEnvironmentId(environmentId, null); + } + + public CompletableFuture> deleteEnvironmentsEnvironmentId( + String environmentId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("environments") + .addPathSegment(PathSegments.validate(environmentId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "DELETE", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + public CompletableFuture> getCreditLedger() { return getCreditLedger(null); } diff --git a/src/main/java/com/schematic/api/RawBaseSchematic.java b/src/main/java/com/schematic/api/RawBaseSchematic.java index 4bdf2c2f..d781641a 100644 --- a/src/main/java/com/schematic/api/RawBaseSchematic.java +++ b/src/main/java/com/schematic/api/RawBaseSchematic.java @@ -7,8 +7,10 @@ import com.schematic.api.core.BaseSchematicApiException; import com.schematic.api.core.BaseSchematicException; import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.BodyProperties; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; import java.io.IOException; @@ -16,6 +18,7 @@ import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; @@ -26,6 +29,316 @@ public RawBaseSchematic(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public BaseSchematicHttpResponse postApiKeys() { + return postApiKeys(null); + } + + public BaseSchematicHttpResponse postApiKeys(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api-keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "POST", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse putApiKeysApiKeyId(String apiKeyId) { + return putApiKeysApiKeyId(apiKeyId, null); + } + + public BaseSchematicHttpResponse putApiKeysApiKeyId(String apiKeyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api-keys") + .addPathSegment(PathSegments.validate(apiKeyId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "PUT", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse deleteApiKeysApiKeyId(String apiKeyId) { + return deleteApiKeysApiKeyId(apiKeyId, null); + } + + public BaseSchematicHttpResponse deleteApiKeysApiKeyId(String apiKeyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api-keys") + .addPathSegment(PathSegments.validate(apiKeyId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "DELETE", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse postEnvironments() { + return postEnvironments(null); + } + + public BaseSchematicHttpResponse postEnvironments(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("environments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "POST", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse putEnvironmentsEnvironmentId(String environmentId) { + return putEnvironmentsEnvironmentId(environmentId, null); + } + + public BaseSchematicHttpResponse putEnvironmentsEnvironmentId( + String environmentId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("environments") + .addPathSegment(PathSegments.validate(environmentId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "PUT", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, + RequestBody.create("", null))) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse deleteEnvironmentsEnvironmentId(String environmentId) { + return deleteEnvironmentsEnvironmentId(environmentId, null); + } + + public BaseSchematicHttpResponse deleteEnvironmentsEnvironmentId( + String environmentId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("environments") + .addPathSegment(PathSegments.validate(environmentId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method( + "DELETE", + BodyProperties.toRequestBody( + requestOptions != null ? requestOptions.getBodyProperties() : null, null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse getCreditLedger() { return getCreditLedger(null); } diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index 7d5dedb3..83cc7968 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -60,10 +60,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq.schematic-java/1.6.5"); + put("User-Agent", "com.schematichq.schematic-java/1.6.6"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematichq:schematic-java"); - put("X-Fern-SDK-Version", "1.6.5"); + put("X-Fern-SDK-Version", "1.6.6"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/core/PathSegments.java b/src/main/java/com/schematic/api/core/PathSegments.java new file mode 100644 index 00000000..ded13d85 --- /dev/null +++ b/src/main/java/com/schematic/api/core/PathSegments.java @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +public final class PathSegments { + + private PathSegments() {} + + /** + * Returns the value unchanged, rejecting "." and "..". These are dot-segments that URL builders resolve, + * which would otherwise change the endpoint a request is sent to. + */ + public static String validate(String value) { + if (".".equals(value) || "..".equals(value)) { + throw new IllegalArgumentException( + "Invalid path parameter value \"" + value + "\": \".\" and \"..\" are not allowed."); + } + return value; + } +} 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 f62983bd..a9183c9b 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java @@ -8,22 +8,14 @@ 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; -import com.schematic.api.resources.accounts.requests.CreateEnvironmentRequestBody; import com.schematic.api.resources.accounts.requests.ListAccountMembersRequest; import com.schematic.api.resources.accounts.requests.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; 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.requests.UpdateOnboardingStateRequestBody; 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; -import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; -import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; -import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetAccountMemberResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; @@ -35,8 +27,6 @@ import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; -import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; -import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; public class AccountsClient { @@ -106,14 +96,6 @@ public ListApiKeysResponse listApiKeys(ListApiKeysRequest request, RequestOption return this.rawClient.listApiKeys(request, requestOptions).body(); } - public CreateApiKeyResponse createApiKey(CreateApiKeyRequestBody request) { - return this.rawClient.createApiKey(request).body(); - } - - public CreateApiKeyResponse createApiKey(CreateApiKeyRequestBody request, RequestOptions requestOptions) { - return this.rawClient.createApiKey(request, requestOptions).body(); - } - public GetApiKeyResponse getApiKey(String apiKeyId) { return this.rawClient.getApiKey(apiKeyId).body(); } @@ -122,31 +104,6 @@ public GetApiKeyResponse getApiKey(String apiKeyId, RequestOptions requestOption return this.rawClient.getApiKey(apiKeyId, requestOptions).body(); } - public UpdateApiKeyResponse updateApiKey(String apiKeyId) { - return this.rawClient.updateApiKey(apiKeyId).body(); - } - - public UpdateApiKeyResponse updateApiKey(String apiKeyId, RequestOptions requestOptions) { - return this.rawClient.updateApiKey(apiKeyId, requestOptions).body(); - } - - public UpdateApiKeyResponse updateApiKey(String apiKeyId, UpdateApiKeyRequestBody request) { - return this.rawClient.updateApiKey(apiKeyId, request).body(); - } - - public UpdateApiKeyResponse updateApiKey( - String apiKeyId, UpdateApiKeyRequestBody request, RequestOptions requestOptions) { - return this.rawClient.updateApiKey(apiKeyId, request, requestOptions).body(); - } - - public DeleteApiKeyResponse deleteApiKey(String apiKeyId) { - return this.rawClient.deleteApiKey(apiKeyId).body(); - } - - public DeleteApiKeyResponse deleteApiKey(String apiKeyId, RequestOptions requestOptions) { - return this.rawClient.deleteApiKey(apiKeyId, requestOptions).body(); - } - public CountApiKeysResponse countApiKeys(CountApiKeysRequest request) { return this.rawClient.countApiKeys(request).body(); } @@ -211,15 +168,6 @@ public ListEnvironmentsResponse listEnvironments(ListEnvironmentsRequest request return this.rawClient.listEnvironments(request, requestOptions).body(); } - public CreateEnvironmentResponse createEnvironment(CreateEnvironmentRequestBody request) { - return this.rawClient.createEnvironment(request).body(); - } - - public CreateEnvironmentResponse createEnvironment( - CreateEnvironmentRequestBody request, RequestOptions requestOptions) { - return this.rawClient.createEnvironment(request, requestOptions).body(); - } - public GetEnvironmentResponse getEnvironment(String environmentId) { return this.rawClient.getEnvironment(environmentId).body(); } @@ -228,33 +176,6 @@ public GetEnvironmentResponse getEnvironment(String environmentId, RequestOption return this.rawClient.getEnvironment(environmentId, requestOptions).body(); } - public UpdateEnvironmentResponse updateEnvironment(String environmentId) { - return this.rawClient.updateEnvironment(environmentId).body(); - } - - public UpdateEnvironmentResponse updateEnvironment(String environmentId, RequestOptions requestOptions) { - return this.rawClient.updateEnvironment(environmentId, requestOptions).body(); - } - - public UpdateEnvironmentResponse updateEnvironment(String environmentId, UpdateEnvironmentRequestBody request) { - return this.rawClient.updateEnvironment(environmentId, request).body(); - } - - public UpdateEnvironmentResponse updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request, RequestOptions requestOptions) { - return this.rawClient - .updateEnvironment(environmentId, request, requestOptions) - .body(); - } - - public DeleteEnvironmentResponse deleteEnvironment(String environmentId) { - return this.rawClient.deleteEnvironment(environmentId).body(); - } - - public DeleteEnvironmentResponse deleteEnvironment(String environmentId, RequestOptions requestOptions) { - return this.rawClient.deleteEnvironment(environmentId, requestOptions).body(); - } - public GetOnboardingStateResponse getOnboardingState() { return this.rawClient.getOnboardingState().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 c9a0c014..45c0c7c4 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java @@ -9,22 +9,14 @@ 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; -import com.schematic.api.resources.accounts.requests.CreateEnvironmentRequestBody; import com.schematic.api.resources.accounts.requests.ListAccountMembersRequest; import com.schematic.api.resources.accounts.requests.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; 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.requests.UpdateOnboardingStateRequestBody; 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; -import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; -import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; -import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetAccountMemberResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; @@ -36,8 +28,6 @@ import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; -import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; -import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; import java.util.concurrent.CompletableFuture; @@ -206,31 +196,6 @@ public CompletableFuture listApiKeys( return future; } - public CompletableFuture createApiKey(CreateApiKeyRequestBody request) { - CompletableFuture> rawFuture = - this.rawClient.createApiKey(request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture createApiKey( - CreateApiKeyRequestBody request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.createApiKey(request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - public CompletableFuture getApiKey(String apiKeyId) { CompletableFuture> rawFuture = this.rawClient.getApiKey(apiKeyId); CompletableFuture future = rawFuture.thenApply(response -> response.body()); @@ -254,79 +219,6 @@ public CompletableFuture getApiKey(String apiKeyId, RequestOp return future; } - public CompletableFuture updateApiKey(String apiKeyId) { - CompletableFuture> rawFuture = - this.rawClient.updateApiKey(apiKeyId); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture updateApiKey(String apiKeyId, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.updateApiKey(apiKeyId, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture updateApiKey(String apiKeyId, UpdateApiKeyRequestBody request) { - CompletableFuture> rawFuture = - this.rawClient.updateApiKey(apiKeyId, request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture updateApiKey( - String apiKeyId, UpdateApiKeyRequestBody request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.updateApiKey(apiKeyId, request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture deleteApiKey(String apiKeyId) { - CompletableFuture> rawFuture = - this.rawClient.deleteApiKey(apiKeyId); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture deleteApiKey(String apiKeyId, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.deleteApiKey(apiKeyId, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - public CompletableFuture countApiKeys(CountApiKeysRequest request) { CompletableFuture> rawFuture = this.rawClient.countApiKeys(request); @@ -522,31 +414,6 @@ public CompletableFuture listEnvironments( return future; } - public CompletableFuture createEnvironment(CreateEnvironmentRequestBody request) { - CompletableFuture> rawFuture = - this.rawClient.createEnvironment(request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture createEnvironment( - CreateEnvironmentRequestBody request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.createEnvironment(request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - public CompletableFuture getEnvironment(String environmentId) { CompletableFuture> rawFuture = this.rawClient.getEnvironment(environmentId); @@ -572,82 +439,6 @@ public CompletableFuture getEnvironment( return future; } - public CompletableFuture updateEnvironment(String environmentId) { - CompletableFuture> rawFuture = - this.rawClient.updateEnvironment(environmentId); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture updateEnvironment( - String environmentId, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.updateEnvironment(environmentId, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request) { - CompletableFuture> rawFuture = - this.rawClient.updateEnvironment(environmentId, request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.updateEnvironment(environmentId, request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture deleteEnvironment(String environmentId) { - CompletableFuture> rawFuture = - this.rawClient.deleteEnvironment(environmentId); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - - public CompletableFuture deleteEnvironment( - String environmentId, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.deleteEnvironment(environmentId, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - rawFuture.cancel(true); - } - }); - return future; - } - public CompletableFuture getOnboardingState() { CompletableFuture> rawFuture = this.rawClient.getOnboardingState(); 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 ece7f2cf..0acf2be4 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -22,22 +23,14 @@ 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; -import com.schematic.api.resources.accounts.requests.CreateEnvironmentRequestBody; import com.schematic.api.resources.accounts.requests.ListAccountMembersRequest; import com.schematic.api.resources.accounts.requests.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; 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.requests.UpdateOnboardingStateRequestBody; 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; -import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; -import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; -import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetAccountMemberResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; @@ -49,8 +42,6 @@ import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; -import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; -import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; import com.schematic.api.types.ApiError; import java.io.IOException; @@ -214,7 +205,7 @@ public CompletableFuture> ge HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("account-members") - .addPathSegment(accountMemberId); + .addPathSegment(PathSegments.validate(accountMemberId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -549,711 +540,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> createApiKey( - CreateApiKeyRequestBody request) { - return createApiKey(request, null); - } - - public CompletableFuture> createApiKey( - CreateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys"); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - 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); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); - okhttpCall.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, CreateApiKeyResponse.class), - response)); - return; - } - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - okhttpCall.cancel(); - } - }); - return future; - } - - public CompletableFuture> getApiKey(String apiKeyId) { - return getApiKey(apiKeyId, null); - } - - public CompletableFuture> getApiKey( - String apiKeyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys") - .addPathSegment(apiKeyId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); - okhttpCall.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, GetApiKeyResponse.class), - response)); - return; - } - try { - switch (response.code()) { - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - okhttpCall.cancel(); - } - }); - return future; - } - - public CompletableFuture> updateApiKey(String apiKeyId) { - return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build()); - } - - public CompletableFuture> updateApiKey( - String apiKeyId, RequestOptions requestOptions) { - return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build(), requestOptions); - } - - public CompletableFuture> updateApiKey( - String apiKeyId, UpdateApiKeyRequestBody request) { - return updateApiKey(apiKeyId, request, null); - } - - public CompletableFuture> updateApiKey( - String apiKeyId, UpdateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys") - .addPathSegment(apiKeyId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); - okhttpCall.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, UpdateApiKeyResponse.class), - response)); - return; - } - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - okhttpCall.cancel(); - } - }); - return future; - } - - public CompletableFuture> deleteApiKey(String apiKeyId) { - return deleteApiKey(apiKeyId, null); - } - - public CompletableFuture> deleteApiKey( - String apiKeyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys") - .addPathSegment(apiKeyId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method( - "DELETE", - BodyProperties.toRequestBody( - requestOptions != null ? requestOptions.getBodyProperties() : null, null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); - okhttpCall.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, DeleteApiKeyResponse.class), - response)); - return; - } - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - okhttpCall.cancel(); - } - }); - return future; - } - - public CompletableFuture> countApiKeys( - CountApiKeysRequest request) { - return countApiKeys(request, null); - } - - public CompletableFuture> countApiKeys( - CountApiKeysRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys/count"); - if (request.getEnvironmentId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "environment_id", request.getEnvironmentId().get(), false); - } - QueryStringMapper.addQueryParameter(httpUrl, "require_environment", request.getRequireEnvironment(), 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 (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); - okhttpCall.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, CountApiKeysResponse.class), - response)); - return; - } - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - okhttpCall.cancel(); - } - }); - return future; - } - - public CompletableFuture> listAuditLogs() { - return listAuditLogs(ListAuditLogsRequest.builder().build()); - } - - public CompletableFuture> listAuditLogs( - RequestOptions requestOptions) { - return listAuditLogs(ListAuditLogsRequest.builder().build(), requestOptions); - } - - public CompletableFuture> listAuditLogs( - ListAuditLogsRequest request) { - return listAuditLogs(request, null); - } - - public CompletableFuture> listAuditLogs( - ListAuditLogsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("audit-log"); - if (request.getActorType().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "actor_type", request.getActorType().get(), false); - } - if (request.getEndTime().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "end_time", request.getEndTime().get(), false); - } - if (request.getEnvironmentId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "environment_id", request.getEnvironmentId().get(), false); - } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getStartTime().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "start_time", request.getStartTime().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 (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - CompletableFuture> future = new CompletableFuture<>(); - RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); - okhttpCall.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, ListAuditLogsResponse.class), - response)); - return; - } - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } catch (JsonProcessingException e) { - future.completeExceptionally( - new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - future.whenComplete((result_, throwable_) -> { - if (future.isCancelled()) { - okhttpCall.cancel(); - } - }); - return future; - } - - public CompletableFuture> getAuditLog(String auditLogId) { - return getAuditLog(auditLogId, null); + public CompletableFuture> getApiKey(String apiKeyId) { + return getApiKey(apiKeyId, null); } - public CompletableFuture> getAuditLog( - String auditLogId, RequestOptions requestOptions) { + public CompletableFuture> getApiKey( + String apiKeyId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("audit-log") - .addPathSegment(auditLogId); + .addPathSegments("api-keys") + .addPathSegment(PathSegments.validate(apiKeyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1278,7 +574,7 @@ public CompletableFuture> getAudi requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1287,7 +583,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAuditLogResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetApiKeyResponse.class), response)); return; } @@ -1342,44 +638,21 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> countAuditLogs() { - return countAuditLogs(CountAuditLogsRequest.builder().build()); - } - - public CompletableFuture> countAuditLogs( - RequestOptions requestOptions) { - return countAuditLogs(CountAuditLogsRequest.builder().build(), requestOptions); - } - - public CompletableFuture> countAuditLogs( - CountAuditLogsRequest request) { - return countAuditLogs(request, null); + public CompletableFuture> countApiKeys( + CountApiKeysRequest request) { + return countApiKeys(request, null); } - public CompletableFuture> countAuditLogs( - CountAuditLogsRequest request, RequestOptions requestOptions) { + public CompletableFuture> countApiKeys( + CountApiKeysRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("audit-log/count"); - if (request.getActorType().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "actor_type", request.getActorType().get(), false); - } - if (request.getEndTime().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "end_time", request.getEndTime().get(), false); - } + .addPathSegments("api-keys/count"); if (request.getEnvironmentId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "environment_id", request.getEnvironmentId().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getStartTime().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "start_time", request.getStartTime().get(), false); - } + QueryStringMapper.addQueryParameter(httpUrl, "require_environment", request.getRequireEnvironment(), false); if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -1412,7 +685,7 @@ public CompletableFuture> coun requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1421,7 +694,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountAuditLogsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountApiKeysResponse.class), response)); return; } @@ -1481,25 +754,44 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> listEnvironments() { - return listEnvironments(ListEnvironmentsRequest.builder().build()); + public CompletableFuture> listAuditLogs() { + return listAuditLogs(ListAuditLogsRequest.builder().build()); } - public CompletableFuture> listEnvironments( + public CompletableFuture> listAuditLogs( RequestOptions requestOptions) { - return listEnvironments(ListEnvironmentsRequest.builder().build(), requestOptions); + return listAuditLogs(ListAuditLogsRequest.builder().build(), requestOptions); } - public CompletableFuture> listEnvironments( - ListEnvironmentsRequest request) { - return listEnvironments(request, null); + public CompletableFuture> listAuditLogs( + ListAuditLogsRequest request) { + return listAuditLogs(request, null); } - public CompletableFuture> listEnvironments( - ListEnvironmentsRequest request, RequestOptions requestOptions) { + public CompletableFuture> listAuditLogs( + ListAuditLogsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("environments"); + .addPathSegments("audit-log"); + if (request.getActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actor_type", request.getActorType().get(), false); + } + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getEnvironmentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "environment_id", request.getEnvironmentId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -1508,9 +800,6 @@ public CompletableFuture> li 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); @@ -1535,7 +824,7 @@ public CompletableFuture> li requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1544,7 +833,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEnvironmentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAuditLogsResponse.class), response)); return; } @@ -1604,35 +893,25 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> createEnvironment( - CreateEnvironmentRequestBody request) { - return createEnvironment(request, null); + public CompletableFuture> getAuditLog(String auditLogId) { + return getAuditLog(auditLogId, null); } - public CompletableFuture> createEnvironment( - CreateEnvironmentRequestBody request, RequestOptions requestOptions) { + public CompletableFuture> getAuditLog( + String auditLogId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("environments"); + .addPathSegments("audit-log") + .addPathSegment(PathSegments.validate(auditLogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); }); } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - 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) + .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); @@ -1648,7 +927,7 @@ public CompletableFuture> c requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1657,18 +936,12 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAuditLogResponse.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), @@ -1718,27 +991,63 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> getEnvironment(String environmentId) { - return getEnvironment(environmentId, null); + public CompletableFuture> countAuditLogs() { + return countAuditLogs(CountAuditLogsRequest.builder().build()); } - public CompletableFuture> getEnvironment( - String environmentId, RequestOptions requestOptions) { + public CompletableFuture> countAuditLogs( + RequestOptions requestOptions) { + return countAuditLogs(CountAuditLogsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> countAuditLogs( + CountAuditLogsRequest request) { + return countAuditLogs(request, null); + } + + public CompletableFuture> countAuditLogs( + CountAuditLogsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("environments") - .addPathSegment(environmentId); + .addPathSegments("audit-log/count"); + if (request.getActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actor_type", request.getActorType().get(), false); + } + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getEnvironmentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "environment_id", request.getEnvironmentId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().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 (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); }); } - Request okhttpRequest = new Request.Builder() + Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); @@ -1752,7 +1061,7 @@ public CompletableFuture> getE requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1761,12 +1070,17 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountAuditLogsResponse.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), @@ -1816,50 +1130,47 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> updateEnvironment( - String environmentId) { - return updateEnvironment( - environmentId, UpdateEnvironmentRequestBody.builder().build()); + public CompletableFuture> listEnvironments() { + return listEnvironments(ListEnvironmentsRequest.builder().build()); } - public CompletableFuture> updateEnvironment( - String environmentId, RequestOptions requestOptions) { - return updateEnvironment( - environmentId, UpdateEnvironmentRequestBody.builder().build(), requestOptions); + public CompletableFuture> listEnvironments( + RequestOptions requestOptions) { + return listEnvironments(ListEnvironmentsRequest.builder().build(), requestOptions); } - public CompletableFuture> updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request) { - return updateEnvironment(environmentId, request, null); + public CompletableFuture> listEnvironments( + ListEnvironmentsRequest request) { + return listEnvironments(request, null); } - public CompletableFuture> updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request, RequestOptions requestOptions) { + public CompletableFuture> listEnvironments( + ListEnvironmentsRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("environments") - .addPathSegment(environmentId); + .addPathSegments("environments"); + 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); }); } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() + Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) - .method("PUT", body) + .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); @@ -1873,7 +1184,7 @@ public CompletableFuture> u requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1882,8 +1193,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UpdateEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEnvironmentsResponse.class), response)); return; } @@ -1943,17 +1253,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> deleteEnvironment( - String environmentId) { - return deleteEnvironment(environmentId, null); + public CompletableFuture> getEnvironment(String environmentId) { + return getEnvironment(environmentId, null); } - public CompletableFuture> deleteEnvironment( + public CompletableFuture> getEnvironment( String environmentId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId); + .addPathSegment(PathSegments.validate(environmentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1961,10 +1270,7 @@ public CompletableFuture> d } Request okhttpRequest = new Request.Builder() .url(httpUrl.build()) - .method( - "DELETE", - BodyProperties.toRequestBody( - requestOptions != null ? requestOptions.getBodyProperties() : null, null)) + .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") .build(); @@ -1981,7 +1287,7 @@ public CompletableFuture> d requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -1990,18 +1296,12 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEnvironmentResponse.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), 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 2c62c39e..19f919ff 100644 --- a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -22,22 +23,14 @@ 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; -import com.schematic.api.resources.accounts.requests.CreateEnvironmentRequestBody; import com.schematic.api.resources.accounts.requests.ListAccountMembersRequest; import com.schematic.api.resources.accounts.requests.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; 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.requests.UpdateOnboardingStateRequestBody; 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; -import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; -import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; -import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetAccountMemberResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetAuditLogResponse; @@ -49,8 +42,6 @@ import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; -import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; -import com.schematic.api.resources.accounts.types.UpdateEnvironmentResponse; import com.schematic.api.resources.accounts.types.UpdateOnboardingStateResponse; import com.schematic.api.types.ApiError; import java.io.IOException; @@ -176,7 +167,7 @@ public BaseSchematicHttpResponse getAccountMember( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("account-members") - .addPathSegment(accountMemberId); + .addPathSegment(PathSegments.validate(accountMemberId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -420,87 +411,6 @@ public BaseSchematicHttpResponse listApiKeys( } } - public BaseSchematicHttpResponse createApiKey(CreateApiKeyRequestBody request) { - return createApiKey(request, null); - } - - public BaseSchematicHttpResponse createApiKey( - CreateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys"); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - 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); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateApiKeyResponse.class), response); - } - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - public BaseSchematicHttpResponse getApiKey(String apiKeyId) { return getApiKey(apiKeyId, null); } @@ -509,7 +419,7 @@ public BaseSchematicHttpResponse getApiKey(String apiKeyId, R HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId); + .addPathSegment(PathSegments.validate(apiKeyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -569,173 +479,6 @@ public BaseSchematicHttpResponse getApiKey(String apiKeyId, R } } - public BaseSchematicHttpResponse updateApiKey(String apiKeyId) { - return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build()); - } - - public BaseSchematicHttpResponse updateApiKey( - String apiKeyId, RequestOptions requestOptions) { - return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build(), requestOptions); - } - - public BaseSchematicHttpResponse updateApiKey( - String apiKeyId, UpdateApiKeyRequestBody request) { - return updateApiKey(apiKeyId, request, null); - } - - public BaseSchematicHttpResponse updateApiKey( - String apiKeyId, UpdateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys") - .addPathSegment(apiKeyId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateApiKeyResponse.class), response); - } - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - - public BaseSchematicHttpResponse deleteApiKey(String apiKeyId) { - return deleteApiKey(apiKeyId, null); - } - - public BaseSchematicHttpResponse deleteApiKey( - String apiKeyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-keys") - .addPathSegment(apiKeyId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method( - "DELETE", - BodyProperties.toRequestBody( - requestOptions != null ? requestOptions.getBodyProperties() : null, null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteApiKeyResponse.class), response); - } - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - public BaseSchematicHttpResponse countApiKeys(CountApiKeysRequest request) { return countApiKeys(request, null); } @@ -935,7 +678,7 @@ public BaseSchematicHttpResponse getAuditLog( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("audit-log") - .addPathSegment(auditLogId); + .addPathSegment(PathSegments.validate(auditLogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1193,89 +936,6 @@ public BaseSchematicHttpResponse listEnvironments( } } - public BaseSchematicHttpResponse createEnvironment( - CreateEnvironmentRequestBody request) { - return createEnvironment(request, null); - } - - public BaseSchematicHttpResponse createEnvironment( - CreateEnvironmentRequestBody request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("environments"); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - 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); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEnvironmentResponse.class), - response); - } - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - public BaseSchematicHttpResponse getEnvironment(String environmentId) { return getEnvironment(environmentId, null); } @@ -1285,7 +945,7 @@ public BaseSchematicHttpResponse getEnvironment( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId); + .addPathSegment(PathSegments.validate(environmentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1346,177 +1006,6 @@ public BaseSchematicHttpResponse getEnvironment( } } - public BaseSchematicHttpResponse updateEnvironment(String environmentId) { - return updateEnvironment( - environmentId, UpdateEnvironmentRequestBody.builder().build()); - } - - public BaseSchematicHttpResponse updateEnvironment( - String environmentId, RequestOptions requestOptions) { - return updateEnvironment( - environmentId, UpdateEnvironmentRequestBody.builder().build(), requestOptions); - } - - public BaseSchematicHttpResponse updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request) { - return updateEnvironment(environmentId, request, null); - } - - public BaseSchematicHttpResponse updateEnvironment( - String environmentId, UpdateEnvironmentRequestBody request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("environments") - .addPathSegment(environmentId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(BodyProperties.merge( - request, requestOptions != null ? requestOptions.getBodyProperties() : null)), - MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateEnvironmentResponse.class), - response); - } - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - - public BaseSchematicHttpResponse deleteEnvironment(String environmentId) { - return deleteEnvironment(environmentId, null); - } - - public BaseSchematicHttpResponse deleteEnvironment( - String environmentId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("environments") - .addPathSegment(environmentId); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method( - "DELETE", - BodyProperties.toRequestBody( - requestOptions != null ? requestOptions.getBodyProperties() : null, null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { - okhttpRequest = okhttpRequest - .newBuilder() - .tag( - RetryInterceptor.MaxRetriesOverride.class, - new RetryInterceptor.MaxRetriesOverride( - requestOptions.getMaxRetries().get())) - .build(); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteEnvironmentResponse.class), - response); - } - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new BaseSchematicApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - public BaseSchematicHttpResponse getOnboardingState() { return getOnboardingState(null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java deleted file mode 100644 index adf516ea..00000000 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * 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.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 = CreateApiKeyRequestBody.Builder.class) -public final class CreateApiKeyRequestBody { - private final Optional description; - - private final Optional environmentId; - - private final String name; - - private final Optional rateLimitPercent; - - private final Optional readonly; - - private final Map additionalProperties; - - private CreateApiKeyRequestBody( - Optional description, - Optional environmentId, - String name, - Optional rateLimitPercent, - Optional readonly, - Map additionalProperties) { - this.description = description; - this.environmentId = environmentId; - this.name = name; - this.rateLimitPercent = rateLimitPercent; - this.readonly = readonly; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - @JsonProperty("environment_id") - public Optional getEnvironmentId() { - return environmentId; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("rate_limit_percent") - public Optional getRateLimitPercent() { - return rateLimitPercent; - } - - @JsonProperty("readonly") - public Optional getReadonly() { - return readonly; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateApiKeyRequestBody && equalTo((CreateApiKeyRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateApiKeyRequestBody other) { - return description.equals(other.description) - && environmentId.equals(other.environmentId) - && name.equals(other.name) - && rateLimitPercent.equals(other.rateLimitPercent) - && readonly.equals(other.readonly); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.description, this.environmentId, this.name, this.rateLimitPercent, this.readonly); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(@NotNull String name); - - Builder from(CreateApiKeyRequestBody other); - } - - public interface _FinalStage { - CreateApiKeyRequestBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage description(Optional description); - - _FinalStage description(String description); - - _FinalStage environmentId(Optional environmentId); - - _FinalStage environmentId(String environmentId); - - _FinalStage rateLimitPercent(Optional rateLimitPercent); - - _FinalStage rateLimitPercent(Long rateLimitPercent); - - _FinalStage readonly(Optional readonly); - - _FinalStage readonly(Boolean readonly); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Optional readonly = Optional.empty(); - - private Optional rateLimitPercent = Optional.empty(); - - private Optional environmentId = Optional.empty(); - - private Optional description = Optional.empty(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateApiKeyRequestBody other) { - description(other.getDescription()); - environmentId(other.getEnvironmentId()); - name(other.getName()); - rateLimitPercent(other.getRateLimitPercent()); - readonly(other.getReadonly()); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage readonly(Boolean readonly) { - this.readonly = Optional.ofNullable(readonly); - return this; - } - - @java.lang.Override - @JsonSetter(value = "readonly", nulls = Nulls.SKIP) - public _FinalStage readonly(Optional readonly) { - this.readonly = readonly; - return this; - } - - @java.lang.Override - public _FinalStage rateLimitPercent(Long rateLimitPercent) { - this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); - return this; - } - - @java.lang.Override - @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) - public _FinalStage rateLimitPercent(Optional rateLimitPercent) { - this.rateLimitPercent = rateLimitPercent; - return this; - } - - @java.lang.Override - public _FinalStage environmentId(String environmentId) { - this.environmentId = Optional.ofNullable(environmentId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) - public _FinalStage environmentId(Optional environmentId) { - this.environmentId = environmentId; - return this; - } - - @java.lang.Override - public _FinalStage description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - @java.lang.Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - @java.lang.Override - public CreateApiKeyRequestBody build() { - return new CreateApiKeyRequestBody( - description, environmentId, name, rateLimitPercent, readonly, additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("description") - || key.equalsIgnoreCase("environment_id") - || key.equalsIgnoreCase("name") - || key.equalsIgnoreCase("rate_limit_percent") - || key.equalsIgnoreCase("readonly")) { - return; - } - this.additionalProperties.put(key, value); - } - - @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/accounts/requests/UpdateApiKeyRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java deleted file mode 100644 index 1eae59ea..00000000 --- a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * 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.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpdateApiKeyRequestBody.Builder.class) -public final class UpdateApiKeyRequestBody { - private final Optional description; - - private final Optional name; - - private final Optional rateLimitPercent; - - private final Map additionalProperties; - - private UpdateApiKeyRequestBody( - Optional description, - Optional name, - Optional rateLimitPercent, - Map additionalProperties) { - this.description = description; - this.name = name; - this.rateLimitPercent = rateLimitPercent; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("rate_limit_percent") - public Optional getRateLimitPercent() { - return rateLimitPercent; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateApiKeyRequestBody && equalTo((UpdateApiKeyRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateApiKeyRequestBody other) { - return description.equals(other.description) - && name.equals(other.name) - && rateLimitPercent.equals(other.rateLimitPercent); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.description, this.name, this.rateLimitPercent); - } - - @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 description = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional rateLimitPercent = Optional.empty(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UpdateApiKeyRequestBody other) { - description(other.getDescription()); - name(other.getName()); - rateLimitPercent(other.getRateLimitPercent()); - return this; - } - - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public Builder description(Optional description) { - this.description = description; - return this; - } - - public Builder description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) - public Builder rateLimitPercent(Optional rateLimitPercent) { - this.rateLimitPercent = rateLimitPercent; - return this; - } - - public Builder rateLimitPercent(Long rateLimitPercent) { - this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); - return this; - } - - public UpdateApiKeyRequestBody build() { - return new UpdateApiKeyRequestBody(description, name, rateLimitPercent, additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("description") - || key.equalsIgnoreCase("name") - || key.equalsIgnoreCase("rate_limit_percent")) { - return; - } - this.additionalProperties.put(key, value); - } - - 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/requests/UpdateEnvironmentRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java deleted file mode 100644 index 1049815c..00000000 --- a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * 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 com.schematic.api.types.EnvironmentType; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpdateEnvironmentRequestBody.Builder.class) -public final class UpdateEnvironmentRequestBody { - private final Optional environmentType; - - private final Optional name; - - private final Optional requireContextSignature; - - private final Map additionalProperties; - - private UpdateEnvironmentRequestBody( - Optional environmentType, - Optional name, - Optional requireContextSignature, - Map additionalProperties) { - this.environmentType = environmentType; - this.name = name; - this.requireContextSignature = requireContextSignature; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("environment_type") - public Optional getEnvironmentType() { - return environmentType; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("require_context_signature") - public Optional getRequireContextSignature() { - return requireContextSignature; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateEnvironmentRequestBody && equalTo((UpdateEnvironmentRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateEnvironmentRequestBody other) { - return environmentType.equals(other.environmentType) - && name.equals(other.name) - && requireContextSignature.equals(other.requireContextSignature); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.environmentType, this.name, this.requireContextSignature); - } - - @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 environmentType = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional requireContextSignature = Optional.empty(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UpdateEnvironmentRequestBody other) { - environmentType(other.getEnvironmentType()); - name(other.getName()); - requireContextSignature(other.getRequireContextSignature()); - return this; - } - - @JsonSetter(value = "environment_type", nulls = Nulls.SKIP) - public Builder environmentType(Optional environmentType) { - this.environmentType = environmentType; - return this; - } - - public Builder environmentType(EnvironmentType environmentType) { - this.environmentType = Optional.ofNullable(environmentType); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter(value = "require_context_signature", nulls = Nulls.SKIP) - public Builder requireContextSignature(Optional requireContextSignature) { - this.requireContextSignature = requireContextSignature; - return this; - } - - public Builder requireContextSignature(Boolean requireContextSignature) { - this.requireContextSignature = Optional.ofNullable(requireContextSignature); - return this; - } - - public UpdateEnvironmentRequestBody build() { - return new UpdateEnvironmentRequestBody( - environmentType, name, requireContextSignature, additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("environment_type") - || key.equalsIgnoreCase("name") - || key.equalsIgnoreCase("require_context_signature")) { - return; - } - this.additionalProperties.put(key, value); - } - - 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/DeleteApiKeyResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java deleted file mode 100644 index f8eec85f..00000000 --- a/src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * 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.JsonNode; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.DeleteResponse; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = DeleteApiKeyResponse.Builder.class) -public final class DeleteApiKeyResponse { - private final DeleteResponse data; - - private final Map params; - - private final Map additionalProperties; - - private DeleteApiKeyResponse( - DeleteResponse data, Map params, Map additionalProperties) { - this.data = data; - this.params = params; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public DeleteResponse 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 DeleteApiKeyResponse && equalTo((DeleteApiKeyResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DeleteApiKeyResponse 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 DeleteResponse data); - - Builder from(DeleteApiKeyResponse other); - } - - public interface _FinalStage { - DeleteApiKeyResponse 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 DeleteResponse data; - - private Map params = new LinkedHashMap<>(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(DeleteApiKeyResponse other) { - data(other.getData()); - params(other.getParams()); - return this; - } - - @java.lang.Override - @JsonSetter("data") - public _FinalStage data(@NotNull DeleteResponse data) { - this.data = Objects.requireNonNull(data, "data must not be null"); - return this; - } - - /** - *

Input parameters

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

Input parameters

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage putAllParams(Map params) { - if (params != null) { - this.params.putAll(params); - } - return this; - } - - /** - *

Input parameters

- */ - @java.lang.Override - @JsonSetter(value = "params", nulls = Nulls.SKIP) - public _FinalStage params(Map params) { - this.params.clear(); - if (params != null) { - this.params.putAll(params); - } - return this; - } - - @java.lang.Override - public DeleteApiKeyResponse build() { - return new DeleteApiKeyResponse(data, params, additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("data") || key.equalsIgnoreCase("params")) { - return; - } - this.additionalProperties.put(key, value); - } - - @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/accounts/types/UpdateApiKeyResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java deleted file mode 100644 index 81cd137c..00000000 --- a/src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * 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.JsonNode; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.ApiKeyResponseData; -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 = UpdateApiKeyResponse.Builder.class) -public final class UpdateApiKeyResponse { - private final ApiKeyResponseData data; - - private final Map params; - - private final Map additionalProperties; - - private UpdateApiKeyResponse( - ApiKeyResponseData data, Map params, Map additionalProperties) { - this.data = data; - this.params = params; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public ApiKeyResponseData 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 UpdateApiKeyResponse && equalTo((UpdateApiKeyResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateApiKeyResponse 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 ApiKeyResponseData data); - - Builder from(UpdateApiKeyResponse other); - } - - public interface _FinalStage { - UpdateApiKeyResponse 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 ApiKeyResponseData data; - - private Map params = new LinkedHashMap<>(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UpdateApiKeyResponse other) { - data(other.getData()); - params(other.getParams()); - return this; - } - - @java.lang.Override - @JsonSetter("data") - public _FinalStage data(@NotNull ApiKeyResponseData 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 UpdateApiKeyResponse build() { - return new UpdateApiKeyResponse(data, params, additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("data") || key.equalsIgnoreCase("params")) { - return; - } - this.additionalProperties.put(key, value); - } - - @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/accounts/types/UpdateEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java deleted file mode 100644 index bb79fe13..00000000 --- a/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * 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.JsonNode; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.EnvironmentResponseData; -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 = UpdateEnvironmentResponse.Builder.class) -public final class UpdateEnvironmentResponse { - private final EnvironmentResponseData data; - - private final Map params; - - private final Map additionalProperties; - - private UpdateEnvironmentResponse( - EnvironmentResponseData data, Map params, Map additionalProperties) { - this.data = data; - this.params = params; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public EnvironmentResponseData 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 UpdateEnvironmentResponse && equalTo((UpdateEnvironmentResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateEnvironmentResponse 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 EnvironmentResponseData data); - - Builder from(UpdateEnvironmentResponse other); - } - - public interface _FinalStage { - UpdateEnvironmentResponse 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 EnvironmentResponseData data; - - private Map params = new LinkedHashMap<>(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UpdateEnvironmentResponse other) { - data(other.getData()); - params(other.getParams()); - return this; - } - - @java.lang.Override - @JsonSetter("data") - public _FinalStage data(@NotNull EnvironmentResponseData 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 UpdateEnvironmentResponse build() { - return new UpdateEnvironmentResponse(data, params, additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("data") || key.equalsIgnoreCase("params")) { - return; - } - this.additionalProperties.put(key, value); - } - - @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/billing/AsyncBillingClient.java b/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java index 1da6a0c4..ee0d1441 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java @@ -6,9 +6,9 @@ import com.schematic.api.core.BaseSchematicHttpResponse; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.billing.requests.CountBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.CountBillingProductsRequest; import com.schematic.api.resources.billing.requests.CountCustomersRequest; -import com.schematic.api.resources.billing.requests.CountNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.CreateBillingCustomerRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingPriceRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingProductRequestBody; @@ -17,6 +17,7 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; @@ -25,14 +26,13 @@ import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; -import com.schematic.api.resources.billing.requests.ListNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; import com.schematic.api.resources.billing.requests.MarkInvoicePaidRequestBody; import com.schematic.api.resources.billing.requests.UpdateBillingSettingsRequestBody; import com.schematic.api.resources.billing.requests.UpdateCompanyBillingProfileRequestBody; +import com.schematic.api.resources.billing.types.CountBillingInvoicesResponse; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; -import com.schematic.api.resources.billing.types.CountNativeInvoicesResponse; import com.schematic.api.resources.billing.types.DeleteBillingCouponResponse; import com.schematic.api.resources.billing.types.DeleteBillingCustomerResponse; import com.schematic.api.resources.billing.types.DeleteBillingInvoiceResponse; @@ -40,9 +40,10 @@ import com.schematic.api.resources.billing.types.DeletePaymentMethodByExternalIdResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; import com.schematic.api.resources.billing.types.FinalizeNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.GetBillingInvoiceResponse; import com.schematic.api.resources.billing.types.GetBillingSettingsResponse; import com.schematic.api.resources.billing.types.GetCompanyNativeSubscriptionResponse; -import com.schematic.api.resources.billing.types.GetNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.ListBillingInvoicesResponse; import com.schematic.api.resources.billing.types.ListBillingPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; @@ -51,9 +52,8 @@ import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; -import com.schematic.api.resources.billing.types.ListNativeInvoicesResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.MarkNativeInvoicePaidResponse; +import com.schematic.api.resources.billing.types.MarkBillingInvoicePaidResponse; import com.schematic.api.resources.billing.types.UpdateBillingSettingsResponse; import com.schematic.api.resources.billing.types.UpdateCompanyBillingProfileResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; @@ -1066,10 +1066,10 @@ public CompletableFuture getCompanyNativeS return future; } - public CompletableFuture listNativeInvoices() { - CompletableFuture> rawFuture = - this.rawClient.listNativeInvoices(); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture listBillingInvoices() { + CompletableFuture> rawFuture = + this.rawClient.listBillingInvoices(); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1078,10 +1078,10 @@ public CompletableFuture listNativeInvoices() { return future; } - public CompletableFuture listNativeInvoices(RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.listNativeInvoices(requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture listBillingInvoices(RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.listBillingInvoices(requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1090,10 +1090,10 @@ public CompletableFuture listNativeInvoices(RequestO return future; } - public CompletableFuture listNativeInvoices(ListNativeInvoicesRequest request) { - CompletableFuture> rawFuture = - this.rawClient.listNativeInvoices(request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture listBillingInvoices(ListBillingInvoicesRequest request) { + CompletableFuture> rawFuture = + this.rawClient.listBillingInvoices(request); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1102,11 +1102,11 @@ public CompletableFuture listNativeInvoices(ListNati return future; } - public CompletableFuture listNativeInvoices( - ListNativeInvoicesRequest request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.listNativeInvoices(request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture listBillingInvoices( + ListBillingInvoicesRequest request, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.listBillingInvoices(request, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1115,10 +1115,10 @@ public CompletableFuture listNativeInvoices( return future; } - public CompletableFuture getNativeInvoice(String invoiceId) { - CompletableFuture> rawFuture = - this.rawClient.getNativeInvoice(invoiceId); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture getBillingInvoice(String invoiceId) { + CompletableFuture> rawFuture = + this.rawClient.getBillingInvoice(invoiceId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1127,11 +1127,11 @@ public CompletableFuture getNativeInvoice(String invoi return future; } - public CompletableFuture getNativeInvoice( + public CompletableFuture getBillingInvoice( String invoiceId, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.getNativeInvoice(invoiceId, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + CompletableFuture> rawFuture = + this.rawClient.getBillingInvoice(invoiceId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1189,11 +1189,11 @@ public CompletableFuture finalizeNativeInvoice( return future; } - public CompletableFuture markNativeInvoicePaid( + public CompletableFuture markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request) { - CompletableFuture> rawFuture = - this.rawClient.markNativeInvoicePaid(invoiceId, request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + CompletableFuture> rawFuture = + this.rawClient.markBillingInvoicePaid(invoiceId, request); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1202,11 +1202,11 @@ public CompletableFuture markNativeInvoicePaid( return future; } - public CompletableFuture markNativeInvoicePaid( + public CompletableFuture markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.markNativeInvoicePaid(invoiceId, request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + CompletableFuture> rawFuture = + this.rawClient.markBillingInvoicePaid(invoiceId, request, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1264,10 +1264,10 @@ public CompletableFuture voidNativeInvoice( return future; } - public CompletableFuture countNativeInvoices() { - CompletableFuture> rawFuture = - this.rawClient.countNativeInvoices(); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture countBillingInvoices() { + CompletableFuture> rawFuture = + this.rawClient.countBillingInvoices(); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1276,10 +1276,10 @@ public CompletableFuture countNativeInvoices() { return future; } - public CompletableFuture countNativeInvoices(RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.countNativeInvoices(requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture countBillingInvoices(RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.countBillingInvoices(requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1288,10 +1288,10 @@ public CompletableFuture countNativeInvoices(Reques return future; } - public CompletableFuture countNativeInvoices(CountNativeInvoicesRequest request) { - CompletableFuture> rawFuture = - this.rawClient.countNativeInvoices(request); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture countBillingInvoices(CountBillingInvoicesRequest request) { + CompletableFuture> rawFuture = + this.rawClient.countBillingInvoices(request); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); @@ -1300,11 +1300,11 @@ public CompletableFuture countNativeInvoices(CountN return future; } - public CompletableFuture countNativeInvoices( - CountNativeInvoicesRequest request, RequestOptions requestOptions) { - CompletableFuture> rawFuture = - this.rawClient.countNativeInvoices(request, requestOptions); - CompletableFuture future = rawFuture.thenApply(response -> response.body()); + public CompletableFuture countBillingInvoices( + CountBillingInvoicesRequest request, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.countBillingInvoices(request, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); future.whenComplete((result_, throwable_) -> { if (future.isCancelled()) { rawFuture.cancel(true); diff --git a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java index b078b7ba..97927889 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.ResponseBodyInputStream; @@ -20,9 +21,9 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.billing.requests.CountBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.CountBillingProductsRequest; import com.schematic.api.resources.billing.requests.CountCustomersRequest; -import com.schematic.api.resources.billing.requests.CountNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.CreateBillingCustomerRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingPriceRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingProductRequestBody; @@ -31,6 +32,7 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; @@ -39,14 +41,13 @@ import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; -import com.schematic.api.resources.billing.requests.ListNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; import com.schematic.api.resources.billing.requests.MarkInvoicePaidRequestBody; import com.schematic.api.resources.billing.requests.UpdateBillingSettingsRequestBody; import com.schematic.api.resources.billing.requests.UpdateCompanyBillingProfileRequestBody; +import com.schematic.api.resources.billing.types.CountBillingInvoicesResponse; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; -import com.schematic.api.resources.billing.types.CountNativeInvoicesResponse; import com.schematic.api.resources.billing.types.DeleteBillingCouponResponse; import com.schematic.api.resources.billing.types.DeleteBillingCustomerResponse; import com.schematic.api.resources.billing.types.DeleteBillingInvoiceResponse; @@ -54,9 +55,10 @@ import com.schematic.api.resources.billing.types.DeletePaymentMethodByExternalIdResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; import com.schematic.api.resources.billing.types.FinalizeNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.GetBillingInvoiceResponse; import com.schematic.api.resources.billing.types.GetBillingSettingsResponse; import com.schematic.api.resources.billing.types.GetCompanyNativeSubscriptionResponse; -import com.schematic.api.resources.billing.types.GetNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.ListBillingInvoicesResponse; import com.schematic.api.resources.billing.types.ListBillingPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; @@ -65,9 +67,8 @@ import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; -import com.schematic.api.resources.billing.types.ListNativeInvoicesResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.MarkNativeInvoicePaidResponse; +import com.schematic.api.resources.billing.types.MarkBillingInvoicePaidResponse; import com.schematic.api.resources.billing.types.UpdateBillingSettingsResponse; import com.schematic.api.resources.billing.types.UpdateCompanyBillingProfileResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; @@ -351,7 +352,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/coupons") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -459,7 +460,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -1188,7 +1189,7 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/invoices") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1763,7 +1764,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/payment-methods") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2172,7 +2173,7 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2469,7 +2470,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3175,7 +3176,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/profiles") - .addPathSegment(billingProfileId); + .addPathSegment(PathSegments.validate(billingProfileId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3627,7 +3628,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) + .addPathSegment(PathSegments.validate(companyId)) .addPathSegments("native-subscription"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3719,22 +3720,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> listNativeInvoices() { - return listNativeInvoices(ListNativeInvoicesRequest.builder().build()); + public CompletableFuture> listBillingInvoices() { + return listBillingInvoices(ListBillingInvoicesRequest.builder().build()); } - public CompletableFuture> listNativeInvoices( + public CompletableFuture> listBillingInvoices( RequestOptions requestOptions) { - return listNativeInvoices(ListNativeInvoicesRequest.builder().build(), requestOptions); + return listBillingInvoices(ListBillingInvoicesRequest.builder().build(), requestOptions); } - public CompletableFuture> listNativeInvoices( - ListNativeInvoicesRequest request) { - return listNativeInvoices(request, null); + public CompletableFuture> listBillingInvoices( + ListBillingInvoicesRequest request) { + return listBillingInvoices(request, null); } - public CompletableFuture> listNativeInvoices( - ListNativeInvoicesRequest request, RequestOptions requestOptions) { + public CompletableFuture> listBillingInvoices( + ListBillingInvoicesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices"); @@ -3750,6 +3751,21 @@ public CompletableFuture> QueryStringMapper.addQueryParameter( httpUrl, "document_state", request.getDocumentState().get(), false); } + if (request.getPastDue().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "past_due", request.getPastDue().get(), false); + } + if (request.getProviderType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -3782,7 +3798,7 @@ public CompletableFuture> requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -3792,7 +3808,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListNativeInvoicesResponse.class), + responseBodyString, ListBillingInvoicesResponse.class), response)); return; } @@ -3852,16 +3868,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> getNativeInvoice(String invoiceId) { - return getNativeInvoice(invoiceId, null); + public CompletableFuture> getBillingInvoice(String invoiceId) { + return getBillingInvoice(invoiceId, null); } - public CompletableFuture> getNativeInvoice( + public CompletableFuture> getBillingInvoice( String invoiceId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId); + .addPathSegment(PathSegments.validate(invoiceId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3886,7 +3902,7 @@ public CompletableFuture> ge requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -3895,7 +3911,8 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetNativeInvoiceResponse.class), + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetBillingInvoiceResponse.class), response)); return; } @@ -3959,7 +3976,7 @@ public CompletableFuture> exportNativeInv HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("export"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -4059,7 +4076,7 @@ public CompletableFuture { @@ -4159,17 +4176,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> markNativeInvoicePaid( + public CompletableFuture> markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request) { - return markNativeInvoicePaid(invoiceId, request, null); + return markBillingInvoicePaid(invoiceId, request, null); } - public CompletableFuture> markNativeInvoicePaid( + public CompletableFuture> markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("mark-paid"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -4205,7 +4222,7 @@ public CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -4215,7 +4232,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, MarkNativeInvoicePaidResponse.class), + responseBodyString, MarkBillingInvoicePaidResponse.class), response)); return; } @@ -4284,7 +4301,7 @@ public CompletableFuture> downloadNativeI HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("pdf"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -4383,7 +4400,7 @@ public CompletableFuture> v HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("void"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -4483,22 +4500,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> countNativeInvoices() { - return countNativeInvoices(CountNativeInvoicesRequest.builder().build()); + public CompletableFuture> countBillingInvoices() { + return countBillingInvoices(CountBillingInvoicesRequest.builder().build()); } - public CompletableFuture> countNativeInvoices( + public CompletableFuture> countBillingInvoices( RequestOptions requestOptions) { - return countNativeInvoices(CountNativeInvoicesRequest.builder().build(), requestOptions); + return countBillingInvoices(CountBillingInvoicesRequest.builder().build(), requestOptions); } - public CompletableFuture> countNativeInvoices( - CountNativeInvoicesRequest request) { - return countNativeInvoices(request, null); + public CompletableFuture> countBillingInvoices( + CountBillingInvoicesRequest request) { + return countBillingInvoices(request, null); } - public CompletableFuture> countNativeInvoices( - CountNativeInvoicesRequest request, RequestOptions requestOptions) { + public CompletableFuture> countBillingInvoices( + CountBillingInvoicesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices/count"); @@ -4514,6 +4531,21 @@ public CompletableFuture> QueryStringMapper.addQueryParameter( httpUrl, "document_state", request.getDocumentState().get(), false); } + if (request.getPastDue().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "past_due", request.getPastDue().get(), false); + } + if (request.getProviderType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -4546,7 +4578,7 @@ public CompletableFuture> requestOptions.getMaxRetries().get())) .build(); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); okhttpCall.enqueue(new Callback() { @Override @@ -4556,7 +4588,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CountNativeInvoicesResponse.class), + responseBodyString, CountBillingInvoicesResponse.class), response)); return; } diff --git a/src/main/java/com/schematic/api/resources/billing/BillingClient.java b/src/main/java/com/schematic/api/resources/billing/BillingClient.java index 68283035..d65fe309 100644 --- a/src/main/java/com/schematic/api/resources/billing/BillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/BillingClient.java @@ -5,9 +5,9 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.billing.requests.CountBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.CountBillingProductsRequest; import com.schematic.api.resources.billing.requests.CountCustomersRequest; -import com.schematic.api.resources.billing.requests.CountNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.CreateBillingCustomerRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingPriceRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingProductRequestBody; @@ -16,6 +16,7 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; @@ -24,14 +25,13 @@ import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; -import com.schematic.api.resources.billing.requests.ListNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; import com.schematic.api.resources.billing.requests.MarkInvoicePaidRequestBody; import com.schematic.api.resources.billing.requests.UpdateBillingSettingsRequestBody; import com.schematic.api.resources.billing.requests.UpdateCompanyBillingProfileRequestBody; +import com.schematic.api.resources.billing.types.CountBillingInvoicesResponse; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; -import com.schematic.api.resources.billing.types.CountNativeInvoicesResponse; import com.schematic.api.resources.billing.types.DeleteBillingCouponResponse; import com.schematic.api.resources.billing.types.DeleteBillingCustomerResponse; import com.schematic.api.resources.billing.types.DeleteBillingInvoiceResponse; @@ -39,9 +39,10 @@ import com.schematic.api.resources.billing.types.DeletePaymentMethodByExternalIdResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; import com.schematic.api.resources.billing.types.FinalizeNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.GetBillingInvoiceResponse; import com.schematic.api.resources.billing.types.GetBillingSettingsResponse; import com.schematic.api.resources.billing.types.GetCompanyNativeSubscriptionResponse; -import com.schematic.api.resources.billing.types.GetNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.ListBillingInvoicesResponse; import com.schematic.api.resources.billing.types.ListBillingPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; @@ -50,9 +51,8 @@ import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; -import com.schematic.api.resources.billing.types.ListNativeInvoicesResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.MarkNativeInvoicePaidResponse; +import com.schematic.api.resources.billing.types.MarkBillingInvoicePaidResponse; import com.schematic.api.resources.billing.types.UpdateBillingSettingsResponse; import com.schematic.api.resources.billing.types.UpdateCompanyBillingProfileResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; @@ -427,29 +427,29 @@ public GetCompanyNativeSubscriptionResponse getCompanyNativeSubscription( .body(); } - public ListNativeInvoicesResponse listNativeInvoices() { - return this.rawClient.listNativeInvoices().body(); + public ListBillingInvoicesResponse listBillingInvoices() { + return this.rawClient.listBillingInvoices().body(); } - public ListNativeInvoicesResponse listNativeInvoices(RequestOptions requestOptions) { - return this.rawClient.listNativeInvoices(requestOptions).body(); + public ListBillingInvoicesResponse listBillingInvoices(RequestOptions requestOptions) { + return this.rawClient.listBillingInvoices(requestOptions).body(); } - public ListNativeInvoicesResponse listNativeInvoices(ListNativeInvoicesRequest request) { - return this.rawClient.listNativeInvoices(request).body(); + public ListBillingInvoicesResponse listBillingInvoices(ListBillingInvoicesRequest request) { + return this.rawClient.listBillingInvoices(request).body(); } - public ListNativeInvoicesResponse listNativeInvoices( - ListNativeInvoicesRequest request, RequestOptions requestOptions) { - return this.rawClient.listNativeInvoices(request, requestOptions).body(); + public ListBillingInvoicesResponse listBillingInvoices( + ListBillingInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.listBillingInvoices(request, requestOptions).body(); } - public GetNativeInvoiceResponse getNativeInvoice(String invoiceId) { - return this.rawClient.getNativeInvoice(invoiceId).body(); + public GetBillingInvoiceResponse getBillingInvoice(String invoiceId) { + return this.rawClient.getBillingInvoice(invoiceId).body(); } - public GetNativeInvoiceResponse getNativeInvoice(String invoiceId, RequestOptions requestOptions) { - return this.rawClient.getNativeInvoice(invoiceId, requestOptions).body(); + public GetBillingInvoiceResponse getBillingInvoice(String invoiceId, RequestOptions requestOptions) { + return this.rawClient.getBillingInvoice(invoiceId, requestOptions).body(); } public InputStream exportNativeInvoice(String invoiceId) { @@ -468,14 +468,14 @@ public FinalizeNativeInvoiceResponse finalizeNativeInvoice(String invoiceId, Req return this.rawClient.finalizeNativeInvoice(invoiceId, requestOptions).body(); } - public MarkNativeInvoicePaidResponse markNativeInvoicePaid(String invoiceId, MarkInvoicePaidRequestBody request) { - return this.rawClient.markNativeInvoicePaid(invoiceId, request).body(); + public MarkBillingInvoicePaidResponse markBillingInvoicePaid(String invoiceId, MarkInvoicePaidRequestBody request) { + return this.rawClient.markBillingInvoicePaid(invoiceId, request).body(); } - public MarkNativeInvoicePaidResponse markNativeInvoicePaid( + public MarkBillingInvoicePaidResponse markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request, RequestOptions requestOptions) { return this.rawClient - .markNativeInvoicePaid(invoiceId, request, requestOptions) + .markBillingInvoicePaid(invoiceId, request, requestOptions) .body(); } @@ -497,20 +497,20 @@ public VoidNativeInvoiceResponse voidNativeInvoice(String invoiceId, RequestOpti return this.rawClient.voidNativeInvoice(invoiceId, requestOptions).body(); } - public CountNativeInvoicesResponse countNativeInvoices() { - return this.rawClient.countNativeInvoices().body(); + public CountBillingInvoicesResponse countBillingInvoices() { + return this.rawClient.countBillingInvoices().body(); } - public CountNativeInvoicesResponse countNativeInvoices(RequestOptions requestOptions) { - return this.rawClient.countNativeInvoices(requestOptions).body(); + public CountBillingInvoicesResponse countBillingInvoices(RequestOptions requestOptions) { + return this.rawClient.countBillingInvoices(requestOptions).body(); } - public CountNativeInvoicesResponse countNativeInvoices(CountNativeInvoicesRequest request) { - return this.rawClient.countNativeInvoices(request).body(); + public CountBillingInvoicesResponse countBillingInvoices(CountBillingInvoicesRequest request) { + return this.rawClient.countBillingInvoices(request).body(); } - public CountNativeInvoicesResponse countNativeInvoices( - CountNativeInvoicesRequest request, RequestOptions requestOptions) { - return this.rawClient.countNativeInvoices(request, requestOptions).body(); + public CountBillingInvoicesResponse countBillingInvoices( + CountBillingInvoicesRequest request, RequestOptions requestOptions) { + return this.rawClient.countBillingInvoices(request, requestOptions).body(); } } diff --git a/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java b/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java index b672f12b..158785d3 100644 --- a/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.ResponseBodyInputStream; @@ -20,9 +21,9 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.billing.requests.CountBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.CountBillingProductsRequest; import com.schematic.api.resources.billing.requests.CountCustomersRequest; -import com.schematic.api.resources.billing.requests.CountNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.CreateBillingCustomerRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingPriceRequestBody; import com.schematic.api.resources.billing.requests.CreateBillingProductRequestBody; @@ -31,6 +32,7 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingInvoicesRequest; import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; @@ -39,14 +41,13 @@ import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; -import com.schematic.api.resources.billing.requests.ListNativeInvoicesRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; import com.schematic.api.resources.billing.requests.MarkInvoicePaidRequestBody; import com.schematic.api.resources.billing.requests.UpdateBillingSettingsRequestBody; import com.schematic.api.resources.billing.requests.UpdateCompanyBillingProfileRequestBody; +import com.schematic.api.resources.billing.types.CountBillingInvoicesResponse; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; -import com.schematic.api.resources.billing.types.CountNativeInvoicesResponse; import com.schematic.api.resources.billing.types.DeleteBillingCouponResponse; import com.schematic.api.resources.billing.types.DeleteBillingCustomerResponse; import com.schematic.api.resources.billing.types.DeleteBillingInvoiceResponse; @@ -54,9 +55,10 @@ import com.schematic.api.resources.billing.types.DeletePaymentMethodByExternalIdResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; import com.schematic.api.resources.billing.types.FinalizeNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.GetBillingInvoiceResponse; import com.schematic.api.resources.billing.types.GetBillingSettingsResponse; import com.schematic.api.resources.billing.types.GetCompanyNativeSubscriptionResponse; -import com.schematic.api.resources.billing.types.GetNativeInvoiceResponse; +import com.schematic.api.resources.billing.types.ListBillingInvoicesResponse; import com.schematic.api.resources.billing.types.ListBillingPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; @@ -65,9 +67,8 @@ import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; -import com.schematic.api.resources.billing.types.ListNativeInvoicesResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.MarkNativeInvoicePaidResponse; +import com.schematic.api.resources.billing.types.MarkBillingInvoicePaidResponse; import com.schematic.api.resources.billing.types.UpdateBillingSettingsResponse; import com.schematic.api.resources.billing.types.UpdateCompanyBillingProfileResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; @@ -282,7 +283,7 @@ public BaseSchematicHttpResponse deleteBillingCoupo HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/coupons") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -358,7 +359,7 @@ public BaseSchematicHttpResponse deleteBillingCus HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/customer") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -895,7 +896,7 @@ public BaseSchematicHttpResponse deleteBillingInvo HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/invoices") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1313,7 +1314,7 @@ public BaseSchematicHttpResponse delete HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/payment-methods") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1626,7 +1627,7 @@ public BaseSchematicHttpResponse deleteBillingProd HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1859,7 +1860,7 @@ public BaseSchematicHttpResponse deleteProductPrice( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices") - .addPathSegment(billingId); + .addPathSegment(PathSegments.validate(billingId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2404,7 +2405,7 @@ public BaseSchematicHttpResponse updateComp HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/profiles") - .addPathSegment(billingProfileId); + .addPathSegment(PathSegments.validate(billingProfileId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2733,7 +2734,7 @@ public BaseSchematicHttpResponse getCompan HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) + .addPathSegment(PathSegments.validate(companyId)) .addPathSegments("native-subscription"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2796,20 +2797,21 @@ public BaseSchematicHttpResponse getCompan } } - public BaseSchematicHttpResponse listNativeInvoices() { - return listNativeInvoices(ListNativeInvoicesRequest.builder().build()); + public BaseSchematicHttpResponse listBillingInvoices() { + return listBillingInvoices(ListBillingInvoicesRequest.builder().build()); } - public BaseSchematicHttpResponse listNativeInvoices(RequestOptions requestOptions) { - return listNativeInvoices(ListNativeInvoicesRequest.builder().build(), requestOptions); + public BaseSchematicHttpResponse listBillingInvoices(RequestOptions requestOptions) { + return listBillingInvoices(ListBillingInvoicesRequest.builder().build(), requestOptions); } - public BaseSchematicHttpResponse listNativeInvoices(ListNativeInvoicesRequest request) { - return listNativeInvoices(request, null); + public BaseSchematicHttpResponse listBillingInvoices( + ListBillingInvoicesRequest request) { + return listBillingInvoices(request, null); } - public BaseSchematicHttpResponse listNativeInvoices( - ListNativeInvoicesRequest request, RequestOptions requestOptions) { + public BaseSchematicHttpResponse listBillingInvoices( + ListBillingInvoicesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices"); @@ -2825,6 +2827,21 @@ public BaseSchematicHttpResponse listNativeInvoices( QueryStringMapper.addQueryParameter( httpUrl, "document_state", request.getDocumentState().get(), false); } + if (request.getPastDue().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "past_due", request.getPastDue().get(), false); + } + if (request.getProviderType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -2862,7 +2879,7 @@ public BaseSchematicHttpResponse listNativeInvoices( String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListNativeInvoicesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBillingInvoicesResponse.class), response); } try { @@ -2896,16 +2913,16 @@ public BaseSchematicHttpResponse listNativeInvoices( } } - public BaseSchematicHttpResponse getNativeInvoice(String invoiceId) { - return getNativeInvoice(invoiceId, null); + public BaseSchematicHttpResponse getBillingInvoice(String invoiceId) { + return getBillingInvoice(invoiceId, null); } - public BaseSchematicHttpResponse getNativeInvoice( + public BaseSchematicHttpResponse getBillingInvoice( String invoiceId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId); + .addPathSegment(PathSegments.validate(invoiceId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2935,7 +2952,7 @@ public BaseSchematicHttpResponse getNativeInvoice( String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetNativeInvoiceResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetBillingInvoiceResponse.class), response); } try { @@ -2974,7 +2991,7 @@ public BaseSchematicHttpResponse exportNativeInvoice(String invoice HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("export"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3044,7 +3061,7 @@ public BaseSchematicHttpResponse finalizeNativeIn HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("finalize"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3113,17 +3130,17 @@ public BaseSchematicHttpResponse finalizeNativeIn } } - public BaseSchematicHttpResponse markNativeInvoicePaid( + public BaseSchematicHttpResponse markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request) { - return markNativeInvoicePaid(invoiceId, request, null); + return markBillingInvoicePaid(invoiceId, request, null); } - public BaseSchematicHttpResponse markNativeInvoicePaid( + public BaseSchematicHttpResponse markBillingInvoicePaid( String invoiceId, MarkInvoicePaidRequestBody request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("mark-paid"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3164,7 +3181,7 @@ public BaseSchematicHttpResponse markNativeInvoic String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MarkNativeInvoicePaidResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MarkBillingInvoicePaidResponse.class), response); } try { @@ -3207,7 +3224,7 @@ public BaseSchematicHttpResponse downloadNativeInvoicePdf( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("pdf"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3277,7 +3294,7 @@ public BaseSchematicHttpResponse voidNativeInvoice( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices") - .addPathSegment(invoiceId) + .addPathSegment(PathSegments.validate(invoiceId)) .addPathSegments("void"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3346,21 +3363,21 @@ public BaseSchematicHttpResponse voidNativeInvoice( } } - public BaseSchematicHttpResponse countNativeInvoices() { - return countNativeInvoices(CountNativeInvoicesRequest.builder().build()); + public BaseSchematicHttpResponse countBillingInvoices() { + return countBillingInvoices(CountBillingInvoicesRequest.builder().build()); } - public BaseSchematicHttpResponse countNativeInvoices(RequestOptions requestOptions) { - return countNativeInvoices(CountNativeInvoicesRequest.builder().build(), requestOptions); + public BaseSchematicHttpResponse countBillingInvoices(RequestOptions requestOptions) { + return countBillingInvoices(CountBillingInvoicesRequest.builder().build(), requestOptions); } - public BaseSchematicHttpResponse countNativeInvoices( - CountNativeInvoicesRequest request) { - return countNativeInvoices(request, null); + public BaseSchematicHttpResponse countBillingInvoices( + CountBillingInvoicesRequest request) { + return countBillingInvoices(request, null); } - public BaseSchematicHttpResponse countNativeInvoices( - CountNativeInvoicesRequest request, RequestOptions requestOptions) { + public BaseSchematicHttpResponse countBillingInvoices( + CountBillingInvoicesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("invoices/count"); @@ -3376,6 +3393,21 @@ public BaseSchematicHttpResponse countNativeInvoice QueryStringMapper.addQueryParameter( httpUrl, "document_state", request.getDocumentState().get(), false); } + if (request.getPastDue().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "past_due", request.getPastDue().get(), false); + } + if (request.getProviderType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -3413,7 +3445,7 @@ public BaseSchematicHttpResponse countNativeInvoice String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountNativeInvoicesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountBillingInvoicesResponse.class), response); } try { diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListNativeInvoicesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/CountBillingInvoicesRequest.java similarity index 56% rename from src/main/java/com/schematic/api/resources/billing/requests/ListNativeInvoicesRequest.java rename to src/main/java/com/schematic/api/resources/billing/requests/CountBillingInvoicesRequest.java index 60e4a686..7bd10d56 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListNativeInvoicesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CountBillingInvoicesRequest.java @@ -12,37 +12,55 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import com.schematic.api.types.InvoiceDocumentState; +import com.schematic.api.types.InvoiceStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListNativeInvoicesRequest.Builder.class) -public final class ListNativeInvoicesRequest { +@JsonDeserialize(builder = CountBillingInvoicesRequest.Builder.class) +public final class CountBillingInvoicesRequest { private final Optional companyId; private final Optional contractId; private final Optional documentState; + private final Optional pastDue; + + private final Optional providerType; + + private final Optional q; + + private final Optional status; + private final Optional limit; private final Optional offset; private final Map additionalProperties; - private ListNativeInvoicesRequest( + private CountBillingInvoicesRequest( Optional companyId, Optional contractId, Optional documentState, + Optional pastDue, + Optional providerType, + Optional q, + Optional status, Optional limit, Optional offset, Map additionalProperties) { this.companyId = companyId; this.contractId = contractId; this.documentState = documentState; + this.pastDue = pastDue; + this.providerType = providerType; + this.q = q; + this.status = status; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -63,6 +81,35 @@ public Optional getDocumentState() { return documentState; } + /** + * @return Only open invoices with an amount left to pay whose due date has passed. + */ + @JsonProperty("past_due") + public Optional getPastDue() { + return pastDue; + } + + /** + * @return Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe. + */ + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + /** + * @return Search by invoice number, provider invoice ID or company name. + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + /** * @return Page limit (default 100) */ @@ -82,7 +129,7 @@ public Optional getOffset() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListNativeInvoicesRequest && equalTo((ListNativeInvoicesRequest) other); + return other instanceof CountBillingInvoicesRequest && equalTo((CountBillingInvoicesRequest) other); } @JsonAnyGetter @@ -90,17 +137,30 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListNativeInvoicesRequest other) { + private boolean equalTo(CountBillingInvoicesRequest other) { return companyId.equals(other.companyId) && contractId.equals(other.contractId) && documentState.equals(other.documentState) + && pastDue.equals(other.pastDue) + && providerType.equals(other.providerType) + && q.equals(other.q) + && status.equals(other.status) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.contractId, this.documentState, this.limit, this.offset); + return Objects.hash( + this.companyId, + this.contractId, + this.documentState, + this.pastDue, + this.providerType, + this.q, + this.status, + this.limit, + this.offset); } @java.lang.Override @@ -120,6 +180,14 @@ public static final class Builder { private Optional documentState = Optional.empty(); + private Optional pastDue = Optional.empty(); + + private Optional providerType = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional status = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -128,10 +196,14 @@ public static final class Builder { private Builder() {} - public Builder from(ListNativeInvoicesRequest other) { + public Builder from(CountBillingInvoicesRequest other) { companyId(other.getCompanyId()); contractId(other.getContractId()); documentState(other.getDocumentState()); + pastDue(other.getPastDue()); + providerType(other.getProviderType()); + q(other.getQ()); + status(other.getStatus()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -170,6 +242,59 @@ public Builder documentState(InvoiceDocumentState documentState) { return this; } + /** + *

Only open invoices with an amount left to pay whose due date has passed.

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

Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe.

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

Search by invoice number, provider invoice ID or company name.

+ */ + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + /** *

Page limit (default 100)

*/ @@ -198,9 +323,18 @@ public Builder offset(Long offset) { return this; } - public ListNativeInvoicesRequest build() { - return new ListNativeInvoicesRequest( - companyId, contractId, documentState, limit, offset, additionalProperties); + public CountBillingInvoicesRequest build() { + return new CountBillingInvoicesRequest( + companyId, + contractId, + documentState, + pastDue, + providerType, + q, + status, + limit, + offset, + additionalProperties); } @JsonAnySetter @@ -208,6 +342,10 @@ private void putAdditionalPropertyFromJson(String key, Object value) { if (key.equalsIgnoreCase("company_id") || key.equalsIgnoreCase("contract_id") || key.equalsIgnoreCase("document_state") + || key.equalsIgnoreCase("past_due") + || key.equalsIgnoreCase("provider_type") + || key.equalsIgnoreCase("q") + || key.equalsIgnoreCase("status") || key.equalsIgnoreCase("limit") || key.equalsIgnoreCase("offset")) { return; diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java index de1d09cb..072d4be8 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.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.PaymentMethodBillingDetailsRequestBody; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -39,6 +40,8 @@ public final class CreatePaymentMethodRequestBody { private final Optional cardLast4; + private final Optional customerBillingDetails; + private final String customerExternalId; private final String externalId; @@ -57,6 +60,7 @@ private CreatePaymentMethodRequestBody( Optional cardExpMonth, Optional cardExpYear, Optional cardLast4, + Optional customerBillingDetails, String customerExternalId, String externalId, String paymentMethodType, @@ -70,6 +74,7 @@ private CreatePaymentMethodRequestBody( this.cardExpMonth = cardExpMonth; this.cardExpYear = cardExpYear; this.cardLast4 = cardLast4; + this.customerBillingDetails = customerBillingDetails; this.customerExternalId = customerExternalId; this.externalId = externalId; this.paymentMethodType = paymentMethodType; @@ -121,6 +126,11 @@ public Optional getCardLast4() { return cardLast4; } + @JsonProperty("customer_billing_details") + public Optional getCustomerBillingDetails() { + return customerBillingDetails; + } + @JsonProperty("customer_external_id") public String getCustomerExternalId() { return customerExternalId; @@ -157,6 +167,7 @@ private boolean equalTo(CreatePaymentMethodRequestBody other) { && cardExpMonth.equals(other.cardExpMonth) && cardExpYear.equals(other.cardExpYear) && cardLast4.equals(other.cardLast4) + && customerBillingDetails.equals(other.customerBillingDetails) && customerExternalId.equals(other.customerExternalId) && externalId.equals(other.externalId) && paymentMethodType.equals(other.paymentMethodType); @@ -174,6 +185,7 @@ public int hashCode() { this.cardExpMonth, this.cardExpYear, this.cardLast4, + this.customerBillingDetails, this.customerExternalId, this.externalId, this.paymentMethodType); @@ -244,6 +256,10 @@ public interface _FinalStage { _FinalStage cardLast4(Optional cardLast4); _FinalStage cardLast4(String cardLast4); + + _FinalStage customerBillingDetails(Optional customerBillingDetails); + + _FinalStage customerBillingDetails(PaymentMethodBillingDetailsRequestBody customerBillingDetails); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -255,6 +271,8 @@ public static final class Builder private String paymentMethodType; + private Optional customerBillingDetails = Optional.empty(); + private Optional cardLast4 = Optional.empty(); private Optional cardExpYear = Optional.empty(); @@ -288,6 +306,7 @@ public Builder from(CreatePaymentMethodRequestBody other) { cardExpMonth(other.getCardExpMonth()); cardExpYear(other.getCardExpYear()); cardLast4(other.getCardLast4()); + customerBillingDetails(other.getCustomerBillingDetails()); customerExternalId(other.getCustomerExternalId()); externalId(other.getExternalId()); paymentMethodType(other.getPaymentMethodType()); @@ -315,6 +334,20 @@ public _FinalStage paymentMethodType(@NotNull String paymentMethodType) { return this; } + @java.lang.Override + public _FinalStage customerBillingDetails(PaymentMethodBillingDetailsRequestBody customerBillingDetails) { + this.customerBillingDetails = Optional.ofNullable(customerBillingDetails); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer_billing_details", nulls = Nulls.SKIP) + public _FinalStage customerBillingDetails( + Optional customerBillingDetails) { + this.customerBillingDetails = customerBillingDetails; + return this; + } + @java.lang.Override public _FinalStage cardLast4(String cardLast4) { this.cardLast4 = Optional.ofNullable(cardLast4); @@ -444,6 +477,7 @@ public CreatePaymentMethodRequestBody build() { cardExpMonth, cardExpYear, cardLast4, + customerBillingDetails, customerExternalId, externalId, paymentMethodType, @@ -461,6 +495,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("card_exp_month") || key.equalsIgnoreCase("card_exp_year") || key.equalsIgnoreCase("card_last4") + || key.equalsIgnoreCase("customer_billing_details") || key.equalsIgnoreCase("customer_external_id") || key.equalsIgnoreCase("external_id") || key.equalsIgnoreCase("payment_method_type")) { diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CountNativeInvoicesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingInvoicesRequest.java similarity index 56% rename from src/main/java/com/schematic/api/resources/billing/requests/CountNativeInvoicesRequest.java rename to src/main/java/com/schematic/api/resources/billing/requests/ListBillingInvoicesRequest.java index e5c19eee..fbc7528a 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CountNativeInvoicesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingInvoicesRequest.java @@ -12,37 +12,55 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import com.schematic.api.types.InvoiceDocumentState; +import com.schematic.api.types.InvoiceStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountNativeInvoicesRequest.Builder.class) -public final class CountNativeInvoicesRequest { +@JsonDeserialize(builder = ListBillingInvoicesRequest.Builder.class) +public final class ListBillingInvoicesRequest { private final Optional companyId; private final Optional contractId; private final Optional documentState; + private final Optional pastDue; + + private final Optional providerType; + + private final Optional q; + + private final Optional status; + private final Optional limit; private final Optional offset; private final Map additionalProperties; - private CountNativeInvoicesRequest( + private ListBillingInvoicesRequest( Optional companyId, Optional contractId, Optional documentState, + Optional pastDue, + Optional providerType, + Optional q, + Optional status, Optional limit, Optional offset, Map additionalProperties) { this.companyId = companyId; this.contractId = contractId; this.documentState = documentState; + this.pastDue = pastDue; + this.providerType = providerType; + this.q = q; + this.status = status; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -63,6 +81,35 @@ public Optional getDocumentState() { return documentState; } + /** + * @return Only open invoices with an amount left to pay whose due date has passed. + */ + @JsonProperty("past_due") + public Optional getPastDue() { + return pastDue; + } + + /** + * @return Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe. + */ + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + /** + * @return Search by invoice number, provider invoice ID or company name. + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + /** * @return Page limit (default 100) */ @@ -82,7 +129,7 @@ public Optional getOffset() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountNativeInvoicesRequest && equalTo((CountNativeInvoicesRequest) other); + return other instanceof ListBillingInvoicesRequest && equalTo((ListBillingInvoicesRequest) other); } @JsonAnyGetter @@ -90,17 +137,30 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountNativeInvoicesRequest other) { + private boolean equalTo(ListBillingInvoicesRequest other) { return companyId.equals(other.companyId) && contractId.equals(other.contractId) && documentState.equals(other.documentState) + && pastDue.equals(other.pastDue) + && providerType.equals(other.providerType) + && q.equals(other.q) + && status.equals(other.status) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.contractId, this.documentState, this.limit, this.offset); + return Objects.hash( + this.companyId, + this.contractId, + this.documentState, + this.pastDue, + this.providerType, + this.q, + this.status, + this.limit, + this.offset); } @java.lang.Override @@ -120,6 +180,14 @@ public static final class Builder { private Optional documentState = Optional.empty(); + private Optional pastDue = Optional.empty(); + + private Optional providerType = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional status = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -128,10 +196,14 @@ public static final class Builder { private Builder() {} - public Builder from(CountNativeInvoicesRequest other) { + public Builder from(ListBillingInvoicesRequest other) { companyId(other.getCompanyId()); contractId(other.getContractId()); documentState(other.getDocumentState()); + pastDue(other.getPastDue()); + providerType(other.getProviderType()); + q(other.getQ()); + status(other.getStatus()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -170,6 +242,59 @@ public Builder documentState(InvoiceDocumentState documentState) { return this; } + /** + *

Only open invoices with an amount left to pay whose due date has passed.

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

Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe.

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

Search by invoice number, provider invoice ID or company name.

+ */ + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + /** *

Page limit (default 100)

*/ @@ -198,9 +323,18 @@ public Builder offset(Long offset) { return this; } - public CountNativeInvoicesRequest build() { - return new CountNativeInvoicesRequest( - companyId, contractId, documentState, limit, offset, additionalProperties); + public ListBillingInvoicesRequest build() { + return new ListBillingInvoicesRequest( + companyId, + contractId, + documentState, + pastDue, + providerType, + q, + status, + limit, + offset, + additionalProperties); } @JsonAnySetter @@ -208,6 +342,10 @@ private void putAdditionalPropertyFromJson(String key, Object value) { if (key.equalsIgnoreCase("company_id") || key.equalsIgnoreCase("contract_id") || key.equalsIgnoreCase("document_state") + || key.equalsIgnoreCase("past_due") + || key.equalsIgnoreCase("provider_type") + || key.equalsIgnoreCase("q") + || key.equalsIgnoreCase("status") || key.equalsIgnoreCase("limit") || key.equalsIgnoreCase("offset")) { return; diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListNativeInvoicesParams.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingInvoicesParams.java similarity index 55% rename from src/main/java/com/schematic/api/resources/billing/types/ListNativeInvoicesParams.java rename to src/main/java/com/schematic/api/resources/billing/types/CountBillingInvoicesParams.java index 447b2c91..50ff7b2d 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListNativeInvoicesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/CountBillingInvoicesParams.java @@ -12,15 +12,17 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import com.schematic.api.types.InvoiceDocumentState; +import com.schematic.api.types.InvoiceStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListNativeInvoicesParams.Builder.class) -public final class ListNativeInvoicesParams { +@JsonDeserialize(builder = CountBillingInvoicesParams.Builder.class) +public final class CountBillingInvoicesParams { private final Optional companyId; private final Optional contractId; @@ -31,20 +33,36 @@ public final class ListNativeInvoicesParams { private final Optional offset; + private final Optional pastDue; + + private final Optional providerType; + + private final Optional q; + + private final Optional status; + private final Map additionalProperties; - private ListNativeInvoicesParams( + private CountBillingInvoicesParams( Optional companyId, Optional contractId, Optional documentState, Optional limit, Optional offset, + Optional pastDue, + Optional providerType, + Optional q, + Optional status, Map additionalProperties) { this.companyId = companyId; this.contractId = contractId; this.documentState = documentState; this.limit = limit; this.offset = offset; + this.pastDue = pastDue; + this.providerType = providerType; + this.q = q; + this.status = status; this.additionalProperties = additionalProperties; } @@ -79,10 +97,39 @@ public Optional getOffset() { return offset; } + /** + * @return Only open invoices with an amount left to pay whose due date has passed. + */ + @JsonProperty("past_due") + public Optional getPastDue() { + return pastDue; + } + + /** + * @return Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe. + */ + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + /** + * @return Search by invoice number, provider invoice ID or company name. + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListNativeInvoicesParams && equalTo((ListNativeInvoicesParams) other); + return other instanceof CountBillingInvoicesParams && equalTo((CountBillingInvoicesParams) other); } @JsonAnyGetter @@ -90,17 +137,30 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListNativeInvoicesParams other) { + private boolean equalTo(CountBillingInvoicesParams other) { return companyId.equals(other.companyId) && contractId.equals(other.contractId) && documentState.equals(other.documentState) && limit.equals(other.limit) - && offset.equals(other.offset); + && offset.equals(other.offset) + && pastDue.equals(other.pastDue) + && providerType.equals(other.providerType) + && q.equals(other.q) + && status.equals(other.status); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.contractId, this.documentState, this.limit, this.offset); + return Objects.hash( + this.companyId, + this.contractId, + this.documentState, + this.limit, + this.offset, + this.pastDue, + this.providerType, + this.q, + this.status); } @java.lang.Override @@ -124,16 +184,28 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional pastDue = Optional.empty(); + + private Optional providerType = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional status = Optional.empty(); + private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(ListNativeInvoicesParams other) { + public Builder from(CountBillingInvoicesParams other) { companyId(other.getCompanyId()); contractId(other.getContractId()); documentState(other.getDocumentState()); limit(other.getLimit()); offset(other.getOffset()); + pastDue(other.getPastDue()); + providerType(other.getProviderType()); + q(other.getQ()); + status(other.getStatus()); return this; } @@ -198,9 +270,71 @@ public Builder offset(Long offset) { return this; } - public ListNativeInvoicesParams build() { - return new ListNativeInvoicesParams( - companyId, contractId, documentState, limit, offset, additionalProperties); + /** + *

Only open invoices with an amount left to pay whose due date has passed.

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

Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe.

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

Search by invoice number, provider invoice ID or company name.

+ */ + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public CountBillingInvoicesParams build() { + return new CountBillingInvoicesParams( + companyId, + contractId, + documentState, + limit, + offset, + pastDue, + providerType, + q, + status, + additionalProperties); } @JsonAnySetter @@ -209,7 +343,11 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("contract_id") || key.equalsIgnoreCase("document_state") || key.equalsIgnoreCase("limit") - || key.equalsIgnoreCase("offset")) { + || key.equalsIgnoreCase("offset") + || key.equalsIgnoreCase("past_due") + || key.equalsIgnoreCase("provider_type") + || key.equalsIgnoreCase("q") + || key.equalsIgnoreCase("status")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountNativeInvoicesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingInvoicesResponse.java similarity index 78% rename from src/main/java/com/schematic/api/resources/billing/types/CountNativeInvoicesResponse.java rename to src/main/java/com/schematic/api/resources/billing/types/CountBillingInvoicesResponse.java index d3f7af94..f29c1126 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CountNativeInvoicesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/CountBillingInvoicesResponse.java @@ -18,16 +18,16 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountNativeInvoicesResponse.Builder.class) -public final class CountNativeInvoicesResponse { +@JsonDeserialize(builder = CountBillingInvoicesResponse.Builder.class) +public final class CountBillingInvoicesResponse { private final CountResponse data; - private final CountNativeInvoicesParams params; + private final CountBillingInvoicesParams params; private final Map additionalProperties; - private CountNativeInvoicesResponse( - CountResponse data, CountNativeInvoicesParams params, Map additionalProperties) { + private CountBillingInvoicesResponse( + CountResponse data, CountBillingInvoicesParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -42,14 +42,14 @@ public CountResponse getData() { * @return Input parameters */ @JsonProperty("params") - public CountNativeInvoicesParams getParams() { + public CountBillingInvoicesParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountNativeInvoicesResponse && equalTo((CountNativeInvoicesResponse) other); + return other instanceof CountBillingInvoicesResponse && equalTo((CountBillingInvoicesResponse) other); } @JsonAnyGetter @@ -57,7 +57,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountNativeInvoicesResponse other) { + private boolean equalTo(CountBillingInvoicesResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -78,18 +78,18 @@ public static DataStage builder() { public interface DataStage { ParamsStage data(@NotNull CountResponse data); - Builder from(CountNativeInvoicesResponse other); + Builder from(CountBillingInvoicesResponse other); } public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull CountNativeInvoicesParams params); + _FinalStage params(@NotNull CountBillingInvoicesParams params); } public interface _FinalStage { - CountNativeInvoicesResponse build(); + CountBillingInvoicesResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -100,14 +100,14 @@ public interface _FinalStage { public static final class Builder implements DataStage, ParamsStage, _FinalStage { private CountResponse data; - private CountNativeInvoicesParams params; + private CountBillingInvoicesParams params; private Map additionalProperties = new HashMap<>(); private Builder() {} @java.lang.Override - public Builder from(CountNativeInvoicesResponse other) { + public Builder from(CountBillingInvoicesResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -126,14 +126,14 @@ public ParamsStage data(@NotNull CountResponse data) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull CountNativeInvoicesParams params) { + public _FinalStage params(@NotNull CountBillingInvoicesParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @java.lang.Override - public CountNativeInvoicesResponse build() { - return new CountNativeInvoicesResponse(data, params, additionalProperties); + public CountBillingInvoicesResponse build() { + return new CountBillingInvoicesResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/billing/types/GetNativeInvoiceResponse.java b/src/main/java/com/schematic/api/resources/billing/types/GetBillingInvoiceResponse.java similarity index 89% rename from src/main/java/com/schematic/api/resources/billing/types/GetNativeInvoiceResponse.java rename to src/main/java/com/schematic/api/resources/billing/types/GetBillingInvoiceResponse.java index adb894bc..6654a6a2 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/GetNativeInvoiceResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/GetBillingInvoiceResponse.java @@ -21,15 +21,15 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = GetNativeInvoiceResponse.Builder.class) -public final class GetNativeInvoiceResponse { +@JsonDeserialize(builder = GetBillingInvoiceResponse.Builder.class) +public final class GetBillingInvoiceResponse { private final BillingInvoiceDetailResponseData data; private final Map params; private final Map additionalProperties; - private GetNativeInvoiceResponse( + private GetBillingInvoiceResponse( BillingInvoiceDetailResponseData 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 GetNativeInvoiceResponse && equalTo((GetNativeInvoiceResponse) other); + return other instanceof GetBillingInvoiceResponse && equalTo((GetBillingInvoiceResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(GetNativeInvoiceResponse other) { + private boolean equalTo(GetBillingInvoiceResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -83,11 +83,11 @@ public static DataStage builder() { public interface DataStage { _FinalStage data(@NotNull BillingInvoiceDetailResponseData data); - Builder from(GetNativeInvoiceResponse other); + Builder from(GetBillingInvoiceResponse other); } public interface _FinalStage { - GetNativeInvoiceResponse build(); + GetBillingInvoiceResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -114,7 +114,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(GetNativeInvoiceResponse other) { + public Builder from(GetBillingInvoiceResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -163,8 +163,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public GetNativeInvoiceResponse build() { - return new GetNativeInvoiceResponse(data, params, additionalProperties); + public GetBillingInvoiceResponse build() { + return new GetBillingInvoiceResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountNativeInvoicesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingInvoicesParams.java similarity index 55% rename from src/main/java/com/schematic/api/resources/billing/types/CountNativeInvoicesParams.java rename to src/main/java/com/schematic/api/resources/billing/types/ListBillingInvoicesParams.java index b9807f44..07fa9b08 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CountNativeInvoicesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingInvoicesParams.java @@ -12,15 +12,17 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import com.schematic.api.types.InvoiceDocumentState; +import com.schematic.api.types.InvoiceStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountNativeInvoicesParams.Builder.class) -public final class CountNativeInvoicesParams { +@JsonDeserialize(builder = ListBillingInvoicesParams.Builder.class) +public final class ListBillingInvoicesParams { private final Optional companyId; private final Optional contractId; @@ -31,20 +33,36 @@ public final class CountNativeInvoicesParams { private final Optional offset; + private final Optional pastDue; + + private final Optional providerType; + + private final Optional q; + + private final Optional status; + private final Map additionalProperties; - private CountNativeInvoicesParams( + private ListBillingInvoicesParams( Optional companyId, Optional contractId, Optional documentState, Optional limit, Optional offset, + Optional pastDue, + Optional providerType, + Optional q, + Optional status, Map additionalProperties) { this.companyId = companyId; this.contractId = contractId; this.documentState = documentState; this.limit = limit; this.offset = offset; + this.pastDue = pastDue; + this.providerType = providerType; + this.q = q; + this.status = status; this.additionalProperties = additionalProperties; } @@ -79,10 +97,39 @@ public Optional getOffset() { return offset; } + /** + * @return Only open invoices with an amount left to pay whose due date has passed. + */ + @JsonProperty("past_due") + public Optional getPastDue() { + return pastDue; + } + + /** + * @return Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe. + */ + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + /** + * @return Search by invoice number, provider invoice ID or company name. + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountNativeInvoicesParams && equalTo((CountNativeInvoicesParams) other); + return other instanceof ListBillingInvoicesParams && equalTo((ListBillingInvoicesParams) other); } @JsonAnyGetter @@ -90,17 +137,30 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountNativeInvoicesParams other) { + private boolean equalTo(ListBillingInvoicesParams other) { return companyId.equals(other.companyId) && contractId.equals(other.contractId) && documentState.equals(other.documentState) && limit.equals(other.limit) - && offset.equals(other.offset); + && offset.equals(other.offset) + && pastDue.equals(other.pastDue) + && providerType.equals(other.providerType) + && q.equals(other.q) + && status.equals(other.status); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.contractId, this.documentState, this.limit, this.offset); + return Objects.hash( + this.companyId, + this.contractId, + this.documentState, + this.limit, + this.offset, + this.pastDue, + this.providerType, + this.q, + this.status); } @java.lang.Override @@ -124,16 +184,28 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional pastDue = Optional.empty(); + + private Optional providerType = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional status = Optional.empty(); + private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(CountNativeInvoicesParams other) { + public Builder from(ListBillingInvoicesParams other) { companyId(other.getCompanyId()); contractId(other.getContractId()); documentState(other.getDocumentState()); limit(other.getLimit()); offset(other.getOffset()); + pastDue(other.getPastDue()); + providerType(other.getProviderType()); + q(other.getQ()); + status(other.getStatus()); return this; } @@ -198,9 +270,71 @@ public Builder offset(Long offset) { return this; } - public CountNativeInvoicesParams build() { - return new CountNativeInvoicesParams( - companyId, contractId, documentState, limit, offset, additionalProperties); + /** + *

Only open invoices with an amount left to pay whose due date has passed.

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

Only invoices from this billing provider. Leave empty for invoices from Schematic and Stripe.

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

Search by invoice number, provider invoice ID or company name.

+ */ + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public ListBillingInvoicesParams build() { + return new ListBillingInvoicesParams( + companyId, + contractId, + documentState, + limit, + offset, + pastDue, + providerType, + q, + status, + additionalProperties); } @JsonAnySetter @@ -209,7 +343,11 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("contract_id") || key.equalsIgnoreCase("document_state") || key.equalsIgnoreCase("limit") - || key.equalsIgnoreCase("offset")) { + || key.equalsIgnoreCase("offset") + || key.equalsIgnoreCase("past_due") + || key.equalsIgnoreCase("provider_type") + || key.equalsIgnoreCase("q") + || key.equalsIgnoreCase("status")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListNativeInvoicesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingInvoicesResponse.java similarity index 82% rename from src/main/java/com/schematic/api/resources/billing/types/ListNativeInvoicesResponse.java rename to src/main/java/com/schematic/api/resources/billing/types/ListBillingInvoicesResponse.java index 47113105..558c7df2 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListNativeInvoicesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingInvoicesResponse.java @@ -21,17 +21,17 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListNativeInvoicesResponse.Builder.class) -public final class ListNativeInvoicesResponse { +@JsonDeserialize(builder = ListBillingInvoicesResponse.Builder.class) +public final class ListBillingInvoicesResponse { private final List data; - private final ListNativeInvoicesParams params; + private final ListBillingInvoicesParams params; private final Map additionalProperties; - private ListNativeInvoicesResponse( + private ListBillingInvoicesResponse( List data, - ListNativeInvoicesParams params, + ListBillingInvoicesParams params, Map additionalProperties) { this.data = data; this.params = params; @@ -47,14 +47,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public ListNativeInvoicesParams getParams() { + public ListBillingInvoicesParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListNativeInvoicesResponse && equalTo((ListNativeInvoicesResponse) other); + return other instanceof ListBillingInvoicesResponse && equalTo((ListBillingInvoicesResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListNativeInvoicesResponse other) { + private boolean equalTo(ListBillingInvoicesResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -84,13 +84,13 @@ public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull ListNativeInvoicesParams params); + _FinalStage params(@NotNull ListBillingInvoicesParams params); - Builder from(ListNativeInvoicesResponse other); + Builder from(ListBillingInvoicesResponse other); } public interface _FinalStage { - ListNativeInvoicesResponse build(); + ListBillingInvoicesResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -105,7 +105,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ParamsStage, _FinalStage { - private ListNativeInvoicesParams params; + private ListBillingInvoicesParams params; private List data = new ArrayList<>(); @@ -114,7 +114,7 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(ListNativeInvoicesResponse other) { + public Builder from(ListBillingInvoicesResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -126,7 +126,7 @@ public Builder from(ListNativeInvoicesResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull ListNativeInvoicesParams params) { + public _FinalStage params(@NotNull ListBillingInvoicesParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @@ -156,8 +156,8 @@ public _FinalStage data(List data) { } @java.lang.Override - public ListNativeInvoicesResponse build() { - return new ListNativeInvoicesResponse(data, params, additionalProperties); + public ListBillingInvoicesResponse build() { + return new ListBillingInvoicesResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/billing/types/MarkNativeInvoicePaidResponse.java b/src/main/java/com/schematic/api/resources/billing/types/MarkBillingInvoicePaidResponse.java similarity index 88% rename from src/main/java/com/schematic/api/resources/billing/types/MarkNativeInvoicePaidResponse.java rename to src/main/java/com/schematic/api/resources/billing/types/MarkBillingInvoicePaidResponse.java index cdc3a2a8..5358e1e9 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/MarkNativeInvoicePaidResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/MarkBillingInvoicePaidResponse.java @@ -21,15 +21,15 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = MarkNativeInvoicePaidResponse.Builder.class) -public final class MarkNativeInvoicePaidResponse { +@JsonDeserialize(builder = MarkBillingInvoicePaidResponse.Builder.class) +public final class MarkBillingInvoicePaidResponse { private final BillingInvoiceDetailResponseData data; private final Map params; private final Map additionalProperties; - private MarkNativeInvoicePaidResponse( + private MarkBillingInvoicePaidResponse( BillingInvoiceDetailResponseData 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 MarkNativeInvoicePaidResponse && equalTo((MarkNativeInvoicePaidResponse) other); + return other instanceof MarkBillingInvoicePaidResponse && equalTo((MarkBillingInvoicePaidResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(MarkNativeInvoicePaidResponse other) { + private boolean equalTo(MarkBillingInvoicePaidResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -83,11 +83,11 @@ public static DataStage builder() { public interface DataStage { _FinalStage data(@NotNull BillingInvoiceDetailResponseData data); - Builder from(MarkNativeInvoicePaidResponse other); + Builder from(MarkBillingInvoicePaidResponse other); } public interface _FinalStage { - MarkNativeInvoicePaidResponse build(); + MarkBillingInvoicePaidResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -114,7 +114,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(MarkNativeInvoicePaidResponse other) { + public Builder from(MarkBillingInvoicePaidResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -163,8 +163,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public MarkNativeInvoicePaidResponse build() { - return new MarkNativeInvoicePaidResponse(data, params, additionalProperties); + public MarkBillingInvoicePaidResponse build() { + return new MarkBillingInvoicePaidResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java index f90f456d..d4c14ed4 100644 --- a/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java +++ b/src/main/java/com/schematic/api/resources/catalogs/AsyncCatalogsClient.java @@ -17,6 +17,8 @@ import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse; import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse; import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogByIdResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogResponse; import com.schematic.api.resources.catalogs.types.ListCatalogsResponse; import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse; import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse; @@ -455,4 +457,53 @@ public CompletableFuture removePlan(String catalogId, String planId, Reque }); return future; } + + public CompletableFuture getPublicCatalog() { + CompletableFuture> rawFuture = + this.rawClient.getPublicCatalog(); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture getPublicCatalog(RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.getPublicCatalog(requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture getPublicCatalogById(String catalogId) { + CompletableFuture> rawFuture = + this.rawClient.getPublicCatalogById(catalogId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture getPublicCatalogById( + String catalogId, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.getPublicCatalogById(catalogId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } } diff --git a/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java index 6aacfceb..43c09137 100644 --- a/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java +++ b/src/main/java/com/schematic/api/resources/catalogs/AsyncRawCatalogsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -30,6 +31,8 @@ import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse; import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse; import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogByIdResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogResponse; import com.schematic.api.resources.catalogs.types.ListCatalogsResponse; import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse; import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse; @@ -303,7 +306,7 @@ public CompletableFuture> getCatal HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId); + .addPathSegment(PathSegments.validate(catalogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -411,7 +414,7 @@ public CompletableFuture> updat HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId); + .addPathSegment(PathSegments.validate(catalogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -524,7 +527,7 @@ public CompletableFuture> delet HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId); + .addPathSegment(PathSegments.validate(catalogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -630,7 +633,7 @@ public CompletableFuture> ge HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("configuration"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -742,7 +745,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("configuration"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -858,7 +861,7 @@ public CompletableFuture { @@ -959,9 +962,9 @@ public CompletableFuture> addCreditBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("credit-bundles") - .addPathSegment(creditBundleId); + .addPathSegment(PathSegments.validate(creditBundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1067,9 +1070,9 @@ public CompletableFuture> removeCreditBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("credit-bundles") - .addPathSegment(creditBundleId); + .addPathSegment(PathSegments.validate(creditBundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1174,7 +1177,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("features"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1274,7 +1277,7 @@ public CompletableFuture> g HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("plans"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1374,9 +1377,9 @@ public CompletableFuture> addPlan( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1481,9 +1484,9 @@ public CompletableFuture> removePlan( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1577,4 +1580,201 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } + + public CompletableFuture> getPublicCatalog() { + return getPublicCatalog(null); + } + + public CompletableFuture> getPublicCatalog( + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("public/catalog"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.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, GetPublicCatalogResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + + public CompletableFuture> getPublicCatalogById( + String catalogId) { + return getPublicCatalogById(catalogId, null); + } + + public CompletableFuture> getPublicCatalogById( + String catalogId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("public/catalogs") + .addPathSegment(PathSegments.validate(catalogId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.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, GetPublicCatalogByIdResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } } diff --git a/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java index 6169b106..db94701b 100644 --- a/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java +++ b/src/main/java/com/schematic/api/resources/catalogs/CatalogsClient.java @@ -16,6 +16,8 @@ import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse; import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse; import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogByIdResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogResponse; import com.schematic.api.resources.catalogs.types.ListCatalogsResponse; import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse; import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse; @@ -184,4 +186,20 @@ public void removePlan(String catalogId, String planId) { public void removePlan(String catalogId, String planId, RequestOptions requestOptions) { this.rawClient.removePlan(catalogId, planId, requestOptions).body(); } + + public GetPublicCatalogResponse getPublicCatalog() { + return this.rawClient.getPublicCatalog().body(); + } + + public GetPublicCatalogResponse getPublicCatalog(RequestOptions requestOptions) { + return this.rawClient.getPublicCatalog(requestOptions).body(); + } + + public GetPublicCatalogByIdResponse getPublicCatalogById(String catalogId) { + return this.rawClient.getPublicCatalogById(catalogId).body(); + } + + public GetPublicCatalogByIdResponse getPublicCatalogById(String catalogId, RequestOptions requestOptions) { + return this.rawClient.getPublicCatalogById(catalogId, requestOptions).body(); + } } diff --git a/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java b/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java index 78e27df6..6fe0e747 100644 --- a/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java +++ b/src/main/java/com/schematic/api/resources/catalogs/RawCatalogsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -30,6 +31,8 @@ import com.schematic.api.resources.catalogs.types.GetCreditBundlesInCatalogResponse; import com.schematic.api.resources.catalogs.types.GetDerivedFeaturesResponse; import com.schematic.api.resources.catalogs.types.GetPlansInCatalogResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogByIdResponse; +import com.schematic.api.resources.catalogs.types.GetPublicCatalogResponse; import com.schematic.api.resources.catalogs.types.ListCatalogsResponse; import com.schematic.api.resources.catalogs.types.UpdateCatalogResponse; import com.schematic.api.resources.catalogs.types.UpdateConfigurationResponse; @@ -233,7 +236,7 @@ public BaseSchematicHttpResponse getCatalog(String catalogId HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId); + .addPathSegment(PathSegments.validate(catalogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -312,7 +315,7 @@ public BaseSchematicHttpResponse updateCatalog( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId); + .addPathSegment(PathSegments.validate(catalogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -394,7 +397,7 @@ public BaseSchematicHttpResponse deleteCatalog( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId); + .addPathSegment(PathSegments.validate(catalogId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -469,7 +472,7 @@ public BaseSchematicHttpResponse getConfiguration( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("configuration"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -552,7 +555,7 @@ public BaseSchematicHttpResponse updateConfiguratio HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("configuration"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -636,7 +639,7 @@ public BaseSchematicHttpResponse getCreditBun HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("credit-bundles"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -708,9 +711,9 @@ public BaseSchematicHttpResponse addCreditBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("credit-bundles") - .addPathSegment(creditBundleId); + .addPathSegment(PathSegments.validate(creditBundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -785,9 +788,9 @@ public BaseSchematicHttpResponse removeCreditBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("credit-bundles") - .addPathSegment(creditBundleId); + .addPathSegment(PathSegments.validate(creditBundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -861,7 +864,7 @@ public BaseSchematicHttpResponse getDerivedFeatures( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("features"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -932,7 +935,7 @@ public BaseSchematicHttpResponse getPlansInCatalog( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("plans"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1002,9 +1005,9 @@ public BaseSchematicHttpResponse addPlan(String catalogId, String planId, HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1078,9 +1081,9 @@ public BaseSchematicHttpResponse removePlan(String catalogId, String planI HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("catalogs") - .addPathSegment(catalogId) + .addPathSegment(PathSegments.validate(catalogId)) .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1144,4 +1147,142 @@ public BaseSchematicHttpResponse removePlan(String catalogId, String planI throw new BaseSchematicException("Network error executing HTTP request", e); } } + + public BaseSchematicHttpResponse getPublicCatalog() { + return getPublicCatalog(null); + } + + public BaseSchematicHttpResponse getPublicCatalog(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("public/catalog"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPublicCatalogResponse.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 (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getPublicCatalogById(String catalogId) { + return getPublicCatalogById(catalogId, null); + } + + public BaseSchematicHttpResponse getPublicCatalogById( + String catalogId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("public/catalogs") + .addPathSegment(PathSegments.validate(catalogId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPublicCatalogByIdResponse.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 (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetPublicCatalogByIdResponse.java similarity index 80% rename from src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java rename to src/main/java/com/schematic/api/resources/catalogs/types/GetPublicCatalogByIdResponse.java index 323421cf..e3f63901 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetPublicCatalogByIdResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.catalogs.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.DeleteResponse; +import com.schematic.api.types.PublicCatalogResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,23 +21,23 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = DeleteEnvironmentResponse.Builder.class) -public final class DeleteEnvironmentResponse { - private final DeleteResponse data; +@JsonDeserialize(builder = GetPublicCatalogByIdResponse.Builder.class) +public final class GetPublicCatalogByIdResponse { + private final PublicCatalogResponseData data; private final Map params; private final Map additionalProperties; - private DeleteEnvironmentResponse( - DeleteResponse data, Map params, Map additionalProperties) { + private GetPublicCatalogByIdResponse( + PublicCatalogResponseData data, Map params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public DeleteResponse getData() { + public PublicCatalogResponseData getData() { return data; } @@ -52,7 +52,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof DeleteEnvironmentResponse && equalTo((DeleteEnvironmentResponse) other); + return other instanceof GetPublicCatalogByIdResponse && equalTo((GetPublicCatalogByIdResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(DeleteEnvironmentResponse other) { + private boolean equalTo(GetPublicCatalogByIdResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -79,13 +79,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull DeleteResponse data); + _FinalStage data(@NotNull PublicCatalogResponseData data); - Builder from(DeleteEnvironmentResponse other); + Builder from(GetPublicCatalogByIdResponse other); } public interface _FinalStage { - DeleteEnvironmentResponse build(); + GetPublicCatalogByIdResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -103,7 +103,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private DeleteResponse data; + private PublicCatalogResponseData data; private Map params = new LinkedHashMap<>(); @@ -112,7 +112,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(DeleteEnvironmentResponse other) { + public Builder from(GetPublicCatalogByIdResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -120,7 +120,7 @@ public Builder from(DeleteEnvironmentResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull DeleteResponse data) { + public _FinalStage data(@NotNull PublicCatalogResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -161,8 +161,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public DeleteEnvironmentResponse build() { - return new DeleteEnvironmentResponse(data, params, additionalProperties); + public GetPublicCatalogByIdResponse build() { + return new GetPublicCatalogByIdResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java b/src/main/java/com/schematic/api/resources/catalogs/types/GetPublicCatalogResponse.java similarity index 80% rename from src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java rename to src/main/java/com/schematic/api/resources/catalogs/types/GetPublicCatalogResponse.java index b6e0708b..d1c062f1 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java +++ b/src/main/java/com/schematic/api/resources/catalogs/types/GetPublicCatalogResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.catalogs.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.ApiKeyCreateResponseData; +import com.schematic.api.types.PublicCatalogResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,23 +21,23 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateApiKeyResponse.Builder.class) -public final class CreateApiKeyResponse { - private final ApiKeyCreateResponseData data; +@JsonDeserialize(builder = GetPublicCatalogResponse.Builder.class) +public final class GetPublicCatalogResponse { + private final PublicCatalogResponseData data; private final Map params; private final Map additionalProperties; - private CreateApiKeyResponse( - ApiKeyCreateResponseData data, Map params, Map additionalProperties) { + private GetPublicCatalogResponse( + PublicCatalogResponseData data, Map params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public ApiKeyCreateResponseData getData() { + public PublicCatalogResponseData getData() { return data; } @@ -52,7 +52,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CreateApiKeyResponse && equalTo((CreateApiKeyResponse) other); + return other instanceof GetPublicCatalogResponse && equalTo((GetPublicCatalogResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CreateApiKeyResponse other) { + private boolean equalTo(GetPublicCatalogResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -79,13 +79,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull ApiKeyCreateResponseData data); + _FinalStage data(@NotNull PublicCatalogResponseData data); - Builder from(CreateApiKeyResponse other); + Builder from(GetPublicCatalogResponse other); } public interface _FinalStage { - CreateApiKeyResponse build(); + GetPublicCatalogResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -103,7 +103,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private ApiKeyCreateResponseData data; + private PublicCatalogResponseData data; private Map params = new LinkedHashMap<>(); @@ -112,7 +112,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(CreateApiKeyResponse other) { + public Builder from(GetPublicCatalogResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -120,7 +120,7 @@ public Builder from(CreateApiKeyResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull ApiKeyCreateResponseData data) { + public _FinalStage data(@NotNull PublicCatalogResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -161,8 +161,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public CreateApiKeyResponse build() { - return new CreateApiKeyResponse(data, params, additionalProperties); + public GetPublicCatalogResponse build() { + return new GetPublicCatalogResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java index a99081bd..6a3eda6e 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; import com.schematic.api.errors.BadRequestError; @@ -405,7 +406,7 @@ public CompletableFuture { @@ -508,7 +509,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) + .addPathSegment(PathSegments.validate(companyId)) .addPathSegments("billing-details"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -978,7 +979,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("subscription") - .addPathSegment(subscriptionId) + .addPathSegment(PathSegments.validate(subscriptionId)) .addPathSegments("edit-trial-end"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java index e9221799..3f34fdc8 100644 --- a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; import com.schematic.api.errors.BadRequestError; @@ -306,7 +307,7 @@ public BaseSchematicHttpResponse getCompanyBil HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) + .addPathSegment(PathSegments.validate(companyId)) .addPathSegments("billing-details"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -378,7 +379,7 @@ public BaseSchematicHttpResponse updateComp HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) + .addPathSegment(PathSegments.validate(companyId)) .addPathSegments("billing-details"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -721,7 +722,7 @@ public BaseSchematicHttpResponse upd HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("subscription") - .addPathSegment(subscriptionId) + .addPathSegment(PathSegments.validate(subscriptionId)) .addPathSegments("edit-trial-end"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java index cdb913c0..fedc651c 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -455,7 +456,7 @@ public CompletableFuture> getCompa HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId); + .addPathSegment(PathSegments.validate(companyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -563,7 +564,7 @@ public CompletableFuture> delet HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId); + .addPathSegment(PathSegments.validate(companyId)); if (request.getCancelSubscription().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -1704,7 +1705,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -2194,7 +2195,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -2824,7 +2825,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -2929,7 +2930,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId); + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3045,7 +3046,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId); + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3154,7 +3155,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId) + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)) .addPathSegments("usage"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3779,7 +3780,7 @@ public CompletableFuture> getPl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-changes") - .addPathSegment(planChangeId); + .addPathSegment(PathSegments.validate(planChangeId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -4012,7 +4013,7 @@ public CompletableFuture> getPla HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId); + .addPathSegment(PathSegments.validate(planTraitId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -4716,7 +4717,7 @@ public CompletableFuture> getUser( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId); + .addPathSegment(PathSegments.validate(userId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -4814,7 +4815,7 @@ public CompletableFuture> deleteUs HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId); + .addPathSegment(PathSegments.validate(userId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java index e3d51a54..fcf8ca68 100644 --- a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -385,7 +386,7 @@ public BaseSchematicHttpResponse getCompany(String companyId HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId); + .addPathSegment(PathSegments.validate(companyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -464,7 +465,7 @@ public BaseSchematicHttpResponse deleteCompany( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId); + .addPathSegment(PathSegments.validate(companyId)); if (request.getCancelSubscription().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -1321,7 +1322,7 @@ public BaseSchematicHttpResponse deleteCompanyM HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-memberships") - .addPathSegment(companyMembershipId); + .addPathSegment(PathSegments.validate(companyMembershipId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1683,7 +1684,7 @@ public BaseSchematicHttpResponse deleteEntity HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-key-definitions") - .addPathSegment(entityKeyDefinitionId); + .addPathSegment(PathSegments.validate(entityKeyDefinitionId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2155,7 +2156,7 @@ public BaseSchematicHttpResponse getEntityTrai HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId); + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2228,7 +2229,7 @@ public BaseSchematicHttpResponse updateEnti HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId); + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2313,7 +2314,7 @@ public BaseSchematicHttpResponse deleteEnti HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId); + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2391,7 +2392,7 @@ public BaseSchematicHttpResponse getEntit HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId) + .addPathSegment(PathSegments.validate(entityTraitDefinitionId)) .addPathSegments("usage"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2859,7 +2860,7 @@ public BaseSchematicHttpResponse getPlanChange( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-changes") - .addPathSegment(planChangeId); + .addPathSegment(PathSegments.validate(planChangeId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3031,7 +3032,7 @@ public BaseSchematicHttpResponse getPlanTrait( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId); + .addPathSegment(PathSegments.validate(planTraitId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3549,7 +3550,7 @@ public BaseSchematicHttpResponse getUser(String userId, Request HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId); + .addPathSegment(PathSegments.validate(userId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3617,7 +3618,7 @@ public BaseSchematicHttpResponse deleteUser(String userId, R HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId); + .addPathSegment(PathSegments.validate(userId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java index b763848a..dc5505f1 100644 --- a/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -299,7 +300,7 @@ public CompletableFuture> getCom HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId); + .addPathSegment(PathSegments.validate(componentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -407,7 +408,7 @@ public CompletableFuture> upd HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId); + .addPathSegment(PathSegments.validate(componentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -520,7 +521,7 @@ public CompletableFuture> del HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId); + .addPathSegment(PathSegments.validate(componentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -636,7 +637,7 @@ public CompletableFuture> bindCat HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) + .addPathSegment(PathSegments.validate(componentId)) .addPathSegments("catalog"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java b/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java index f5f94c39..fb132535 100644 --- a/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -232,7 +233,7 @@ public BaseSchematicHttpResponse getComponent( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId); + .addPathSegment(PathSegments.validate(componentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -311,7 +312,7 @@ public BaseSchematicHttpResponse updateComponent( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId); + .addPathSegment(PathSegments.validate(componentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -394,7 +395,7 @@ public BaseSchematicHttpResponse deleteComponent( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId); + .addPathSegment(PathSegments.validate(componentId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -480,7 +481,7 @@ public BaseSchematicHttpResponse bindCatalog( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) + .addPathSegment(PathSegments.validate(componentId)) .addPathSegments("catalog"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java index b12376b9..bbf6f76b 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java @@ -53,6 +53,7 @@ import com.schematic.api.resources.credits.types.ExtendCreditLeaseResponse; import com.schematic.api.resources.credits.types.GetCreditBalanceTimeSeriesResponse; import com.schematic.api.resources.credits.types.GetCreditBundleResponse; +import com.schematic.api.resources.credits.types.GetCreditEventLedgerEntryResponse; import com.schematic.api.resources.credits.types.GetCreditSpendPolicyResponse; import com.schematic.api.resources.credits.types.GetCreditSpendPolicyUsageResponse; import com.schematic.api.resources.credits.types.GetSingleBillingCreditResponse; @@ -1426,6 +1427,31 @@ public CompletableFuture listCreditEventLedger( return future; } + public CompletableFuture getCreditEventLedgerEntry(String ledgerEntryId) { + CompletableFuture> rawFuture = + this.rawClient.getCreditEventLedgerEntry(ledgerEntryId); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + + public CompletableFuture getCreditEventLedgerEntry( + String ledgerEntryId, RequestOptions requestOptions) { + CompletableFuture> rawFuture = + this.rawClient.getCreditEventLedgerEntry(ledgerEntryId, requestOptions); + CompletableFuture future = rawFuture.thenApply(response -> response.body()); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + rawFuture.cancel(true); + } + }); + return future; + } + public CompletableFuture countCreditEventLedger( CountCreditEventLedgerRequest request) { CompletableFuture> rawFuture = diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java index a6385272..6f8b7647 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -67,6 +68,7 @@ import com.schematic.api.resources.credits.types.ExtendCreditLeaseResponse; import com.schematic.api.resources.credits.types.GetCreditBalanceTimeSeriesResponse; import com.schematic.api.resources.credits.types.GetCreditBundleResponse; +import com.schematic.api.resources.credits.types.GetCreditEventLedgerEntryResponse; import com.schematic.api.resources.credits.types.GetCreditSpendPolicyResponse; import com.schematic.api.resources.credits.types.GetCreditSpendPolicyUsageResponse; import com.schematic.api.resources.credits.types.GetSingleBillingCreditResponse; @@ -364,7 +366,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -464,7 +466,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId); + .addPathSegment(PathSegments.validate(creditId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -579,7 +581,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -1147,7 +1149,7 @@ public CompletableFuture> get HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId); + .addPathSegment(PathSegments.validate(bundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1246,7 +1248,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -1362,7 +1364,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId); + .addPathSegment(PathSegments.validate(bundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1743,7 +1745,7 @@ public CompletableFuture> zeroOu HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants") - .addPathSegment(grantId) + .addPathSegment(PathSegments.validate(grantId)) .addPathSegments("zero-out"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2591,7 +2593,7 @@ public CompletableFuture> e HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/lease") - .addPathSegment(leaseId) + .addPathSegment(PathSegments.validate(leaseId)) .addPathSegments("extend"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2711,7 +2713,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/lease") - .addPathSegment(leaseId) + .addPathSegment(PathSegments.validate(leaseId)) .addPathSegments("release"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3085,7 +3087,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId); + .addPathSegment(PathSegments.validate(planGrantId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3189,7 +3191,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId); + .addPathSegment(PathSegments.validate(planGrantId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3318,7 +3320,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId); + .addPathSegment(PathSegments.validate(planGrantId)); if (request.getApplyToExisting().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "apply_to_existing", request.getApplyToExisting().get(), false); @@ -3697,7 +3699,7 @@ public CompletableFuture { @@ -4065,7 +4067,7 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/spend-policies") - .addPathSegment(spendPolicyId); + .addPathSegment(PathSegments.validate(spendPolicyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -4177,7 +4179,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -4293,7 +4295,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -4677,6 +4679,10 @@ public CompletableFuture> getCreditEventLedgerEntry( + String ledgerEntryId) { + return getCreditEventLedgerEntry(ledgerEntryId, null); + } + + public CompletableFuture> getCreditEventLedgerEntry( + String ledgerEntryId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/billing/credits/ledger") + .addPathSegment(PathSegments.validate(ledgerEntryId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + RetryInterceptor.AsyncCall okhttpCall = RetryInterceptor.newAsyncCall(client, okhttpRequest); + okhttpCall.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, GetCreditEventLedgerEntryResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + future.whenComplete((result_, throwable_) -> { + if (future.isCancelled()) { + okhttpCall.cancel(); + } + }); + return future; + } + public CompletableFuture> countCreditEventLedger( CountCreditEventLedgerRequest request) { return countCreditEventLedger(request, null); @@ -4810,6 +4917,10 @@ public CompletableFuture getSingleBillin HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId); + .addPathSegment(PathSegments.validate(creditId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -366,7 +368,7 @@ public BaseSchematicHttpResponse updateBillingCredi HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId); + .addPathSegment(PathSegments.validate(creditId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -449,7 +451,7 @@ public BaseSchematicHttpResponse softDeleteBill HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId); + .addPathSegment(PathSegments.validate(creditId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -861,7 +863,7 @@ public BaseSchematicHttpResponse getCreditBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId); + .addPathSegment(PathSegments.validate(bundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -932,7 +934,7 @@ public BaseSchematicHttpResponse updateCredit HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId); + .addPathSegment(PathSegments.validate(bundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1016,7 +1018,7 @@ public BaseSchematicHttpResponse deleteCreditBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId); + .addPathSegment(PathSegments.validate(bundleId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1300,7 +1302,7 @@ public BaseSchematicHttpResponse zeroOutGrant( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants") - .addPathSegment(grantId) + .addPathSegment(PathSegments.validate(grantId)) .addPathSegments("zero-out"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1926,7 +1928,7 @@ public BaseSchematicHttpResponse extendCreditLease( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/lease") - .addPathSegment(leaseId) + .addPathSegment(PathSegments.validate(leaseId)) .addPathSegments("extend"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2013,7 +2015,7 @@ public BaseSchematicHttpResponse releaseCreditLease( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/lease") - .addPathSegment(leaseId) + .addPathSegment(PathSegments.validate(leaseId)) .addPathSegments("release"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2292,7 +2294,7 @@ public BaseSchematicHttpResponse getSin HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId); + .addPathSegment(PathSegments.validate(planGrantId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2364,7 +2366,7 @@ public BaseSchematicHttpResponse updateBil HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId); + .addPathSegment(PathSegments.validate(planGrantId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2461,7 +2463,7 @@ public BaseSchematicHttpResponse deleteBil HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId); + .addPathSegment(PathSegments.validate(planGrantId)); if (request.getApplyToExisting().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "apply_to_existing", request.getApplyToExisting().get(), false); @@ -2743,7 +2745,7 @@ public BaseSchematicHttpResponse releaseCredit HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/reservations") - .addPathSegment(reservationId) + .addPathSegment(PathSegments.validate(reservationId)) .addPathSegments("release"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -3014,7 +3016,7 @@ public BaseSchematicHttpResponse getCreditSpendPol HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/spend-policies") - .addPathSegment(spendPolicyId); + .addPathSegment(PathSegments.validate(spendPolicyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3096,7 +3098,7 @@ public BaseSchematicHttpResponse updateCreditSp HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/spend-policies") - .addPathSegment(spendPolicyId); + .addPathSegment(PathSegments.validate(spendPolicyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3179,7 +3181,7 @@ public BaseSchematicHttpResponse deleteCreditSp HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/spend-policies") - .addPathSegment(spendPolicyId); + .addPathSegment(PathSegments.validate(spendPolicyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -3468,6 +3470,10 @@ public BaseSchematicHttpResponse listCreditEventL QueryStringMapper.addQueryParameter( httpUrl, "feature_id", request.getFeatureId().get(), false); } + if (request.getSourceEventId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source_event_id", request.getSourceEventId().get(), false); + } if (request.getStartTime().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "start_time", request.getStartTime().get(), false); @@ -3543,6 +3549,78 @@ public BaseSchematicHttpResponse listCreditEventL } } + public BaseSchematicHttpResponse getCreditEventLedgerEntry( + String ledgerEntryId) { + return getCreditEventLedgerEntry(ledgerEntryId, null); + } + + public BaseSchematicHttpResponse getCreditEventLedgerEntry( + String ledgerEntryId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/billing/credits/ledger") + .addPathSegment(PathSegments.validate(ledgerEntryId)); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetCreditEventLedgerEntryResponse.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 (JsonProcessingException e) { + throw new BaseSchematicException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countCreditEventLedger( CountCreditEventLedgerRequest request) { return countCreditEventLedger(request, null); @@ -3570,6 +3648,10 @@ public BaseSchematicHttpResponse countCreditEven QueryStringMapper.addQueryParameter( httpUrl, "feature_id", request.getFeatureId().get(), false); } + if (request.getSourceEventId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "source_event_id", request.getSourceEventId().get(), false); + } if (request.getStartTime().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "start_time", request.getStartTime().get(), false); diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java index 41367d3d..0b9647f6 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java @@ -32,6 +32,8 @@ public final class CountCreditEventLedgerRequest { private final Optional featureId; + private final Optional sourceEventId; + private final Optional startTime; private final Optional limit; @@ -46,6 +48,7 @@ private CountCreditEventLedgerRequest( Optional endTime, Optional eventType, Optional featureId, + Optional sourceEventId, Optional startTime, Optional limit, Optional offset, @@ -55,6 +58,7 @@ private CountCreditEventLedgerRequest( this.endTime = endTime; this.eventType = eventType; this.featureId = featureId; + this.sourceEventId = sourceEventId; this.startTime = startTime; this.limit = limit; this.offset = offset; @@ -86,6 +90,14 @@ public Optional getFeatureId() { return featureId; } + /** + * @return Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it. + */ + @JsonProperty("source_event_id") + public Optional getSourceEventId() { + return sourceEventId; + } + @JsonProperty("start_time") public Optional getStartTime() { return startTime; @@ -124,6 +136,7 @@ private boolean equalTo(CountCreditEventLedgerRequest other) { && endTime.equals(other.endTime) && eventType.equals(other.eventType) && featureId.equals(other.featureId) + && sourceEventId.equals(other.sourceEventId) && startTime.equals(other.startTime) && limit.equals(other.limit) && offset.equals(other.offset); @@ -137,6 +150,7 @@ public int hashCode() { this.endTime, this.eventType, this.featureId, + this.sourceEventId, this.startTime, this.limit, this.offset); @@ -180,6 +194,13 @@ public interface _FinalStage { _FinalStage featureId(String featureId); + /** + *

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

+ */ + _FinalStage sourceEventId(Optional sourceEventId); + + _FinalStage sourceEventId(String sourceEventId); + _FinalStage startTime(Optional startTime); _FinalStage startTime(String startTime); @@ -209,6 +230,8 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private Optional startTime = Optional.empty(); + private Optional sourceEventId = Optional.empty(); + private Optional featureId = Optional.empty(); private Optional eventType = Optional.empty(); @@ -228,6 +251,7 @@ public Builder from(CountCreditEventLedgerRequest other) { endTime(other.getEndTime()); eventType(other.getEventType()); featureId(other.getFeatureId()); + sourceEventId(other.getSourceEventId()); startTime(other.getStartTime()); limit(other.getLimit()); offset(other.getOffset()); @@ -294,6 +318,26 @@ public _FinalStage startTime(Optional startTime) { return this; } + /** + *

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

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

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

+ */ + @java.lang.Override + @JsonSetter(value = "source_event_id", nulls = Nulls.SKIP) + public _FinalStage sourceEventId(Optional sourceEventId) { + this.sourceEventId = sourceEventId; + return this; + } + @java.lang.Override public _FinalStage featureId(String featureId) { this.featureId = Optional.ofNullable(featureId); @@ -354,6 +398,7 @@ public CountCreditEventLedgerRequest build() { endTime, eventType, featureId, + sourceEventId, startTime, limit, offset, @@ -367,6 +412,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("end_time") || key.equalsIgnoreCase("event_type") || key.equalsIgnoreCase("feature_id") + || key.equalsIgnoreCase("source_event_id") || key.equalsIgnoreCase("start_time") || key.equalsIgnoreCase("limit") || key.equalsIgnoreCase("offset")) { diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditSpendPolicyRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditSpendPolicyRequestBody.java index 036a59c2..02060570 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditSpendPolicyRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditSpendPolicyRequestBody.java @@ -100,7 +100,7 @@ public Optional getWindowAmount() { } /** - * @return The window that window_amount applies to: one UTC hour or one UTC day. Required with window_amount. + * @return The window that window_amount applies to: one UTC hour, one UTC day, one week from Monday 00:00 UTC, one calendar month from the 1st 00:00 UTC, or the company's current billing period. billing_period applies to company policies only, and a company without an active subscription falls back to the calendar month. Required with window_amount. */ @JsonProperty("window_unit") public Optional getWindowUnit() { @@ -196,7 +196,7 @@ public interface _FinalStage { _FinalStage windowAmount(Double windowAmount); /** - *

The window that window_amount applies to: one UTC hour or one UTC day. Required with window_amount.

+ *

The window that window_amount applies to: one UTC hour, one UTC day, one week from Monday 00:00 UTC, one calendar month from the 1st 00:00 UTC, or the company's current billing period. billing_period applies to company policies only, and a company without an active subscription falls back to the calendar month. Required with window_amount.

*/ _FinalStage windowUnit(Optional windowUnit); @@ -243,7 +243,7 @@ public _FinalStage billingCreditId(@NotNull String billingCreditId) { } /** - *

The window that window_amount applies to: one UTC hour or one UTC day. Required with window_amount.

+ *

The window that window_amount applies to: one UTC hour, one UTC day, one week from Monday 00:00 UTC, one calendar month from the 1st 00:00 UTC, or the company's current billing period. billing_period applies to company policies only, and a company without an active subscription falls back to the calendar month. Required with window_amount.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -253,7 +253,7 @@ public _FinalStage windowUnit(CreditSpendWindowUnit windowUnit) { } /** - *

The window that window_amount applies to: one UTC hour or one UTC day. Required with window_amount.

+ *

The window that window_amount applies to: one UTC hour, one UTC day, one week from Monday 00:00 UTC, one calendar month from the 1st 00:00 UTC, or the company's current billing period. billing_period applies to company policies only, and a company without an active subscription falls back to the calendar month. Required with window_amount.

*/ @java.lang.Override @JsonSetter(value = "window_unit", nulls = Nulls.SKIP) diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java index c22eadb9..77eca20c 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java @@ -32,6 +32,8 @@ public final class ListCreditEventLedgerRequest { private final Optional featureId; + private final Optional sourceEventId; + private final Optional startTime; private final Optional limit; @@ -46,6 +48,7 @@ private ListCreditEventLedgerRequest( Optional endTime, Optional eventType, Optional featureId, + Optional sourceEventId, Optional startTime, Optional limit, Optional offset, @@ -55,6 +58,7 @@ private ListCreditEventLedgerRequest( this.endTime = endTime; this.eventType = eventType; this.featureId = featureId; + this.sourceEventId = sourceEventId; this.startTime = startTime; this.limit = limit; this.offset = offset; @@ -86,6 +90,14 @@ public Optional getFeatureId() { return featureId; } + /** + * @return Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it. + */ + @JsonProperty("source_event_id") + public Optional getSourceEventId() { + return sourceEventId; + } + @JsonProperty("start_time") public Optional getStartTime() { return startTime; @@ -124,6 +136,7 @@ private boolean equalTo(ListCreditEventLedgerRequest other) { && endTime.equals(other.endTime) && eventType.equals(other.eventType) && featureId.equals(other.featureId) + && sourceEventId.equals(other.sourceEventId) && startTime.equals(other.startTime) && limit.equals(other.limit) && offset.equals(other.offset); @@ -137,6 +150,7 @@ public int hashCode() { this.endTime, this.eventType, this.featureId, + this.sourceEventId, this.startTime, this.limit, this.offset); @@ -180,6 +194,13 @@ public interface _FinalStage { _FinalStage featureId(String featureId); + /** + *

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

+ */ + _FinalStage sourceEventId(Optional sourceEventId); + + _FinalStage sourceEventId(String sourceEventId); + _FinalStage startTime(Optional startTime); _FinalStage startTime(String startTime); @@ -209,6 +230,8 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private Optional startTime = Optional.empty(); + private Optional sourceEventId = Optional.empty(); + private Optional featureId = Optional.empty(); private Optional eventType = Optional.empty(); @@ -228,6 +251,7 @@ public Builder from(ListCreditEventLedgerRequest other) { endTime(other.getEndTime()); eventType(other.getEventType()); featureId(other.getFeatureId()); + sourceEventId(other.getSourceEventId()); startTime(other.getStartTime()); limit(other.getLimit()); offset(other.getOffset()); @@ -294,6 +318,26 @@ public _FinalStage startTime(Optional startTime) { return this; } + /** + *

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

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

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

+ */ + @java.lang.Override + @JsonSetter(value = "source_event_id", nulls = Nulls.SKIP) + public _FinalStage sourceEventId(Optional sourceEventId) { + this.sourceEventId = sourceEventId; + return this; + } + @java.lang.Override public _FinalStage featureId(String featureId) { this.featureId = Optional.ofNullable(featureId); @@ -354,6 +398,7 @@ public ListCreditEventLedgerRequest build() { endTime, eventType, featureId, + sourceEventId, startTime, limit, offset, @@ -367,6 +412,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("end_time") || key.equalsIgnoreCase("event_type") || key.equalsIgnoreCase("feature_id") + || key.equalsIgnoreCase("source_event_id") || key.equalsIgnoreCase("start_time") || key.equalsIgnoreCase("limit") || key.equalsIgnoreCase("offset")) { diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java index bb01c907..7824b923 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java @@ -35,6 +35,8 @@ public final class CountCreditEventLedgerParams { private final Optional offset; + private final Optional sourceEventId; + private final Optional startTime; private final Map additionalProperties; @@ -47,6 +49,7 @@ private CountCreditEventLedgerParams( Optional featureId, Optional limit, Optional offset, + Optional sourceEventId, Optional startTime, Map additionalProperties) { this.billingCreditId = billingCreditId; @@ -56,6 +59,7 @@ private CountCreditEventLedgerParams( this.featureId = featureId; this.limit = limit; this.offset = offset; + this.sourceEventId = sourceEventId; this.startTime = startTime; this.additionalProperties = additionalProperties; } @@ -101,6 +105,14 @@ public Optional getOffset() { return offset; } + /** + * @return Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it. + */ + @JsonProperty("source_event_id") + public Optional getSourceEventId() { + return sourceEventId; + } + @JsonProperty("start_time") public Optional getStartTime() { return startTime; @@ -125,6 +137,7 @@ private boolean equalTo(CountCreditEventLedgerParams other) { && featureId.equals(other.featureId) && limit.equals(other.limit) && offset.equals(other.offset) + && sourceEventId.equals(other.sourceEventId) && startTime.equals(other.startTime); } @@ -138,6 +151,7 @@ public int hashCode() { this.featureId, this.limit, this.offset, + this.sourceEventId, this.startTime); } @@ -166,6 +180,8 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional sourceEventId = Optional.empty(); + private Optional startTime = Optional.empty(); private Map additionalProperties = new HashMap<>(); @@ -180,6 +196,7 @@ public Builder from(CountCreditEventLedgerParams other) { featureId(other.getFeatureId()); limit(other.getLimit()); offset(other.getOffset()); + sourceEventId(other.getSourceEventId()); startTime(other.getStartTime()); return this; } @@ -267,6 +284,20 @@ public Builder offset(Long offset) { return this; } + /** + *

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

+ */ + @JsonSetter(value = "source_event_id", nulls = Nulls.SKIP) + public Builder sourceEventId(Optional sourceEventId) { + this.sourceEventId = sourceEventId; + return this; + } + + public Builder sourceEventId(String sourceEventId) { + this.sourceEventId = Optional.ofNullable(sourceEventId); + return this; + } + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) public Builder startTime(Optional startTime) { this.startTime = startTime; @@ -287,6 +318,7 @@ public CountCreditEventLedgerParams build() { featureId, limit, offset, + sourceEventId, startTime, additionalProperties); } @@ -300,6 +332,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("feature_id") || key.equalsIgnoreCase("limit") || key.equalsIgnoreCase("offset") + || key.equalsIgnoreCase("source_event_id") || key.equalsIgnoreCase("start_time")) { return; } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/credits/types/GetCreditEventLedgerEntryResponse.java similarity index 80% rename from src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java rename to src/main/java/com/schematic/api/resources/credits/types/GetCreditEventLedgerEntryResponse.java index 1dac2388..18488da8 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/GetCreditEventLedgerEntryResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.credits.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.EnvironmentDetailResponseData; +import com.schematic.api.types.CreditEventLedgerResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,16 +21,16 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateEnvironmentResponse.Builder.class) -public final class CreateEnvironmentResponse { - private final EnvironmentDetailResponseData data; +@JsonDeserialize(builder = GetCreditEventLedgerEntryResponse.Builder.class) +public final class GetCreditEventLedgerEntryResponse { + private final CreditEventLedgerResponseData data; private final Map params; private final Map additionalProperties; - private CreateEnvironmentResponse( - EnvironmentDetailResponseData data, + private GetCreditEventLedgerEntryResponse( + CreditEventLedgerResponseData data, Map params, Map additionalProperties) { this.data = data; @@ -39,7 +39,7 @@ private CreateEnvironmentResponse( } @JsonProperty("data") - public EnvironmentDetailResponseData getData() { + public CreditEventLedgerResponseData getData() { return data; } @@ -54,7 +54,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CreateEnvironmentResponse && equalTo((CreateEnvironmentResponse) other); + return other instanceof GetCreditEventLedgerEntryResponse && equalTo((GetCreditEventLedgerEntryResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CreateEnvironmentResponse other) { + private boolean equalTo(GetCreditEventLedgerEntryResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -81,13 +81,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull EnvironmentDetailResponseData data); + _FinalStage data(@NotNull CreditEventLedgerResponseData data); - Builder from(CreateEnvironmentResponse other); + Builder from(GetCreditEventLedgerEntryResponse other); } public interface _FinalStage { - CreateEnvironmentResponse build(); + GetCreditEventLedgerEntryResponse build(); _FinalStage additionalProperty(String key, Object value); @@ -105,7 +105,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private EnvironmentDetailResponseData data; + private CreditEventLedgerResponseData data; private Map params = new LinkedHashMap<>(); @@ -114,7 +114,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(CreateEnvironmentResponse other) { + public Builder from(GetCreditEventLedgerEntryResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -122,7 +122,7 @@ public Builder from(CreateEnvironmentResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull EnvironmentDetailResponseData data) { + public _FinalStage data(@NotNull CreditEventLedgerResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -163,8 +163,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public CreateEnvironmentResponse build() { - return new CreateEnvironmentResponse(data, params, additionalProperties); + public GetCreditEventLedgerEntryResponse build() { + return new GetCreditEventLedgerEntryResponse(data, params, additionalProperties); } @JsonAnySetter diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java index 35d49bc4..3f4c7d73 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java @@ -35,6 +35,8 @@ public final class ListCreditEventLedgerParams { private final Optional offset; + private final Optional sourceEventId; + private final Optional startTime; private final Map additionalProperties; @@ -47,6 +49,7 @@ private ListCreditEventLedgerParams( Optional featureId, Optional limit, Optional offset, + Optional sourceEventId, Optional startTime, Map additionalProperties) { this.billingCreditId = billingCreditId; @@ -56,6 +59,7 @@ private ListCreditEventLedgerParams( this.featureId = featureId; this.limit = limit; this.offset = offset; + this.sourceEventId = sourceEventId; this.startTime = startTime; this.additionalProperties = additionalProperties; } @@ -101,6 +105,14 @@ public Optional getOffset() { return offset; } + /** + * @return Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it. + */ + @JsonProperty("source_event_id") + public Optional getSourceEventId() { + return sourceEventId; + } + @JsonProperty("start_time") public Optional getStartTime() { return startTime; @@ -125,6 +137,7 @@ private boolean equalTo(ListCreditEventLedgerParams other) { && featureId.equals(other.featureId) && limit.equals(other.limit) && offset.equals(other.offset) + && sourceEventId.equals(other.sourceEventId) && startTime.equals(other.startTime); } @@ -138,6 +151,7 @@ public int hashCode() { this.featureId, this.limit, this.offset, + this.sourceEventId, this.startTime); } @@ -166,6 +180,8 @@ public static final class Builder { private Optional offset = Optional.empty(); + private Optional sourceEventId = Optional.empty(); + private Optional startTime = Optional.empty(); private Map additionalProperties = new HashMap<>(); @@ -180,6 +196,7 @@ public Builder from(ListCreditEventLedgerParams other) { featureId(other.getFeatureId()); limit(other.getLimit()); offset(other.getOffset()); + sourceEventId(other.getSourceEventId()); startTime(other.getStartTime()); return this; } @@ -267,6 +284,20 @@ public Builder offset(Long offset) { return this; } + /** + *

Return only entries drawn by this track or inference event. Pass the event ID that POST /events returned for it.

+ */ + @JsonSetter(value = "source_event_id", nulls = Nulls.SKIP) + public Builder sourceEventId(Optional sourceEventId) { + this.sourceEventId = sourceEventId; + return this; + } + + public Builder sourceEventId(String sourceEventId) { + this.sourceEventId = Optional.ofNullable(sourceEventId); + return this; + } + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) public Builder startTime(Optional startTime) { this.startTime = startTime; @@ -287,6 +318,7 @@ public ListCreditEventLedgerParams build() { featureId, limit, offset, + sourceEventId, startTime, additionalProperties); } @@ -300,6 +332,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("feature_id") || key.equalsIgnoreCase("limit") || key.equalsIgnoreCase("offset") + || key.equalsIgnoreCase("source_event_id") || key.equalsIgnoreCase("start_time")) { return; } diff --git a/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java index 3fd36bc8..a16c9feb 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.ResponseBodyInputStream; @@ -297,7 +298,7 @@ public CompletableFuture> getDa HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("data-exports") - .addPathSegment(dataExportId); + .addPathSegment(PathSegments.validate(dataExportId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -395,7 +396,7 @@ public CompletableFuture> getDataExportAr HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("data-exports") - .addPathSegment(dataExportId) + .addPathSegment(PathSegments.validate(dataExportId)) .addPathSegments("artifact"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java index 2ff8ab84..1e9595ad 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.ResponseBodyInputStream; @@ -230,7 +231,7 @@ public BaseSchematicHttpResponse getDataExport( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("data-exports") - .addPathSegment(dataExportId); + .addPathSegment(PathSegments.validate(dataExportId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -299,7 +300,7 @@ public BaseSchematicHttpResponse getDataExportArtifact( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("data-exports") - .addPathSegment(dataExportId) + .addPathSegment(PathSegments.validate(dataExportId)) .addPathSegments("artifact"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java index 02dc06fc..e1d89838 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -363,7 +364,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId); + .addPathSegment(PathSegments.validate(companyOverrideId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -463,7 +464,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -578,7 +579,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -2110,7 +2111,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId); + .addPathSegment(PathSegments.validate(planEntitlementId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -2210,7 +2211,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -2325,7 +2326,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java index 88df17ff..95772533 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -295,7 +296,7 @@ public BaseSchematicHttpResponse getCompanyOverride( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId); + .addPathSegment(PathSegments.validate(companyOverrideId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -366,7 +367,7 @@ public BaseSchematicHttpResponse updateCompanyOve HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId); + .addPathSegment(PathSegments.validate(companyOverrideId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -449,7 +450,7 @@ public BaseSchematicHttpResponse deleteCompanyOve HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId); + .addPathSegment(PathSegments.validate(companyOverrideId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1604,7 +1605,7 @@ public BaseSchematicHttpResponse getPlanEntitlement( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId); + .addPathSegment(PathSegments.validate(planEntitlementId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1675,7 +1676,7 @@ public BaseSchematicHttpResponse updatePlanEntitl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId); + .addPathSegment(PathSegments.validate(planEntitlementId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1758,7 +1759,7 @@ public BaseSchematicHttpResponse deletePlanEntitl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId); + .addPathSegment(PathSegments.validate(planEntitlementId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java b/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java index fafb3b3e..3ab40380 100644 --- a/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -559,7 +560,7 @@ public CompletableFuture> getEvent( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("events") - .addPathSegment(eventId); + .addPathSegment(PathSegments.validate(eventId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/events/RawEventsClient.java b/src/main/java/com/schematic/api/resources/events/RawEventsClient.java index 87fd0d62..83280059 100644 --- a/src/main/java/com/schematic/api/resources/events/RawEventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/RawEventsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -427,7 +428,7 @@ public BaseSchematicHttpResponse getEvent(String eventId, Requ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("events") - .addPathSegment(eventId); + .addPathSegment(PathSegments.validate(eventId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java b/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java index d26d4612..caa34c5b 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -351,7 +352,7 @@ public CompletableFuture> getFeatu HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId); + .addPathSegment(PathSegments.validate(featureId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -459,7 +460,7 @@ public CompletableFuture> updat HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId); + .addPathSegment(PathSegments.validate(featureId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -572,7 +573,7 @@ public CompletableFuture> delet HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId); + .addPathSegment(PathSegments.validate(featureId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1193,7 +1194,7 @@ public CompletableFuture> getFlag( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId); + .addPathSegment(PathSegments.validate(flagId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1292,7 +1293,7 @@ public CompletableFuture> updateFl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId); + .addPathSegment(PathSegments.validate(flagId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1405,7 +1406,7 @@ public CompletableFuture> deleteFl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId); + .addPathSegment(PathSegments.validate(flagId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1512,7 +1513,7 @@ public CompletableFuture> upd HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) + .addPathSegment(PathSegments.validate(flagId)) .addPathSegments("rules"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1636,7 +1637,7 @@ public CompletableFuture> checkFlag HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(key) + .addPathSegment(PathSegments.validate(key)) .addPathSegments("check"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1760,7 +1761,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(key) + .addPathSegment(PathSegments.validate(key)) .addPathSegments("check-and-reserve"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java b/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java index 304b5ee0..40a676ae 100644 --- a/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -281,7 +282,7 @@ public BaseSchematicHttpResponse getFeature(String featureId HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId); + .addPathSegment(PathSegments.validate(featureId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -360,7 +361,7 @@ public BaseSchematicHttpResponse updateFeature( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId); + .addPathSegment(PathSegments.validate(featureId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -442,7 +443,7 @@ public BaseSchematicHttpResponse deleteFeature( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId); + .addPathSegment(PathSegments.validate(featureId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -904,7 +905,7 @@ public BaseSchematicHttpResponse getFlag(String flagId, Request HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId); + .addPathSegment(PathSegments.validate(flagId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -973,7 +974,7 @@ public BaseSchematicHttpResponse updateFlag( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId); + .addPathSegment(PathSegments.validate(flagId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1054,7 +1055,7 @@ public BaseSchematicHttpResponse deleteFlag(String flagId, R HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId); + .addPathSegment(PathSegments.validate(flagId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1130,7 +1131,7 @@ public BaseSchematicHttpResponse updateFlagRules( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) + .addPathSegment(PathSegments.validate(flagId)) .addPathSegments("rules"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1222,7 +1223,7 @@ public BaseSchematicHttpResponse checkFlag( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(key) + .addPathSegment(PathSegments.validate(key)) .addPathSegments("check"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1315,7 +1316,7 @@ public BaseSchematicHttpResponse checkAndReserveFla HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(key) + .addPathSegment(PathSegments.validate(key)) .addPathSegments("check-and-reserve"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { 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 5139526f..c8ec7353 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -68,7 +69,7 @@ public CompletableFuture> runI HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("integration/start") - .addPathSegment(integrationId); + .addPathSegment(PathSegments.validate(integrationId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -306,7 +307,7 @@ public CompletableFuture { @@ -1486,7 +1487,7 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("integrations/uninstall") - .addPathSegment(integrationId); + .addPathSegment(PathSegments.validate(integrationId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); 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 503a4fcc..5f0f00e1 100644 --- a/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java +++ b/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -64,7 +65,7 @@ public BaseSchematicHttpResponse runIntegration( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("integration/start") - .addPathSegment(integrationId); + .addPathSegment(PathSegments.validate(integrationId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -241,7 +242,7 @@ public BaseSchematicHttpResponse getIntegratio HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("integrations") - .addPathSegment(type) + .addPathSegment(PathSegments.validate(type)) .addPathSegments("webhook-url"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1084,7 +1085,7 @@ public BaseSchematicHttpResponse uninstallIntegrat HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("integrations/uninstall") - .addPathSegment(integrationId); + .addPathSegment(PathSegments.validate(integrationId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/licenses/AsyncRawLicensesClient.java b/src/main/java/com/schematic/api/resources/licenses/AsyncRawLicensesClient.java index 79819460..a64e94ec 100644 --- a/src/main/java/com/schematic/api/resources/licenses/AsyncRawLicensesClient.java +++ b/src/main/java/com/schematic/api/resources/licenses/AsyncRawLicensesClient.java @@ -9,6 +9,7 @@ import com.schematic.api.core.BaseSchematicHttpResponse; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -182,7 +183,7 @@ public CompletableFuture> ge HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("licenses") - .addPathSegment(licenseId); + .addPathSegment(PathSegments.validate(licenseId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/licenses/RawLicensesClient.java b/src/main/java/com/schematic/api/resources/licenses/RawLicensesClient.java index 03ab6d26..9668a85f 100644 --- a/src/main/java/com/schematic/api/resources/licenses/RawLicensesClient.java +++ b/src/main/java/com/schematic/api/resources/licenses/RawLicensesClient.java @@ -9,6 +9,7 @@ import com.schematic.api.core.BaseSchematicHttpResponse; import com.schematic.api.core.ClientOptions; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -145,7 +146,7 @@ public BaseSchematicHttpResponse getSingleLicense( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("licenses") - .addPathSegment(licenseId); + .addPathSegment(PathSegments.validate(licenseId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java index 146c2963..bce056ad 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; import com.schematic.api.errors.BadRequestError; @@ -282,7 +283,7 @@ public CompletableFuture> up HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-bundles") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java index 9e954a9f..89785163 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; import com.schematic.api.errors.BadRequestError; @@ -216,7 +217,7 @@ public BaseSchematicHttpResponse updatePlanBundle( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-bundles") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java index 3524d91c..b1dd1ac0 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreateCustomPlanBundleRequestBody.java @@ -15,6 +15,7 @@ import com.schematic.api.types.CreateCustomPlanBundlePlanRequestBody; import com.schematic.api.types.PlanBundleCreditGrantRequestBody; import com.schematic.api.types.PlanBundleEntitlementRequestBody; +import com.schematic.api.types.RenewalPolicy; import com.schematic.api.types.UpsertBillingProductRequestBody; import java.util.ArrayList; import java.util.HashMap; @@ -35,6 +36,8 @@ public final class CreateCustomPlanBundleRequestBody { private final CreateCustomPlanBundlePlanRequestBody plan; + private final Optional renewalPolicy; + private final Map additionalProperties; private CreateCustomPlanBundleRequestBody( @@ -42,11 +45,13 @@ private CreateCustomPlanBundleRequestBody( Optional> creditGrants, List entitlements, CreateCustomPlanBundlePlanRequestBody plan, + Optional renewalPolicy, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; this.entitlements = entitlements; this.plan = plan; + this.renewalPolicy = renewalPolicy; this.additionalProperties = additionalProperties; } @@ -70,6 +75,11 @@ public CreateCustomPlanBundlePlanRequestBody getPlan() { return plan; } + @JsonProperty("renewal_policy") + public Optional getRenewalPolicy() { + return renewalPolicy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -85,12 +95,13 @@ private boolean equalTo(CreateCustomPlanBundleRequestBody other) { return billingProduct.equals(other.billingProduct) && creditGrants.equals(other.creditGrants) && entitlements.equals(other.entitlements) - && plan.equals(other.plan); + && plan.equals(other.plan) + && renewalPolicy.equals(other.renewalPolicy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan); + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.renewalPolicy); } @java.lang.Override @@ -128,6 +139,10 @@ public interface _FinalStage { _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements); _FinalStage addAllEntitlements(List entitlements); + + _FinalStage renewalPolicy(Optional renewalPolicy); + + _FinalStage renewalPolicy(RenewalPolicy renewalPolicy); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -136,6 +151,8 @@ public static final class Builder implements BillingProductStage, PlanStage, _Fi private CreateCustomPlanBundlePlanRequestBody plan; + private Optional renewalPolicy = Optional.empty(); + private List entitlements = new ArrayList<>(); private Optional> creditGrants = Optional.empty(); @@ -150,6 +167,7 @@ public Builder from(CreateCustomPlanBundleRequestBody other) { creditGrants(other.getCreditGrants()); entitlements(other.getEntitlements()); plan(other.getPlan()); + renewalPolicy(other.getRenewalPolicy()); return this; } @@ -167,6 +185,19 @@ public _FinalStage plan(@NotNull CreateCustomPlanBundlePlanRequestBody plan) { return this; } + @java.lang.Override + public _FinalStage renewalPolicy(RenewalPolicy renewalPolicy) { + this.renewalPolicy = Optional.ofNullable(renewalPolicy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_policy", nulls = Nulls.SKIP) + public _FinalStage renewalPolicy(Optional renewalPolicy) { + this.renewalPolicy = renewalPolicy; + return this; + } + @java.lang.Override public _FinalStage addAllEntitlements(List entitlements) { if (entitlements != null) { @@ -207,7 +238,7 @@ public _FinalStage creditGrants(Optional> @java.lang.Override public CreateCustomPlanBundleRequestBody build() { return new CreateCustomPlanBundleRequestBody( - billingProduct, creditGrants, entitlements, plan, additionalProperties); + billingProduct, creditGrants, entitlements, plan, renewalPolicy, additionalProperties); } @JsonAnySetter @@ -215,7 +246,8 @@ private void putAdditionalPropertyFromJson(String key, Object value) { if (key.equalsIgnoreCase("billing_product") || key.equalsIgnoreCase("credit_grants") || key.equalsIgnoreCase("entitlements") - || key.equalsIgnoreCase("plan")) { + || key.equalsIgnoreCase("plan") + || key.equalsIgnoreCase("renewal_policy")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java index 82a557a1..882b1a1d 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java @@ -15,6 +15,7 @@ import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.PlanBundleCreditGrantRequestBody; import com.schematic.api.types.PlanBundleEntitlementRequestBody; +import com.schematic.api.types.RenewalPolicy; import com.schematic.api.types.UpsertBillingProductRequestBody; import java.util.ArrayList; import java.util.HashMap; @@ -35,6 +36,8 @@ public final class CreatePlanBundleRequestBody { private final CreatePlanRequestBody plan; + private final Optional renewalPolicy; + private final Map additionalProperties; private CreatePlanBundleRequestBody( @@ -42,11 +45,13 @@ private CreatePlanBundleRequestBody( Optional> creditGrants, List entitlements, CreatePlanRequestBody plan, + Optional renewalPolicy, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; this.entitlements = entitlements; this.plan = plan; + this.renewalPolicy = renewalPolicy; this.additionalProperties = additionalProperties; } @@ -70,6 +75,11 @@ public CreatePlanRequestBody getPlan() { return plan; } + @JsonProperty("renewal_policy") + public Optional getRenewalPolicy() { + return renewalPolicy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -85,12 +95,13 @@ private boolean equalTo(CreatePlanBundleRequestBody other) { return billingProduct.equals(other.billingProduct) && creditGrants.equals(other.creditGrants) && entitlements.equals(other.entitlements) - && plan.equals(other.plan); + && plan.equals(other.plan) + && renewalPolicy.equals(other.renewalPolicy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan); + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.renewalPolicy); } @java.lang.Override @@ -128,12 +139,18 @@ public interface _FinalStage { _FinalStage addEntitlements(PlanBundleEntitlementRequestBody entitlements); _FinalStage addAllEntitlements(List entitlements); + + _FinalStage renewalPolicy(Optional renewalPolicy); + + _FinalStage renewalPolicy(RenewalPolicy renewalPolicy); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements PlanStage, _FinalStage { private CreatePlanRequestBody plan; + private Optional renewalPolicy = Optional.empty(); + private List entitlements = new ArrayList<>(); private Optional> creditGrants = Optional.empty(); @@ -150,6 +167,7 @@ public Builder from(CreatePlanBundleRequestBody other) { creditGrants(other.getCreditGrants()); entitlements(other.getEntitlements()); plan(other.getPlan()); + renewalPolicy(other.getRenewalPolicy()); return this; } @@ -160,6 +178,19 @@ public _FinalStage plan(@NotNull CreatePlanRequestBody plan) { return this; } + @java.lang.Override + public _FinalStage renewalPolicy(RenewalPolicy renewalPolicy) { + this.renewalPolicy = Optional.ofNullable(renewalPolicy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_policy", nulls = Nulls.SKIP) + public _FinalStage renewalPolicy(Optional renewalPolicy) { + this.renewalPolicy = renewalPolicy; + return this; + } + @java.lang.Override public _FinalStage addAllEntitlements(List entitlements) { if (entitlements != null) { @@ -213,7 +244,7 @@ public _FinalStage billingProduct(Optional bill @java.lang.Override public CreatePlanBundleRequestBody build() { return new CreatePlanBundleRequestBody( - billingProduct, creditGrants, entitlements, plan, additionalProperties); + billingProduct, creditGrants, entitlements, plan, renewalPolicy, additionalProperties); } @JsonAnySetter @@ -221,7 +252,8 @@ private void putAdditionalPropertyFromJson(String key, Object value) { if (key.equalsIgnoreCase("billing_product") || key.equalsIgnoreCase("credit_grants") || key.equalsIgnoreCase("entitlements") - || key.equalsIgnoreCase("plan")) { + || key.equalsIgnoreCase("plan") + || key.equalsIgnoreCase("renewal_policy")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java index 4c8b8e1c..82604f01 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java @@ -14,6 +14,7 @@ import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.PlanBundleCreditGrantRequestBody; import com.schematic.api.types.PlanBundleEntitlementRequestBody; +import com.schematic.api.types.RenewalPolicy; import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; import java.util.ArrayList; @@ -37,6 +38,8 @@ public final class UpdatePlanBundleRequestBody { private final Optional planVersionId; + private final Optional renewalPolicy; + private final Map additionalProperties; private UpdatePlanBundleRequestBody( @@ -45,12 +48,14 @@ private UpdatePlanBundleRequestBody( List entitlements, UpdatePlanRequestBody plan, Optional planVersionId, + Optional renewalPolicy, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; this.entitlements = entitlements; this.plan = plan; this.planVersionId = planVersionId; + this.renewalPolicy = renewalPolicy; this.additionalProperties = additionalProperties; } @@ -79,6 +84,11 @@ public Optional getPlanVersionId() { return planVersionId; } + @JsonProperty("renewal_policy") + public Optional getRenewalPolicy() { + return renewalPolicy; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -95,12 +105,19 @@ private boolean equalTo(UpdatePlanBundleRequestBody other) { && creditGrants.equals(other.creditGrants) && entitlements.equals(other.entitlements) && plan.equals(other.plan) - && planVersionId.equals(other.planVersionId); + && planVersionId.equals(other.planVersionId) + && renewalPolicy.equals(other.renewalPolicy); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.planVersionId); + return Objects.hash( + this.billingProduct, + this.creditGrants, + this.entitlements, + this.plan, + this.planVersionId, + this.renewalPolicy); } @java.lang.Override @@ -142,12 +159,18 @@ public interface _FinalStage { _FinalStage planVersionId(Optional planVersionId); _FinalStage planVersionId(String planVersionId); + + _FinalStage renewalPolicy(Optional renewalPolicy); + + _FinalStage renewalPolicy(RenewalPolicy renewalPolicy); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements PlanStage, _FinalStage { private UpdatePlanRequestBody plan; + private Optional renewalPolicy = Optional.empty(); + private Optional planVersionId = Optional.empty(); private List entitlements = new ArrayList<>(); @@ -167,6 +190,7 @@ public Builder from(UpdatePlanBundleRequestBody other) { entitlements(other.getEntitlements()); plan(other.getPlan()); planVersionId(other.getPlanVersionId()); + renewalPolicy(other.getRenewalPolicy()); return this; } @@ -177,6 +201,19 @@ public _FinalStage plan(@NotNull UpdatePlanRequestBody plan) { return this; } + @java.lang.Override + public _FinalStage renewalPolicy(RenewalPolicy renewalPolicy) { + this.renewalPolicy = Optional.ofNullable(renewalPolicy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_policy", nulls = Nulls.SKIP) + public _FinalStage renewalPolicy(Optional renewalPolicy) { + this.renewalPolicy = renewalPolicy; + return this; + } + @java.lang.Override public _FinalStage planVersionId(String planVersionId) { this.planVersionId = Optional.ofNullable(planVersionId); @@ -243,7 +280,13 @@ public _FinalStage billingProduct(Optional bill @java.lang.Override public UpdatePlanBundleRequestBody build() { return new UpdatePlanBundleRequestBody( - billingProduct, creditGrants, entitlements, plan, planVersionId, additionalProperties); + billingProduct, + creditGrants, + entitlements, + plan, + planVersionId, + renewalPolicy, + additionalProperties); } @JsonAnySetter @@ -252,7 +295,8 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("credit_grants") || key.equalsIgnoreCase("entitlements") || key.equalsIgnoreCase("plan") - || key.equalsIgnoreCase("plan_version_id")) { + || key.equalsIgnoreCase("plan_version_id") + || key.equalsIgnoreCase("renewal_policy")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java index c809ad48..c903746e 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -283,7 +284,7 @@ public CompletableFuture> upd HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-groups") - .addPathSegment(planGroupId); + .addPathSegment(PathSegments.validate(planGroupId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java index cdf091f1..5aefd692 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -217,7 +218,7 @@ public BaseSchematicHttpResponse updatePlanGroup( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-groups") - .addPathSegment(planGroupId); + .addPathSegment(PathSegments.validate(planGroupId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java index b718056f..56ac0b44 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -189,7 +190,7 @@ public CompletableFuture { @@ -671,7 +672,7 @@ public CompletableFuture> getMig HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId); + .addPathSegment(PathSegments.validate(planVersionMigrationId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -770,7 +771,7 @@ public CompletableFuture> can HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId) + .addPathSegment(PathSegments.validate(planVersionMigrationId)) .addPathSegments("cancel"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -894,7 +895,7 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId) + .addPathSegment(PathSegments.validate(planVersionMigrationId)) .addPathSegments("complete-now"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1010,7 +1011,7 @@ public CompletableFuture> retr HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId) + .addPathSegment(PathSegments.validate(planVersionMigrationId)) .addPathSegments("retry"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java index c33d358e..6dae73e4 100644 --- a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -154,7 +155,7 @@ public BaseSchematicHttpResponse retryCompanyMigr HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-company-migrations") - .addPathSegment(planVersionCompanyMigrationId) + .addPathSegment(PathSegments.validate(planVersionCompanyMigrationId)) .addPathSegments("retry"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -510,7 +511,7 @@ public BaseSchematicHttpResponse getMigration( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId); + .addPathSegment(PathSegments.validate(planVersionMigrationId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -579,7 +580,7 @@ public BaseSchematicHttpResponse cancelMigration( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId) + .addPathSegment(PathSegments.validate(planVersionMigrationId)) .addPathSegments("cancel"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -672,7 +673,7 @@ public BaseSchematicHttpResponse completeMigration HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId) + .addPathSegment(PathSegments.validate(planVersionMigrationId)) .addPathSegments("complete-now"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -757,7 +758,7 @@ public BaseSchematicHttpResponse retryMigration( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-version-migrations") - .addPathSegment(planVersionMigrationId) + .addPathSegment(PathSegments.validate(planVersionMigrationId)) .addPathSegments("retry"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java index b15ebd78..c3610c9d 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java @@ -12,6 +12,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -89,7 +90,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-plans") - .addPathSegment(companyId); + .addPathSegment(PathSegments.validate(companyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -359,7 +360,7 @@ public CompletableFuture { @@ -476,7 +477,7 @@ public CompletableFuture { @@ -1041,7 +1042,7 @@ public CompletableFuture> getPlan( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (request.getPlanVersionId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); @@ -1144,7 +1145,7 @@ public CompletableFuture> updatePl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1257,7 +1258,7 @@ public CompletableFuture> deletePl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1364,7 +1365,7 @@ public CompletableFuture { @@ -2167,7 +2168,7 @@ public CompletableFuture> d HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId); + .addPathSegment(PathSegments.validate(planVersionId)); if (request.getPromoteArchivedVersion().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -2294,7 +2295,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId) + .addPathSegment(PathSegments.validate(planVersionId)) .addPathSegments("diff"); if (request.getAgainst().isPresent()) { QueryStringMapper.addQueryParameter( @@ -2399,7 +2400,7 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId) + .addPathSegment(PathSegments.validate(planVersionId)) .addPathSegments("publish"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -2515,7 +2516,7 @@ public CompletableFuture { diff --git a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java index b98daae7..0648c963 100644 --- a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java @@ -12,6 +12,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -85,7 +86,7 @@ public BaseSchematicHttpResponse updateCompanyPlans( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-plans") - .addPathSegment(companyId); + .addPathSegment(PathSegments.validate(companyId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -293,7 +294,7 @@ public BaseSchematicHttpResponse markCustomPl HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("custom-plan-billings") - .addPathSegment(customPlanBillingId) + .addPathSegment(PathSegments.validate(customPlanBillingId)) .addPathSegments("mark-paid"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -379,7 +380,7 @@ public BaseSchematicHttpResponse retryCustomPlan HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("custom-plan-billings") - .addPathSegment(customPlanBillingId) + .addPathSegment(PathSegments.validate(customPlanBillingId)) .addPathSegments("retry"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -818,7 +819,7 @@ public BaseSchematicHttpResponse getPlan( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (request.getPlanVersionId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); @@ -891,7 +892,7 @@ public BaseSchematicHttpResponse updatePlan( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -972,7 +973,7 @@ public BaseSchematicHttpResponse deletePlan(String planId, R HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId); + .addPathSegment(PathSegments.validate(planId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -1048,7 +1049,7 @@ public BaseSchematicHttpResponse upsertBilling HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) + .addPathSegment(PathSegments.validate(planId)) .addPathSegments("billing_products"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1661,7 +1662,7 @@ public BaseSchematicHttpResponse deletePlanVersion( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId); + .addPathSegment(PathSegments.validate(planVersionId)); if (request.getPromoteArchivedVersion().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -1756,7 +1757,7 @@ public BaseSchematicHttpResponse getPlanVersionDiff( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId) + .addPathSegment(PathSegments.validate(planVersionId)) .addPathSegments("diff"); if (request.getAgainst().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1832,7 +1833,7 @@ public BaseSchematicHttpResponse publishPlanVersion( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId) + .addPathSegment(PathSegments.validate(planVersionId)) .addPathSegments("publish"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -1917,7 +1918,7 @@ public BaseSchematicHttpResponse previewPubli HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans/version") - .addPathSegment(planVersionId) + .addPathSegment(PathSegments.validate(planVersionId)) .addPathSegments("publish-preview"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java index 10828ee4..e56d54df 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/RetryCustomPlanBillingRequestBody.java @@ -33,6 +33,8 @@ public final class RetryCustomPlanBillingRequestBody { private final Optional daysUntilDue; + private final Optional endDate; + private final Optional prorateFirstPeriod; private final Optional sendInvoice; @@ -45,6 +47,7 @@ private RetryCustomPlanBillingRequestBody( Optional billingStartDate, String customerEmail, Optional daysUntilDue, + Optional endDate, Optional prorateFirstPeriod, Optional sendInvoice, Map additionalProperties) { @@ -53,6 +56,7 @@ private RetryCustomPlanBillingRequestBody( this.billingStartDate = billingStartDate; this.customerEmail = customerEmail; this.daysUntilDue = daysUntilDue; + this.endDate = endDate; this.prorateFirstPeriod = prorateFirstPeriod; this.sendInvoice = sendInvoice; this.additionalProperties = additionalProperties; @@ -89,6 +93,14 @@ public Optional getDaysUntilDue() { return daysUntilDue; } + /** + * @return When a plan that doesn't renew ends. Moved back to the last renewal on or before it. When omitted, the end date set at finalize is reissued. Only honored when the retry creates a subscription. + */ + @JsonProperty("end_date") + public Optional getEndDate() { + return endDate; + } + /** * @return When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true. */ @@ -122,6 +134,7 @@ private boolean equalTo(RetryCustomPlanBillingRequestBody other) { && billingStartDate.equals(other.billingStartDate) && customerEmail.equals(other.customerEmail) && daysUntilDue.equals(other.daysUntilDue) + && endDate.equals(other.endDate) && prorateFirstPeriod.equals(other.prorateFirstPeriod) && sendInvoice.equals(other.sendInvoice); } @@ -134,6 +147,7 @@ public int hashCode() { this.billingStartDate, this.customerEmail, this.daysUntilDue, + this.endDate, this.prorateFirstPeriod, this.sendInvoice); } @@ -182,6 +196,13 @@ public interface _FinalStage { _FinalStage daysUntilDue(Long daysUntilDue); + /** + *

When a plan that doesn't renew ends. Moved back to the last renewal on or before it. When omitted, the end date set at finalize is reissued. Only honored when the retry creates a subscription.

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

When true, the partial period between the subscription starting and its renewal date is billed pro rata straight away. When false that period is free and no invoice is raised until the renewal date. Only applies alongside billing_cycle_anchor. Defaults to true.

*/ @@ -205,6 +226,8 @@ public static final class Builder implements CustomerEmailStage, _FinalStage { private Optional prorateFirstPeriod = Optional.empty(); + private Optional endDate = Optional.empty(); + private Optional daysUntilDue = Optional.empty(); private Optional billingStartDate = Optional.empty(); @@ -224,6 +247,7 @@ public Builder from(RetryCustomPlanBillingRequestBody other) { billingStartDate(other.getBillingStartDate()); customerEmail(other.getCustomerEmail()); daysUntilDue(other.getDaysUntilDue()); + endDate(other.getEndDate()); prorateFirstPeriod(other.getProrateFirstPeriod()); sendInvoice(other.getSendInvoice()); return this; @@ -276,6 +300,26 @@ public _FinalStage prorateFirstPeriod(Optional prorateFirstPeriod) { return this; } + /** + *

When a plan that doesn't renew ends. Moved back to the last renewal on or before it. When omitted, the end date set at finalize is reissued. Only honored when the retry creates a subscription.

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

When a plan that doesn't renew ends. Moved back to the last renewal on or before it. When omitted, the end date set at finalize is reissued. Only honored when the retry creates a subscription.

+ */ + @java.lang.Override + @JsonSetter(value = "end_date", nulls = Nulls.SKIP) + public _FinalStage endDate(Optional endDate) { + this.endDate = endDate; + return this; + } + @java.lang.Override public _FinalStage daysUntilDue(Long daysUntilDue) { this.daysUntilDue = Optional.ofNullable(daysUntilDue); @@ -350,6 +394,7 @@ public RetryCustomPlanBillingRequestBody build() { billingStartDate, customerEmail, daysUntilDue, + endDate, prorateFirstPeriod, sendInvoice, additionalProperties); @@ -362,6 +407,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("billing_start_date") || key.equalsIgnoreCase("customer_email") || key.equalsIgnoreCase("days_until_due") + || key.equalsIgnoreCase("end_date") || key.equalsIgnoreCase("prorate_first_period") || key.equalsIgnoreCase("send_invoice")) { return; diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java index 1ca08c75..f762137b 100644 --- a/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -301,7 +302,7 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("scheduled-checkout") - .addPathSegment(scheduledCheckoutId); + .addPathSegment(PathSegments.validate(scheduledCheckoutId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -413,7 +414,7 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java index 0f6e07f8..679d62f1 100644 --- a/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -233,7 +234,7 @@ public BaseSchematicHttpResponse getScheduledCheck HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("scheduled-checkout") - .addPathSegment(scheduledCheckoutId); + .addPathSegment(PathSegments.validate(scheduledCheckoutId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -316,7 +317,7 @@ public BaseSchematicHttpResponse updateSchedule HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("scheduled-checkout") - .addPathSegment(scheduledCheckoutId); + .addPathSegment(PathSegments.validate(scheduledCheckoutId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java index c611ec9b..becf6168 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -198,7 +199,7 @@ public CompletableFuture> get HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhook-events") - .addPathSegment(webhookEventId); + .addPathSegment(PathSegments.validate(webhookEventId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -663,7 +664,7 @@ public CompletableFuture> getWebho HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId); + .addPathSegment(PathSegments.validate(webhookId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -771,7 +772,7 @@ public CompletableFuture> updat HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId); + .addPathSegment(PathSegments.validate(webhookId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -884,7 +885,7 @@ public CompletableFuture> delet HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId); + .addPathSegment(PathSegments.validate(webhookId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -991,7 +992,7 @@ public CompletableFuture { diff --git a/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java index 8f9dc5a7..92016af0 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java @@ -11,6 +11,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.MediaTypes; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.PathSegments; import com.schematic.api.core.QueryStringMapper; import com.schematic.api.core.RequestOptions; import com.schematic.api.core.RetryInterceptor; @@ -160,7 +161,7 @@ public BaseSchematicHttpResponse getWebhookEvent( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhook-events") - .addPathSegment(webhookEventId); + .addPathSegment(PathSegments.validate(webhookEventId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -498,7 +499,7 @@ public BaseSchematicHttpResponse getWebhook(String webhookId HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId); + .addPathSegment(PathSegments.validate(webhookId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -577,7 +578,7 @@ public BaseSchematicHttpResponse updateWebhook( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId); + .addPathSegment(PathSegments.validate(webhookId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -659,7 +660,7 @@ public BaseSchematicHttpResponse deleteWebhook( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId); + .addPathSegment(PathSegments.validate(webhookId)); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -735,7 +736,7 @@ public BaseSchematicHttpResponse sendTestWebhookA HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) + .addPathSegment(PathSegments.validate(webhookId)) .addPathSegments("test"); if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { diff --git a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java deleted file mode 100644 index 8e8cb615..00000000 --- a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java +++ /dev/null @@ -1,515 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import java.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 = ApiKeyCreateResponseData.Builder.class) -public final class ApiKeyCreateResponseData { - private final OffsetDateTime createdAt; - - private final Optional description; - - private final Optional environment; - - private final Optional environmentId; - - private final String id; - - private final Optional integration; - - private final Optional lastUsedAt; - - private final String name; - - private final Optional rateLimitPercent; - - private final boolean readonly; - - private final List scopes; - - private final String secret; - - private final OffsetDateTime updatedAt; - - private final Map additionalProperties; - - private ApiKeyCreateResponseData( - OffsetDateTime createdAt, - Optional description, - Optional environment, - Optional environmentId, - String id, - Optional integration, - Optional lastUsedAt, - String name, - Optional rateLimitPercent, - boolean readonly, - List scopes, - String secret, - OffsetDateTime updatedAt, - Map additionalProperties) { - this.createdAt = createdAt; - this.description = description; - this.environment = environment; - this.environmentId = environmentId; - this.id = id; - this.integration = integration; - this.lastUsedAt = lastUsedAt; - this.name = name; - this.rateLimitPercent = rateLimitPercent; - this.readonly = readonly; - this.scopes = scopes; - this.secret = secret; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("created_at") - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - @JsonProperty("environment") - public Optional getEnvironment() { - return environment; - } - - @JsonProperty("environment_id") - public Optional getEnvironmentId() { - return environmentId; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("integration") - public Optional getIntegration() { - return integration; - } - - @JsonProperty("last_used_at") - public Optional getLastUsedAt() { - return lastUsedAt; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("rate_limit_percent") - public Optional getRateLimitPercent() { - return rateLimitPercent; - } - - @JsonProperty("readonly") - public boolean getReadonly() { - return readonly; - } - - @JsonProperty("scopes") - public List getScopes() { - return scopes; - } - - @JsonProperty("secret") - public String getSecret() { - return secret; - } - - @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ApiKeyCreateResponseData && equalTo((ApiKeyCreateResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ApiKeyCreateResponseData other) { - return createdAt.equals(other.createdAt) - && description.equals(other.description) - && environment.equals(other.environment) - && environmentId.equals(other.environmentId) - && id.equals(other.id) - && integration.equals(other.integration) - && lastUsedAt.equals(other.lastUsedAt) - && name.equals(other.name) - && rateLimitPercent.equals(other.rateLimitPercent) - && readonly == other.readonly - && scopes.equals(other.scopes) - && secret.equals(other.secret) - && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.createdAt, - this.description, - this.environment, - this.environmentId, - this.id, - this.integration, - this.lastUsedAt, - this.name, - this.rateLimitPercent, - this.readonly, - this.scopes, - this.secret, - 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(ApiKeyCreateResponseData other); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - ReadonlyStage name(@NotNull String name); - } - - public interface ReadonlyStage { - SecretStage readonly(boolean readonly); - } - - public interface SecretStage { - UpdatedAtStage secret(@NotNull String secret); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - ApiKeyCreateResponseData build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage description(Optional description); - - _FinalStage description(String description); - - _FinalStage environment(Optional environment); - - _FinalStage environment(EnvironmentResponseData environment); - - _FinalStage environmentId(Optional environmentId); - - _FinalStage environmentId(String environmentId); - - _FinalStage integration(Optional integration); - - _FinalStage integration(ApiKeyIntegrationResponseData integration); - - _FinalStage lastUsedAt(Optional lastUsedAt); - - _FinalStage lastUsedAt(OffsetDateTime lastUsedAt); - - _FinalStage rateLimitPercent(Optional rateLimitPercent); - - _FinalStage rateLimitPercent(Long rateLimitPercent); - - _FinalStage scopes(List scopes); - - _FinalStage addScopes(ApiKeyScope scopes); - - _FinalStage addAllScopes(List scopes); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements CreatedAtStage, IdStage, NameStage, ReadonlyStage, SecretStage, UpdatedAtStage, _FinalStage { - private OffsetDateTime createdAt; - - private String id; - - private String name; - - private boolean readonly; - - private String secret; - - private OffsetDateTime updatedAt; - - private List scopes = new ArrayList<>(); - - private Optional rateLimitPercent = Optional.empty(); - - private Optional lastUsedAt = Optional.empty(); - - private Optional integration = Optional.empty(); - - private Optional environmentId = Optional.empty(); - - private Optional environment = Optional.empty(); - - private Optional description = Optional.empty(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ApiKeyCreateResponseData other) { - createdAt(other.getCreatedAt()); - description(other.getDescription()); - environment(other.getEnvironment()); - environmentId(other.getEnvironmentId()); - id(other.getId()); - integration(other.getIntegration()); - lastUsedAt(other.getLastUsedAt()); - name(other.getName()); - rateLimitPercent(other.getRateLimitPercent()); - readonly(other.getReadonly()); - scopes(other.getScopes()); - secret(other.getSecret()); - 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 NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public ReadonlyStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("readonly") - public SecretStage readonly(boolean readonly) { - this.readonly = readonly; - return this; - } - - @java.lang.Override - @JsonSetter("secret") - public UpdatedAtStage secret(@NotNull String secret) { - this.secret = Objects.requireNonNull(secret, "secret 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 addAllScopes(List scopes) { - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - @java.lang.Override - public _FinalStage addScopes(ApiKeyScope scopes) { - this.scopes.add(scopes); - return this; - } - - @java.lang.Override - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public _FinalStage scopes(List scopes) { - this.scopes.clear(); - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - @java.lang.Override - public _FinalStage rateLimitPercent(Long rateLimitPercent) { - this.rateLimitPercent = Optional.ofNullable(rateLimitPercent); - return this; - } - - @java.lang.Override - @JsonSetter(value = "rate_limit_percent", nulls = Nulls.SKIP) - public _FinalStage rateLimitPercent(Optional rateLimitPercent) { - this.rateLimitPercent = rateLimitPercent; - return this; - } - - @java.lang.Override - public _FinalStage lastUsedAt(OffsetDateTime lastUsedAt) { - this.lastUsedAt = Optional.ofNullable(lastUsedAt); - return this; - } - - @java.lang.Override - @JsonSetter(value = "last_used_at", nulls = Nulls.SKIP) - public _FinalStage lastUsedAt(Optional lastUsedAt) { - this.lastUsedAt = lastUsedAt; - return this; - } - - @java.lang.Override - public _FinalStage integration(ApiKeyIntegrationResponseData integration) { - this.integration = Optional.ofNullable(integration); - return this; - } - - @java.lang.Override - @JsonSetter(value = "integration", nulls = Nulls.SKIP) - public _FinalStage integration(Optional integration) { - this.integration = integration; - return this; - } - - @java.lang.Override - public _FinalStage environmentId(String environmentId) { - this.environmentId = Optional.ofNullable(environmentId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) - public _FinalStage environmentId(Optional environmentId) { - this.environmentId = environmentId; - return this; - } - - @java.lang.Override - public _FinalStage environment(EnvironmentResponseData environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @java.lang.Override - @JsonSetter(value = "environment", nulls = Nulls.SKIP) - public _FinalStage environment(Optional environment) { - this.environment = environment; - return this; - } - - @java.lang.Override - public _FinalStage description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - @java.lang.Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - @java.lang.Override - public ApiKeyCreateResponseData build() { - return new ApiKeyCreateResponseData( - createdAt, - description, - environment, - environmentId, - id, - integration, - lastUsedAt, - name, - rateLimitPercent, - readonly, - scopes, - secret, - updatedAt, - additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("created_at") - || key.equalsIgnoreCase("description") - || key.equalsIgnoreCase("environment") - || key.equalsIgnoreCase("environment_id") - || key.equalsIgnoreCase("id") - || key.equalsIgnoreCase("integration") - || key.equalsIgnoreCase("last_used_at") - || key.equalsIgnoreCase("name") - || key.equalsIgnoreCase("rate_limit_percent") - || key.equalsIgnoreCase("readonly") - || key.equalsIgnoreCase("scopes") - || key.equalsIgnoreCase("secret") - || key.equalsIgnoreCase("updated_at")) { - return; - } - this.additionalProperties.put(key, value); - } - - @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/BillingInvoiceAddressResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceAddressResponseData.java new file mode 100644 index 00000000..91eeb9f9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingInvoiceAddressResponseData.java @@ -0,0 +1,254 @@ +/** + * 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 = BillingInvoiceAddressResponseData.Builder.class) +public final class BillingInvoiceAddressResponseData { + private final String city; + + private final String country; + + private final String line1; + + private final String line2; + + private final String postalCode; + + private final String state; + + private final Map additionalProperties; + + private BillingInvoiceAddressResponseData( + String city, + String country, + String line1, + String line2, + String postalCode, + String state, + Map additionalProperties) { + this.city = city; + this.country = country; + this.line1 = line1; + this.line2 = line2; + this.postalCode = postalCode; + this.state = state; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("city") + public String getCity() { + return city; + } + + @JsonProperty("country") + public String getCountry() { + return country; + } + + @JsonProperty("line1") + public String getLine1() { + return line1; + } + + @JsonProperty("line2") + public String getLine2() { + return line2; + } + + @JsonProperty("postal_code") + public String getPostalCode() { + return postalCode; + } + + @JsonProperty("state") + public String getState() { + return state; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingInvoiceAddressResponseData && equalTo((BillingInvoiceAddressResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingInvoiceAddressResponseData other) { + return city.equals(other.city) + && country.equals(other.country) + && line1.equals(other.line1) + && line2.equals(other.line2) + && postalCode.equals(other.postalCode) + && state.equals(other.state); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.city, this.country, this.line1, this.line2, this.postalCode, this.state); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CityStage builder() { + return new Builder(); + } + + public interface CityStage { + CountryStage city(@NotNull String city); + + Builder from(BillingInvoiceAddressResponseData other); + } + + public interface CountryStage { + Line1Stage country(@NotNull String country); + } + + public interface Line1Stage { + Line2Stage line1(@NotNull String line1); + } + + public interface Line2Stage { + PostalCodeStage line2(@NotNull String line2); + } + + public interface PostalCodeStage { + StateStage postalCode(@NotNull String postalCode); + } + + public interface StateStage { + _FinalStage state(@NotNull String state); + } + + public interface _FinalStage { + BillingInvoiceAddressResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CityStage, CountryStage, Line1Stage, Line2Stage, PostalCodeStage, StateStage, _FinalStage { + private String city; + + private String country; + + private String line1; + + private String line2; + + private String postalCode; + + private String state; + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingInvoiceAddressResponseData other) { + city(other.getCity()); + country(other.getCountry()); + line1(other.getLine1()); + line2(other.getLine2()); + postalCode(other.getPostalCode()); + state(other.getState()); + return this; + } + + @java.lang.Override + @JsonSetter("city") + public CountryStage city(@NotNull String city) { + this.city = Objects.requireNonNull(city, "city must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("country") + public Line1Stage country(@NotNull String country) { + this.country = Objects.requireNonNull(country, "country must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("line1") + public Line2Stage line1(@NotNull String line1) { + this.line1 = Objects.requireNonNull(line1, "line1 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("line2") + public PostalCodeStage line2(@NotNull String line2) { + this.line2 = Objects.requireNonNull(line2, "line2 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("postal_code") + public StateStage postalCode(@NotNull String postalCode) { + this.postalCode = Objects.requireNonNull(postalCode, "postalCode must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("state") + public _FinalStage state(@NotNull String state) { + this.state = Objects.requireNonNull(state, "state must not be null"); + return this; + } + + @java.lang.Override + public BillingInvoiceAddressResponseData build() { + return new BillingInvoiceAddressResponseData( + city, country, line1, line2, postalCode, state, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("city") + || key.equalsIgnoreCase("country") + || key.equalsIgnoreCase("line1") + || key.equalsIgnoreCase("line2") + || key.equalsIgnoreCase("postal_code") + || key.equalsIgnoreCase("state")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/BillingInvoiceBillingDetailsResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceBillingDetailsResponseData.java new file mode 100644 index 00000000..4624e4e5 --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingInvoiceBillingDetailsResponseData.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BillingInvoiceBillingDetailsResponseData.Builder.class) +public final class BillingInvoiceBillingDetailsResponseData { + private final Optional address; + + private final Optional email; + + private final Optional phone; + + private final List taxIds; + + private final Map additionalProperties; + + private BillingInvoiceBillingDetailsResponseData( + Optional address, + Optional email, + Optional phone, + List taxIds, + Map additionalProperties) { + this.address = address; + this.email = email; + this.phone = phone; + this.taxIds = taxIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + @JsonProperty("tax_ids") + public List getTaxIds() { + return taxIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingInvoiceBillingDetailsResponseData + && equalTo((BillingInvoiceBillingDetailsResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingInvoiceBillingDetailsResponseData other) { + return address.equals(other.address) + && email.equals(other.email) + && phone.equals(other.phone) + && taxIds.equals(other.taxIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.email, this.phone, this.taxIds); + } + + @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 address = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional phone = Optional.empty(); + + private List taxIds = new ArrayList<>(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BillingInvoiceBillingDetailsResponseData other) { + address(other.getAddress()); + email(other.getEmail()); + phone(other.getPhone()); + taxIds(other.getTaxIds()); + return this; + } + + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(BillingInvoiceAddressResponseData address) { + this.address = Optional.ofNullable(address); + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + @JsonSetter(value = "tax_ids", nulls = Nulls.SKIP) + public Builder taxIds(List taxIds) { + this.taxIds.clear(); + if (taxIds != null) { + this.taxIds.addAll(taxIds); + } + return this; + } + + public Builder addTaxIds(BillingInvoiceTaxIdResponseData taxIds) { + this.taxIds.add(taxIds); + return this; + } + + public Builder addAllTaxIds(List taxIds) { + if (taxIds != null) { + this.taxIds.addAll(taxIds); + } + return this; + } + + public BillingInvoiceBillingDetailsResponseData build() { + return new BillingInvoiceBillingDetailsResponseData(address, email, phone, taxIds, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("address") + || key.equalsIgnoreCase("email") + || key.equalsIgnoreCase("phone") + || key.equalsIgnoreCase("tax_ids")) { + return; + } + this.additionalProperties.put(key, value); + } + + 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/BillingInvoiceDetailResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceDetailResponseData.java index da54d347..150b46c8 100644 --- a/src/main/java/com/schematic/api/types/BillingInvoiceDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingInvoiceDetailResponseData.java @@ -34,16 +34,20 @@ public final class BillingInvoiceDetailResponseData { private final String companyId; - private final String contractId; + private final Optional contractId; private final OffsetDateTime createdAt; private final Currency currency; - private final InvoiceDocumentState documentState; + private final long discount; + + private final Optional documentState; private final Optional dueAt; + private final Optional externalId; + private final Optional finalizedAt; private final String id; @@ -52,20 +56,32 @@ public final class BillingInvoiceDetailResponseData { private final Optional number; - private final OffsetDateTime periodEnd; + private final Optional pdfUrl; + + private final Optional periodEnd; + + private final Optional periodStart; - private final OffsetDateTime periodStart; + private final BillingProviderType providerType; private final List settlements; private final InvoiceStatus status; + private final Optional subscriptionExternalId; + + private final Optional subscriptionId; + private final long subtotal; + private final long tax; + private final Optional terms; private final long total; + private final Optional url; + private final Map additionalProperties; private BillingInvoiceDetailResponseData( @@ -74,22 +90,30 @@ private BillingInvoiceDetailResponseData( Optional collectionState, Optional collector, String companyId, - String contractId, + Optional contractId, OffsetDateTime createdAt, Currency currency, - InvoiceDocumentState documentState, + long discount, + Optional documentState, Optional dueAt, + Optional externalId, Optional finalizedAt, String id, List lines, Optional number, - OffsetDateTime periodEnd, - OffsetDateTime periodStart, + Optional pdfUrl, + Optional periodEnd, + Optional periodStart, + BillingProviderType providerType, List settlements, InvoiceStatus status, + Optional subscriptionExternalId, + Optional subscriptionId, long subtotal, + long tax, Optional terms, long total, + Optional url, Map additionalProperties) { this.amountPaid = amountPaid; this.amountRemaining = amountRemaining; @@ -99,19 +123,27 @@ private BillingInvoiceDetailResponseData( this.contractId = contractId; this.createdAt = createdAt; this.currency = currency; + this.discount = discount; this.documentState = documentState; this.dueAt = dueAt; + this.externalId = externalId; this.finalizedAt = finalizedAt; this.id = id; this.lines = lines; this.number = number; + this.pdfUrl = pdfUrl; this.periodEnd = periodEnd; this.periodStart = periodStart; + this.providerType = providerType; this.settlements = settlements; this.status = status; + this.subscriptionExternalId = subscriptionExternalId; + this.subscriptionId = subscriptionId; this.subtotal = subtotal; + this.tax = tax; this.terms = terms; this.total = total; + this.url = url; this.additionalProperties = additionalProperties; } @@ -126,7 +158,7 @@ public long getAmountRemaining() { } /** - * @return The collector's report on payment. Null on a draft. + * @return The collector's report on payment. Null on a draft and on a Stripe invoice. */ @JsonProperty("collection_state") public Optional getCollectionState() { @@ -143,8 +175,11 @@ public String getCompanyId() { return companyId; } + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("contract_id") - public String getContractId() { + public Optional getContractId() { return contractId; } @@ -158,8 +193,19 @@ public Currency getCurrency() { return currency; } + /** + * @return What discounts took off the subtotal, in minor units of the invoice's currency. Zero on an invoice Schematic issued. + */ + @JsonProperty("discount") + public long getDiscount() { + return discount; + } + + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("document_state") - public InvoiceDocumentState getDocumentState() { + public Optional getDocumentState() { return documentState; } @@ -168,6 +214,14 @@ public Optional getDueAt() { return dueAt; } + /** + * @return The billing provider's invoice ID. Null on an invoice Schematic issued. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + @JsonProperty("finalized_at") public Optional getFinalizedAt() { return finalizedAt; @@ -188,16 +242,35 @@ public Optional getNumber() { return number; } + /** + * @return The billing provider's PDF of the invoice. Null on an invoice Schematic issued, which downloads its PDF from this API. + */ + @JsonProperty("pdf_url") + public Optional getPdfUrl() { + return pdfUrl; + } + + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("period_end") - public OffsetDateTime getPeriodEnd() { + public Optional getPeriodEnd() { return periodEnd; } + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("period_start") - public OffsetDateTime getPeriodStart() { + public Optional getPeriodStart() { return periodStart; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("settlements") public List getSettlements() { return settlements; @@ -208,13 +281,37 @@ public InvoiceStatus getStatus() { return status; } + /** + * @return The billing provider's subscription ID. Null on an invoice Schematic issued. + */ + @JsonProperty("subscription_external_id") + public Optional getSubscriptionExternalId() { + return subscriptionExternalId; + } + + /** + * @return The Schematic subscription the invoice's lines bill for. Null on a Stripe invoice, which links its subscription through subscription_external_id. + */ + @JsonProperty("subscription_id") + public Optional getSubscriptionId() { + return subscriptionId; + } + @JsonProperty("subtotal") public long getSubtotal() { return subtotal; } /** - * @return The contract's terms, copied when the invoice was finalized. Null on a draft. + * @return In minor units of the invoice's currency. + */ + @JsonProperty("tax") + public long getTax() { + return tax; + } + + /** + * @return The contract's terms, copied when the invoice was finalized. Null on a draft and on a Stripe invoice. */ @JsonProperty("terms") public Optional getTerms() { @@ -226,6 +323,14 @@ public long getTotal() { return total; } + /** + * @return The billing provider's hosted invoice page. Null on an invoice Schematic issued. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -246,19 +351,27 @@ private boolean equalTo(BillingInvoiceDetailResponseData other) { && contractId.equals(other.contractId) && createdAt.equals(other.createdAt) && currency.equals(other.currency) + && discount == other.discount && documentState.equals(other.documentState) && dueAt.equals(other.dueAt) + && externalId.equals(other.externalId) && finalizedAt.equals(other.finalizedAt) && id.equals(other.id) && lines.equals(other.lines) && number.equals(other.number) + && pdfUrl.equals(other.pdfUrl) && periodEnd.equals(other.periodEnd) && periodStart.equals(other.periodStart) + && providerType.equals(other.providerType) && settlements.equals(other.settlements) && status.equals(other.status) + && subscriptionExternalId.equals(other.subscriptionExternalId) + && subscriptionId.equals(other.subscriptionId) && subtotal == other.subtotal + && tax == other.tax && terms.equals(other.terms) - && total == other.total; + && total == other.total + && url.equals(other.url); } @java.lang.Override @@ -272,19 +385,27 @@ public int hashCode() { this.contractId, this.createdAt, this.currency, + this.discount, this.documentState, this.dueAt, + this.externalId, this.finalizedAt, this.id, this.lines, this.number, + this.pdfUrl, this.periodEnd, this.periodStart, + this.providerType, this.settlements, this.status, + this.subscriptionExternalId, + this.subscriptionId, this.subtotal, + this.tax, this.terms, - this.total); + this.total, + this.url); } @java.lang.Override @@ -307,11 +428,7 @@ public interface AmountRemainingStage { } public interface CompanyIdStage { - ContractIdStage companyId(@NotNull String companyId); - } - - public interface ContractIdStage { - CreatedAtStage contractId(@NotNull String contractId); + CreatedAtStage companyId(@NotNull String companyId); } public interface CreatedAtStage { @@ -319,23 +436,22 @@ public interface CreatedAtStage { } public interface CurrencyStage { - DocumentStateStage currency(@NotNull Currency currency); + DiscountStage currency(@NotNull Currency currency); } - public interface DocumentStateStage { - IdStage documentState(@NotNull InvoiceDocumentState documentState); + public interface DiscountStage { + /** + *

What discounts took off the subtotal, in minor units of the invoice's currency. Zero on an invoice Schematic issued.

+ */ + IdStage discount(long discount); } public interface IdStage { - PeriodEndStage id(@NotNull String id); - } - - public interface PeriodEndStage { - PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd); + ProviderTypeStage id(@NotNull String id); } - public interface PeriodStartStage { - StatusStage periodStart(@NotNull OffsetDateTime periodStart); + public interface ProviderTypeStage { + StatusStage providerType(@NotNull BillingProviderType providerType); } public interface StatusStage { @@ -343,7 +459,14 @@ public interface StatusStage { } public interface SubtotalStage { - TotalStage subtotal(long subtotal); + TaxStage subtotal(long subtotal); + } + + public interface TaxStage { + /** + *

In minor units of the invoice's currency.

+ */ + TotalStage tax(long tax); } public interface TotalStage { @@ -358,7 +481,7 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); /** - *

The collector's report on payment. Null on a draft.

+ *

The collector's report on payment. Null on a draft and on a Stripe invoice.

*/ _FinalStage collectionState(Optional collectionState); @@ -368,10 +491,31 @@ public interface _FinalStage { _FinalStage collector(Collector collector); + /** + *

Null on a Stripe invoice.

+ */ + _FinalStage contractId(Optional contractId); + + _FinalStage contractId(String contractId); + + /** + *

Null on a Stripe invoice.

+ */ + _FinalStage documentState(Optional documentState); + + _FinalStage documentState(InvoiceDocumentState documentState); + _FinalStage dueAt(Optional dueAt); _FinalStage dueAt(OffsetDateTime dueAt); + /** + *

The billing provider's invoice ID. Null on an invoice Schematic issued.

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + _FinalStage finalizedAt(Optional finalizedAt); _FinalStage finalizedAt(OffsetDateTime finalizedAt); @@ -386,6 +530,27 @@ public interface _FinalStage { _FinalStage number(String number); + /** + *

The billing provider's PDF of the invoice. Null on an invoice Schematic issued, which downloads its PDF from this API.

+ */ + _FinalStage pdfUrl(Optional pdfUrl); + + _FinalStage pdfUrl(String pdfUrl); + + /** + *

Null on a Stripe invoice.

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

Null on a Stripe invoice.

+ */ + _FinalStage periodStart(Optional periodStart); + + _FinalStage periodStart(OffsetDateTime periodStart); + _FinalStage settlements(List settlements); _FinalStage addSettlements(BillingInvoiceSettlementResponseData settlements); @@ -393,11 +558,32 @@ public interface _FinalStage { _FinalStage addAllSettlements(List settlements); /** - *

The contract's terms, copied when the invoice was finalized. Null on a draft.

+ *

The billing provider's subscription ID. Null on an invoice Schematic issued.

+ */ + _FinalStage subscriptionExternalId(Optional subscriptionExternalId); + + _FinalStage subscriptionExternalId(String subscriptionExternalId); + + /** + *

The Schematic subscription the invoice's lines bill for. Null on a Stripe invoice, which links its subscription through subscription_external_id.

+ */ + _FinalStage subscriptionId(Optional subscriptionId); + + _FinalStage subscriptionId(String subscriptionId); + + /** + *

The contract's terms, copied when the invoice was finalized. Null on a draft and on a Stripe invoice.

*/ _FinalStage terms(Optional terms); _FinalStage terms(BillingInvoiceTermsResponseData terms); + + /** + *

The billing provider's hosted invoice page. Null on an invoice Schematic issued.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -405,15 +591,14 @@ public static final class Builder implements AmountPaidStage, AmountRemainingStage, CompanyIdStage, - ContractIdStage, CreatedAtStage, CurrencyStage, - DocumentStateStage, + DiscountStage, IdStage, - PeriodEndStage, - PeriodStartStage, + ProviderTypeStage, StatusStage, SubtotalStage, + TaxStage, TotalStage, _FinalStage { private long amountPaid; @@ -422,38 +607,54 @@ public static final class Builder private String companyId; - private String contractId; - private OffsetDateTime createdAt; private Currency currency; - private InvoiceDocumentState documentState; + private long discount; private String id; - private OffsetDateTime periodEnd; - - private OffsetDateTime periodStart; + private BillingProviderType providerType; private InvoiceStatus status; private long subtotal; + private long tax; + private long total; + private Optional url = Optional.empty(); + private Optional terms = Optional.empty(); + private Optional subscriptionId = Optional.empty(); + + private Optional subscriptionExternalId = Optional.empty(); + private List settlements = new ArrayList<>(); + private Optional periodStart = Optional.empty(); + + private Optional periodEnd = Optional.empty(); + + private Optional pdfUrl = Optional.empty(); + private Optional number = Optional.empty(); private List lines = new ArrayList<>(); private Optional finalizedAt = Optional.empty(); + private Optional externalId = Optional.empty(); + private Optional dueAt = Optional.empty(); + private Optional documentState = Optional.empty(); + + private Optional contractId = Optional.empty(); + private Optional collector = Optional.empty(); private Optional collectionState = Optional.empty(); @@ -472,19 +673,27 @@ public Builder from(BillingInvoiceDetailResponseData other) { contractId(other.getContractId()); createdAt(other.getCreatedAt()); currency(other.getCurrency()); + discount(other.getDiscount()); documentState(other.getDocumentState()); dueAt(other.getDueAt()); + externalId(other.getExternalId()); finalizedAt(other.getFinalizedAt()); id(other.getId()); lines(other.getLines()); number(other.getNumber()); + pdfUrl(other.getPdfUrl()); periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); + providerType(other.getProviderType()); settlements(other.getSettlements()); status(other.getStatus()); + subscriptionExternalId(other.getSubscriptionExternalId()); + subscriptionId(other.getSubscriptionId()); subtotal(other.getSubtotal()); + tax(other.getTax()); terms(other.getTerms()); total(other.getTotal()); + url(other.getUrl()); return this; } @@ -504,18 +713,11 @@ public CompanyIdStage amountRemaining(long amountRemaining) { @java.lang.Override @JsonSetter("company_id") - public ContractIdStage companyId(@NotNull String companyId) { + public CreatedAtStage companyId(@NotNull String companyId) { this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } - @java.lang.Override - @JsonSetter("contract_id") - public CreatedAtStage contractId(@NotNull String contractId) { - this.contractId = Objects.requireNonNull(contractId, "contractId must not be null"); - return this; - } - @java.lang.Override @JsonSetter("created_at") public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -525,36 +727,33 @@ public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("currency") - public DocumentStateStage currency(@NotNull Currency currency) { + public DiscountStage currency(@NotNull Currency currency) { this.currency = Objects.requireNonNull(currency, "currency must not be null"); return this; } + /** + *

What discounts took off the subtotal, in minor units of the invoice's currency. Zero on an invoice Schematic issued.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - @JsonSetter("document_state") - public IdStage documentState(@NotNull InvoiceDocumentState documentState) { - this.documentState = Objects.requireNonNull(documentState, "documentState must not be null"); + @JsonSetter("discount") + public IdStage discount(long discount) { + this.discount = discount; return this; } @java.lang.Override @JsonSetter("id") - public PeriodEndStage id(@NotNull String id) { + public ProviderTypeStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } @java.lang.Override - @JsonSetter("period_end") - public PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd) { - this.periodEnd = Objects.requireNonNull(periodEnd, "periodEnd must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("period_start") - public StatusStage periodStart(@NotNull OffsetDateTime periodStart) { - this.periodStart = Objects.requireNonNull(periodStart, "periodStart must not be null"); + @JsonSetter("provider_type") + public StatusStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); return this; } @@ -567,11 +766,22 @@ public SubtotalStage status(@NotNull InvoiceStatus status) { @java.lang.Override @JsonSetter("subtotal") - public TotalStage subtotal(long subtotal) { + public TaxStage subtotal(long subtotal) { this.subtotal = subtotal; return this; } + /** + *

In minor units of the invoice's currency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tax") + public TotalStage tax(long tax) { + this.tax = tax; + return this; + } + @java.lang.Override @JsonSetter("total") public _FinalStage total(long total) { @@ -580,7 +790,27 @@ public _FinalStage total(long total) { } /** - *

The contract's terms, copied when the invoice was finalized. Null on a draft.

+ *

The billing provider's hosted invoice page. Null on an invoice Schematic issued.

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

The billing provider's hosted invoice page. Null on an invoice Schematic issued.

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

The contract's terms, copied when the invoice was finalized. Null on a draft and on a Stripe invoice.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -590,7 +820,7 @@ public _FinalStage terms(BillingInvoiceTermsResponseData terms) { } /** - *

The contract's terms, copied when the invoice was finalized. Null on a draft.

+ *

The contract's terms, copied when the invoice was finalized. Null on a draft and on a Stripe invoice.

*/ @java.lang.Override @JsonSetter(value = "terms", nulls = Nulls.SKIP) @@ -599,6 +829,46 @@ public _FinalStage terms(Optional terms) { return this; } + /** + *

The Schematic subscription the invoice's lines bill for. Null on a Stripe invoice, which links its subscription through subscription_external_id.

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

The Schematic subscription the invoice's lines bill for. Null on a Stripe invoice, which links its subscription through subscription_external_id.

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

The billing provider's subscription ID. Null on an invoice Schematic issued.

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

The billing provider's subscription ID. Null on an invoice Schematic issued.

+ */ + @java.lang.Override + @JsonSetter(value = "subscription_external_id", nulls = Nulls.SKIP) + public _FinalStage subscriptionExternalId(Optional subscriptionExternalId) { + this.subscriptionExternalId = subscriptionExternalId; + return this; + } + @java.lang.Override public _FinalStage addAllSettlements(List settlements) { if (settlements != null) { @@ -623,6 +893,66 @@ public _FinalStage settlements(List settle return this; } + /** + *

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

The billing provider's PDF of the invoice. Null on an invoice Schematic issued, which downloads its PDF from this API.

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

The billing provider's PDF of the invoice. Null on an invoice Schematic issued, which downloads its PDF from this API.

+ */ + @java.lang.Override + @JsonSetter(value = "pdf_url", nulls = Nulls.SKIP) + public _FinalStage pdfUrl(Optional pdfUrl) { + this.pdfUrl = pdfUrl; + return this; + } + @java.lang.Override public _FinalStage number(String number) { this.number = Optional.ofNullable(number); @@ -673,6 +1003,26 @@ public _FinalStage finalizedAt(Optional finalizedAt) { return this; } + /** + *

The billing provider's invoice ID. Null on an invoice Schematic issued.

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

The billing provider's invoice ID. Null on an invoice Schematic issued.

+ */ + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + @java.lang.Override public _FinalStage dueAt(OffsetDateTime dueAt) { this.dueAt = Optional.ofNullable(dueAt); @@ -686,6 +1036,46 @@ public _FinalStage dueAt(Optional dueAt) { return this; } + /** + *

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "contract_id", nulls = Nulls.SKIP) + public _FinalStage contractId(Optional contractId) { + this.contractId = contractId; + return this; + } + @java.lang.Override public _FinalStage collector(Collector collector) { this.collector = Optional.ofNullable(collector); @@ -700,7 +1090,7 @@ public _FinalStage collector(Optional collector) { } /** - *

The collector's report on payment. Null on a draft.

+ *

The collector's report on payment. Null on a draft and on a Stripe invoice.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -710,7 +1100,7 @@ public _FinalStage collectionState(InvoiceCollectionState collectionState) { } /** - *

The collector's report on payment. Null on a draft.

+ *

The collector's report on payment. Null on a draft and on a Stripe invoice.

*/ @java.lang.Override @JsonSetter(value = "collection_state", nulls = Nulls.SKIP) @@ -730,19 +1120,27 @@ public BillingInvoiceDetailResponseData build() { contractId, createdAt, currency, + discount, documentState, dueAt, + externalId, finalizedAt, id, lines, number, + pdfUrl, periodEnd, periodStart, + providerType, settlements, status, + subscriptionExternalId, + subscriptionId, subtotal, + tax, terms, total, + url, additionalProperties); } @@ -756,19 +1154,27 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("contract_id") || key.equalsIgnoreCase("created_at") || key.equalsIgnoreCase("currency") + || key.equalsIgnoreCase("discount") || key.equalsIgnoreCase("document_state") || key.equalsIgnoreCase("due_at") + || key.equalsIgnoreCase("external_id") || key.equalsIgnoreCase("finalized_at") || key.equalsIgnoreCase("id") || key.equalsIgnoreCase("lines") || key.equalsIgnoreCase("number") + || key.equalsIgnoreCase("pdf_url") || key.equalsIgnoreCase("period_end") || key.equalsIgnoreCase("period_start") + || key.equalsIgnoreCase("provider_type") || key.equalsIgnoreCase("settlements") || key.equalsIgnoreCase("status") + || key.equalsIgnoreCase("subscription_external_id") + || key.equalsIgnoreCase("subscription_id") || key.equalsIgnoreCase("subtotal") + || key.equalsIgnoreCase("tax") || key.equalsIgnoreCase("terms") - || key.equalsIgnoreCase("total")) { + || key.equalsIgnoreCase("total") + || key.equalsIgnoreCase("url")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/types/BillingInvoiceLineResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceLineResponseData.java index 8645618e..e7610b20 100644 --- a/src/main/java/com/schematic/api/types/BillingInvoiceLineResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingInvoiceLineResponseData.java @@ -28,7 +28,11 @@ public final class BillingInvoiceLineResponseData { private final List chargeIds; - private final String id; + private final Optional description; + + private final Optional externalId; + + private final Optional id; private final InvoiceLineKind kind; @@ -49,7 +53,9 @@ public final class BillingInvoiceLineResponseData { private BillingInvoiceLineResponseData( long amount, List chargeIds, - String id, + Optional description, + Optional externalId, + Optional id, InvoiceLineKind kind, Optional periodEnd, Optional periodStart, @@ -60,6 +66,8 @@ private BillingInvoiceLineResponseData( Map additionalProperties) { this.amount = amount; this.chargeIds = chargeIds; + this.description = description; + this.externalId = externalId; this.id = id; this.kind = kind; this.periodEnd = periodEnd; @@ -87,8 +95,27 @@ public List getChargeIds() { return chargeIds; } + /** + * @return What the line bills for: the product, plan, add-on or credit. Null when the line has no subscription line behind it. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The billing provider's line ID. Null on an invoice Schematic issued. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + + /** + * @return Null on a Stripe invoice line. + */ @JsonProperty("id") - public String getId() { + public Optional getId() { return id; } @@ -141,6 +168,8 @@ public Map getAdditionalProperties() { private boolean equalTo(BillingInvoiceLineResponseData other) { return amount == other.amount && chargeIds.equals(other.chargeIds) + && description.equals(other.description) + && externalId.equals(other.externalId) && id.equals(other.id) && kind.equals(other.kind) && periodEnd.equals(other.periodEnd) @@ -156,6 +185,8 @@ public int hashCode() { return Objects.hash( this.amount, this.chargeIds, + this.description, + this.externalId, this.id, this.kind, this.periodEnd, @@ -179,15 +210,11 @@ public interface AmountStage { /** *

In minor units of the invoice's currency.

*/ - IdStage amount(long amount); + KindStage amount(long amount); Builder from(BillingInvoiceLineResponseData other); } - public interface IdStage { - KindStage id(@NotNull String id); - } - public interface KindStage { TaxableStage kind(@NotNull InvoiceLineKind kind); } @@ -212,6 +239,27 @@ public interface _FinalStage { _FinalStage addAllChargeIds(List chargeIds); + /** + *

What the line bills for: the product, plan, add-on or credit. Null when the line has no subscription line behind it.

+ */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

The billing provider's line ID. Null on an invoice Schematic issued.

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + + /** + *

Null on a Stripe invoice line.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + _FinalStage periodEnd(Optional periodEnd); _FinalStage periodEnd(OffsetDateTime periodEnd); @@ -234,11 +282,9 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AmountStage, IdStage, KindStage, TaxableStage, _FinalStage { + public static final class Builder implements AmountStage, KindStage, TaxableStage, _FinalStage { private long amount; - private String id; - private InvoiceLineKind kind; private boolean taxable; @@ -253,6 +299,12 @@ public static final class Builder implements AmountStage, IdStage, KindStage, Ta private Optional periodEnd = Optional.empty(); + private Optional id = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional description = Optional.empty(); + private List chargeIds = new ArrayList<>(); private Map additionalProperties = new HashMap<>(); @@ -263,6 +315,8 @@ private Builder() {} public Builder from(BillingInvoiceLineResponseData other) { amount(other.getAmount()); chargeIds(other.getChargeIds()); + description(other.getDescription()); + externalId(other.getExternalId()); id(other.getId()); kind(other.getKind()); periodEnd(other.getPeriodEnd()); @@ -280,18 +334,11 @@ public Builder from(BillingInvoiceLineResponseData other) { */ @java.lang.Override @JsonSetter("amount") - public IdStage amount(long amount) { + public KindStage amount(long amount) { this.amount = amount; return this; } - @java.lang.Override - @JsonSetter("id") - public KindStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - @java.lang.Override @JsonSetter("kind") public TaxableStage kind(@NotNull InvoiceLineKind kind) { @@ -371,6 +418,66 @@ public _FinalStage periodEnd(Optional periodEnd) { return this; } + /** + *

Null on a Stripe invoice line.

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

Null on a Stripe invoice line.

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

The billing provider's line ID. Null on an invoice Schematic issued.

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

The billing provider's line ID. Null on an invoice Schematic issued.

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

What the line bills for: the product, plan, add-on or credit. Null when the line has no subscription line behind it.

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

What the line bills for: the product, plan, add-on or credit. Null when the line has no subscription line behind it.

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

The charges this line sums.

* @return Reference to {@code this} so that method calls can be chained together. @@ -411,6 +518,8 @@ public BillingInvoiceLineResponseData build() { return new BillingInvoiceLineResponseData( amount, chargeIds, + description, + externalId, id, kind, periodEnd, @@ -426,6 +535,8 @@ public BillingInvoiceLineResponseData build() { private void putAdditionalPropertyFromJson(String key, Object value) { if (key.equalsIgnoreCase("amount") || key.equalsIgnoreCase("charge_ids") + || key.equalsIgnoreCase("description") + || key.equalsIgnoreCase("external_id") || key.equalsIgnoreCase("id") || key.equalsIgnoreCase("kind") || key.equalsIgnoreCase("period_end") diff --git a/src/main/java/com/schematic/api/types/BillingInvoiceResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceResponseData.java index 7c4806d5..6a9859bf 100644 --- a/src/main/java/com/schematic/api/types/BillingInvoiceResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingInvoiceResponseData.java @@ -32,32 +32,40 @@ public final class BillingInvoiceResponseData { private final String companyId; - private final String contractId; + private final Optional contractId; private final OffsetDateTime createdAt; private final Currency currency; - private final InvoiceDocumentState documentState; + private final Optional documentState; private final Optional dueAt; + private final Optional externalId; + private final Optional finalizedAt; private final String id; private final Optional number; - private final OffsetDateTime periodEnd; + private final Optional periodEnd; + + private final Optional periodStart; - private final OffsetDateTime periodStart; + private final BillingProviderType providerType; private final InvoiceStatus status; + private final Optional subscriptionExternalId; + private final long subtotal; private final long total; + private final Optional url; + private final Map additionalProperties; private BillingInvoiceResponseData( @@ -66,19 +74,23 @@ private BillingInvoiceResponseData( Optional collectionState, Optional collector, String companyId, - String contractId, + Optional contractId, OffsetDateTime createdAt, Currency currency, - InvoiceDocumentState documentState, + Optional documentState, Optional dueAt, + Optional externalId, Optional finalizedAt, String id, Optional number, - OffsetDateTime periodEnd, - OffsetDateTime periodStart, + Optional periodEnd, + Optional periodStart, + BillingProviderType providerType, InvoiceStatus status, + Optional subscriptionExternalId, long subtotal, long total, + Optional url, Map additionalProperties) { this.amountPaid = amountPaid; this.amountRemaining = amountRemaining; @@ -90,14 +102,18 @@ private BillingInvoiceResponseData( this.currency = currency; this.documentState = documentState; this.dueAt = dueAt; + this.externalId = externalId; this.finalizedAt = finalizedAt; this.id = id; this.number = number; this.periodEnd = periodEnd; this.periodStart = periodStart; + this.providerType = providerType; this.status = status; + this.subscriptionExternalId = subscriptionExternalId; this.subtotal = subtotal; this.total = total; + this.url = url; this.additionalProperties = additionalProperties; } @@ -112,7 +128,7 @@ public long getAmountRemaining() { } /** - * @return The collector's report on payment. Null on a draft. + * @return The collector's report on payment. Null on a draft and on a Stripe invoice. */ @JsonProperty("collection_state") public Optional getCollectionState() { @@ -129,8 +145,11 @@ public String getCompanyId() { return companyId; } + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("contract_id") - public String getContractId() { + public Optional getContractId() { return contractId; } @@ -144,8 +163,11 @@ public Currency getCurrency() { return currency; } + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("document_state") - public InvoiceDocumentState getDocumentState() { + public Optional getDocumentState() { return documentState; } @@ -154,6 +176,14 @@ public Optional getDueAt() { return dueAt; } + /** + * @return The billing provider's invoice ID. Null on an invoice Schematic issued. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + @JsonProperty("finalized_at") public Optional getFinalizedAt() { return finalizedAt; @@ -169,21 +199,40 @@ public Optional getNumber() { return number; } + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("period_end") - public OffsetDateTime getPeriodEnd() { + public Optional getPeriodEnd() { return periodEnd; } + /** + * @return Null on a Stripe invoice. + */ @JsonProperty("period_start") - public OffsetDateTime getPeriodStart() { + public Optional getPeriodStart() { return periodStart; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("status") public InvoiceStatus getStatus() { return status; } + /** + * @return The billing provider's subscription ID. Null on an invoice Schematic issued. + */ + @JsonProperty("subscription_external_id") + public Optional getSubscriptionExternalId() { + return subscriptionExternalId; + } + @JsonProperty("subtotal") public long getSubtotal() { return subtotal; @@ -194,6 +243,14 @@ public long getTotal() { return total; } + /** + * @return The billing provider's hosted invoice page. Null on an invoice Schematic issued. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -216,14 +273,18 @@ private boolean equalTo(BillingInvoiceResponseData other) { && currency.equals(other.currency) && documentState.equals(other.documentState) && dueAt.equals(other.dueAt) + && externalId.equals(other.externalId) && finalizedAt.equals(other.finalizedAt) && id.equals(other.id) && number.equals(other.number) && periodEnd.equals(other.periodEnd) && periodStart.equals(other.periodStart) + && providerType.equals(other.providerType) && status.equals(other.status) + && subscriptionExternalId.equals(other.subscriptionExternalId) && subtotal == other.subtotal - && total == other.total; + && total == other.total + && url.equals(other.url); } @java.lang.Override @@ -239,14 +300,18 @@ public int hashCode() { this.currency, this.documentState, this.dueAt, + this.externalId, this.finalizedAt, this.id, this.number, this.periodEnd, this.periodStart, + this.providerType, this.status, + this.subscriptionExternalId, this.subtotal, - this.total); + this.total, + this.url); } @java.lang.Override @@ -269,11 +334,7 @@ public interface AmountRemainingStage { } public interface CompanyIdStage { - ContractIdStage companyId(@NotNull String companyId); - } - - public interface ContractIdStage { - CreatedAtStage contractId(@NotNull String contractId); + CreatedAtStage companyId(@NotNull String companyId); } public interface CreatedAtStage { @@ -281,23 +342,15 @@ public interface CreatedAtStage { } public interface CurrencyStage { - DocumentStateStage currency(@NotNull Currency currency); - } - - public interface DocumentStateStage { - IdStage documentState(@NotNull InvoiceDocumentState documentState); + IdStage currency(@NotNull Currency currency); } public interface IdStage { - PeriodEndStage id(@NotNull String id); + ProviderTypeStage id(@NotNull String id); } - public interface PeriodEndStage { - PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd); - } - - public interface PeriodStartStage { - StatusStage periodStart(@NotNull OffsetDateTime periodStart); + public interface ProviderTypeStage { + StatusStage providerType(@NotNull BillingProviderType providerType); } public interface StatusStage { @@ -320,7 +373,7 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); /** - *

The collector's report on payment. Null on a draft.

+ *

The collector's report on payment. Null on a draft and on a Stripe invoice.

*/ _FinalStage collectionState(Optional collectionState); @@ -330,10 +383,31 @@ public interface _FinalStage { _FinalStage collector(Collector collector); + /** + *

Null on a Stripe invoice.

+ */ + _FinalStage contractId(Optional contractId); + + _FinalStage contractId(String contractId); + + /** + *

Null on a Stripe invoice.

+ */ + _FinalStage documentState(Optional documentState); + + _FinalStage documentState(InvoiceDocumentState documentState); + _FinalStage dueAt(Optional dueAt); _FinalStage dueAt(OffsetDateTime dueAt); + /** + *

The billing provider's invoice ID. Null on an invoice Schematic issued.

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + _FinalStage finalizedAt(Optional finalizedAt); _FinalStage finalizedAt(OffsetDateTime finalizedAt); @@ -341,6 +415,34 @@ public interface _FinalStage { _FinalStage number(Optional number); _FinalStage number(String number); + + /** + *

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

The billing provider's subscription ID. Null on an invoice Schematic issued.

+ */ + _FinalStage subscriptionExternalId(Optional subscriptionExternalId); + + _FinalStage subscriptionExternalId(String subscriptionExternalId); + + /** + *

The billing provider's hosted invoice page. Null on an invoice Schematic issued.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -348,13 +450,10 @@ public static final class Builder implements AmountPaidStage, AmountRemainingStage, CompanyIdStage, - ContractIdStage, CreatedAtStage, CurrencyStage, - DocumentStateStage, IdStage, - PeriodEndStage, - PeriodStartStage, + ProviderTypeStage, StatusStage, SubtotalStage, TotalStage, @@ -365,19 +464,13 @@ public static final class Builder private String companyId; - private String contractId; - private OffsetDateTime createdAt; private Currency currency; - private InvoiceDocumentState documentState; - private String id; - private OffsetDateTime periodEnd; - - private OffsetDateTime periodStart; + private BillingProviderType providerType; private InvoiceStatus status; @@ -385,12 +478,26 @@ public static final class Builder private long total; + private Optional url = Optional.empty(); + + private Optional subscriptionExternalId = Optional.empty(); + + private Optional periodStart = Optional.empty(); + + private Optional periodEnd = Optional.empty(); + private Optional number = Optional.empty(); private Optional finalizedAt = Optional.empty(); + private Optional externalId = Optional.empty(); + private Optional dueAt = Optional.empty(); + private Optional documentState = Optional.empty(); + + private Optional contractId = Optional.empty(); + private Optional collector = Optional.empty(); private Optional collectionState = Optional.empty(); @@ -411,14 +518,18 @@ public Builder from(BillingInvoiceResponseData other) { currency(other.getCurrency()); documentState(other.getDocumentState()); dueAt(other.getDueAt()); + externalId(other.getExternalId()); finalizedAt(other.getFinalizedAt()); id(other.getId()); number(other.getNumber()); periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); + providerType(other.getProviderType()); status(other.getStatus()); + subscriptionExternalId(other.getSubscriptionExternalId()); subtotal(other.getSubtotal()); total(other.getTotal()); + url(other.getUrl()); return this; } @@ -438,18 +549,11 @@ public CompanyIdStage amountRemaining(long amountRemaining) { @java.lang.Override @JsonSetter("company_id") - public ContractIdStage companyId(@NotNull String companyId) { + public CreatedAtStage companyId(@NotNull String companyId) { this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); return this; } - @java.lang.Override - @JsonSetter("contract_id") - public CreatedAtStage contractId(@NotNull String contractId) { - this.contractId = Objects.requireNonNull(contractId, "contractId must not be null"); - return this; - } - @java.lang.Override @JsonSetter("created_at") public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -459,36 +563,22 @@ public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("currency") - public DocumentStateStage currency(@NotNull Currency currency) { + public IdStage currency(@NotNull Currency currency) { this.currency = Objects.requireNonNull(currency, "currency must not be null"); return this; } - @java.lang.Override - @JsonSetter("document_state") - public IdStage documentState(@NotNull InvoiceDocumentState documentState) { - this.documentState = Objects.requireNonNull(documentState, "documentState must not be null"); - return this; - } - @java.lang.Override @JsonSetter("id") - public PeriodEndStage id(@NotNull String id) { + public ProviderTypeStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } @java.lang.Override - @JsonSetter("period_end") - public PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd) { - this.periodEnd = Objects.requireNonNull(periodEnd, "periodEnd must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("period_start") - public StatusStage periodStart(@NotNull OffsetDateTime periodStart) { - this.periodStart = Objects.requireNonNull(periodStart, "periodStart must not be null"); + @JsonSetter("provider_type") + public StatusStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); return this; } @@ -513,6 +603,86 @@ public _FinalStage total(long total) { return this; } + /** + *

The billing provider's hosted invoice page. Null on an invoice Schematic issued.

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

The billing provider's hosted invoice page. Null on an invoice Schematic issued.

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

The billing provider's subscription ID. Null on an invoice Schematic issued.

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

The billing provider's subscription ID. Null on an invoice Schematic issued.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "period_end", nulls = Nulls.SKIP) + public _FinalStage periodEnd(Optional periodEnd) { + this.periodEnd = periodEnd; + return this; + } + @java.lang.Override public _FinalStage number(String number) { this.number = Optional.ofNullable(number); @@ -539,6 +709,26 @@ public _FinalStage finalizedAt(Optional finalizedAt) { return this; } + /** + *

The billing provider's invoice ID. Null on an invoice Schematic issued.

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

The billing provider's invoice ID. Null on an invoice Schematic issued.

+ */ + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + @java.lang.Override public _FinalStage dueAt(OffsetDateTime dueAt) { this.dueAt = Optional.ofNullable(dueAt); @@ -552,6 +742,46 @@ public _FinalStage dueAt(Optional dueAt) { return this; } + /** + *

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

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

Null on a Stripe invoice.

+ */ + @java.lang.Override + @JsonSetter(value = "contract_id", nulls = Nulls.SKIP) + public _FinalStage contractId(Optional contractId) { + this.contractId = contractId; + return this; + } + @java.lang.Override public _FinalStage collector(Collector collector) { this.collector = Optional.ofNullable(collector); @@ -566,7 +796,7 @@ public _FinalStage collector(Optional collector) { } /** - *

The collector's report on payment. Null on a draft.

+ *

The collector's report on payment. Null on a draft and on a Stripe invoice.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -576,7 +806,7 @@ public _FinalStage collectionState(InvoiceCollectionState collectionState) { } /** - *

The collector's report on payment. Null on a draft.

+ *

The collector's report on payment. Null on a draft and on a Stripe invoice.

*/ @java.lang.Override @JsonSetter(value = "collection_state", nulls = Nulls.SKIP) @@ -598,14 +828,18 @@ public BillingInvoiceResponseData build() { currency, documentState, dueAt, + externalId, finalizedAt, id, number, periodEnd, periodStart, + providerType, status, + subscriptionExternalId, subtotal, total, + url, additionalProperties); } @@ -621,14 +855,18 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("currency") || key.equalsIgnoreCase("document_state") || key.equalsIgnoreCase("due_at") + || key.equalsIgnoreCase("external_id") || key.equalsIgnoreCase("finalized_at") || key.equalsIgnoreCase("id") || key.equalsIgnoreCase("number") || key.equalsIgnoreCase("period_end") || key.equalsIgnoreCase("period_start") + || key.equalsIgnoreCase("provider_type") || key.equalsIgnoreCase("status") + || key.equalsIgnoreCase("subscription_external_id") || key.equalsIgnoreCase("subtotal") - || key.equalsIgnoreCase("total")) { + || key.equalsIgnoreCase("total") + || key.equalsIgnoreCase("url")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/types/BillingInvoiceSettlementResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceSettlementResponseData.java index a889fc10..0ecde280 100644 --- a/src/main/java/com/schematic/api/types/BillingInvoiceSettlementResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingInvoiceSettlementResponseData.java @@ -26,7 +26,7 @@ public final class BillingInvoiceSettlementResponseData { private final Collector collector; - private final String id; + private final Optional id; private final Optional reference; @@ -37,7 +37,7 @@ public final class BillingInvoiceSettlementResponseData { private BillingInvoiceSettlementResponseData( long amount, Collector collector, - String id, + Optional id, Optional reference, OffsetDateTime settledAt, Map additionalProperties) { @@ -59,8 +59,11 @@ public Collector getCollector() { return collector; } + /** + * @return Null on a payment Stripe recorded. + */ @JsonProperty("id") - public String getId() { + public Optional getId() { return id; } @@ -115,11 +118,7 @@ public interface AmountStage { } public interface CollectorStage { - IdStage collector(@NotNull Collector collector); - } - - public interface IdStage { - SettledAtStage id(@NotNull String id); + SettledAtStage collector(@NotNull Collector collector); } public interface SettledAtStage { @@ -133,23 +132,30 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

Null on a payment Stripe recorded.

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + _FinalStage reference(Optional reference); _FinalStage reference(String reference); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AmountStage, CollectorStage, IdStage, SettledAtStage, _FinalStage { + public static final class Builder implements AmountStage, CollectorStage, SettledAtStage, _FinalStage { private long amount; private Collector collector; - private String id; - private OffsetDateTime settledAt; private Optional reference = Optional.empty(); + private Optional id = Optional.empty(); + private Map additionalProperties = new HashMap<>(); private Builder() {} @@ -173,18 +179,11 @@ public CollectorStage amount(long amount) { @java.lang.Override @JsonSetter("collector") - public IdStage collector(@NotNull Collector collector) { + public SettledAtStage collector(@NotNull Collector collector) { this.collector = Objects.requireNonNull(collector, "collector must not be null"); return this; } - @java.lang.Override - @JsonSetter("id") - public SettledAtStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - @java.lang.Override @JsonSetter("settled_at") public _FinalStage settledAt(@NotNull OffsetDateTime settledAt) { @@ -205,6 +204,26 @@ public _FinalStage reference(Optional reference) { return this; } + /** + *

Null on a payment Stripe recorded.

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

Null on a payment Stripe recorded.

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + @java.lang.Override public BillingInvoiceSettlementResponseData build() { return new BillingInvoiceSettlementResponseData( diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java b/src/main/java/com/schematic/api/types/BillingInvoiceTaxIdResponseData.java similarity index 51% rename from src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java rename to src/main/java/com/schematic/api/types/BillingInvoiceTaxIdResponseData.java index d229f323..b071cc4b 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java +++ b/src/main/java/com/schematic/api/types/BillingInvoiceTaxIdResponseData.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.requests; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -11,42 +11,40 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.EnvironmentType; import java.util.HashMap; import java.util.Map; import java.util.Objects; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateEnvironmentRequestBody.Builder.class) -public final class CreateEnvironmentRequestBody { - private final EnvironmentType environmentType; +@JsonDeserialize(builder = BillingInvoiceTaxIdResponseData.Builder.class) +public final class BillingInvoiceTaxIdResponseData { + private final TaxIdType type; - private final String name; + private final String value; private final Map additionalProperties; - private CreateEnvironmentRequestBody( - EnvironmentType environmentType, String name, Map additionalProperties) { - this.environmentType = environmentType; - this.name = name; + private BillingInvoiceTaxIdResponseData(TaxIdType type, String value, Map additionalProperties) { + this.type = type; + this.value = value; this.additionalProperties = additionalProperties; } - @JsonProperty("environment_type") - public EnvironmentType getEnvironmentType() { - return environmentType; + @JsonProperty("type") + public TaxIdType getType() { + return type; } - @JsonProperty("name") - public String getName() { - return name; + @JsonProperty("value") + public String getValue() { + return value; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CreateEnvironmentRequestBody && equalTo((CreateEnvironmentRequestBody) other); + return other instanceof BillingInvoiceTaxIdResponseData && equalTo((BillingInvoiceTaxIdResponseData) other); } @JsonAnyGetter @@ -54,13 +52,13 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CreateEnvironmentRequestBody other) { - return environmentType.equals(other.environmentType) && name.equals(other.name); + private boolean equalTo(BillingInvoiceTaxIdResponseData other) { + return type.equals(other.type) && value.equals(other.value); } @java.lang.Override public int hashCode() { - return Objects.hash(this.environmentType, this.name); + return Objects.hash(this.type, this.value); } @java.lang.Override @@ -68,22 +66,22 @@ public String toString() { return ObjectMappers.stringify(this); } - public static EnvironmentTypeStage builder() { + public static TypeStage builder() { return new Builder(); } - public interface EnvironmentTypeStage { - NameStage environmentType(@NotNull EnvironmentType environmentType); + public interface TypeStage { + ValueStage type(@NotNull TaxIdType type); - Builder from(CreateEnvironmentRequestBody other); + Builder from(BillingInvoiceTaxIdResponseData other); } - public interface NameStage { - _FinalStage name(@NotNull String name); + public interface ValueStage { + _FinalStage value(@NotNull String value); } public interface _FinalStage { - CreateEnvironmentRequestBody build(); + BillingInvoiceTaxIdResponseData build(); _FinalStage additionalProperty(String key, Object value); @@ -91,44 +89,44 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EnvironmentTypeStage, NameStage, _FinalStage { - private EnvironmentType environmentType; + public static final class Builder implements TypeStage, ValueStage, _FinalStage { + private TaxIdType type; - private String name; + private String value; private Map additionalProperties = new HashMap<>(); private Builder() {} @java.lang.Override - public Builder from(CreateEnvironmentRequestBody other) { - environmentType(other.getEnvironmentType()); - name(other.getName()); + public Builder from(BillingInvoiceTaxIdResponseData other) { + type(other.getType()); + value(other.getValue()); return this; } @java.lang.Override - @JsonSetter("environment_type") - public NameStage environmentType(@NotNull EnvironmentType environmentType) { - this.environmentType = Objects.requireNonNull(environmentType, "environmentType must not be null"); + @JsonSetter("type") + public ValueStage type(@NotNull TaxIdType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } @java.lang.Override - @JsonSetter("name") - public _FinalStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); return this; } @java.lang.Override - public CreateEnvironmentRequestBody build() { - return new CreateEnvironmentRequestBody(environmentType, name, additionalProperties); + public BillingInvoiceTaxIdResponseData build() { + return new BillingInvoiceTaxIdResponseData(type, value, additionalProperties); } @JsonAnySetter private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("environment_type") || key.equalsIgnoreCase("name")) { + if (key.equalsIgnoreCase("type") || key.equalsIgnoreCase("value")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/types/BillingInvoiceTermsResponseData.java b/src/main/java/com/schematic/api/types/BillingInvoiceTermsResponseData.java index ec61dbc5..7f4348ed 100644 --- a/src/main/java/com/schematic/api/types/BillingInvoiceTermsResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingInvoiceTermsResponseData.java @@ -21,6 +21,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingInvoiceTermsResponseData.Builder.class) public final class BillingInvoiceTermsResponseData { + private final Optional billingDetails; + private final BillingCollectionMethod collectionMethod; private final Collector collector; @@ -36,6 +38,7 @@ public final class BillingInvoiceTermsResponseData { private final Map additionalProperties; private BillingInvoiceTermsResponseData( + Optional billingDetails, BillingCollectionMethod collectionMethod, Collector collector, Optional currency, @@ -43,6 +46,7 @@ private BillingInvoiceTermsResponseData( PaymentGating paymentGating, Optional purchaseOrder, Map additionalProperties) { + this.billingDetails = billingDetails; this.collectionMethod = collectionMethod; this.collector = collector; this.currency = currency; @@ -52,6 +56,14 @@ private BillingInvoiceTermsResponseData( this.additionalProperties = additionalProperties; } + /** + * @return Who invoices are addressed to. On an invoice, these are the details copied when it was finalized. Null when the contract holds none. + */ + @JsonProperty("billing_details") + public Optional getBillingDetails() { + return billingDetails; + } + @JsonProperty("collection_method") public BillingCollectionMethod getCollectionMethod() { return collectionMethod; @@ -94,7 +106,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(BillingInvoiceTermsResponseData other) { - return collectionMethod.equals(other.collectionMethod) + return billingDetails.equals(other.billingDetails) + && collectionMethod.equals(other.collectionMethod) && collector.equals(other.collector) && currency.equals(other.currency) && daysUntilDue.equals(other.daysUntilDue) @@ -105,6 +118,7 @@ private boolean equalTo(BillingInvoiceTermsResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.billingDetails, this.collectionMethod, this.collector, this.currency, @@ -143,6 +157,13 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

Who invoices are addressed to. On an invoice, these are the details copied when it was finalized. Null when the contract holds none.

+ */ + _FinalStage billingDetails(Optional billingDetails); + + _FinalStage billingDetails(BillingInvoiceBillingDetailsResponseData billingDetails); + _FinalStage currency(Optional currency); _FinalStage currency(Currency currency); @@ -171,12 +192,15 @@ public static final class Builder private Optional currency = Optional.empty(); + private Optional billingDetails = Optional.empty(); + private Map additionalProperties = new HashMap<>(); private Builder() {} @java.lang.Override public Builder from(BillingInvoiceTermsResponseData other) { + billingDetails(other.getBillingDetails()); collectionMethod(other.getCollectionMethod()); collector(other.getCollector()); currency(other.getCurrency()); @@ -246,9 +270,30 @@ public _FinalStage currency(Optional currency) { return this; } + /** + *

Who invoices are addressed to. On an invoice, these are the details copied when it was finalized. Null when the contract holds none.

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

Who invoices are addressed to. On an invoice, these are the details copied when it was finalized. Null when the contract holds none.

+ */ + @java.lang.Override + @JsonSetter(value = "billing_details", nulls = Nulls.SKIP) + public _FinalStage billingDetails(Optional billingDetails) { + this.billingDetails = billingDetails; + return this; + } + @java.lang.Override public BillingInvoiceTermsResponseData build() { return new BillingInvoiceTermsResponseData( + billingDetails, collectionMethod, collector, currency, @@ -260,7 +305,8 @@ public BillingInvoiceTermsResponseData build() { @JsonAnySetter private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("collection_method") + if (key.equalsIgnoreCase("billing_details") + || key.equalsIgnoreCase("collection_method") || key.equalsIgnoreCase("collector") || key.equalsIgnoreCase("currency") || key.equalsIgnoreCase("days_until_due") diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index 85826d21..209186f8 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -116,6 +116,8 @@ public final class BillingPlanCreditGrantResponseData { private final OffsetDateTime updatedAt; + private final List warningTiers; + private final Map additionalProperties; private BillingPlanCreditGrantResponseData( @@ -165,6 +167,7 @@ private BillingPlanCreditGrantResponseData( Optional unitPrice, Optional unitPriceDecimal, OffsetDateTime updatedAt, + List warningTiers, Map additionalProperties) { this.arrearsAnchor = arrearsAnchor; this.arrearsCadence = arrearsCadence; @@ -212,6 +215,7 @@ private BillingPlanCreditGrantResponseData( this.unitPrice = unitPrice; this.unitPriceDecimal = unitPriceDecimal; this.updatedAt = updatedAt; + this.warningTiers = warningTiers; this.additionalProperties = additionalProperties; } @@ -514,6 +518,14 @@ public OffsetDateTime getUpdatedAt() { return updatedAt; } + /** + * @return Usage-warning thresholds, in credits remaining in the company's balance, highest first. Schematic sends a credit.usage_warning_reached webhook when the balance drops to each one. Empty when none are set. + */ + @JsonProperty("warning_tiers") + public List getWarningTiers() { + return warningTiers; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -572,7 +584,8 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && tierMode.equals(other.tierMode) && unitPrice.equals(other.unitPrice) && unitPriceDecimal.equals(other.unitPriceDecimal) - && updatedAt.equals(other.updatedAt); + && updatedAt.equals(other.updatedAt) + && warningTiers.equals(other.warningTiers); } @java.lang.Override @@ -623,7 +636,8 @@ public int hashCode() { this.tierMode, this.unitPrice, this.unitPriceDecimal, - this.updatedAt); + this.updatedAt, + this.warningTiers); } @java.lang.Override @@ -898,6 +912,15 @@ public interface _FinalStage { _FinalStage unitPriceDecimal(Optional unitPriceDecimal); _FinalStage unitPriceDecimal(String unitPriceDecimal); + + /** + *

Usage-warning thresholds, in credits remaining in the company's balance, highest first. Schematic sends a credit.usage_warning_reached webhook when the balance drops to each one. Empty when none are set.

+ */ + _FinalStage warningTiers(List warningTiers); + + _FinalStage addWarningTiers(BillingPlanCreditGrantWarningTierResponseData warningTiers); + + _FinalStage addAllWarningTiers(List warningTiers); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -954,6 +977,8 @@ public static final class Builder private OffsetDateTime updatedAt; + private List warningTiers = new ArrayList<>(); + private Optional unitPriceDecimal = Optional.empty(); private Optional unitPrice = Optional.empty(); @@ -1064,6 +1089,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { unitPrice(other.getUnitPrice()); unitPriceDecimal(other.getUnitPriceDecimal()); updatedAt(other.getUpdatedAt()); + warningTiers(other.getWarningTiers()); return this; } @@ -1228,6 +1254,41 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + /** + *

Usage-warning thresholds, in credits remaining in the company's balance, highest first. Schematic sends a credit.usage_warning_reached webhook when the balance drops to each one. Empty when none are set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllWarningTiers(List warningTiers) { + if (warningTiers != null) { + this.warningTiers.addAll(warningTiers); + } + return this; + } + + /** + *

Usage-warning thresholds, in credits remaining in the company's balance, highest first. Schematic sends a credit.usage_warning_reached webhook when the balance drops to each one. Empty when none are set.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addWarningTiers(BillingPlanCreditGrantWarningTierResponseData warningTiers) { + this.warningTiers.add(warningTiers); + return this; + } + + /** + *

Usage-warning thresholds, in credits remaining in the company's balance, highest first. Schematic sends a credit.usage_warning_reached webhook when the balance drops to each one. Empty when none are set.

+ */ + @java.lang.Override + @JsonSetter(value = "warning_tiers", nulls = Nulls.SKIP) + public _FinalStage warningTiers(List warningTiers) { + this.warningTiers.clear(); + if (warningTiers != null) { + this.warningTiers.addAll(warningTiers); + } + return this; + } + /** *

Price per credit as a decimal in the plan currency's smallest unit. Set only when billing_mode is billed and the rate is below one cent.

* @return Reference to {@code this} so that method calls can be chained together. @@ -1760,6 +1821,7 @@ public BillingPlanCreditGrantResponseData build() { unitPrice, unitPriceDecimal, updatedAt, + warningTiers, additionalProperties); } @@ -1810,7 +1872,8 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("tier_mode") || key.equalsIgnoreCase("unit_price") || key.equalsIgnoreCase("unit_price_decimal") - || key.equalsIgnoreCase("updated_at")) { + || key.equalsIgnoreCase("updated_at") + || key.equalsIgnoreCase("warning_tiers")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantWarningTierResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantWarningTierResponseData.java new file mode 100644 index 00000000..bd210d42 --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantWarningTierResponseData.java @@ -0,0 +1,181 @@ +/** + * 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 = BillingPlanCreditGrantWarningTierResponseData.Builder.class) +public final class BillingPlanCreditGrantWarningTierResponseData { + private final String id; + + private final String key; + + private final long value; + + private final Map additionalProperties; + + private BillingPlanCreditGrantWarningTierResponseData( + String id, String key, long value, Map additionalProperties) { + this.id = id; + this.key = key; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return Credits remaining in the company's balance at which this warning is reached. + */ + @JsonProperty("value") + public long getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingPlanCreditGrantWarningTierResponseData + && equalTo((BillingPlanCreditGrantWarningTierResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingPlanCreditGrantWarningTierResponseData other) { + return id.equals(other.id) && key.equals(other.key) && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.key, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + KeyStage id(@NotNull String id); + + Builder from(BillingPlanCreditGrantWarningTierResponseData other); + } + + public interface KeyStage { + ValueStage key(@NotNull String key); + } + + public interface ValueStage { + /** + *

Credits remaining in the company's balance at which this warning is reached.

+ */ + _FinalStage value(long value); + } + + public interface _FinalStage { + BillingPlanCreditGrantWarningTierResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, KeyStage, ValueStage, _FinalStage { + private String id; + + private String key; + + private long value; + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingPlanCreditGrantWarningTierResponseData other) { + id(other.getId()); + key(other.getKey()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public KeyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("key") + public ValueStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

Credits remaining in the company's balance at which this warning is reached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(long value) { + this.value = value; + return this; + } + + @java.lang.Override + public BillingPlanCreditGrantWarningTierResponseData build() { + return new BillingPlanCreditGrantWarningTierResponseData(id, key, value, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("id") || key.equalsIgnoreCase("key") || key.equalsIgnoreCase("value")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogBundleCurrencyPriceResponseData.java b/src/main/java/com/schematic/api/types/CatalogBundleCurrencyPriceResponseData.java new file mode 100644 index 00000000..f2bcb754 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogBundleCurrencyPriceResponseData.java @@ -0,0 +1,190 @@ +/** + * 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 = CatalogBundleCurrencyPriceResponseData.Builder.class) +public final class CatalogBundleCurrencyPriceResponseData { + private final Currency currency; + + private final Optional price; + + private final Optional unitPrice; + + private final Map additionalProperties; + + private CatalogBundleCurrencyPriceResponseData( + Currency currency, + Optional price, + Optional unitPrice, + Map additionalProperties) { + this.currency = currency; + this.price = price; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public Currency getCurrency() { + return currency; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @JsonProperty("unit_price") + public Optional getUnitPrice() { + return unitPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogBundleCurrencyPriceResponseData + && equalTo((CatalogBundleCurrencyPriceResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogBundleCurrencyPriceResponseData other) { + return currency.equals(other.currency) && price.equals(other.price) && unitPrice.equals(other.unitPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.price, this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull Currency currency); + + Builder from(CatalogBundleCurrencyPriceResponseData other); + } + + public interface _FinalStage { + CatalogBundleCurrencyPriceResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage price(Optional price); + + _FinalStage price(CatalogPriceResponseData price); + + _FinalStage unitPrice(Optional unitPrice); + + _FinalStage unitPrice(CatalogPriceResponseData unitPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private Currency currency; + + private Optional unitPrice = Optional.empty(); + + private Optional price = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogBundleCurrencyPriceResponseData other) { + currency(other.getCurrency()); + price(other.getPrice()); + unitPrice(other.getUnitPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull Currency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage unitPrice(CatalogPriceResponseData unitPrice) { + this.unitPrice = Optional.ofNullable(unitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "unit_price", nulls = Nulls.SKIP) + public _FinalStage unitPrice(Optional unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + @java.lang.Override + public _FinalStage price(CatalogPriceResponseData price) { + this.price = Optional.ofNullable(price); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public _FinalStage price(Optional price) { + this.price = price; + return this; + } + + @java.lang.Override + public CatalogBundleCurrencyPriceResponseData build() { + return new CatalogBundleCurrencyPriceResponseData(currency, price, unitPrice, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("currency") + || key.equalsIgnoreCase("price") + || key.equalsIgnoreCase("unit_price")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogCapabilitiesResponseData.java b/src/main/java/com/schematic/api/types/CatalogCapabilitiesResponseData.java new file mode 100644 index 00000000..a973aee5 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogCapabilitiesResponseData.java @@ -0,0 +1,157 @@ +/** + * 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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogCapabilitiesResponseData.Builder.class) +public final class CatalogCapabilitiesResponseData { + private final boolean badgeVisibility; + + private final boolean checkout; + + private final Map additionalProperties; + + private CatalogCapabilitiesResponseData( + boolean badgeVisibility, boolean checkout, Map additionalProperties) { + this.badgeVisibility = badgeVisibility; + this.checkout = checkout; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether the consumer may hide the 'powered by Schematic' badge (the account's badge-hideable entitlement); false means the badge must be shown. + */ + @JsonProperty("badge_visibility") + public boolean getBadgeVisibility() { + return badgeVisibility; + } + + @JsonProperty("checkout") + public boolean getCheckout() { + return checkout; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogCapabilitiesResponseData && equalTo((CatalogCapabilitiesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogCapabilitiesResponseData other) { + return badgeVisibility == other.badgeVisibility && checkout == other.checkout; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.badgeVisibility, this.checkout); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BadgeVisibilityStage builder() { + return new Builder(); + } + + public interface BadgeVisibilityStage { + /** + *

Whether the consumer may hide the 'powered by Schematic' badge (the account's badge-hideable entitlement); false means the badge must be shown.

+ */ + CheckoutStage badgeVisibility(boolean badgeVisibility); + + Builder from(CatalogCapabilitiesResponseData other); + } + + public interface CheckoutStage { + _FinalStage checkout(boolean checkout); + } + + public interface _FinalStage { + CatalogCapabilitiesResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BadgeVisibilityStage, CheckoutStage, _FinalStage { + private boolean badgeVisibility; + + private boolean checkout; + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogCapabilitiesResponseData other) { + badgeVisibility(other.getBadgeVisibility()); + checkout(other.getCheckout()); + return this; + } + + /** + *

Whether the consumer may hide the 'powered by Schematic' badge (the account's badge-hideable entitlement); false means the badge must be shown.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("badge_visibility") + public CheckoutStage badgeVisibility(boolean badgeVisibility) { + this.badgeVisibility = badgeVisibility; + return this; + } + + @java.lang.Override + @JsonSetter("checkout") + public _FinalStage checkout(boolean checkout) { + this.checkout = checkout; + return this; + } + + @java.lang.Override + public CatalogCapabilitiesResponseData build() { + return new CatalogCapabilitiesResponseData(badgeVisibility, checkout, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("badge_visibility") || key.equalsIgnoreCase("checkout")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogCreditBundleResponseData.java b/src/main/java/com/schematic/api/types/CatalogCreditBundleResponseData.java new file mode 100644 index 00000000..393f2d12 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogCreditBundleResponseData.java @@ -0,0 +1,640 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogCreditBundleResponseData.Builder.class) +public final class CatalogCreditBundleResponseData { + private final String bundleType; + + private final Optional> compatiblePlanIds; + + private final Optional creditIcon; + + private final String creditId; + + private final String creditName; + + private final Optional creditPluralName; + + private final Optional creditSingularName; + + private final List currencyPrices; + + private final BillingCreditExpiryType expiryType; + + private final BillingCreditExpiryUnit expiryUnit; + + private final Optional expiryUnitCount; + + private final String id; + + private final String name; + + private final Optional price; + + private final Optional quantity; + + private final Optional unitPrice; + + private final Map additionalProperties; + + private CatalogCreditBundleResponseData( + String bundleType, + Optional> compatiblePlanIds, + Optional creditIcon, + String creditId, + String creditName, + Optional creditPluralName, + Optional creditSingularName, + List currencyPrices, + BillingCreditExpiryType expiryType, + BillingCreditExpiryUnit expiryUnit, + Optional expiryUnitCount, + String id, + String name, + Optional price, + Optional quantity, + Optional unitPrice, + Map additionalProperties) { + this.bundleType = bundleType; + this.compatiblePlanIds = compatiblePlanIds; + this.creditIcon = creditIcon; + this.creditId = creditId; + this.creditName = creditName; + this.creditPluralName = creditPluralName; + this.creditSingularName = creditSingularName; + this.currencyPrices = currencyPrices; + this.expiryType = expiryType; + this.expiryUnit = expiryUnit; + this.expiryUnitCount = expiryUnitCount; + this.id = id; + this.name = name; + this.price = price; + this.quantity = quantity; + this.unitPrice = unitPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("bundle_type") + public String getBundleType() { + return bundleType; + } + + /** + * @return The plans whose companies may purchase this bundle. Null means compatible with every plan. + */ + @JsonProperty("compatible_plan_ids") + public Optional> getCompatiblePlanIds() { + return compatiblePlanIds; + } + + @JsonProperty("credit_icon") + public Optional getCreditIcon() { + return creditIcon; + } + + @JsonProperty("credit_id") + public String getCreditId() { + return creditId; + } + + @JsonProperty("credit_name") + public String getCreditName() { + return creditName; + } + + @JsonProperty("credit_plural_name") + public Optional getCreditPluralName() { + return creditPluralName; + } + + @JsonProperty("credit_singular_name") + public Optional getCreditSingularName() { + return creditSingularName; + } + + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + + @JsonProperty("expiry_type") + public BillingCreditExpiryType getExpiryType() { + return expiryType; + } + + @JsonProperty("expiry_unit") + public BillingCreditExpiryUnit getExpiryUnit() { + return expiryUnit; + } + + @JsonProperty("expiry_unit_count") + public Optional getExpiryUnitCount() { + return expiryUnitCount; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + /** + * @return Credits granted per purchase; null means the buyer chooses a custom quantity priced via unit_price. + */ + @JsonProperty("quantity") + public Optional getQuantity() { + return quantity; + } + + @JsonProperty("unit_price") + public Optional getUnitPrice() { + return unitPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogCreditBundleResponseData && equalTo((CatalogCreditBundleResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogCreditBundleResponseData other) { + return bundleType.equals(other.bundleType) + && compatiblePlanIds.equals(other.compatiblePlanIds) + && creditIcon.equals(other.creditIcon) + && creditId.equals(other.creditId) + && creditName.equals(other.creditName) + && creditPluralName.equals(other.creditPluralName) + && creditSingularName.equals(other.creditSingularName) + && currencyPrices.equals(other.currencyPrices) + && expiryType.equals(other.expiryType) + && expiryUnit.equals(other.expiryUnit) + && expiryUnitCount.equals(other.expiryUnitCount) + && id.equals(other.id) + && name.equals(other.name) + && price.equals(other.price) + && quantity.equals(other.quantity) + && unitPrice.equals(other.unitPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.bundleType, + this.compatiblePlanIds, + this.creditIcon, + this.creditId, + this.creditName, + this.creditPluralName, + this.creditSingularName, + this.currencyPrices, + this.expiryType, + this.expiryUnit, + this.expiryUnitCount, + this.id, + this.name, + this.price, + this.quantity, + this.unitPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BundleTypeStage builder() { + return new Builder(); + } + + public interface BundleTypeStage { + CreditIdStage bundleType(@NotNull String bundleType); + + Builder from(CatalogCreditBundleResponseData other); + } + + public interface CreditIdStage { + CreditNameStage creditId(@NotNull String creditId); + } + + public interface CreditNameStage { + ExpiryTypeStage creditName(@NotNull String creditName); + } + + public interface ExpiryTypeStage { + ExpiryUnitStage expiryType(@NotNull BillingCreditExpiryType expiryType); + } + + public interface ExpiryUnitStage { + IdStage expiryUnit(@NotNull BillingCreditExpiryUnit expiryUnit); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CatalogCreditBundleResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The plans whose companies may purchase this bundle. Null means compatible with every plan.

+ */ + _FinalStage compatiblePlanIds(Optional> compatiblePlanIds); + + _FinalStage compatiblePlanIds(List compatiblePlanIds); + + _FinalStage creditIcon(Optional creditIcon); + + _FinalStage creditIcon(String creditIcon); + + _FinalStage creditPluralName(Optional creditPluralName); + + _FinalStage creditPluralName(String creditPluralName); + + _FinalStage creditSingularName(Optional creditSingularName); + + _FinalStage creditSingularName(String creditSingularName); + + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(CatalogBundleCurrencyPriceResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Long expiryUnitCount); + + _FinalStage price(Optional price); + + _FinalStage price(CatalogPriceResponseData price); + + /** + *

Credits granted per purchase; null means the buyer chooses a custom quantity priced via unit_price.

+ */ + _FinalStage quantity(Optional quantity); + + _FinalStage quantity(Long quantity); + + _FinalStage unitPrice(Optional unitPrice); + + _FinalStage unitPrice(CatalogPriceResponseData unitPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BundleTypeStage, + CreditIdStage, + CreditNameStage, + ExpiryTypeStage, + ExpiryUnitStage, + IdStage, + NameStage, + _FinalStage { + private String bundleType; + + private String creditId; + + private String creditName; + + private BillingCreditExpiryType expiryType; + + private BillingCreditExpiryUnit expiryUnit; + + private String id; + + private String name; + + private Optional unitPrice = Optional.empty(); + + private Optional quantity = Optional.empty(); + + private Optional price = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); + + private Optional creditSingularName = Optional.empty(); + + private Optional creditPluralName = Optional.empty(); + + private Optional creditIcon = Optional.empty(); + + private Optional> compatiblePlanIds = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogCreditBundleResponseData other) { + bundleType(other.getBundleType()); + compatiblePlanIds(other.getCompatiblePlanIds()); + creditIcon(other.getCreditIcon()); + creditId(other.getCreditId()); + creditName(other.getCreditName()); + creditPluralName(other.getCreditPluralName()); + creditSingularName(other.getCreditSingularName()); + currencyPrices(other.getCurrencyPrices()); + expiryType(other.getExpiryType()); + expiryUnit(other.getExpiryUnit()); + expiryUnitCount(other.getExpiryUnitCount()); + id(other.getId()); + name(other.getName()); + price(other.getPrice()); + quantity(other.getQuantity()); + unitPrice(other.getUnitPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("bundle_type") + public CreditIdStage bundleType(@NotNull String bundleType) { + this.bundleType = Objects.requireNonNull(bundleType, "bundleType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("credit_id") + public CreditNameStage creditId(@NotNull String creditId) { + this.creditId = Objects.requireNonNull(creditId, "creditId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("credit_name") + public ExpiryTypeStage creditName(@NotNull String creditName) { + this.creditName = Objects.requireNonNull(creditName, "creditName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("expiry_type") + public ExpiryUnitStage expiryType(@NotNull BillingCreditExpiryType expiryType) { + this.expiryType = Objects.requireNonNull(expiryType, "expiryType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("expiry_unit") + public IdStage expiryUnit(@NotNull BillingCreditExpiryUnit expiryUnit) { + this.expiryUnit = Objects.requireNonNull(expiryUnit, "expiryUnit 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 _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage unitPrice(CatalogPriceResponseData unitPrice) { + this.unitPrice = Optional.ofNullable(unitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "unit_price", nulls = Nulls.SKIP) + public _FinalStage unitPrice(Optional unitPrice) { + this.unitPrice = unitPrice; + return this; + } + + /** + *

Credits granted per purchase; null means the buyer chooses a custom quantity priced via unit_price.

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

Credits granted per purchase; null means the buyer chooses a custom quantity priced via unit_price.

+ */ + @java.lang.Override + @JsonSetter(value = "quantity", nulls = Nulls.SKIP) + public _FinalStage quantity(Optional quantity) { + this.quantity = quantity; + return this; + } + + @java.lang.Override + public _FinalStage price(CatalogPriceResponseData price) { + this.price = Optional.ofNullable(price); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public _FinalStage price(Optional price) { + this.price = price; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnitCount(Long expiryUnitCount) { + this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + this.expiryUnitCount = expiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(CatalogBundleCurrencyPriceResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage creditSingularName(String creditSingularName) { + this.creditSingularName = Optional.ofNullable(creditSingularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_singular_name", nulls = Nulls.SKIP) + public _FinalStage creditSingularName(Optional creditSingularName) { + this.creditSingularName = creditSingularName; + return this; + } + + @java.lang.Override + public _FinalStage creditPluralName(String creditPluralName) { + this.creditPluralName = Optional.ofNullable(creditPluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_plural_name", nulls = Nulls.SKIP) + public _FinalStage creditPluralName(Optional creditPluralName) { + this.creditPluralName = creditPluralName; + return this; + } + + @java.lang.Override + public _FinalStage creditIcon(String creditIcon) { + this.creditIcon = Optional.ofNullable(creditIcon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_icon", nulls = Nulls.SKIP) + public _FinalStage creditIcon(Optional creditIcon) { + this.creditIcon = creditIcon; + return this; + } + + /** + *

The plans whose companies may purchase this bundle. Null means compatible with every plan.

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

The plans whose companies may purchase this bundle. Null means compatible with every plan.

+ */ + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(Optional> compatiblePlanIds) { + this.compatiblePlanIds = compatiblePlanIds; + return this; + } + + @java.lang.Override + public CatalogCreditBundleResponseData build() { + return new CatalogCreditBundleResponseData( + bundleType, + compatiblePlanIds, + creditIcon, + creditId, + creditName, + creditPluralName, + creditSingularName, + currencyPrices, + expiryType, + expiryUnit, + expiryUnitCount, + id, + name, + price, + quantity, + unitPrice, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("bundle_type") + || key.equalsIgnoreCase("compatible_plan_ids") + || key.equalsIgnoreCase("credit_icon") + || key.equalsIgnoreCase("credit_id") + || key.equalsIgnoreCase("credit_name") + || key.equalsIgnoreCase("credit_plural_name") + || key.equalsIgnoreCase("credit_singular_name") + || key.equalsIgnoreCase("currency_prices") + || key.equalsIgnoreCase("expiry_type") + || key.equalsIgnoreCase("expiry_unit") + || key.equalsIgnoreCase("expiry_unit_count") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("name") + || key.equalsIgnoreCase("price") + || key.equalsIgnoreCase("quantity") + || key.equalsIgnoreCase("unit_price")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/CatalogCreditGrantResponseData.java new file mode 100644 index 00000000..19dc8318 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogCreditGrantResponseData.java @@ -0,0 +1,459 @@ +/** + * 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 = CatalogCreditGrantResponseData.Builder.class) +public final class CatalogCreditGrantResponseData { + private final long companyCreditAmount; + + private final long creditAmount; + + private final Optional creditIcon; + + private final String creditId; + + private final String creditName; + + private final Optional creditPluralName; + + private final Optional creditSingularName; + + private final String id; + + private final Optional licenseId; + + private final Optional resetCadence; + + private final PlanCreditGrantScaling scaling; + + private final Map additionalProperties; + + private CatalogCreditGrantResponseData( + long companyCreditAmount, + long creditAmount, + Optional creditIcon, + String creditId, + String creditName, + Optional creditPluralName, + Optional creditSingularName, + String id, + Optional licenseId, + Optional resetCadence, + PlanCreditGrantScaling scaling, + Map additionalProperties) { + this.companyCreditAmount = companyCreditAmount; + this.creditAmount = creditAmount; + this.creditIcon = creditIcon; + this.creditId = creditId; + this.creditName = creditName; + this.creditPluralName = creditPluralName; + this.creditSingularName = creditSingularName; + this.id = id; + this.licenseId = licenseId; + this.resetCadence = resetCadence; + this.scaling = scaling; + this.additionalProperties = additionalProperties; + } + + /** + * @return Flat credit amount granted to the company regardless of scaling. + */ + @JsonProperty("company_credit_amount") + public long getCompanyCreditAmount() { + return companyCreditAmount; + } + + /** + * @return Credits granted; for per_license scaling this is the amount per license unit. + */ + @JsonProperty("credit_amount") + public long getCreditAmount() { + return creditAmount; + } + + @JsonProperty("credit_icon") + public Optional getCreditIcon() { + return creditIcon; + } + + @JsonProperty("credit_id") + public String getCreditId() { + return creditId; + } + + @JsonProperty("credit_name") + public String getCreditName() { + return creditName; + } + + @JsonProperty("credit_plural_name") + public Optional getCreditPluralName() { + return creditPluralName; + } + + @JsonProperty("credit_singular_name") + public Optional getCreditSingularName() { + return creditSingularName; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + + @JsonProperty("reset_cadence") + public Optional getResetCadence() { + return resetCadence; + } + + @JsonProperty("scaling") + public PlanCreditGrantScaling getScaling() { + return scaling; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogCreditGrantResponseData && equalTo((CatalogCreditGrantResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogCreditGrantResponseData other) { + return companyCreditAmount == other.companyCreditAmount + && creditAmount == other.creditAmount + && creditIcon.equals(other.creditIcon) + && creditId.equals(other.creditId) + && creditName.equals(other.creditName) + && creditPluralName.equals(other.creditPluralName) + && creditSingularName.equals(other.creditSingularName) + && id.equals(other.id) + && licenseId.equals(other.licenseId) + && resetCadence.equals(other.resetCadence) + && scaling.equals(other.scaling); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyCreditAmount, + this.creditAmount, + this.creditIcon, + this.creditId, + this.creditName, + this.creditPluralName, + this.creditSingularName, + this.id, + this.licenseId, + this.resetCadence, + this.scaling); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyCreditAmountStage builder() { + return new Builder(); + } + + public interface CompanyCreditAmountStage { + /** + *

Flat credit amount granted to the company regardless of scaling.

+ */ + CreditAmountStage companyCreditAmount(long companyCreditAmount); + + Builder from(CatalogCreditGrantResponseData other); + } + + public interface CreditAmountStage { + /** + *

Credits granted; for per_license scaling this is the amount per license unit.

+ */ + CreditIdStage creditAmount(long creditAmount); + } + + public interface CreditIdStage { + CreditNameStage creditId(@NotNull String creditId); + } + + public interface CreditNameStage { + IdStage creditName(@NotNull String creditName); + } + + public interface IdStage { + ScalingStage id(@NotNull String id); + } + + public interface ScalingStage { + _FinalStage scaling(@NotNull PlanCreditGrantScaling scaling); + } + + public interface _FinalStage { + CatalogCreditGrantResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage creditIcon(Optional creditIcon); + + _FinalStage creditIcon(String creditIcon); + + _FinalStage creditPluralName(Optional creditPluralName); + + _FinalStage creditPluralName(String creditPluralName); + + _FinalStage creditSingularName(Optional creditSingularName); + + _FinalStage creditSingularName(String creditSingularName); + + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + + _FinalStage resetCadence(Optional resetCadence); + + _FinalStage resetCadence(BillingPlanCreditGrantResetCadence resetCadence); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyCreditAmountStage, + CreditAmountStage, + CreditIdStage, + CreditNameStage, + IdStage, + ScalingStage, + _FinalStage { + private long companyCreditAmount; + + private long creditAmount; + + private String creditId; + + private String creditName; + + private String id; + + private PlanCreditGrantScaling scaling; + + private Optional resetCadence = Optional.empty(); + + private Optional licenseId = Optional.empty(); + + private Optional creditSingularName = Optional.empty(); + + private Optional creditPluralName = Optional.empty(); + + private Optional creditIcon = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogCreditGrantResponseData other) { + companyCreditAmount(other.getCompanyCreditAmount()); + creditAmount(other.getCreditAmount()); + creditIcon(other.getCreditIcon()); + creditId(other.getCreditId()); + creditName(other.getCreditName()); + creditPluralName(other.getCreditPluralName()); + creditSingularName(other.getCreditSingularName()); + id(other.getId()); + licenseId(other.getLicenseId()); + resetCadence(other.getResetCadence()); + scaling(other.getScaling()); + return this; + } + + /** + *

Flat credit amount granted to the company regardless of scaling.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("company_credit_amount") + public CreditAmountStage companyCreditAmount(long companyCreditAmount) { + this.companyCreditAmount = companyCreditAmount; + return this; + } + + /** + *

Credits granted; for per_license scaling this is the amount per license unit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credit_amount") + public CreditIdStage creditAmount(long creditAmount) { + this.creditAmount = creditAmount; + return this; + } + + @java.lang.Override + @JsonSetter("credit_id") + public CreditNameStage creditId(@NotNull String creditId) { + this.creditId = Objects.requireNonNull(creditId, "creditId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("credit_name") + public IdStage creditName(@NotNull String creditName) { + this.creditName = Objects.requireNonNull(creditName, "creditName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ScalingStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("scaling") + public _FinalStage scaling(@NotNull PlanCreditGrantScaling scaling) { + this.scaling = Objects.requireNonNull(scaling, "scaling must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage resetCadence(BillingPlanCreditGrantResetCadence resetCadence) { + this.resetCadence = Optional.ofNullable(resetCadence); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_cadence", nulls = Nulls.SKIP) + public _FinalStage resetCadence(Optional resetCadence) { + this.resetCadence = resetCadence; + return this; + } + + @java.lang.Override + public _FinalStage licenseId(String licenseId) { + this.licenseId = Optional.ofNullable(licenseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + + @java.lang.Override + public _FinalStage creditSingularName(String creditSingularName) { + this.creditSingularName = Optional.ofNullable(creditSingularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_singular_name", nulls = Nulls.SKIP) + public _FinalStage creditSingularName(Optional creditSingularName) { + this.creditSingularName = creditSingularName; + return this; + } + + @java.lang.Override + public _FinalStage creditPluralName(String creditPluralName) { + this.creditPluralName = Optional.ofNullable(creditPluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_plural_name", nulls = Nulls.SKIP) + public _FinalStage creditPluralName(Optional creditPluralName) { + this.creditPluralName = creditPluralName; + return this; + } + + @java.lang.Override + public _FinalStage creditIcon(String creditIcon) { + this.creditIcon = Optional.ofNullable(creditIcon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_icon", nulls = Nulls.SKIP) + public _FinalStage creditIcon(Optional creditIcon) { + this.creditIcon = creditIcon; + return this; + } + + @java.lang.Override + public CatalogCreditGrantResponseData build() { + return new CatalogCreditGrantResponseData( + companyCreditAmount, + creditAmount, + creditIcon, + creditId, + creditName, + creditPluralName, + creditSingularName, + id, + licenseId, + resetCadence, + scaling, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("company_credit_amount") + || key.equalsIgnoreCase("credit_amount") + || key.equalsIgnoreCase("credit_icon") + || key.equalsIgnoreCase("credit_id") + || key.equalsIgnoreCase("credit_name") + || key.equalsIgnoreCase("credit_plural_name") + || key.equalsIgnoreCase("credit_singular_name") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("license_id") + || key.equalsIgnoreCase("reset_cadence") + || key.equalsIgnoreCase("scaling")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogCurrencyPricesResponseData.java b/src/main/java/com/schematic/api/types/CatalogCurrencyPricesResponseData.java new file mode 100644 index 00000000..5f1d86e7 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogCurrencyPricesResponseData.java @@ -0,0 +1,254 @@ +/** + * 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 = CatalogCurrencyPricesResponseData.Builder.class) +public final class CatalogCurrencyPricesResponseData { + private final Currency currency; + + private final Optional monthlyPrice; + + private final Optional oneTimePrice; + + private final Optional quarterlyPrice; + + private final Optional yearlyPrice; + + private final Map additionalProperties; + + private CatalogCurrencyPricesResponseData( + Currency currency, + Optional monthlyPrice, + Optional oneTimePrice, + Optional quarterlyPrice, + Optional yearlyPrice, + Map additionalProperties) { + this.currency = currency; + this.monthlyPrice = monthlyPrice; + this.oneTimePrice = oneTimePrice; + this.quarterlyPrice = quarterlyPrice; + this.yearlyPrice = yearlyPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public Currency getCurrency() { + return currency; + } + + @JsonProperty("monthly_price") + public Optional getMonthlyPrice() { + return monthlyPrice; + } + + @JsonProperty("one_time_price") + public Optional getOneTimePrice() { + return oneTimePrice; + } + + @JsonProperty("quarterly_price") + public Optional getQuarterlyPrice() { + return quarterlyPrice; + } + + @JsonProperty("yearly_price") + public Optional getYearlyPrice() { + return yearlyPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogCurrencyPricesResponseData && equalTo((CatalogCurrencyPricesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogCurrencyPricesResponseData other) { + return currency.equals(other.currency) + && monthlyPrice.equals(other.monthlyPrice) + && oneTimePrice.equals(other.oneTimePrice) + && quarterlyPrice.equals(other.quarterlyPrice) + && yearlyPrice.equals(other.yearlyPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.monthlyPrice, this.oneTimePrice, this.quarterlyPrice, this.yearlyPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull Currency currency); + + Builder from(CatalogCurrencyPricesResponseData other); + } + + public interface _FinalStage { + CatalogCurrencyPricesResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(CatalogPriceResponseData monthlyPrice); + + _FinalStage oneTimePrice(Optional oneTimePrice); + + _FinalStage oneTimePrice(CatalogPriceResponseData oneTimePrice); + + _FinalStage quarterlyPrice(Optional quarterlyPrice); + + _FinalStage quarterlyPrice(CatalogPriceResponseData quarterlyPrice); + + _FinalStage yearlyPrice(Optional yearlyPrice); + + _FinalStage yearlyPrice(CatalogPriceResponseData yearlyPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private Currency currency; + + private Optional yearlyPrice = Optional.empty(); + + private Optional quarterlyPrice = Optional.empty(); + + private Optional oneTimePrice = Optional.empty(); + + private Optional monthlyPrice = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogCurrencyPricesResponseData other) { + currency(other.getCurrency()); + monthlyPrice(other.getMonthlyPrice()); + oneTimePrice(other.getOneTimePrice()); + quarterlyPrice(other.getQuarterlyPrice()); + yearlyPrice(other.getYearlyPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull Currency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage yearlyPrice(CatalogPriceResponseData yearlyPrice) { + this.yearlyPrice = Optional.ofNullable(yearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) + public _FinalStage yearlyPrice(Optional yearlyPrice) { + this.yearlyPrice = yearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage quarterlyPrice(CatalogPriceResponseData quarterlyPrice) { + this.quarterlyPrice = Optional.ofNullable(quarterlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "quarterly_price", nulls = Nulls.SKIP) + public _FinalStage quarterlyPrice(Optional quarterlyPrice) { + this.quarterlyPrice = quarterlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage oneTimePrice(CatalogPriceResponseData oneTimePrice) { + this.oneTimePrice = Optional.ofNullable(oneTimePrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "one_time_price", nulls = Nulls.SKIP) + public _FinalStage oneTimePrice(Optional oneTimePrice) { + this.oneTimePrice = oneTimePrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPrice(CatalogPriceResponseData monthlyPrice) { + this.monthlyPrice = Optional.ofNullable(monthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) + public _FinalStage monthlyPrice(Optional monthlyPrice) { + this.monthlyPrice = monthlyPrice; + return this; + } + + @java.lang.Override + public CatalogCurrencyPricesResponseData build() { + return new CatalogCurrencyPricesResponseData( + currency, monthlyPrice, oneTimePrice, quarterlyPrice, yearlyPrice, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("currency") + || key.equalsIgnoreCase("monthly_price") + || key.equalsIgnoreCase("one_time_price") + || key.equalsIgnoreCase("quarterly_price") + || key.equalsIgnoreCase("yearly_price")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogCustomPlanCtaResponseData.java b/src/main/java/com/schematic/api/types/CatalogCustomPlanCtaResponseData.java new file mode 100644 index 00000000..b7e00e1f --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogCustomPlanCtaResponseData.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogCustomPlanCtaResponseData.Builder.class) +public final class CatalogCustomPlanCtaResponseData { + private final Optional ctaText; + + private final Optional ctaUrl; + + private final Optional priceText; + + private final Map additionalProperties; + + private CatalogCustomPlanCtaResponseData( + Optional ctaText, + Optional ctaUrl, + Optional priceText, + Map additionalProperties) { + this.ctaText = ctaText; + this.ctaUrl = ctaUrl; + this.priceText = priceText; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("cta_text") + public Optional getCtaText() { + return ctaText; + } + + @JsonProperty("cta_url") + public Optional getCtaUrl() { + return ctaUrl; + } + + @JsonProperty("price_text") + public Optional getPriceText() { + return priceText; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogCustomPlanCtaResponseData && equalTo((CatalogCustomPlanCtaResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogCustomPlanCtaResponseData other) { + return ctaText.equals(other.ctaText) && ctaUrl.equals(other.ctaUrl) && priceText.equals(other.priceText); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ctaText, this.ctaUrl, this.priceText); + } + + @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 ctaText = Optional.empty(); + + private Optional ctaUrl = Optional.empty(); + + private Optional priceText = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CatalogCustomPlanCtaResponseData other) { + ctaText(other.getCtaText()); + ctaUrl(other.getCtaUrl()); + priceText(other.getPriceText()); + return this; + } + + @JsonSetter(value = "cta_text", nulls = Nulls.SKIP) + public Builder ctaText(Optional ctaText) { + this.ctaText = ctaText; + return this; + } + + public Builder ctaText(String ctaText) { + this.ctaText = Optional.ofNullable(ctaText); + return this; + } + + @JsonSetter(value = "cta_url", nulls = Nulls.SKIP) + public Builder ctaUrl(Optional ctaUrl) { + this.ctaUrl = ctaUrl; + return this; + } + + public Builder ctaUrl(String ctaUrl) { + this.ctaUrl = Optional.ofNullable(ctaUrl); + return this; + } + + @JsonSetter(value = "price_text", nulls = Nulls.SKIP) + public Builder priceText(Optional priceText) { + this.priceText = priceText; + return this; + } + + public Builder priceText(String priceText) { + this.priceText = Optional.ofNullable(priceText); + return this; + } + + public CatalogCustomPlanCtaResponseData build() { + return new CatalogCustomPlanCtaResponseData(ctaText, ctaUrl, priceText, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("cta_text") + || key.equalsIgnoreCase("cta_url") + || key.equalsIgnoreCase("price_text")) { + return; + } + this.additionalProperties.put(key, value); + } + + 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/CatalogDetailResponseData.java b/src/main/java/com/schematic/api/types/CatalogDetailResponseData.java new file mode 100644 index 00000000..d440398c --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogDetailResponseData.java @@ -0,0 +1,369 @@ +/** + * 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 = CatalogDetailResponseData.Builder.class) +public final class CatalogDetailResponseData { + private final CatalogCapabilitiesResponseData capabilities; + + private final Optional customPlanCta; + + private final Currency defaultCurrency; + + private final Optional description; + + private final String id; + + private final String name; + + private final Optional pricingModel; + + private final Optional pricingUrl; + + private final Map additionalProperties; + + private CatalogDetailResponseData( + CatalogCapabilitiesResponseData capabilities, + Optional customPlanCta, + Currency defaultCurrency, + Optional description, + String id, + String name, + Optional pricingModel, + Optional pricingUrl, + Map additionalProperties) { + this.capabilities = capabilities; + this.customPlanCta = customPlanCta; + this.defaultCurrency = defaultCurrency; + this.description = description; + this.id = id; + this.name = name; + this.pricingModel = pricingModel; + this.pricingUrl = pricingUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("capabilities") + public CatalogCapabilitiesResponseData getCapabilities() { + return capabilities; + } + + /** + * @return Present when the catalog offers a custom plan; absent when custom plans are hidden. + */ + @JsonProperty("custom_plan_cta") + public Optional getCustomPlanCta() { + return customPlanCta; + } + + /** + * @return ISO 4217 currency of every top-level price slot; currency_prices carries the others. + */ + @JsonProperty("default_currency") + public Currency getDefaultCurrency() { + return defaultCurrency; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("pricing_model") + public Optional getPricingModel() { + return pricingModel; + } + + @JsonProperty("pricing_url") + public Optional getPricingUrl() { + return pricingUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogDetailResponseData && equalTo((CatalogDetailResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogDetailResponseData other) { + return capabilities.equals(other.capabilities) + && customPlanCta.equals(other.customPlanCta) + && defaultCurrency.equals(other.defaultCurrency) + && description.equals(other.description) + && id.equals(other.id) + && name.equals(other.name) + && pricingModel.equals(other.pricingModel) + && pricingUrl.equals(other.pricingUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.capabilities, + this.customPlanCta, + this.defaultCurrency, + this.description, + this.id, + this.name, + this.pricingModel, + this.pricingUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CapabilitiesStage builder() { + return new Builder(); + } + + public interface CapabilitiesStage { + DefaultCurrencyStage capabilities(@NotNull CatalogCapabilitiesResponseData capabilities); + + Builder from(CatalogDetailResponseData other); + } + + public interface DefaultCurrencyStage { + /** + *

ISO 4217 currency of every top-level price slot; currency_prices carries the others.

+ */ + IdStage defaultCurrency(@NotNull Currency defaultCurrency); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CatalogDetailResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Present when the catalog offers a custom plan; absent when custom plans are hidden.

+ */ + _FinalStage customPlanCta(Optional customPlanCta); + + _FinalStage customPlanCta(CatalogCustomPlanCtaResponseData customPlanCta); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage pricingModel(Optional pricingModel); + + _FinalStage pricingModel(String pricingModel); + + _FinalStage pricingUrl(Optional pricingUrl); + + _FinalStage pricingUrl(String pricingUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CapabilitiesStage, DefaultCurrencyStage, IdStage, NameStage, _FinalStage { + private CatalogCapabilitiesResponseData capabilities; + + private Currency defaultCurrency; + + private String id; + + private String name; + + private Optional pricingUrl = Optional.empty(); + + private Optional pricingModel = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional customPlanCta = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogDetailResponseData other) { + capabilities(other.getCapabilities()); + customPlanCta(other.getCustomPlanCta()); + defaultCurrency(other.getDefaultCurrency()); + description(other.getDescription()); + id(other.getId()); + name(other.getName()); + pricingModel(other.getPricingModel()); + pricingUrl(other.getPricingUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("capabilities") + public DefaultCurrencyStage capabilities(@NotNull CatalogCapabilitiesResponseData capabilities) { + this.capabilities = Objects.requireNonNull(capabilities, "capabilities must not be null"); + return this; + } + + /** + *

ISO 4217 currency of every top-level price slot; currency_prices carries the others.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("default_currency") + public IdStage defaultCurrency(@NotNull Currency defaultCurrency) { + this.defaultCurrency = Objects.requireNonNull(defaultCurrency, "defaultCurrency 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 _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage pricingUrl(String pricingUrl) { + this.pricingUrl = Optional.ofNullable(pricingUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_url", nulls = Nulls.SKIP) + public _FinalStage pricingUrl(Optional pricingUrl) { + this.pricingUrl = pricingUrl; + return this; + } + + @java.lang.Override + public _FinalStage pricingModel(String pricingModel) { + this.pricingModel = Optional.ofNullable(pricingModel); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_model", nulls = Nulls.SKIP) + public _FinalStage pricingModel(Optional pricingModel) { + this.pricingModel = pricingModel; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Present when the catalog offers a custom plan; absent when custom plans are hidden.

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

Present when the catalog offers a custom plan; absent when custom plans are hidden.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_plan_cta", nulls = Nulls.SKIP) + public _FinalStage customPlanCta(Optional customPlanCta) { + this.customPlanCta = customPlanCta; + return this; + } + + @java.lang.Override + public CatalogDetailResponseData build() { + return new CatalogDetailResponseData( + capabilities, + customPlanCta, + defaultCurrency, + description, + id, + name, + pricingModel, + pricingUrl, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("capabilities") + || key.equalsIgnoreCase("custom_plan_cta") + || key.equalsIgnoreCase("default_currency") + || key.equalsIgnoreCase("description") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("name") + || key.equalsIgnoreCase("pricing_model") + || key.equalsIgnoreCase("pricing_url")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogEntitlementResponseData.java b/src/main/java/com/schematic/api/types/CatalogEntitlementResponseData.java new file mode 100644 index 00000000..97943d23 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogEntitlementResponseData.java @@ -0,0 +1,1021 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogEntitlementResponseData.Builder.class) +public final class CatalogEntitlementResponseData { + private final Optional consumptionRate; + + private final Optional creditEquivalentLimit; + + private final Optional creditIcon; + + private final Optional creditId; + + private final Optional creditName; + + private final Optional creditPluralName; + + private final Optional creditSingularName; + + private final List currencyPrices; + + private final String featureDescription; + + private final String featureIcon; + + private final String featureId; + + private final String featureName; + + private final Optional featurePluralName; + + private final Optional featureSingularName; + + private final FeatureType featureType; + + private final Optional licenseId; + + private final Optional meteredMonthlyPrice; + + private final Optional meteredQuarterlyPrice; + + private final Optional meteredYearlyPrice; + + private final Optional metricPeriod; + + private final Optional metricPeriodMonthReset; + + private final Optional priceBehavior; + + private final Optional softLimit; + + private final Optional valueBool; + + private final Optional valueNumeric; + + private final EntitlementValueType valueType; + + private final Optional warningThreshold; + + private final Map additionalProperties; + + private CatalogEntitlementResponseData( + Optional consumptionRate, + Optional creditEquivalentLimit, + Optional creditIcon, + Optional creditId, + Optional creditName, + Optional creditPluralName, + Optional creditSingularName, + List currencyPrices, + String featureDescription, + String featureIcon, + String featureId, + String featureName, + Optional featurePluralName, + Optional featureSingularName, + FeatureType featureType, + Optional licenseId, + Optional meteredMonthlyPrice, + Optional meteredQuarterlyPrice, + Optional meteredYearlyPrice, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional priceBehavior, + Optional softLimit, + Optional valueBool, + Optional valueNumeric, + EntitlementValueType valueType, + Optional warningThreshold, + Map additionalProperties) { + this.consumptionRate = consumptionRate; + this.creditEquivalentLimit = creditEquivalentLimit; + this.creditIcon = creditIcon; + this.creditId = creditId; + this.creditName = creditName; + this.creditPluralName = creditPluralName; + this.creditSingularName = creditSingularName; + this.currencyPrices = currencyPrices; + this.featureDescription = featureDescription; + this.featureIcon = featureIcon; + this.featureId = featureId; + this.featureName = featureName; + this.featurePluralName = featurePluralName; + this.featureSingularName = featureSingularName; + this.featureType = featureType; + this.licenseId = licenseId; + this.meteredMonthlyPrice = meteredMonthlyPrice; + this.meteredQuarterlyPrice = meteredQuarterlyPrice; + this.meteredYearlyPrice = meteredYearlyPrice; + this.metricPeriod = metricPeriod; + this.metricPeriodMonthReset = metricPeriodMonthReset; + this.priceBehavior = priceBehavior; + this.softLimit = softLimit; + this.valueBool = valueBool; + this.valueNumeric = valueNumeric; + this.valueType = valueType; + this.warningThreshold = warningThreshold; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credits consumed per unit of usage, for credit-burndown entitlements. + */ + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + + /** + * @return How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license. + */ + @JsonProperty("credit_equivalent_limit") + public Optional getCreditEquivalentLimit() { + return creditEquivalentLimit; + } + + @JsonProperty("credit_icon") + public Optional getCreditIcon() { + return creditIcon; + } + + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + @JsonProperty("credit_name") + public Optional getCreditName() { + return creditName; + } + + @JsonProperty("credit_plural_name") + public Optional getCreditPluralName() { + return creditPluralName; + } + + @JsonProperty("credit_singular_name") + public Optional getCreditSingularName() { + return creditSingularName; + } + + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + + @JsonProperty("feature_description") + public String getFeatureDescription() { + return featureDescription; + } + + @JsonProperty("feature_icon") + public String getFeatureIcon() { + return featureIcon; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + @JsonProperty("feature_name") + public String getFeatureName() { + return featureName; + } + + @JsonProperty("feature_plural_name") + public Optional getFeaturePluralName() { + return featurePluralName; + } + + @JsonProperty("feature_singular_name") + public Optional getFeatureSingularName() { + return featureSingularName; + } + + @JsonProperty("feature_type") + public FeatureType getFeatureType() { + return featureType; + } + + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + + @JsonProperty("metered_monthly_price") + public Optional getMeteredMonthlyPrice() { + return meteredMonthlyPrice; + } + + @JsonProperty("metered_quarterly_price") + public Optional getMeteredQuarterlyPrice() { + return meteredQuarterlyPrice; + } + + @JsonProperty("metered_yearly_price") + public Optional getMeteredYearlyPrice() { + return meteredYearlyPrice; + } + + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + @JsonProperty("metric_period_month_reset") + public Optional getMetricPeriodMonthReset() { + return metricPeriodMonthReset; + } + + @JsonProperty("price_behavior") + public Optional getPriceBehavior() { + return priceBehavior; + } + + @JsonProperty("soft_limit") + public Optional getSoftLimit() { + return softLimit; + } + + @JsonProperty("value_bool") + public Optional getValueBool() { + return valueBool; + } + + @JsonProperty("value_numeric") + public Optional getValueNumeric() { + return valueNumeric; + } + + @JsonProperty("value_type") + public EntitlementValueType getValueType() { + return valueType; + } + + /** + * @return The default warning-tier value, when configured. + */ + @JsonProperty("warning_threshold") + public Optional getWarningThreshold() { + return warningThreshold; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogEntitlementResponseData && equalTo((CatalogEntitlementResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogEntitlementResponseData other) { + return consumptionRate.equals(other.consumptionRate) + && creditEquivalentLimit.equals(other.creditEquivalentLimit) + && creditIcon.equals(other.creditIcon) + && creditId.equals(other.creditId) + && creditName.equals(other.creditName) + && creditPluralName.equals(other.creditPluralName) + && creditSingularName.equals(other.creditSingularName) + && currencyPrices.equals(other.currencyPrices) + && featureDescription.equals(other.featureDescription) + && featureIcon.equals(other.featureIcon) + && featureId.equals(other.featureId) + && featureName.equals(other.featureName) + && featurePluralName.equals(other.featurePluralName) + && featureSingularName.equals(other.featureSingularName) + && featureType.equals(other.featureType) + && licenseId.equals(other.licenseId) + && meteredMonthlyPrice.equals(other.meteredMonthlyPrice) + && meteredQuarterlyPrice.equals(other.meteredQuarterlyPrice) + && meteredYearlyPrice.equals(other.meteredYearlyPrice) + && metricPeriod.equals(other.metricPeriod) + && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && priceBehavior.equals(other.priceBehavior) + && softLimit.equals(other.softLimit) + && valueBool.equals(other.valueBool) + && valueNumeric.equals(other.valueNumeric) + && valueType.equals(other.valueType) + && warningThreshold.equals(other.warningThreshold); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.consumptionRate, + this.creditEquivalentLimit, + this.creditIcon, + this.creditId, + this.creditName, + this.creditPluralName, + this.creditSingularName, + this.currencyPrices, + this.featureDescription, + this.featureIcon, + this.featureId, + this.featureName, + this.featurePluralName, + this.featureSingularName, + this.featureType, + this.licenseId, + this.meteredMonthlyPrice, + this.meteredQuarterlyPrice, + this.meteredYearlyPrice, + this.metricPeriod, + this.metricPeriodMonthReset, + this.priceBehavior, + this.softLimit, + this.valueBool, + this.valueNumeric, + this.valueType, + this.warningThreshold); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeatureDescriptionStage builder() { + return new Builder(); + } + + public interface FeatureDescriptionStage { + FeatureIconStage featureDescription(@NotNull String featureDescription); + + Builder from(CatalogEntitlementResponseData other); + } + + public interface FeatureIconStage { + FeatureIdStage featureIcon(@NotNull String featureIcon); + } + + public interface FeatureIdStage { + FeatureNameStage featureId(@NotNull String featureId); + } + + public interface FeatureNameStage { + FeatureTypeStage featureName(@NotNull String featureName); + } + + public interface FeatureTypeStage { + ValueTypeStage featureType(@NotNull FeatureType featureType); + } + + public interface ValueTypeStage { + _FinalStage valueType(@NotNull EntitlementValueType valueType); + } + + public interface _FinalStage { + CatalogEntitlementResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Credits consumed per unit of usage, for credit-burndown entitlements.

+ */ + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + + /** + *

How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license.

+ */ + _FinalStage creditEquivalentLimit(Optional creditEquivalentLimit); + + _FinalStage creditEquivalentLimit(Long creditEquivalentLimit); + + _FinalStage creditIcon(Optional creditIcon); + + _FinalStage creditIcon(String creditIcon); + + _FinalStage creditId(Optional creditId); + + _FinalStage creditId(String creditId); + + _FinalStage creditName(Optional creditName); + + _FinalStage creditName(String creditName); + + _FinalStage creditPluralName(Optional creditPluralName); + + _FinalStage creditPluralName(String creditPluralName); + + _FinalStage creditSingularName(Optional creditSingularName); + + _FinalStage creditSingularName(String creditSingularName); + + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(CatalogCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage featurePluralName(Optional featurePluralName); + + _FinalStage featurePluralName(String featurePluralName); + + _FinalStage featureSingularName(Optional featureSingularName); + + _FinalStage featureSingularName(String featureSingularName); + + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + + _FinalStage meteredMonthlyPrice(Optional meteredMonthlyPrice); + + _FinalStage meteredMonthlyPrice(CatalogPriceResponseData meteredMonthlyPrice); + + _FinalStage meteredQuarterlyPrice(Optional meteredQuarterlyPrice); + + _FinalStage meteredQuarterlyPrice(CatalogPriceResponseData meteredQuarterlyPrice); + + _FinalStage meteredYearlyPrice(Optional meteredYearlyPrice); + + _FinalStage meteredYearlyPrice(CatalogPriceResponseData meteredYearlyPrice); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(MetricPeriod metricPeriod); + + _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset(MetricPeriodMonthReset metricPeriodMonthReset); + + _FinalStage priceBehavior(Optional priceBehavior); + + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); + + _FinalStage softLimit(Optional softLimit); + + _FinalStage softLimit(Long softLimit); + + _FinalStage valueBool(Optional valueBool); + + _FinalStage valueBool(Boolean valueBool); + + _FinalStage valueNumeric(Optional valueNumeric); + + _FinalStage valueNumeric(Long valueNumeric); + + /** + *

The default warning-tier value, when configured.

+ */ + _FinalStage warningThreshold(Optional warningThreshold); + + _FinalStage warningThreshold(Long warningThreshold); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FeatureDescriptionStage, + FeatureIconStage, + FeatureIdStage, + FeatureNameStage, + FeatureTypeStage, + ValueTypeStage, + _FinalStage { + private String featureDescription; + + private String featureIcon; + + private String featureId; + + private String featureName; + + private FeatureType featureType; + + private EntitlementValueType valueType; + + private Optional warningThreshold = Optional.empty(); + + private Optional valueNumeric = Optional.empty(); + + private Optional valueBool = Optional.empty(); + + private Optional softLimit = Optional.empty(); + + private Optional priceBehavior = Optional.empty(); + + private Optional metricPeriodMonthReset = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional meteredYearlyPrice = Optional.empty(); + + private Optional meteredQuarterlyPrice = Optional.empty(); + + private Optional meteredMonthlyPrice = Optional.empty(); + + private Optional licenseId = Optional.empty(); + + private Optional featureSingularName = Optional.empty(); + + private Optional featurePluralName = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); + + private Optional creditSingularName = Optional.empty(); + + private Optional creditPluralName = Optional.empty(); + + private Optional creditName = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional creditIcon = Optional.empty(); + + private Optional creditEquivalentLimit = Optional.empty(); + + private Optional consumptionRate = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogEntitlementResponseData other) { + consumptionRate(other.getConsumptionRate()); + creditEquivalentLimit(other.getCreditEquivalentLimit()); + creditIcon(other.getCreditIcon()); + creditId(other.getCreditId()); + creditName(other.getCreditName()); + creditPluralName(other.getCreditPluralName()); + creditSingularName(other.getCreditSingularName()); + currencyPrices(other.getCurrencyPrices()); + featureDescription(other.getFeatureDescription()); + featureIcon(other.getFeatureIcon()); + featureId(other.getFeatureId()); + featureName(other.getFeatureName()); + featurePluralName(other.getFeaturePluralName()); + featureSingularName(other.getFeatureSingularName()); + featureType(other.getFeatureType()); + licenseId(other.getLicenseId()); + meteredMonthlyPrice(other.getMeteredMonthlyPrice()); + meteredQuarterlyPrice(other.getMeteredQuarterlyPrice()); + meteredYearlyPrice(other.getMeteredYearlyPrice()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + priceBehavior(other.getPriceBehavior()); + softLimit(other.getSoftLimit()); + valueBool(other.getValueBool()); + valueNumeric(other.getValueNumeric()); + valueType(other.getValueType()); + warningThreshold(other.getWarningThreshold()); + return this; + } + + @java.lang.Override + @JsonSetter("feature_description") + public FeatureIconStage featureDescription(@NotNull String featureDescription) { + this.featureDescription = Objects.requireNonNull(featureDescription, "featureDescription must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_icon") + public FeatureIdStage featureIcon(@NotNull String featureIcon) { + this.featureIcon = Objects.requireNonNull(featureIcon, "featureIcon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_id") + public FeatureNameStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_name") + public FeatureTypeStage featureName(@NotNull String featureName) { + this.featureName = Objects.requireNonNull(featureName, "featureName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_type") + public ValueTypeStage featureType(@NotNull FeatureType featureType) { + this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value_type") + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { + this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); + return this; + } + + /** + *

The default warning-tier value, when configured.

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

The default warning-tier value, when configured.

+ */ + @java.lang.Override + @JsonSetter(value = "warning_threshold", nulls = Nulls.SKIP) + public _FinalStage warningThreshold(Optional warningThreshold) { + this.warningThreshold = warningThreshold; + return this; + } + + @java.lang.Override + public _FinalStage valueNumeric(Long valueNumeric) { + this.valueNumeric = Optional.ofNullable(valueNumeric); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) + public _FinalStage valueNumeric(Optional valueNumeric) { + this.valueNumeric = valueNumeric; + return this; + } + + @java.lang.Override + public _FinalStage valueBool(Boolean valueBool) { + this.valueBool = Optional.ofNullable(valueBool); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value_bool", nulls = Nulls.SKIP) + public _FinalStage valueBool(Optional valueBool) { + this.valueBool = valueBool; + return this; + } + + @java.lang.Override + public _FinalStage softLimit(Long softLimit) { + this.softLimit = Optional.ofNullable(softLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) + public _FinalStage softLimit(Optional softLimit) { + this.softLimit = softLimit; + return this; + } + + @java.lang.Override + public _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior) { + this.priceBehavior = Optional.ofNullable(priceBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_behavior", nulls = Nulls.SKIP) + public _FinalStage priceBehavior(Optional priceBehavior) { + this.priceBehavior = priceBehavior; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriodMonthReset(MetricPeriodMonthReset metricPeriodMonthReset) { + this.metricPeriodMonthReset = Optional.ofNullable(metricPeriodMonthReset); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_period_month_reset", nulls = Nulls.SKIP) + public _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset) { + this.metricPeriodMonthReset = metricPeriodMonthReset; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriod(MetricPeriod metricPeriod) { + this.metricPeriod = Optional.ofNullable(metricPeriod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_period", nulls = Nulls.SKIP) + public _FinalStage metricPeriod(Optional metricPeriod) { + this.metricPeriod = metricPeriod; + return this; + } + + @java.lang.Override + public _FinalStage meteredYearlyPrice(CatalogPriceResponseData meteredYearlyPrice) { + this.meteredYearlyPrice = Optional.ofNullable(meteredYearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metered_yearly_price", nulls = Nulls.SKIP) + public _FinalStage meteredYearlyPrice(Optional meteredYearlyPrice) { + this.meteredYearlyPrice = meteredYearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage meteredQuarterlyPrice(CatalogPriceResponseData meteredQuarterlyPrice) { + this.meteredQuarterlyPrice = Optional.ofNullable(meteredQuarterlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metered_quarterly_price", nulls = Nulls.SKIP) + public _FinalStage meteredQuarterlyPrice(Optional meteredQuarterlyPrice) { + this.meteredQuarterlyPrice = meteredQuarterlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage meteredMonthlyPrice(CatalogPriceResponseData meteredMonthlyPrice) { + this.meteredMonthlyPrice = Optional.ofNullable(meteredMonthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metered_monthly_price", nulls = Nulls.SKIP) + public _FinalStage meteredMonthlyPrice(Optional meteredMonthlyPrice) { + this.meteredMonthlyPrice = meteredMonthlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage licenseId(String licenseId) { + this.licenseId = Optional.ofNullable(licenseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + + @java.lang.Override + public _FinalStage featureSingularName(String featureSingularName) { + this.featureSingularName = Optional.ofNullable(featureSingularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_singular_name", nulls = Nulls.SKIP) + public _FinalStage featureSingularName(Optional featureSingularName) { + this.featureSingularName = featureSingularName; + return this; + } + + @java.lang.Override + public _FinalStage featurePluralName(String featurePluralName) { + this.featurePluralName = Optional.ofNullable(featurePluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_plural_name", nulls = Nulls.SKIP) + public _FinalStage featurePluralName(Optional featurePluralName) { + this.featurePluralName = featurePluralName; + return this; + } + + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(CatalogCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage creditSingularName(String creditSingularName) { + this.creditSingularName = Optional.ofNullable(creditSingularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_singular_name", nulls = Nulls.SKIP) + public _FinalStage creditSingularName(Optional creditSingularName) { + this.creditSingularName = creditSingularName; + return this; + } + + @java.lang.Override + public _FinalStage creditPluralName(String creditPluralName) { + this.creditPluralName = Optional.ofNullable(creditPluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_plural_name", nulls = Nulls.SKIP) + public _FinalStage creditPluralName(Optional creditPluralName) { + this.creditPluralName = creditPluralName; + return this; + } + + @java.lang.Override + public _FinalStage creditName(String creditName) { + this.creditName = Optional.ofNullable(creditName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_name", nulls = Nulls.SKIP) + public _FinalStage creditName(Optional creditName) { + this.creditName = creditName; + return this; + } + + @java.lang.Override + public _FinalStage creditId(String creditId) { + this.creditId = Optional.ofNullable(creditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_id", nulls = Nulls.SKIP) + public _FinalStage creditId(Optional creditId) { + this.creditId = creditId; + return this; + } + + @java.lang.Override + public _FinalStage creditIcon(String creditIcon) { + this.creditIcon = Optional.ofNullable(creditIcon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_icon", nulls = Nulls.SKIP) + public _FinalStage creditIcon(Optional creditIcon) { + this.creditIcon = creditIcon; + return this; + } + + /** + *

How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license.

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

How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license.

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

Credits consumed per unit of usage, for credit-burndown entitlements.

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

Credits consumed per unit of usage, for credit-burndown entitlements.

+ */ + @java.lang.Override + @JsonSetter(value = "consumption_rate", nulls = Nulls.SKIP) + public _FinalStage consumptionRate(Optional consumptionRate) { + this.consumptionRate = consumptionRate; + return this; + } + + @java.lang.Override + public CatalogEntitlementResponseData build() { + return new CatalogEntitlementResponseData( + consumptionRate, + creditEquivalentLimit, + creditIcon, + creditId, + creditName, + creditPluralName, + creditSingularName, + currencyPrices, + featureDescription, + featureIcon, + featureId, + featureName, + featurePluralName, + featureSingularName, + featureType, + licenseId, + meteredMonthlyPrice, + meteredQuarterlyPrice, + meteredYearlyPrice, + metricPeriod, + metricPeriodMonthReset, + priceBehavior, + softLimit, + valueBool, + valueNumeric, + valueType, + warningThreshold, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("consumption_rate") + || key.equalsIgnoreCase("credit_equivalent_limit") + || key.equalsIgnoreCase("credit_icon") + || key.equalsIgnoreCase("credit_id") + || key.equalsIgnoreCase("credit_name") + || key.equalsIgnoreCase("credit_plural_name") + || key.equalsIgnoreCase("credit_singular_name") + || key.equalsIgnoreCase("currency_prices") + || key.equalsIgnoreCase("feature_description") + || key.equalsIgnoreCase("feature_icon") + || key.equalsIgnoreCase("feature_id") + || key.equalsIgnoreCase("feature_name") + || key.equalsIgnoreCase("feature_plural_name") + || key.equalsIgnoreCase("feature_singular_name") + || key.equalsIgnoreCase("feature_type") + || key.equalsIgnoreCase("license_id") + || key.equalsIgnoreCase("metered_monthly_price") + || key.equalsIgnoreCase("metered_quarterly_price") + || key.equalsIgnoreCase("metered_yearly_price") + || key.equalsIgnoreCase("metric_period") + || key.equalsIgnoreCase("metric_period_month_reset") + || key.equalsIgnoreCase("price_behavior") + || key.equalsIgnoreCase("soft_limit") + || key.equalsIgnoreCase("value_bool") + || key.equalsIgnoreCase("value_numeric") + || key.equalsIgnoreCase("value_type") + || key.equalsIgnoreCase("warning_threshold")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogPlanEntitlementResponseData.java b/src/main/java/com/schematic/api/types/CatalogPlanEntitlementResponseData.java new file mode 100644 index 00000000..42ea691a --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogPlanEntitlementResponseData.java @@ -0,0 +1,1050 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogPlanEntitlementResponseData.Builder.class) +public final class CatalogPlanEntitlementResponseData { + private final Optional consumptionRate; + + private final Optional creditEquivalentLimit; + + private final Optional creditIcon; + + private final Optional creditId; + + private final Optional creditName; + + private final Optional creditPluralName; + + private final Optional creditSingularName; + + private final List currencyPrices; + + private final String featureDescription; + + private final String featureIcon; + + private final String featureId; + + private final String featureName; + + private final Optional featurePluralName; + + private final Optional featureSingularName; + + private final FeatureType featureType; + + private final String id; + + private final Optional licenseId; + + private final Optional meteredMonthlyPrice; + + private final Optional meteredQuarterlyPrice; + + private final Optional meteredYearlyPrice; + + private final Optional metricPeriod; + + private final Optional metricPeriodMonthReset; + + private final Optional priceBehavior; + + private final Optional softLimit; + + private final Optional valueBool; + + private final Optional valueNumeric; + + private final EntitlementValueType valueType; + + private final Optional warningThreshold; + + private final Map additionalProperties; + + private CatalogPlanEntitlementResponseData( + Optional consumptionRate, + Optional creditEquivalentLimit, + Optional creditIcon, + Optional creditId, + Optional creditName, + Optional creditPluralName, + Optional creditSingularName, + List currencyPrices, + String featureDescription, + String featureIcon, + String featureId, + String featureName, + Optional featurePluralName, + Optional featureSingularName, + FeatureType featureType, + String id, + Optional licenseId, + Optional meteredMonthlyPrice, + Optional meteredQuarterlyPrice, + Optional meteredYearlyPrice, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional priceBehavior, + Optional softLimit, + Optional valueBool, + Optional valueNumeric, + EntitlementValueType valueType, + Optional warningThreshold, + Map additionalProperties) { + this.consumptionRate = consumptionRate; + this.creditEquivalentLimit = creditEquivalentLimit; + this.creditIcon = creditIcon; + this.creditId = creditId; + this.creditName = creditName; + this.creditPluralName = creditPluralName; + this.creditSingularName = creditSingularName; + this.currencyPrices = currencyPrices; + this.featureDescription = featureDescription; + this.featureIcon = featureIcon; + this.featureId = featureId; + this.featureName = featureName; + this.featurePluralName = featurePluralName; + this.featureSingularName = featureSingularName; + this.featureType = featureType; + this.id = id; + this.licenseId = licenseId; + this.meteredMonthlyPrice = meteredMonthlyPrice; + this.meteredQuarterlyPrice = meteredQuarterlyPrice; + this.meteredYearlyPrice = meteredYearlyPrice; + this.metricPeriod = metricPeriod; + this.metricPeriodMonthReset = metricPeriodMonthReset; + this.priceBehavior = priceBehavior; + this.softLimit = softLimit; + this.valueBool = valueBool; + this.valueNumeric = valueNumeric; + this.valueType = valueType; + this.warningThreshold = warningThreshold; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credits consumed per unit of usage, for credit-burndown entitlements. + */ + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + + /** + * @return How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license. + */ + @JsonProperty("credit_equivalent_limit") + public Optional getCreditEquivalentLimit() { + return creditEquivalentLimit; + } + + @JsonProperty("credit_icon") + public Optional getCreditIcon() { + return creditIcon; + } + + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + @JsonProperty("credit_name") + public Optional getCreditName() { + return creditName; + } + + @JsonProperty("credit_plural_name") + public Optional getCreditPluralName() { + return creditPluralName; + } + + @JsonProperty("credit_singular_name") + public Optional getCreditSingularName() { + return creditSingularName; + } + + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + + @JsonProperty("feature_description") + public String getFeatureDescription() { + return featureDescription; + } + + @JsonProperty("feature_icon") + public String getFeatureIcon() { + return featureIcon; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + @JsonProperty("feature_name") + public String getFeatureName() { + return featureName; + } + + @JsonProperty("feature_plural_name") + public Optional getFeaturePluralName() { + return featurePluralName; + } + + @JsonProperty("feature_singular_name") + public Optional getFeatureSingularName() { + return featureSingularName; + } + + @JsonProperty("feature_type") + public FeatureType getFeatureType() { + return featureType; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("license_id") + public Optional getLicenseId() { + return licenseId; + } + + @JsonProperty("metered_monthly_price") + public Optional getMeteredMonthlyPrice() { + return meteredMonthlyPrice; + } + + @JsonProperty("metered_quarterly_price") + public Optional getMeteredQuarterlyPrice() { + return meteredQuarterlyPrice; + } + + @JsonProperty("metered_yearly_price") + public Optional getMeteredYearlyPrice() { + return meteredYearlyPrice; + } + + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + @JsonProperty("metric_period_month_reset") + public Optional getMetricPeriodMonthReset() { + return metricPeriodMonthReset; + } + + @JsonProperty("price_behavior") + public Optional getPriceBehavior() { + return priceBehavior; + } + + @JsonProperty("soft_limit") + public Optional getSoftLimit() { + return softLimit; + } + + @JsonProperty("value_bool") + public Optional getValueBool() { + return valueBool; + } + + @JsonProperty("value_numeric") + public Optional getValueNumeric() { + return valueNumeric; + } + + @JsonProperty("value_type") + public EntitlementValueType getValueType() { + return valueType; + } + + /** + * @return The default warning-tier value, when configured. + */ + @JsonProperty("warning_threshold") + public Optional getWarningThreshold() { + return warningThreshold; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogPlanEntitlementResponseData + && equalTo((CatalogPlanEntitlementResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogPlanEntitlementResponseData other) { + return consumptionRate.equals(other.consumptionRate) + && creditEquivalentLimit.equals(other.creditEquivalentLimit) + && creditIcon.equals(other.creditIcon) + && creditId.equals(other.creditId) + && creditName.equals(other.creditName) + && creditPluralName.equals(other.creditPluralName) + && creditSingularName.equals(other.creditSingularName) + && currencyPrices.equals(other.currencyPrices) + && featureDescription.equals(other.featureDescription) + && featureIcon.equals(other.featureIcon) + && featureId.equals(other.featureId) + && featureName.equals(other.featureName) + && featurePluralName.equals(other.featurePluralName) + && featureSingularName.equals(other.featureSingularName) + && featureType.equals(other.featureType) + && id.equals(other.id) + && licenseId.equals(other.licenseId) + && meteredMonthlyPrice.equals(other.meteredMonthlyPrice) + && meteredQuarterlyPrice.equals(other.meteredQuarterlyPrice) + && meteredYearlyPrice.equals(other.meteredYearlyPrice) + && metricPeriod.equals(other.metricPeriod) + && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && priceBehavior.equals(other.priceBehavior) + && softLimit.equals(other.softLimit) + && valueBool.equals(other.valueBool) + && valueNumeric.equals(other.valueNumeric) + && valueType.equals(other.valueType) + && warningThreshold.equals(other.warningThreshold); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.consumptionRate, + this.creditEquivalentLimit, + this.creditIcon, + this.creditId, + this.creditName, + this.creditPluralName, + this.creditSingularName, + this.currencyPrices, + this.featureDescription, + this.featureIcon, + this.featureId, + this.featureName, + this.featurePluralName, + this.featureSingularName, + this.featureType, + this.id, + this.licenseId, + this.meteredMonthlyPrice, + this.meteredQuarterlyPrice, + this.meteredYearlyPrice, + this.metricPeriod, + this.metricPeriodMonthReset, + this.priceBehavior, + this.softLimit, + this.valueBool, + this.valueNumeric, + this.valueType, + this.warningThreshold); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeatureDescriptionStage builder() { + return new Builder(); + } + + public interface FeatureDescriptionStage { + FeatureIconStage featureDescription(@NotNull String featureDescription); + + Builder from(CatalogPlanEntitlementResponseData other); + } + + public interface FeatureIconStage { + FeatureIdStage featureIcon(@NotNull String featureIcon); + } + + public interface FeatureIdStage { + FeatureNameStage featureId(@NotNull String featureId); + } + + public interface FeatureNameStage { + FeatureTypeStage featureName(@NotNull String featureName); + } + + public interface FeatureTypeStage { + IdStage featureType(@NotNull FeatureType featureType); + } + + public interface IdStage { + ValueTypeStage id(@NotNull String id); + } + + public interface ValueTypeStage { + _FinalStage valueType(@NotNull EntitlementValueType valueType); + } + + public interface _FinalStage { + CatalogPlanEntitlementResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Credits consumed per unit of usage, for credit-burndown entitlements.

+ */ + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + + /** + *

How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license.

+ */ + _FinalStage creditEquivalentLimit(Optional creditEquivalentLimit); + + _FinalStage creditEquivalentLimit(Long creditEquivalentLimit); + + _FinalStage creditIcon(Optional creditIcon); + + _FinalStage creditIcon(String creditIcon); + + _FinalStage creditId(Optional creditId); + + _FinalStage creditId(String creditId); + + _FinalStage creditName(Optional creditName); + + _FinalStage creditName(String creditName); + + _FinalStage creditPluralName(Optional creditPluralName); + + _FinalStage creditPluralName(String creditPluralName); + + _FinalStage creditSingularName(Optional creditSingularName); + + _FinalStage creditSingularName(String creditSingularName); + + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(CatalogCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage featurePluralName(Optional featurePluralName); + + _FinalStage featurePluralName(String featurePluralName); + + _FinalStage featureSingularName(Optional featureSingularName); + + _FinalStage featureSingularName(String featureSingularName); + + _FinalStage licenseId(Optional licenseId); + + _FinalStage licenseId(String licenseId); + + _FinalStage meteredMonthlyPrice(Optional meteredMonthlyPrice); + + _FinalStage meteredMonthlyPrice(CatalogPriceResponseData meteredMonthlyPrice); + + _FinalStage meteredQuarterlyPrice(Optional meteredQuarterlyPrice); + + _FinalStage meteredQuarterlyPrice(CatalogPriceResponseData meteredQuarterlyPrice); + + _FinalStage meteredYearlyPrice(Optional meteredYearlyPrice); + + _FinalStage meteredYearlyPrice(CatalogPriceResponseData meteredYearlyPrice); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(MetricPeriod metricPeriod); + + _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset(MetricPeriodMonthReset metricPeriodMonthReset); + + _FinalStage priceBehavior(Optional priceBehavior); + + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); + + _FinalStage softLimit(Optional softLimit); + + _FinalStage softLimit(Long softLimit); + + _FinalStage valueBool(Optional valueBool); + + _FinalStage valueBool(Boolean valueBool); + + _FinalStage valueNumeric(Optional valueNumeric); + + _FinalStage valueNumeric(Long valueNumeric); + + /** + *

The default warning-tier value, when configured.

+ */ + _FinalStage warningThreshold(Optional warningThreshold); + + _FinalStage warningThreshold(Long warningThreshold); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements FeatureDescriptionStage, + FeatureIconStage, + FeatureIdStage, + FeatureNameStage, + FeatureTypeStage, + IdStage, + ValueTypeStage, + _FinalStage { + private String featureDescription; + + private String featureIcon; + + private String featureId; + + private String featureName; + + private FeatureType featureType; + + private String id; + + private EntitlementValueType valueType; + + private Optional warningThreshold = Optional.empty(); + + private Optional valueNumeric = Optional.empty(); + + private Optional valueBool = Optional.empty(); + + private Optional softLimit = Optional.empty(); + + private Optional priceBehavior = Optional.empty(); + + private Optional metricPeriodMonthReset = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional meteredYearlyPrice = Optional.empty(); + + private Optional meteredQuarterlyPrice = Optional.empty(); + + private Optional meteredMonthlyPrice = Optional.empty(); + + private Optional licenseId = Optional.empty(); + + private Optional featureSingularName = Optional.empty(); + + private Optional featurePluralName = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); + + private Optional creditSingularName = Optional.empty(); + + private Optional creditPluralName = Optional.empty(); + + private Optional creditName = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional creditIcon = Optional.empty(); + + private Optional creditEquivalentLimit = Optional.empty(); + + private Optional consumptionRate = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogPlanEntitlementResponseData other) { + consumptionRate(other.getConsumptionRate()); + creditEquivalentLimit(other.getCreditEquivalentLimit()); + creditIcon(other.getCreditIcon()); + creditId(other.getCreditId()); + creditName(other.getCreditName()); + creditPluralName(other.getCreditPluralName()); + creditSingularName(other.getCreditSingularName()); + currencyPrices(other.getCurrencyPrices()); + featureDescription(other.getFeatureDescription()); + featureIcon(other.getFeatureIcon()); + featureId(other.getFeatureId()); + featureName(other.getFeatureName()); + featurePluralName(other.getFeaturePluralName()); + featureSingularName(other.getFeatureSingularName()); + featureType(other.getFeatureType()); + id(other.getId()); + licenseId(other.getLicenseId()); + meteredMonthlyPrice(other.getMeteredMonthlyPrice()); + meteredQuarterlyPrice(other.getMeteredQuarterlyPrice()); + meteredYearlyPrice(other.getMeteredYearlyPrice()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + priceBehavior(other.getPriceBehavior()); + softLimit(other.getSoftLimit()); + valueBool(other.getValueBool()); + valueNumeric(other.getValueNumeric()); + valueType(other.getValueType()); + warningThreshold(other.getWarningThreshold()); + return this; + } + + @java.lang.Override + @JsonSetter("feature_description") + public FeatureIconStage featureDescription(@NotNull String featureDescription) { + this.featureDescription = Objects.requireNonNull(featureDescription, "featureDescription must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_icon") + public FeatureIdStage featureIcon(@NotNull String featureIcon) { + this.featureIcon = Objects.requireNonNull(featureIcon, "featureIcon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_id") + public FeatureNameStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_name") + public FeatureTypeStage featureName(@NotNull String featureName) { + this.featureName = Objects.requireNonNull(featureName, "featureName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_type") + public IdStage featureType(@NotNull FeatureType featureType) { + this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ValueTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value_type") + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { + this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); + return this; + } + + /** + *

The default warning-tier value, when configured.

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

The default warning-tier value, when configured.

+ */ + @java.lang.Override + @JsonSetter(value = "warning_threshold", nulls = Nulls.SKIP) + public _FinalStage warningThreshold(Optional warningThreshold) { + this.warningThreshold = warningThreshold; + return this; + } + + @java.lang.Override + public _FinalStage valueNumeric(Long valueNumeric) { + this.valueNumeric = Optional.ofNullable(valueNumeric); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) + public _FinalStage valueNumeric(Optional valueNumeric) { + this.valueNumeric = valueNumeric; + return this; + } + + @java.lang.Override + public _FinalStage valueBool(Boolean valueBool) { + this.valueBool = Optional.ofNullable(valueBool); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value_bool", nulls = Nulls.SKIP) + public _FinalStage valueBool(Optional valueBool) { + this.valueBool = valueBool; + return this; + } + + @java.lang.Override + public _FinalStage softLimit(Long softLimit) { + this.softLimit = Optional.ofNullable(softLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) + public _FinalStage softLimit(Optional softLimit) { + this.softLimit = softLimit; + return this; + } + + @java.lang.Override + public _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior) { + this.priceBehavior = Optional.ofNullable(priceBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_behavior", nulls = Nulls.SKIP) + public _FinalStage priceBehavior(Optional priceBehavior) { + this.priceBehavior = priceBehavior; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriodMonthReset(MetricPeriodMonthReset metricPeriodMonthReset) { + this.metricPeriodMonthReset = Optional.ofNullable(metricPeriodMonthReset); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_period_month_reset", nulls = Nulls.SKIP) + public _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset) { + this.metricPeriodMonthReset = metricPeriodMonthReset; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriod(MetricPeriod metricPeriod) { + this.metricPeriod = Optional.ofNullable(metricPeriod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_period", nulls = Nulls.SKIP) + public _FinalStage metricPeriod(Optional metricPeriod) { + this.metricPeriod = metricPeriod; + return this; + } + + @java.lang.Override + public _FinalStage meteredYearlyPrice(CatalogPriceResponseData meteredYearlyPrice) { + this.meteredYearlyPrice = Optional.ofNullable(meteredYearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metered_yearly_price", nulls = Nulls.SKIP) + public _FinalStage meteredYearlyPrice(Optional meteredYearlyPrice) { + this.meteredYearlyPrice = meteredYearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage meteredQuarterlyPrice(CatalogPriceResponseData meteredQuarterlyPrice) { + this.meteredQuarterlyPrice = Optional.ofNullable(meteredQuarterlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metered_quarterly_price", nulls = Nulls.SKIP) + public _FinalStage meteredQuarterlyPrice(Optional meteredQuarterlyPrice) { + this.meteredQuarterlyPrice = meteredQuarterlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage meteredMonthlyPrice(CatalogPriceResponseData meteredMonthlyPrice) { + this.meteredMonthlyPrice = Optional.ofNullable(meteredMonthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metered_monthly_price", nulls = Nulls.SKIP) + public _FinalStage meteredMonthlyPrice(Optional meteredMonthlyPrice) { + this.meteredMonthlyPrice = meteredMonthlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage licenseId(String licenseId) { + this.licenseId = Optional.ofNullable(licenseId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "license_id", nulls = Nulls.SKIP) + public _FinalStage licenseId(Optional licenseId) { + this.licenseId = licenseId; + return this; + } + + @java.lang.Override + public _FinalStage featureSingularName(String featureSingularName) { + this.featureSingularName = Optional.ofNullable(featureSingularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_singular_name", nulls = Nulls.SKIP) + public _FinalStage featureSingularName(Optional featureSingularName) { + this.featureSingularName = featureSingularName; + return this; + } + + @java.lang.Override + public _FinalStage featurePluralName(String featurePluralName) { + this.featurePluralName = Optional.ofNullable(featurePluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_plural_name", nulls = Nulls.SKIP) + public _FinalStage featurePluralName(Optional featurePluralName) { + this.featurePluralName = featurePluralName; + return this; + } + + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(CatalogCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage creditSingularName(String creditSingularName) { + this.creditSingularName = Optional.ofNullable(creditSingularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_singular_name", nulls = Nulls.SKIP) + public _FinalStage creditSingularName(Optional creditSingularName) { + this.creditSingularName = creditSingularName; + return this; + } + + @java.lang.Override + public _FinalStage creditPluralName(String creditPluralName) { + this.creditPluralName = Optional.ofNullable(creditPluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_plural_name", nulls = Nulls.SKIP) + public _FinalStage creditPluralName(Optional creditPluralName) { + this.creditPluralName = creditPluralName; + return this; + } + + @java.lang.Override + public _FinalStage creditName(String creditName) { + this.creditName = Optional.ofNullable(creditName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_name", nulls = Nulls.SKIP) + public _FinalStage creditName(Optional creditName) { + this.creditName = creditName; + return this; + } + + @java.lang.Override + public _FinalStage creditId(String creditId) { + this.creditId = Optional.ofNullable(creditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_id", nulls = Nulls.SKIP) + public _FinalStage creditId(Optional creditId) { + this.creditId = creditId; + return this; + } + + @java.lang.Override + public _FinalStage creditIcon(String creditIcon) { + this.creditIcon = Optional.ofNullable(creditIcon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_icon", nulls = Nulls.SKIP) + public _FinalStage creditIcon(Optional creditIcon) { + this.creditIcon = creditIcon; + return this; + } + + /** + *

How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license.

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

How many units of usage the plan's fixed included credit grants cover (⌊granted credits ÷ consumption rate⌋). Null when there is no fixed grant or the grant scales per license.

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

Credits consumed per unit of usage, for credit-burndown entitlements.

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

Credits consumed per unit of usage, for credit-burndown entitlements.

+ */ + @java.lang.Override + @JsonSetter(value = "consumption_rate", nulls = Nulls.SKIP) + public _FinalStage consumptionRate(Optional consumptionRate) { + this.consumptionRate = consumptionRate; + return this; + } + + @java.lang.Override + public CatalogPlanEntitlementResponseData build() { + return new CatalogPlanEntitlementResponseData( + consumptionRate, + creditEquivalentLimit, + creditIcon, + creditId, + creditName, + creditPluralName, + creditSingularName, + currencyPrices, + featureDescription, + featureIcon, + featureId, + featureName, + featurePluralName, + featureSingularName, + featureType, + id, + licenseId, + meteredMonthlyPrice, + meteredQuarterlyPrice, + meteredYearlyPrice, + metricPeriod, + metricPeriodMonthReset, + priceBehavior, + softLimit, + valueBool, + valueNumeric, + valueType, + warningThreshold, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("consumption_rate") + || key.equalsIgnoreCase("credit_equivalent_limit") + || key.equalsIgnoreCase("credit_icon") + || key.equalsIgnoreCase("credit_id") + || key.equalsIgnoreCase("credit_name") + || key.equalsIgnoreCase("credit_plural_name") + || key.equalsIgnoreCase("credit_singular_name") + || key.equalsIgnoreCase("currency_prices") + || key.equalsIgnoreCase("feature_description") + || key.equalsIgnoreCase("feature_icon") + || key.equalsIgnoreCase("feature_id") + || key.equalsIgnoreCase("feature_name") + || key.equalsIgnoreCase("feature_plural_name") + || key.equalsIgnoreCase("feature_singular_name") + || key.equalsIgnoreCase("feature_type") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("license_id") + || key.equalsIgnoreCase("metered_monthly_price") + || key.equalsIgnoreCase("metered_quarterly_price") + || key.equalsIgnoreCase("metered_yearly_price") + || key.equalsIgnoreCase("metric_period") + || key.equalsIgnoreCase("metric_period_month_reset") + || key.equalsIgnoreCase("price_behavior") + || key.equalsIgnoreCase("soft_limit") + || key.equalsIgnoreCase("value_bool") + || key.equalsIgnoreCase("value_numeric") + || key.equalsIgnoreCase("value_type") + || key.equalsIgnoreCase("warning_threshold")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogPlanResponseData.java b/src/main/java/com/schematic/api/types/CatalogPlanResponseData.java new file mode 100644 index 00000000..b553fc66 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogPlanResponseData.java @@ -0,0 +1,699 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogPlanResponseData.Builder.class) +public final class CatalogPlanResponseData { + private final List availablePeriods; + + private final BillingStrategy billingStrategy; + + private final ChargeType chargeType; + + private final Optional> compatiblePlanIds; + + private final List currencyPrices; + + private final String description; + + private final List entitlements; + + private final String icon; + + private final String id; + + private final List includedCreditGrants; + + private final boolean isTrialable; + + private final Optional monthlyPrice; + + private final String name; + + private final Optional oneTimePrice; + + private final Optional quarterlyPrice; + + private final Optional trialDays; + + private final Optional yearlyPrice; + + private final Map additionalProperties; + + private CatalogPlanResponseData( + List availablePeriods, + BillingStrategy billingStrategy, + ChargeType chargeType, + Optional> compatiblePlanIds, + List currencyPrices, + String description, + List entitlements, + String icon, + String id, + List includedCreditGrants, + boolean isTrialable, + Optional monthlyPrice, + String name, + Optional oneTimePrice, + Optional quarterlyPrice, + Optional trialDays, + Optional yearlyPrice, + Map additionalProperties) { + this.availablePeriods = availablePeriods; + this.billingStrategy = billingStrategy; + this.chargeType = chargeType; + this.compatiblePlanIds = compatiblePlanIds; + this.currencyPrices = currencyPrices; + this.description = description; + this.entitlements = entitlements; + this.icon = icon; + this.id = id; + this.includedCreditGrants = includedCreditGrants; + this.isTrialable = isTrialable; + this.monthlyPrice = monthlyPrice; + this.name = name; + this.oneTimePrice = oneTimePrice; + this.quarterlyPrice = quarterlyPrice; + this.trialDays = trialDays; + this.yearlyPrice = yearlyPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("available_periods") + public List getAvailablePeriods() { + return availablePeriods; + } + + @JsonProperty("billing_strategy") + public BillingStrategy getBillingStrategy() { + return billingStrategy; + } + + @JsonProperty("charge_type") + public ChargeType getChargeType() { + return chargeType; + } + + /** + * @return For add-ons, the plans this add-on may be purchased with. Null means compatible with every plan. + */ + @JsonProperty("compatible_plan_ids") + public Optional> getCompatiblePlanIds() { + return compatiblePlanIds; + } + + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + + @JsonProperty("icon") + public String getIcon() { + return icon; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("included_credit_grants") + public List getIncludedCreditGrants() { + return includedCreditGrants; + } + + @JsonProperty("is_trialable") + public boolean getIsTrialable() { + return isTrialable; + } + + @JsonProperty("monthly_price") + public Optional getMonthlyPrice() { + return monthlyPrice; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("one_time_price") + public Optional getOneTimePrice() { + return oneTimePrice; + } + + @JsonProperty("quarterly_price") + public Optional getQuarterlyPrice() { + return quarterlyPrice; + } + + @JsonProperty("trial_days") + public Optional getTrialDays() { + return trialDays; + } + + @JsonProperty("yearly_price") + public Optional getYearlyPrice() { + return yearlyPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogPlanResponseData && equalTo((CatalogPlanResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogPlanResponseData other) { + return availablePeriods.equals(other.availablePeriods) + && billingStrategy.equals(other.billingStrategy) + && chargeType.equals(other.chargeType) + && compatiblePlanIds.equals(other.compatiblePlanIds) + && currencyPrices.equals(other.currencyPrices) + && description.equals(other.description) + && entitlements.equals(other.entitlements) + && icon.equals(other.icon) + && id.equals(other.id) + && includedCreditGrants.equals(other.includedCreditGrants) + && isTrialable == other.isTrialable + && monthlyPrice.equals(other.monthlyPrice) + && name.equals(other.name) + && oneTimePrice.equals(other.oneTimePrice) + && quarterlyPrice.equals(other.quarterlyPrice) + && trialDays.equals(other.trialDays) + && yearlyPrice.equals(other.yearlyPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.availablePeriods, + this.billingStrategy, + this.chargeType, + this.compatiblePlanIds, + this.currencyPrices, + this.description, + this.entitlements, + this.icon, + this.id, + this.includedCreditGrants, + this.isTrialable, + this.monthlyPrice, + this.name, + this.oneTimePrice, + this.quarterlyPrice, + this.trialDays, + this.yearlyPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BillingStrategyStage builder() { + return new Builder(); + } + + public interface BillingStrategyStage { + ChargeTypeStage billingStrategy(@NotNull BillingStrategy billingStrategy); + + Builder from(CatalogPlanResponseData other); + } + + public interface ChargeTypeStage { + DescriptionStage chargeType(@NotNull ChargeType chargeType); + } + + public interface DescriptionStage { + IconStage description(@NotNull String description); + } + + public interface IconStage { + IdStage icon(@NotNull String icon); + } + + public interface IdStage { + IsTrialableStage id(@NotNull String id); + } + + public interface IsTrialableStage { + NameStage isTrialable(boolean isTrialable); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CatalogPlanResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage availablePeriods(List availablePeriods); + + _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods); + + _FinalStage addAllAvailablePeriods(List availablePeriods); + + /** + *

For add-ons, the plans this add-on may be purchased with. Null means compatible with every plan.

+ */ + _FinalStage compatiblePlanIds(Optional> compatiblePlanIds); + + _FinalStage compatiblePlanIds(List compatiblePlanIds); + + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(CatalogCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(CatalogPlanEntitlementResponseData entitlements); + + _FinalStage addAllEntitlements(List entitlements); + + _FinalStage includedCreditGrants(List includedCreditGrants); + + _FinalStage addIncludedCreditGrants(CatalogCreditGrantResponseData includedCreditGrants); + + _FinalStage addAllIncludedCreditGrants(List includedCreditGrants); + + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(CatalogPriceResponseData monthlyPrice); + + _FinalStage oneTimePrice(Optional oneTimePrice); + + _FinalStage oneTimePrice(CatalogPriceResponseData oneTimePrice); + + _FinalStage quarterlyPrice(Optional quarterlyPrice); + + _FinalStage quarterlyPrice(CatalogPriceResponseData quarterlyPrice); + + _FinalStage trialDays(Optional trialDays); + + _FinalStage trialDays(Long trialDays); + + _FinalStage yearlyPrice(Optional yearlyPrice); + + _FinalStage yearlyPrice(CatalogPriceResponseData yearlyPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BillingStrategyStage, + ChargeTypeStage, + DescriptionStage, + IconStage, + IdStage, + IsTrialableStage, + NameStage, + _FinalStage { + private BillingStrategy billingStrategy; + + private ChargeType chargeType; + + private String description; + + private String icon; + + private String id; + + private boolean isTrialable; + + private String name; + + private Optional yearlyPrice = Optional.empty(); + + private Optional trialDays = Optional.empty(); + + private Optional quarterlyPrice = Optional.empty(); + + private Optional oneTimePrice = Optional.empty(); + + private Optional monthlyPrice = Optional.empty(); + + private List includedCreditGrants = new ArrayList<>(); + + private List entitlements = new ArrayList<>(); + + private List currencyPrices = new ArrayList<>(); + + private Optional> compatiblePlanIds = Optional.empty(); + + private List availablePeriods = new ArrayList<>(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogPlanResponseData other) { + availablePeriods(other.getAvailablePeriods()); + billingStrategy(other.getBillingStrategy()); + chargeType(other.getChargeType()); + compatiblePlanIds(other.getCompatiblePlanIds()); + currencyPrices(other.getCurrencyPrices()); + description(other.getDescription()); + entitlements(other.getEntitlements()); + icon(other.getIcon()); + id(other.getId()); + includedCreditGrants(other.getIncludedCreditGrants()); + isTrialable(other.getIsTrialable()); + monthlyPrice(other.getMonthlyPrice()); + name(other.getName()); + oneTimePrice(other.getOneTimePrice()); + quarterlyPrice(other.getQuarterlyPrice()); + trialDays(other.getTrialDays()); + yearlyPrice(other.getYearlyPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("billing_strategy") + public ChargeTypeStage billingStrategy(@NotNull BillingStrategy billingStrategy) { + this.billingStrategy = Objects.requireNonNull(billingStrategy, "billingStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("charge_type") + public DescriptionStage chargeType(@NotNull ChargeType chargeType) { + this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("description") + public IconStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull String icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IsTrialableStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_trialable") + public NameStage isTrialable(boolean isTrialable) { + this.isTrialable = isTrialable; + return this; + } + + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage yearlyPrice(CatalogPriceResponseData yearlyPrice) { + this.yearlyPrice = Optional.ofNullable(yearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) + public _FinalStage yearlyPrice(Optional yearlyPrice) { + this.yearlyPrice = yearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage trialDays(Long trialDays) { + this.trialDays = Optional.ofNullable(trialDays); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) + public _FinalStage trialDays(Optional trialDays) { + this.trialDays = trialDays; + return this; + } + + @java.lang.Override + public _FinalStage quarterlyPrice(CatalogPriceResponseData quarterlyPrice) { + this.quarterlyPrice = Optional.ofNullable(quarterlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "quarterly_price", nulls = Nulls.SKIP) + public _FinalStage quarterlyPrice(Optional quarterlyPrice) { + this.quarterlyPrice = quarterlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage oneTimePrice(CatalogPriceResponseData oneTimePrice) { + this.oneTimePrice = Optional.ofNullable(oneTimePrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "one_time_price", nulls = Nulls.SKIP) + public _FinalStage oneTimePrice(Optional oneTimePrice) { + this.oneTimePrice = oneTimePrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPrice(CatalogPriceResponseData monthlyPrice) { + this.monthlyPrice = Optional.ofNullable(monthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) + public _FinalStage monthlyPrice(Optional monthlyPrice) { + this.monthlyPrice = monthlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage addAllIncludedCreditGrants(List includedCreditGrants) { + if (includedCreditGrants != null) { + this.includedCreditGrants.addAll(includedCreditGrants); + } + return this; + } + + @java.lang.Override + public _FinalStage addIncludedCreditGrants(CatalogCreditGrantResponseData includedCreditGrants) { + this.includedCreditGrants.add(includedCreditGrants); + return this; + } + + @java.lang.Override + @JsonSetter(value = "included_credit_grants", nulls = Nulls.SKIP) + public _FinalStage includedCreditGrants(List includedCreditGrants) { + this.includedCreditGrants.clear(); + if (includedCreditGrants != null) { + this.includedCreditGrants.addAll(includedCreditGrants); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @java.lang.Override + public _FinalStage addEntitlements(CatalogPlanEntitlementResponseData entitlements) { + this.entitlements.add(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(List entitlements) { + this.entitlements.clear(); + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(CatalogCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + /** + *

For add-ons, the plans this add-on may be purchased with. Null means compatible with every plan.

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

For add-ons, the plans this add-on may be purchased with. Null means compatible with every plan.

+ */ + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(Optional> compatiblePlanIds) { + this.compatiblePlanIds = compatiblePlanIds; + return this; + } + + @java.lang.Override + public _FinalStage addAllAvailablePeriods(List availablePeriods) { + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + + @java.lang.Override + public _FinalStage addAvailablePeriods(PlanPriceCadence availablePeriods) { + this.availablePeriods.add(availablePeriods); + return this; + } + + @java.lang.Override + @JsonSetter(value = "available_periods", nulls = Nulls.SKIP) + public _FinalStage availablePeriods(List availablePeriods) { + this.availablePeriods.clear(); + if (availablePeriods != null) { + this.availablePeriods.addAll(availablePeriods); + } + return this; + } + + @java.lang.Override + public CatalogPlanResponseData build() { + return new CatalogPlanResponseData( + availablePeriods, + billingStrategy, + chargeType, + compatiblePlanIds, + currencyPrices, + description, + entitlements, + icon, + id, + includedCreditGrants, + isTrialable, + monthlyPrice, + name, + oneTimePrice, + quarterlyPrice, + trialDays, + yearlyPrice, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("available_periods") + || key.equalsIgnoreCase("billing_strategy") + || key.equalsIgnoreCase("charge_type") + || key.equalsIgnoreCase("compatible_plan_ids") + || key.equalsIgnoreCase("currency_prices") + || key.equalsIgnoreCase("description") + || key.equalsIgnoreCase("entitlements") + || key.equalsIgnoreCase("icon") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("included_credit_grants") + || key.equalsIgnoreCase("is_trialable") + || key.equalsIgnoreCase("monthly_price") + || key.equalsIgnoreCase("name") + || key.equalsIgnoreCase("one_time_price") + || key.equalsIgnoreCase("quarterly_price") + || key.equalsIgnoreCase("trial_days") + || key.equalsIgnoreCase("yearly_price")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogPriceResponseData.java b/src/main/java/com/schematic/api/types/CatalogPriceResponseData.java new file mode 100644 index 00000000..c8590e56 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogPriceResponseData.java @@ -0,0 +1,472 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogPriceResponseData.Builder.class) +public final class CatalogPriceResponseData { + private final Currency currency; + + private final String id; + + private final BillingProductPriceInterval interval; + + private final long intervalCount; + + private final Optional overageUnitPriceDecimal; + + private final long packageSize; + + private final long price; + + private final Optional priceDecimal; + + private final List priceTiers; + + private final BillingPriceScheme scheme; + + private final Optional tiersMode; + + private final Map additionalProperties; + + private CatalogPriceResponseData( + Currency currency, + String id, + BillingProductPriceInterval interval, + long intervalCount, + Optional overageUnitPriceDecimal, + long packageSize, + long price, + Optional priceDecimal, + List priceTiers, + BillingPriceScheme scheme, + Optional tiersMode, + Map additionalProperties) { + this.currency = currency; + this.id = id; + this.interval = interval; + this.intervalCount = intervalCount; + this.overageUnitPriceDecimal = overageUnitPriceDecimal; + this.packageSize = packageSize; + this.price = price; + this.priceDecimal = priceDecimal; + this.priceTiers = priceTiers; + this.scheme = scheme; + this.tiersMode = tiersMode; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public Currency getCurrency() { + return currency; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("interval") + public BillingProductPriceInterval getInterval() { + return interval; + } + + @JsonProperty("interval_count") + public long getIntervalCount() { + return intervalCount; + } + + /** + * @return Per-unit price of the final tier, precomputed for overage display. + */ + @JsonProperty("overage_unit_price_decimal") + public Optional getOverageUnitPriceDecimal() { + return overageUnitPriceDecimal; + } + + /** + * @return Units covered per priced package; a price of $10 with package_size 1000 charges $10 per 1000 units. + */ + @JsonProperty("package_size") + public long getPackageSize() { + return packageSize; + } + + @JsonProperty("price") + public long getPrice() { + return price; + } + + @JsonProperty("price_decimal") + public Optional getPriceDecimal() { + return priceDecimal; + } + + @JsonProperty("price_tiers") + public List getPriceTiers() { + return priceTiers; + } + + @JsonProperty("scheme") + public BillingPriceScheme getScheme() { + return scheme; + } + + @JsonProperty("tiers_mode") + public Optional getTiersMode() { + return tiersMode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogPriceResponseData && equalTo((CatalogPriceResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogPriceResponseData other) { + return currency.equals(other.currency) + && id.equals(other.id) + && interval.equals(other.interval) + && intervalCount == other.intervalCount + && overageUnitPriceDecimal.equals(other.overageUnitPriceDecimal) + && packageSize == other.packageSize + && price == other.price + && priceDecimal.equals(other.priceDecimal) + && priceTiers.equals(other.priceTiers) + && scheme.equals(other.scheme) + && tiersMode.equals(other.tiersMode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.currency, + this.id, + this.interval, + this.intervalCount, + this.overageUnitPriceDecimal, + this.packageSize, + this.price, + this.priceDecimal, + this.priceTiers, + this.scheme, + this.tiersMode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + IdStage currency(@NotNull Currency currency); + + Builder from(CatalogPriceResponseData other); + } + + public interface IdStage { + IntervalStage id(@NotNull String id); + } + + public interface IntervalStage { + IntervalCountStage interval(@NotNull BillingProductPriceInterval interval); + } + + public interface IntervalCountStage { + PackageSizeStage intervalCount(long intervalCount); + } + + public interface PackageSizeStage { + /** + *

Units covered per priced package; a price of $10 with package_size 1000 charges $10 per 1000 units.

+ */ + PriceStage packageSize(long packageSize); + } + + public interface PriceStage { + SchemeStage price(long price); + } + + public interface SchemeStage { + _FinalStage scheme(@NotNull BillingPriceScheme scheme); + } + + public interface _FinalStage { + CatalogPriceResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Per-unit price of the final tier, precomputed for overage display.

+ */ + _FinalStage overageUnitPriceDecimal(Optional overageUnitPriceDecimal); + + _FinalStage overageUnitPriceDecimal(String overageUnitPriceDecimal); + + _FinalStage priceDecimal(Optional priceDecimal); + + _FinalStage priceDecimal(String priceDecimal); + + _FinalStage priceTiers(List priceTiers); + + _FinalStage addPriceTiers(CatalogPriceTierResponseData priceTiers); + + _FinalStage addAllPriceTiers(List priceTiers); + + _FinalStage tiersMode(Optional tiersMode); + + _FinalStage tiersMode(BillingTiersMode tiersMode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CurrencyStage, + IdStage, + IntervalStage, + IntervalCountStage, + PackageSizeStage, + PriceStage, + SchemeStage, + _FinalStage { + private Currency currency; + + private String id; + + private BillingProductPriceInterval interval; + + private long intervalCount; + + private long packageSize; + + private long price; + + private BillingPriceScheme scheme; + + private Optional tiersMode = Optional.empty(); + + private List priceTiers = new ArrayList<>(); + + private Optional priceDecimal = Optional.empty(); + + private Optional overageUnitPriceDecimal = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogPriceResponseData other) { + currency(other.getCurrency()); + id(other.getId()); + interval(other.getInterval()); + intervalCount(other.getIntervalCount()); + overageUnitPriceDecimal(other.getOverageUnitPriceDecimal()); + packageSize(other.getPackageSize()); + price(other.getPrice()); + priceDecimal(other.getPriceDecimal()); + priceTiers(other.getPriceTiers()); + scheme(other.getScheme()); + tiersMode(other.getTiersMode()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public IdStage currency(@NotNull Currency currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IntervalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("interval") + public IntervalCountStage interval(@NotNull BillingProductPriceInterval interval) { + this.interval = Objects.requireNonNull(interval, "interval must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("interval_count") + public PackageSizeStage intervalCount(long intervalCount) { + this.intervalCount = intervalCount; + return this; + } + + /** + *

Units covered per priced package; a price of $10 with package_size 1000 charges $10 per 1000 units.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("package_size") + public PriceStage packageSize(long packageSize) { + this.packageSize = packageSize; + return this; + } + + @java.lang.Override + @JsonSetter("price") + public SchemeStage price(long price) { + this.price = price; + return this; + } + + @java.lang.Override + @JsonSetter("scheme") + public _FinalStage scheme(@NotNull BillingPriceScheme scheme) { + this.scheme = Objects.requireNonNull(scheme, "scheme must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage tiersMode(BillingTiersMode tiersMode) { + this.tiersMode = Optional.ofNullable(tiersMode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) + public _FinalStage tiersMode(Optional tiersMode) { + this.tiersMode = tiersMode; + return this; + } + + @java.lang.Override + public _FinalStage addAllPriceTiers(List priceTiers) { + if (priceTiers != null) { + this.priceTiers.addAll(priceTiers); + } + return this; + } + + @java.lang.Override + public _FinalStage addPriceTiers(CatalogPriceTierResponseData priceTiers) { + this.priceTiers.add(priceTiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_tiers", nulls = Nulls.SKIP) + public _FinalStage priceTiers(List priceTiers) { + this.priceTiers.clear(); + if (priceTiers != null) { + this.priceTiers.addAll(priceTiers); + } + return this; + } + + @java.lang.Override + public _FinalStage priceDecimal(String priceDecimal) { + this.priceDecimal = Optional.ofNullable(priceDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_decimal", nulls = Nulls.SKIP) + public _FinalStage priceDecimal(Optional priceDecimal) { + this.priceDecimal = priceDecimal; + return this; + } + + /** + *

Per-unit price of the final tier, precomputed for overage display.

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

Per-unit price of the final tier, precomputed for overage display.

+ */ + @java.lang.Override + @JsonSetter(value = "overage_unit_price_decimal", nulls = Nulls.SKIP) + public _FinalStage overageUnitPriceDecimal(Optional overageUnitPriceDecimal) { + this.overageUnitPriceDecimal = overageUnitPriceDecimal; + return this; + } + + @java.lang.Override + public CatalogPriceResponseData build() { + return new CatalogPriceResponseData( + currency, + id, + interval, + intervalCount, + overageUnitPriceDecimal, + packageSize, + price, + priceDecimal, + priceTiers, + scheme, + tiersMode, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("currency") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("interval") + || key.equalsIgnoreCase("interval_count") + || key.equalsIgnoreCase("overage_unit_price_decimal") + || key.equalsIgnoreCase("package_size") + || key.equalsIgnoreCase("price") + || key.equalsIgnoreCase("price_decimal") + || key.equalsIgnoreCase("price_tiers") + || key.equalsIgnoreCase("scheme") + || key.equalsIgnoreCase("tiers_mode")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CatalogPriceTierResponseData.java b/src/main/java/com/schematic/api/types/CatalogPriceTierResponseData.java new file mode 100644 index 00000000..990bbba0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CatalogPriceTierResponseData.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CatalogPriceTierResponseData.Builder.class) +public final class CatalogPriceTierResponseData { + private final Optional flatPrice; + + private final long from; + + private final Optional perUnitPrice; + + private final Optional perUnitPriceDecimal; + + private final Optional to; + + private final Map additionalProperties; + + private CatalogPriceTierResponseData( + Optional flatPrice, + long from, + Optional perUnitPrice, + Optional perUnitPriceDecimal, + Optional to, + Map additionalProperties) { + this.flatPrice = flatPrice; + this.from = from; + this.perUnitPrice = perUnitPrice; + this.perUnitPriceDecimal = perUnitPriceDecimal; + this.to = to; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("flat_price") + public Optional getFlatPrice() { + return flatPrice; + } + + /** + * @return Lower bound of the tier (inclusive). + */ + @JsonProperty("from") + public long getFrom() { + return from; + } + + @JsonProperty("per_unit_price") + public Optional getPerUnitPrice() { + return perUnitPrice; + } + + @JsonProperty("per_unit_price_decimal") + public Optional getPerUnitPriceDecimal() { + return perUnitPriceDecimal; + } + + /** + * @return Upper bound of the tier (inclusive); null means unbounded. + */ + @JsonProperty("to") + public Optional getTo() { + return to; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CatalogPriceTierResponseData && equalTo((CatalogPriceTierResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CatalogPriceTierResponseData other) { + return flatPrice.equals(other.flatPrice) + && from == other.from + && perUnitPrice.equals(other.perUnitPrice) + && perUnitPriceDecimal.equals(other.perUnitPriceDecimal) + && to.equals(other.to); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.flatPrice, this.from, this.perUnitPrice, this.perUnitPriceDecimal, this.to); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FromStage builder() { + return new Builder(); + } + + public interface FromStage { + /** + *

Lower bound of the tier (inclusive).

+ */ + _FinalStage from(long from); + + Builder from(CatalogPriceTierResponseData other); + } + + public interface _FinalStage { + CatalogPriceTierResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage flatPrice(Optional flatPrice); + + _FinalStage flatPrice(Long flatPrice); + + _FinalStage perUnitPrice(Optional perUnitPrice); + + _FinalStage perUnitPrice(Long perUnitPrice); + + _FinalStage perUnitPriceDecimal(Optional perUnitPriceDecimal); + + _FinalStage perUnitPriceDecimal(String perUnitPriceDecimal); + + /** + *

Upper bound of the tier (inclusive); null means unbounded.

+ */ + _FinalStage to(Optional to); + + _FinalStage to(Long to); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FromStage, _FinalStage { + private long from; + + private Optional to = Optional.empty(); + + private Optional perUnitPriceDecimal = Optional.empty(); + + private Optional perUnitPrice = Optional.empty(); + + private Optional flatPrice = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CatalogPriceTierResponseData other) { + flatPrice(other.getFlatPrice()); + from(other.getFrom()); + perUnitPrice(other.getPerUnitPrice()); + perUnitPriceDecimal(other.getPerUnitPriceDecimal()); + to(other.getTo()); + return this; + } + + /** + *

Lower bound of the tier (inclusive).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("from") + public _FinalStage from(long from) { + this.from = from; + return this; + } + + /** + *

Upper bound of the tier (inclusive); null means unbounded.

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

Upper bound of the tier (inclusive); null means unbounded.

+ */ + @java.lang.Override + @JsonSetter(value = "to", nulls = Nulls.SKIP) + public _FinalStage to(Optional to) { + this.to = to; + return this; + } + + @java.lang.Override + public _FinalStage perUnitPriceDecimal(String perUnitPriceDecimal) { + this.perUnitPriceDecimal = Optional.ofNullable(perUnitPriceDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "per_unit_price_decimal", nulls = Nulls.SKIP) + public _FinalStage perUnitPriceDecimal(Optional perUnitPriceDecimal) { + this.perUnitPriceDecimal = perUnitPriceDecimal; + return this; + } + + @java.lang.Override + public _FinalStage perUnitPrice(Long perUnitPrice) { + this.perUnitPrice = Optional.ofNullable(perUnitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "per_unit_price", nulls = Nulls.SKIP) + public _FinalStage perUnitPrice(Optional perUnitPrice) { + this.perUnitPrice = perUnitPrice; + return this; + } + + @java.lang.Override + public _FinalStage flatPrice(Long flatPrice) { + this.flatPrice = Optional.ofNullable(flatPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flat_price", nulls = Nulls.SKIP) + public _FinalStage flatPrice(Optional flatPrice) { + this.flatPrice = flatPrice; + return this; + } + + @java.lang.Override + public CatalogPriceTierResponseData build() { + return new CatalogPriceTierResponseData( + flatPrice, from, perUnitPrice, perUnitPriceDecimal, to, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("flat_price") + || key.equalsIgnoreCase("from") + || key.equalsIgnoreCase("per_unit_price") + || key.equalsIgnoreCase("per_unit_price_decimal") + || key.equalsIgnoreCase("to")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/CheckoutChargeTiming.java b/src/main/java/com/schematic/api/types/CheckoutChargeTiming.java new file mode 100644 index 00000000..9ef65cd0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckoutChargeTiming.java @@ -0,0 +1,93 @@ +/** + * 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 CheckoutChargeTiming { + public static final CheckoutChargeTiming AT_RENEWAL = new CheckoutChargeTiming(Value.AT_RENEWAL, "at_renewal"); + + public static final CheckoutChargeTiming NOW = new CheckoutChargeTiming(Value.NOW, "now"); + + public static final CheckoutChargeTiming NONE = new CheckoutChargeTiming(Value.NONE, "none"); + + private final Value value; + + private final String string; + + CheckoutChargeTiming(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 CheckoutChargeTiming && this.string.equals(((CheckoutChargeTiming) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AT_RENEWAL: + return visitor.visitAtRenewal(); + case NOW: + return visitor.visitNow(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CheckoutChargeTiming valueOf(String value) { + switch (value) { + case "at_renewal": + return AT_RENEWAL; + case "now": + return NOW; + case "none": + return NONE; + default: + return new CheckoutChargeTiming(Value.UNKNOWN, value); + } + } + + public enum Value { + AT_RENEWAL, + + NONE, + + NOW, + + UNKNOWN + } + + public interface Visitor { + T visitAtRenewal(); + + T visitNone(); + + T visitNow(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CheckoutProblemCode.java b/src/main/java/com/schematic/api/types/CheckoutProblemCode.java index 3dfdaf84..c4a2e8df 100644 --- a/src/main/java/com/schematic/api/types/CheckoutProblemCode.java +++ b/src/main/java/com/schematic/api/types/CheckoutProblemCode.java @@ -19,6 +19,9 @@ public final class CheckoutProblemCode { public static final CheckoutProblemCode INVOICED_SUBSCRIPTION_NEEDS_NEW_SUBSCRIPTION = new CheckoutProblemCode( Value.INVOICED_SUBSCRIPTION_NEEDS_NEW_SUBSCRIPTION, "invoiced_subscription_needs_new_subscription"); + public static final CheckoutProblemCode CHECKOUT_SUPERSEDED = + new CheckoutProblemCode(Value.CHECKOUT_SUPERSEDED, "checkout_superseded"); + public static final CheckoutProblemCode USAGE_OVER_LIMIT = new CheckoutProblemCode(Value.USAGE_OVER_LIMIT, "usage_over_limit"); @@ -40,6 +43,9 @@ public final class CheckoutProblemCode { public static final CheckoutProblemCode TRIAL_END_TOO_FAR = new CheckoutProblemCode(Value.TRIAL_END_TOO_FAR, "trial_end_too_far"); + public static final CheckoutProblemCode END_DATE_NOT_AFTER_RENEWAL_DATE = + new CheckoutProblemCode(Value.END_DATE_NOT_AFTER_RENEWAL_DATE, "end_date_not_after_renewal_date"); + public static final CheckoutProblemCode BILLING_START_DATE_NOT_BEFORE_RENEWAL_DATE = new CheckoutProblemCode( Value.BILLING_START_DATE_NOT_BEFORE_RENEWAL_DATE, "billing_start_date_not_before_renewal_date"); @@ -61,6 +67,9 @@ public final class CheckoutProblemCode { public static final CheckoutProblemCode BILLING_CYCLE_ANCHOR_WITHOUT_PLAN = new CheckoutProblemCode(Value.BILLING_CYCLE_ANCHOR_WITHOUT_PLAN, "billing_cycle_anchor_without_plan"); + public static final CheckoutProblemCode END_DATE_MUST_BE_FUTURE = + new CheckoutProblemCode(Value.END_DATE_MUST_BE_FUTURE, "end_date_must_be_future"); + public static final CheckoutProblemCode PAYMENT_METHOD_REQUIRED = new CheckoutProblemCode(Value.PAYMENT_METHOD_REQUIRED, "payment_method_required"); @@ -121,6 +130,9 @@ public final class CheckoutProblemCode { public static final CheckoutProblemCode BILLING_CYCLE_ANCHOR_MUST_BE_FUTURE = new CheckoutProblemCode(Value.BILLING_CYCLE_ANCHOR_MUST_BE_FUTURE, "billing_cycle_anchor_must_be_future"); + public static final CheckoutProblemCode END_DATE_NEEDS_NEW_SUBSCRIPTION = + new CheckoutProblemCode(Value.END_DATE_NEEDS_NEW_SUBSCRIPTION, "end_date_needs_new_subscription"); + public static final CheckoutProblemCode ADD_ON_INTERVAL_MISMATCH = new CheckoutProblemCode(Value.ADD_ON_INTERVAL_MISMATCH, "add_on_interval_mismatch"); @@ -179,6 +191,8 @@ public T visit(Visitor visitor) { return visitor.visitPayInAdvanceRequired(); case INVOICED_SUBSCRIPTION_NEEDS_NEW_SUBSCRIPTION: return visitor.visitInvoicedSubscriptionNeedsNewSubscription(); + case CHECKOUT_SUPERSEDED: + return visitor.visitCheckoutSuperseded(); case USAGE_OVER_LIMIT: return visitor.visitUsageOverLimit(); case SELECTION_INVALID: @@ -193,6 +207,8 @@ public T visit(Visitor visitor) { return visitor.visitInvoiceEmailRequired(); case TRIAL_END_TOO_FAR: return visitor.visitTrialEndTooFar(); + case END_DATE_NOT_AFTER_RENEWAL_DATE: + return visitor.visitEndDateNotAfterRenewalDate(); case BILLING_START_DATE_NOT_BEFORE_RENEWAL_DATE: return visitor.visitBillingStartDateNotBeforeRenewalDate(); case PAY_IN_ADVANCE_PRICE_INVALID: @@ -207,6 +223,8 @@ public T visit(Visitor visitor) { return visitor.visitUsagePriceMissingForInterval(); case BILLING_CYCLE_ANCHOR_WITHOUT_PLAN: return visitor.visitBillingCycleAnchorWithoutPlan(); + case END_DATE_MUST_BE_FUTURE: + return visitor.visitEndDateMustBeFuture(); case PAYMENT_METHOD_REQUIRED: return visitor.visitPaymentMethodRequired(); case CUSTOM_FIELD_REQUIRED: @@ -247,6 +265,8 @@ public T visit(Visitor visitor) { return visitor.visitDiscountIneligible(); case BILLING_CYCLE_ANCHOR_MUST_BE_FUTURE: return visitor.visitBillingCycleAnchorMustBeFuture(); + case END_DATE_NEEDS_NEW_SUBSCRIPTION: + return visitor.visitEndDateNeedsNewSubscription(); case ADD_ON_INTERVAL_MISMATCH: return visitor.visitAddOnIntervalMismatch(); case PRICE_UNAVAILABLE: @@ -276,6 +296,8 @@ public static CheckoutProblemCode valueOf(String value) { return PAY_IN_ADVANCE_REQUIRED; case "invoiced_subscription_needs_new_subscription": return INVOICED_SUBSCRIPTION_NEEDS_NEW_SUBSCRIPTION; + case "checkout_superseded": + return CHECKOUT_SUPERSEDED; case "usage_over_limit": return USAGE_OVER_LIMIT; case "selection_invalid": @@ -290,6 +312,8 @@ public static CheckoutProblemCode valueOf(String value) { return INVOICE_EMAIL_REQUIRED; case "trial_end_too_far": return TRIAL_END_TOO_FAR; + case "end_date_not_after_renewal_date": + return END_DATE_NOT_AFTER_RENEWAL_DATE; case "billing_start_date_not_before_renewal_date": return BILLING_START_DATE_NOT_BEFORE_RENEWAL_DATE; case "pay_in_advance_price_invalid": @@ -304,6 +328,8 @@ public static CheckoutProblemCode valueOf(String value) { return USAGE_PRICE_MISSING_FOR_INTERVAL; case "billing_cycle_anchor_without_plan": return BILLING_CYCLE_ANCHOR_WITHOUT_PLAN; + case "end_date_must_be_future": + return END_DATE_MUST_BE_FUTURE; case "payment_method_required": return PAYMENT_METHOD_REQUIRED; case "custom_field_required": @@ -344,6 +370,8 @@ public static CheckoutProblemCode valueOf(String value) { return DISCOUNT_INELIGIBLE; case "billing_cycle_anchor_must_be_future": return BILLING_CYCLE_ANCHOR_MUST_BE_FUTURE; + case "end_date_needs_new_subscription": + return END_DATE_NEEDS_NEW_SUBSCRIPTION; case "add_on_interval_mismatch": return ADD_ON_INTERVAL_MISMATCH; case "price_unavailable": @@ -388,6 +416,8 @@ public enum Value { BILLING_START_DATE_TOO_FAR_IN_PAST, + CHECKOUT_SUPERSEDED, + CREDIT_BUNDLE_INCOMPATIBLE, CREDIT_BUNDLE_UNAVAILABLE, @@ -402,6 +432,12 @@ public enum Value { DOWNGRADE_NOT_PERMITTED, + END_DATE_MUST_BE_FUTURE, + + END_DATE_NEEDS_NEW_SUBSCRIPTION, + + END_DATE_NOT_AFTER_RENEWAL_DATE, + FREE_FIRST_PERIOD_ACTIVATES_ON_PAYMENT, INVOICE_EMAIL_REQUIRED, @@ -480,6 +516,8 @@ public interface Visitor { T visitBillingStartDateTooFarInPast(); + T visitCheckoutSuperseded(); + T visitCreditBundleIncompatible(); T visitCreditBundleUnavailable(); @@ -494,6 +532,12 @@ public interface Visitor { T visitDowngradeNotPermitted(); + T visitEndDateMustBeFuture(); + + T visitEndDateNeedsNewSubscription(); + + T visitEndDateNotAfterRenewalDate(); + T visitFreeFirstPeriodActivatesOnPayment(); T visitInvoiceEmailRequired(); diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index 4a14a355..2e15372e 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -96,6 +96,8 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional unitPriceDecimal; + private final Optional> warningTiers; + private final Map additionalProperties; private CreateBillingPlanCreditGrantRequestBody( @@ -136,6 +138,7 @@ private CreateBillingPlanCreditGrantRequestBody( Optional tierMode, Optional unitPrice, Optional unitPriceDecimal, + Optional> warningTiers, Map additionalProperties) { this.applyToExisting = applyToExisting; this.arrearsAnchor = arrearsAnchor; @@ -174,6 +177,7 @@ private CreateBillingPlanCreditGrantRequestBody( this.tierMode = tierMode; this.unitPrice = unitPrice; this.unitPriceDecimal = unitPriceDecimal; + this.warningTiers = warningTiers; this.additionalProperties = additionalProperties; } @@ -410,6 +414,14 @@ public Optional getUnitPriceDecimal() { return unitPriceDecimal; } + /** + * @return Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5. + */ + @JsonProperty("warning_tiers") + public Optional> getWarningTiers() { + return warningTiers; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -459,7 +471,8 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { && scaling.equals(other.scaling) && tierMode.equals(other.tierMode) && unitPrice.equals(other.unitPrice) - && unitPriceDecimal.equals(other.unitPriceDecimal); + && unitPriceDecimal.equals(other.unitPriceDecimal) + && warningTiers.equals(other.warningTiers); } @java.lang.Override @@ -501,7 +514,8 @@ public int hashCode() { this.scaling, this.tierMode, this.unitPrice, - this.unitPriceDecimal); + this.unitPriceDecimal, + this.warningTiers); } @java.lang.Override @@ -717,6 +731,13 @@ public interface _FinalStage { _FinalStage unitPriceDecimal(Optional unitPriceDecimal); _FinalStage unitPriceDecimal(String unitPriceDecimal); + + /** + *

Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5.

+ */ + _FinalStage warningTiers(Optional> warningTiers); + + _FinalStage warningTiers(List warningTiers); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -732,6 +753,8 @@ public static final class Builder private BillingPlanCreditGrantResetStart resetStart; + private Optional> warningTiers = Optional.empty(); + private Optional unitPriceDecimal = Optional.empty(); private Optional unitPrice = Optional.empty(); @@ -839,6 +862,7 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { tierMode(other.getTierMode()); unitPrice(other.getUnitPrice()); unitPriceDecimal(other.getUnitPriceDecimal()); + warningTiers(other.getWarningTiers()); return this; } @@ -877,6 +901,26 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta return this; } + /** + *

Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5.

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

Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5.

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

Price per credit as a decimal in the plan currency's smallest unit, for prices below one cent.

* @return Reference to {@code this} so that method calls can be chained together. @@ -1445,6 +1489,7 @@ public CreateBillingPlanCreditGrantRequestBody build() { tierMode, unitPrice, unitPriceDecimal, + warningTiers, additionalProperties); } @@ -1486,7 +1531,8 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("scaling") || key.equalsIgnoreCase("tier_mode") || key.equalsIgnoreCase("unit_price") - || key.equalsIgnoreCase("unit_price_decimal")) { + || key.equalsIgnoreCase("unit_price_decimal") + || key.equalsIgnoreCase("warning_tiers")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/types/CreditSpendWindowUnit.java b/src/main/java/com/schematic/api/types/CreditSpendWindowUnit.java index dbd4b022..75b49b64 100644 --- a/src/main/java/com/schematic/api/types/CreditSpendWindowUnit.java +++ b/src/main/java/com/schematic/api/types/CreditSpendWindowUnit.java @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class CreditSpendWindowUnit { + public static final CreditSpendWindowUnit MONTH = new CreditSpendWindowUnit(Value.MONTH, "month"); + public static final CreditSpendWindowUnit HOUR = new CreditSpendWindowUnit(Value.HOUR, "hour"); public static final CreditSpendWindowUnit DAY = new CreditSpendWindowUnit(Value.DAY, "day"); @@ -14,6 +16,8 @@ public final class CreditSpendWindowUnit { public static final CreditSpendWindowUnit BILLING_PERIOD = new CreditSpendWindowUnit(Value.BILLING_PERIOD, "billing_period"); + public static final CreditSpendWindowUnit WEEK = new CreditSpendWindowUnit(Value.WEEK, "week"); + private final Value value; private final String string; @@ -47,12 +51,16 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case MONTH: + return visitor.visitMonth(); case HOUR: return visitor.visitHour(); case DAY: return visitor.visitDay(); case BILLING_PERIOD: return visitor.visitBillingPeriod(); + case WEEK: + return visitor.visitWeek(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -62,12 +70,16 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static CreditSpendWindowUnit valueOf(String value) { switch (value) { + case "month": + return MONTH; case "hour": return HOUR; case "day": return DAY; case "billing_period": return BILLING_PERIOD; + case "week": + return WEEK; default: return new CreditSpendWindowUnit(Value.UNKNOWN, value); } @@ -78,6 +90,10 @@ public enum Value { DAY, + WEEK, + + MONTH, + BILLING_PERIOD, UNKNOWN @@ -88,6 +104,10 @@ public interface Visitor { T visitDay(); + T visitWeek(); + + T visitMonth(); + T visitBillingPeriod(); T visitUnknown(String unknownType); diff --git a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java index 1e8f83ee..c4e2331d 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java @@ -38,6 +38,8 @@ public final class CustomPlanBillingResponseData { private final long daysUntilDue; + private final Optional endDate; + private final Optional externalInvoiceId; private final String id; @@ -74,6 +76,7 @@ private CustomPlanBillingResponseData( String companyId, OffsetDateTime createdAt, long daysUntilDue, + Optional endDate, Optional externalInvoiceId, String id, Optional migrationId, @@ -95,6 +98,7 @@ private CustomPlanBillingResponseData( this.companyId = companyId; this.createdAt = createdAt; this.daysUntilDue = daysUntilDue; + this.endDate = endDate; this.externalInvoiceId = externalInvoiceId; this.id = id; this.migrationId = migrationId; @@ -155,6 +159,14 @@ public long getDaysUntilDue() { return daysUntilDue; } + /** + * @return When a custom plan that doesn't renew ends: the renewal the subscription stops on and the company moves to the default plan. Null for a plan that renews. + */ + @JsonProperty("end_date") + public Optional getEndDate() { + return endDate; + } + @JsonProperty("external_invoice_id") public Optional getExternalInvoiceId() { return externalInvoiceId; @@ -251,6 +263,7 @@ private boolean equalTo(CustomPlanBillingResponseData other) { && companyId.equals(other.companyId) && createdAt.equals(other.createdAt) && daysUntilDue == other.daysUntilDue + && endDate.equals(other.endDate) && externalInvoiceId.equals(other.externalInvoiceId) && id.equals(other.id) && migrationId.equals(other.migrationId) @@ -276,6 +289,7 @@ public int hashCode() { this.companyId, this.createdAt, this.daysUntilDue, + this.endDate, this.externalInvoiceId, this.id, this.migrationId, @@ -373,6 +387,13 @@ public interface _FinalStage { _FinalStage checkoutId(String checkoutId); + /** + *

When a custom plan that doesn't renew ends: the renewal the subscription stops on and the company moves to the default plan. Null for a plan that renews.

+ */ + _FinalStage endDate(Optional endDate); + + _FinalStage endDate(OffsetDateTime endDate); + _FinalStage externalInvoiceId(Optional externalInvoiceId); _FinalStage externalInvoiceId(String externalInvoiceId); @@ -460,6 +481,8 @@ public static final class Builder private Optional externalInvoiceId = Optional.empty(); + private Optional endDate = Optional.empty(); + private Optional checkoutId = Optional.empty(); private Optional billingStartDate = Optional.empty(); @@ -479,6 +502,7 @@ public Builder from(CustomPlanBillingResponseData other) { companyId(other.getCompanyId()); createdAt(other.getCreatedAt()); daysUntilDue(other.getDaysUntilDue()); + endDate(other.getEndDate()); externalInvoiceId(other.getExternalInvoiceId()); id(other.getId()); migrationId(other.getMigrationId()); @@ -696,6 +720,26 @@ public _FinalStage externalInvoiceId(Optional externalInvoiceId) { return this; } + /** + *

When a custom plan that doesn't renew ends: the renewal the subscription stops on and the company moves to the default plan. Null for a plan that renews.

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

When a custom plan that doesn't renew ends: the renewal the subscription stops on and the company moves to the default plan. Null for a plan that renews.

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

The checkout this billing record was created from, when it was created from one.

* @return Reference to {@code this} so that method calls can be chained together. @@ -766,6 +810,7 @@ public CustomPlanBillingResponseData build() { companyId, createdAt, daysUntilDue, + endDate, externalInvoiceId, id, migrationId, @@ -791,6 +836,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("company_id") || key.equalsIgnoreCase("created_at") || key.equalsIgnoreCase("days_until_due") + || key.equalsIgnoreCase("end_date") || key.equalsIgnoreCase("external_invoice_id") || key.equalsIgnoreCase("id") || key.equalsIgnoreCase("migration_id") diff --git a/src/main/java/com/schematic/api/types/EntitlementType.java b/src/main/java/com/schematic/api/types/EntitlementType.java index bcf9d5dc..8cb8ffe0 100644 --- a/src/main/java/com/schematic/api/types/EntitlementType.java +++ b/src/main/java/com/schematic/api/types/EntitlementType.java @@ -12,6 +12,9 @@ public final class EntitlementType { public static final EntitlementType UNKNOWN = new EntitlementType(Value.UNKNOWN, "unknown"); + public static final EntitlementType PLAN_CREDIT_GRANT = + new EntitlementType(Value.PLAN_CREDIT_GRANT, "plan_credit_grant"); + public static final EntitlementType PLAN_ENTITLEMENT = new EntitlementType(Value.PLAN_ENTITLEMENT, "plan_entitlement"); @@ -51,6 +54,8 @@ public T visit(Visitor visitor) { return visitor.visitCompanyOverride(); case UNKNOWN: return visitor.visitUnknown(); + case PLAN_CREDIT_GRANT: + return visitor.visitPlanCreditGrant(); case PLAN_ENTITLEMENT: return visitor.visitPlanEntitlement(); case _UNKNOWN: @@ -66,6 +71,8 @@ public static EntitlementType valueOf(String value) { return COMPANY_OVERRIDE; case "unknown": return UNKNOWN; + case "plan_credit_grant": + return PLAN_CREDIT_GRANT; case "plan_entitlement": return PLAN_ENTITLEMENT; default: @@ -76,6 +83,8 @@ public static EntitlementType valueOf(String value) { public enum Value { COMPANY_OVERRIDE, + PLAN_CREDIT_GRANT, + PLAN_ENTITLEMENT, UNKNOWN, @@ -86,6 +95,8 @@ public enum Value { public interface Visitor { T visitCompanyOverride(); + T visitPlanCreditGrant(); + T visitPlanEntitlement(); T visitUnknown(); diff --git a/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java b/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java deleted file mode 100644 index 610dbb53..00000000 --- a/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java +++ /dev/null @@ -1,322 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = EnvironmentDetailResponseData.Builder.class) -public final class EnvironmentDetailResponseData { - private final List apiKeys; - - private final OffsetDateTime createdAt; - - private final EnvironmentType environmentType; - - private final String id; - - private final String name; - - private final boolean requireContextSignature; - - private final OffsetDateTime updatedAt; - - private final Map additionalProperties; - - private EnvironmentDetailResponseData( - List apiKeys, - OffsetDateTime createdAt, - EnvironmentType environmentType, - String id, - String name, - boolean requireContextSignature, - OffsetDateTime updatedAt, - Map additionalProperties) { - this.apiKeys = apiKeys; - this.createdAt = createdAt; - this.environmentType = environmentType; - this.id = id; - this.name = name; - this.requireContextSignature = requireContextSignature; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("api_keys") - public List getApiKeys() { - return apiKeys; - } - - @JsonProperty("created_at") - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("environment_type") - public EnvironmentType getEnvironmentType() { - return environmentType; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("require_context_signature") - public boolean getRequireContextSignature() { - return requireContextSignature; - } - - @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EnvironmentDetailResponseData && equalTo((EnvironmentDetailResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(EnvironmentDetailResponseData other) { - return apiKeys.equals(other.apiKeys) - && createdAt.equals(other.createdAt) - && environmentType.equals(other.environmentType) - && id.equals(other.id) - && name.equals(other.name) - && requireContextSignature == other.requireContextSignature - && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.apiKeys, - this.createdAt, - this.environmentType, - this.id, - this.name, - this.requireContextSignature, - this.updatedAt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static CreatedAtStage builder() { - return new Builder(); - } - - public interface CreatedAtStage { - EnvironmentTypeStage createdAt(@NotNull OffsetDateTime createdAt); - - Builder from(EnvironmentDetailResponseData other); - } - - public interface EnvironmentTypeStage { - IdStage environmentType(@NotNull EnvironmentType environmentType); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - RequireContextSignatureStage name(@NotNull String name); - } - - public interface RequireContextSignatureStage { - UpdatedAtStage requireContextSignature(boolean requireContextSignature); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - EnvironmentDetailResponseData build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage apiKeys(List apiKeys); - - _FinalStage addApiKeys(ApiKeyResponseData apiKeys); - - _FinalStage addAllApiKeys(List apiKeys); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements CreatedAtStage, - EnvironmentTypeStage, - IdStage, - NameStage, - RequireContextSignatureStage, - UpdatedAtStage, - _FinalStage { - private OffsetDateTime createdAt; - - private EnvironmentType environmentType; - - private String id; - - private String name; - - private boolean requireContextSignature; - - private OffsetDateTime updatedAt; - - private List apiKeys = new ArrayList<>(); - - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(EnvironmentDetailResponseData other) { - apiKeys(other.getApiKeys()); - createdAt(other.getCreatedAt()); - environmentType(other.getEnvironmentType()); - id(other.getId()); - name(other.getName()); - requireContextSignature(other.getRequireContextSignature()); - updatedAt(other.getUpdatedAt()); - return this; - } - - @java.lang.Override - @JsonSetter("created_at") - public EnvironmentTypeStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("environment_type") - public IdStage environmentType(@NotNull EnvironmentType environmentType) { - this.environmentType = Objects.requireNonNull(environmentType, "environmentType 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 RequireContextSignatureStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("require_context_signature") - public UpdatedAtStage requireContextSignature(boolean requireContextSignature) { - this.requireContextSignature = requireContextSignature; - 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 addAllApiKeys(List apiKeys) { - if (apiKeys != null) { - this.apiKeys.addAll(apiKeys); - } - return this; - } - - @java.lang.Override - public _FinalStage addApiKeys(ApiKeyResponseData apiKeys) { - this.apiKeys.add(apiKeys); - return this; - } - - @java.lang.Override - @JsonSetter(value = "api_keys", nulls = Nulls.SKIP) - public _FinalStage apiKeys(List apiKeys) { - this.apiKeys.clear(); - if (apiKeys != null) { - this.apiKeys.addAll(apiKeys); - } - return this; - } - - @java.lang.Override - public EnvironmentDetailResponseData build() { - return new EnvironmentDetailResponseData( - apiKeys, - createdAt, - environmentType, - id, - name, - requireContextSignature, - updatedAt, - additionalProperties); - } - - @JsonAnySetter - private void putAdditionalPropertyFromJson(String key, Object value) { - if (key.equalsIgnoreCase("api_keys") - || key.equalsIgnoreCase("created_at") - || key.equalsIgnoreCase("environment_type") - || key.equalsIgnoreCase("id") - || key.equalsIgnoreCase("name") - || key.equalsIgnoreCase("require_context_signature") - || key.equalsIgnoreCase("updated_at")) { - return; - } - this.additionalProperties.put(key, value); - } - - @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/EventBody.java b/src/main/java/com/schematic/api/types/EventBody.java index 6abd3703..d87c18e9 100644 --- a/src/main/java/com/schematic/api/types/EventBody.java +++ b/src/main/java/com/schematic/api/types/EventBody.java @@ -33,13 +33,13 @@ public Object get() { @SuppressWarnings("unchecked") public T visit(Visitor visitor) { if (this.type == 0) { - return visitor.visit((EventBodyTrack) this.value); + return visitor.visit((EventBodyInference) this.value); } else if (this.type == 1) { return visitor.visit((EventBodyFlagCheck) this.value); } else if (this.type == 2) { - return visitor.visit((EventBodyIdentify) this.value); + return visitor.visit((EventBodyTrack) this.value); } else if (this.type == 3) { - return visitor.visit((EventBodyInference) this.value); + return visitor.visit((EventBodyIdentify) this.value); } throw new IllegalStateException("Failed to visit value. This should never happen."); } @@ -64,7 +64,7 @@ public String toString() { return this.value.toString(); } - public static EventBody of(EventBodyTrack value) { + public static EventBody of(EventBodyInference value) { return new EventBody(value, 0); } @@ -72,22 +72,22 @@ public static EventBody of(EventBodyFlagCheck value) { return new EventBody(value, 1); } - public static EventBody of(EventBodyIdentify value) { + public static EventBody of(EventBodyTrack value) { return new EventBody(value, 2); } - public static EventBody of(EventBodyInference value) { + public static EventBody of(EventBodyIdentify value) { return new EventBody(value, 3); } public interface Visitor { - T visit(EventBodyTrack value); + T visit(EventBodyInference value); T visit(EventBodyFlagCheck value); - T visit(EventBodyIdentify value); + T visit(EventBodyTrack value); - T visit(EventBodyInference value); + T visit(EventBodyIdentify value); } static final class Deserializer extends StdDeserializer { @@ -98,9 +98,14 @@ static final class Deserializer extends StdDeserializer { @java.lang.Override public EventBody deserialize(JsonParser p, DeserializationContext context) throws IOException { Object value = p.readValueAs(Object.class); - if (value instanceof Map && ((Map) value).containsKey("event")) { + if (value instanceof Map + && ((Map) value).containsKey("company") + && ((Map) value).containsKey("input_tokens") + && ((Map) value).containsKey("output_tokens") + && ((Map) value).containsKey("provider") + && ((Map) value).containsKey("response_model")) { try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyTrack.class)); + return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyInference.class)); } catch (RuntimeException e) { } } @@ -113,20 +118,15 @@ public EventBody deserialize(JsonParser p, DeserializationContext context) throw } catch (RuntimeException e) { } } - if (value instanceof Map && ((Map) value).containsKey("keys")) { + if (value instanceof Map && ((Map) value).containsKey("event")) { try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyIdentify.class)); + return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyTrack.class)); } catch (RuntimeException e) { } } - if (value instanceof Map - && ((Map) value).containsKey("company") - && ((Map) value).containsKey("input_tokens") - && ((Map) value).containsKey("output_tokens") - && ((Map) value).containsKey("provider") - && ((Map) value).containsKey("response_model")) { + if (value instanceof Map && ((Map) value).containsKey("keys")) { try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyInference.class)); + return of(ObjectMappers.JSON_MAPPER.convertValue(value, EventBodyIdentify.class)); } catch (RuntimeException e) { } } diff --git a/src/main/java/com/schematic/api/types/PaymentMethodBillingDetailsRequestBody.java b/src/main/java/com/schematic/api/types/PaymentMethodBillingDetailsRequestBody.java new file mode 100644 index 00000000..da6c176f --- /dev/null +++ b/src/main/java/com/schematic/api/types/PaymentMethodBillingDetailsRequestBody.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaymentMethodBillingDetailsRequestBody.Builder.class) +public final class PaymentMethodBillingDetailsRequestBody { + private final Optional address; + + private final Optional email; + + private final Optional phone; + + private final Map additionalProperties; + + private PaymentMethodBillingDetailsRequestBody( + Optional address, + Optional email, + Optional phone, + Map additionalProperties) { + this.address = address; + this.email = email; + this.phone = phone; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("address") + public Optional getAddress() { + return address; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("phone") + public Optional getPhone() { + return phone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaymentMethodBillingDetailsRequestBody + && equalTo((PaymentMethodBillingDetailsRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaymentMethodBillingDetailsRequestBody other) { + return address.equals(other.address) && email.equals(other.email) && phone.equals(other.phone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.address, this.email, this.phone); + } + + @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 address = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional phone = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PaymentMethodBillingDetailsRequestBody other) { + address(other.getAddress()); + email(other.getEmail()); + phone(other.getPhone()); + return this; + } + + @JsonSetter(value = "address", nulls = Nulls.SKIP) + public Builder address(Optional address) { + this.address = address; + return this; + } + + public Builder address(CustomerBillingAddress address) { + this.address = Optional.ofNullable(address); + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @JsonSetter(value = "phone", nulls = Nulls.SKIP) + public Builder phone(Optional phone) { + this.phone = phone; + return this; + } + + public Builder phone(String phone) { + this.phone = Optional.ofNullable(phone); + return this; + } + + public PaymentMethodBillingDetailsRequestBody build() { + return new PaymentMethodBillingDetailsRequestBody(address, email, phone, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("address") || key.equalsIgnoreCase("email") || key.equalsIgnoreCase("phone")) { + return; + } + this.additionalProperties.put(key, value); + } + + 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/PlanCreditGrantWarningTierRequestBody.java b/src/main/java/com/schematic/api/types/PlanCreditGrantWarningTierRequestBody.java new file mode 100644 index 00000000..585bda33 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantWarningTierRequestBody.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 = PlanCreditGrantWarningTierRequestBody.Builder.class) +public final class PlanCreditGrantWarningTierRequestBody { + private final String key; + + private final long value; + + private final Map additionalProperties; + + private PlanCreditGrantWarningTierRequestBody(String key, long value, Map additionalProperties) { + this.key = key; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return Identifier for the threshold, unique within the grant. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return Credits remaining in the company's balance at which the warning is reached. + */ + @JsonProperty("value") + public long getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanCreditGrantWarningTierRequestBody + && equalTo((PlanCreditGrantWarningTierRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanCreditGrantWarningTierRequestBody other) { + return key.equals(other.key) && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

Identifier for the threshold, unique within the grant.

+ */ + ValueStage key(@NotNull String key); + + Builder from(PlanCreditGrantWarningTierRequestBody other); + } + + public interface ValueStage { + /** + *

Credits remaining in the company's balance at which the warning is reached.

+ */ + _FinalStage value(long value); + } + + public interface _FinalStage { + PlanCreditGrantWarningTierRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, ValueStage, _FinalStage { + private String key; + + private long value; + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanCreditGrantWarningTierRequestBody other) { + key(other.getKey()); + value(other.getValue()); + return this; + } + + /** + *

Identifier for the threshold, unique within the grant.

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

Credits remaining in the company's balance at which the warning is reached.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(long value) { + this.value = value; + return this; + } + + @java.lang.Override + public PlanCreditGrantWarningTierRequestBody build() { + return new PlanCreditGrantWarningTierRequestBody(key, value, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("key") || key.equalsIgnoreCase("value")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/PlanVersionMigrationPreviewCompanyResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java index dab1088c..f73141a3 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewCompanyResponseData.java @@ -12,7 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -29,6 +31,8 @@ public final class PlanVersionMigrationPreviewCompanyResponseData { private final Optional note; + private final List notes; + private final Optional planVersionIdFrom; private final boolean willUpdateSubscription; @@ -42,6 +46,7 @@ private PlanVersionMigrationPreviewCompanyResponseData( boolean hasBillingChanges, boolean hasCustomPricing, Optional note, + List notes, Optional planVersionIdFrom, boolean willUpdateSubscription, boolean wouldFail, @@ -50,6 +55,7 @@ private PlanVersionMigrationPreviewCompanyResponseData( this.hasBillingChanges = hasBillingChanges; this.hasCustomPricing = hasCustomPricing; this.note = note; + this.notes = notes; this.planVersionIdFrom = planVersionIdFrom; this.willUpdateSubscription = willUpdateSubscription; this.wouldFail = wouldFail; @@ -71,11 +77,19 @@ public boolean getHasCustomPricing() { return hasCustomPricing; } + /** + * @return The message of the first blocking note, or of the first note when none is blocking. Kept for clients that read a single note; prefer notes. + */ @JsonProperty("note") public Optional getNote() { return note; } + @JsonProperty("notes") + public List getNotes() { + return notes; + } + @JsonProperty("plan_version_id_from") public Optional getPlanVersionIdFrom() { return planVersionIdFrom; @@ -108,6 +122,7 @@ private boolean equalTo(PlanVersionMigrationPreviewCompanyResponseData other) { && hasBillingChanges == other.hasBillingChanges && hasCustomPricing == other.hasCustomPricing && note.equals(other.note) + && notes.equals(other.notes) && planVersionIdFrom.equals(other.planVersionIdFrom) && willUpdateSubscription == other.willUpdateSubscription && wouldFail == other.wouldFail; @@ -120,6 +135,7 @@ public int hashCode() { this.hasBillingChanges, this.hasCustomPricing, this.note, + this.notes, this.planVersionIdFrom, this.willUpdateSubscription, this.wouldFail); @@ -163,10 +179,19 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

The message of the first blocking note, or of the first note when none is blocking. Kept for clients that read a single note; prefer notes.

+ */ _FinalStage note(Optional note); _FinalStage note(String note); + _FinalStage notes(List notes); + + _FinalStage addNotes(PlanVersionMigrationPreviewNoteResponseData notes); + + _FinalStage addAllNotes(List notes); + _FinalStage planVersionIdFrom(Optional planVersionIdFrom); _FinalStage planVersionIdFrom(String planVersionIdFrom); @@ -192,6 +217,8 @@ public static final class Builder private Optional planVersionIdFrom = Optional.empty(); + private List notes = new ArrayList<>(); + private Optional note = Optional.empty(); private Map additionalProperties = new HashMap<>(); @@ -204,6 +231,7 @@ public Builder from(PlanVersionMigrationPreviewCompanyResponseData other) { hasBillingChanges(other.getHasBillingChanges()); hasCustomPricing(other.getHasCustomPricing()); note(other.getNote()); + notes(other.getNotes()); planVersionIdFrom(other.getPlanVersionIdFrom()); willUpdateSubscription(other.getWillUpdateSubscription()); wouldFail(other.getWouldFail()); @@ -258,12 +286,43 @@ public _FinalStage planVersionIdFrom(Optional planVersionIdFrom) { return this; } + @java.lang.Override + public _FinalStage addAllNotes(List notes) { + if (notes != null) { + this.notes.addAll(notes); + } + return this; + } + + @java.lang.Override + public _FinalStage addNotes(PlanVersionMigrationPreviewNoteResponseData notes) { + this.notes.add(notes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "notes", nulls = Nulls.SKIP) + public _FinalStage notes(List notes) { + this.notes.clear(); + if (notes != null) { + this.notes.addAll(notes); + } + return this; + } + + /** + *

The message of the first blocking note, or of the first note when none is blocking. Kept for clients that read a single note; prefer notes.

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

The message of the first blocking note, or of the first note when none is blocking. Kept for clients that read a single note; prefer notes.

+ */ @java.lang.Override @JsonSetter(value = "note", nulls = Nulls.SKIP) public _FinalStage note(Optional note) { @@ -278,6 +337,7 @@ public PlanVersionMigrationPreviewCompanyResponseData build() { hasBillingChanges, hasCustomPricing, note, + notes, planVersionIdFrom, willUpdateSubscription, wouldFail, @@ -290,6 +350,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("has_billing_changes") || key.equalsIgnoreCase("has_custom_pricing") || key.equalsIgnoreCase("note") + || key.equalsIgnoreCase("notes") || key.equalsIgnoreCase("plan_version_id_from") || key.equalsIgnoreCase("will_update_subscription") || key.equalsIgnoreCase("would_fail")) { diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewNoteResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewNoteResponseData.java new file mode 100644 index 00000000..49f28233 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationPreviewNoteResponseData.java @@ -0,0 +1,205 @@ +/** + * 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 = PlanVersionMigrationPreviewNoteResponseData.Builder.class) +public final class PlanVersionMigrationPreviewNoteResponseData { + private final boolean blocking; + + private final Optional code; + + private final String message; + + private final Map additionalProperties; + + private PlanVersionMigrationPreviewNoteResponseData( + boolean blocking, + Optional code, + String message, + Map additionalProperties) { + this.blocking = blocking; + this.code = code; + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether this note predicts that the company's migration would fail. + */ + @JsonProperty("blocking") + public boolean getBlocking() { + return blocking; + } + + /** + * @return The error code the company's migration would fail or be skipped with. Null for a note that is only informational. + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanVersionMigrationPreviewNoteResponseData + && equalTo((PlanVersionMigrationPreviewNoteResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanVersionMigrationPreviewNoteResponseData other) { + return blocking == other.blocking && code.equals(other.code) && message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.blocking, this.code, this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BlockingStage builder() { + return new Builder(); + } + + public interface BlockingStage { + /** + *

Whether this note predicts that the company's migration would fail.

+ */ + MessageStage blocking(boolean blocking); + + Builder from(PlanVersionMigrationPreviewNoteResponseData other); + } + + public interface MessageStage { + _FinalStage message(@NotNull String message); + } + + public interface _FinalStage { + PlanVersionMigrationPreviewNoteResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The error code the company's migration would fail or be skipped with. Null for a note that is only informational.

+ */ + _FinalStage code(Optional code); + + _FinalStage code(MigrationErrorCode code); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BlockingStage, MessageStage, _FinalStage { + private boolean blocking; + + private String message; + + private Optional code = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanVersionMigrationPreviewNoteResponseData other) { + blocking(other.getBlocking()); + code(other.getCode()); + message(other.getMessage()); + return this; + } + + /** + *

Whether this note predicts that the company's migration would fail.

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

The error code the company's migration would fail or be skipped with. Null for a note that is only informational.

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

The error code the company's migration would fail or be skipped with. Null for a note that is only informational.

+ */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public PlanVersionMigrationPreviewNoteResponseData build() { + return new PlanVersionMigrationPreviewNoteResponseData(blocking, code, message, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("blocking") || key.equalsIgnoreCase("code") || key.equalsIgnoreCase("message")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/PlanVersionResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java index a0f43aa5..9da68a0a 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java @@ -38,6 +38,8 @@ public final class PlanVersionResponseData { private final PlanType planType; + private final RenewalPolicy renewalPolicy; + private final PlanVersionStatus status; private final OffsetDateTime updatedAt; @@ -55,6 +57,7 @@ private PlanVersionResponseData( String name, Optional originalPlanId, PlanType planType, + RenewalPolicy renewalPolicy, PlanVersionStatus status, OffsetDateTime updatedAt, long version, @@ -67,6 +70,7 @@ private PlanVersionResponseData( this.name = name; this.originalPlanId = originalPlanId; this.planType = planType; + this.renewalPolicy = renewalPolicy; this.status = status; this.updatedAt = updatedAt; this.version = version; @@ -113,6 +117,11 @@ public PlanType getPlanType() { return planType; } + @JsonProperty("renewal_policy") + public RenewalPolicy getRenewalPolicy() { + return renewalPolicy; + } + @JsonProperty("status") public PlanVersionStatus getStatus() { return status; @@ -148,6 +157,7 @@ private boolean equalTo(PlanVersionResponseData other) { && name.equals(other.name) && originalPlanId.equals(other.originalPlanId) && planType.equals(other.planType) + && renewalPolicy.equals(other.renewalPolicy) && status.equals(other.status) && updatedAt.equals(other.updatedAt) && version == other.version; @@ -164,6 +174,7 @@ public int hashCode() { this.name, this.originalPlanId, this.planType, + this.renewalPolicy, this.status, this.updatedAt, this.version); @@ -205,7 +216,11 @@ public interface NameStage { } public interface PlanTypeStage { - StatusStage planType(@NotNull PlanType planType); + RenewalPolicyStage planType(@NotNull PlanType planType); + } + + public interface RenewalPolicyStage { + StatusStage renewalPolicy(@NotNull RenewalPolicy renewalPolicy); } public interface StatusStage { @@ -241,6 +256,7 @@ public static final class Builder IdStage, NameStage, PlanTypeStage, + RenewalPolicyStage, StatusStage, UpdatedAtStage, VersionStage, @@ -259,6 +275,8 @@ public static final class Builder private PlanType planType; + private RenewalPolicy renewalPolicy; + private PlanVersionStatus status; private OffsetDateTime updatedAt; @@ -281,6 +299,7 @@ public Builder from(PlanVersionResponseData other) { name(other.getName()); originalPlanId(other.getOriginalPlanId()); planType(other.getPlanType()); + renewalPolicy(other.getRenewalPolicy()); status(other.getStatus()); updatedAt(other.getUpdatedAt()); version(other.getVersion()); @@ -331,11 +350,18 @@ public PlanTypeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("plan_type") - public StatusStage planType(@NotNull PlanType planType) { + public RenewalPolicyStage planType(@NotNull PlanType planType) { this.planType = Objects.requireNonNull(planType, "planType must not be null"); return this; } + @java.lang.Override + @JsonSetter("renewal_policy") + public StatusStage renewalPolicy(@NotNull RenewalPolicy renewalPolicy) { + this.renewalPolicy = Objects.requireNonNull(renewalPolicy, "renewalPolicy must not be null"); + return this; + } + @java.lang.Override @JsonSetter("status") public UpdatedAtStage status(@NotNull PlanVersionStatus status) { @@ -381,6 +407,7 @@ public PlanVersionResponseData build() { name, originalPlanId, planType, + renewalPolicy, status, updatedAt, version, @@ -397,6 +424,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("name") || key.equalsIgnoreCase("original_plan_id") || key.equalsIgnoreCase("plan_type") + || key.equalsIgnoreCase("renewal_policy") || key.equalsIgnoreCase("status") || key.equalsIgnoreCase("updated_at") || key.equalsIgnoreCase("version")) { diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java index 06760d27..36178ee7 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java @@ -28,6 +28,10 @@ public final class PreviewSubscriptionFinanceResponseData { private final Currency currency; + private final long customerBalanceApplied; + + private final long customerBalanceRemaining; + private final long discountAmount; private final List discounts; @@ -48,6 +52,8 @@ public final class PreviewSubscriptionFinanceResponseData { private final Optional prorationBilledAt; + private final Optional prorationDetail; + private final Optional taxAmount; private final Optional taxDisplayName; @@ -65,6 +71,8 @@ public final class PreviewSubscriptionFinanceResponseData { private PreviewSubscriptionFinanceResponseData( long amountOff, Currency currency, + long customerBalanceApplied, + long customerBalanceRemaining, long discountAmount, List discounts, long dueNow, @@ -75,6 +83,7 @@ private PreviewSubscriptionFinanceResponseData( boolean promoCodeApplied, long proration, Optional prorationBilledAt, + Optional prorationDetail, Optional taxAmount, Optional taxDisplayName, boolean taxRequireBillingDetails, @@ -84,6 +93,8 @@ private PreviewSubscriptionFinanceResponseData( Map additionalProperties) { this.amountOff = amountOff; this.currency = currency; + this.customerBalanceApplied = customerBalanceApplied; + this.customerBalanceRemaining = customerBalanceRemaining; this.discountAmount = discountAmount; this.discounts = discounts; this.dueNow = dueNow; @@ -94,6 +105,7 @@ private PreviewSubscriptionFinanceResponseData( this.promoCodeApplied = promoCodeApplied; this.proration = proration; this.prorationBilledAt = prorationBilledAt; + this.prorationDetail = prorationDetail; this.taxAmount = taxAmount; this.taxDisplayName = taxDisplayName; this.taxRequireBillingDetails = taxRequireBillingDetails; @@ -116,6 +128,22 @@ public Currency getCurrency() { return currency; } + /** + * @return What the company's stored credit covers of this invoice, in minor units. + */ + @JsonProperty("customer_balance_applied") + public long getCustomerBalanceApplied() { + return customerBalanceApplied; + } + + /** + * @return Credit left on the company's balance after this invoice, in minor units: what it did not consume, plus what a total below zero adds, which the provider applies to later invoices. + */ + @JsonProperty("customer_balance_remaining") + public long getCustomerBalanceRemaining() { + return customerBalanceRemaining; + } + @JsonProperty("discount_amount") public long getDiscountAmount() { return discountAmount; @@ -166,6 +194,14 @@ public Optional getProrationBilledAt() { return prorationBilledAt; } + /** + * @return The proration itemized in the cart's terms, by plan and price. Null when the change prorates nothing. upcoming_invoice_line_items stays as the billing provider reported it. + */ + @JsonProperty("proration_detail") + public Optional getProrationDetail() { + return prorationDetail; + } + @JsonProperty("tax_amount") public Optional getTaxAmount() { return taxAmount; @@ -211,6 +247,8 @@ public Map getAdditionalProperties() { private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { return amountOff == other.amountOff && currency.equals(other.currency) + && customerBalanceApplied == other.customerBalanceApplied + && customerBalanceRemaining == other.customerBalanceRemaining && discountAmount == other.discountAmount && discounts.equals(other.discounts) && dueNow == other.dueNow @@ -221,6 +259,7 @@ private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { && promoCodeApplied == other.promoCodeApplied && proration == other.proration && prorationBilledAt.equals(other.prorationBilledAt) + && prorationDetail.equals(other.prorationDetail) && taxAmount.equals(other.taxAmount) && taxDisplayName.equals(other.taxDisplayName) && taxRequireBillingDetails == other.taxRequireBillingDetails @@ -234,6 +273,8 @@ public int hashCode() { return Objects.hash( this.amountOff, this.currency, + this.customerBalanceApplied, + this.customerBalanceRemaining, this.discountAmount, this.discounts, this.dueNow, @@ -244,6 +285,7 @@ public int hashCode() { this.promoCodeApplied, this.proration, this.prorationBilledAt, + this.prorationDetail, this.taxAmount, this.taxDisplayName, this.taxRequireBillingDetails, @@ -271,7 +313,21 @@ public interface CurrencyStage { /** *

ISO 4217 currency every amount in this block is denominated in.

*/ - DiscountAmountStage currency(@NotNull Currency currency); + CustomerBalanceAppliedStage currency(@NotNull Currency currency); + } + + public interface CustomerBalanceAppliedStage { + /** + *

What the company's stored credit covers of this invoice, in minor units.

+ */ + CustomerBalanceRemainingStage customerBalanceApplied(long customerBalanceApplied); + } + + public interface CustomerBalanceRemainingStage { + /** + *

Credit left on the company's balance after this invoice, in minor units: what it did not consume, plus what a total below zero adds, which the provider applies to later invoices.

+ */ + DiscountAmountStage customerBalanceRemaining(long customerBalanceRemaining); } public interface DiscountAmountStage { @@ -331,6 +387,13 @@ public interface _FinalStage { _FinalStage prorationBilledAt(OffsetDateTime prorationBilledAt); + /** + *

The proration itemized in the cart's terms, by plan and price. Null when the change prorates nothing. upcoming_invoice_line_items stays as the billing provider reported it.

+ */ + _FinalStage prorationDetail(Optional prorationDetail); + + _FinalStage prorationDetail(PreviewSubscriptionProrationResponseData prorationDetail); + _FinalStage taxAmount(Optional taxAmount); _FinalStage taxAmount(Long taxAmount); @@ -356,6 +419,8 @@ _FinalStage addAllUpcomingInvoiceLineItems( public static final class Builder implements AmountOffStage, CurrencyStage, + CustomerBalanceAppliedStage, + CustomerBalanceRemainingStage, DiscountAmountStage, DueNowStage, NewChargesStage, @@ -371,6 +436,10 @@ public static final class Builder private Currency currency; + private long customerBalanceApplied; + + private long customerBalanceRemaining; + private long discountAmount; private long dueNow; @@ -399,6 +468,8 @@ public static final class Builder private Optional taxAmount = Optional.empty(); + private Optional prorationDetail = Optional.empty(); + private Optional prorationBilledAt = Optional.empty(); private List discounts = new ArrayList<>(); @@ -411,6 +482,8 @@ private Builder() {} public Builder from(PreviewSubscriptionFinanceResponseData other) { amountOff(other.getAmountOff()); currency(other.getCurrency()); + customerBalanceApplied(other.getCustomerBalanceApplied()); + customerBalanceRemaining(other.getCustomerBalanceRemaining()); discountAmount(other.getDiscountAmount()); discounts(other.getDiscounts()); dueNow(other.getDueNow()); @@ -421,6 +494,7 @@ public Builder from(PreviewSubscriptionFinanceResponseData other) { promoCodeApplied(other.getPromoCodeApplied()); proration(other.getProration()); prorationBilledAt(other.getProrationBilledAt()); + prorationDetail(other.getProrationDetail()); taxAmount(other.getTaxAmount()); taxDisplayName(other.getTaxDisplayName()); taxRequireBillingDetails(other.getTaxRequireBillingDetails()); @@ -443,11 +517,33 @@ public CurrencyStage amountOff(long amountOff) { */ @java.lang.Override @JsonSetter("currency") - public DiscountAmountStage currency(@NotNull Currency currency) { + public CustomerBalanceAppliedStage currency(@NotNull Currency currency) { this.currency = Objects.requireNonNull(currency, "currency must not be null"); return this; } + /** + *

What the company's stored credit covers of this invoice, in minor units.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_balance_applied") + public CustomerBalanceRemainingStage customerBalanceApplied(long customerBalanceApplied) { + this.customerBalanceApplied = customerBalanceApplied; + return this; + } + + /** + *

Credit left on the company's balance after this invoice, in minor units: what it did not consume, plus what a total below zero adds, which the provider applies to later invoices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("customer_balance_remaining") + public DiscountAmountStage customerBalanceRemaining(long customerBalanceRemaining) { + this.customerBalanceRemaining = customerBalanceRemaining; + return this; + } + @java.lang.Override @JsonSetter("discount_amount") public DueNowStage discountAmount(long discountAmount) { @@ -584,6 +680,26 @@ public _FinalStage taxAmount(Optional taxAmount) { return this; } + /** + *

The proration itemized in the cart's terms, by plan and price. Null when the change prorates nothing. upcoming_invoice_line_items stays as the billing provider reported it.

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

The proration itemized in the cart's terms, by plan and price. Null when the change prorates nothing. upcoming_invoice_line_items stays as the billing provider reported it.

+ */ + @java.lang.Override + @JsonSetter(value = "proration_detail", nulls = Nulls.SKIP) + public _FinalStage prorationDetail(Optional prorationDetail) { + this.prorationDetail = prorationDetail; + return this; + } + @java.lang.Override public _FinalStage prorationBilledAt(OffsetDateTime prorationBilledAt) { this.prorationBilledAt = Optional.ofNullable(prorationBilledAt); @@ -626,6 +742,8 @@ public PreviewSubscriptionFinanceResponseData build() { return new PreviewSubscriptionFinanceResponseData( amountOff, currency, + customerBalanceApplied, + customerBalanceRemaining, discountAmount, discounts, dueNow, @@ -636,6 +754,7 @@ public PreviewSubscriptionFinanceResponseData build() { promoCodeApplied, proration, prorationBilledAt, + prorationDetail, taxAmount, taxDisplayName, taxRequireBillingDetails, @@ -649,6 +768,8 @@ public PreviewSubscriptionFinanceResponseData build() { private void putAdditionalPropertyFromJson(String key, Object value) { if (key.equalsIgnoreCase("amount_off") || key.equalsIgnoreCase("currency") + || key.equalsIgnoreCase("customer_balance_applied") + || key.equalsIgnoreCase("customer_balance_remaining") || key.equalsIgnoreCase("discount_amount") || key.equalsIgnoreCase("discounts") || key.equalsIgnoreCase("due_now") @@ -659,6 +780,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("promo_code_applied") || key.equalsIgnoreCase("proration") || key.equalsIgnoreCase("proration_billed_at") + || key.equalsIgnoreCase("proration_detail") || key.equalsIgnoreCase("tax_amount") || key.equalsIgnoreCase("tax_display_name") || key.equalsIgnoreCase("tax_require_billing_details") diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionProrationLineResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionProrationLineResponseData.java new file mode 100644 index 00000000..89bd8254 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionProrationLineResponseData.java @@ -0,0 +1,349 @@ +/** + * 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 = PreviewSubscriptionProrationLineResponseData.Builder.class) +public final class PreviewSubscriptionProrationLineResponseData { + private final long amount; + + private final ProrationLineKind kind; + + private final Optional periodEnd; + + private final Optional periodStart; + + private final Optional planId; + + private final Optional priceId; + + private final Optional quantity; + + private final Map additionalProperties; + + private PreviewSubscriptionProrationLineResponseData( + long amount, + ProrationLineKind kind, + Optional periodEnd, + Optional periodStart, + Optional planId, + Optional priceId, + Optional quantity, + Map additionalProperties) { + this.amount = amount; + this.kind = kind; + this.periodEnd = periodEnd; + this.periodStart = periodStart; + this.planId = planId; + this.priceId = priceId; + this.quantity = quantity; + this.additionalProperties = additionalProperties; + } + + /** + * @return In minor units of the block's currency; negative on a credit. + */ + @JsonProperty("amount") + public long getAmount() { + return amount; + } + + @JsonProperty("kind") + public ProrationLineKind getKind() { + return kind; + } + + @JsonProperty("period_end") + public Optional getPeriodEnd() { + return periodEnd; + } + + @JsonProperty("period_start") + public Optional getPeriodStart() { + return periodStart; + } + + /** + * @return The plan or add-on in the cart the price belongs to. Null for a price the subscription carries outside the cart. + */ + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + /** + * @return The Schematic price. Null when the provider priced something Schematic does not carry. + */ + @JsonProperty("price_id") + public Optional getPriceId() { + return priceId; + } + + @JsonProperty("quantity") + public Optional getQuantity() { + return quantity; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PreviewSubscriptionProrationLineResponseData + && equalTo((PreviewSubscriptionProrationLineResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PreviewSubscriptionProrationLineResponseData other) { + return amount == other.amount + && kind.equals(other.kind) + && periodEnd.equals(other.periodEnd) + && periodStart.equals(other.periodStart) + && planId.equals(other.planId) + && priceId.equals(other.priceId) + && quantity.equals(other.quantity); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, this.kind, this.periodEnd, this.periodStart, this.planId, this.priceId, this.quantity); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + /** + *

In minor units of the block's currency; negative on a credit.

+ */ + KindStage amount(long amount); + + Builder from(PreviewSubscriptionProrationLineResponseData other); + } + + public interface KindStage { + _FinalStage kind(@NotNull ProrationLineKind kind); + } + + public interface _FinalStage { + PreviewSubscriptionProrationLineResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage periodEnd(Optional periodEnd); + + _FinalStage periodEnd(OffsetDateTime periodEnd); + + _FinalStage periodStart(Optional periodStart); + + _FinalStage periodStart(OffsetDateTime periodStart); + + /** + *

The plan or add-on in the cart the price belongs to. Null for a price the subscription carries outside the cart.

+ */ + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + /** + *

The Schematic price. Null when the provider priced something Schematic does not carry.

+ */ + _FinalStage priceId(Optional priceId); + + _FinalStage priceId(String priceId); + + _FinalStage quantity(Optional quantity); + + _FinalStage quantity(Long quantity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AmountStage, KindStage, _FinalStage { + private long amount; + + private ProrationLineKind kind; + + private Optional quantity = Optional.empty(); + + private Optional priceId = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional periodStart = Optional.empty(); + + private Optional periodEnd = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PreviewSubscriptionProrationLineResponseData other) { + amount(other.getAmount()); + kind(other.getKind()); + periodEnd(other.getPeriodEnd()); + periodStart(other.getPeriodStart()); + planId(other.getPlanId()); + priceId(other.getPriceId()); + quantity(other.getQuantity()); + return this; + } + + /** + *

In minor units of the block's currency; negative on a credit.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public KindStage amount(long amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + @JsonSetter("kind") + public _FinalStage kind(@NotNull ProrationLineKind kind) { + this.kind = Objects.requireNonNull(kind, "kind must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage quantity(Long quantity) { + this.quantity = Optional.ofNullable(quantity); + return this; + } + + @java.lang.Override + @JsonSetter(value = "quantity", nulls = Nulls.SKIP) + public _FinalStage quantity(Optional quantity) { + this.quantity = quantity; + return this; + } + + /** + *

The Schematic price. Null when the provider priced something Schematic does not carry.

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

The Schematic price. Null when the provider priced something Schematic does not carry.

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

The plan or add-on in the cart the price belongs to. Null for a price the subscription carries outside the cart.

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

The plan or add-on in the cart the price belongs to. Null for a price the subscription carries outside the cart.

+ */ + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + @java.lang.Override + public _FinalStage periodStart(OffsetDateTime periodStart) { + this.periodStart = Optional.ofNullable(periodStart); + return this; + } + + @java.lang.Override + @JsonSetter(value = "period_start", nulls = Nulls.SKIP) + public _FinalStage periodStart(Optional periodStart) { + this.periodStart = periodStart; + return this; + } + + @java.lang.Override + public _FinalStage periodEnd(OffsetDateTime periodEnd) { + this.periodEnd = Optional.ofNullable(periodEnd); + return this; + } + + @java.lang.Override + @JsonSetter(value = "period_end", nulls = Nulls.SKIP) + public _FinalStage periodEnd(Optional periodEnd) { + this.periodEnd = periodEnd; + return this; + } + + @java.lang.Override + public PreviewSubscriptionProrationLineResponseData build() { + return new PreviewSubscriptionProrationLineResponseData( + amount, kind, periodEnd, periodStart, planId, priceId, quantity, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("amount") + || key.equalsIgnoreCase("kind") + || key.equalsIgnoreCase("period_end") + || key.equalsIgnoreCase("period_start") + || key.equalsIgnoreCase("plan_id") + || key.equalsIgnoreCase("price_id") + || key.equalsIgnoreCase("quantity")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/PreviewSubscriptionProrationResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionProrationResponseData.java new file mode 100644 index 00000000..5e6aa8c3 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionProrationResponseData.java @@ -0,0 +1,364 @@ +/** + * 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 = PreviewSubscriptionProrationResponseData.Builder.class) +public final class PreviewSubscriptionProrationResponseData { + private final Optional billedAt; + + private final long charge; + + private final long credit; + + private final Currency currency; + + private final List lines; + + private final CheckoutChargeTiming timing; + + private final long total; + + private final Map additionalProperties; + + private PreviewSubscriptionProrationResponseData( + Optional billedAt, + long charge, + long credit, + Currency currency, + List lines, + CheckoutChargeTiming timing, + long total, + Map additionalProperties) { + this.billedAt = billedAt; + this.charge = charge; + this.credit = credit; + this.currency = currency; + this.lines = lines; + this.timing = timing; + this.total = total; + this.additionalProperties = additionalProperties; + } + + /** + * @return When the proration is charged: the change for now, the period's end for at_renewal. Null when nothing is charged. + */ + @JsonProperty("billed_at") + public Optional getBilledAt() { + return billedAt; + } + + /** + * @return Sum of the charge lines, in minor units, before tax. + */ + @JsonProperty("charge") + public long getCharge() { + return charge; + } + + /** + * @return Sum of the credit lines, in minor units, before tax: zero or below. + */ + @JsonProperty("credit") + public long getCredit() { + return credit; + } + + @JsonProperty("currency") + public Currency getCurrency() { + return currency; + } + + @JsonProperty("lines") + public List getLines() { + return lines; + } + + /** + * @return When the proration is charged: now, at_renewal, or none when it nets to nothing. + */ + @JsonProperty("timing") + public CheckoutChargeTiming getTiming() { + return timing; + } + + /** + * @return credit plus charge, before tax. Equals proration. + */ + @JsonProperty("total") + public long getTotal() { + return total; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PreviewSubscriptionProrationResponseData + && equalTo((PreviewSubscriptionProrationResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PreviewSubscriptionProrationResponseData other) { + return billedAt.equals(other.billedAt) + && charge == other.charge + && credit == other.credit + && currency.equals(other.currency) + && lines.equals(other.lines) + && timing.equals(other.timing) + && total == other.total; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billedAt, this.charge, this.credit, this.currency, this.lines, this.timing, this.total); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChargeStage builder() { + return new Builder(); + } + + public interface ChargeStage { + /** + *

Sum of the charge lines, in minor units, before tax.

+ */ + CreditStage charge(long charge); + + Builder from(PreviewSubscriptionProrationResponseData other); + } + + public interface CreditStage { + /** + *

Sum of the credit lines, in minor units, before tax: zero or below.

+ */ + CurrencyStage credit(long credit); + } + + public interface CurrencyStage { + TimingStage currency(@NotNull Currency currency); + } + + public interface TimingStage { + /** + *

When the proration is charged: now, at_renewal, or none when it nets to nothing.

+ */ + TotalStage timing(@NotNull CheckoutChargeTiming timing); + } + + public interface TotalStage { + /** + *

credit plus charge, before tax. Equals proration.

+ */ + _FinalStage total(long total); + } + + public interface _FinalStage { + PreviewSubscriptionProrationResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

When the proration is charged: the change for now, the period's end for at_renewal. Null when nothing is charged.

+ */ + _FinalStage billedAt(Optional billedAt); + + _FinalStage billedAt(OffsetDateTime billedAt); + + _FinalStage lines(List lines); + + _FinalStage addLines(PreviewSubscriptionProrationLineResponseData lines); + + _FinalStage addAllLines(List lines); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChargeStage, CreditStage, CurrencyStage, TimingStage, TotalStage, _FinalStage { + private long charge; + + private long credit; + + private Currency currency; + + private CheckoutChargeTiming timing; + + private long total; + + private List lines = new ArrayList<>(); + + private Optional billedAt = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PreviewSubscriptionProrationResponseData other) { + billedAt(other.getBilledAt()); + charge(other.getCharge()); + credit(other.getCredit()); + currency(other.getCurrency()); + lines(other.getLines()); + timing(other.getTiming()); + total(other.getTotal()); + return this; + } + + /** + *

Sum of the charge lines, in minor units, before tax.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("charge") + public CreditStage charge(long charge) { + this.charge = charge; + return this; + } + + /** + *

Sum of the credit lines, in minor units, before tax: zero or below.

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

When the proration is charged: now, at_renewal, or none when it nets to nothing.

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

credit plus charge, before tax. Equals proration.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("total") + public _FinalStage total(long total) { + this.total = total; + return this; + } + + @java.lang.Override + public _FinalStage addAllLines(List lines) { + if (lines != null) { + this.lines.addAll(lines); + } + return this; + } + + @java.lang.Override + public _FinalStage addLines(PreviewSubscriptionProrationLineResponseData lines) { + this.lines.add(lines); + return this; + } + + @java.lang.Override + @JsonSetter(value = "lines", nulls = Nulls.SKIP) + public _FinalStage lines(List lines) { + this.lines.clear(); + if (lines != null) { + this.lines.addAll(lines); + } + return this; + } + + /** + *

When the proration is charged: the change for now, the period's end for at_renewal. Null when nothing is charged.

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

When the proration is charged: the change for now, the period's end for at_renewal. Null when nothing is charged.

+ */ + @java.lang.Override + @JsonSetter(value = "billed_at", nulls = Nulls.SKIP) + public _FinalStage billedAt(Optional billedAt) { + this.billedAt = billedAt; + return this; + } + + @java.lang.Override + public PreviewSubscriptionProrationResponseData build() { + return new PreviewSubscriptionProrationResponseData( + billedAt, charge, credit, currency, lines, timing, total, additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("billed_at") + || key.equalsIgnoreCase("charge") + || key.equalsIgnoreCase("credit") + || key.equalsIgnoreCase("currency") + || key.equalsIgnoreCase("lines") + || key.equalsIgnoreCase("timing") + || key.equalsIgnoreCase("total")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/ProrationLineKind.java b/src/main/java/com/schematic/api/types/ProrationLineKind.java new file mode 100644 index 00000000..7b1e7f89 --- /dev/null +++ b/src/main/java/com/schematic/api/types/ProrationLineKind.java @@ -0,0 +1,83 @@ +/** + * 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 ProrationLineKind { + public static final ProrationLineKind CREDIT = new ProrationLineKind(Value.CREDIT, "credit"); + + public static final ProrationLineKind CHARGE = new ProrationLineKind(Value.CHARGE, "charge"); + + private final Value value; + + private final String string; + + ProrationLineKind(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 ProrationLineKind && this.string.equals(((ProrationLineKind) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CREDIT: + return visitor.visitCredit(); + case CHARGE: + return visitor.visitCharge(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProrationLineKind valueOf(String value) { + switch (value) { + case "credit": + return CREDIT; + case "charge": + return CHARGE; + default: + return new ProrationLineKind(Value.UNKNOWN, value); + } + } + + public enum Value { + CHARGE, + + CREDIT, + + UNKNOWN + } + + public interface Visitor { + T visitCharge(); + + T visitCredit(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PublicCatalogResponseData.java b/src/main/java/com/schematic/api/types/PublicCatalogResponseData.java new file mode 100644 index 00000000..e21067ed --- /dev/null +++ b/src/main/java/com/schematic/api/types/PublicCatalogResponseData.java @@ -0,0 +1,509 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PublicCatalogResponseData.Builder.class) +public final class PublicCatalogResponseData { + private final List addOns; + + private final CatalogCapabilitiesResponseData capabilities; + + private final List creditBundles; + + private final Optional customPlanCta; + + private final Currency defaultCurrency; + + private final Optional description; + + private final String id; + + private final String name; + + private final List plans; + + private final Optional pricingModel; + + private final Optional pricingUrl; + + private final Map additionalProperties; + + private PublicCatalogResponseData( + List addOns, + CatalogCapabilitiesResponseData capabilities, + List creditBundles, + Optional customPlanCta, + Currency defaultCurrency, + Optional description, + String id, + String name, + List plans, + Optional pricingModel, + Optional pricingUrl, + Map additionalProperties) { + this.addOns = addOns; + this.capabilities = capabilities; + this.creditBundles = creditBundles; + this.customPlanCta = customPlanCta; + this.defaultCurrency = defaultCurrency; + this.description = description; + this.id = id; + this.name = name; + this.plans = plans; + this.pricingModel = pricingModel; + this.pricingUrl = pricingUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("add_ons") + public List getAddOns() { + return addOns; + } + + @JsonProperty("capabilities") + public CatalogCapabilitiesResponseData getCapabilities() { + return capabilities; + } + + @JsonProperty("credit_bundles") + public List getCreditBundles() { + return creditBundles; + } + + /** + * @return Present when the catalog offers a custom plan; absent when custom plans are hidden. + */ + @JsonProperty("custom_plan_cta") + public Optional getCustomPlanCta() { + return customPlanCta; + } + + /** + * @return ISO 4217 currency of every top-level price slot; currency_prices carries the others. + */ + @JsonProperty("default_currency") + public Currency getDefaultCurrency() { + return defaultCurrency; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("plans") + public List getPlans() { + return plans; + } + + @JsonProperty("pricing_model") + public Optional getPricingModel() { + return pricingModel; + } + + @JsonProperty("pricing_url") + public Optional getPricingUrl() { + return pricingUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PublicCatalogResponseData && equalTo((PublicCatalogResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PublicCatalogResponseData other) { + return addOns.equals(other.addOns) + && capabilities.equals(other.capabilities) + && creditBundles.equals(other.creditBundles) + && customPlanCta.equals(other.customPlanCta) + && defaultCurrency.equals(other.defaultCurrency) + && description.equals(other.description) + && id.equals(other.id) + && name.equals(other.name) + && plans.equals(other.plans) + && pricingModel.equals(other.pricingModel) + && pricingUrl.equals(other.pricingUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.addOns, + this.capabilities, + this.creditBundles, + this.customPlanCta, + this.defaultCurrency, + this.description, + this.id, + this.name, + this.plans, + this.pricingModel, + this.pricingUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CapabilitiesStage builder() { + return new Builder(); + } + + public interface CapabilitiesStage { + DefaultCurrencyStage capabilities(@NotNull CatalogCapabilitiesResponseData capabilities); + + Builder from(PublicCatalogResponseData other); + } + + public interface DefaultCurrencyStage { + /** + *

ISO 4217 currency of every top-level price slot; currency_prices carries the others.

+ */ + IdStage defaultCurrency(@NotNull Currency defaultCurrency); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + PublicCatalogResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage addOns(List addOns); + + _FinalStage addAddOns(CatalogPlanResponseData addOns); + + _FinalStage addAllAddOns(List addOns); + + _FinalStage creditBundles(List creditBundles); + + _FinalStage addCreditBundles(CatalogCreditBundleResponseData creditBundles); + + _FinalStage addAllCreditBundles(List creditBundles); + + /** + *

Present when the catalog offers a custom plan; absent when custom plans are hidden.

+ */ + _FinalStage customPlanCta(Optional customPlanCta); + + _FinalStage customPlanCta(CatalogCustomPlanCtaResponseData customPlanCta); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage plans(List plans); + + _FinalStage addPlans(CatalogPlanResponseData plans); + + _FinalStage addAllPlans(List plans); + + _FinalStage pricingModel(Optional pricingModel); + + _FinalStage pricingModel(String pricingModel); + + _FinalStage pricingUrl(Optional pricingUrl); + + _FinalStage pricingUrl(String pricingUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CapabilitiesStage, DefaultCurrencyStage, IdStage, NameStage, _FinalStage { + private CatalogCapabilitiesResponseData capabilities; + + private Currency defaultCurrency; + + private String id; + + private String name; + + private Optional pricingUrl = Optional.empty(); + + private Optional pricingModel = Optional.empty(); + + private List plans = new ArrayList<>(); + + private Optional description = Optional.empty(); + + private Optional customPlanCta = Optional.empty(); + + private List creditBundles = new ArrayList<>(); + + private List addOns = new ArrayList<>(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PublicCatalogResponseData other) { + addOns(other.getAddOns()); + capabilities(other.getCapabilities()); + creditBundles(other.getCreditBundles()); + customPlanCta(other.getCustomPlanCta()); + defaultCurrency(other.getDefaultCurrency()); + description(other.getDescription()); + id(other.getId()); + name(other.getName()); + plans(other.getPlans()); + pricingModel(other.getPricingModel()); + pricingUrl(other.getPricingUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("capabilities") + public DefaultCurrencyStage capabilities(@NotNull CatalogCapabilitiesResponseData capabilities) { + this.capabilities = Objects.requireNonNull(capabilities, "capabilities must not be null"); + return this; + } + + /** + *

ISO 4217 currency of every top-level price slot; currency_prices carries the others.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("default_currency") + public IdStage defaultCurrency(@NotNull Currency defaultCurrency) { + this.defaultCurrency = Objects.requireNonNull(defaultCurrency, "defaultCurrency 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 _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage pricingUrl(String pricingUrl) { + this.pricingUrl = Optional.ofNullable(pricingUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_url", nulls = Nulls.SKIP) + public _FinalStage pricingUrl(Optional pricingUrl) { + this.pricingUrl = pricingUrl; + return this; + } + + @java.lang.Override + public _FinalStage pricingModel(String pricingModel) { + this.pricingModel = Optional.ofNullable(pricingModel); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pricing_model", nulls = Nulls.SKIP) + public _FinalStage pricingModel(Optional pricingModel) { + this.pricingModel = pricingModel; + return this; + } + + @java.lang.Override + public _FinalStage addAllPlans(List plans) { + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlans(CatalogPlanResponseData plans) { + this.plans.add(plans); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plans", nulls = Nulls.SKIP) + public _FinalStage plans(List plans) { + this.plans.clear(); + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

Present when the catalog offers a custom plan; absent when custom plans are hidden.

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

Present when the catalog offers a custom plan; absent when custom plans are hidden.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_plan_cta", nulls = Nulls.SKIP) + public _FinalStage customPlanCta(Optional customPlanCta) { + this.customPlanCta = customPlanCta; + return this; + } + + @java.lang.Override + public _FinalStage addAllCreditBundles(List creditBundles) { + if (creditBundles != null) { + this.creditBundles.addAll(creditBundles); + } + return this; + } + + @java.lang.Override + public _FinalStage addCreditBundles(CatalogCreditBundleResponseData creditBundles) { + this.creditBundles.add(creditBundles); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_bundles", nulls = Nulls.SKIP) + public _FinalStage creditBundles(List creditBundles) { + this.creditBundles.clear(); + if (creditBundles != null) { + this.creditBundles.addAll(creditBundles); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllAddOns(List addOns) { + if (addOns != null) { + this.addOns.addAll(addOns); + } + return this; + } + + @java.lang.Override + public _FinalStage addAddOns(CatalogPlanResponseData addOns) { + this.addOns.add(addOns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "add_ons", nulls = Nulls.SKIP) + public _FinalStage addOns(List addOns) { + this.addOns.clear(); + if (addOns != null) { + this.addOns.addAll(addOns); + } + return this; + } + + @java.lang.Override + public PublicCatalogResponseData build() { + return new PublicCatalogResponseData( + addOns, + capabilities, + creditBundles, + customPlanCta, + defaultCurrency, + description, + id, + name, + plans, + pricingModel, + pricingUrl, + additionalProperties); + } + + @JsonAnySetter + private void putAdditionalPropertyFromJson(String key, Object value) { + if (key.equalsIgnoreCase("add_ons") + || key.equalsIgnoreCase("capabilities") + || key.equalsIgnoreCase("credit_bundles") + || key.equalsIgnoreCase("custom_plan_cta") + || key.equalsIgnoreCase("default_currency") + || key.equalsIgnoreCase("description") + || key.equalsIgnoreCase("id") + || key.equalsIgnoreCase("name") + || key.equalsIgnoreCase("plans") + || key.equalsIgnoreCase("pricing_model") + || key.equalsIgnoreCase("pricing_url")) { + return; + } + this.additionalProperties.put(key, value); + } + + @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/PublishPlanVersionRequestBody.java b/src/main/java/com/schematic/api/types/PublishPlanVersionRequestBody.java index c9b7cd8f..96c16852 100644 --- a/src/main/java/com/schematic/api/types/PublishPlanVersionRequestBody.java +++ b/src/main/java/com/schematic/api/types/PublishPlanVersionRequestBody.java @@ -42,6 +42,8 @@ public final class PublishPlanVersionRequestBody { private final Optional daysUntilDue; + private final Optional endDate; + private final List excludedCompanyIds; private final PlanVersionMigrationStrategy migrationStrategy; @@ -72,6 +74,7 @@ private PublishPlanVersionRequestBody( Optional> customFieldValues, Optional customerEmail, Optional daysUntilDue, + Optional endDate, List excludedCompanyIds, PlanVersionMigrationStrategy migrationStrategy, Optional phone, @@ -91,6 +94,7 @@ private PublishPlanVersionRequestBody( this.customFieldValues = customFieldValues; this.customerEmail = customerEmail; this.daysUntilDue = daysUntilDue; + this.endDate = endDate; this.excludedCompanyIds = excludedCompanyIds; this.migrationStrategy = migrationStrategy; this.phone = phone; @@ -166,6 +170,14 @@ public Optional getDaysUntilDue() { return daysUntilDue; } + /** + * @return When a custom plan that doesn't renew ends: the company moves to the default plan then, and no renewal invoice is raised. Required when the version's renewal_policy is expire_to_default, and refused otherwise. Moved back to the last renewal on or before it, which must leave at least one whole billing period. Only honored on a first publish that starts a subscription. + */ + @JsonProperty("end_date") + public Optional getEndDate() { + return endDate; + } + @JsonProperty("excluded_company_ids") public List getExcludedCompanyIds() { return excludedCompanyIds; @@ -247,6 +259,7 @@ private boolean equalTo(PublishPlanVersionRequestBody other) { && customFieldValues.equals(other.customFieldValues) && customerEmail.equals(other.customerEmail) && daysUntilDue.equals(other.daysUntilDue) + && endDate.equals(other.endDate) && excludedCompanyIds.equals(other.excludedCompanyIds) && migrationStrategy.equals(other.migrationStrategy) && phone.equals(other.phone) @@ -270,6 +283,7 @@ public int hashCode() { this.customFieldValues, this.customerEmail, this.daysUntilDue, + this.endDate, this.excludedCompanyIds, this.migrationStrategy, this.phone, @@ -357,6 +371,13 @@ public interface _FinalStage { _FinalStage daysUntilDue(Long daysUntilDue); + /** + *

When a custom plan that doesn't renew ends: the company moves to the default plan then, and no renewal invoice is raised. Required when the version's renewal_policy is expire_to_default, and refused otherwise. Moved back to the last renewal on or before it, which must leave at least one whole billing period. Only honored on a first publish that starts a subscription.

+ */ + _FinalStage endDate(Optional endDate); + + _FinalStage endDate(OffsetDateTime endDate); + _FinalStage excludedCompanyIds(List excludedCompanyIds); _FinalStage addExcludedCompanyIds(String excludedCompanyIds); @@ -427,6 +448,8 @@ public static final class Builder implements MigrationStrategyStage, _FinalStage private List excludedCompanyIds = new ArrayList<>(); + private Optional endDate = Optional.empty(); + private Optional daysUntilDue = Optional.empty(); private Optional customerEmail = Optional.empty(); @@ -460,6 +483,7 @@ public Builder from(PublishPlanVersionRequestBody other) { customFieldValues(other.getCustomFieldValues()); customerEmail(other.getCustomerEmail()); daysUntilDue(other.getDaysUntilDue()); + endDate(other.getEndDate()); excludedCompanyIds(other.getExcludedCompanyIds()); migrationStrategy(other.getMigrationStrategy()); phone(other.getPhone()); @@ -629,6 +653,26 @@ public _FinalStage excludedCompanyIds(List excludedCompanyIds) { return this; } + /** + *

When a custom plan that doesn't renew ends: the company moves to the default plan then, and no renewal invoice is raised. Required when the version's renewal_policy is expire_to_default, and refused otherwise. Moved back to the last renewal on or before it, which must leave at least one whole billing period. Only honored on a first publish that starts a subscription.

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

When a custom plan that doesn't renew ends: the company moves to the default plan then, and no renewal invoice is raised. Required when the version's renewal_policy is expire_to_default, and refused otherwise. Moved back to the last renewal on or before it, which must leave at least one whole billing period. Only honored on a first publish that starts a subscription.

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

Payment terms in days. On a custom-plan republish they apply to the amendment invoice only, leave the subscription's renewal terms unchanged, and are only used when that invoice is raised today and sent rather than charged. Defaults to the subscription's terms.

* @return Reference to {@code this} so that method calls can be chained together. @@ -800,6 +844,7 @@ public PublishPlanVersionRequestBody build() { customFieldValues, customerEmail, daysUntilDue, + endDate, excludedCompanyIds, migrationStrategy, phone, @@ -823,6 +868,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("custom_field_values") || key.equalsIgnoreCase("customer_email") || key.equalsIgnoreCase("days_until_due") + || key.equalsIgnoreCase("end_date") || key.equalsIgnoreCase("excluded_company_ids") || key.equalsIgnoreCase("migration_strategy") || key.equalsIgnoreCase("phone") diff --git a/src/main/java/com/schematic/api/types/PublishPreviewResponseData.java b/src/main/java/com/schematic/api/types/PublishPreviewResponseData.java index 6f1763db..ba0af52d 100644 --- a/src/main/java/com/schematic/api/types/PublishPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/PublishPreviewResponseData.java @@ -40,6 +40,8 @@ public final class PublishPreviewResponseData { private final Optional effectiveAt; + private final Optional endsAt; + private final boolean hasBillingChanges; private final Optional immediateInvoiceAmount; @@ -81,6 +83,7 @@ private PublishPreviewResponseData( long defaultDaysUntilDue, boolean defaultSendInvoice, Optional effectiveAt, + Optional endsAt, boolean hasBillingChanges, Optional immediateInvoiceAmount, AmendmentProrationLandsOn landsOn, @@ -105,6 +108,7 @@ private PublishPreviewResponseData( this.defaultDaysUntilDue = defaultDaysUntilDue; this.defaultSendInvoice = defaultSendInvoice; this.effectiveAt = effectiveAt; + this.endsAt = endsAt; this.hasBillingChanges = hasBillingChanges; this.immediateInvoiceAmount = immediateInvoiceAmount; this.landsOn = landsOn; @@ -175,6 +179,14 @@ public Optional getEffectiveAt() { return effectiveAt; } + /** + * @return When the subscription ends instead of renewing once the amendment is finalized: the end date moved back to a renewal, or the end it already has. Null when it renews. + */ + @JsonProperty("ends_at") + public Optional getEndsAt() { + return endsAt; + } + @JsonProperty("has_billing_changes") public boolean getHasBillingChanges() { return hasBillingChanges; @@ -288,6 +300,7 @@ private boolean equalTo(PublishPreviewResponseData other) { && defaultDaysUntilDue == other.defaultDaysUntilDue && defaultSendInvoice == other.defaultSendInvoice && effectiveAt.equals(other.effectiveAt) + && endsAt.equals(other.endsAt) && hasBillingChanges == other.hasBillingChanges && immediateInvoiceAmount.equals(other.immediateInvoiceAmount) && landsOn.equals(other.landsOn) @@ -316,6 +329,7 @@ public int hashCode() { this.defaultDaysUntilDue, this.defaultSendInvoice, this.effectiveAt, + this.endsAt, this.hasBillingChanges, this.immediateInvoiceAmount, this.landsOn, @@ -436,6 +450,13 @@ public interface _FinalStage { _FinalStage effectiveAt(OffsetDateTime effectiveAt); + /** + *

When the subscription ends instead of renewing once the amendment is finalized: the end date moved back to a renewal, or the end it already has. Null when it renews.

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

What the amendment's own invoice bills, in cents, when lands_on is immediate_invoice, after discounts and tax. Includes pending invoice items Stripe adds to the same invoice. Negative for a downgrade: Stripe raises a credit invoice with nothing due, and the credit goes to the customer's balance against later invoices.

*/ @@ -528,6 +549,8 @@ public static final class Builder private Optional immediateInvoiceAmount = Optional.empty(); + private Optional endsAt = Optional.empty(); + private Optional effectiveAt = Optional.empty(); private Optional currentPeriodStart = Optional.empty(); @@ -552,6 +575,7 @@ public Builder from(PublishPreviewResponseData other) { defaultDaysUntilDue(other.getDefaultDaysUntilDue()); defaultSendInvoice(other.getDefaultSendInvoice()); effectiveAt(other.getEffectiveAt()); + endsAt(other.getEndsAt()); hasBillingChanges(other.getHasBillingChanges()); immediateInvoiceAmount(other.getImmediateInvoiceAmount()); landsOn(other.getLandsOn()); @@ -807,6 +831,26 @@ public _FinalStage immediateInvoiceAmount(Optional immediateInvoiceAmount) return this; } + /** + *

When the subscription ends instead of renewing once the amendment is finalized: the end date moved back to a renewal, or the end it already has. Null when it renews.

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

When the subscription ends instead of renewing once the amendment is finalized: the end date moved back to a renewal, or the end it already has. Null when it renews.

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

When the company moves to the new version. Null when no date can be named yet: the company's only subscription is in dunning or scheduled to cancel.

* @return Reference to {@code this} so that method calls can be chained together. @@ -890,6 +934,7 @@ public PublishPreviewResponseData build() { defaultDaysUntilDue, defaultSendInvoice, effectiveAt, + endsAt, hasBillingChanges, immediateInvoiceAmount, landsOn, @@ -918,6 +963,7 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("default_days_until_due") || key.equalsIgnoreCase("default_send_invoice") || key.equalsIgnoreCase("effective_at") + || key.equalsIgnoreCase("ends_at") || key.equalsIgnoreCase("has_billing_changes") || key.equalsIgnoreCase("immediate_invoice_amount") || key.equalsIgnoreCase("lands_on") diff --git a/src/main/java/com/schematic/api/types/RenewalPolicy.java b/src/main/java/com/schematic/api/types/RenewalPolicy.java new file mode 100644 index 00000000..24f109db --- /dev/null +++ b/src/main/java/com/schematic/api/types/RenewalPolicy.java @@ -0,0 +1,94 @@ +/** + * 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 RenewalPolicy { + public static final RenewalPolicy EXPIRE_TO_DEFAULT = + new RenewalPolicy(Value.EXPIRE_TO_DEFAULT, "expire_to_default"); + + public static final RenewalPolicy HOLD_WITH_GRACE = new RenewalPolicy(Value.HOLD_WITH_GRACE, "hold_with_grace"); + + public static final RenewalPolicy AUTO_RENEW = new RenewalPolicy(Value.AUTO_RENEW, "auto_renew"); + + private final Value value; + + private final String string; + + RenewalPolicy(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 RenewalPolicy && this.string.equals(((RenewalPolicy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXPIRE_TO_DEFAULT: + return visitor.visitExpireToDefault(); + case HOLD_WITH_GRACE: + return visitor.visitHoldWithGrace(); + case AUTO_RENEW: + return visitor.visitAutoRenew(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RenewalPolicy valueOf(String value) { + switch (value) { + case "expire_to_default": + return EXPIRE_TO_DEFAULT; + case "hold_with_grace": + return HOLD_WITH_GRACE; + case "auto_renew": + return AUTO_RENEW; + default: + return new RenewalPolicy(Value.UNKNOWN, value); + } + } + + public enum Value { + AUTO_RENEW, + + EXPIRE_TO_DEFAULT, + + HOLD_WITH_GRACE, + + UNKNOWN + } + + public interface Visitor { + T visitAutoRenew(); + + T visitExpireToDefault(); + + T visitHoldWithGrace(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java index 09563beb..11f41df5 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -90,6 +90,8 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional unitPriceDecimal; + private final Optional> warningTiers; + private final Map additionalProperties; private UpdateBillingPlanCreditGrantRequestBody( @@ -127,6 +129,7 @@ private UpdateBillingPlanCreditGrantRequestBody( Optional tierMode, Optional unitPrice, Optional unitPriceDecimal, + Optional> warningTiers, Map additionalProperties) { this.applyToExisting = applyToExisting; this.arrearsAnchor = arrearsAnchor; @@ -162,6 +165,7 @@ private UpdateBillingPlanCreditGrantRequestBody( this.tierMode = tierMode; this.unitPrice = unitPrice; this.unitPriceDecimal = unitPriceDecimal; + this.warningTiers = warningTiers; this.additionalProperties = additionalProperties; } @@ -383,6 +387,14 @@ public Optional getUnitPriceDecimal() { return unitPriceDecimal; } + /** + * @return Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5. + */ + @JsonProperty("warning_tiers") + public Optional> getWarningTiers() { + return warningTiers; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -429,7 +441,8 @@ private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { && scaling.equals(other.scaling) && tierMode.equals(other.tierMode) && unitPrice.equals(other.unitPrice) - && unitPriceDecimal.equals(other.unitPriceDecimal); + && unitPriceDecimal.equals(other.unitPriceDecimal) + && warningTiers.equals(other.warningTiers); } @java.lang.Override @@ -468,7 +481,8 @@ public int hashCode() { this.scaling, this.tierMode, this.unitPrice, - this.unitPriceDecimal); + this.unitPriceDecimal, + this.warningTiers); } @java.lang.Override @@ -672,6 +686,13 @@ public interface _FinalStage { _FinalStage unitPriceDecimal(Optional unitPriceDecimal); _FinalStage unitPriceDecimal(String unitPriceDecimal); + + /** + *

Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5.

+ */ + _FinalStage warningTiers(Optional> warningTiers); + + _FinalStage warningTiers(List warningTiers); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -680,6 +701,8 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private BillingPlanCreditGrantResetStart resetStart; + private Optional> warningTiers = Optional.empty(); + private Optional unitPriceDecimal = Optional.empty(); private Optional unitPrice = Optional.empty(); @@ -784,6 +807,7 @@ public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { tierMode(other.getTierMode()); unitPrice(other.getUnitPrice()); unitPriceDecimal(other.getUnitPriceDecimal()); + warningTiers(other.getWarningTiers()); return this; } @@ -801,6 +825,26 @@ public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetSta return this; } + /** + *

Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5.

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

Usage-warning thresholds, in credits remaining in the company's balance (grant, rollover, top-ups and bundles together). Each value must be below the grant amount, and values must be unique. Schematic sends a credit.usage_warning_reached webhook once when the balance drops to each threshold, and again after the balance rises back above it. Omit to leave the thresholds as they are; send an empty list to remove them. At most 5.

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

Price per credit as a decimal in the plan currency's smallest unit, for prices below one cent.

* @return Reference to {@code this} so that method calls can be chained together. @@ -1366,6 +1410,7 @@ public UpdateBillingPlanCreditGrantRequestBody build() { tierMode, unitPrice, unitPriceDecimal, + warningTiers, additionalProperties); } @@ -1404,7 +1449,8 @@ private void putAdditionalPropertyFromJson(String key, Object value) { || key.equalsIgnoreCase("scaling") || key.equalsIgnoreCase("tier_mode") || key.equalsIgnoreCase("unit_price") - || key.equalsIgnoreCase("unit_price_decimal")) { + || key.equalsIgnoreCase("unit_price_decimal") + || key.equalsIgnoreCase("warning_tiers")) { return; } this.additionalProperties.put(key, value); diff --git a/src/main/java/com/schematic/api/types/WebhookRequestType.java b/src/main/java/com/schematic/api/types/WebhookRequestType.java index 9213f3dd..ade12454 100644 --- a/src/main/java/com/schematic/api/types/WebhookRequestType.java +++ b/src/main/java/com/schematic/api/types/WebhookRequestType.java @@ -28,6 +28,9 @@ public final class WebhookRequestType { public static final WebhookRequestType USER_UPDATED = new WebhookRequestType(Value.USER_UPDATED, "user.updated"); + public static final WebhookRequestType CREDIT_USAGE_WARNING_REACHED = + new WebhookRequestType(Value.CREDIT_USAGE_WARNING_REACHED, "credit.usage_warning_reached"); + public static final WebhookRequestType AUTO_TOPUP_HARD_FAILURE = new WebhookRequestType(Value.AUTO_TOPUP_HARD_FAILURE, "auto.topup.hard.failure"); @@ -167,6 +170,8 @@ public T visit(Visitor visitor) { return visitor.visitPlanEntitlementCreated(); case USER_UPDATED: return visitor.visitUserUpdated(); + case CREDIT_USAGE_WARNING_REACHED: + return visitor.visitCreditUsageWarningReached(); case AUTO_TOPUP_HARD_FAILURE: return visitor.visitAutoTopupHardFailure(); case COMPANY_OVERRIDE_DELETED: @@ -258,6 +263,8 @@ public static WebhookRequestType valueOf(String value) { return PLAN_ENTITLEMENT_CREATED; case "user.updated": return USER_UPDATED; + case "credit.usage_warning_reached": + return CREDIT_USAGE_WARNING_REACHED; case "auto.topup.hard.failure": return AUTO_TOPUP_HARD_FAILURE; case "company.override.deleted": @@ -356,6 +363,8 @@ public enum Value { CREDIT_PURCHASE_SUCCESS, + CREDIT_USAGE_WARNING_REACHED, + ENTITLEMENT_LIMIT_REACHED, ENTITLEMENT_LIMIT_WARNING, @@ -442,6 +451,8 @@ public interface Visitor { T visitCreditPurchaseSuccess(); + T visitCreditUsageWarningReached(); + T visitEntitlementLimitReached(); T visitEntitlementLimitWarning(); diff --git a/src/test/java/com/schematic/api/UndiscriminatedUnionTest.java b/src/test/java/com/schematic/api/UndiscriminatedUnionTest.java index 6664d74b..1a894930 100644 --- a/src/test/java/com/schematic/api/UndiscriminatedUnionTest.java +++ b/src/test/java/com/schematic/api/UndiscriminatedUnionTest.java @@ -15,10 +15,11 @@ public final class UndiscriminatedUnionTest { @Test - public void testEventBody_EventBodyTrack() throws Exception { - String json = "{\"event\":\"test\"}"; + public void testEventBody_EventBodyInference() throws Exception { + String json = + "{\"company\":{},\"input_tokens\":1,\"output_tokens\":1,\"provider\":\"test\",\"response_model\":\"test\"}"; EventBody union = ObjectMappers.JSON_MAPPER.readValue(json, EventBody.class); - assertTrue(union.get() instanceof EventBodyTrack, "Expected EventBodyTrack but got different variant"); + assertTrue(union.get() instanceof EventBodyInference, "Expected EventBodyInference but got different variant"); } @Test @@ -29,17 +30,16 @@ public void testEventBody_EventBodyFlagCheck() throws Exception { } @Test - public void testEventBody_EventBodyIdentify() throws Exception { - String json = "{\"keys\":{}}"; + public void testEventBody_EventBodyTrack() throws Exception { + String json = "{\"event\":\"test\"}"; EventBody union = ObjectMappers.JSON_MAPPER.readValue(json, EventBody.class); - assertTrue(union.get() instanceof EventBodyIdentify, "Expected EventBodyIdentify but got different variant"); + assertTrue(union.get() instanceof EventBodyTrack, "Expected EventBodyTrack but got different variant"); } @Test - public void testEventBody_EventBodyInference() throws Exception { - String json = - "{\"company\":{},\"input_tokens\":1,\"output_tokens\":1,\"provider\":\"test\",\"response_model\":\"test\"}"; + public void testEventBody_EventBodyIdentify() throws Exception { + String json = "{\"keys\":{}}"; EventBody union = ObjectMappers.JSON_MAPPER.readValue(json, EventBody.class); - assertTrue(union.get() instanceof EventBodyInference, "Expected EventBodyInference but got different variant"); + assertTrue(union.get() instanceof EventBodyIdentify, "Expected EventBodyIdentify but got different variant"); } } diff --git a/src/test/java/com/schematic/api/core/PathSegmentsTest.java b/src/test/java/com/schematic/api/core/PathSegmentsTest.java new file mode 100644 index 00000000..333de377 --- /dev/null +++ b/src/test/java/com/schematic/api/core/PathSegmentsTest.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class PathSegmentsTest { + + @Test + public void testRejectsDotSegments() { + Assertions.assertThrows(IllegalArgumentException.class, () -> PathSegments.validate(".")); + Assertions.assertThrows(IllegalArgumentException.class, () -> PathSegments.validate("..")); + } + + @Test + public void testAllowsValuesContainingDots() { + Assertions.assertEquals("...", PathSegments.validate("...")); + Assertions.assertEquals("v1.2", PathSegments.validate("v1.2")); + Assertions.assertEquals("../plants", PathSegments.validate("../plants")); + } + + @Test + public void testValueStaysWithinOneSegment() { + HttpUrl url = HttpUrl.parse("https://api.example.com") + .newBuilder() + .addPathSegments("plants") + .addPathSegment(PathSegments.validate("../leaves?x#y")) + .addPathSegments("leaves") + .addPathSegment(PathSegments.validate("L1")) + .build(); + Assertions.assertEquals("/plants/..%2Fleaves%3Fx%23y/leaves/L1", url.encodedPath()); + } +} From 469276e08b69cc860b60ca7f4d7af89c1c761fc3 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:10:19 +0000 Subject: [PATCH 2/2] [fern-replay] advance lockfile --- .fern/replay.lock | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.fern/replay.lock b/.fern/replay.lock index e98ea3a6..d4c73e6a 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -108,5 +108,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-java-sdk: 4.32.2 -current_generation: fd4649e8ef55575e75fe5ed09fe6426977d342c6 + - commit_sha: 241fd3e8a164b4508d294c67575c80b5b9de45ae + tree_hash: 57cc72564970a405649e0f2cf792b3af345e03c4 + timestamp: 2026-10-26T10:10:15.836Z + cli_version: unknown + generator_versions: + fernapi/fern-java-sdk: 4.32.4 +current_generation: 241fd3e8a164b4508d294c67575c80b5b9de45ae patches: []