From 75bab164df1137425d691fa1429e3a01e7359b5c Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 14:40:00 +0000 Subject: [PATCH] SDK regeneration --- .fern/metadata.json | 6 +- build.gradle | 4 +- reference.md | 1342 ++++++++++++++++- .../com/schematic/api/AsyncBaseSchematic.java | 8 + .../com/schematic/api/core/ClientOptions.java | 4 +- .../resources/accounts/AccountsClient.java | 28 + .../accounts/AsyncAccountsClient.java | 29 + .../accounts/AsyncRawAccountsClient.java | 193 +++ .../resources/accounts/RawAccountsClient.java | 145 ++ .../requests/ListAccountMembersRequest.java | 201 +++ .../types/GetAccountMemberResponse.java | 181 +++ .../types/ListAccountMembersParams.java | 195 +++ .../types/ListAccountMembersResponse.java | 177 +++ .../CreateBillingSubscriptionRequestBody.java | 33 + .../requests/CreateMeterRequestBody.java | 39 +- .../companies/AsyncRawCompaniesClient.java | 14 + .../companies/RawCompaniesClient.java | 14 + .../requests/CountCompaniesRequest.java | 32 + .../requests/ListCompaniesRequest.java | 32 + .../requests/ListPlanChangesRequest.java | 26 +- .../companies/types/CountCompaniesParams.java | 32 + .../companies/types/ListCompaniesParams.java | 32 + .../types/ListPlanChangesParams.java | 26 +- .../resources/credits/AsyncCreditsClient.java | 13 + .../credits/AsyncRawCreditsClient.java | 84 ++ .../api/resources/credits/CreditsClient.java | 12 + .../resources/credits/RawCreditsClient.java | 62 + ...tSingleBillingPlanCreditGrantResponse.java | 184 +++ .../entitlements/AsyncEntitlementsClient.java | 14 + .../AsyncRawEntitlementsClient.java | 98 ++ .../entitlements/EntitlementsClient.java | 14 + .../entitlements/RawEntitlementsClient.java | 74 + ...llingLinkedPlanEntitlementRequestBody.java | 1064 +++++++++++++ .../CreatePlanEntitlementRequestBody.java | 33 + .../UpdatePlanEntitlementRequestBody.java | 33 + ...lanEntitlementRequestBodyMetricPeriod.java | 109 ++ ...mentRequestBodyMetricPeriodMonthReset.java | 89 ++ ...nEntitlementForBillingProductResponse.java | 182 +++ .../features/AsyncFeaturesClient.java | 14 + .../features/AsyncRawFeaturesClient.java | 154 +- .../resources/features/FeaturesClient.java | 14 + .../resources/features/RawFeaturesClient.java | 129 +- .../requests/CountFeaturesRequest.java | 170 +-- ...CreateBillingLinkedFeatureRequestBody.java | 496 ++++++ .../requests/ListFeaturesRequest.java | 170 +-- ...psertFeatureForBillingProductResponse.java | 182 +++ .../AsyncIntegrationsapiClient.java | 36 + .../AsyncRawIntegrationsapiClient.java | 121 ++ .../IntegrationsapiClient.java | 34 + .../RawIntegrationsapiClient.java | 93 ++ .../GetIntegrationWebhookUrlResponse.java | 183 +++ .../api/resources/plans/AsyncPlansClient.java | 53 + .../resources/plans/AsyncRawPlansClient.java | 410 +++++ .../api/resources/plans/PlansClient.java | 52 + .../api/resources/plans/RawPlansClient.java | 312 ++++ ...ntBillingProductMatchCompaniesRequest.java | 263 ++++ .../plans/requests/CountPlansRequest.java | 32 + .../CreateBillingLinkedPlanRequestBody.java | 260 ++++ .../requests/CreateCustomPlanRequestBody.java | 232 +++ ...stBillingProductMatchCompaniesRequest.java | 263 ++++ .../plans/requests/ListPlansRequest.java | 32 + .../PublishPlanVersionRequestBody.java | 156 +- ...untBillingProductMatchCompaniesParams.java | 204 +++ ...tBillingProductMatchCompaniesResponse.java | 156 ++ .../plans/types/CountPlansParams.java | 32 + .../plans/types/CreateCustomPlanResponse.java | 181 +++ ...istBillingProductMatchCompaniesParams.java | 204 +++ ...tBillingProductMatchCompaniesResponse.java | 178 +++ .../plans/types/ListPlansParams.java | 32 + .../UpsertPlanForBillingProductResponse.java | 182 +++ .../api/types/AccountMemberPermission.java | 229 +++ .../api/types/AccountMemberResponseData.java | 345 +++++ ...lledByType.java => AccountMemberRole.java} | 38 +- .../api/types/BillingCreditGrantReason.java | 11 + .../BillingLinkedResourceResponseData.java | 170 +++ .../BillingPlanCreditGrantResponseData.java | 32 + .../types/BillingProductPlanResponseData.java | 12 +- .../api/types/BillingProviderType.java | 10 + .../api/types/CheckoutSubscription.java | 32 + .../api/types/CompanyDetailResponseData.java | 45 + .../types/CompanyPlanDetailResponseData.java | 152 +- ...eateBillingPlanCreditGrantRequestBody.java | 32 + .../CreateEntitlementInBundleRequestBody.java | 32 + ...dateConditionRequestBodyConditionType.java | 11 + .../api/types/CreatePlanRequestBody.java | 16 +- .../api/types/CurrencyPriceRequestBody.java | 318 ++++ .../types/CustomPlanActivationStrategy.java | 86 ++ .../types/CustomPlanBillingResponseData.java | 413 +++++ .../api/types/CustomPlanBillingStatus.java | 104 ++ .../api/types/DatastreamCompanyPlan.java | 43 +- .../api/types/FeatureDetailResponseData.java | 34 +- .../com/schematic/api/types/FeatureView.java | 32 + .../schematic/api/types/IntegrationType.java | 103 ++ .../IntegrationWebhookUrlResponseData.java | 141 ++ .../api/types/PlanCreditGrantView.java | 33 + .../api/types/PlanDetailResponseData.java | 152 +- .../types/PlanEntitlementResponseData.java | 34 +- .../PlanGroupPlanDetailResponseData.java | 152 +- .../com/schematic/api/types/PlanIcon.java | 312 ++++ .../schematic/api/types/PlanResponseData.java | 86 +- .../api/types/PlanVersionResponseData.java | 12 +- .../api/types/PlanViewPublicResponseData.java | 152 +- .../api/types/RulesEngineSchemaVersion.java | 16 +- .../com/schematic/api/types/TrialStatus.java | 92 ++ ...dateBillingPlanCreditGrantRequestBody.java | 32 + .../api/types/UpdatePlanRequestBody.java | 16 +- .../UsageBasedEntitlementRequestBody.java | 26 + .../com/schematic/api/types/WebhookUrl.java | 140 ++ 108 files changed, 13163 insertions(+), 421 deletions(-) create mode 100644 src/main/java/com/schematic/api/resources/accounts/requests/ListAccountMembersRequest.java create mode 100644 src/main/java/com/schematic/api/resources/accounts/types/GetAccountMemberResponse.java create mode 100644 src/main/java/com/schematic/api/resources/accounts/types/ListAccountMembersParams.java create mode 100644 src/main/java/com/schematic/api/resources/accounts/types/ListAccountMembersResponse.java create mode 100644 src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingPlanCreditGrantResponse.java create mode 100644 src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod.java create mode 100644 src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset.java create mode 100644 src/main/java/com/schematic/api/resources/entitlements/types/UpsertPlanEntitlementForBillingProductResponse.java create mode 100644 src/main/java/com/schematic/api/resources/features/requests/CreateBillingLinkedFeatureRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/features/types/UpsertFeatureForBillingProductResponse.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java create mode 100644 src/main/java/com/schematic/api/resources/integrationsapi/types/GetIntegrationWebhookUrlResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/CountBillingProductMatchCompaniesRequest.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/ListBillingProductMatchCompaniesRequest.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/CountBillingProductMatchCompaniesParams.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/CountBillingProductMatchCompaniesResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/CreateCustomPlanResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/ListBillingProductMatchCompaniesParams.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/ListBillingProductMatchCompaniesResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/UpsertPlanForBillingProductResponse.java create mode 100644 src/main/java/com/schematic/api/types/AccountMemberPermission.java create mode 100644 src/main/java/com/schematic/api/types/AccountMemberResponseData.java rename src/main/java/com/schematic/api/types/{PlanControlledByType.java => AccountMemberRole.java} (55%) create mode 100644 src/main/java/com/schematic/api/types/BillingLinkedResourceResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CurrencyPriceRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/CustomPlanActivationStrategy.java create mode 100644 src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CustomPlanBillingStatus.java create mode 100644 src/main/java/com/schematic/api/types/IntegrationType.java create mode 100644 src/main/java/com/schematic/api/types/IntegrationWebhookUrlResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PlanIcon.java create mode 100644 src/main/java/com/schematic/api/types/TrialStatus.java create mode 100644 src/main/java/com/schematic/api/types/WebhookUrl.java diff --git a/.fern/metadata.json b/.fern/metadata.json index 8d2fe62..f2055c4 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,5 +1,5 @@ { - "cliVersion": "4.43.1", + "cliVersion": "4.76.1", "generatorName": "fernapi/fern-java-sdk", "generatorVersion": "3.44.6", "generatorConfig": { @@ -11,6 +11,6 @@ "testImplementation org.mockito:mockito-junit-jupiter:5.3.1" ] }, - "originGitCommit": "2717563b79232180e36aa245da14c045650ea31b", - "sdkVersion": "1.3.1" + "originGitCommit": "3984203f8f49616dfdae68590f4b291c18ca1151", + "sdkVersion": "1.4.0" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 29c05bb..2c63ce4 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ java { group = 'com.schematichq' -version = '1.3.1' +version = '1.4.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -80,7 +80,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.3.1' + version = '1.4.0' from components.java pom { name = 'Schematic' diff --git a/reference.md b/reference.md index 1c3e10b..2c6f5b4 100644 --- a/reference.md +++ b/reference.md @@ -80,6 +80,120 @@ client.deletePlanAudiencesPlanAudienceId("plan_audience_id"); ## accounts +
client.accounts.listAccountMembers() -> ListAccountMembersResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().listAccountMembers( + ListAccountMembersRequest + .builder() + .ids( + Arrays.asList("ids") + ) + .q("q") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**ids:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` — Search filter + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ + +
+
+
+ +
client.accounts.getAccountMember(accountMemberId) -> GetAccountMemberResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().getAccountMember("account_member_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**accountMemberId:** `String` — account_member_id + +
+
+
+
+ + +
+
+
+
client.accounts.listApiKeys() -> ListApiKeysResponse
@@ -688,6 +802,9 @@ client.accounts().countAuditLogs( client.accounts().listEnvironments( ListEnvironmentsRequest .builder() + .ids( + Arrays.asList("ids") + ) .limit(1000000L) .offset(1000000L) .build() @@ -1284,8 +1401,11 @@ client.billing().upsertBillingCustomer( client.billing().listCustomersWithSubscriptions( ListCustomersWithSubscriptionsRequest .builder() + .companyIds( + Arrays.asList("company_ids") + ) .name("name") - .providerType(BillingProviderType.SCHEMATIC) + .providerType(BillingProviderType.ORB) .q("q") .limit(1000000L) .offset(1000000L) @@ -1373,8 +1493,11 @@ client.billing().listCustomersWithSubscriptions( client.billing().countCustomers( CountCustomersRequest .builder() + .companyIds( + Arrays.asList("company_ids") + ) .name("name") - .providerType(BillingProviderType.SCHEMATIC) + .providerType(BillingProviderType.ORB) .q("q") .limit(1000000L) .offset(1000000L) @@ -1799,6 +1922,14 @@ client.billing().upsertBillingMeter( **externalId:** `String` +
+
+ +
+
+ +**providerType:** `Optional` +
@@ -2032,6 +2163,12 @@ client.billing().upsertPaymentMethod( client.billing().listBillingPrices( ListBillingPricesRequest .builder() + .ids( + Arrays.asList("ids") + ) + .productIds( + Arrays.asList("product_ids") + ) .currency("currency") .forInitialPlan(true) .forTrialExpiryPlan(true) @@ -2039,7 +2176,7 @@ client.billing().listBillingPrices( .isActive(true) .price(1000000L) .productId("product_id") - .providerType(BillingProviderType.SCHEMATIC) + .providerType(BillingProviderType.ORB) .q("q") .tiersMode(BillingTiersMode.GRADUATED) .usageType(BillingPriceUsageType.LICENSED) @@ -2423,6 +2560,12 @@ client.billing().deleteBillingProduct("billing_id"); client.billing().listBillingProductPrices( ListBillingProductPricesRequest .builder() + .ids( + Arrays.asList("ids") + ) + .productIds( + Arrays.asList("product_ids") + ) .currency("currency") .forInitialPlan(true) .forTrialExpiryPlan(true) @@ -2430,7 +2573,7 @@ client.billing().listBillingProductPrices( .isActive(true) .price(1000000L) .productId("product_id") - .providerType(BillingProviderType.SCHEMATIC) + .providerType(BillingProviderType.ORB) .q("q") .tiersMode(BillingTiersMode.GRADUATED) .usageType(BillingPriceUsageType.LICENSED) @@ -2719,10 +2862,13 @@ client.billing().upsertBillingProduct( client.billing().listBillingProducts( ListBillingProductsRequest .builder() + .ids( + Arrays.asList("ids") + ) .isActive(true) .name("name") .priceUsageType(BillingPriceUsageType.LICENSED) - .providerType(BillingProviderType.SCHEMATIC) + .providerType(BillingProviderType.ORB) .q("q") .withOneTimeCharges(true) .withPricesOnly(true) @@ -2862,10 +3008,13 @@ client.billing().listBillingProducts( client.billing().countBillingProducts( CountBillingProductsRequest .builder() + .ids( + Arrays.asList("ids") + ) .isActive(true) .name("name") .priceUsageType(BillingPriceUsageType.LICENSED) - .providerType(BillingProviderType.SCHEMATIC) + .providerType(BillingProviderType.ORB) .q("q") .withOneTimeCharges(true) .withPricesOnly(true) @@ -3164,6 +3313,14 @@ client.billing().upsertBillingSubscription(
+**providerType:** `Optional` + +
+
+ +
+
+ **status:** `Optional`
@@ -3225,6 +3382,9 @@ client.billing().upsertBillingSubscription( client.credits().listBillingCredits( ListBillingCreditsRequest .builder() + .ids( + Arrays.asList("ids") + ) .name("name") .limit(1000000L) .offset(1000000L) @@ -3662,6 +3822,9 @@ client.credits().softDeleteBillingCredit("credit_id"); client.credits().listCreditBundles( ListCreditBundlesRequest .builder() + .ids( + Arrays.asList("ids") + ) .creditId("credit_id") .status(BillingCreditBundleStatus.ACTIVE) .bundleType("fixed") @@ -4086,6 +4249,9 @@ client.credits().deleteCreditBundle("bundle_id"); client.credits().countCreditBundles( CountCreditBundlesRequest .builder() + .ids( + Arrays.asList("ids") + ) .creditId("credit_id") .status(BillingCreditBundleStatus.ACTIVE) .bundleType("fixed") @@ -4175,6 +4341,9 @@ client.credits().countCreditBundles( client.credits().countBillingCredits( CountBillingCreditsRequest .builder() + .ids( + Arrays.asList("ids") + ) .name("name") .limit(1000000L) .offset(1000000L) @@ -4302,7 +4471,7 @@ client.credits().grantBillingCreditsToCompany( .companyId("company_id") .creditId("credit_id") .quantity(1000000L) - .reason(BillingCreditGrantReason.BILLING_CREDIT_AUTO_TOPUP) + .reason(BillingCreditGrantReason.ADJUSTMENT) .build() ); ``` @@ -4597,6 +4766,9 @@ client.credits().listCompanyGrants( client.credits().countBillingCreditsGrants( CountBillingCreditsGrantsRequest .builder() + .ids( + Arrays.asList("ids") + ) .creditId("credit_id") .limit(1000000L) .offset(1000000L) @@ -4668,6 +4840,9 @@ client.credits().countBillingCreditsGrants( client.credits().listGrantsForCredit( ListGrantsForCreditRequest .builder() + .ids( + Arrays.asList("ids") + ) .creditId("credit_id") .limit(1000000L) .offset(1000000L) @@ -4955,6 +5130,12 @@ client.credits().countCreditLedger( client.credits().listBillingPlanCreditGrants( ListBillingPlanCreditGrantsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) .creditId("credit_id") .planId("plan_id") .planVersionId("plan_version_id") @@ -5081,6 +5262,46 @@ client.credits().createBillingPlanCreditGrant(
+ + +
+ +
client.credits.getSingleBillingPlanCreditGrant(planGrantId) -> GetSingleBillingPlanCreditGrantResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.credits().getSingleBillingPlanCreditGrant("plan_grant_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planGrantId:** `String` — plan_grant_id + +
+
+
+
+ +
@@ -5210,6 +5431,12 @@ client.credits().deleteBillingPlanCreditGrant( client.credits().countBillingPlanCreditGrants( CountBillingPlanCreditGrantsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) .creditId("credit_id") .planId("plan_id") .planVersionId("plan_version_id") @@ -5984,6 +6211,22 @@ client.checkout().updateCustomerSubscriptionTrialEnd( client.companies().listCompanies( ListCompaniesRequest .builder() + .creditTypeIds( + Arrays.asList("credit_type_ids") + ) + .ids( + Arrays.asList("ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) + .subscriptionStatuses( + Arrays.asList(SubscriptionStatus.ACTIVE) + ) + .subscriptionTypes( + Arrays.asList(SubscriptionType.FREE) + ) + .hasScheduledDowngrade(true) .monetizedSubscriptions(true) .planId("plan_id") .planVersionId("plan_version_id") @@ -6021,6 +6264,14 @@ client.companies().listCompanies(
+**hasScheduledDowngrade:** `Optional` — Filter companies that have a pending scheduled downgrade + +
+
+ +
+
+ **ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_)
@@ -6329,6 +6580,22 @@ client.companies().deleteCompany( client.companies().countCompanies( CountCompaniesRequest .builder() + .creditTypeIds( + Arrays.asList("credit_type_ids") + ) + .ids( + Arrays.asList("ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) + .subscriptionStatuses( + Arrays.asList(SubscriptionStatus.ACTIVE) + ) + .subscriptionTypes( + Arrays.asList(SubscriptionType.FREE) + ) + .hasScheduledDowngrade(true) .monetizedSubscriptions(true) .planId("plan_id") .planVersionId("plan_version_id") @@ -6366,6 +6633,14 @@ client.companies().countCompanies(
+**hasScheduledDowngrade:** `Optional` — Filter companies that have a pending scheduled downgrade + +
+
+ +
+
+ **ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_)
@@ -6853,6 +7128,9 @@ client.companies().deleteCompanyMembership("company_membership_id"); client.companies().getActiveCompanySubscription( GetActiveCompanySubscriptionRequest .builder() + .companyIds( + Arrays.asList("company_ids") + ) .companyId("company_id") .limit(1000000L) .offset(1000000L) @@ -6974,6 +7252,9 @@ client.companies().upsertCompanyTrait( client.companies().listEntityKeyDefinitions( ListEntityKeyDefinitionsRequest .builder() + .ids( + Arrays.asList("ids") + ) .entityType(EntityType.COMPANY) .q("q") .limit(1000000L) @@ -7054,6 +7335,9 @@ client.companies().listEntityKeyDefinitions( client.companies().countEntityKeyDefinitions( CountEntityKeyDefinitionsRequest .builder() + .ids( + Arrays.asList("ids") + ) .entityType(EntityType.COMPANY) .q("q") .limit(1000000L) @@ -7134,6 +7418,12 @@ client.companies().countEntityKeyDefinitions( client.companies().listEntityTraitDefinitions( ListEntityTraitDefinitionsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .traitTypes( + Arrays.asList(TraitType.BOOLEAN) + ) .entityType(EntityType.COMPANY) .q("q") .traitType(TraitType.BOOLEAN) @@ -7406,6 +7696,12 @@ client.companies().updateEntityTraitDefinition( client.companies().countEntityTraitDefinitions( CountEntityTraitDefinitionsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .traitTypes( + Arrays.asList(TraitType.BOOLEAN) + ) .entityType(EntityType.COMPANY) .q("q") .traitType(TraitType.BOOLEAN) @@ -7575,8 +7871,14 @@ client.companies().getEntityTraitValues( client.companies().listPlanChanges( ListPlanChangesRequest .builder() - .action("action") - .basePlanAction("base_plan_action") + .companyIds( + Arrays.asList("company_ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) + .action(PlanChangeAction.CHECKOUT) + .basePlanAction(PlanChangeBasePlanAction.FALLBACK) .companyId("company_id") .limit(1000000L) .offset(1000000L) @@ -7596,7 +7898,7 @@ client.companies().listPlanChanges(
-**action:** `Optional` +**action:** `Optional`
@@ -7604,7 +7906,7 @@ client.companies().listPlanChanges(
-**basePlanAction:** `Optional` +**basePlanAction:** `Optional`
@@ -7712,6 +8014,12 @@ client.companies().getPlanChange("plan_change_id"); client.companies().listPlanTraits( ListPlanTraitsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .traitIds( + Arrays.asList("trait_ids") + ) .planId("plan_id") .traitId("trait_id") .limit(1000000L) @@ -8077,6 +8385,12 @@ client.companies().updatePlanTraitsBulk( client.companies().countPlanTraits( CountPlanTraitsRequest .builder() + .ids( + Arrays.asList("ids") + ) + .traitIds( + Arrays.asList("trait_ids") + ) .planId("plan_id") .traitId("trait_id") .limit(1000000L) @@ -8215,6 +8529,9 @@ client.companies().upsertUserTrait( client.companies().listUsers( ListUsersRequest .builder() + .ids( + Arrays.asList("ids") + ) .companyId("company_id") .planId("plan_id") .q("q") @@ -8433,6 +8750,9 @@ client.companies().deleteUser("user_id"); client.companies().countUsers( CountUsersRequest .builder() + .ids( + Arrays.asList("ids") + ) .companyId("company_id") .planId("plan_id") .q("q") @@ -8670,6 +8990,15 @@ client.companies().lookupUser( client.entitlements().listCompanyOverrides( ListCompanyOverridesRequest .builder() + .companyIds( + Arrays.asList("company_ids") + ) + .featureIds( + Arrays.asList("feature_ids") + ) + .ids( + Arrays.asList("ids") + ) .companyId("company_id") .featureId("feature_id") .withoutExpired(true) @@ -9125,6 +9454,15 @@ client.entitlements().deleteCompanyOverride("company_override_id"); client.entitlements().countCompanyOverrides( CountCompanyOverridesRequest .builder() + .companyIds( + Arrays.asList("company_ids") + ) + .featureIds( + Arrays.asList("feature_ids") + ) + .ids( + Arrays.asList("ids") + ) .companyId("company_id") .featureId("feature_id") .withoutExpired(true) @@ -9383,6 +9721,9 @@ client.entitlements().countFeatureCompanies( client.entitlements().listFeatureUsage( ListFeatureUsageRequest .builder() + .featureIds( + Arrays.asList("feature_ids") + ) .companyId("company_id") .includeUsageAggregation(true) .q("q") @@ -9570,6 +9911,9 @@ client.entitlements().getFeatureUsageTimeSeries( client.entitlements().countFeatureUsage( CountFeatureUsageRequest .builder() + .featureIds( + Arrays.asList("feature_ids") + ) .companyId("company_id") .includeUsageAggregation(true) .q("q") @@ -9820,6 +10164,18 @@ client.entitlements().countFeatureUsers( client.entitlements().listPlanEntitlements( ListPlanEntitlementsRequest .builder() + .featureIds( + Arrays.asList("feature_ids") + ) + .ids( + Arrays.asList("ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) + .planVersionIds( + Arrays.asList("plan_version_ids") + ) .featureId("feature_id") .planId("plan_id") .planVersionId("plan_version_id") @@ -10002,6 +10358,14 @@ client.entitlements().createPlanEntitlement(
+**currencyPrices:** `Optional>` + +
+
+ +
+
+ **featureId:** `String`
@@ -10304,6 +10668,14 @@ client.entitlements().updatePlanEntitlement(
+**currencyPrices:** `Optional>` + +
+
+ +
+
+ **metricPeriod:** `Optional`
@@ -10508,7 +10880,7 @@ client.entitlements().deletePlanEntitlement("plan_entitlement_id");
-
client.entitlements.countPlanEntitlements() -> CountPlanEntitlementsResponse +
client.entitlements.upsertPlanEntitlementForBillingProduct(request) -> UpsertPlanEntitlementForBillingProductResponse
@@ -10521,16 +10893,14 @@ client.entitlements().deletePlanEntitlement("plan_entitlement_id");
```java -client.entitlements().countPlanEntitlements( - CountPlanEntitlementsRequest +client.entitlements().upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody .builder() + .billingProvider(BillingProviderType.ORB) + .externalResourceId("external_resource_id") .featureId("feature_id") .planId("plan_id") - .planVersionId("plan_version_id") - .q("q") - .withMeteredProducts(true) - .limit(1000000L) - .offset(1000000L) + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -10547,7 +10917,7 @@ client.entitlements().countPlanEntitlements(
-**featureId:** `Optional` — Filter plan entitlements by a single feature ID (starting with feat_) +**billingProductId:** `Optional`
@@ -10555,7 +10925,7 @@ client.entitlements().countPlanEntitlements(
-**featureIds:** `Optional` — Filter plan entitlements by multiple feature IDs (starting with feat_) +**billingProvider:** `BillingProviderType`
@@ -10563,7 +10933,302 @@ client.entitlements().countPlanEntitlements(
-**ids:** `Optional` — Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_) +**billingThreshold:** `Optional` + +
+
+ +
+
+ +**creditConsumptionRate:** `Optional` + +
+
+ +
+
+ +**currency:** `Optional` + +
+
+ +
+
+ +**currencyPrices:** `Optional>` + +
+
+ +
+
+ +**externalResourceId:** `String` + +
+
+ +
+
+ +**featureId:** `String` + +
+
+ +
+
+ +**metricPeriod:** `Optional` + +
+
+ +
+
+ +**metricPeriodMonthReset:** `Optional` + +
+
+ +
+
+ +**monthlyMeteredPriceId:** `Optional` + +
+
+ +
+
+ +**monthlyPriceTiers:** `Optional>` + +
+
+ +
+
+ +**monthlyUnitPrice:** `Optional` + +
+
+ +
+
+ +**monthlyUnitPriceDecimal:** `Optional` + +
+
+ +
+
+ +**overageBillingProductId:** `Optional` + +
+
+ +
+
+ +**planId:** `String` + +
+
+ +
+
+ +**planVersionId:** `Optional` + +
+
+ +
+
+ +**priceBehavior:** `Optional` + +
+
+ +
+
+ +**priceTiers:** `Optional>` — Use MonthlyPriceTiers or YearlyPriceTiers instead + +
+
+ +
+
+ +**softLimit:** `Optional` + +
+
+ +
+
+ +**tierMode:** `Optional` + +
+
+ +
+
+ +**valueBool:** `Optional` + +
+
+ +
+
+ +**valueCreditId:** `Optional` + +
+
+ +
+
+ +**valueNumeric:** `Optional` + +
+
+ +
+
+ +**valueTraitId:** `Optional` + +
+
+ +
+
+ +**valueType:** `EntitlementValueType` + +
+
+ +
+
+ +**yearlyMeteredPriceId:** `Optional` + +
+
+ +
+
+ +**yearlyPriceTiers:** `Optional>` + +
+
+ +
+
+ +**yearlyUnitPrice:** `Optional` + +
+
+ +
+
+ +**yearlyUnitPriceDecimal:** `Optional` + +
+
+
+
+ + + +
+ + +
client.entitlements.countPlanEntitlements() -> CountPlanEntitlementsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entitlements().countPlanEntitlements( + CountPlanEntitlementsRequest + .builder() + .featureIds( + Arrays.asList("feature_ids") + ) + .ids( + Arrays.asList("ids") + ) + .planIds( + Arrays.asList("plan_ids") + ) + .planVersionIds( + Arrays.asList("plan_version_ids") + ) + .featureId("feature_id") + .planId("plan_id") + .planVersionId("plan_version_id") + .q("q") + .withMeteredProducts(true) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**featureId:** `Optional` — Filter plan entitlements by a single feature ID (starting with feat_) + +
+
+ +
+
+ +**featureIds:** `Optional` — Filter plan entitlements by multiple feature IDs (starting with feat_) + +
+
+ +
+
+ +**ids:** `Optional` — Filter plan entitlements by multiple plan entitlement IDs (starting with pltl_)
@@ -10779,7 +11444,70 @@ client.plans().updateCompanyPlans(
-**companyPlanId:** `String` — company_plan_id +**companyPlanId:** `String` — company_plan_id + +
+
+ +
+
+ +**addOnIds:** `List` + +
+
+ +
+
+ +**basePlanId:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.plans.createCustomPlan(request) -> CreateCustomPlanResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().createCustomPlan( + CreateCustomPlanRequestBody + .builder() + .companyId("company_id") + .description("description") + .name("name") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String`
@@ -10787,7 +11515,7 @@ client.plans().updateCompanyPlans(
-**addOnIds:** `List` +**copiedFromPlanId:** `Optional`
@@ -10795,7 +11523,23 @@ client.plans().updateCompanyPlans(
-**basePlanId:** `Optional` +**description:** `String` + +
+
+ +
+
+ +**icon:** `Optional` + +
+
+ +
+
+ +**name:** `String`
@@ -10823,6 +11567,9 @@ client.plans().updateCompanyPlans( client.plans().listPlans( ListPlansRequest .builder() + .ids( + Arrays.asList("ids") + ) .companyId("company_id") .forFallbackPlan(true) .forInitialPlan(true) @@ -10831,6 +11578,7 @@ client.plans().listPlans( .includeDraftVersions(true) .planType(PlanType.PLAN) .q("q") + .scopedToCompanyId("scoped_to_company_id") .withoutEntitlementFor("without_entitlement_for") .withoutPaidProductId(true) .limit(1000000L) @@ -10923,6 +11671,14 @@ client.plans().listPlans(
+**scopedToCompanyId:** `Optional` — Filter plans scoped to a specific company (custom plans) + +
+
+ +
+
+ **withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -11205,6 +11961,239 @@ client.plans().upsertBillingProductPlan(
+
+
+
+ +
client.plans.upsertPlanForBillingProduct(request) -> UpsertPlanForBillingProductResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().upsertPlanForBillingProduct( + CreateBillingLinkedPlanRequestBody + .builder() + .billingProvider(BillingProviderType.ORB) + .description("description") + .externalResourceId("external_resource_id") + .name("name") + .planType(PlanType.PLAN) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billingProvider:** `BillingProviderType` + +
+
+ +
+
+ +**description:** `String` + +
+
+ +
+
+ +**externalResourceId:** `String` + +
+
+ +
+
+ +**icon:** `Optional` + +
+
+ +
+
+ +**name:** `String` + +
+
+ +
+
+ +**planType:** `PlanType` + +
+
+
+
+ + +
+
+
+ +
client.plans.listBillingProductMatchCompanies() -> ListBillingProductMatchCompaniesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest + .builder() + .planId("plan_id") + .q("q") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planId:** `String` — The plan ID to find billing product match companies for + +
+
+ +
+
+ +**q:** `Optional` — Search for companies by name, keys or string traits + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ + +
+
+
+ +
client.plans.countBillingProductMatchCompanies() -> CountBillingProductMatchCompaniesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest + .builder() + .planId("plan_id") + .q("q") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planId:** `String` — The plan ID to find billing product match companies for + +
+
+ +
+
+ +**q:** `Optional` — Search for companies by name, keys or string traits + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ +
@@ -11225,6 +12214,9 @@ client.plans().upsertBillingProductPlan( client.plans().countPlans( CountPlansRequest .builder() + .ids( + Arrays.asList("ids") + ) .companyId("company_id") .forFallbackPlan(true) .forInitialPlan(true) @@ -11233,6 +12225,7 @@ client.plans().countPlans( .includeDraftVersions(true) .planType(PlanType.PLAN) .q("q") + .scopedToCompanyId("scoped_to_company_id") .withoutEntitlementFor("without_entitlement_for") .withoutPaidProductId(true) .limit(1000000L) @@ -11317,7 +12310,15 @@ client.plans().countPlans(
-**q:** `Optional` +**q:** `Optional` + +
+
+ +
+
+ +**scopedToCompanyId:** `Optional` — Filter plans scoped to a specific company (custom plans)
@@ -11490,6 +12491,15 @@ client.plans().publishPlanVersion( .excludedCompanyIds( Arrays.asList("excluded_company_ids") ) + .payInAdvance( + Arrays.asList( + UpdatePayInAdvanceRequestBody + .builder() + .priceId("price_id") + .quantity(1000000L) + .build() + ) + ) .build() ); ``` @@ -11514,6 +12524,30 @@ client.plans().publishPlanVersion(
+**activationStrategy:** `Optional` + +
+
+ +
+
+ +**customerEmail:** `Optional` + +
+
+ +
+
+ +**daysUntilDue:** `Optional` + +
+
+ +
+
+ **excludedCompanyIds:** `List`
@@ -11524,6 +12558,14 @@ client.plans().publishPlanVersion( **migrationStrategy:** `PlanVersionMigrationStrategy` + +
+ +
+
+ +**payInAdvance:** `List` +
@@ -12107,6 +13149,9 @@ client.events().createEventBatch( client.events().getEventSummaries( GetEventSummariesRequest .builder() + .eventSubtypes( + Arrays.asList("event_subtypes") + ) .q("q") .limit(1000000L) .offset(1000000L) @@ -12178,6 +13223,9 @@ client.events().getEventSummaries( client.events().listEvents( ListEventsRequest .builder() + .eventTypes( + Arrays.asList(EventType.FLAG_CHECK) + ) .companyId("company_id") .eventSubtype("event_subtype") .flagId("flag_id") @@ -12387,11 +13435,17 @@ client.events().getSegmentIntegrationStatus(); client.features().listFeatures( ListFeaturesRequest .builder() + .featureType( + Arrays.asList(FeatureType.BOOLEAN) + ) + .ids( + Arrays.asList("ids") + ) + .booleanRequireEvent(true) + .planVersionId("plan_version_id") .q("q") .withoutCompanyOverrideFor("without_company_override_for") - .planVersionId("plan_version_id") .withoutPlanEntitlementFor("without_plan_entitlement_for") - .booleanRequireEvent(true) .limit(1000000L) .offset(1000000L) .build() @@ -12410,7 +13464,7 @@ client.features().listFeatures(
-**ids:** `Optional` +**booleanRequireEvent:** `Optional` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.
@@ -12418,7 +13472,7 @@ client.features().listFeatures(
-**q:** `Optional` — Search by feature name or ID +**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait)
@@ -12426,7 +13480,7 @@ client.features().listFeatures(
-**withoutCompanyOverrideFor:** `Optional` — Filter out features that already have a company override for the specified company ID +**ids:** `Optional`
@@ -12442,7 +13496,7 @@ client.features().listFeatures(
-**withoutPlanEntitlementFor:** `Optional` — Filter out features that already have a plan entitlement for the specified plan ID +**q:** `Optional` — Search by feature name or ID
@@ -12450,7 +13504,7 @@ client.features().listFeatures(
-**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait) +**withoutCompanyOverrideFor:** `Optional` — Filter out features that already have a company override for the specified company ID
@@ -12458,7 +13512,7 @@ client.features().listFeatures(
-**booleanRequireEvent:** `Optional` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. +**withoutPlanEntitlementFor:** `Optional` — Filter out features that already have a plan entitlement for the specified plan ID
@@ -12822,6 +13876,151 @@ client.features().deleteFeature("feature_id");
+ +
+ + +
client.features.upsertFeatureForBillingProduct(request) -> UpsertFeatureForBillingProductResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.features().upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody + .builder() + .billingProvider(BillingProviderType.ORB) + .description("description") + .externalResourceId("external_resource_id") + .featureType(FeatureType.BOOLEAN) + .name("name") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billingProvider:** `BillingProviderType` + +
+
+ +
+
+ +**description:** `String` + +
+
+ +
+
+ +**eventSubtype:** `Optional` + +
+
+ +
+
+ +**externalResourceId:** `String` + +
+
+ +
+
+ +**featureType:** `FeatureType` + +
+
+ +
+
+ +**flag:** `Optional` + +
+
+ +
+
+ +**icon:** `Optional` + +
+
+ +
+
+ +**lifecyclePhase:** `Optional` + +
+
+ +
+
+ +**maintainerId:** `Optional` + +
+
+ +
+
+ +**name:** `String` + +
+
+ +
+
+ +**pluralName:** `Optional` + +
+
+ +
+
+ +**singularName:** `Optional` + +
+
+ +
+
+ +**traitId:** `Optional` + +
+
+
+
+ +
@@ -12842,11 +14041,17 @@ client.features().deleteFeature("feature_id"); client.features().countFeatures( CountFeaturesRequest .builder() + .featureType( + Arrays.asList(FeatureType.BOOLEAN) + ) + .ids( + Arrays.asList("ids") + ) + .booleanRequireEvent(true) + .planVersionId("plan_version_id") .q("q") .withoutCompanyOverrideFor("without_company_override_for") - .planVersionId("plan_version_id") .withoutPlanEntitlementFor("without_plan_entitlement_for") - .booleanRequireEvent(true) .limit(1000000L) .offset(1000000L) .build() @@ -12865,7 +14070,7 @@ client.features().countFeatures(
-**ids:** `Optional` +**booleanRequireEvent:** `Optional` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.
@@ -12873,7 +14078,7 @@ client.features().countFeatures(
-**q:** `Optional` — Search by feature name or ID +**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait)
@@ -12881,7 +14086,7 @@ client.features().countFeatures(
-**withoutCompanyOverrideFor:** `Optional` — Filter out features that already have a company override for the specified company ID +**ids:** `Optional`
@@ -12897,7 +14102,7 @@ client.features().countFeatures(
-**withoutPlanEntitlementFor:** `Optional` — Filter out features that already have a plan entitlement for the specified plan ID +**q:** `Optional` — Search by feature name or ID
@@ -12905,7 +14110,7 @@ client.features().countFeatures(
-**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait) +**withoutCompanyOverrideFor:** `Optional` — Filter out features that already have a company override for the specified company ID
@@ -12913,7 +14118,7 @@ client.features().countFeatures(
-**booleanRequireEvent:** `Optional` — Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. +**withoutPlanEntitlementFor:** `Optional` — Filter out features that already have a plan entitlement for the specified plan ID
@@ -12957,6 +14162,9 @@ client.features().countFeatures( client.features().listFlags( ListFlagsRequest .builder() + .ids( + Arrays.asList("ids") + ) .featureId("feature_id") .q("q") .limit(1000000L) @@ -13466,6 +14674,9 @@ client.features().checkFlagsBulk( client.features().countFlags( CountFlagsRequest .builder() + .ids( + Arrays.asList("ids") + ) .featureId("feature_id") .q("q") .limit(1000000L) @@ -13526,6 +14737,47 @@ client.features().countFlags( + + + + +## integrationsapi +
client.integrationsapi.getIntegrationWebhookUrl(type) -> GetIntegrationWebhookUrlResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.integrationsapi().getIntegrationWebhookUrl("type"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**type:** `String` — type + +
+
+
+
+ +
@@ -15132,6 +16384,9 @@ client.accesstokens().issueTemporaryAccessToken( client.webhooks().listWebhookEvents( ListWebhookEventsRequest .builder() + .ids( + Arrays.asList("ids") + ) .q("q") .webhookId("webhook_id") .limit(1000000L) @@ -15252,6 +16507,9 @@ client.webhooks().getWebhookEvent("webhook_event_id"); client.webhooks().countWebhookEvents( CountWebhookEventsRequest .builder() + .ids( + Arrays.asList("ids") + ) .q("q") .webhookId("webhook_id") .limit(1000000L) diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematic.java b/src/main/java/com/schematic/api/AsyncBaseSchematic.java index 77df3d5..96e4c27 100644 --- a/src/main/java/com/schematic/api/AsyncBaseSchematic.java +++ b/src/main/java/com/schematic/api/AsyncBaseSchematic.java @@ -18,6 +18,7 @@ import com.schematic.api.resources.entitlements.AsyncEntitlementsClient; import com.schematic.api.resources.events.AsyncEventsClient; import com.schematic.api.resources.features.AsyncFeaturesClient; +import com.schematic.api.resources.integrationsapi.AsyncIntegrationsapiClient; import com.schematic.api.resources.planbundle.AsyncPlanbundleClient; import com.schematic.api.resources.plangroups.AsyncPlangroupsClient; import com.schematic.api.resources.planmigrations.AsyncPlanmigrationsClient; @@ -54,6 +55,8 @@ public class AsyncBaseSchematic { protected final Supplier featuresClient; + protected final Supplier integrationsapiClient; + protected final Supplier planbundleClient; protected final Supplier plangroupsClient; @@ -82,6 +85,7 @@ public AsyncBaseSchematic(ClientOptions clientOptions) { this.dataexportsClient = Suppliers.memoize(() -> new AsyncDataexportsClient(clientOptions)); this.eventsClient = Suppliers.memoize(() -> new AsyncEventsClient(clientOptions)); this.featuresClient = Suppliers.memoize(() -> new AsyncFeaturesClient(clientOptions)); + this.integrationsapiClient = Suppliers.memoize(() -> new AsyncIntegrationsapiClient(clientOptions)); this.planbundleClient = Suppliers.memoize(() -> new AsyncPlanbundleClient(clientOptions)); this.plangroupsClient = Suppliers.memoize(() -> new AsyncPlangroupsClient(clientOptions)); this.planmigrationsClient = Suppliers.memoize(() -> new AsyncPlanmigrationsClient(clientOptions)); @@ -164,6 +168,10 @@ public AsyncFeaturesClient features() { return this.featuresClient.get(); } + public AsyncIntegrationsapiClient integrationsapi() { + return this.integrationsapiClient.get(); + } + public AsyncPlanbundleClient planbundle() { return this.planbundleClient.get(); } diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index efb312f..b5d94b9 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.3.1"); + put("User-Agent", "com.schematichq:schematic-java/1.4.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.3.1"); + put("X-Fern-SDK-Version", "1.4.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java index 4ddb1f1..9ecf136 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java @@ -9,6 +9,7 @@ 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; @@ -20,10 +21,12 @@ 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; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; +import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; @@ -48,6 +51,31 @@ public RawAccountsClient withRawResponse() { return this.rawClient; } + public ListAccountMembersResponse listAccountMembers() { + return this.rawClient.listAccountMembers().body(); + } + + public ListAccountMembersResponse listAccountMembers(RequestOptions requestOptions) { + return this.rawClient.listAccountMembers(requestOptions).body(); + } + + public ListAccountMembersResponse listAccountMembers(ListAccountMembersRequest request) { + return this.rawClient.listAccountMembers(request).body(); + } + + public ListAccountMembersResponse listAccountMembers( + ListAccountMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.listAccountMembers(request, requestOptions).body(); + } + + public GetAccountMemberResponse getAccountMember(String accountMemberId) { + return this.rawClient.getAccountMember(accountMemberId).body(); + } + + public GetAccountMemberResponse getAccountMember(String accountMemberId, RequestOptions requestOptions) { + return this.rawClient.getAccountMember(accountMemberId, requestOptions).body(); + } + public ListApiKeysResponse listApiKeys(ListApiKeysRequest request) { return this.rawClient.listApiKeys(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java index 410c177..d37bb0c 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java @@ -9,6 +9,7 @@ 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; @@ -20,10 +21,12 @@ 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; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; +import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; @@ -49,6 +52,32 @@ public AsyncRawAccountsClient withRawResponse() { return this.rawClient; } + public CompletableFuture listAccountMembers() { + return this.rawClient.listAccountMembers().thenApply(response -> response.body()); + } + + public CompletableFuture listAccountMembers(RequestOptions requestOptions) { + return this.rawClient.listAccountMembers(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listAccountMembers(ListAccountMembersRequest request) { + return this.rawClient.listAccountMembers(request).thenApply(response -> response.body()); + } + + public CompletableFuture listAccountMembers( + ListAccountMembersRequest request, RequestOptions requestOptions) { + return this.rawClient.listAccountMembers(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture getAccountMember(String accountMemberId) { + return this.rawClient.getAccountMember(accountMemberId).thenApply(response -> response.body()); + } + + public CompletableFuture getAccountMember( + String accountMemberId, RequestOptions requestOptions) { + return this.rawClient.getAccountMember(accountMemberId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listApiKeys(ListApiKeysRequest request) { return this.rawClient.listApiKeys(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java index cf062f8..24bbb7c 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java @@ -21,6 +21,7 @@ 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; @@ -32,10 +33,12 @@ 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; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; +import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; @@ -63,6 +66,196 @@ public AsyncRawAccountsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public CompletableFuture> listAccountMembers() { + return listAccountMembers(ListAccountMembersRequest.builder().build()); + } + + public CompletableFuture> listAccountMembers( + RequestOptions requestOptions) { + return listAccountMembers(ListAccountMembersRequest.builder().build(), requestOptions); + } + + public CompletableFuture> listAccountMembers( + ListAccountMembersRequest request) { + return listAccountMembers(request, null); + } + + public CompletableFuture> listAccountMembers( + ListAccountMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account-members"); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListAccountMembersResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> getAccountMember( + String accountMemberId) { + return getAccountMember(accountMemberId, null); + } + + public CompletableFuture> getAccountMember( + String accountMemberId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account-members") + .addPathSegment(accountMemberId); + 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); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAccountMemberResponse.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 (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> listApiKeys(ListApiKeysRequest request) { return listApiKeys(request, null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java index 3a68cc6..0569770 100644 --- a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java @@ -21,6 +21,7 @@ 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; @@ -32,10 +33,12 @@ 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; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetWhoAmIResponse; +import com.schematic.api.resources.accounts.types.ListAccountMembersResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; @@ -59,6 +62,148 @@ public RawAccountsClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } + public BaseSchematicHttpResponse listAccountMembers() { + return listAccountMembers(ListAccountMembersRequest.builder().build()); + } + + public BaseSchematicHttpResponse listAccountMembers(RequestOptions requestOptions) { + return listAccountMembers(ListAccountMembersRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse listAccountMembers(ListAccountMembersRequest request) { + return listAccountMembers(request, null); + } + + public BaseSchematicHttpResponse listAccountMembers( + ListAccountMembersRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account-members"); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAccountMembersResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getAccountMember(String accountMemberId) { + return getAccountMember(accountMemberId, null); + } + + public BaseSchematicHttpResponse getAccountMember( + String accountMemberId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("account-members") + .addPathSegment(accountMemberId); + 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); + } + 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, GetAccountMemberResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse listApiKeys(ListApiKeysRequest request) { return listApiKeys(request, null); } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/ListAccountMembersRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/ListAccountMembersRequest.java new file mode 100644 index 0000000..10a0328 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/requests/ListAccountMembersRequest.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountMembersRequest.Builder.class) +public final class ListAccountMembersRequest { + private final Optional> ids; + + private final Optional q; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListAccountMembersRequest( + Optional> ids, + Optional q, + Optional limit, + Optional offset, + Map additionalProperties) { + this.ids = ids; + this.q = q; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + /** + * @return Search filter + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountMembersRequest && equalTo((ListAccountMembersRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountMembersRequest other) { + return ids.equals(other.ids) && q.equals(other.q) && limit.equals(other.limit) && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ids, this.q, this.limit, this.offset); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> ids = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAccountMembersRequest other) { + ids(other.getIds()); + q(other.getQ()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @JsonSetter(value = "ids", nulls = Nulls.SKIP) + public Builder ids(Optional> ids) { + this.ids = ids; + return this; + } + + public Builder ids(List ids) { + this.ids = Optional.ofNullable(ids); + return this; + } + + public Builder ids(String ids) { + this.ids = Optional.of(Collections.singletonList(ids)); + return this; + } + + /** + *

Search filter

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

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public ListAccountMembersRequest build() { + return new ListAccountMembersRequest(ids, q, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/GetAccountMemberResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetAccountMemberResponse.java new file mode 100644 index 0000000..e20552e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetAccountMemberResponse.java @@ -0,0 +1,181 @@ +/** + * 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.AccountMemberResponseData; +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 = GetAccountMemberResponse.Builder.class) +public final class GetAccountMemberResponse { + private final AccountMemberResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetAccountMemberResponse( + AccountMemberResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public AccountMemberResponseData 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 GetAccountMemberResponse && equalTo((GetAccountMemberResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAccountMemberResponse 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 AccountMemberResponseData data); + + Builder from(GetAccountMemberResponse other); + } + + public interface _FinalStage { + GetAccountMemberResponse 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 AccountMemberResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAccountMemberResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull AccountMemberResponseData 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 GetAccountMemberResponse build() { + return new GetAccountMemberResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListAccountMembersParams.java b/src/main/java/com/schematic/api/resources/accounts/types/ListAccountMembersParams.java new file mode 100644 index 0000000..42e47f1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListAccountMembersParams.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountMembersParams.Builder.class) +public final class ListAccountMembersParams { + private final Optional> ids; + + private final Optional limit; + + private final Optional offset; + + private final Optional q; + + private final Map additionalProperties; + + private ListAccountMembersParams( + Optional> ids, + Optional limit, + Optional offset, + Optional q, + Map additionalProperties) { + this.ids = ids; + this.limit = limit; + this.offset = offset; + this.q = q; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return Search filter + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountMembersParams && equalTo((ListAccountMembersParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountMembersParams other) { + return ids.equals(other.ids) && limit.equals(other.limit) && offset.equals(other.offset) && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ids, this.limit, this.offset, this.q); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> ids = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListAccountMembersParams other) { + ids(other.getIds()); + limit(other.getLimit()); + offset(other.getOffset()); + q(other.getQ()); + return this; + } + + @JsonSetter(value = "ids", nulls = Nulls.SKIP) + public Builder ids(Optional> ids) { + this.ids = ids; + return this; + } + + public Builder ids(List ids) { + this.ids = Optional.ofNullable(ids); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

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

Search filter

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

Input parameters

+ */ + _FinalStage params(@NotNull ListAccountMembersParams params); + + Builder from(ListAccountMembersResponse other); + } + + public interface _FinalStage { + ListAccountMembersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(AccountMemberResponseData data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ParamsStage, _FinalStage { + private ListAccountMembersParams params; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountMembersResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + /** + *

Input parameters

+ *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull ListAccountMembersParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(AccountMemberResponseData data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListAccountMembersResponse build() { + return new ListAccountMembersResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingSubscriptionRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingSubscriptionRequestBody.java index f4b51ce..3bbd523 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingSubscriptionRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingSubscriptionRequestBody.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.BillingProductPricing; +import com.schematic.api.types.BillingProviderType; import com.schematic.api.types.BillingSubscriptionDiscount; import com.schematic.api.types.BillingSubscriptionTrialEndSetting; import java.time.OffsetDateTime; @@ -56,6 +57,8 @@ public final class CreateBillingSubscriptionRequestBody { private final List productExternalIds; + private final Optional providerType; + private final Optional status; private final String subscriptionExternalId; @@ -83,6 +86,7 @@ private CreateBillingSubscriptionRequestBody( Optional periodEnd, Optional periodStart, List productExternalIds, + Optional providerType, Optional status, String subscriptionExternalId, long totalPrice, @@ -103,6 +107,7 @@ private CreateBillingSubscriptionRequestBody( this.periodEnd = periodEnd; this.periodStart = periodStart; this.productExternalIds = productExternalIds; + this.providerType = providerType; this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.totalPrice = totalPrice; @@ -181,6 +186,11 @@ public List getProductExternalIds() { return productExternalIds; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("status") public Optional getStatus() { return status; @@ -233,6 +243,7 @@ private boolean equalTo(CreateBillingSubscriptionRequestBody other) { && periodEnd.equals(other.periodEnd) && periodStart.equals(other.periodStart) && productExternalIds.equals(other.productExternalIds) + && providerType.equals(other.providerType) && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && totalPrice == other.totalPrice @@ -257,6 +268,7 @@ public int hashCode() { this.periodEnd, this.periodStart, this.productExternalIds, + this.providerType, this.status, this.subscriptionExternalId, this.totalPrice, @@ -350,6 +362,10 @@ public interface _FinalStage { _FinalStage addAllProductExternalIds(List productExternalIds); + _FinalStage providerType(Optional providerType); + + _FinalStage providerType(BillingProviderType providerType); + _FinalStage status(Optional status); _FinalStage status(String status); @@ -390,6 +406,8 @@ public static final class Builder private Optional status = Optional.empty(); + private Optional providerType = Optional.empty(); + private List productExternalIds = new ArrayList<>(); private Optional periodStart = Optional.empty(); @@ -431,6 +449,7 @@ public Builder from(CreateBillingSubscriptionRequestBody other) { periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); productExternalIds(other.getProductExternalIds()); + providerType(other.getProviderType()); status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); totalPrice(other.getTotalPrice()); @@ -521,6 +540,19 @@ public _FinalStage status(Optional status) { return this; } + @java.lang.Override + public _FinalStage providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public _FinalStage providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + @java.lang.Override public _FinalStage addAllProductExternalIds(List productExternalIds) { if (productExternalIds != null) { @@ -690,6 +722,7 @@ public CreateBillingSubscriptionRequestBody build() { periodEnd, periodStart, productExternalIds, + providerType, status, subscriptionExternalId, totalPrice, diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java index bbfd54e..a2db149 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java @@ -9,11 +9,14 @@ 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.BillingProviderType; 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) @@ -27,6 +30,8 @@ public final class CreateMeterRequestBody { private final String externalId; + private final Optional providerType; + private final Map additionalProperties; private CreateMeterRequestBody( @@ -34,11 +39,13 @@ private CreateMeterRequestBody( String eventName, String eventPayloadKey, String externalId, + Optional providerType, Map additionalProperties) { this.displayName = displayName; this.eventName = eventName; this.eventPayloadKey = eventPayloadKey; this.externalId = externalId; + this.providerType = providerType; this.additionalProperties = additionalProperties; } @@ -62,6 +69,11 @@ public String getExternalId() { return externalId; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -77,12 +89,13 @@ private boolean equalTo(CreateMeterRequestBody other) { return displayName.equals(other.displayName) && eventName.equals(other.eventName) && eventPayloadKey.equals(other.eventPayloadKey) - && externalId.equals(other.externalId); + && externalId.equals(other.externalId) + && providerType.equals(other.providerType); } @java.lang.Override public int hashCode() { - return Objects.hash(this.displayName, this.eventName, this.eventPayloadKey, this.externalId); + return Objects.hash(this.displayName, this.eventName, this.eventPayloadKey, this.externalId, this.providerType); } @java.lang.Override @@ -118,6 +131,10 @@ public interface _FinalStage { _FinalStage additionalProperty(String key, Object value); _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage providerType(Optional providerType); + + _FinalStage providerType(BillingProviderType providerType); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -131,6 +148,8 @@ public static final class Builder private String externalId; + private Optional providerType = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -142,6 +161,7 @@ public Builder from(CreateMeterRequestBody other) { eventName(other.getEventName()); eventPayloadKey(other.getEventPayloadKey()); externalId(other.getExternalId()); + providerType(other.getProviderType()); return this; } @@ -173,10 +193,23 @@ public _FinalStage externalId(@NotNull String externalId) { return this; } + @java.lang.Override + public _FinalStage providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public _FinalStage providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + @java.lang.Override public CreateMeterRequestBody build() { return new CreateMeterRequestBody( - displayName, eventName, eventPayloadKey, externalId, additionalProperties); + displayName, eventName, eventPayloadKey, externalId, providerType, additionalProperties); } @java.lang.Override 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 e9ca280..6527128 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -123,6 +123,13 @@ public CompletableFuture> listC HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies"); + if (request.getHasScheduledDowngrade().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "has_scheduled_downgrade", + request.getHasScheduledDowngrade().get(), + false); + } if (request.getMonetizedSubscriptions().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -587,6 +594,13 @@ public CompletableFuture> coun HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies/count"); + if (request.getHasScheduledDowngrade().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "has_scheduled_downgrade", + request.getHasScheduledDowngrade().get(), + false); + } if (request.getMonetizedSubscriptions().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, 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 a373c48..25f5745 100644 --- a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java @@ -117,6 +117,13 @@ public BaseSchematicHttpResponse listCompanies( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies"); + if (request.getHasScheduledDowngrade().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "has_scheduled_downgrade", + request.getHasScheduledDowngrade().get(), + false); + } if (request.getMonetizedSubscriptions().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -483,6 +490,13 @@ public BaseSchematicHttpResponse countCompanies( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies/count"); + if (request.getHasScheduledDowngrade().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "has_scheduled_downgrade", + request.getHasScheduledDowngrade().get(), + false); + } if (request.getMonetizedSubscriptions().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java index 3c6ca03..fb2b7bc 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesRequest.java @@ -35,6 +35,8 @@ public final class CountCompaniesRequest { private final Optional> subscriptionTypes; + private final Optional hasScheduledDowngrade; + private final Optional monetizedSubscriptions; private final Optional planId; @@ -69,6 +71,7 @@ private CountCompaniesRequest( Optional> planIds, Optional> subscriptionStatuses, Optional> subscriptionTypes, + Optional hasScheduledDowngrade, Optional monetizedSubscriptions, Optional planId, Optional planVersionId, @@ -88,6 +91,7 @@ private CountCompaniesRequest( this.planIds = planIds; this.subscriptionStatuses = subscriptionStatuses; this.subscriptionTypes = subscriptionTypes; + this.hasScheduledDowngrade = hasScheduledDowngrade; this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; this.planVersionId = planVersionId; @@ -144,6 +148,14 @@ public Optional> getSubscriptionTypes() { return subscriptionTypes; } + /** + * @return Filter companies that have a pending scheduled downgrade + */ + @JsonProperty("has_scheduled_downgrade") + public Optional getHasScheduledDowngrade() { + return hasScheduledDowngrade; + } + /** * @return Filter companies that have monetized subscriptions */ @@ -265,6 +277,7 @@ private boolean equalTo(CountCompaniesRequest other) { && planIds.equals(other.planIds) && subscriptionStatuses.equals(other.subscriptionStatuses) && subscriptionTypes.equals(other.subscriptionTypes) + && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) @@ -288,6 +301,7 @@ public int hashCode() { this.planIds, this.subscriptionStatuses, this.subscriptionTypes, + this.hasScheduledDowngrade, this.monetizedSubscriptions, this.planId, this.planVersionId, @@ -324,6 +338,8 @@ public static final class Builder { private Optional> subscriptionTypes = Optional.empty(); + private Optional hasScheduledDowngrade = Optional.empty(); + private Optional monetizedSubscriptions = Optional.empty(); private Optional planId = Optional.empty(); @@ -361,6 +377,7 @@ public Builder from(CountCompaniesRequest other) { planIds(other.getPlanIds()); subscriptionStatuses(other.getSubscriptionStatuses()); subscriptionTypes(other.getSubscriptionTypes()); + hasScheduledDowngrade(other.getHasScheduledDowngrade()); monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); @@ -472,6 +489,20 @@ public Builder subscriptionTypes(SubscriptionType subscriptionTypes) { return this; } + /** + *

Filter companies that have a pending scheduled downgrade

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

Filter companies that have monetized subscriptions

*/ @@ -661,6 +692,7 @@ public CountCompaniesRequest build() { planIds, subscriptionStatuses, subscriptionTypes, + hasScheduledDowngrade, monetizedSubscriptions, planId, planVersionId, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java index 5708dc3..28ee241 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesRequest.java @@ -35,6 +35,8 @@ public final class ListCompaniesRequest { private final Optional> subscriptionTypes; + private final Optional hasScheduledDowngrade; + private final Optional monetizedSubscriptions; private final Optional planId; @@ -69,6 +71,7 @@ private ListCompaniesRequest( Optional> planIds, Optional> subscriptionStatuses, Optional> subscriptionTypes, + Optional hasScheduledDowngrade, Optional monetizedSubscriptions, Optional planId, Optional planVersionId, @@ -88,6 +91,7 @@ private ListCompaniesRequest( this.planIds = planIds; this.subscriptionStatuses = subscriptionStatuses; this.subscriptionTypes = subscriptionTypes; + this.hasScheduledDowngrade = hasScheduledDowngrade; this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; this.planVersionId = planVersionId; @@ -144,6 +148,14 @@ public Optional> getSubscriptionTypes() { return subscriptionTypes; } + /** + * @return Filter companies that have a pending scheduled downgrade + */ + @JsonProperty("has_scheduled_downgrade") + public Optional getHasScheduledDowngrade() { + return hasScheduledDowngrade; + } + /** * @return Filter companies that have monetized subscriptions */ @@ -265,6 +277,7 @@ private boolean equalTo(ListCompaniesRequest other) { && planIds.equals(other.planIds) && subscriptionStatuses.equals(other.subscriptionStatuses) && subscriptionTypes.equals(other.subscriptionTypes) + && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) && planVersionId.equals(other.planVersionId) @@ -288,6 +301,7 @@ public int hashCode() { this.planIds, this.subscriptionStatuses, this.subscriptionTypes, + this.hasScheduledDowngrade, this.monetizedSubscriptions, this.planId, this.planVersionId, @@ -324,6 +338,8 @@ public static final class Builder { private Optional> subscriptionTypes = Optional.empty(); + private Optional hasScheduledDowngrade = Optional.empty(); + private Optional monetizedSubscriptions = Optional.empty(); private Optional planId = Optional.empty(); @@ -361,6 +377,7 @@ public Builder from(ListCompaniesRequest other) { planIds(other.getPlanIds()); subscriptionStatuses(other.getSubscriptionStatuses()); subscriptionTypes(other.getSubscriptionTypes()); + hasScheduledDowngrade(other.getHasScheduledDowngrade()); monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); planVersionId(other.getPlanVersionId()); @@ -472,6 +489,20 @@ public Builder subscriptionTypes(SubscriptionType subscriptionTypes) { return this; } + /** + *

Filter companies that have a pending scheduled downgrade

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

Filter companies that have monetized subscriptions

*/ @@ -661,6 +692,7 @@ public ListCompaniesRequest build() { planIds, subscriptionStatuses, subscriptionTypes, + hasScheduledDowngrade, monetizedSubscriptions, planId, planVersionId, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java index e004aea..aa3452c 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java @@ -12,6 +12,8 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanChangeAction; +import com.schematic.api.types.PlanChangeBasePlanAction; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -26,9 +28,9 @@ public final class ListPlanChangesRequest { private final Optional> planIds; - private final Optional action; + private final Optional action; - private final Optional basePlanAction; + private final Optional basePlanAction; private final Optional companyId; @@ -41,8 +43,8 @@ public final class ListPlanChangesRequest { private ListPlanChangesRequest( Optional> companyIds, Optional> planIds, - Optional action, - Optional basePlanAction, + Optional action, + Optional basePlanAction, Optional companyId, Optional limit, Optional offset, @@ -68,12 +70,12 @@ public Optional> getPlanIds() { } @JsonProperty("action") - public Optional getAction() { + public Optional getAction() { return action; } @JsonProperty("base_plan_action") - public Optional getBasePlanAction() { + public Optional getBasePlanAction() { return basePlanAction; } @@ -146,9 +148,9 @@ public static final class Builder { private Optional> planIds = Optional.empty(); - private Optional action = Optional.empty(); + private Optional action = Optional.empty(); - private Optional basePlanAction = Optional.empty(); + private Optional basePlanAction = Optional.empty(); private Optional companyId = Optional.empty(); @@ -205,23 +207,23 @@ public Builder planIds(String planIds) { } @JsonSetter(value = "action", nulls = Nulls.SKIP) - public Builder action(Optional action) { + public Builder action(Optional action) { this.action = action; return this; } - public Builder action(String action) { + public Builder action(PlanChangeAction action) { this.action = Optional.ofNullable(action); return this; } @JsonSetter(value = "base_plan_action", nulls = Nulls.SKIP) - public Builder basePlanAction(Optional basePlanAction) { + public Builder basePlanAction(Optional basePlanAction) { this.basePlanAction = basePlanAction; return this; } - public Builder basePlanAction(String basePlanAction) { + public Builder basePlanAction(PlanChangeBasePlanAction basePlanAction) { this.basePlanAction = Optional.ofNullable(basePlanAction); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java index 8fb4650..3b58715 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesParams.java @@ -26,6 +26,8 @@ public final class CountCompaniesParams { private final Optional> creditTypeIds; + private final Optional hasScheduledDowngrade; + private final Optional> ids; private final Optional limit; @@ -64,6 +66,7 @@ public final class CountCompaniesParams { private CountCompaniesParams( Optional> creditTypeIds, + Optional hasScheduledDowngrade, Optional> ids, Optional limit, Optional monetizedSubscriptions, @@ -83,6 +86,7 @@ private CountCompaniesParams( Optional withoutSubscription, Map additionalProperties) { this.creditTypeIds = creditTypeIds; + this.hasScheduledDowngrade = hasScheduledDowngrade; this.ids = ids; this.limit = limit; this.monetizedSubscriptions = monetizedSubscriptions; @@ -111,6 +115,14 @@ public Optional> getCreditTypeIds() { return creditTypeIds; } + /** + * @return Filter companies that have a pending scheduled downgrade + */ + @JsonProperty("has_scheduled_downgrade") + public Optional getHasScheduledDowngrade() { + return hasScheduledDowngrade; + } + /** * @return Filter companies by multiple company IDs (starts with comp_) */ @@ -260,6 +272,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CountCompaniesParams other) { return creditTypeIds.equals(other.creditTypeIds) + && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) && ids.equals(other.ids) && limit.equals(other.limit) && monetizedSubscriptions.equals(other.monetizedSubscriptions) @@ -283,6 +296,7 @@ private boolean equalTo(CountCompaniesParams other) { public int hashCode() { return Objects.hash( this.creditTypeIds, + this.hasScheduledDowngrade, this.ids, this.limit, this.monetizedSubscriptions, @@ -315,6 +329,8 @@ public static Builder builder() { public static final class Builder { private Optional> creditTypeIds = Optional.empty(); + private Optional hasScheduledDowngrade = Optional.empty(); + private Optional> ids = Optional.empty(); private Optional limit = Optional.empty(); @@ -356,6 +372,7 @@ private Builder() {} public Builder from(CountCompaniesParams other) { creditTypeIds(other.getCreditTypeIds()); + hasScheduledDowngrade(other.getHasScheduledDowngrade()); ids(other.getIds()); limit(other.getLimit()); monetizedSubscriptions(other.getMonetizedSubscriptions()); @@ -390,6 +407,20 @@ public Builder creditTypeIds(List creditTypeIds) { return this; } + /** + *

Filter companies that have a pending scheduled downgrade

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

Filter companies by multiple company IDs (starts with comp_)

*/ @@ -631,6 +662,7 @@ public Builder withoutSubscription(Boolean withoutSubscription) { public CountCompaniesParams build() { return new CountCompaniesParams( creditTypeIds, + hasScheduledDowngrade, ids, limit, monetizedSubscriptions, diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java index e891234..c6ae112 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesParams.java @@ -26,6 +26,8 @@ public final class ListCompaniesParams { private final Optional> creditTypeIds; + private final Optional hasScheduledDowngrade; + private final Optional> ids; private final Optional limit; @@ -64,6 +66,7 @@ public final class ListCompaniesParams { private ListCompaniesParams( Optional> creditTypeIds, + Optional hasScheduledDowngrade, Optional> ids, Optional limit, Optional monetizedSubscriptions, @@ -83,6 +86,7 @@ private ListCompaniesParams( Optional withoutSubscription, Map additionalProperties) { this.creditTypeIds = creditTypeIds; + this.hasScheduledDowngrade = hasScheduledDowngrade; this.ids = ids; this.limit = limit; this.monetizedSubscriptions = monetizedSubscriptions; @@ -111,6 +115,14 @@ public Optional> getCreditTypeIds() { return creditTypeIds; } + /** + * @return Filter companies that have a pending scheduled downgrade + */ + @JsonProperty("has_scheduled_downgrade") + public Optional getHasScheduledDowngrade() { + return hasScheduledDowngrade; + } + /** * @return Filter companies by multiple company IDs (starts with comp_) */ @@ -260,6 +272,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ListCompaniesParams other) { return creditTypeIds.equals(other.creditTypeIds) + && hasScheduledDowngrade.equals(other.hasScheduledDowngrade) && ids.equals(other.ids) && limit.equals(other.limit) && monetizedSubscriptions.equals(other.monetizedSubscriptions) @@ -283,6 +296,7 @@ private boolean equalTo(ListCompaniesParams other) { public int hashCode() { return Objects.hash( this.creditTypeIds, + this.hasScheduledDowngrade, this.ids, this.limit, this.monetizedSubscriptions, @@ -315,6 +329,8 @@ public static Builder builder() { public static final class Builder { private Optional> creditTypeIds = Optional.empty(); + private Optional hasScheduledDowngrade = Optional.empty(); + private Optional> ids = Optional.empty(); private Optional limit = Optional.empty(); @@ -356,6 +372,7 @@ private Builder() {} public Builder from(ListCompaniesParams other) { creditTypeIds(other.getCreditTypeIds()); + hasScheduledDowngrade(other.getHasScheduledDowngrade()); ids(other.getIds()); limit(other.getLimit()); monetizedSubscriptions(other.getMonetizedSubscriptions()); @@ -390,6 +407,20 @@ public Builder creditTypeIds(List creditTypeIds) { return this; } + /** + *

Filter companies that have a pending scheduled downgrade

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

Filter companies by multiple company IDs (starts with comp_)

*/ @@ -631,6 +662,7 @@ public Builder withoutSubscription(Boolean withoutSubscription) { public ListCompaniesParams build() { return new ListCompaniesParams( creditTypeIds, + hasScheduledDowngrade, ids, limit, monetizedSubscriptions, diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java index 4132ac5..b694f5e 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java @@ -12,6 +12,8 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanChangeAction; +import com.schematic.api.types.PlanChangeBasePlanAction; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,9 +23,9 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListPlanChangesParams.Builder.class) public final class ListPlanChangesParams { - private final Optional action; + private final Optional action; - private final Optional basePlanAction; + private final Optional basePlanAction; private final Optional companyId; @@ -38,8 +40,8 @@ public final class ListPlanChangesParams { private final Map additionalProperties; private ListPlanChangesParams( - Optional action, - Optional basePlanAction, + Optional action, + Optional basePlanAction, Optional companyId, Optional> companyIds, Optional limit, @@ -57,12 +59,12 @@ private ListPlanChangesParams( } @JsonProperty("action") - public Optional getAction() { + public Optional getAction() { return action; } @JsonProperty("base_plan_action") - public Optional getBasePlanAction() { + public Optional getBasePlanAction() { return basePlanAction; } @@ -141,9 +143,9 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional action = Optional.empty(); + private Optional action = Optional.empty(); - private Optional basePlanAction = Optional.empty(); + private Optional basePlanAction = Optional.empty(); private Optional companyId = Optional.empty(); @@ -172,23 +174,23 @@ public Builder from(ListPlanChangesParams other) { } @JsonSetter(value = "action", nulls = Nulls.SKIP) - public Builder action(Optional action) { + public Builder action(Optional action) { this.action = action; return this; } - public Builder action(String action) { + public Builder action(PlanChangeAction action) { this.action = Optional.ofNullable(action); return this; } @JsonSetter(value = "base_plan_action", nulls = Nulls.SKIP) - public Builder basePlanAction(Optional basePlanAction) { + public Builder basePlanAction(Optional basePlanAction) { this.basePlanAction = basePlanAction; return this; } - public Builder basePlanAction(String basePlanAction) { + public Builder basePlanAction(PlanChangeBasePlanAction basePlanAction) { this.basePlanAction = Optional.ofNullable(basePlanAction); return this; } 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 dd44ffd..07c80c1 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java @@ -41,6 +41,7 @@ import com.schematic.api.resources.credits.types.GetCreditBundleResponse; import com.schematic.api.resources.credits.types.GetEnrichedCreditLedgerResponse; import com.schematic.api.resources.credits.types.GetSingleBillingCreditResponse; +import com.schematic.api.resources.credits.types.GetSingleBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.GrantBillingCreditsToCompanyResponse; import com.schematic.api.resources.credits.types.ListBillingCreditsResponse; import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; @@ -370,6 +371,18 @@ public CompletableFuture createBillingPlan .thenApply(response -> response.body()); } + public CompletableFuture getSingleBillingPlanCreditGrant( + String planGrantId) { + return this.rawClient.getSingleBillingPlanCreditGrant(planGrantId).thenApply(response -> response.body()); + } + + public CompletableFuture getSingleBillingPlanCreditGrant( + String planGrantId, RequestOptions requestOptions) { + return this.rawClient + .getSingleBillingPlanCreditGrant(planGrantId, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture updateBillingPlanCreditGrant( String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { return this.rawClient.updateBillingPlanCreditGrant(planGrantId, request).thenApply(response -> response.body()); diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java index 63e584a..62867e6 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java @@ -53,6 +53,7 @@ import com.schematic.api.resources.credits.types.GetCreditBundleResponse; import com.schematic.api.resources.credits.types.GetEnrichedCreditLedgerResponse; import com.schematic.api.resources.credits.types.GetSingleBillingCreditResponse; +import com.schematic.api.resources.credits.types.GetSingleBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.GrantBillingCreditsToCompanyResponse; import com.schematic.api.resources.credits.types.ListBillingCreditsResponse; import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; @@ -2357,6 +2358,89 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> + getSingleBillingPlanCreditGrant(String planGrantId) { + return getSingleBillingPlanCreditGrant(planGrantId, null); + } + + public CompletableFuture> + getSingleBillingPlanCreditGrant(String planGrantId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("billing/credits/plan-grants") + .addPathSegment(planGrantId); + 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); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetSingleBillingPlanCreditGrantResponse.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 (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> updateBillingPlanCreditGrant(String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { return updateBillingPlanCreditGrant(planGrantId, request, null); diff --git a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java index d48c4d4..a70d81e 100644 --- a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java @@ -41,6 +41,7 @@ import com.schematic.api.resources.credits.types.GetCreditBundleResponse; import com.schematic.api.resources.credits.types.GetEnrichedCreditLedgerResponse; import com.schematic.api.resources.credits.types.GetSingleBillingCreditResponse; +import com.schematic.api.resources.credits.types.GetSingleBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.GrantBillingCreditsToCompanyResponse; import com.schematic.api.resources.credits.types.ListBillingCreditsResponse; import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; @@ -359,6 +360,17 @@ public CreateBillingPlanCreditGrantResponse createBillingPlanCreditGrant( .body(); } + public GetSingleBillingPlanCreditGrantResponse getSingleBillingPlanCreditGrant(String planGrantId) { + return this.rawClient.getSingleBillingPlanCreditGrant(planGrantId).body(); + } + + public GetSingleBillingPlanCreditGrantResponse getSingleBillingPlanCreditGrant( + String planGrantId, RequestOptions requestOptions) { + return this.rawClient + .getSingleBillingPlanCreditGrant(planGrantId, requestOptions) + .body(); + } + public UpdateBillingPlanCreditGrantResponse updateBillingPlanCreditGrant( String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { return this.rawClient.updateBillingPlanCreditGrant(planGrantId, request).body(); diff --git a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java index d44a40d..fafdf41 100644 --- a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java @@ -53,6 +53,7 @@ import com.schematic.api.resources.credits.types.GetCreditBundleResponse; import com.schematic.api.resources.credits.types.GetEnrichedCreditLedgerResponse; import com.schematic.api.resources.credits.types.GetSingleBillingCreditResponse; +import com.schematic.api.resources.credits.types.GetSingleBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.GrantBillingCreditsToCompanyResponse; import com.schematic.api.resources.credits.types.ListBillingCreditsResponse; import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; @@ -1809,6 +1810,67 @@ public BaseSchematicHttpResponse createBil } } + public BaseSchematicHttpResponse getSingleBillingPlanCreditGrant( + String planGrantId) { + return getSingleBillingPlanCreditGrant(planGrantId, null); + } + + public BaseSchematicHttpResponse getSingleBillingPlanCreditGrant( + String planGrantId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("billing/credits/plan-grants") + .addPathSegment(planGrantId); + 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); + } + 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, GetSingleBillingPlanCreditGrantResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse updateBillingPlanCreditGrant( String planGrantId, UpdateBillingPlanCreditGrantRequestBody request) { return updateBillingPlanCreditGrant(planGrantId, request, null); diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingPlanCreditGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingPlanCreditGrantResponse.java new file mode 100644 index 0000000..9874e88 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingPlanCreditGrantResponse.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingPlanCreditGrantResponseData; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetSingleBillingPlanCreditGrantResponse.Builder.class) +public final class GetSingleBillingPlanCreditGrantResponse { + private final BillingPlanCreditGrantResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetSingleBillingPlanCreditGrantResponse( + BillingPlanCreditGrantResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public BillingPlanCreditGrantResponseData getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public Map getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetSingleBillingPlanCreditGrantResponse + && equalTo((GetSingleBillingPlanCreditGrantResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetSingleBillingPlanCreditGrantResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull BillingPlanCreditGrantResponseData data); + + Builder from(GetSingleBillingPlanCreditGrantResponse other); + } + + public interface _FinalStage { + GetSingleBillingPlanCreditGrantResponse 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 BillingPlanCreditGrantResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetSingleBillingPlanCreditGrantResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull BillingPlanCreditGrantResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + /** + *

Input parameters

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

Input parameters

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

Input parameters

+ */ + @java.lang.Override + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public _FinalStage params(Map params) { + this.params.clear(); + if (params != null) { + this.params.putAll(params); + } + return this; + } + + @java.lang.Override + public GetSingleBillingPlanCreditGrantResponse build() { + return new GetSingleBillingPlanCreditGrantResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java index 8e0d820..c6c374f 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java @@ -10,6 +10,7 @@ import com.schematic.api.resources.entitlements.requests.CountFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.CountFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; +import com.schematic.api.resources.entitlements.requests.CreateBillingLinkedPlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; @@ -43,6 +44,7 @@ import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.UpsertPlanEntitlementForBillingProductResponse; import java.util.concurrent.CompletableFuture; public class AsyncEntitlementsClient { @@ -283,6 +285,18 @@ public CompletableFuture deletePlanEntitlement( .thenApply(response -> response.body()); } + public CompletableFuture upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody request) { + return this.rawClient.upsertPlanEntitlementForBillingProduct(request).thenApply(response -> response.body()); + } + + public CompletableFuture upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .upsertPlanEntitlementForBillingProduct(request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture countPlanEntitlements() { return this.rawClient.countPlanEntitlements().thenApply(response -> response.body()); } 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 18191ec..641cccc 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java @@ -22,6 +22,7 @@ import com.schematic.api.resources.entitlements.requests.CountFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.CountFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; +import com.schematic.api.resources.entitlements.requests.CreateBillingLinkedPlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; @@ -55,6 +56,7 @@ import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.UpsertPlanEntitlementForBillingProductResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import java.util.concurrent.CompletableFuture; @@ -1934,6 +1936,102 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> + upsertPlanEntitlementForBillingProduct(CreateBillingLinkedPlanEntitlementRequestBody request) { + return upsertPlanEntitlementForBillingProduct(request, null); + } + + public CompletableFuture> + upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-entitlements/billing-linked"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpsertPlanEntitlementForBillingProductResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> countPlanEntitlements() { return countPlanEntitlements(CountPlanEntitlementsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java index 4f9a98a..eccf611 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java @@ -10,6 +10,7 @@ import com.schematic.api.resources.entitlements.requests.CountFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.CountFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; +import com.schematic.api.resources.entitlements.requests.CreateBillingLinkedPlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; @@ -43,6 +44,7 @@ import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.UpsertPlanEntitlementForBillingProductResponse; public class EntitlementsClient { protected final ClientOptions clientOptions; @@ -273,6 +275,18 @@ public DeletePlanEntitlementResponse deletePlanEntitlement( .body(); } + public UpsertPlanEntitlementForBillingProductResponse upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody request) { + return this.rawClient.upsertPlanEntitlementForBillingProduct(request).body(); + } + + public UpsertPlanEntitlementForBillingProductResponse upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .upsertPlanEntitlementForBillingProduct(request, requestOptions) + .body(); + } + public CountPlanEntitlementsResponse countPlanEntitlements() { return this.rawClient.countPlanEntitlements().body(); } 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 1bda5e7..07b87ba 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java @@ -22,6 +22,7 @@ import com.schematic.api.resources.entitlements.requests.CountFeatureUsageRequest; import com.schematic.api.resources.entitlements.requests.CountFeatureUsersRequest; import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; +import com.schematic.api.resources.entitlements.requests.CreateBillingLinkedPlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; @@ -55,6 +56,7 @@ import com.schematic.api.resources.entitlements.types.ListPlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.UpsertPlanEntitlementForBillingProductResponse; import com.schematic.api.types.ApiError; import java.io.IOException; import okhttp3.Headers; @@ -1494,6 +1496,78 @@ public BaseSchematicHttpResponse deletePlanEntitl } } + public BaseSchematicHttpResponse + upsertPlanEntitlementForBillingProduct(CreateBillingLinkedPlanEntitlementRequestBody request) { + return upsertPlanEntitlementForBillingProduct(request, null); + } + + public BaseSchematicHttpResponse + upsertPlanEntitlementForBillingProduct( + CreateBillingLinkedPlanEntitlementRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-entitlements/billing-linked"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpsertPlanEntitlementForBillingProductResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countPlanEntitlements() { return countPlanEntitlements(CountPlanEntitlementsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java new file mode 100644 index 0000000..a9ee613 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateBillingLinkedPlanEntitlementRequestBody.java @@ -0,0 +1,1064 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.resources.entitlements.types.CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod; +import com.schematic.api.resources.entitlements.types.CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.BillingTiersMode; +import com.schematic.api.types.CreatePriceTierRequestBody; +import com.schematic.api.types.CurrencyPriceRequestBody; +import com.schematic.api.types.EntitlementPriceBehavior; +import com.schematic.api.types.EntitlementValueType; +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 = CreateBillingLinkedPlanEntitlementRequestBody.Builder.class) +public final class CreateBillingLinkedPlanEntitlementRequestBody { + private final Optional billingProductId; + + private final BillingProviderType billingProvider; + + private final Optional billingThreshold; + + private final Optional creditConsumptionRate; + + private final Optional currency; + + private final Optional> currencyPrices; + + private final String externalResourceId; + + private final String featureId; + + private final Optional metricPeriod; + + private final Optional metricPeriodMonthReset; + + private final Optional monthlyMeteredPriceId; + + private final Optional> monthlyPriceTiers; + + private final Optional monthlyUnitPrice; + + private final Optional monthlyUnitPriceDecimal; + + private final Optional overageBillingProductId; + + private final String planId; + + private final Optional planVersionId; + + private final Optional priceBehavior; + + private final Optional> priceTiers; + + private final Optional softLimit; + + private final Optional tierMode; + + private final Optional valueBool; + + private final Optional valueCreditId; + + private final Optional valueNumeric; + + private final Optional valueTraitId; + + private final EntitlementValueType valueType; + + private final Optional yearlyMeteredPriceId; + + private final Optional> yearlyPriceTiers; + + private final Optional yearlyUnitPrice; + + private final Optional yearlyUnitPriceDecimal; + + private final Map additionalProperties; + + private CreateBillingLinkedPlanEntitlementRequestBody( + Optional billingProductId, + BillingProviderType billingProvider, + Optional billingThreshold, + Optional creditConsumptionRate, + Optional currency, + Optional> currencyPrices, + String externalResourceId, + String featureId, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional monthlyMeteredPriceId, + Optional> monthlyPriceTiers, + Optional monthlyUnitPrice, + Optional monthlyUnitPriceDecimal, + Optional overageBillingProductId, + String planId, + Optional planVersionId, + Optional priceBehavior, + Optional> priceTiers, + Optional softLimit, + Optional tierMode, + Optional valueBool, + Optional valueCreditId, + Optional valueNumeric, + Optional valueTraitId, + EntitlementValueType valueType, + Optional yearlyMeteredPriceId, + Optional> yearlyPriceTiers, + Optional yearlyUnitPrice, + Optional yearlyUnitPriceDecimal, + Map additionalProperties) { + this.billingProductId = billingProductId; + this.billingProvider = billingProvider; + this.billingThreshold = billingThreshold; + this.creditConsumptionRate = creditConsumptionRate; + this.currency = currency; + this.currencyPrices = currencyPrices; + this.externalResourceId = externalResourceId; + this.featureId = featureId; + this.metricPeriod = metricPeriod; + this.metricPeriodMonthReset = metricPeriodMonthReset; + this.monthlyMeteredPriceId = monthlyMeteredPriceId; + this.monthlyPriceTiers = monthlyPriceTiers; + this.monthlyUnitPrice = monthlyUnitPrice; + this.monthlyUnitPriceDecimal = monthlyUnitPriceDecimal; + this.overageBillingProductId = overageBillingProductId; + this.planId = planId; + this.planVersionId = planVersionId; + this.priceBehavior = priceBehavior; + this.priceTiers = priceTiers; + this.softLimit = softLimit; + this.tierMode = tierMode; + this.valueBool = valueBool; + this.valueCreditId = valueCreditId; + this.valueNumeric = valueNumeric; + this.valueTraitId = valueTraitId; + this.valueType = valueType; + this.yearlyMeteredPriceId = yearlyMeteredPriceId; + this.yearlyPriceTiers = yearlyPriceTiers; + this.yearlyUnitPrice = yearlyUnitPrice; + this.yearlyUnitPriceDecimal = yearlyUnitPriceDecimal; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_product_id") + public Optional getBillingProductId() { + return billingProductId; + } + + @JsonProperty("billing_provider") + public BillingProviderType getBillingProvider() { + return billingProvider; + } + + @JsonProperty("billing_threshold") + public Optional getBillingThreshold() { + return billingThreshold; + } + + @JsonProperty("credit_consumption_rate") + public Optional getCreditConsumptionRate() { + return creditConsumptionRate; + } + + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + + @JsonProperty("external_resource_id") + public String getExternalResourceId() { + return externalResourceId; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + @JsonProperty("metric_period_month_reset") + public Optional getMetricPeriodMonthReset() { + return metricPeriodMonthReset; + } + + @JsonProperty("monthly_metered_price_id") + public Optional getMonthlyMeteredPriceId() { + return monthlyMeteredPriceId; + } + + @JsonProperty("monthly_price_tiers") + public Optional> getMonthlyPriceTiers() { + return monthlyPriceTiers; + } + + @JsonProperty("monthly_unit_price") + public Optional getMonthlyUnitPrice() { + return monthlyUnitPrice; + } + + @JsonProperty("monthly_unit_price_decimal") + public Optional getMonthlyUnitPriceDecimal() { + return monthlyUnitPriceDecimal; + } + + @JsonProperty("overage_billing_product_id") + public Optional getOverageBillingProductId() { + return overageBillingProductId; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("price_behavior") + public Optional getPriceBehavior() { + return priceBehavior; + } + + /** + * @return Use MonthlyPriceTiers or YearlyPriceTiers instead + */ + @JsonProperty("price_tiers") + public Optional> getPriceTiers() { + return priceTiers; + } + + @JsonProperty("soft_limit") + public Optional getSoftLimit() { + return softLimit; + } + + @JsonProperty("tier_mode") + public Optional getTierMode() { + return tierMode; + } + + @JsonProperty("value_bool") + public Optional getValueBool() { + return valueBool; + } + + @JsonProperty("value_credit_id") + public Optional getValueCreditId() { + return valueCreditId; + } + + @JsonProperty("value_numeric") + public Optional getValueNumeric() { + return valueNumeric; + } + + @JsonProperty("value_trait_id") + public Optional getValueTraitId() { + return valueTraitId; + } + + @JsonProperty("value_type") + public EntitlementValueType getValueType() { + return valueType; + } + + @JsonProperty("yearly_metered_price_id") + public Optional getYearlyMeteredPriceId() { + return yearlyMeteredPriceId; + } + + @JsonProperty("yearly_price_tiers") + public Optional> getYearlyPriceTiers() { + return yearlyPriceTiers; + } + + @JsonProperty("yearly_unit_price") + public Optional getYearlyUnitPrice() { + return yearlyUnitPrice; + } + + @JsonProperty("yearly_unit_price_decimal") + public Optional getYearlyUnitPriceDecimal() { + return yearlyUnitPriceDecimal; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBillingLinkedPlanEntitlementRequestBody + && equalTo((CreateBillingLinkedPlanEntitlementRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBillingLinkedPlanEntitlementRequestBody other) { + return billingProductId.equals(other.billingProductId) + && billingProvider.equals(other.billingProvider) + && billingThreshold.equals(other.billingThreshold) + && creditConsumptionRate.equals(other.creditConsumptionRate) + && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) + && externalResourceId.equals(other.externalResourceId) + && featureId.equals(other.featureId) + && metricPeriod.equals(other.metricPeriod) + && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && monthlyMeteredPriceId.equals(other.monthlyMeteredPriceId) + && monthlyPriceTiers.equals(other.monthlyPriceTiers) + && monthlyUnitPrice.equals(other.monthlyUnitPrice) + && monthlyUnitPriceDecimal.equals(other.monthlyUnitPriceDecimal) + && overageBillingProductId.equals(other.overageBillingProductId) + && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) + && priceBehavior.equals(other.priceBehavior) + && priceTiers.equals(other.priceTiers) + && softLimit.equals(other.softLimit) + && tierMode.equals(other.tierMode) + && valueBool.equals(other.valueBool) + && valueCreditId.equals(other.valueCreditId) + && valueNumeric.equals(other.valueNumeric) + && valueTraitId.equals(other.valueTraitId) + && valueType.equals(other.valueType) + && yearlyMeteredPriceId.equals(other.yearlyMeteredPriceId) + && yearlyPriceTiers.equals(other.yearlyPriceTiers) + && yearlyUnitPrice.equals(other.yearlyUnitPrice) + && yearlyUnitPriceDecimal.equals(other.yearlyUnitPriceDecimal); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingProductId, + this.billingProvider, + this.billingThreshold, + this.creditConsumptionRate, + this.currency, + this.currencyPrices, + this.externalResourceId, + this.featureId, + this.metricPeriod, + this.metricPeriodMonthReset, + this.monthlyMeteredPriceId, + this.monthlyPriceTiers, + this.monthlyUnitPrice, + this.monthlyUnitPriceDecimal, + this.overageBillingProductId, + this.planId, + this.planVersionId, + this.priceBehavior, + this.priceTiers, + this.softLimit, + this.tierMode, + this.valueBool, + this.valueCreditId, + this.valueNumeric, + this.valueTraitId, + this.valueType, + this.yearlyMeteredPriceId, + this.yearlyPriceTiers, + this.yearlyUnitPrice, + this.yearlyUnitPriceDecimal); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BillingProviderStage builder() { + return new Builder(); + } + + public interface BillingProviderStage { + ExternalResourceIdStage billingProvider(@NotNull BillingProviderType billingProvider); + + Builder from(CreateBillingLinkedPlanEntitlementRequestBody other); + } + + public interface ExternalResourceIdStage { + FeatureIdStage externalResourceId(@NotNull String externalResourceId); + } + + public interface FeatureIdStage { + PlanIdStage featureId(@NotNull String featureId); + } + + public interface PlanIdStage { + ValueTypeStage planId(@NotNull String planId); + } + + public interface ValueTypeStage { + _FinalStage valueType(@NotNull EntitlementValueType valueType); + } + + public interface _FinalStage { + CreateBillingLinkedPlanEntitlementRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingProductId(Optional billingProductId); + + _FinalStage billingProductId(String billingProductId); + + _FinalStage billingThreshold(Optional billingThreshold); + + _FinalStage billingThreshold(Long billingThreshold); + + _FinalStage creditConsumptionRate(Optional creditConsumptionRate); + + _FinalStage creditConsumptionRate(Double creditConsumptionRate); + + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod metricPeriod); + + _FinalStage metricPeriodMonthReset( + Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset( + CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset metricPeriodMonthReset); + + _FinalStage monthlyMeteredPriceId(Optional monthlyMeteredPriceId); + + _FinalStage monthlyMeteredPriceId(String monthlyMeteredPriceId); + + _FinalStage monthlyPriceTiers(Optional> monthlyPriceTiers); + + _FinalStage monthlyPriceTiers(List monthlyPriceTiers); + + _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); + + _FinalStage monthlyUnitPrice(Long monthlyUnitPrice); + + _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal); + + _FinalStage monthlyUnitPriceDecimal(String monthlyUnitPriceDecimal); + + _FinalStage overageBillingProductId(Optional overageBillingProductId); + + _FinalStage overageBillingProductId(String overageBillingProductId); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + + _FinalStage priceBehavior(Optional priceBehavior); + + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); + + /** + *

Use MonthlyPriceTiers or YearlyPriceTiers instead

+ */ + _FinalStage priceTiers(Optional> priceTiers); + + _FinalStage priceTiers(List priceTiers); + + _FinalStage softLimit(Optional softLimit); + + _FinalStage softLimit(Long softLimit); + + _FinalStage tierMode(Optional tierMode); + + _FinalStage tierMode(BillingTiersMode tierMode); + + _FinalStage valueBool(Optional valueBool); + + _FinalStage valueBool(Boolean valueBool); + + _FinalStage valueCreditId(Optional valueCreditId); + + _FinalStage valueCreditId(String valueCreditId); + + _FinalStage valueNumeric(Optional valueNumeric); + + _FinalStage valueNumeric(Long valueNumeric); + + _FinalStage valueTraitId(Optional valueTraitId); + + _FinalStage valueTraitId(String valueTraitId); + + _FinalStage yearlyMeteredPriceId(Optional yearlyMeteredPriceId); + + _FinalStage yearlyMeteredPriceId(String yearlyMeteredPriceId); + + _FinalStage yearlyPriceTiers(Optional> yearlyPriceTiers); + + _FinalStage yearlyPriceTiers(List yearlyPriceTiers); + + _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); + + _FinalStage yearlyUnitPrice(Long yearlyUnitPrice); + + _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal); + + _FinalStage yearlyUnitPriceDecimal(String yearlyUnitPriceDecimal); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BillingProviderStage, + ExternalResourceIdStage, + FeatureIdStage, + PlanIdStage, + ValueTypeStage, + _FinalStage { + private BillingProviderType billingProvider; + + private String externalResourceId; + + private String featureId; + + private String planId; + + private EntitlementValueType valueType; + + private Optional yearlyUnitPriceDecimal = Optional.empty(); + + private Optional yearlyUnitPrice = Optional.empty(); + + private Optional> yearlyPriceTiers = Optional.empty(); + + private Optional yearlyMeteredPriceId = Optional.empty(); + + private Optional valueTraitId = Optional.empty(); + + private Optional valueNumeric = Optional.empty(); + + private Optional valueCreditId = Optional.empty(); + + private Optional valueBool = Optional.empty(); + + private Optional tierMode = Optional.empty(); + + private Optional softLimit = Optional.empty(); + + private Optional> priceTiers = Optional.empty(); + + private Optional priceBehavior = Optional.empty(); + + private Optional planVersionId = Optional.empty(); + + private Optional overageBillingProductId = Optional.empty(); + + private Optional monthlyUnitPriceDecimal = Optional.empty(); + + private Optional monthlyUnitPrice = Optional.empty(); + + private Optional> monthlyPriceTiers = Optional.empty(); + + private Optional monthlyMeteredPriceId = Optional.empty(); + + private Optional metricPeriodMonthReset = + Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional> currencyPrices = Optional.empty(); + + private Optional currency = Optional.empty(); + + private Optional creditConsumptionRate = Optional.empty(); + + private Optional billingThreshold = Optional.empty(); + + private Optional billingProductId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBillingLinkedPlanEntitlementRequestBody other) { + billingProductId(other.getBillingProductId()); + billingProvider(other.getBillingProvider()); + billingThreshold(other.getBillingThreshold()); + creditConsumptionRate(other.getCreditConsumptionRate()); + currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); + externalResourceId(other.getExternalResourceId()); + featureId(other.getFeatureId()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + monthlyMeteredPriceId(other.getMonthlyMeteredPriceId()); + monthlyPriceTiers(other.getMonthlyPriceTiers()); + monthlyUnitPrice(other.getMonthlyUnitPrice()); + monthlyUnitPriceDecimal(other.getMonthlyUnitPriceDecimal()); + overageBillingProductId(other.getOverageBillingProductId()); + planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); + priceBehavior(other.getPriceBehavior()); + priceTiers(other.getPriceTiers()); + softLimit(other.getSoftLimit()); + tierMode(other.getTierMode()); + valueBool(other.getValueBool()); + valueCreditId(other.getValueCreditId()); + valueNumeric(other.getValueNumeric()); + valueTraitId(other.getValueTraitId()); + valueType(other.getValueType()); + yearlyMeteredPriceId(other.getYearlyMeteredPriceId()); + yearlyPriceTiers(other.getYearlyPriceTiers()); + yearlyUnitPrice(other.getYearlyUnitPrice()); + yearlyUnitPriceDecimal(other.getYearlyUnitPriceDecimal()); + return this; + } + + @java.lang.Override + @JsonSetter("billing_provider") + public ExternalResourceIdStage billingProvider(@NotNull BillingProviderType billingProvider) { + this.billingProvider = Objects.requireNonNull(billingProvider, "billingProvider must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("external_resource_id") + public FeatureIdStage externalResourceId(@NotNull String externalResourceId) { + this.externalResourceId = Objects.requireNonNull(externalResourceId, "externalResourceId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_id") + public PlanIdStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public ValueTypeStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId 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; + } + + @java.lang.Override + public _FinalStage yearlyUnitPriceDecimal(String yearlyUnitPriceDecimal) { + this.yearlyUnitPriceDecimal = Optional.ofNullable(yearlyUnitPriceDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_unit_price_decimal", nulls = Nulls.SKIP) + public _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal) { + this.yearlyUnitPriceDecimal = yearlyUnitPriceDecimal; + return this; + } + + @java.lang.Override + public _FinalStage yearlyUnitPrice(Long yearlyUnitPrice) { + this.yearlyUnitPrice = Optional.ofNullable(yearlyUnitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_unit_price", nulls = Nulls.SKIP) + public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { + this.yearlyUnitPrice = yearlyUnitPrice; + return this; + } + + @java.lang.Override + public _FinalStage yearlyPriceTiers(List yearlyPriceTiers) { + this.yearlyPriceTiers = Optional.ofNullable(yearlyPriceTiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price_tiers", nulls = Nulls.SKIP) + public _FinalStage yearlyPriceTiers(Optional> yearlyPriceTiers) { + this.yearlyPriceTiers = yearlyPriceTiers; + return this; + } + + @java.lang.Override + public _FinalStage yearlyMeteredPriceId(String yearlyMeteredPriceId) { + this.yearlyMeteredPriceId = Optional.ofNullable(yearlyMeteredPriceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_metered_price_id", nulls = Nulls.SKIP) + public _FinalStage yearlyMeteredPriceId(Optional yearlyMeteredPriceId) { + this.yearlyMeteredPriceId = yearlyMeteredPriceId; + return this; + } + + @java.lang.Override + public _FinalStage valueTraitId(String valueTraitId) { + this.valueTraitId = Optional.ofNullable(valueTraitId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value_trait_id", nulls = Nulls.SKIP) + public _FinalStage valueTraitId(Optional valueTraitId) { + this.valueTraitId = valueTraitId; + 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 valueCreditId(String valueCreditId) { + this.valueCreditId = Optional.ofNullable(valueCreditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "value_credit_id", nulls = Nulls.SKIP) + public _FinalStage valueCreditId(Optional valueCreditId) { + this.valueCreditId = valueCreditId; + 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 tierMode(BillingTiersMode tierMode) { + this.tierMode = Optional.ofNullable(tierMode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tier_mode", nulls = Nulls.SKIP) + public _FinalStage tierMode(Optional tierMode) { + this.tierMode = tierMode; + 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; + } + + /** + *

Use MonthlyPriceTiers or YearlyPriceTiers instead

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

Use MonthlyPriceTiers or YearlyPriceTiers instead

+ */ + @java.lang.Override + @JsonSetter(value = "price_tiers", nulls = Nulls.SKIP) + public _FinalStage priceTiers(Optional> priceTiers) { + this.priceTiers = priceTiers; + 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 planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public _FinalStage planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + @java.lang.Override + public _FinalStage overageBillingProductId(String overageBillingProductId) { + this.overageBillingProductId = Optional.ofNullable(overageBillingProductId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "overage_billing_product_id", nulls = Nulls.SKIP) + public _FinalStage overageBillingProductId(Optional overageBillingProductId) { + this.overageBillingProductId = overageBillingProductId; + return this; + } + + @java.lang.Override + public _FinalStage monthlyUnitPriceDecimal(String monthlyUnitPriceDecimal) { + this.monthlyUnitPriceDecimal = Optional.ofNullable(monthlyUnitPriceDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_unit_price_decimal", nulls = Nulls.SKIP) + public _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal) { + this.monthlyUnitPriceDecimal = monthlyUnitPriceDecimal; + return this; + } + + @java.lang.Override + public _FinalStage monthlyUnitPrice(Long monthlyUnitPrice) { + this.monthlyUnitPrice = Optional.ofNullable(monthlyUnitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_unit_price", nulls = Nulls.SKIP) + public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { + this.monthlyUnitPrice = monthlyUnitPrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPriceTiers(List monthlyPriceTiers) { + this.monthlyPriceTiers = Optional.ofNullable(monthlyPriceTiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price_tiers", nulls = Nulls.SKIP) + public _FinalStage monthlyPriceTiers(Optional> monthlyPriceTiers) { + this.monthlyPriceTiers = monthlyPriceTiers; + return this; + } + + @java.lang.Override + public _FinalStage monthlyMeteredPriceId(String monthlyMeteredPriceId) { + this.monthlyMeteredPriceId = Optional.ofNullable(monthlyMeteredPriceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_metered_price_id", nulls = Nulls.SKIP) + public _FinalStage monthlyMeteredPriceId(Optional monthlyMeteredPriceId) { + this.monthlyMeteredPriceId = monthlyMeteredPriceId; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriodMonthReset( + CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset 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(CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod 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 currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + + @java.lang.Override + public _FinalStage currency(String currency) { + this.currency = Optional.ofNullable(currency); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency", nulls = Nulls.SKIP) + public _FinalStage currency(Optional currency) { + this.currency = currency; + return this; + } + + @java.lang.Override + public _FinalStage creditConsumptionRate(Double creditConsumptionRate) { + this.creditConsumptionRate = Optional.ofNullable(creditConsumptionRate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_consumption_rate", nulls = Nulls.SKIP) + public _FinalStage creditConsumptionRate(Optional creditConsumptionRate) { + this.creditConsumptionRate = creditConsumptionRate; + return this; + } + + @java.lang.Override + public _FinalStage billingThreshold(Long billingThreshold) { + this.billingThreshold = Optional.ofNullable(billingThreshold); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) + public _FinalStage billingThreshold(Optional billingThreshold) { + this.billingThreshold = billingThreshold; + return this; + } + + @java.lang.Override + public _FinalStage billingProductId(String billingProductId) { + this.billingProductId = Optional.ofNullable(billingProductId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_product_id", nulls = Nulls.SKIP) + public _FinalStage billingProductId(Optional billingProductId) { + this.billingProductId = billingProductId; + return this; + } + + @java.lang.Override + public CreateBillingLinkedPlanEntitlementRequestBody build() { + return new CreateBillingLinkedPlanEntitlementRequestBody( + billingProductId, + billingProvider, + billingThreshold, + creditConsumptionRate, + currency, + currencyPrices, + externalResourceId, + featureId, + metricPeriod, + metricPeriodMonthReset, + monthlyMeteredPriceId, + monthlyPriceTiers, + monthlyUnitPrice, + monthlyUnitPriceDecimal, + overageBillingProductId, + planId, + planVersionId, + priceBehavior, + priceTiers, + softLimit, + tierMode, + valueBool, + valueCreditId, + valueNumeric, + valueTraitId, + valueType, + yearlyMeteredPriceId, + yearlyPriceTiers, + yearlyUnitPrice, + yearlyUnitPriceDecimal, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java index 382ddaf..82d1d4f 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java @@ -16,6 +16,7 @@ import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementRequestBodyMetricPeriodMonthReset; import com.schematic.api.types.BillingTiersMode; import com.schematic.api.types.CreatePriceTierRequestBody; +import com.schematic.api.types.CurrencyPriceRequestBody; import com.schematic.api.types.EntitlementPriceBehavior; import com.schematic.api.types.EntitlementValueType; import java.util.HashMap; @@ -36,6 +37,8 @@ public final class CreatePlanEntitlementRequestBody { private final Optional currency; + private final Optional> currencyPrices; + private final String featureId; private final Optional metricPeriod; @@ -89,6 +92,7 @@ private CreatePlanEntitlementRequestBody( Optional billingThreshold, Optional creditConsumptionRate, Optional currency, + Optional> currencyPrices, String featureId, Optional metricPeriod, Optional metricPeriodMonthReset, @@ -117,6 +121,7 @@ private CreatePlanEntitlementRequestBody( this.billingThreshold = billingThreshold; this.creditConsumptionRate = creditConsumptionRate; this.currency = currency; + this.currencyPrices = currencyPrices; this.featureId = featureId; this.metricPeriod = metricPeriod; this.metricPeriodMonthReset = metricPeriodMonthReset; @@ -163,6 +168,11 @@ public Optional getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("feature_id") public String getFeatureId() { return featureId; @@ -297,6 +307,7 @@ private boolean equalTo(CreatePlanEntitlementRequestBody other) { && billingThreshold.equals(other.billingThreshold) && creditConsumptionRate.equals(other.creditConsumptionRate) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && featureId.equals(other.featureId) && metricPeriod.equals(other.metricPeriod) && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) @@ -329,6 +340,7 @@ public int hashCode() { this.billingThreshold, this.creditConsumptionRate, this.currency, + this.currencyPrices, this.featureId, this.metricPeriod, this.metricPeriodMonthReset, @@ -400,6 +412,10 @@ public interface _FinalStage { _FinalStage currency(String currency); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage metricPeriod(Optional metricPeriod); _FinalStage metricPeriod(CreatePlanEntitlementRequestBodyMetricPeriod metricPeriod); @@ -535,6 +551,8 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional metricPeriod = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional currency = Optional.empty(); private Optional creditConsumptionRate = Optional.empty(); @@ -554,6 +572,7 @@ public Builder from(CreatePlanEntitlementRequestBody other) { billingThreshold(other.getBillingThreshold()); creditConsumptionRate(other.getCreditConsumptionRate()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); featureId(other.getFeatureId()); metricPeriod(other.getMetricPeriod()); metricPeriodMonthReset(other.getMetricPeriodMonthReset()); @@ -870,6 +889,19 @@ public _FinalStage metricPeriod(Optional currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage currency(String currency) { this.currency = Optional.ofNullable(currency); @@ -929,6 +961,7 @@ public CreatePlanEntitlementRequestBody build() { billingThreshold, creditConsumptionRate, currency, + currencyPrices, featureId, metricPeriod, metricPeriodMonthReset, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java index 047e157..d3be5eb 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java @@ -16,6 +16,7 @@ import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset; import com.schematic.api.types.BillingTiersMode; import com.schematic.api.types.CreatePriceTierRequestBody; +import com.schematic.api.types.CurrencyPriceRequestBody; import com.schematic.api.types.EntitlementPriceBehavior; import com.schematic.api.types.EntitlementValueType; import java.util.HashMap; @@ -36,6 +37,8 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional currency; + private final Optional> currencyPrices; + private final Optional metricPeriod; private final Optional metricPeriodMonthReset; @@ -83,6 +86,7 @@ private UpdatePlanEntitlementRequestBody( Optional billingThreshold, Optional creditConsumptionRate, Optional currency, + Optional> currencyPrices, Optional metricPeriod, Optional metricPeriodMonthReset, Optional monthlyMeteredPriceId, @@ -108,6 +112,7 @@ private UpdatePlanEntitlementRequestBody( this.billingThreshold = billingThreshold; this.creditConsumptionRate = creditConsumptionRate; this.currency = currency; + this.currencyPrices = currencyPrices; this.metricPeriod = metricPeriod; this.metricPeriodMonthReset = metricPeriodMonthReset; this.monthlyMeteredPriceId = monthlyMeteredPriceId; @@ -151,6 +156,11 @@ public Optional getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("metric_period") public Optional getMetricPeriod() { return metricPeriod; @@ -270,6 +280,7 @@ private boolean equalTo(UpdatePlanEntitlementRequestBody other) { && billingThreshold.equals(other.billingThreshold) && creditConsumptionRate.equals(other.creditConsumptionRate) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && metricPeriod.equals(other.metricPeriod) && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) && monthlyMeteredPriceId.equals(other.monthlyMeteredPriceId) @@ -299,6 +310,7 @@ public int hashCode() { this.billingThreshold, this.creditConsumptionRate, this.currency, + this.currencyPrices, this.metricPeriod, this.metricPeriodMonthReset, this.monthlyMeteredPriceId, @@ -359,6 +371,10 @@ public interface _FinalStage { _FinalStage currency(String currency); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage metricPeriod(Optional metricPeriod); _FinalStage metricPeriod(UpdatePlanEntitlementRequestBodyMetricPeriod metricPeriod); @@ -484,6 +500,8 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional metricPeriod = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional currency = Optional.empty(); private Optional creditConsumptionRate = Optional.empty(); @@ -503,6 +521,7 @@ public Builder from(UpdatePlanEntitlementRequestBody other) { billingThreshold(other.getBillingThreshold()); creditConsumptionRate(other.getCreditConsumptionRate()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); metricPeriod(other.getMetricPeriod()); metricPeriodMonthReset(other.getMetricPeriodMonthReset()); monthlyMeteredPriceId(other.getMonthlyMeteredPriceId()); @@ -789,6 +808,19 @@ public _FinalStage metricPeriod(Optional currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage currency(String currency) { this.currency = Optional.ofNullable(currency); @@ -848,6 +880,7 @@ public UpdatePlanEntitlementRequestBody build() { billingThreshold, creditConsumptionRate, currency, + currencyPrices, metricPeriod, metricPeriodMonthReset, monthlyMeteredPriceId, diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod.java new file mode 100644 index 0000000..da3cb3b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod { + public static final CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod CURRENT_DAY = + new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod ALL_TIME = + new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod CURRENT_WEEK = + new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod CURRENT_MONTH = + new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod(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 CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod + && this.string.equals( + ((CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CURRENT_DAY: + return visitor.visitCurrentDay(); + case ALL_TIME: + return visitor.visitAllTime(); + case CURRENT_WEEK: + return visitor.visitCurrentWeek(); + case CURRENT_MONTH: + return visitor.visitCurrentMonth(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod valueOf(String value) { + switch (value) { + case "current_day": + return CURRENT_DAY; + case "all_time": + return ALL_TIME; + case "current_week": + return CURRENT_WEEK; + case "current_month": + return CURRENT_MONTH; + default: + return new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_MONTH, + + CURRENT_WEEK, + + CURRENT_DAY, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitCurrentDay(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset.java new file mode 100644 index 0000000..91f877f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset.java @@ -0,0 +1,89 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset { + public static final CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset FIRST_OF_MONTH = + new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset( + Value.FIRST_OF_MONTH, "first_of_month"); + + public static final CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset BILLING_CYCLE = + new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset( + Value.BILLING_CYCLE, "billing_cycle"); + + private final Value value; + + private final String string; + + CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset(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 CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset + && this.string.equals( + ((CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FIRST_OF_MONTH: + return visitor.visitFirstOfMonth(); + case BILLING_CYCLE: + return visitor.visitBillingCycle(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_cycle": + return BILLING_CYCLE; + default: + return new CreateBillingLinkedPlanEntitlementRequestBodyMetricPeriodMonthReset(Value.UNKNOWN, value); + } + } + + public enum Value { + FIRST_OF_MONTH, + + BILLING_CYCLE, + + UNKNOWN + } + + public interface Visitor { + T visitFirstOfMonth(); + + T visitBillingCycle(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/UpsertPlanEntitlementForBillingProductResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/UpsertPlanEntitlementForBillingProductResponse.java new file mode 100644 index 0000000..4eb08fb --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/UpsertPlanEntitlementForBillingProductResponse.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.entitlements.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.PlanEntitlementResponseData; +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 = UpsertPlanEntitlementForBillingProductResponse.Builder.class) +public final class UpsertPlanEntitlementForBillingProductResponse { + private final PlanEntitlementResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpsertPlanEntitlementForBillingProductResponse( + PlanEntitlementResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanEntitlementResponseData 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 UpsertPlanEntitlementForBillingProductResponse + && equalTo((UpsertPlanEntitlementForBillingProductResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpsertPlanEntitlementForBillingProductResponse 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 PlanEntitlementResponseData data); + + Builder from(UpsertPlanEntitlementForBillingProductResponse other); + } + + public interface _FinalStage { + UpsertPlanEntitlementForBillingProductResponse 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 PlanEntitlementResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpsertPlanEntitlementForBillingProductResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanEntitlementResponseData 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 UpsertPlanEntitlementForBillingProductResponse build() { + return new UpsertPlanEntitlementForBillingProductResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java b/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java index cda5f18..fa6d88e 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java @@ -8,6 +8,7 @@ import com.schematic.api.resources.features.requests.CheckFlagsBulkRequestBody; import com.schematic.api.resources.features.requests.CountFeaturesRequest; import com.schematic.api.resources.features.requests.CountFlagsRequest; +import com.schematic.api.resources.features.requests.CreateBillingLinkedFeatureRequestBody; import com.schematic.api.resources.features.requests.CreateFeatureRequestBody; import com.schematic.api.resources.features.requests.ListFeaturesRequest; import com.schematic.api.resources.features.requests.ListFlagsRequest; @@ -29,6 +30,7 @@ import com.schematic.api.resources.features.types.UpdateFeatureResponse; import com.schematic.api.resources.features.types.UpdateFlagResponse; import com.schematic.api.resources.features.types.UpdateFlagRulesResponse; +import com.schematic.api.resources.features.types.UpsertFeatureForBillingProductResponse; import com.schematic.api.types.CheckFlagRequestBody; import com.schematic.api.types.CreateFlagRequestBody; import java.util.concurrent.CompletableFuture; @@ -109,6 +111,18 @@ public CompletableFuture deleteFeature(String featureId, return this.rawClient.deleteFeature(featureId, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request) { + return this.rawClient.upsertFeatureForBillingProduct(request).thenApply(response -> response.body()); + } + + public CompletableFuture upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .upsertFeatureForBillingProduct(request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture countFeatures() { return this.rawClient.countFeatures().thenApply(response -> response.body()); } 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 72865f9..780127f 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java @@ -20,6 +20,7 @@ import com.schematic.api.resources.features.requests.CheckFlagsBulkRequestBody; import com.schematic.api.resources.features.requests.CountFeaturesRequest; import com.schematic.api.resources.features.requests.CountFlagsRequest; +import com.schematic.api.resources.features.requests.CreateBillingLinkedFeatureRequestBody; import com.schematic.api.resources.features.requests.CreateFeatureRequestBody; import com.schematic.api.resources.features.requests.ListFeaturesRequest; import com.schematic.api.resources.features.requests.ListFlagsRequest; @@ -41,6 +42,7 @@ import com.schematic.api.resources.features.types.UpdateFeatureResponse; import com.schematic.api.resources.features.types.UpdateFlagResponse; import com.schematic.api.resources.features.types.UpdateFlagRulesResponse; +import com.schematic.api.resources.features.types.UpsertFeatureForBillingProductResponse; import com.schematic.api.types.ApiError; import com.schematic.api.types.CheckFlagRequestBody; import com.schematic.api.types.CreateFlagRequestBody; @@ -83,6 +85,17 @@ public CompletableFuture> listFe HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features"); + if (request.getBooleanRequireEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "boolean_require_event", + request.getBooleanRequireEvent().get(), + false); + } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -93,10 +106,6 @@ public CompletableFuture> listFe request.getWithoutCompanyOverrideFor().get(), false); } - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -104,13 +113,6 @@ public CompletableFuture> listFe request.getWithoutPlanEntitlementFor().get(), false); } - if (request.getBooleanRequireEvent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "boolean_require_event", - request.getBooleanRequireEvent().get(), - false); - } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -119,13 +121,13 @@ public CompletableFuture> listFe QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } if (request.getFeatureType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -562,6 +564,102 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> + upsertFeatureForBillingProduct(CreateBillingLinkedFeatureRequestBody request) { + return upsertFeatureForBillingProduct(request, null); + } + + public CompletableFuture> + upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("features/billing-linked"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpsertFeatureForBillingProductResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> countFeatures() { return countFeatures(CountFeaturesRequest.builder().build()); } @@ -581,6 +679,17 @@ public CompletableFuture> count HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features/count"); + if (request.getBooleanRequireEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "boolean_require_event", + request.getBooleanRequireEvent().get(), + false); + } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -591,10 +700,6 @@ public CompletableFuture> count request.getWithoutCompanyOverrideFor().get(), false); } - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -602,13 +707,6 @@ public CompletableFuture> count request.getWithoutPlanEntitlementFor().get(), false); } - if (request.getBooleanRequireEvent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "boolean_require_event", - request.getBooleanRequireEvent().get(), - false); - } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -617,13 +715,13 @@ public CompletableFuture> count QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } if (request.getFeatureType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/features/FeaturesClient.java b/src/main/java/com/schematic/api/resources/features/FeaturesClient.java index f9712db..d6a5912 100644 --- a/src/main/java/com/schematic/api/resources/features/FeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/FeaturesClient.java @@ -8,6 +8,7 @@ import com.schematic.api.resources.features.requests.CheckFlagsBulkRequestBody; import com.schematic.api.resources.features.requests.CountFeaturesRequest; import com.schematic.api.resources.features.requests.CountFlagsRequest; +import com.schematic.api.resources.features.requests.CreateBillingLinkedFeatureRequestBody; import com.schematic.api.resources.features.requests.CreateFeatureRequestBody; import com.schematic.api.resources.features.requests.ListFeaturesRequest; import com.schematic.api.resources.features.requests.ListFlagsRequest; @@ -29,6 +30,7 @@ import com.schematic.api.resources.features.types.UpdateFeatureResponse; import com.schematic.api.resources.features.types.UpdateFlagResponse; import com.schematic.api.resources.features.types.UpdateFlagRulesResponse; +import com.schematic.api.resources.features.types.UpsertFeatureForBillingProductResponse; import com.schematic.api.types.CheckFlagRequestBody; import com.schematic.api.types.CreateFlagRequestBody; @@ -106,6 +108,18 @@ public DeleteFeatureResponse deleteFeature(String featureId, RequestOptions requ return this.rawClient.deleteFeature(featureId, requestOptions).body(); } + public UpsertFeatureForBillingProductResponse upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request) { + return this.rawClient.upsertFeatureForBillingProduct(request).body(); + } + + public UpsertFeatureForBillingProductResponse upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .upsertFeatureForBillingProduct(request, requestOptions) + .body(); + } + public CountFeaturesResponse countFeatures() { return this.rawClient.countFeatures().body(); } 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 b03e901..913dce2 100644 --- a/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java @@ -20,6 +20,7 @@ import com.schematic.api.resources.features.requests.CheckFlagsBulkRequestBody; import com.schematic.api.resources.features.requests.CountFeaturesRequest; import com.schematic.api.resources.features.requests.CountFlagsRequest; +import com.schematic.api.resources.features.requests.CreateBillingLinkedFeatureRequestBody; import com.schematic.api.resources.features.requests.CreateFeatureRequestBody; import com.schematic.api.resources.features.requests.ListFeaturesRequest; import com.schematic.api.resources.features.requests.ListFlagsRequest; @@ -41,6 +42,7 @@ import com.schematic.api.resources.features.types.UpdateFeatureResponse; import com.schematic.api.resources.features.types.UpdateFlagResponse; import com.schematic.api.resources.features.types.UpdateFlagRulesResponse; +import com.schematic.api.resources.features.types.UpsertFeatureForBillingProductResponse; import com.schematic.api.types.ApiError; import com.schematic.api.types.CheckFlagRequestBody; import com.schematic.api.types.CreateFlagRequestBody; @@ -77,6 +79,17 @@ public BaseSchematicHttpResponse listFeatures( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features"); + if (request.getBooleanRequireEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "boolean_require_event", + request.getBooleanRequireEvent().get(), + false); + } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -87,10 +100,6 @@ public BaseSchematicHttpResponse listFeatures( request.getWithoutCompanyOverrideFor().get(), false); } - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -98,13 +107,6 @@ public BaseSchematicHttpResponse listFeatures( request.getWithoutPlanEntitlementFor().get(), false); } - if (request.getBooleanRequireEvent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "boolean_require_event", - request.getBooleanRequireEvent().get(), - false); - } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -113,13 +115,13 @@ public BaseSchematicHttpResponse listFeatures( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } if (request.getFeatureType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -436,6 +438,77 @@ public BaseSchematicHttpResponse deleteFeature( } } + public BaseSchematicHttpResponse upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request) { + return upsertFeatureForBillingProduct(request, null); + } + + public BaseSchematicHttpResponse upsertFeatureForBillingProduct( + CreateBillingLinkedFeatureRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("features/billing-linked"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpsertFeatureForBillingProductResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countFeatures() { return countFeatures(CountFeaturesRequest.builder().build()); } @@ -453,6 +526,17 @@ public BaseSchematicHttpResponse countFeatures( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features/count"); + if (request.getBooleanRequireEvent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "boolean_require_event", + request.getBooleanRequireEvent().get(), + false); + } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -463,10 +547,6 @@ public BaseSchematicHttpResponse countFeatures( request.getWithoutCompanyOverrideFor().get(), false); } - if (request.getPlanVersionId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); - } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -474,13 +554,6 @@ public BaseSchematicHttpResponse countFeatures( request.getWithoutPlanEntitlementFor().get(), false); } - if (request.getBooleanRequireEvent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "boolean_require_event", - request.getBooleanRequireEvent().get(), - false); - } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -489,13 +562,13 @@ public BaseSchematicHttpResponse countFeatures( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } if (request.getFeatureType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (request.getIds().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); diff --git a/src/main/java/com/schematic/api/resources/features/requests/CountFeaturesRequest.java b/src/main/java/com/schematic/api/resources/features/requests/CountFeaturesRequest.java index 7affe0e..ca5cc96 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/CountFeaturesRequest.java +++ b/src/main/java/com/schematic/api/resources/features/requests/CountFeaturesRequest.java @@ -23,20 +23,20 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountFeaturesRequest.Builder.class) public final class CountFeaturesRequest { + private final Optional> featureType; + private final Optional> ids; - private final Optional> featureType; + private final Optional booleanRequireEvent; + + private final Optional planVersionId; private final Optional q; private final Optional withoutCompanyOverrideFor; - private final Optional planVersionId; - private final Optional withoutPlanEntitlementFor; - private final Optional booleanRequireEvent; - private final Optional limit; private final Optional offset; @@ -44,39 +44,55 @@ public final class CountFeaturesRequest { private final Map additionalProperties; private CountFeaturesRequest( - Optional> ids, Optional> featureType, + Optional> ids, + Optional booleanRequireEvent, + Optional planVersionId, Optional q, Optional withoutCompanyOverrideFor, - Optional planVersionId, Optional withoutPlanEntitlementFor, - Optional booleanRequireEvent, Optional limit, Optional offset, Map additionalProperties) { - this.ids = ids; this.featureType = featureType; + this.ids = ids; + this.booleanRequireEvent = booleanRequireEvent; + this.planVersionId = planVersionId; this.q = q; this.withoutCompanyOverrideFor = withoutCompanyOverrideFor; - this.planVersionId = planVersionId; this.withoutPlanEntitlementFor = withoutPlanEntitlementFor; - this.booleanRequireEvent = booleanRequireEvent; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } + /** + * @return Filter by one or more feature types (boolean, event, trait) + */ + @JsonProperty("feature_type") + public Optional> getFeatureType() { + return featureType; + } + @JsonProperty("ids") public Optional> getIds() { return ids; } /** - * @return Filter by one or more feature types (boolean, event, trait) + * @return Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. */ - @JsonProperty("feature_type") - public Optional> getFeatureType() { - return featureType; + @JsonProperty("boolean_require_event") + public Optional getBooleanRequireEvent() { + return booleanRequireEvent; + } + + /** + * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; } /** @@ -95,14 +111,6 @@ public Optional getWithoutCompanyOverrideFor() { return withoutCompanyOverrideFor; } - /** - * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used - */ - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - /** * @return Filter out features that already have a plan entitlement for the specified plan ID */ @@ -111,14 +119,6 @@ public Optional getWithoutPlanEntitlementFor() { return withoutPlanEntitlementFor; } - /** - * @return Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. - */ - @JsonProperty("boolean_require_event") - public Optional getBooleanRequireEvent() { - return booleanRequireEvent; - } - /** * @return Page limit (default 100) */ @@ -147,13 +147,13 @@ public Map getAdditionalProperties() { } private boolean equalTo(CountFeaturesRequest other) { - return ids.equals(other.ids) - && featureType.equals(other.featureType) + return featureType.equals(other.featureType) + && ids.equals(other.ids) + && booleanRequireEvent.equals(other.booleanRequireEvent) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && withoutCompanyOverrideFor.equals(other.withoutCompanyOverrideFor) - && planVersionId.equals(other.planVersionId) && withoutPlanEntitlementFor.equals(other.withoutPlanEntitlementFor) - && booleanRequireEvent.equals(other.booleanRequireEvent) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -161,13 +161,13 @@ private boolean equalTo(CountFeaturesRequest other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.ids, this.featureType, + this.ids, + this.booleanRequireEvent, + this.planVersionId, this.q, this.withoutCompanyOverrideFor, - this.planVersionId, this.withoutPlanEntitlementFor, - this.booleanRequireEvent, this.limit, this.offset); } @@ -183,20 +183,20 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> featureType = Optional.empty(); + private Optional> ids = Optional.empty(); - private Optional> featureType = Optional.empty(); + private Optional booleanRequireEvent = Optional.empty(); + + private Optional planVersionId = Optional.empty(); private Optional q = Optional.empty(); private Optional withoutCompanyOverrideFor = Optional.empty(); - private Optional planVersionId = Optional.empty(); - private Optional withoutPlanEntitlementFor = Optional.empty(); - private Optional booleanRequireEvent = Optional.empty(); - private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -207,18 +207,37 @@ public static final class Builder { private Builder() {} public Builder from(CountFeaturesRequest other) { - ids(other.getIds()); featureType(other.getFeatureType()); + ids(other.getIds()); + booleanRequireEvent(other.getBooleanRequireEvent()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); withoutCompanyOverrideFor(other.getWithoutCompanyOverrideFor()); - planVersionId(other.getPlanVersionId()); withoutPlanEntitlementFor(other.getWithoutPlanEntitlementFor()); - booleanRequireEvent(other.getBooleanRequireEvent()); limit(other.getLimit()); offset(other.getOffset()); return this; } + /** + *

Filter by one or more feature types (boolean, event, trait)

+ */ + @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) + public Builder featureType(Optional> featureType) { + this.featureType = featureType; + return this; + } + + public Builder featureType(List featureType) { + this.featureType = Optional.ofNullable(featureType); + return this; + } + + public Builder featureType(FeatureType featureType) { + this.featureType = Optional.of(Collections.singletonList(featureType)); + return this; + } + @JsonSetter(value = "ids", nulls = Nulls.SKIP) public Builder ids(Optional> ids) { this.ids = ids; @@ -236,21 +255,30 @@ public Builder ids(String ids) { } /** - *

Filter by one or more feature types (boolean, event, trait)

+ *

Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.

*/ - @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional> featureType) { - this.featureType = featureType; + @JsonSetter(value = "boolean_require_event", nulls = Nulls.SKIP) + public Builder booleanRequireEvent(Optional booleanRequireEvent) { + this.booleanRequireEvent = booleanRequireEvent; return this; } - public Builder featureType(List featureType) { - this.featureType = Optional.ofNullable(featureType); + public Builder booleanRequireEvent(Boolean booleanRequireEvent) { + this.booleanRequireEvent = Optional.ofNullable(booleanRequireEvent); return this; } - public Builder featureType(FeatureType featureType) { - this.featureType = Optional.of(Collections.singletonList(featureType)); + /** + *

Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); return this; } @@ -282,20 +310,6 @@ public Builder withoutCompanyOverrideFor(String withoutCompanyOverrideFor) { return this; } - /** - *

Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used

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

Filter out features that already have a plan entitlement for the specified plan ID

*/ @@ -310,20 +324,6 @@ public Builder withoutPlanEntitlementFor(String withoutPlanEntitlementFor) { return this; } - /** - *

Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.

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

Page limit (default 100)

*/ @@ -354,13 +354,13 @@ public Builder offset(Long offset) { public CountFeaturesRequest build() { return new CountFeaturesRequest( - ids, featureType, + ids, + booleanRequireEvent, + planVersionId, q, withoutCompanyOverrideFor, - planVersionId, withoutPlanEntitlementFor, - booleanRequireEvent, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/features/requests/CreateBillingLinkedFeatureRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/CreateBillingLinkedFeatureRequestBody.java new file mode 100644 index 0000000..09394ba --- /dev/null +++ b/src/main/java/com/schematic/api/resources/features/requests/CreateBillingLinkedFeatureRequestBody.java @@ -0,0 +1,496 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.features.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.BillingProviderType; +import com.schematic.api.types.CreateOrUpdateFlagRequestBody; +import com.schematic.api.types.FeatureLifecyclePhase; +import com.schematic.api.types.FeatureType; +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 = CreateBillingLinkedFeatureRequestBody.Builder.class) +public final class CreateBillingLinkedFeatureRequestBody { + private final BillingProviderType billingProvider; + + private final String description; + + private final Optional eventSubtype; + + private final String externalResourceId; + + private final FeatureType featureType; + + private final Optional flag; + + private final Optional icon; + + private final Optional lifecyclePhase; + + private final Optional maintainerId; + + private final String name; + + private final Optional pluralName; + + private final Optional singularName; + + private final Optional traitId; + + private final Map additionalProperties; + + private CreateBillingLinkedFeatureRequestBody( + BillingProviderType billingProvider, + String description, + Optional eventSubtype, + String externalResourceId, + FeatureType featureType, + Optional flag, + Optional icon, + Optional lifecyclePhase, + Optional maintainerId, + String name, + Optional pluralName, + Optional singularName, + Optional traitId, + Map additionalProperties) { + this.billingProvider = billingProvider; + this.description = description; + this.eventSubtype = eventSubtype; + this.externalResourceId = externalResourceId; + this.featureType = featureType; + this.flag = flag; + this.icon = icon; + this.lifecyclePhase = lifecyclePhase; + this.maintainerId = maintainerId; + this.name = name; + this.pluralName = pluralName; + this.singularName = singularName; + this.traitId = traitId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_provider") + public BillingProviderType getBillingProvider() { + return billingProvider; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("external_resource_id") + public String getExternalResourceId() { + return externalResourceId; + } + + @JsonProperty("feature_type") + public FeatureType getFeatureType() { + return featureType; + } + + @JsonProperty("flag") + public Optional getFlag() { + return flag; + } + + @JsonProperty("icon") + public Optional getIcon() { + return icon; + } + + @JsonProperty("lifecycle_phase") + public Optional getLifecyclePhase() { + return lifecyclePhase; + } + + @JsonProperty("maintainer_id") + public Optional getMaintainerId() { + return maintainerId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("plural_name") + public Optional getPluralName() { + return pluralName; + } + + @JsonProperty("singular_name") + public Optional getSingularName() { + return singularName; + } + + @JsonProperty("trait_id") + public Optional getTraitId() { + return traitId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBillingLinkedFeatureRequestBody + && equalTo((CreateBillingLinkedFeatureRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBillingLinkedFeatureRequestBody other) { + return billingProvider.equals(other.billingProvider) + && description.equals(other.description) + && eventSubtype.equals(other.eventSubtype) + && externalResourceId.equals(other.externalResourceId) + && featureType.equals(other.featureType) + && flag.equals(other.flag) + && icon.equals(other.icon) + && lifecyclePhase.equals(other.lifecyclePhase) + && maintainerId.equals(other.maintainerId) + && name.equals(other.name) + && pluralName.equals(other.pluralName) + && singularName.equals(other.singularName) + && traitId.equals(other.traitId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingProvider, + this.description, + this.eventSubtype, + this.externalResourceId, + this.featureType, + this.flag, + this.icon, + this.lifecyclePhase, + this.maintainerId, + this.name, + this.pluralName, + this.singularName, + this.traitId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BillingProviderStage builder() { + return new Builder(); + } + + public interface BillingProviderStage { + DescriptionStage billingProvider(@NotNull BillingProviderType billingProvider); + + Builder from(CreateBillingLinkedFeatureRequestBody other); + } + + public interface DescriptionStage { + ExternalResourceIdStage description(@NotNull String description); + } + + public interface ExternalResourceIdStage { + FeatureTypeStage externalResourceId(@NotNull String externalResourceId); + } + + public interface FeatureTypeStage { + NameStage featureType(@NotNull FeatureType featureType); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreateBillingLinkedFeatureRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage eventSubtype(Optional eventSubtype); + + _FinalStage eventSubtype(String eventSubtype); + + _FinalStage flag(Optional flag); + + _FinalStage flag(CreateOrUpdateFlagRequestBody flag); + + _FinalStage icon(Optional icon); + + _FinalStage icon(String icon); + + _FinalStage lifecyclePhase(Optional lifecyclePhase); + + _FinalStage lifecyclePhase(FeatureLifecyclePhase lifecyclePhase); + + _FinalStage maintainerId(Optional maintainerId); + + _FinalStage maintainerId(String maintainerId); + + _FinalStage pluralName(Optional pluralName); + + _FinalStage pluralName(String pluralName); + + _FinalStage singularName(Optional singularName); + + _FinalStage singularName(String singularName); + + _FinalStage traitId(Optional traitId); + + _FinalStage traitId(String traitId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BillingProviderStage, + DescriptionStage, + ExternalResourceIdStage, + FeatureTypeStage, + NameStage, + _FinalStage { + private BillingProviderType billingProvider; + + private String description; + + private String externalResourceId; + + private FeatureType featureType; + + private String name; + + private Optional traitId = Optional.empty(); + + private Optional singularName = Optional.empty(); + + private Optional pluralName = Optional.empty(); + + private Optional maintainerId = Optional.empty(); + + private Optional lifecyclePhase = Optional.empty(); + + private Optional icon = Optional.empty(); + + private Optional flag = Optional.empty(); + + private Optional eventSubtype = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBillingLinkedFeatureRequestBody other) { + billingProvider(other.getBillingProvider()); + description(other.getDescription()); + eventSubtype(other.getEventSubtype()); + externalResourceId(other.getExternalResourceId()); + featureType(other.getFeatureType()); + flag(other.getFlag()); + icon(other.getIcon()); + lifecyclePhase(other.getLifecyclePhase()); + maintainerId(other.getMaintainerId()); + name(other.getName()); + pluralName(other.getPluralName()); + singularName(other.getSingularName()); + traitId(other.getTraitId()); + return this; + } + + @java.lang.Override + @JsonSetter("billing_provider") + public DescriptionStage billingProvider(@NotNull BillingProviderType billingProvider) { + this.billingProvider = Objects.requireNonNull(billingProvider, "billingProvider must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("description") + public ExternalResourceIdStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("external_resource_id") + public FeatureTypeStage externalResourceId(@NotNull String externalResourceId) { + this.externalResourceId = Objects.requireNonNull(externalResourceId, "externalResourceId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_type") + public NameStage featureType(@NotNull FeatureType featureType) { + this.featureType = Objects.requireNonNull(featureType, "featureType 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 traitId(String traitId) { + this.traitId = Optional.ofNullable(traitId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_id", nulls = Nulls.SKIP) + public _FinalStage traitId(Optional traitId) { + this.traitId = traitId; + return this; + } + + @java.lang.Override + public _FinalStage singularName(String singularName) { + this.singularName = Optional.ofNullable(singularName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "singular_name", nulls = Nulls.SKIP) + public _FinalStage singularName(Optional singularName) { + this.singularName = singularName; + return this; + } + + @java.lang.Override + public _FinalStage pluralName(String pluralName) { + this.pluralName = Optional.ofNullable(pluralName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plural_name", nulls = Nulls.SKIP) + public _FinalStage pluralName(Optional pluralName) { + this.pluralName = pluralName; + return this; + } + + @java.lang.Override + public _FinalStage maintainerId(String maintainerId) { + this.maintainerId = Optional.ofNullable(maintainerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maintainer_id", nulls = Nulls.SKIP) + public _FinalStage maintainerId(Optional maintainerId) { + this.maintainerId = maintainerId; + return this; + } + + @java.lang.Override + public _FinalStage lifecyclePhase(FeatureLifecyclePhase lifecyclePhase) { + this.lifecyclePhase = Optional.ofNullable(lifecyclePhase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "lifecycle_phase", nulls = Nulls.SKIP) + public _FinalStage lifecyclePhase(Optional lifecyclePhase) { + this.lifecyclePhase = lifecyclePhase; + return this; + } + + @java.lang.Override + public _FinalStage icon(String icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + @java.lang.Override + public _FinalStage flag(CreateOrUpdateFlagRequestBody flag) { + this.flag = Optional.ofNullable(flag); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flag", nulls = Nulls.SKIP) + public _FinalStage flag(Optional flag) { + this.flag = flag; + return this; + } + + @java.lang.Override + public _FinalStage eventSubtype(String eventSubtype) { + this.eventSubtype = Optional.ofNullable(eventSubtype); + return this; + } + + @java.lang.Override + @JsonSetter(value = "event_subtype", nulls = Nulls.SKIP) + public _FinalStage eventSubtype(Optional eventSubtype) { + this.eventSubtype = eventSubtype; + return this; + } + + @java.lang.Override + public CreateBillingLinkedFeatureRequestBody build() { + return new CreateBillingLinkedFeatureRequestBody( + billingProvider, + description, + eventSubtype, + externalResourceId, + featureType, + flag, + icon, + lifecyclePhase, + maintainerId, + name, + pluralName, + singularName, + traitId, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/features/requests/ListFeaturesRequest.java b/src/main/java/com/schematic/api/resources/features/requests/ListFeaturesRequest.java index 1532f60..4289e89 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/ListFeaturesRequest.java +++ b/src/main/java/com/schematic/api/resources/features/requests/ListFeaturesRequest.java @@ -23,20 +23,20 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListFeaturesRequest.Builder.class) public final class ListFeaturesRequest { + private final Optional> featureType; + private final Optional> ids; - private final Optional> featureType; + private final Optional booleanRequireEvent; + + private final Optional planVersionId; private final Optional q; private final Optional withoutCompanyOverrideFor; - private final Optional planVersionId; - private final Optional withoutPlanEntitlementFor; - private final Optional booleanRequireEvent; - private final Optional limit; private final Optional offset; @@ -44,39 +44,55 @@ public final class ListFeaturesRequest { private final Map additionalProperties; private ListFeaturesRequest( - Optional> ids, Optional> featureType, + Optional> ids, + Optional booleanRequireEvent, + Optional planVersionId, Optional q, Optional withoutCompanyOverrideFor, - Optional planVersionId, Optional withoutPlanEntitlementFor, - Optional booleanRequireEvent, Optional limit, Optional offset, Map additionalProperties) { - this.ids = ids; this.featureType = featureType; + this.ids = ids; + this.booleanRequireEvent = booleanRequireEvent; + this.planVersionId = planVersionId; this.q = q; this.withoutCompanyOverrideFor = withoutCompanyOverrideFor; - this.planVersionId = planVersionId; this.withoutPlanEntitlementFor = withoutPlanEntitlementFor; - this.booleanRequireEvent = booleanRequireEvent; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } + /** + * @return Filter by one or more feature types (boolean, event, trait) + */ + @JsonProperty("feature_type") + public Optional> getFeatureType() { + return featureType; + } + @JsonProperty("ids") public Optional> getIds() { return ids; } /** - * @return Filter by one or more feature types (boolean, event, trait) + * @return Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. */ - @JsonProperty("feature_type") - public Optional> getFeatureType() { - return featureType; + @JsonProperty("boolean_require_event") + public Optional getBooleanRequireEvent() { + return booleanRequireEvent; + } + + /** + * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; } /** @@ -95,14 +111,6 @@ public Optional getWithoutCompanyOverrideFor() { return withoutCompanyOverrideFor; } - /** - * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used - */ - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - /** * @return Filter out features that already have a plan entitlement for the specified plan ID */ @@ -111,14 +119,6 @@ public Optional getWithoutPlanEntitlementFor() { return withoutPlanEntitlementFor; } - /** - * @return Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter. - */ - @JsonProperty("boolean_require_event") - public Optional getBooleanRequireEvent() { - return booleanRequireEvent; - } - /** * @return Page limit (default 100) */ @@ -147,13 +147,13 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListFeaturesRequest other) { - return ids.equals(other.ids) - && featureType.equals(other.featureType) + return featureType.equals(other.featureType) + && ids.equals(other.ids) + && booleanRequireEvent.equals(other.booleanRequireEvent) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && withoutCompanyOverrideFor.equals(other.withoutCompanyOverrideFor) - && planVersionId.equals(other.planVersionId) && withoutPlanEntitlementFor.equals(other.withoutPlanEntitlementFor) - && booleanRequireEvent.equals(other.booleanRequireEvent) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -161,13 +161,13 @@ private boolean equalTo(ListFeaturesRequest other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.ids, this.featureType, + this.ids, + this.booleanRequireEvent, + this.planVersionId, this.q, this.withoutCompanyOverrideFor, - this.planVersionId, this.withoutPlanEntitlementFor, - this.booleanRequireEvent, this.limit, this.offset); } @@ -183,20 +183,20 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> featureType = Optional.empty(); + private Optional> ids = Optional.empty(); - private Optional> featureType = Optional.empty(); + private Optional booleanRequireEvent = Optional.empty(); + + private Optional planVersionId = Optional.empty(); private Optional q = Optional.empty(); private Optional withoutCompanyOverrideFor = Optional.empty(); - private Optional planVersionId = Optional.empty(); - private Optional withoutPlanEntitlementFor = Optional.empty(); - private Optional booleanRequireEvent = Optional.empty(); - private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -207,18 +207,37 @@ public static final class Builder { private Builder() {} public Builder from(ListFeaturesRequest other) { - ids(other.getIds()); featureType(other.getFeatureType()); + ids(other.getIds()); + booleanRequireEvent(other.getBooleanRequireEvent()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); withoutCompanyOverrideFor(other.getWithoutCompanyOverrideFor()); - planVersionId(other.getPlanVersionId()); withoutPlanEntitlementFor(other.getWithoutPlanEntitlementFor()); - booleanRequireEvent(other.getBooleanRequireEvent()); limit(other.getLimit()); offset(other.getOffset()); return this; } + /** + *

Filter by one or more feature types (boolean, event, trait)

+ */ + @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) + public Builder featureType(Optional> featureType) { + this.featureType = featureType; + return this; + } + + public Builder featureType(List featureType) { + this.featureType = Optional.ofNullable(featureType); + return this; + } + + public Builder featureType(FeatureType featureType) { + this.featureType = Optional.of(Collections.singletonList(featureType)); + return this; + } + @JsonSetter(value = "ids", nulls = Nulls.SKIP) public Builder ids(Optional> ids) { this.ids = ids; @@ -236,21 +255,30 @@ public Builder ids(String ids) { } /** - *

Filter by one or more feature types (boolean, event, trait)

+ *

Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.

*/ - @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional> featureType) { - this.featureType = featureType; + @JsonSetter(value = "boolean_require_event", nulls = Nulls.SKIP) + public Builder booleanRequireEvent(Optional booleanRequireEvent) { + this.booleanRequireEvent = booleanRequireEvent; return this; } - public Builder featureType(List featureType) { - this.featureType = Optional.ofNullable(featureType); + public Builder booleanRequireEvent(Boolean booleanRequireEvent) { + this.booleanRequireEvent = Optional.ofNullable(booleanRequireEvent); return this; } - public Builder featureType(FeatureType featureType) { - this.featureType = Optional.of(Collections.singletonList(featureType)); + /** + *

Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used

+ */ + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public Builder planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + + public Builder planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); return this; } @@ -282,20 +310,6 @@ public Builder withoutCompanyOverrideFor(String withoutCompanyOverrideFor) { return this; } - /** - *

Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used

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

Filter out features that already have a plan entitlement for the specified plan ID

*/ @@ -310,20 +324,6 @@ public Builder withoutPlanEntitlementFor(String withoutPlanEntitlementFor) { return this; } - /** - *

Only return boolean features if there is an associated event. Automatically includes boolean in the feature types filter.

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

Page limit (default 100)

*/ @@ -354,13 +354,13 @@ public Builder offset(Long offset) { public ListFeaturesRequest build() { return new ListFeaturesRequest( - ids, featureType, + ids, + booleanRequireEvent, + planVersionId, q, withoutCompanyOverrideFor, - planVersionId, withoutPlanEntitlementFor, - booleanRequireEvent, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/features/types/UpsertFeatureForBillingProductResponse.java b/src/main/java/com/schematic/api/resources/features/types/UpsertFeatureForBillingProductResponse.java new file mode 100644 index 0000000..a290a9f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/features/types/UpsertFeatureForBillingProductResponse.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.features.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.FeatureDetailResponseData; +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 = UpsertFeatureForBillingProductResponse.Builder.class) +public final class UpsertFeatureForBillingProductResponse { + private final FeatureDetailResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpsertFeatureForBillingProductResponse( + FeatureDetailResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public FeatureDetailResponseData 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 UpsertFeatureForBillingProductResponse + && equalTo((UpsertFeatureForBillingProductResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpsertFeatureForBillingProductResponse 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 FeatureDetailResponseData data); + + Builder from(UpsertFeatureForBillingProductResponse other); + } + + public interface _FinalStage { + UpsertFeatureForBillingProductResponse 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 FeatureDetailResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpsertFeatureForBillingProductResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull FeatureDetailResponseData 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 UpsertFeatureForBillingProductResponse build() { + return new UpsertFeatureForBillingProductResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java new file mode 100644 index 0000000..bb4340e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncIntegrationsapiClient.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncIntegrationsapiClient { + protected final ClientOptions clientOptions; + + private final AsyncRawIntegrationsapiClient rawClient; + + public AsyncIntegrationsapiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawIntegrationsapiClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawIntegrationsapiClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture getIntegrationWebhookUrl(String type) { + return this.rawClient.getIntegrationWebhookUrl(type).thenApply(response -> response.body()); + } + + public CompletableFuture getIntegrationWebhookUrl( + String type, RequestOptions requestOptions) { + return this.rawClient.getIntegrationWebhookUrl(type, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java new file mode 100644 index 0000000..0514a9f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/AsyncRawIntegrationsapiClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.schematic.api.core.BaseSchematicApiException; +import com.schematic.api.core.BaseSchematicException; +import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.errors.ForbiddenError; +import com.schematic.api.errors.InternalServerError; +import com.schematic.api.errors.NotFoundError; +import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawIntegrationsapiClient { + protected final ClientOptions clientOptions; + + public AsyncRawIntegrationsapiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> getIntegrationWebhookUrl( + String type) { + return getIntegrationWebhookUrl(type, null); + } + + public CompletableFuture> getIntegrationWebhookUrl( + String type, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations") + .addPathSegment(type) + .addPathSegments("webhook-url"); + 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); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetIntegrationWebhookUrlResponse.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 (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java new file mode 100644 index 0000000..dc32efd --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/IntegrationsapiClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; + +public class IntegrationsapiClient { + protected final ClientOptions clientOptions; + + private final RawIntegrationsapiClient rawClient; + + public IntegrationsapiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawIntegrationsapiClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawIntegrationsapiClient withRawResponse() { + return this.rawClient; + } + + public GetIntegrationWebhookUrlResponse getIntegrationWebhookUrl(String type) { + return this.rawClient.getIntegrationWebhookUrl(type).body(); + } + + public GetIntegrationWebhookUrlResponse getIntegrationWebhookUrl(String type, RequestOptions requestOptions) { + return this.rawClient.getIntegrationWebhookUrl(type, requestOptions).body(); + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java b/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java new file mode 100644 index 0000000..134025e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/RawIntegrationsapiClient.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.schematic.api.core.BaseSchematicApiException; +import com.schematic.api.core.BaseSchematicException; +import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.errors.ForbiddenError; +import com.schematic.api.errors.InternalServerError; +import com.schematic.api.errors.NotFoundError; +import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.integrationsapi.types.GetIntegrationWebhookUrlResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawIntegrationsapiClient { + protected final ClientOptions clientOptions; + + public RawIntegrationsapiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public BaseSchematicHttpResponse getIntegrationWebhookUrl(String type) { + return getIntegrationWebhookUrl(type, null); + } + + public BaseSchematicHttpResponse getIntegrationWebhookUrl( + String type, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("integrations") + .addPathSegment(type) + .addPathSegments("webhook-url"); + 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); + } + 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, GetIntegrationWebhookUrlResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/integrationsapi/types/GetIntegrationWebhookUrlResponse.java b/src/main/java/com/schematic/api/resources/integrationsapi/types/GetIntegrationWebhookUrlResponse.java new file mode 100644 index 0000000..fffcad3 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/integrationsapi/types/GetIntegrationWebhookUrlResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.integrationsapi.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.IntegrationWebhookUrlResponseData; +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 = GetIntegrationWebhookUrlResponse.Builder.class) +public final class GetIntegrationWebhookUrlResponse { + private final IntegrationWebhookUrlResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetIntegrationWebhookUrlResponse( + IntegrationWebhookUrlResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public IntegrationWebhookUrlResponseData 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 GetIntegrationWebhookUrlResponse && equalTo((GetIntegrationWebhookUrlResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetIntegrationWebhookUrlResponse 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 IntegrationWebhookUrlResponseData data); + + Builder from(GetIntegrationWebhookUrlResponse other); + } + + public interface _FinalStage { + GetIntegrationWebhookUrlResponse 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 IntegrationWebhookUrlResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetIntegrationWebhookUrlResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull IntegrationWebhookUrlResponseData 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 GetIntegrationWebhookUrlResponse build() { + return new GetIntegrationWebhookUrlResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java index 5698a40..edd42eb 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java @@ -5,24 +5,32 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.plans.requests.CountBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.CountPlansRequest; +import com.schematic.api.resources.plans.requests.CreateBillingLinkedPlanRequestBody; +import com.schematic.api.resources.plans.requests.CreateCustomPlanRequestBody; import com.schematic.api.resources.plans.requests.DeletePlanVersionRequest; import com.schematic.api.resources.plans.requests.GetPlanRequest; +import com.schematic.api.resources.plans.requests.ListBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; +import com.schematic.api.resources.plans.types.CountBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.CountPlansResponse; +import com.schematic.api.resources.plans.types.CreateCustomPlanResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; +import com.schematic.api.resources.plans.types.ListBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; +import com.schematic.api.resources.plans.types.UpsertPlanForBillingProductResponse; import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; @@ -57,6 +65,15 @@ public CompletableFuture updateCompanyPlans( .thenApply(response -> response.body()); } + public CompletableFuture createCustomPlan(CreateCustomPlanRequestBody request) { + return this.rawClient.createCustomPlan(request).thenApply(response -> response.body()); + } + + public CompletableFuture createCustomPlan( + CreateCustomPlanRequestBody request, RequestOptions requestOptions) { + return this.rawClient.createCustomPlan(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listPlans() { return this.rawClient.listPlans().thenApply(response -> response.body()); } @@ -128,6 +145,42 @@ public CompletableFuture upsertBillingProductP .thenApply(response -> response.body()); } + public CompletableFuture upsertPlanForBillingProduct( + CreateBillingLinkedPlanRequestBody request) { + return this.rawClient.upsertPlanForBillingProduct(request).thenApply(response -> response.body()); + } + + public CompletableFuture upsertPlanForBillingProduct( + CreateBillingLinkedPlanRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .upsertPlanForBillingProduct(request, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request) { + return this.rawClient.listBillingProductMatchCompanies(request).thenApply(response -> response.body()); + } + + public CompletableFuture listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient + .listBillingProductMatchCompanies(request, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request) { + return this.rawClient.countBillingProductMatchCompanies(request).thenApply(response -> response.body()); + } + + public CompletableFuture countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient + .countBillingProductMatchCompanies(request, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture countPlans() { return this.rawClient.countPlans().thenApply(response -> response.body()); } 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 a1db791..00e9356 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java @@ -17,24 +17,32 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.plans.requests.CountBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.CountPlansRequest; +import com.schematic.api.resources.plans.requests.CreateBillingLinkedPlanRequestBody; +import com.schematic.api.resources.plans.requests.CreateCustomPlanRequestBody; import com.schematic.api.resources.plans.requests.DeletePlanVersionRequest; import com.schematic.api.resources.plans.requests.GetPlanRequest; +import com.schematic.api.resources.plans.requests.ListBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; +import com.schematic.api.resources.plans.types.CountBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.CountPlansResponse; +import com.schematic.api.resources.plans.types.CreateCustomPlanResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; +import com.schematic.api.resources.plans.types.ListBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; +import com.schematic.api.resources.plans.types.UpsertPlanForBillingProductResponse; import com.schematic.api.types.ApiError; import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.UpdatePlanRequestBody; @@ -154,6 +162,99 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> createCustomPlan( + CreateCustomPlanRequestBody request) { + return createCustomPlan(request, null); + } + + public CompletableFuture> createCustomPlan( + CreateCustomPlanRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("custom-plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCustomPlanResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> listPlans() { return listPlans(ListPlansRequest.builder().build()); } @@ -208,6 +309,13 @@ public CompletableFuture> listPlans if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getScopedToCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "scoped_to_company_id", + request.getScopedToCompanyId().get(), + false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -770,6 +878,301 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> + upsertPlanForBillingProduct(CreateBillingLinkedPlanRequestBody request) { + return upsertPlanForBillingProduct(request, null); + } + + public CompletableFuture> + upsertPlanForBillingProduct(CreateBillingLinkedPlanRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/billing-linked"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpsertPlanForBillingProductResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> + listBillingProductMatchCompanies(ListBillingProductMatchCompaniesRequest request) { + return listBillingProductMatchCompanies(request, null); + } + + public CompletableFuture> + listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/billing-product-match-companies"); + QueryStringMapper.addQueryParameter(httpUrl, "plan_id", request.getPlanId(), false); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListBillingProductMatchCompaniesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> + countBillingProductMatchCompanies(CountBillingProductMatchCompaniesRequest request) { + return countBillingProductMatchCompanies(request, null); + } + + public CompletableFuture> + countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/billing-product-match-companies/count"); + QueryStringMapper.addQueryParameter(httpUrl, "plan_id", request.getPlanId(), false); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CountBillingProductMatchCompaniesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> countPlans() { return countPlans(CountPlansRequest.builder().build()); } @@ -824,6 +1227,13 @@ public CompletableFuture> countPla if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getScopedToCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "scoped_to_company_id", + request.getScopedToCompanyId().get(), + false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/plans/PlansClient.java b/src/main/java/com/schematic/api/resources/plans/PlansClient.java index c70e8ff..6592160 100644 --- a/src/main/java/com/schematic/api/resources/plans/PlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/PlansClient.java @@ -5,24 +5,32 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.plans.requests.CountBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.CountPlansRequest; +import com.schematic.api.resources.plans.requests.CreateBillingLinkedPlanRequestBody; +import com.schematic.api.resources.plans.requests.CreateCustomPlanRequestBody; import com.schematic.api.resources.plans.requests.DeletePlanVersionRequest; import com.schematic.api.resources.plans.requests.GetPlanRequest; +import com.schematic.api.resources.plans.requests.ListBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; +import com.schematic.api.resources.plans.types.CountBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.CountPlansResponse; +import com.schematic.api.resources.plans.types.CreateCustomPlanResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; +import com.schematic.api.resources.plans.types.ListBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; +import com.schematic.api.resources.plans.types.UpsertPlanForBillingProductResponse; import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.UpdatePlanRequestBody; import com.schematic.api.types.UpsertBillingProductRequestBody; @@ -55,6 +63,15 @@ public UpdateCompanyPlansResponse updateCompanyPlans( .body(); } + public CreateCustomPlanResponse createCustomPlan(CreateCustomPlanRequestBody request) { + return this.rawClient.createCustomPlan(request).body(); + } + + public CreateCustomPlanResponse createCustomPlan( + CreateCustomPlanRequestBody request, RequestOptions requestOptions) { + return this.rawClient.createCustomPlan(request, requestOptions).body(); + } + public ListPlansResponse listPlans() { return this.rawClient.listPlans().body(); } @@ -123,6 +140,41 @@ public UpsertBillingProductPlanResponse upsertBillingProductPlan( .body(); } + public UpsertPlanForBillingProductResponse upsertPlanForBillingProduct(CreateBillingLinkedPlanRequestBody request) { + return this.rawClient.upsertPlanForBillingProduct(request).body(); + } + + public UpsertPlanForBillingProductResponse upsertPlanForBillingProduct( + CreateBillingLinkedPlanRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .upsertPlanForBillingProduct(request, requestOptions) + .body(); + } + + public ListBillingProductMatchCompaniesResponse listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request) { + return this.rawClient.listBillingProductMatchCompanies(request).body(); + } + + public ListBillingProductMatchCompaniesResponse listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient + .listBillingProductMatchCompanies(request, requestOptions) + .body(); + } + + public CountBillingProductMatchCompaniesResponse countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request) { + return this.rawClient.countBillingProductMatchCompanies(request).body(); + } + + public CountBillingProductMatchCompaniesResponse countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + return this.rawClient + .countBillingProductMatchCompanies(request, requestOptions) + .body(); + } + public CountPlansResponse countPlans() { return this.rawClient.countPlans().body(); } 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 1c02840..e4557a5 100644 --- a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java @@ -17,24 +17,32 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.plans.requests.CountBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.CountPlansRequest; +import com.schematic.api.resources.plans.requests.CreateBillingLinkedPlanRequestBody; +import com.schematic.api.resources.plans.requests.CreateCustomPlanRequestBody; import com.schematic.api.resources.plans.requests.DeletePlanVersionRequest; import com.schematic.api.resources.plans.requests.GetPlanRequest; +import com.schematic.api.resources.plans.requests.ListBillingProductMatchCompaniesRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; +import com.schematic.api.resources.plans.types.CountBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.CountPlansResponse; +import com.schematic.api.resources.plans.types.CreateCustomPlanResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; +import com.schematic.api.resources.plans.types.ListBillingProductMatchCompaniesResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; +import com.schematic.api.resources.plans.types.UpsertPlanForBillingProductResponse; import com.schematic.api.types.ApiError; import com.schematic.api.types.CreatePlanRequestBody; import com.schematic.api.types.UpdatePlanRequestBody; @@ -126,6 +134,75 @@ public BaseSchematicHttpResponse updateCompanyPlans( } } + public BaseSchematicHttpResponse createCustomPlan(CreateCustomPlanRequestBody request) { + return createCustomPlan(request, null); + } + + public BaseSchematicHttpResponse createCustomPlan( + CreateCustomPlanRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("custom-plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCustomPlanResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse listPlans() { return listPlans(ListPlansRequest.builder().build()); } @@ -180,6 +257,13 @@ public BaseSchematicHttpResponse listPlans( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getScopedToCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "scoped_to_company_id", + request.getScopedToCompanyId().get(), + false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -595,6 +679,227 @@ public BaseSchematicHttpResponse upsertBilling } } + public BaseSchematicHttpResponse upsertPlanForBillingProduct( + CreateBillingLinkedPlanRequestBody request) { + return upsertPlanForBillingProduct(request, null); + } + + public BaseSchematicHttpResponse upsertPlanForBillingProduct( + CreateBillingLinkedPlanRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/billing-linked"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpsertPlanForBillingProductResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request) { + return listBillingProductMatchCompanies(request, null); + } + + public BaseSchematicHttpResponse listBillingProductMatchCompanies( + ListBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/billing-product-match-companies"); + QueryStringMapper.addQueryParameter(httpUrl, "plan_id", request.getPlanId(), false); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListBillingProductMatchCompaniesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request) { + return countBillingProductMatchCompanies(request, null); + } + + public BaseSchematicHttpResponse countBillingProductMatchCompanies( + CountBillingProductMatchCompaniesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/billing-product-match-companies/count"); + QueryStringMapper.addQueryParameter(httpUrl, "plan_id", request.getPlanId(), false); + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CountBillingProductMatchCompaniesResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countPlans() { return countPlans(CountPlansRequest.builder().build()); } @@ -649,6 +954,13 @@ public BaseSchematicHttpResponse countPlans( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getScopedToCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "scoped_to_company_id", + request.getScopedToCompanyId().get(), + false); + } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CountBillingProductMatchCompaniesRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/CountBillingProductMatchCompaniesRequest.java new file mode 100644 index 0000000..c6f6d5f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/CountBillingProductMatchCompaniesRequest.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.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 = CountBillingProductMatchCompaniesRequest.Builder.class) +public final class CountBillingProductMatchCompaniesRequest { + private final String planId; + + private final Optional q; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private CountBillingProductMatchCompaniesRequest( + String planId, + Optional q, + Optional limit, + Optional offset, + Map additionalProperties) { + this.planId = planId; + this.q = q; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + /** + * @return The plan ID to find billing product match companies for + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + /** + * @return Search for companies by name, keys or string traits + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountBillingProductMatchCompaniesRequest + && equalTo((CountBillingProductMatchCompaniesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountBillingProductMatchCompaniesRequest other) { + return planId.equals(other.planId) + && q.equals(other.q) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planId, this.q, this.limit, this.offset); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + /** + *

The plan ID to find billing product match companies for

+ */ + _FinalStage planId(@NotNull String planId); + + Builder from(CountBillingProductMatchCompaniesRequest other); + } + + public interface _FinalStage { + CountBillingProductMatchCompaniesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Search for companies by name, keys or string traits

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

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanIdStage, _FinalStage { + private String planId; + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountBillingProductMatchCompaniesRequest other) { + planId(other.getPlanId()); + q(other.getQ()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + /** + *

The plan ID to find billing product match companies for

+ *

The plan ID to find billing product match companies for

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

Page offset (default 0)

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

Page offset (default 0)

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

Page limit (default 100)

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

Page limit (default 100)

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

Search for companies by name, keys or string traits

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

Search for companies by name, keys or string traits

+ */ + @java.lang.Override + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public _FinalStage q(Optional q) { + this.q = q; + return this; + } + + @java.lang.Override + public CountBillingProductMatchCompaniesRequest build() { + return new CountBillingProductMatchCompaniesRequest(planId, q, limit, offset, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java index 7e1229e..95aa054 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java @@ -41,6 +41,8 @@ public final class CountPlansRequest { private final Optional q; + private final Optional scopedToCompanyId; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -61,6 +63,7 @@ private CountPlansRequest( Optional includeDraftVersions, Optional planType, Optional q, + Optional scopedToCompanyId, Optional withoutEntitlementFor, Optional withoutPaidProductId, Optional limit, @@ -75,6 +78,7 @@ private CountPlansRequest( this.includeDraftVersions = includeDraftVersions; this.planType = planType; this.q = q; + this.scopedToCompanyId = scopedToCompanyId; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; @@ -145,6 +149,14 @@ public Optional getQ() { return q; } + /** + * @return Filter plans scoped to a specific company (custom plans) + */ + @JsonProperty("scoped_to_company_id") + public Optional getScopedToCompanyId() { + return scopedToCompanyId; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -198,6 +210,7 @@ private boolean equalTo(CountPlansRequest other) { && includeDraftVersions.equals(other.includeDraftVersions) && planType.equals(other.planType) && q.equals(other.q) + && scopedToCompanyId.equals(other.scopedToCompanyId) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) @@ -216,6 +229,7 @@ public int hashCode() { this.includeDraftVersions, this.planType, this.q, + this.scopedToCompanyId, this.withoutEntitlementFor, this.withoutPaidProductId, this.limit, @@ -251,6 +265,8 @@ public static final class Builder { private Optional q = Optional.empty(); + private Optional scopedToCompanyId = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -274,6 +290,7 @@ public Builder from(CountPlansRequest other) { includeDraftVersions(other.getIncludeDraftVersions()); planType(other.getPlanType()); q(other.getQ()); + scopedToCompanyId(other.getScopedToCompanyId()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); @@ -403,6 +420,20 @@ public Builder q(String q) { return this; } + /** + *

Filter plans scoped to a specific company (custom plans)

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -470,6 +501,7 @@ public CountPlansRequest build() { includeDraftVersions, planType, q, + scopedToCompanyId, withoutEntitlementFor, withoutPaidProductId, limit, diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java new file mode 100644 index 0000000..abdda20 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/CreateBillingLinkedPlanRequestBody.java @@ -0,0 +1,260 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.PlanIcon; +import com.schematic.api.types.PlanType; +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 = CreateBillingLinkedPlanRequestBody.Builder.class) +public final class CreateBillingLinkedPlanRequestBody { + private final BillingProviderType billingProvider; + + private final String description; + + private final String externalResourceId; + + private final Optional icon; + + private final String name; + + private final PlanType planType; + + private final Map additionalProperties; + + private CreateBillingLinkedPlanRequestBody( + BillingProviderType billingProvider, + String description, + String externalResourceId, + Optional icon, + String name, + PlanType planType, + Map additionalProperties) { + this.billingProvider = billingProvider; + this.description = description; + this.externalResourceId = externalResourceId; + this.icon = icon; + this.name = name; + this.planType = planType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_provider") + public BillingProviderType getBillingProvider() { + return billingProvider; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("external_resource_id") + public String getExternalResourceId() { + return externalResourceId; + } + + @JsonProperty("icon") + public Optional getIcon() { + return icon; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("plan_type") + public PlanType getPlanType() { + return planType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBillingLinkedPlanRequestBody + && equalTo((CreateBillingLinkedPlanRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBillingLinkedPlanRequestBody other) { + return billingProvider.equals(other.billingProvider) + && description.equals(other.description) + && externalResourceId.equals(other.externalResourceId) + && icon.equals(other.icon) + && name.equals(other.name) + && planType.equals(other.planType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingProvider, this.description, this.externalResourceId, this.icon, this.name, this.planType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BillingProviderStage builder() { + return new Builder(); + } + + public interface BillingProviderStage { + DescriptionStage billingProvider(@NotNull BillingProviderType billingProvider); + + Builder from(CreateBillingLinkedPlanRequestBody other); + } + + public interface DescriptionStage { + ExternalResourceIdStage description(@NotNull String description); + } + + public interface ExternalResourceIdStage { + NameStage externalResourceId(@NotNull String externalResourceId); + } + + public interface NameStage { + PlanTypeStage name(@NotNull String name); + } + + public interface PlanTypeStage { + _FinalStage planType(@NotNull PlanType planType); + } + + public interface _FinalStage { + CreateBillingLinkedPlanRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage icon(Optional icon); + + _FinalStage icon(PlanIcon icon); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BillingProviderStage, + DescriptionStage, + ExternalResourceIdStage, + NameStage, + PlanTypeStage, + _FinalStage { + private BillingProviderType billingProvider; + + private String description; + + private String externalResourceId; + + private String name; + + private PlanType planType; + + private Optional icon = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBillingLinkedPlanRequestBody other) { + billingProvider(other.getBillingProvider()); + description(other.getDescription()); + externalResourceId(other.getExternalResourceId()); + icon(other.getIcon()); + name(other.getName()); + planType(other.getPlanType()); + return this; + } + + @java.lang.Override + @JsonSetter("billing_provider") + public DescriptionStage billingProvider(@NotNull BillingProviderType billingProvider) { + this.billingProvider = Objects.requireNonNull(billingProvider, "billingProvider must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("description") + public ExternalResourceIdStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("external_resource_id") + public NameStage externalResourceId(@NotNull String externalResourceId) { + this.externalResourceId = Objects.requireNonNull(externalResourceId, "externalResourceId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public PlanTypeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_type") + public _FinalStage planType(@NotNull PlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage icon(PlanIcon icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + @java.lang.Override + public CreateBillingLinkedPlanRequestBody build() { + return new CreateBillingLinkedPlanRequestBody( + billingProvider, description, externalResourceId, icon, name, planType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java new file mode 100644 index 0000000..78cfee7 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/CreateCustomPlanRequestBody.java @@ -0,0 +1,232 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanIcon; +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 = CreateCustomPlanRequestBody.Builder.class) +public final class CreateCustomPlanRequestBody { + private final String companyId; + + private final Optional copiedFromPlanId; + + private final String description; + + private final Optional icon; + + private final String name; + + private final Map additionalProperties; + + private CreateCustomPlanRequestBody( + String companyId, + Optional copiedFromPlanId, + String description, + Optional icon, + String name, + Map additionalProperties) { + this.companyId = companyId; + this.copiedFromPlanId = copiedFromPlanId; + this.description = description; + this.icon = icon; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("copied_from_plan_id") + public Optional getCopiedFromPlanId() { + return copiedFromPlanId; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("icon") + public Optional getIcon() { + return icon; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCustomPlanRequestBody && equalTo((CreateCustomPlanRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCustomPlanRequestBody other) { + return companyId.equals(other.companyId) + && copiedFromPlanId.equals(other.copiedFromPlanId) + && description.equals(other.description) + && icon.equals(other.icon) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.copiedFromPlanId, this.description, this.icon, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + DescriptionStage companyId(@NotNull String companyId); + + Builder from(CreateCustomPlanRequestBody other); + } + + public interface DescriptionStage { + NameStage description(@NotNull String description); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreateCustomPlanRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage copiedFromPlanId(Optional copiedFromPlanId); + + _FinalStage copiedFromPlanId(String copiedFromPlanId); + + _FinalStage icon(Optional icon); + + _FinalStage icon(PlanIcon icon); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, DescriptionStage, NameStage, _FinalStage { + private String companyId; + + private String description; + + private String name; + + private Optional icon = Optional.empty(); + + private Optional copiedFromPlanId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCustomPlanRequestBody other) { + companyId(other.getCompanyId()); + copiedFromPlanId(other.getCopiedFromPlanId()); + description(other.getDescription()); + icon(other.getIcon()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public DescriptionStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("description") + public NameStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description 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 icon(PlanIcon icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + @java.lang.Override + public _FinalStage copiedFromPlanId(String copiedFromPlanId) { + this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_from_plan_id", nulls = Nulls.SKIP) + public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { + this.copiedFromPlanId = copiedFromPlanId; + return this; + } + + @java.lang.Override + public CreateCustomPlanRequestBody build() { + return new CreateCustomPlanRequestBody( + companyId, copiedFromPlanId, description, icon, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListBillingProductMatchCompaniesRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListBillingProductMatchCompaniesRequest.java new file mode 100644 index 0000000..198bdf1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/ListBillingProductMatchCompaniesRequest.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.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 = ListBillingProductMatchCompaniesRequest.Builder.class) +public final class ListBillingProductMatchCompaniesRequest { + private final String planId; + + private final Optional q; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListBillingProductMatchCompaniesRequest( + String planId, + Optional q, + Optional limit, + Optional offset, + Map additionalProperties) { + this.planId = planId; + this.q = q; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + /** + * @return The plan ID to find billing product match companies for + */ + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + /** + * @return Search for companies by name, keys or string traits + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBillingProductMatchCompaniesRequest + && equalTo((ListBillingProductMatchCompaniesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBillingProductMatchCompaniesRequest other) { + return planId.equals(other.planId) + && q.equals(other.q) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planId, this.q, this.limit, this.offset); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + /** + *

The plan ID to find billing product match companies for

+ */ + _FinalStage planId(@NotNull String planId); + + Builder from(ListBillingProductMatchCompaniesRequest other); + } + + public interface _FinalStage { + ListBillingProductMatchCompaniesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Search for companies by name, keys or string traits

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

Page limit (default 100)

+ */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Long limit); + + /** + *

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PlanIdStage, _FinalStage { + private String planId; + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBillingProductMatchCompaniesRequest other) { + planId(other.getPlanId()); + q(other.getQ()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + /** + *

The plan ID to find billing product match companies for

+ *

The plan ID to find billing product match companies for

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

Page offset (default 0)

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

Page offset (default 0)

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

Page limit (default 100)

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

Page limit (default 100)

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

Search for companies by name, keys or string traits

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

Search for companies by name, keys or string traits

+ */ + @java.lang.Override + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public _FinalStage q(Optional q) { + this.q = q; + return this; + } + + @java.lang.Override + public ListBillingProductMatchCompaniesRequest build() { + return new ListBillingProductMatchCompaniesRequest(planId, q, limit, offset, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java index a2cf3d7..4659b6d 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java @@ -41,6 +41,8 @@ public final class ListPlansRequest { private final Optional q; + private final Optional scopedToCompanyId; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -61,6 +63,7 @@ private ListPlansRequest( Optional includeDraftVersions, Optional planType, Optional q, + Optional scopedToCompanyId, Optional withoutEntitlementFor, Optional withoutPaidProductId, Optional limit, @@ -75,6 +78,7 @@ private ListPlansRequest( this.includeDraftVersions = includeDraftVersions; this.planType = planType; this.q = q; + this.scopedToCompanyId = scopedToCompanyId; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; @@ -145,6 +149,14 @@ public Optional getQ() { return q; } + /** + * @return Filter plans scoped to a specific company (custom plans) + */ + @JsonProperty("scoped_to_company_id") + public Optional getScopedToCompanyId() { + return scopedToCompanyId; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -198,6 +210,7 @@ private boolean equalTo(ListPlansRequest other) { && includeDraftVersions.equals(other.includeDraftVersions) && planType.equals(other.planType) && q.equals(other.q) + && scopedToCompanyId.equals(other.scopedToCompanyId) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) @@ -216,6 +229,7 @@ public int hashCode() { this.includeDraftVersions, this.planType, this.q, + this.scopedToCompanyId, this.withoutEntitlementFor, this.withoutPaidProductId, this.limit, @@ -251,6 +265,8 @@ public static final class Builder { private Optional q = Optional.empty(); + private Optional scopedToCompanyId = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -274,6 +290,7 @@ public Builder from(ListPlansRequest other) { includeDraftVersions(other.getIncludeDraftVersions()); planType(other.getPlanType()); q(other.getQ()); + scopedToCompanyId(other.getScopedToCompanyId()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); @@ -403,6 +420,20 @@ public Builder q(String q) { return this; } + /** + *

Filter plans scoped to a specific company (custom plans)

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -470,6 +501,7 @@ public ListPlansRequest build() { includeDraftVersions, planType, q, + scopedToCompanyId, withoutEntitlementFor, withoutPaidProductId, limit, diff --git a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java index f3e62e1..6be8b1a 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java @@ -12,32 +12,66 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CustomPlanActivationStrategy; import com.schematic.api.types.PlanVersionMigrationStrategy; +import com.schematic.api.types.UpdatePayInAdvanceRequestBody; 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 = PublishPlanVersionRequestBody.Builder.class) public final class PublishPlanVersionRequestBody { + private final Optional activationStrategy; + + private final Optional customerEmail; + + private final Optional daysUntilDue; + private final List excludedCompanyIds; private final PlanVersionMigrationStrategy migrationStrategy; + private final List payInAdvance; + private final Map additionalProperties; private PublishPlanVersionRequestBody( + Optional activationStrategy, + Optional customerEmail, + Optional daysUntilDue, List excludedCompanyIds, PlanVersionMigrationStrategy migrationStrategy, + List payInAdvance, Map additionalProperties) { + this.activationStrategy = activationStrategy; + this.customerEmail = customerEmail; + this.daysUntilDue = daysUntilDue; this.excludedCompanyIds = excludedCompanyIds; this.migrationStrategy = migrationStrategy; + this.payInAdvance = payInAdvance; this.additionalProperties = additionalProperties; } + @JsonProperty("activation_strategy") + public Optional getActivationStrategy() { + return activationStrategy; + } + + @JsonProperty("customer_email") + public Optional getCustomerEmail() { + return customerEmail; + } + + @JsonProperty("days_until_due") + public Optional getDaysUntilDue() { + return daysUntilDue; + } + @JsonProperty("excluded_company_ids") public List getExcludedCompanyIds() { return excludedCompanyIds; @@ -48,6 +82,11 @@ public PlanVersionMigrationStrategy getMigrationStrategy() { return migrationStrategy; } + @JsonProperty("pay_in_advance") + public List getPayInAdvance() { + return payInAdvance; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -60,12 +99,23 @@ public Map getAdditionalProperties() { } private boolean equalTo(PublishPlanVersionRequestBody other) { - return excludedCompanyIds.equals(other.excludedCompanyIds) && migrationStrategy.equals(other.migrationStrategy); + return activationStrategy.equals(other.activationStrategy) + && customerEmail.equals(other.customerEmail) + && daysUntilDue.equals(other.daysUntilDue) + && excludedCompanyIds.equals(other.excludedCompanyIds) + && migrationStrategy.equals(other.migrationStrategy) + && payInAdvance.equals(other.payInAdvance); } @java.lang.Override public int hashCode() { - return Objects.hash(this.excludedCompanyIds, this.migrationStrategy); + return Objects.hash( + this.activationStrategy, + this.customerEmail, + this.daysUntilDue, + this.excludedCompanyIds, + this.migrationStrategy, + this.payInAdvance); } @java.lang.Override @@ -90,19 +140,45 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage activationStrategy(Optional activationStrategy); + + _FinalStage activationStrategy(CustomPlanActivationStrategy activationStrategy); + + _FinalStage customerEmail(Optional customerEmail); + + _FinalStage customerEmail(String customerEmail); + + _FinalStage daysUntilDue(Optional daysUntilDue); + + _FinalStage daysUntilDue(Long daysUntilDue); + _FinalStage excludedCompanyIds(List excludedCompanyIds); _FinalStage addExcludedCompanyIds(String excludedCompanyIds); _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds); + + _FinalStage payInAdvance(List payInAdvance); + + _FinalStage addPayInAdvance(UpdatePayInAdvanceRequestBody payInAdvance); + + _FinalStage addAllPayInAdvance(List payInAdvance); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements MigrationStrategyStage, _FinalStage { private PlanVersionMigrationStrategy migrationStrategy; + private List payInAdvance = new ArrayList<>(); + private List excludedCompanyIds = new ArrayList<>(); + private Optional daysUntilDue = Optional.empty(); + + private Optional customerEmail = Optional.empty(); + + private Optional activationStrategy = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -110,8 +186,12 @@ private Builder() {} @java.lang.Override public Builder from(PublishPlanVersionRequestBody other) { + activationStrategy(other.getActivationStrategy()); + customerEmail(other.getCustomerEmail()); + daysUntilDue(other.getDaysUntilDue()); excludedCompanyIds(other.getExcludedCompanyIds()); migrationStrategy(other.getMigrationStrategy()); + payInAdvance(other.getPayInAdvance()); return this; } @@ -122,6 +202,30 @@ public _FinalStage migrationStrategy(@NotNull PlanVersionMigrationStrategy migra return this; } + @java.lang.Override + public _FinalStage addAllPayInAdvance(List payInAdvance) { + if (payInAdvance != null) { + this.payInAdvance.addAll(payInAdvance); + } + return this; + } + + @java.lang.Override + public _FinalStage addPayInAdvance(UpdatePayInAdvanceRequestBody payInAdvance) { + this.payInAdvance.add(payInAdvance); + return this; + } + + @java.lang.Override + @JsonSetter(value = "pay_in_advance", nulls = Nulls.SKIP) + public _FinalStage payInAdvance(List payInAdvance) { + this.payInAdvance.clear(); + if (payInAdvance != null) { + this.payInAdvance.addAll(payInAdvance); + } + return this; + } + @java.lang.Override public _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds) { if (excludedCompanyIds != null) { @@ -146,9 +250,55 @@ public _FinalStage excludedCompanyIds(List excludedCompanyIds) { return this; } + @java.lang.Override + public _FinalStage daysUntilDue(Long daysUntilDue) { + this.daysUntilDue = Optional.ofNullable(daysUntilDue); + return this; + } + + @java.lang.Override + @JsonSetter(value = "days_until_due", nulls = Nulls.SKIP) + public _FinalStage daysUntilDue(Optional daysUntilDue) { + this.daysUntilDue = daysUntilDue; + return this; + } + + @java.lang.Override + public _FinalStage customerEmail(String customerEmail) { + this.customerEmail = Optional.ofNullable(customerEmail); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer_email", nulls = Nulls.SKIP) + public _FinalStage customerEmail(Optional customerEmail) { + this.customerEmail = customerEmail; + return this; + } + + @java.lang.Override + public _FinalStage activationStrategy(CustomPlanActivationStrategy activationStrategy) { + this.activationStrategy = Optional.ofNullable(activationStrategy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "activation_strategy", nulls = Nulls.SKIP) + public _FinalStage activationStrategy(Optional activationStrategy) { + this.activationStrategy = activationStrategy; + return this; + } + @java.lang.Override public PublishPlanVersionRequestBody build() { - return new PublishPlanVersionRequestBody(excludedCompanyIds, migrationStrategy, additionalProperties); + return new PublishPlanVersionRequestBody( + activationStrategy, + customerEmail, + daysUntilDue, + excludedCompanyIds, + migrationStrategy, + payInAdvance, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountBillingProductMatchCompaniesParams.java b/src/main/java/com/schematic/api/resources/plans/types/CountBillingProductMatchCompaniesParams.java new file mode 100644 index 0000000..5a17f2e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/CountBillingProductMatchCompaniesParams.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.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 = CountBillingProductMatchCompaniesParams.Builder.class) +public final class CountBillingProductMatchCompaniesParams { + private final Optional limit; + + private final Optional offset; + + private final Optional planId; + + private final Optional q; + + private final Map additionalProperties; + + private CountBillingProductMatchCompaniesParams( + Optional limit, + Optional offset, + Optional planId, + Optional q, + Map additionalProperties) { + this.limit = limit; + this.offset = offset; + this.planId = planId; + this.q = q; + this.additionalProperties = additionalProperties; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return The plan ID to find billing product match companies for + */ + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + /** + * @return Search for companies by name, keys or string traits + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountBillingProductMatchCompaniesParams + && equalTo((CountBillingProductMatchCompaniesParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountBillingProductMatchCompaniesParams other) { + return limit.equals(other.limit) + && offset.equals(other.offset) + && planId.equals(other.planId) + && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.limit, this.offset, this.planId, this.q); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountBillingProductMatchCompaniesParams other) { + limit(other.getLimit()); + offset(other.getOffset()); + planId(other.getPlanId()); + q(other.getQ()); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

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

The plan ID to find billing product match companies for

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

Search for companies by name, keys or string traits

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

Input parameters

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

Input parameters

+ *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull CountBillingProductMatchCompaniesParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public CountBillingProductMatchCompaniesResponse build() { + return new CountBillingProductMatchCompaniesResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java index 7ed35c4..fe4b811 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java @@ -44,6 +44,8 @@ public final class CountPlansParams { private final Optional q; + private final Optional scopedToCompanyId; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -62,6 +64,7 @@ private CountPlansParams( Optional offset, Optional planType, Optional q, + Optional scopedToCompanyId, Optional withoutEntitlementFor, Optional withoutPaidProductId, Map additionalProperties) { @@ -76,6 +79,7 @@ private CountPlansParams( this.offset = offset; this.planType = planType; this.q = q; + this.scopedToCompanyId = scopedToCompanyId; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.additionalProperties = additionalProperties; @@ -160,6 +164,14 @@ public Optional getQ() { return q; } + /** + * @return Filter plans scoped to a specific company (custom plans) + */ + @JsonProperty("scoped_to_company_id") + public Optional getScopedToCompanyId() { + return scopedToCompanyId; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -199,6 +211,7 @@ private boolean equalTo(CountPlansParams other) { && offset.equals(other.offset) && planType.equals(other.planType) && q.equals(other.q) + && scopedToCompanyId.equals(other.scopedToCompanyId) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId); } @@ -217,6 +230,7 @@ public int hashCode() { this.offset, this.planType, this.q, + this.scopedToCompanyId, this.withoutEntitlementFor, this.withoutPaidProductId); } @@ -254,6 +268,8 @@ public static final class Builder { private Optional q = Optional.empty(); + private Optional scopedToCompanyId = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -275,6 +291,7 @@ public Builder from(CountPlansParams other) { offset(other.getOffset()); planType(other.getPlanType()); q(other.getQ()); + scopedToCompanyId(other.getScopedToCompanyId()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); return this; @@ -425,6 +442,20 @@ public Builder q(String q) { return this; } + /** + *

Filter plans scoped to a specific company (custom plans)

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -466,6 +497,7 @@ public CountPlansParams build() { offset, planType, q, + scopedToCompanyId, withoutEntitlementFor, withoutPaidProductId, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/types/CreateCustomPlanResponse.java b/src/main/java/com/schematic/api/resources/plans/types/CreateCustomPlanResponse.java new file mode 100644 index 0000000..acf6969 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/CreateCustomPlanResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanDetailResponseData; +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 = CreateCustomPlanResponse.Builder.class) +public final class CreateCustomPlanResponse { + private final PlanDetailResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private CreateCustomPlanResponse( + PlanDetailResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanDetailResponseData 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 CreateCustomPlanResponse && equalTo((CreateCustomPlanResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCustomPlanResponse 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 PlanDetailResponseData data); + + Builder from(CreateCustomPlanResponse other); + } + + public interface _FinalStage { + CreateCustomPlanResponse 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 PlanDetailResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCustomPlanResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanDetailResponseData 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 CreateCustomPlanResponse build() { + return new CreateCustomPlanResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListBillingProductMatchCompaniesParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListBillingProductMatchCompaniesParams.java new file mode 100644 index 0000000..88c9803 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/ListBillingProductMatchCompaniesParams.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.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 = ListBillingProductMatchCompaniesParams.Builder.class) +public final class ListBillingProductMatchCompaniesParams { + private final Optional limit; + + private final Optional offset; + + private final Optional planId; + + private final Optional q; + + private final Map additionalProperties; + + private ListBillingProductMatchCompaniesParams( + Optional limit, + Optional offset, + Optional planId, + Optional q, + Map additionalProperties) { + this.limit = limit; + this.offset = offset; + this.planId = planId; + this.q = q; + this.additionalProperties = additionalProperties; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + /** + * @return The plan ID to find billing product match companies for + */ + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + /** + * @return Search for companies by name, keys or string traits + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBillingProductMatchCompaniesParams + && equalTo((ListBillingProductMatchCompaniesParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBillingProductMatchCompaniesParams other) { + return limit.equals(other.limit) + && offset.equals(other.offset) + && planId.equals(other.planId) + && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.limit, this.offset, this.planId, this.q); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional q = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBillingProductMatchCompaniesParams other) { + limit(other.getLimit()); + offset(other.getOffset()); + planId(other.getPlanId()); + q(other.getQ()); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

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

The plan ID to find billing product match companies for

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

Search for companies by name, keys or string traits

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

Input parameters

+ */ + _FinalStage params(@NotNull ListBillingProductMatchCompaniesParams params); + + Builder from(ListBillingProductMatchCompaniesResponse other); + } + + public interface _FinalStage { + ListBillingProductMatchCompaniesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage data(List data); + + _FinalStage addData(CompanyDetailResponseData data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ParamsStage, _FinalStage { + private ListBillingProductMatchCompaniesParams params; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListBillingProductMatchCompaniesResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + /** + *

Input parameters

+ *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull ListBillingProductMatchCompaniesParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public _FinalStage addData(CompanyDetailResponseData data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @java.lang.Override + public ListBillingProductMatchCompaniesResponse build() { + return new ListBillingProductMatchCompaniesResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java index 86ca235..8ac1af0 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java @@ -44,6 +44,8 @@ public final class ListPlansParams { private final Optional q; + private final Optional scopedToCompanyId; + private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; @@ -62,6 +64,7 @@ private ListPlansParams( Optional offset, Optional planType, Optional q, + Optional scopedToCompanyId, Optional withoutEntitlementFor, Optional withoutPaidProductId, Map additionalProperties) { @@ -76,6 +79,7 @@ private ListPlansParams( this.offset = offset; this.planType = planType; this.q = q; + this.scopedToCompanyId = scopedToCompanyId; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; this.additionalProperties = additionalProperties; @@ -160,6 +164,14 @@ public Optional getQ() { return q; } + /** + * @return Filter plans scoped to a specific company (custom plans) + */ + @JsonProperty("scoped_to_company_id") + public Optional getScopedToCompanyId() { + return scopedToCompanyId; + } + /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -199,6 +211,7 @@ private boolean equalTo(ListPlansParams other) { && offset.equals(other.offset) && planType.equals(other.planType) && q.equals(other.q) + && scopedToCompanyId.equals(other.scopedToCompanyId) && withoutEntitlementFor.equals(other.withoutEntitlementFor) && withoutPaidProductId.equals(other.withoutPaidProductId); } @@ -217,6 +230,7 @@ public int hashCode() { this.offset, this.planType, this.q, + this.scopedToCompanyId, this.withoutEntitlementFor, this.withoutPaidProductId); } @@ -254,6 +268,8 @@ public static final class Builder { private Optional q = Optional.empty(); + private Optional scopedToCompanyId = Optional.empty(); + private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); @@ -275,6 +291,7 @@ public Builder from(ListPlansParams other) { offset(other.getOffset()); planType(other.getPlanType()); q(other.getQ()); + scopedToCompanyId(other.getScopedToCompanyId()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); return this; @@ -425,6 +442,20 @@ public Builder q(String q) { return this; } + /** + *

Filter plans scoped to a specific company (custom plans)

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

Filter out plans that already have a plan entitlement for the specified feature ID

*/ @@ -466,6 +497,7 @@ public ListPlansParams build() { offset, planType, q, + scopedToCompanyId, withoutEntitlementFor, withoutPaidProductId, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/types/UpsertPlanForBillingProductResponse.java b/src/main/java/com/schematic/api/resources/plans/types/UpsertPlanForBillingProductResponse.java new file mode 100644 index 0000000..abf326e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/UpsertPlanForBillingProductResponse.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanDetailResponseData; +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 = UpsertPlanForBillingProductResponse.Builder.class) +public final class UpsertPlanForBillingProductResponse { + private final PlanDetailResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpsertPlanForBillingProductResponse( + PlanDetailResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanDetailResponseData 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 UpsertPlanForBillingProductResponse + && equalTo((UpsertPlanForBillingProductResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpsertPlanForBillingProductResponse 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 PlanDetailResponseData data); + + Builder from(UpsertPlanForBillingProductResponse other); + } + + public interface _FinalStage { + UpsertPlanForBillingProductResponse 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 PlanDetailResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpsertPlanForBillingProductResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanDetailResponseData 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 UpsertPlanForBillingProductResponse build() { + return new UpsertPlanForBillingProductResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/AccountMemberPermission.java b/src/main/java/com/schematic/api/types/AccountMemberPermission.java new file mode 100644 index 0000000..0b4658e --- /dev/null +++ b/src/main/java/com/schematic/api/types/AccountMemberPermission.java @@ -0,0 +1,229 @@ +/** + * 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 AccountMemberPermission { + public static final AccountMemberPermission COMPANY_USERS_EDIT = + new AccountMemberPermission(Value.COMPANY_USERS_EDIT, "company_users_edit"); + + public static final AccountMemberPermission PLAN_BILLING_EDIT = + new AccountMemberPermission(Value.PLAN_BILLING_EDIT, "plan_billing_edit"); + + public static final AccountMemberPermission WEBHOOKS_EDIT = + new AccountMemberPermission(Value.WEBHOOKS_EDIT, "webhooks_edit"); + + public static final AccountMemberPermission PLAN_ENTITLEMENTS_EDIT = + new AccountMemberPermission(Value.PLAN_ENTITLEMENTS_EDIT, "plan_entitlements_edit"); + + public static final AccountMemberPermission FEATURES_EDIT = + new AccountMemberPermission(Value.FEATURES_EDIT, "features_edit"); + + public static final AccountMemberPermission WEBHOOKS_REVEAL_SECRET = + new AccountMemberPermission(Value.WEBHOOKS_REVEAL_SECRET, "webhooks_reveal_secret"); + + public static final AccountMemberPermission FLAG_RULES_EDIT = + new AccountMemberPermission(Value.FLAG_RULES_EDIT, "flag_rules_edit"); + + public static final AccountMemberPermission PLAN_VERSIONS_EDIT = + new AccountMemberPermission(Value.PLAN_VERSIONS_EDIT, "plan_versions_edit"); + + public static final AccountMemberPermission FLAGS_EDIT = + new AccountMemberPermission(Value.FLAGS_EDIT, "flags_edit"); + + public static final AccountMemberPermission PLANS_EDIT = + new AccountMemberPermission(Value.PLANS_EDIT, "plans_edit"); + + public static final AccountMemberPermission BILLING_CREDITS_EDIT = + new AccountMemberPermission(Value.BILLING_CREDITS_EDIT, "billing_credits_edit"); + + public static final AccountMemberPermission DATA_EXPORTS_EDIT = + new AccountMemberPermission(Value.DATA_EXPORTS_EDIT, "data_exports_edit"); + + public static final AccountMemberPermission COMPANIES_EDIT = + new AccountMemberPermission(Value.COMPANIES_EDIT, "companies_edit"); + + public static final AccountMemberPermission COMPONENTS_EDIT = + new AccountMemberPermission(Value.COMPONENTS_EDIT, "components_edit"); + + public static final AccountMemberPermission OVERRIDES_EDIT = + new AccountMemberPermission(Value.OVERRIDES_EDIT, "overrides_edit"); + + private final Value value; + + private final String string; + + AccountMemberPermission(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 AccountMemberPermission + && this.string.equals(((AccountMemberPermission) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPANY_USERS_EDIT: + return visitor.visitCompanyUsersEdit(); + case PLAN_BILLING_EDIT: + return visitor.visitPlanBillingEdit(); + case WEBHOOKS_EDIT: + return visitor.visitWebhooksEdit(); + case PLAN_ENTITLEMENTS_EDIT: + return visitor.visitPlanEntitlementsEdit(); + case FEATURES_EDIT: + return visitor.visitFeaturesEdit(); + case WEBHOOKS_REVEAL_SECRET: + return visitor.visitWebhooksRevealSecret(); + case FLAG_RULES_EDIT: + return visitor.visitFlagRulesEdit(); + case PLAN_VERSIONS_EDIT: + return visitor.visitPlanVersionsEdit(); + case FLAGS_EDIT: + return visitor.visitFlagsEdit(); + case PLANS_EDIT: + return visitor.visitPlansEdit(); + case BILLING_CREDITS_EDIT: + return visitor.visitBillingCreditsEdit(); + case DATA_EXPORTS_EDIT: + return visitor.visitDataExportsEdit(); + case COMPANIES_EDIT: + return visitor.visitCompaniesEdit(); + case COMPONENTS_EDIT: + return visitor.visitComponentsEdit(); + case OVERRIDES_EDIT: + return visitor.visitOverridesEdit(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AccountMemberPermission valueOf(String value) { + switch (value) { + case "company_users_edit": + return COMPANY_USERS_EDIT; + case "plan_billing_edit": + return PLAN_BILLING_EDIT; + case "webhooks_edit": + return WEBHOOKS_EDIT; + case "plan_entitlements_edit": + return PLAN_ENTITLEMENTS_EDIT; + case "features_edit": + return FEATURES_EDIT; + case "webhooks_reveal_secret": + return WEBHOOKS_REVEAL_SECRET; + case "flag_rules_edit": + return FLAG_RULES_EDIT; + case "plan_versions_edit": + return PLAN_VERSIONS_EDIT; + case "flags_edit": + return FLAGS_EDIT; + case "plans_edit": + return PLANS_EDIT; + case "billing_credits_edit": + return BILLING_CREDITS_EDIT; + case "data_exports_edit": + return DATA_EXPORTS_EDIT; + case "companies_edit": + return COMPANIES_EDIT; + case "components_edit": + return COMPONENTS_EDIT; + case "overrides_edit": + return OVERRIDES_EDIT; + default: + return new AccountMemberPermission(Value.UNKNOWN, value); + } + } + + public enum Value { + BILLING_CREDITS_EDIT, + + COMPANIES_EDIT, + + COMPANY_USERS_EDIT, + + COMPONENTS_EDIT, + + DATA_EXPORTS_EDIT, + + FEATURES_EDIT, + + FLAG_RULES_EDIT, + + FLAGS_EDIT, + + OVERRIDES_EDIT, + + PLAN_BILLING_EDIT, + + PLAN_ENTITLEMENTS_EDIT, + + PLAN_VERSIONS_EDIT, + + PLANS_EDIT, + + WEBHOOKS_EDIT, + + WEBHOOKS_REVEAL_SECRET, + + UNKNOWN + } + + public interface Visitor { + T visitBillingCreditsEdit(); + + T visitCompaniesEdit(); + + T visitCompanyUsersEdit(); + + T visitComponentsEdit(); + + T visitDataExportsEdit(); + + T visitFeaturesEdit(); + + T visitFlagRulesEdit(); + + T visitFlagsEdit(); + + T visitOverridesEdit(); + + T visitPlanBillingEdit(); + + T visitPlanEntitlementsEdit(); + + T visitPlanVersionsEdit(); + + T visitPlansEdit(); + + T visitWebhooksEdit(); + + T visitWebhooksRevealSecret(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/AccountMemberResponseData.java b/src/main/java/com/schematic/api/types/AccountMemberResponseData.java new file mode 100644 index 0000000..41e14a3 --- /dev/null +++ b/src/main/java/com/schematic/api/types/AccountMemberResponseData.java @@ -0,0 +1,345 @@ +/** + * 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.LinkedHashMap; +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 = AccountMemberResponseData.Builder.class) +public final class AccountMemberResponseData { + private final OffsetDateTime createdAt; + + private final Optional email; + + private final String id; + + private final Optional imageUrl; + + private final Optional name; + + private final Map> permissions; + + private final Optional role; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private AccountMemberResponseData( + OffsetDateTime createdAt, + Optional email, + String id, + Optional imageUrl, + Optional name, + Map> permissions, + Optional role, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.createdAt = createdAt; + this.email = email; + this.id = id; + this.imageUrl = imageUrl; + this.name = name; + this.permissions = permissions; + this.role = role; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("image_url") + public Optional getImageUrl() { + return imageUrl; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("permissions") + public Map> getPermissions() { + return permissions; + } + + @JsonProperty("role") + public Optional getRole() { + return role; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountMemberResponseData && equalTo((AccountMemberResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountMemberResponseData other) { + return createdAt.equals(other.createdAt) + && email.equals(other.email) + && id.equals(other.id) + && imageUrl.equals(other.imageUrl) + && name.equals(other.name) + && permissions.equals(other.permissions) + && role.equals(other.role) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.email, + this.id, + this.imageUrl, + this.name, + this.permissions, + this.role, + 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(AccountMemberResponseData other); + } + + public interface IdStage { + UpdatedAtStage id(@NotNull String id); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + AccountMemberResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage email(Optional email); + + _FinalStage email(String email); + + _FinalStage imageUrl(Optional imageUrl); + + _FinalStage imageUrl(String imageUrl); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage permissions(Map> permissions); + + _FinalStage putAllPermissions(Map> permissions); + + _FinalStage permissions(String key, List value); + + _FinalStage role(Optional role); + + _FinalStage role(AccountMemberRole role); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CreatedAtStage, IdStage, UpdatedAtStage, _FinalStage { + private OffsetDateTime createdAt; + + private String id; + + private OffsetDateTime updatedAt; + + private Optional role = Optional.empty(); + + private Map> permissions = new LinkedHashMap<>(); + + private Optional name = Optional.empty(); + + private Optional imageUrl = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AccountMemberResponseData other) { + createdAt(other.getCreatedAt()); + email(other.getEmail()); + id(other.getId()); + imageUrl(other.getImageUrl()); + name(other.getName()); + permissions(other.getPermissions()); + role(other.getRole()); + 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 UpdatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id 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 role(AccountMemberRole role) { + this.role = Optional.ofNullable(role); + return this; + } + + @java.lang.Override + @JsonSetter(value = "role", nulls = Nulls.SKIP) + public _FinalStage role(Optional role) { + this.role = role; + return this; + } + + @java.lang.Override + public _FinalStage permissions(String key, List value) { + this.permissions.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllPermissions(Map> permissions) { + if (permissions != null) { + this.permissions.putAll(permissions); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "permissions", nulls = Nulls.SKIP) + public _FinalStage permissions(Map> permissions) { + this.permissions.clear(); + if (permissions != null) { + this.permissions.putAll(permissions); + } + return this; + } + + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage imageUrl(String imageUrl) { + this.imageUrl = Optional.ofNullable(imageUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "image_url", nulls = Nulls.SKIP) + public _FinalStage imageUrl(Optional imageUrl) { + this.imageUrl = imageUrl; + return this; + } + + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; + return this; + } + + @java.lang.Override + public AccountMemberResponseData build() { + return new AccountMemberResponseData( + createdAt, email, id, imageUrl, name, permissions, role, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanControlledByType.java b/src/main/java/com/schematic/api/types/AccountMemberRole.java similarity index 55% rename from src/main/java/com/schematic/api/types/PlanControlledByType.java rename to src/main/java/com/schematic/api/types/AccountMemberRole.java index 5fba738..d01365e 100644 --- a/src/main/java/com/schematic/api/types/PlanControlledByType.java +++ b/src/main/java/com/schematic/api/types/AccountMemberRole.java @@ -6,16 +6,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class PlanControlledByType { - public static final PlanControlledByType SCHEMATIC = new PlanControlledByType(Value.SCHEMATIC, "schematic"); +public final class AccountMemberRole { + public static final AccountMemberRole ADMIN = new AccountMemberRole(Value.ADMIN, "admin"); - public static final PlanControlledByType STRIPE = new PlanControlledByType(Value.STRIPE, "stripe"); + public static final AccountMemberRole MEMBER = new AccountMemberRole(Value.MEMBER, "member"); private final Value value; private final String string; - PlanControlledByType(Value value, String string) { + AccountMemberRole(Value value, String string) { this.value = value; this.string = string; } @@ -33,7 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof PlanControlledByType && this.string.equals(((PlanControlledByType) other).string)); + || (other instanceof AccountMemberRole && this.string.equals(((AccountMemberRole) other).string)); } @java.lang.Override @@ -43,10 +43,10 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case SCHEMATIC: - return visitor.visitSchematic(); - case STRIPE: - return visitor.visitStripe(); + case ADMIN: + return visitor.visitAdmin(); + case MEMBER: + return visitor.visitMember(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -54,29 +54,29 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static PlanControlledByType valueOf(String value) { + public static AccountMemberRole valueOf(String value) { switch (value) { - case "schematic": - return SCHEMATIC; - case "stripe": - return STRIPE; + case "admin": + return ADMIN; + case "member": + return MEMBER; default: - return new PlanControlledByType(Value.UNKNOWN, value); + return new AccountMemberRole(Value.UNKNOWN, value); } } public enum Value { - SCHEMATIC, + ADMIN, - STRIPE, + MEMBER, UNKNOWN } public interface Visitor { - T visitSchematic(); + T visitAdmin(); - T visitStripe(); + T visitMember(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java b/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java index b5d12a8..0dd230b 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java @@ -7,6 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class BillingCreditGrantReason { + public static final BillingCreditGrantReason ADJUSTMENT = + new BillingCreditGrantReason(Value.ADJUSTMENT, "adjustment"); + public static final BillingCreditGrantReason PURCHASED = new BillingCreditGrantReason(Value.PURCHASED, "purchased"); public static final BillingCreditGrantReason PLAN = new BillingCreditGrantReason(Value.PLAN, "plan"); @@ -49,6 +52,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case ADJUSTMENT: + return visitor.visitAdjustment(); case PURCHASED: return visitor.visitPurchased(); case PLAN: @@ -66,6 +71,8 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static BillingCreditGrantReason valueOf(String value) { switch (value) { + case "adjustment": + return ADJUSTMENT; case "purchased": return PURCHASED; case "plan": @@ -80,6 +87,8 @@ public static BillingCreditGrantReason valueOf(String value) { } public enum Value { + ADJUSTMENT, + BILLING_CREDIT_AUTO_TOPUP, FREE, @@ -92,6 +101,8 @@ public enum Value { } public interface Visitor { + T visitAdjustment(); + T visitBillingCreditAutoTopup(); T visitFree(); diff --git a/src/main/java/com/schematic/api/types/BillingLinkedResourceResponseData.java b/src/main/java/com/schematic/api/types/BillingLinkedResourceResponseData.java new file mode 100644 index 0000000..eb3544d --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingLinkedResourceResponseData.java @@ -0,0 +1,170 @@ +/** + * 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 = BillingLinkedResourceResponseData.Builder.class) +public final class BillingLinkedResourceResponseData { + private final BillingProviderType billingProvider; + + private final String externalResourceId; + + private final BillingProviderType originator; + + private final Map additionalProperties; + + private BillingLinkedResourceResponseData( + BillingProviderType billingProvider, + String externalResourceId, + BillingProviderType originator, + Map additionalProperties) { + this.billingProvider = billingProvider; + this.externalResourceId = externalResourceId; + this.originator = originator; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_provider") + public BillingProviderType getBillingProvider() { + return billingProvider; + } + + @JsonProperty("external_resource_id") + public String getExternalResourceId() { + return externalResourceId; + } + + @JsonProperty("originator") + public BillingProviderType getOriginator() { + return originator; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingLinkedResourceResponseData && equalTo((BillingLinkedResourceResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingLinkedResourceResponseData other) { + return billingProvider.equals(other.billingProvider) + && externalResourceId.equals(other.externalResourceId) + && originator.equals(other.originator); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.billingProvider, this.externalResourceId, this.originator); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BillingProviderStage builder() { + return new Builder(); + } + + public interface BillingProviderStage { + ExternalResourceIdStage billingProvider(@NotNull BillingProviderType billingProvider); + + Builder from(BillingLinkedResourceResponseData other); + } + + public interface ExternalResourceIdStage { + OriginatorStage externalResourceId(@NotNull String externalResourceId); + } + + public interface OriginatorStage { + _FinalStage originator(@NotNull BillingProviderType originator); + } + + public interface _FinalStage { + BillingLinkedResourceResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements BillingProviderStage, ExternalResourceIdStage, OriginatorStage, _FinalStage { + private BillingProviderType billingProvider; + + private String externalResourceId; + + private BillingProviderType originator; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingLinkedResourceResponseData other) { + billingProvider(other.getBillingProvider()); + externalResourceId(other.getExternalResourceId()); + originator(other.getOriginator()); + return this; + } + + @java.lang.Override + @JsonSetter("billing_provider") + public ExternalResourceIdStage billingProvider(@NotNull BillingProviderType billingProvider) { + this.billingProvider = Objects.requireNonNull(billingProvider, "billingProvider must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("external_resource_id") + public OriginatorStage externalResourceId(@NotNull String externalResourceId) { + this.externalResourceId = Objects.requireNonNull(externalResourceId, "externalResourceId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("originator") + public _FinalStage originator(@NotNull BillingProviderType originator) { + this.originator = Objects.requireNonNull(originator, "originator must not be null"); + return this; + } + + @java.lang.Override + public BillingLinkedResourceResponseData build() { + return new BillingLinkedResourceResponseData( + billingProvider, externalResourceId, originator, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index 2a4bfa3..c20b5be 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -34,6 +34,8 @@ public final class BillingPlanCreditGrantResponseData { private final Optional autoTopupExpiryUnitCount; + private final Optional autoTopupThresholdCredits; + private final Optional autoTopupThresholdPercent; private final OffsetDateTime createdAt; @@ -83,6 +85,7 @@ private BillingPlanCreditGrantResponseData( Optional autoTopupExpiryType, Optional autoTopupExpiryUnit, Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdCredits, Optional autoTopupThresholdPercent, OffsetDateTime createdAt, Optional credit, @@ -110,6 +113,7 @@ private BillingPlanCreditGrantResponseData( this.autoTopupExpiryType = autoTopupExpiryType; this.autoTopupExpiryUnit = autoTopupExpiryUnit; this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + this.autoTopupThresholdCredits = autoTopupThresholdCredits; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.createdAt = createdAt; this.credit = credit; @@ -163,6 +167,11 @@ public Optional getAutoTopupExpiryUnitCount() { return autoTopupExpiryUnitCount; } + @JsonProperty("auto_topup_threshold_credits") + public Optional getAutoTopupThresholdCredits() { + return autoTopupThresholdCredits; + } + @JsonProperty("auto_topup_threshold_percent") public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; @@ -294,6 +303,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && autoTopupExpiryType.equals(other.autoTopupExpiryType) && autoTopupExpiryUnit.equals(other.autoTopupExpiryUnit) && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) + && autoTopupThresholdCredits.equals(other.autoTopupThresholdCredits) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && createdAt.equals(other.createdAt) && credit.equals(other.credit) @@ -325,6 +335,7 @@ public int hashCode() { this.autoTopupExpiryType, this.autoTopupExpiryUnit, this.autoTopupExpiryUnitCount, + this.autoTopupThresholdCredits, this.autoTopupThresholdPercent, this.createdAt, this.credit, @@ -427,6 +438,10 @@ public interface _FinalStage { _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount); + _FinalStage autoTopupThresholdCredits(Optional autoTopupThresholdCredits); + + _FinalStage autoTopupThresholdCredits(Long autoTopupThresholdCredits); + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); @@ -536,6 +551,8 @@ public static final class Builder private Optional autoTopupThresholdPercent = Optional.empty(); + private Optional autoTopupThresholdCredits = Optional.empty(); + private Optional autoTopupExpiryUnitCount = Optional.empty(); private Optional autoTopupExpiryUnit = Optional.empty(); @@ -559,6 +576,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { autoTopupExpiryType(other.getAutoTopupExpiryType()); autoTopupExpiryUnit(other.getAutoTopupExpiryUnit()); autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); + autoTopupThresholdCredits(other.getAutoTopupThresholdCredits()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); createdAt(other.getCreatedAt()); credit(other.getCredit()); @@ -825,6 +843,19 @@ public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPe return this; } + @java.lang.Override + public _FinalStage autoTopupThresholdCredits(Long autoTopupThresholdCredits) { + this.autoTopupThresholdCredits = Optional.ofNullable(autoTopupThresholdCredits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_threshold_credits", nulls = Nulls.SKIP) + public _FinalStage autoTopupThresholdCredits(Optional autoTopupThresholdCredits) { + this.autoTopupThresholdCredits = autoTopupThresholdCredits; + return this; + } + @java.lang.Override public _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount) { this.autoTopupExpiryUnitCount = Optional.ofNullable(autoTopupExpiryUnitCount); @@ -899,6 +930,7 @@ public BillingPlanCreditGrantResponseData build() { autoTopupExpiryType, autoTopupExpiryUnit, autoTopupExpiryUnitCount, + autoTopupThresholdCredits, autoTopupThresholdPercent, createdAt, credit, diff --git a/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java index 52bb422..528e792 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java @@ -27,7 +27,7 @@ public final class BillingProductPlanResponseData { private final ChargeType chargeType; - private final PlanControlledByType controlledBy; + private final BillingProviderType controlledBy; private final String environmentId; @@ -49,7 +49,7 @@ private BillingProductPlanResponseData( String accountId, String billingProductId, ChargeType chargeType, - PlanControlledByType controlledBy, + BillingProviderType controlledBy, String environmentId, boolean isTrialable, Optional monthlyPriceId, @@ -88,7 +88,7 @@ public ChargeType getChargeType() { } @JsonProperty("controlled_by") - public PlanControlledByType getControlledBy() { + public BillingProviderType getControlledBy() { return controlledBy; } @@ -192,7 +192,7 @@ public interface ChargeTypeStage { } public interface ControlledByStage { - EnvironmentIdStage controlledBy(@NotNull PlanControlledByType controlledBy); + EnvironmentIdStage controlledBy(@NotNull BillingProviderType controlledBy); } public interface EnvironmentIdStage { @@ -247,7 +247,7 @@ public static final class Builder private ChargeType chargeType; - private PlanControlledByType controlledBy; + private BillingProviderType controlledBy; private String environmentId; @@ -307,7 +307,7 @@ public ControlledByStage chargeType(@NotNull ChargeType chargeType) { @java.lang.Override @JsonSetter("controlled_by") - public EnvironmentIdStage controlledBy(@NotNull PlanControlledByType controlledBy) { + public EnvironmentIdStage controlledBy(@NotNull BillingProviderType controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/BillingProviderType.java b/src/main/java/com/schematic/api/types/BillingProviderType.java index d70df06..37b44c4 100644 --- a/src/main/java/com/schematic/api/types/BillingProviderType.java +++ b/src/main/java/com/schematic/api/types/BillingProviderType.java @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class BillingProviderType { + public static final BillingProviderType ORB = new BillingProviderType(Value.ORB, "orb"); + public static final BillingProviderType SCHEMATIC = new BillingProviderType(Value.SCHEMATIC, "schematic"); public static final BillingProviderType STRIPE = new BillingProviderType(Value.STRIPE, "stripe"); @@ -43,6 +45,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case ORB: + return visitor.visitOrb(); case SCHEMATIC: return visitor.visitSchematic(); case STRIPE: @@ -56,6 +60,8 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static BillingProviderType valueOf(String value) { switch (value) { + case "orb": + return ORB; case "schematic": return SCHEMATIC; case "stripe": @@ -66,6 +72,8 @@ public static BillingProviderType valueOf(String value) { } public enum Value { + ORB, + SCHEMATIC, STRIPE, @@ -74,6 +82,8 @@ public enum Value { } public interface Visitor { + T visitOrb(); + T visitSchematic(); T visitStripe(); diff --git a/src/main/java/com/schematic/api/types/CheckoutSubscription.java b/src/main/java/com/schematic/api/types/CheckoutSubscription.java index 26b9294..e0b8120 100644 --- a/src/main/java/com/schematic/api/types/CheckoutSubscription.java +++ b/src/main/java/com/schematic/api/types/CheckoutSubscription.java @@ -49,6 +49,8 @@ public final class CheckoutSubscription { private final String interval; + private final Optional invoiceUrl; + private final Optional> metadata; private final long periodEnd; @@ -83,6 +85,7 @@ private CheckoutSubscription( Optional expiredAt, String id, String interval, + Optional invoiceUrl, Optional> metadata, long periodEnd, long periodStart, @@ -106,6 +109,7 @@ private CheckoutSubscription( this.expiredAt = expiredAt; this.id = id; this.interval = interval; + this.invoiceUrl = invoiceUrl; this.metadata = metadata; this.periodEnd = periodEnd; this.periodStart = periodStart; @@ -183,6 +187,11 @@ public String getInterval() { return interval; } + @JsonProperty("invoice_url") + public Optional getInvoiceUrl() { + return invoiceUrl; + } + @JsonProperty("metadata") public Optional> getMetadata() { return metadata; @@ -253,6 +262,7 @@ private boolean equalTo(CheckoutSubscription other) { && expiredAt.equals(other.expiredAt) && id.equals(other.id) && interval.equals(other.interval) + && invoiceUrl.equals(other.invoiceUrl) && metadata.equals(other.metadata) && periodEnd == other.periodEnd && periodStart == other.periodStart @@ -280,6 +290,7 @@ public int hashCode() { this.expiredAt, this.id, this.interval, + this.invoiceUrl, this.metadata, this.periodEnd, this.periodStart, @@ -385,6 +396,10 @@ public interface _FinalStage { _FinalStage expiredAt(OffsetDateTime expiredAt); + _FinalStage invoiceUrl(Optional invoiceUrl); + + _FinalStage invoiceUrl(String invoiceUrl); + _FinalStage metadata(Optional> metadata); _FinalStage metadata(Map metadata); @@ -443,6 +458,8 @@ public static final class Builder private Optional> metadata = Optional.empty(); + private Optional invoiceUrl = Optional.empty(); + private Optional expiredAt = Optional.empty(); private Optional defaultPaymentMethodId = Optional.empty(); @@ -477,6 +494,7 @@ public Builder from(CheckoutSubscription other) { expiredAt(other.getExpiredAt()); id(other.getId()); interval(other.getInterval()); + invoiceUrl(other.getInvoiceUrl()); metadata(other.getMetadata()); periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); @@ -613,6 +631,19 @@ public _FinalStage metadata(Optional> metadata) { return this; } + @java.lang.Override + public _FinalStage invoiceUrl(String invoiceUrl) { + this.invoiceUrl = Optional.ofNullable(invoiceUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "invoice_url", nulls = Nulls.SKIP) + public _FinalStage invoiceUrl(Optional invoiceUrl) { + this.invoiceUrl = invoiceUrl; + return this; + } + @java.lang.Override public _FinalStage expiredAt(OffsetDateTime expiredAt) { this.expiredAt = Optional.ofNullable(expiredAt); @@ -720,6 +751,7 @@ public CheckoutSubscription build() { expiredAt, id, interval, + invoiceUrl, metadata, periodEnd, periodStart, diff --git a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java index f40aec8..8e875cf 100644 --- a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java @@ -35,6 +35,8 @@ public final class CompanyDetailResponseData { private final OffsetDateTime createdAt; + private final List customPlanBillings; + private final Optional defaultPaymentMethod; private final List entitlements; @@ -79,6 +81,7 @@ private CompanyDetailResponseData( Optional billingSubscription, List billingSubscriptions, OffsetDateTime createdAt, + List customPlanBillings, Optional defaultPaymentMethod, List entitlements, List entityTraits, @@ -103,6 +106,7 @@ private CompanyDetailResponseData( this.billingSubscription = billingSubscription; this.billingSubscriptions = billingSubscriptions; this.createdAt = createdAt; + this.customPlanBillings = customPlanBillings; this.defaultPaymentMethod = defaultPaymentMethod; this.entitlements = entitlements; this.entityTraits = entityTraits; @@ -149,6 +153,11 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("custom_plan_billings") + public List getCustomPlanBillings() { + return customPlanBillings; + } + @JsonProperty("default_payment_method") public Optional getDefaultPaymentMethod() { return defaultPaymentMethod; @@ -259,6 +268,7 @@ private boolean equalTo(CompanyDetailResponseData other) { && billingSubscription.equals(other.billingSubscription) && billingSubscriptions.equals(other.billingSubscriptions) && createdAt.equals(other.createdAt) + && customPlanBillings.equals(other.customPlanBillings) && defaultPaymentMethod.equals(other.defaultPaymentMethod) && entitlements.equals(other.entitlements) && entityTraits.equals(other.entityTraits) @@ -287,6 +297,7 @@ public int hashCode() { this.billingSubscription, this.billingSubscriptions, this.createdAt, + this.customPlanBillings, this.defaultPaymentMethod, this.entitlements, this.entityTraits, @@ -369,6 +380,12 @@ public interface _FinalStage { _FinalStage addAllBillingSubscriptions(List billingSubscriptions); + _FinalStage customPlanBillings(List customPlanBillings); + + _FinalStage addCustomPlanBillings(CustomPlanBillingResponseData customPlanBillings); + + _FinalStage addAllCustomPlanBillings(List customPlanBillings); + _FinalStage defaultPaymentMethod(Optional defaultPaymentMethod); _FinalStage defaultPaymentMethod(PaymentMethodResponseData defaultPaymentMethod); @@ -486,6 +503,8 @@ public static final class Builder private Optional defaultPaymentMethod = Optional.empty(); + private List customPlanBillings = new ArrayList<>(); + private List billingSubscriptions = new ArrayList<>(); private Optional billingSubscription = Optional.empty(); @@ -506,6 +525,7 @@ public Builder from(CompanyDetailResponseData other) { billingSubscription(other.getBillingSubscription()); billingSubscriptions(other.getBillingSubscriptions()); createdAt(other.getCreatedAt()); + customPlanBillings(other.getCustomPlanBillings()); defaultPaymentMethod(other.getDefaultPaymentMethod()); entitlements(other.getEntitlements()); entityTraits(other.getEntityTraits()); @@ -822,6 +842,30 @@ public _FinalStage defaultPaymentMethod(Optional defa return this; } + @java.lang.Override + public _FinalStage addAllCustomPlanBillings(List customPlanBillings) { + if (customPlanBillings != null) { + this.customPlanBillings.addAll(customPlanBillings); + } + return this; + } + + @java.lang.Override + public _FinalStage addCustomPlanBillings(CustomPlanBillingResponseData customPlanBillings) { + this.customPlanBillings.add(customPlanBillings); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_billings", nulls = Nulls.SKIP) + public _FinalStage customPlanBillings(List customPlanBillings) { + this.customPlanBillings.clear(); + if (customPlanBillings != null) { + this.customPlanBillings.addAll(customPlanBillings); + } + return this; + } + @java.lang.Override public _FinalStage addAllBillingSubscriptions(List billingSubscriptions) { if (billingSubscriptions != null) { @@ -904,6 +948,7 @@ public CompanyDetailResponseData build() { billingSubscription, billingSubscriptions, createdAt, + customPlanBillings, defaultPaymentMethod, entitlements, entityTraits, diff --git a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java index 09a3f68..f77048b 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java @@ -28,6 +28,8 @@ public final class CompanyPlanDetailResponseData { private final Optional audienceType; + private final Optional billingLinkedResource; + private final Optional billingProduct; private final ChargeType chargeType; @@ -36,9 +38,15 @@ public final class CompanyPlanDetailResponseData { private final long companyCount; + private final Optional companyId; + + private final Optional companyName; + private final List compatiblePlanIds; - private final PlanControlledByType controlledBy; + private final String controlledBy; + + private final Optional copiedFromPlanId; private final OffsetDateTime createdAt; @@ -58,7 +66,7 @@ public final class CompanyPlanDetailResponseData { private final List features; - private final String icon; + private final PlanIcon icon; private final String id; @@ -99,12 +107,16 @@ public final class CompanyPlanDetailResponseData { private CompanyPlanDetailResponseData( Optional activeVersion, Optional audienceType, + Optional billingLinkedResource, Optional billingProduct, ChargeType chargeType, boolean companyCanTrial, long companyCount, + Optional companyId, + Optional companyName, List compatiblePlanIds, - PlanControlledByType controlledBy, + String controlledBy, + Optional copiedFromPlanId, OffsetDateTime createdAt, List currencyPrices, boolean current, @@ -114,7 +126,7 @@ private CompanyPlanDetailResponseData( Optional draftVersion, List entitlements, List features, - String icon, + PlanIcon icon, String id, List includedCreditGrants, Optional invalidReason, @@ -135,12 +147,16 @@ private CompanyPlanDetailResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.chargeType = chargeType; this.companyCanTrial = companyCanTrial; this.companyCount = companyCount; + this.companyId = companyId; + this.companyName = companyName; this.compatiblePlanIds = compatiblePlanIds; this.controlledBy = controlledBy; + this.copiedFromPlanId = copiedFromPlanId; this.createdAt = createdAt; this.currencyPrices = currencyPrices; this.current = current; @@ -181,6 +197,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("billing_product") public Optional getBillingProduct() { return billingProduct; @@ -201,16 +222,31 @@ public long getCompanyCount() { return companyCount; } + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("company_name") + public Optional getCompanyName() { + return companyName; + } + @JsonProperty("compatible_plan_ids") public List getCompatiblePlanIds() { return compatiblePlanIds; } @JsonProperty("controlled_by") - public PlanControlledByType getControlledBy() { + public String getControlledBy() { return controlledBy; } + @JsonProperty("copied_from_plan_id") + public Optional getCopiedFromPlanId() { + return copiedFromPlanId; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -257,7 +293,7 @@ public List getFeatures() { } @JsonProperty("icon") - public String getIcon() { + public PlanIcon getIcon() { return icon; } @@ -360,12 +396,16 @@ public Map getAdditionalProperties() { private boolean equalTo(CompanyPlanDetailResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCanTrial == other.companyCanTrial && companyCount == other.companyCount + && companyId.equals(other.companyId) + && companyName.equals(other.companyName) && compatiblePlanIds.equals(other.compatiblePlanIds) && controlledBy.equals(other.controlledBy) + && copiedFromPlanId.equals(other.copiedFromPlanId) && createdAt.equals(other.createdAt) && currencyPrices.equals(other.currencyPrices) && current == other.current @@ -400,12 +440,16 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.billingLinkedResource, this.billingProduct, this.chargeType, this.companyCanTrial, this.companyCount, + this.companyId, + this.companyName, this.compatiblePlanIds, this.controlledBy, + this.copiedFromPlanId, this.createdAt, this.currencyPrices, this.current, @@ -459,7 +503,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); + CreatedAtStage controlledBy(@NotNull String controlledBy); } public interface CreatedAtStage { @@ -479,7 +523,7 @@ public interface DescriptionStage { } public interface IconStage { - IdStage icon(@NotNull String icon); + IdStage icon(@NotNull PlanIcon icon); } public interface IdStage { @@ -533,16 +577,32 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage billingProduct(Optional billingProduct); _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyName(Optional companyName); + + _FinalStage companyName(String companyName); + _FinalStage compatiblePlanIds(List compatiblePlanIds); _FinalStage addCompatiblePlanIds(String compatiblePlanIds); _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage copiedFromPlanId(Optional copiedFromPlanId); + + _FinalStage copiedFromPlanId(String copiedFromPlanId); + _FinalStage currencyPrices(List currencyPrices); _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); @@ -635,7 +695,7 @@ public static final class Builder private long companyCount; - private PlanControlledByType controlledBy; + private String controlledBy; private OffsetDateTime createdAt; @@ -645,7 +705,7 @@ public static final class Builder private String description; - private String icon; + private PlanIcon icon; private String id; @@ -691,10 +751,18 @@ public static final class Builder private List currencyPrices = new ArrayList<>(); + private Optional copiedFromPlanId = Optional.empty(); + private List compatiblePlanIds = new ArrayList<>(); + private Optional companyName = Optional.empty(); + + private Optional companyId = Optional.empty(); + private Optional billingProduct = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -708,12 +776,16 @@ private Builder() {} public Builder from(CompanyPlanDetailResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); companyCanTrial(other.getCompanyCanTrial()); companyCount(other.getCompanyCount()); + companyId(other.getCompanyId()); + companyName(other.getCompanyName()); compatiblePlanIds(other.getCompatiblePlanIds()); controlledBy(other.getControlledBy()); + copiedFromPlanId(other.getCopiedFromPlanId()); createdAt(other.getCreatedAt()); currencyPrices(other.getCurrencyPrices()); current(other.getCurrent()); @@ -767,7 +839,7 @@ public ControlledByStage companyCount(long companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { + public CreatedAtStage controlledBy(@NotNull String controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -802,7 +874,7 @@ public IconStage description(@NotNull String description) { @java.lang.Override @JsonSetter("icon") - public IdStage icon(@NotNull String icon) { + public IdStage icon(@NotNull PlanIcon icon) { this.icon = Objects.requireNonNull(icon, "icon must not be null"); return this; } @@ -1105,6 +1177,19 @@ public _FinalStage currencyPrices(List currencyP return this; } + @java.lang.Override + public _FinalStage copiedFromPlanId(String copiedFromPlanId) { + this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_from_plan_id", nulls = Nulls.SKIP) + public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { + this.copiedFromPlanId = copiedFromPlanId; + return this; + } + @java.lang.Override public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { if (compatiblePlanIds != null) { @@ -1129,6 +1214,32 @@ public _FinalStage compatiblePlanIds(List compatiblePlanIds) { return this; } + @java.lang.Override + public _FinalStage companyName(String companyName) { + this.companyName = Optional.ofNullable(companyName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_name", nulls = Nulls.SKIP) + public _FinalStage companyName(Optional companyName) { + this.companyName = companyName; + return this; + } + + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -1142,6 +1253,19 @@ public _FinalStage billingProduct(Optional bil return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -1173,12 +1297,16 @@ public CompanyPlanDetailResponseData build() { return new CompanyPlanDetailResponseData( activeVersion, audienceType, + billingLinkedResource, billingProduct, chargeType, companyCanTrial, companyCount, + companyId, + companyName, compatiblePlanIds, controlledBy, + copiedFromPlanId, createdAt, currencyPrices, current, diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index 92deca8..3ff21ec 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -35,6 +35,8 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional autoTopupExpiryUnitCount; + private final Optional autoTopupThresholdCredits; + private final Optional autoTopupThresholdPercent; private final long creditAmount; @@ -67,6 +69,7 @@ private CreateBillingPlanCreditGrantRequestBody( Optional autoTopupExpiryType, Optional autoTopupExpiryUnit, Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdCredits, Optional autoTopupThresholdPercent, long creditAmount, String creditId, @@ -86,6 +89,7 @@ private CreateBillingPlanCreditGrantRequestBody( this.autoTopupExpiryType = autoTopupExpiryType; this.autoTopupExpiryUnit = autoTopupExpiryUnit; this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + this.autoTopupThresholdCredits = autoTopupThresholdCredits; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.creditAmount = creditAmount; this.creditId = creditId; @@ -135,6 +139,11 @@ public Optional getAutoTopupExpiryUnitCount() { return autoTopupExpiryUnitCount; } + @JsonProperty("auto_topup_threshold_credits") + public Optional getAutoTopupThresholdCredits() { + return autoTopupThresholdCredits; + } + @JsonProperty("auto_topup_threshold_percent") public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; @@ -210,6 +219,7 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { && autoTopupExpiryType.equals(other.autoTopupExpiryType) && autoTopupExpiryUnit.equals(other.autoTopupExpiryUnit) && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) + && autoTopupThresholdCredits.equals(other.autoTopupThresholdCredits) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && creditAmount == other.creditAmount && creditId.equals(other.creditId) @@ -233,6 +243,7 @@ public int hashCode() { this.autoTopupExpiryType, this.autoTopupExpiryUnit, this.autoTopupExpiryUnitCount, + this.autoTopupThresholdCredits, this.autoTopupThresholdPercent, this.creditAmount, this.creditId, @@ -312,6 +323,10 @@ public interface _FinalStage { _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount); + _FinalStage autoTopupThresholdCredits(Optional autoTopupThresholdCredits); + + _FinalStage autoTopupThresholdCredits(Long autoTopupThresholdCredits); + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); @@ -362,6 +377,8 @@ public static final class Builder private Optional autoTopupThresholdPercent = Optional.empty(); + private Optional autoTopupThresholdCredits = Optional.empty(); + private Optional autoTopupExpiryUnitCount = Optional.empty(); private Optional autoTopupExpiryUnit = Optional.empty(); @@ -390,6 +407,7 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { autoTopupExpiryType(other.getAutoTopupExpiryType()); autoTopupExpiryUnit(other.getAutoTopupExpiryUnit()); autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); + autoTopupThresholdCredits(other.getAutoTopupThresholdCredits()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); creditAmount(other.getCreditAmount()); creditId(other.getCreditId()); @@ -517,6 +535,19 @@ public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPe return this; } + @java.lang.Override + public _FinalStage autoTopupThresholdCredits(Long autoTopupThresholdCredits) { + this.autoTopupThresholdCredits = Optional.ofNullable(autoTopupThresholdCredits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_threshold_credits", nulls = Nulls.SKIP) + public _FinalStage autoTopupThresholdCredits(Optional autoTopupThresholdCredits) { + this.autoTopupThresholdCredits = autoTopupThresholdCredits; + return this; + } + @java.lang.Override public _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount) { this.autoTopupExpiryUnitCount = Optional.ofNullable(autoTopupExpiryUnitCount); @@ -618,6 +649,7 @@ public CreateBillingPlanCreditGrantRequestBody build() { autoTopupExpiryType, autoTopupExpiryUnit, autoTopupExpiryUnitCount, + autoTopupThresholdCredits, autoTopupThresholdPercent, creditAmount, creditId, diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java index b793a67..a55f8d3 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java @@ -30,6 +30,8 @@ public final class CreateEntitlementInBundleRequestBody { private final Optional currency; + private final Optional> currencyPrices; + private final String featureId; private final Optional metricPeriod; @@ -83,6 +85,7 @@ private CreateEntitlementInBundleRequestBody( Optional billingThreshold, Optional creditConsumptionRate, Optional currency, + Optional> currencyPrices, String featureId, Optional metricPeriod, Optional metricPeriodMonthReset, @@ -111,6 +114,7 @@ private CreateEntitlementInBundleRequestBody( this.billingThreshold = billingThreshold; this.creditConsumptionRate = creditConsumptionRate; this.currency = currency; + this.currencyPrices = currencyPrices; this.featureId = featureId; this.metricPeriod = metricPeriod; this.metricPeriodMonthReset = metricPeriodMonthReset; @@ -157,6 +161,11 @@ public Optional getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("feature_id") public String getFeatureId() { return featureId; @@ -292,6 +301,7 @@ private boolean equalTo(CreateEntitlementInBundleRequestBody other) { && billingThreshold.equals(other.billingThreshold) && creditConsumptionRate.equals(other.creditConsumptionRate) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && featureId.equals(other.featureId) && metricPeriod.equals(other.metricPeriod) && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) @@ -324,6 +334,7 @@ public int hashCode() { this.billingThreshold, this.creditConsumptionRate, this.currency, + this.currencyPrices, this.featureId, this.metricPeriod, this.metricPeriodMonthReset, @@ -395,6 +406,10 @@ public interface _FinalStage { _FinalStage currency(String currency); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage metricPeriod(Optional metricPeriod); _FinalStage metricPeriod(CreateEntitlementInBundleRequestBodyMetricPeriod metricPeriod); @@ -530,6 +545,8 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional metricPeriod = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional currency = Optional.empty(); private Optional creditConsumptionRate = Optional.empty(); @@ -549,6 +566,7 @@ public Builder from(CreateEntitlementInBundleRequestBody other) { billingThreshold(other.getBillingThreshold()); creditConsumptionRate(other.getCreditConsumptionRate()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); featureId(other.getFeatureId()); metricPeriod(other.getMetricPeriod()); metricPeriodMonthReset(other.getMetricPeriodMonthReset()); @@ -865,6 +883,19 @@ public _FinalStage metricPeriod(Optional currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage currency(String currency) { this.currency = Optional.ofNullable(currency); @@ -924,6 +955,7 @@ public CreateEntitlementInBundleRequestBody build() { billingThreshold, creditConsumptionRate, currency, + currencyPrices, featureId, metricPeriod, metricPeriodMonthReset, diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java index bfaddcb..6c595f5 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java @@ -16,6 +16,9 @@ public final class CreateOrUpdateConditionRequestBodyConditionType { public static final CreateOrUpdateConditionRequestBodyConditionType PLAN = new CreateOrUpdateConditionRequestBodyConditionType(Value.PLAN, "plan"); + public static final CreateOrUpdateConditionRequestBodyConditionType PLAN_VERSION = + new CreateOrUpdateConditionRequestBodyConditionType(Value.PLAN_VERSION, "plan_version"); + public static final CreateOrUpdateConditionRequestBodyConditionType TRAIT = new CreateOrUpdateConditionRequestBodyConditionType(Value.TRAIT, "trait"); @@ -67,6 +70,8 @@ public T visit(Visitor visitor) { return visitor.visitBasePlan(); case PLAN: return visitor.visitPlan(); + case PLAN_VERSION: + return visitor.visitPlanVersion(); case TRAIT: return visitor.visitTrait(); case BILLING_PRODUCT: @@ -90,6 +95,8 @@ public static CreateOrUpdateConditionRequestBodyConditionType valueOf(String val return BASE_PLAN; case "plan": return PLAN; + case "plan_version": + return PLAN_VERSION; case "trait": return TRAIT; case "billing_product": @@ -114,6 +121,8 @@ public enum Value { PLAN, + PLAN_VERSION, + BILLING_PRODUCT, BASE_PLAN, @@ -132,6 +141,8 @@ public interface Visitor { T visitPlan(); + T visitPlanVersion(); + T visitBillingProduct(); T visitBasePlan(); diff --git a/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java index e310446..132ad6f 100644 --- a/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java @@ -23,7 +23,7 @@ public final class CreatePlanRequestBody { private final String description; - private final Optional icon; + private final Optional icon; private final String name; @@ -33,7 +33,7 @@ public final class CreatePlanRequestBody { private CreatePlanRequestBody( String description, - Optional icon, + Optional icon, String name, PlanType planType, Map additionalProperties) { @@ -50,7 +50,7 @@ public String getDescription() { } @JsonProperty("icon") - public Optional getIcon() { + public Optional getIcon() { return icon; } @@ -117,9 +117,9 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); - _FinalStage icon(Optional icon); + _FinalStage icon(Optional icon); - _FinalStage icon(String icon); + _FinalStage icon(PlanIcon icon); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -130,7 +130,7 @@ public static final class Builder implements DescriptionStage, NameStage, PlanTy private PlanType planType; - private Optional icon = Optional.empty(); + private Optional icon = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -168,14 +168,14 @@ public _FinalStage planType(@NotNull PlanType planType) { } @java.lang.Override - public _FinalStage icon(String icon) { + public _FinalStage icon(PlanIcon icon) { this.icon = Optional.ofNullable(icon); return this; } @java.lang.Override @JsonSetter(value = "icon", nulls = Nulls.SKIP) - public _FinalStage icon(Optional icon) { + public _FinalStage icon(Optional icon) { this.icon = icon; return this; } diff --git a/src/main/java/com/schematic/api/types/CurrencyPriceRequestBody.java b/src/main/java/com/schematic/api/types/CurrencyPriceRequestBody.java new file mode 100644 index 0000000..f4438d8 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CurrencyPriceRequestBody.java @@ -0,0 +1,318 @@ +/** + * 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.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 = CurrencyPriceRequestBody.Builder.class) +public final class CurrencyPriceRequestBody { + private final String currency; + + private final Optional> monthlyPriceTiers; + + private final Optional monthlyUnitPrice; + + private final Optional monthlyUnitPriceDecimal; + + private final Optional> yearlyPriceTiers; + + private final Optional yearlyUnitPrice; + + private final Optional yearlyUnitPriceDecimal; + + private final Map additionalProperties; + + private CurrencyPriceRequestBody( + String currency, + Optional> monthlyPriceTiers, + Optional monthlyUnitPrice, + Optional monthlyUnitPriceDecimal, + Optional> yearlyPriceTiers, + Optional yearlyUnitPrice, + Optional yearlyUnitPriceDecimal, + Map additionalProperties) { + this.currency = currency; + this.monthlyPriceTiers = monthlyPriceTiers; + this.monthlyUnitPrice = monthlyUnitPrice; + this.monthlyUnitPriceDecimal = monthlyUnitPriceDecimal; + this.yearlyPriceTiers = yearlyPriceTiers; + this.yearlyUnitPrice = yearlyUnitPrice; + this.yearlyUnitPriceDecimal = yearlyUnitPriceDecimal; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("monthly_price_tiers") + public Optional> getMonthlyPriceTiers() { + return monthlyPriceTiers; + } + + @JsonProperty("monthly_unit_price") + public Optional getMonthlyUnitPrice() { + return monthlyUnitPrice; + } + + @JsonProperty("monthly_unit_price_decimal") + public Optional getMonthlyUnitPriceDecimal() { + return monthlyUnitPriceDecimal; + } + + @JsonProperty("yearly_price_tiers") + public Optional> getYearlyPriceTiers() { + return yearlyPriceTiers; + } + + @JsonProperty("yearly_unit_price") + public Optional getYearlyUnitPrice() { + return yearlyUnitPrice; + } + + @JsonProperty("yearly_unit_price_decimal") + public Optional getYearlyUnitPriceDecimal() { + return yearlyUnitPriceDecimal; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CurrencyPriceRequestBody && equalTo((CurrencyPriceRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CurrencyPriceRequestBody other) { + return currency.equals(other.currency) + && monthlyPriceTiers.equals(other.monthlyPriceTiers) + && monthlyUnitPrice.equals(other.monthlyUnitPrice) + && monthlyUnitPriceDecimal.equals(other.monthlyUnitPriceDecimal) + && yearlyPriceTiers.equals(other.yearlyPriceTiers) + && yearlyUnitPrice.equals(other.yearlyUnitPrice) + && yearlyUnitPriceDecimal.equals(other.yearlyUnitPriceDecimal); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.currency, + this.monthlyPriceTiers, + this.monthlyUnitPrice, + this.monthlyUnitPriceDecimal, + this.yearlyPriceTiers, + this.yearlyUnitPrice, + this.yearlyUnitPriceDecimal); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(CurrencyPriceRequestBody other); + } + + public interface _FinalStage { + CurrencyPriceRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage monthlyPriceTiers(Optional> monthlyPriceTiers); + + _FinalStage monthlyPriceTiers(List monthlyPriceTiers); + + _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); + + _FinalStage monthlyUnitPrice(Long monthlyUnitPrice); + + _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal); + + _FinalStage monthlyUnitPriceDecimal(String monthlyUnitPriceDecimal); + + _FinalStage yearlyPriceTiers(Optional> yearlyPriceTiers); + + _FinalStage yearlyPriceTiers(List yearlyPriceTiers); + + _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); + + _FinalStage yearlyUnitPrice(Long yearlyUnitPrice); + + _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal); + + _FinalStage yearlyUnitPriceDecimal(String yearlyUnitPriceDecimal); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional yearlyUnitPriceDecimal = Optional.empty(); + + private Optional yearlyUnitPrice = Optional.empty(); + + private Optional> yearlyPriceTiers = Optional.empty(); + + private Optional monthlyUnitPriceDecimal = Optional.empty(); + + private Optional monthlyUnitPrice = Optional.empty(); + + private Optional> monthlyPriceTiers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CurrencyPriceRequestBody other) { + currency(other.getCurrency()); + monthlyPriceTiers(other.getMonthlyPriceTiers()); + monthlyUnitPrice(other.getMonthlyUnitPrice()); + monthlyUnitPriceDecimal(other.getMonthlyUnitPriceDecimal()); + yearlyPriceTiers(other.getYearlyPriceTiers()); + yearlyUnitPrice(other.getYearlyUnitPrice()); + yearlyUnitPriceDecimal(other.getYearlyUnitPriceDecimal()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage yearlyUnitPriceDecimal(String yearlyUnitPriceDecimal) { + this.yearlyUnitPriceDecimal = Optional.ofNullable(yearlyUnitPriceDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_unit_price_decimal", nulls = Nulls.SKIP) + public _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal) { + this.yearlyUnitPriceDecimal = yearlyUnitPriceDecimal; + return this; + } + + @java.lang.Override + public _FinalStage yearlyUnitPrice(Long yearlyUnitPrice) { + this.yearlyUnitPrice = Optional.ofNullable(yearlyUnitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_unit_price", nulls = Nulls.SKIP) + public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { + this.yearlyUnitPrice = yearlyUnitPrice; + return this; + } + + @java.lang.Override + public _FinalStage yearlyPriceTiers(List yearlyPriceTiers) { + this.yearlyPriceTiers = Optional.ofNullable(yearlyPriceTiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price_tiers", nulls = Nulls.SKIP) + public _FinalStage yearlyPriceTiers(Optional> yearlyPriceTiers) { + this.yearlyPriceTiers = yearlyPriceTiers; + return this; + } + + @java.lang.Override + public _FinalStage monthlyUnitPriceDecimal(String monthlyUnitPriceDecimal) { + this.monthlyUnitPriceDecimal = Optional.ofNullable(monthlyUnitPriceDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_unit_price_decimal", nulls = Nulls.SKIP) + public _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal) { + this.monthlyUnitPriceDecimal = monthlyUnitPriceDecimal; + return this; + } + + @java.lang.Override + public _FinalStage monthlyUnitPrice(Long monthlyUnitPrice) { + this.monthlyUnitPrice = Optional.ofNullable(monthlyUnitPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_unit_price", nulls = Nulls.SKIP) + public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { + this.monthlyUnitPrice = monthlyUnitPrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPriceTiers(List monthlyPriceTiers) { + this.monthlyPriceTiers = Optional.ofNullable(monthlyPriceTiers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price_tiers", nulls = Nulls.SKIP) + public _FinalStage monthlyPriceTiers(Optional> monthlyPriceTiers) { + this.monthlyPriceTiers = monthlyPriceTiers; + return this; + } + + @java.lang.Override + public CurrencyPriceRequestBody build() { + return new CurrencyPriceRequestBody( + currency, + monthlyPriceTiers, + monthlyUnitPrice, + monthlyUnitPriceDecimal, + yearlyPriceTiers, + yearlyUnitPrice, + yearlyUnitPriceDecimal, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CustomPlanActivationStrategy.java b/src/main/java/com/schematic/api/types/CustomPlanActivationStrategy.java new file mode 100644 index 0000000..51c77fa --- /dev/null +++ b/src/main/java/com/schematic/api/types/CustomPlanActivationStrategy.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CustomPlanActivationStrategy { + public static final CustomPlanActivationStrategy ON_PAYMENT = + new CustomPlanActivationStrategy(Value.ON_PAYMENT, "on_payment"); + + public static final CustomPlanActivationStrategy ON_PUBLISH = + new CustomPlanActivationStrategy(Value.ON_PUBLISH, "on_publish"); + + private final Value value; + + private final String string; + + CustomPlanActivationStrategy(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 CustomPlanActivationStrategy + && this.string.equals(((CustomPlanActivationStrategy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ON_PAYMENT: + return visitor.visitOnPayment(); + case ON_PUBLISH: + return visitor.visitOnPublish(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CustomPlanActivationStrategy valueOf(String value) { + switch (value) { + case "on_payment": + return ON_PAYMENT; + case "on_publish": + return ON_PUBLISH; + default: + return new CustomPlanActivationStrategy(Value.UNKNOWN, value); + } + } + + public enum Value { + ON_PAYMENT, + + ON_PUBLISH, + + UNKNOWN + } + + public interface Visitor { + T visitOnPayment(); + + T visitOnPublish(); + + 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 new file mode 100644 index 0000000..82bd8f7 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingResponseData.java @@ -0,0 +1,413 @@ +/** + * 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 = CustomPlanBillingResponseData.Builder.class) +public final class CustomPlanBillingResponseData { + private final CustomPlanActivationStrategy activationStrategy; + + private final String companyId; + + private final OffsetDateTime createdAt; + + private final long daysUntilDue; + + private final String id; + + private final Optional paidAt; + + private final String planId; + + private final Optional publishedAt; + + private final CustomPlanBillingStatus status; + + private final Optional stripeInvoiceUrl; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CustomPlanBillingResponseData( + CustomPlanActivationStrategy activationStrategy, + String companyId, + OffsetDateTime createdAt, + long daysUntilDue, + String id, + Optional paidAt, + String planId, + Optional publishedAt, + CustomPlanBillingStatus status, + Optional stripeInvoiceUrl, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.activationStrategy = activationStrategy; + this.companyId = companyId; + this.createdAt = createdAt; + this.daysUntilDue = daysUntilDue; + this.id = id; + this.paidAt = paidAt; + this.planId = planId; + this.publishedAt = publishedAt; + this.status = status; + this.stripeInvoiceUrl = stripeInvoiceUrl; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("activation_strategy") + public CustomPlanActivationStrategy getActivationStrategy() { + return activationStrategy; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("days_until_due") + public long getDaysUntilDue() { + return daysUntilDue; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("paid_at") + public Optional getPaidAt() { + return paidAt; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonProperty("published_at") + public Optional getPublishedAt() { + return publishedAt; + } + + @JsonProperty("status") + public CustomPlanBillingStatus getStatus() { + return status; + } + + @JsonProperty("stripe_invoice_url") + public Optional getStripeInvoiceUrl() { + return stripeInvoiceUrl; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomPlanBillingResponseData && equalTo((CustomPlanBillingResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CustomPlanBillingResponseData other) { + return activationStrategy.equals(other.activationStrategy) + && companyId.equals(other.companyId) + && createdAt.equals(other.createdAt) + && daysUntilDue == other.daysUntilDue + && id.equals(other.id) + && paidAt.equals(other.paidAt) + && planId.equals(other.planId) + && publishedAt.equals(other.publishedAt) + && status.equals(other.status) + && stripeInvoiceUrl.equals(other.stripeInvoiceUrl) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.activationStrategy, + this.companyId, + this.createdAt, + this.daysUntilDue, + this.id, + this.paidAt, + this.planId, + this.publishedAt, + this.status, + this.stripeInvoiceUrl, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActivationStrategyStage builder() { + return new Builder(); + } + + public interface ActivationStrategyStage { + CompanyIdStage activationStrategy(@NotNull CustomPlanActivationStrategy activationStrategy); + + Builder from(CustomPlanBillingResponseData other); + } + + public interface CompanyIdStage { + CreatedAtStage companyId(@NotNull String companyId); + } + + public interface CreatedAtStage { + DaysUntilDueStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface DaysUntilDueStage { + IdStage daysUntilDue(long daysUntilDue); + } + + public interface IdStage { + PlanIdStage id(@NotNull String id); + } + + public interface PlanIdStage { + StatusStage planId(@NotNull String planId); + } + + public interface StatusStage { + UpdatedAtStage status(@NotNull CustomPlanBillingStatus status); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CustomPlanBillingResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage paidAt(Optional paidAt); + + _FinalStage paidAt(OffsetDateTime paidAt); + + _FinalStage publishedAt(Optional publishedAt); + + _FinalStage publishedAt(OffsetDateTime publishedAt); + + _FinalStage stripeInvoiceUrl(Optional stripeInvoiceUrl); + + _FinalStage stripeInvoiceUrl(String stripeInvoiceUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActivationStrategyStage, + CompanyIdStage, + CreatedAtStage, + DaysUntilDueStage, + IdStage, + PlanIdStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private CustomPlanActivationStrategy activationStrategy; + + private String companyId; + + private OffsetDateTime createdAt; + + private long daysUntilDue; + + private String id; + + private String planId; + + private CustomPlanBillingStatus status; + + private OffsetDateTime updatedAt; + + private Optional stripeInvoiceUrl = Optional.empty(); + + private Optional publishedAt = Optional.empty(); + + private Optional paidAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CustomPlanBillingResponseData other) { + activationStrategy(other.getActivationStrategy()); + companyId(other.getCompanyId()); + createdAt(other.getCreatedAt()); + daysUntilDue(other.getDaysUntilDue()); + id(other.getId()); + paidAt(other.getPaidAt()); + planId(other.getPlanId()); + publishedAt(other.getPublishedAt()); + status(other.getStatus()); + stripeInvoiceUrl(other.getStripeInvoiceUrl()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("activation_strategy") + public CompanyIdStage activationStrategy(@NotNull CustomPlanActivationStrategy activationStrategy) { + this.activationStrategy = Objects.requireNonNull(activationStrategy, "activationStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public CreatedAtStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DaysUntilDueStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("days_until_due") + public IdStage daysUntilDue(long daysUntilDue) { + this.daysUntilDue = daysUntilDue; + return this; + } + + @java.lang.Override + @JsonSetter("id") + public PlanIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public StatusStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull CustomPlanBillingStatus status) { + this.status = Objects.requireNonNull(status, "status 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 stripeInvoiceUrl(String stripeInvoiceUrl) { + this.stripeInvoiceUrl = Optional.ofNullable(stripeInvoiceUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripe_invoice_url", nulls = Nulls.SKIP) + public _FinalStage stripeInvoiceUrl(Optional stripeInvoiceUrl) { + this.stripeInvoiceUrl = stripeInvoiceUrl; + return this; + } + + @java.lang.Override + public _FinalStage publishedAt(OffsetDateTime publishedAt) { + this.publishedAt = Optional.ofNullable(publishedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "published_at", nulls = Nulls.SKIP) + public _FinalStage publishedAt(Optional publishedAt) { + this.publishedAt = publishedAt; + return this; + } + + @java.lang.Override + public _FinalStage paidAt(OffsetDateTime paidAt) { + this.paidAt = Optional.ofNullable(paidAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "paid_at", nulls = Nulls.SKIP) + public _FinalStage paidAt(Optional paidAt) { + this.paidAt = paidAt; + return this; + } + + @java.lang.Override + public CustomPlanBillingResponseData build() { + return new CustomPlanBillingResponseData( + activationStrategy, + companyId, + createdAt, + daysUntilDue, + id, + paidAt, + planId, + publishedAt, + status, + stripeInvoiceUrl, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CustomPlanBillingStatus.java b/src/main/java/com/schematic/api/types/CustomPlanBillingStatus.java new file mode 100644 index 0000000..acc0e24 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CustomPlanBillingStatus.java @@ -0,0 +1,104 @@ +/** + * 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 CustomPlanBillingStatus { + public static final CustomPlanBillingStatus PENDING = new CustomPlanBillingStatus(Value.PENDING, "pending"); + + public static final CustomPlanBillingStatus EXPIRED = new CustomPlanBillingStatus(Value.EXPIRED, "expired"); + + public static final CustomPlanBillingStatus PAID = new CustomPlanBillingStatus(Value.PAID, "paid"); + + public static final CustomPlanBillingStatus ACTIVE = new CustomPlanBillingStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + CustomPlanBillingStatus(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 CustomPlanBillingStatus + && this.string.equals(((CustomPlanBillingStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PENDING: + return visitor.visitPending(); + case EXPIRED: + return visitor.visitExpired(); + case PAID: + return visitor.visitPaid(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CustomPlanBillingStatus valueOf(String value) { + switch (value) { + case "pending": + return PENDING; + case "expired": + return EXPIRED; + case "paid": + return PAID; + case "active": + return ACTIVE; + default: + return new CustomPlanBillingStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + EXPIRED, + + PAID, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitExpired(); + + T visitPaid(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java b/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java index a3323cf..27f496c 100644 --- a/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java +++ b/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java @@ -28,13 +28,20 @@ public final class DatastreamCompanyPlan { private final Optional trialEndDate; + private final Optional trialStatus; + private final Map additionalProperties; private DatastreamCompanyPlan( - String id, String name, Optional trialEndDate, Map additionalProperties) { + String id, + String name, + Optional trialEndDate, + Optional trialStatus, + Map additionalProperties) { this.id = id; this.name = name; this.trialEndDate = trialEndDate; + this.trialStatus = trialStatus; this.additionalProperties = additionalProperties; } @@ -53,6 +60,11 @@ public Optional getTrialEndDate() { return trialEndDate; } + @JsonProperty("trial_status") + public Optional getTrialStatus() { + return trialStatus; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -65,12 +77,15 @@ public Map getAdditionalProperties() { } private boolean equalTo(DatastreamCompanyPlan other) { - return id.equals(other.id) && name.equals(other.name) && trialEndDate.equals(other.trialEndDate); + return id.equals(other.id) + && name.equals(other.name) + && trialEndDate.equals(other.trialEndDate) + && trialStatus.equals(other.trialStatus); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.name, this.trialEndDate); + return Objects.hash(this.id, this.name, this.trialEndDate, this.trialStatus); } @java.lang.Override @@ -102,6 +117,10 @@ public interface _FinalStage { _FinalStage trialEndDate(Optional trialEndDate); _FinalStage trialEndDate(OffsetDateTime trialEndDate); + + _FinalStage trialStatus(Optional trialStatus); + + _FinalStage trialStatus(TrialStatus trialStatus); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -110,6 +129,8 @@ public static final class Builder implements IdStage, NameStage, _FinalStage { private String name; + private Optional trialStatus = Optional.empty(); + private Optional trialEndDate = Optional.empty(); @JsonAnySetter @@ -122,6 +143,7 @@ public Builder from(DatastreamCompanyPlan other) { id(other.getId()); name(other.getName()); trialEndDate(other.getTrialEndDate()); + trialStatus(other.getTrialStatus()); return this; } @@ -139,6 +161,19 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage trialStatus(TrialStatus trialStatus) { + this.trialStatus = Optional.ofNullable(trialStatus); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trial_status", nulls = Nulls.SKIP) + public _FinalStage trialStatus(Optional trialStatus) { + this.trialStatus = trialStatus; + return this; + } + @java.lang.Override public _FinalStage trialEndDate(OffsetDateTime trialEndDate) { this.trialEndDate = Optional.ofNullable(trialEndDate); @@ -154,7 +189,7 @@ public _FinalStage trialEndDate(Optional trialEndDate) { @java.lang.Override public DatastreamCompanyPlan build() { - return new DatastreamCompanyPlan(id, name, trialEndDate, additionalProperties); + return new DatastreamCompanyPlan(id, name, trialEndDate, trialStatus, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java b/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java index ec302f7..a810be4 100644 --- a/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java @@ -24,6 +24,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = FeatureDetailResponseData.Builder.class) public final class FeatureDetailResponseData { + private final Optional billingLinkedResource; + private final OffsetDateTime createdAt; private final String description; @@ -61,6 +63,7 @@ public final class FeatureDetailResponseData { private final Map additionalProperties; private FeatureDetailResponseData( + Optional billingLinkedResource, OffsetDateTime createdAt, String description, Optional eventSubtype, @@ -79,6 +82,7 @@ private FeatureDetailResponseData( Optional traitId, OffsetDateTime updatedAt, Map additionalProperties) { + this.billingLinkedResource = billingLinkedResource; this.createdAt = createdAt; this.description = description; this.eventSubtype = eventSubtype; @@ -99,6 +103,11 @@ private FeatureDetailResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -196,7 +205,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(FeatureDetailResponseData other) { - return createdAt.equals(other.createdAt) + return billingLinkedResource.equals(other.billingLinkedResource) + && createdAt.equals(other.createdAt) && description.equals(other.description) && eventSubtype.equals(other.eventSubtype) && eventSummary.equals(other.eventSummary) @@ -218,6 +228,7 @@ private boolean equalTo(FeatureDetailResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.billingLinkedResource, this.createdAt, this.description, this.eventSubtype, @@ -283,6 +294,10 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage eventSubtype(Optional eventSubtype); _FinalStage eventSubtype(String eventSubtype); @@ -372,6 +387,8 @@ public static final class Builder private Optional eventSubtype = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -379,6 +396,7 @@ private Builder() {} @java.lang.Override public Builder from(FeatureDetailResponseData other) { + billingLinkedResource(other.getBillingLinkedResource()); createdAt(other.getCreatedAt()); description(other.getDescription()); eventSubtype(other.getEventSubtype()); @@ -600,9 +618,23 @@ public _FinalStage eventSubtype(Optional eventSubtype) { return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public FeatureDetailResponseData build() { return new FeatureDetailResponseData( + billingLinkedResource, createdAt, description, eventSubtype, diff --git a/src/main/java/com/schematic/api/types/FeatureView.java b/src/main/java/com/schematic/api/types/FeatureView.java index a5da337..0627e40 100644 --- a/src/main/java/com/schematic/api/types/FeatureView.java +++ b/src/main/java/com/schematic/api/types/FeatureView.java @@ -26,6 +26,8 @@ public final class FeatureView { private final String accountId; + private final Optional billingLinkedResource; + private final OffsetDateTime createdAt; private final String description; @@ -64,6 +66,7 @@ public final class FeatureView { private FeatureView( String accountId, + Optional billingLinkedResource, OffsetDateTime createdAt, String description, Optional eventSubtype, @@ -83,6 +86,7 @@ private FeatureView( OffsetDateTime updatedAt, Map additionalProperties) { this.accountId = accountId; + this.billingLinkedResource = billingLinkedResource; this.createdAt = createdAt; this.description = description; this.eventSubtype = eventSubtype; @@ -108,6 +112,11 @@ public String getAccountId() { return accountId; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -206,6 +215,7 @@ public Map getAdditionalProperties() { private boolean equalTo(FeatureView other) { return accountId.equals(other.accountId) + && billingLinkedResource.equals(other.billingLinkedResource) && createdAt.equals(other.createdAt) && description.equals(other.description) && eventSubtype.equals(other.eventSubtype) @@ -229,6 +239,7 @@ private boolean equalTo(FeatureView other) { public int hashCode() { return Objects.hash( this.accountId, + this.billingLinkedResource, this.createdAt, this.description, this.eventSubtype, @@ -298,6 +309,10 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage eventSubtype(Optional eventSubtype); _FinalStage eventSubtype(String eventSubtype); @@ -390,6 +405,8 @@ public static final class Builder private Optional eventSubtype = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -398,6 +415,7 @@ private Builder() {} @java.lang.Override public Builder from(FeatureView other) { accountId(other.getAccountId()); + billingLinkedResource(other.getBillingLinkedResource()); createdAt(other.getCreatedAt()); description(other.getDescription()); eventSubtype(other.getEventSubtype()); @@ -626,10 +644,24 @@ public _FinalStage eventSubtype(Optional eventSubtype) { return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public FeatureView build() { return new FeatureView( accountId, + billingLinkedResource, createdAt, description, eventSubtype, diff --git a/src/main/java/com/schematic/api/types/IntegrationType.java b/src/main/java/com/schematic/api/types/IntegrationType.java new file mode 100644 index 0000000..77420b6 --- /dev/null +++ b/src/main/java/com/schematic/api/types/IntegrationType.java @@ -0,0 +1,103 @@ +/** + * 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 IntegrationType { + public static final IntegrationType ORB = new IntegrationType(Value.ORB, "orb"); + + public static final IntegrationType UNKNOWN = new IntegrationType(Value.UNKNOWN, "unknown"); + + public static final IntegrationType CLERK = new IntegrationType(Value.CLERK, "clerk"); + + public static final IntegrationType STRIPE = new IntegrationType(Value.STRIPE, "stripe"); + + private final Value value; + + private final String string; + + IntegrationType(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 IntegrationType && this.string.equals(((IntegrationType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ORB: + return visitor.visitOrb(); + case UNKNOWN: + return visitor.visitUnknown(); + case CLERK: + return visitor.visitClerk(); + case STRIPE: + return visitor.visitStripe(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static IntegrationType valueOf(String value) { + switch (value) { + case "orb": + return ORB; + case "unknown": + return UNKNOWN; + case "clerk": + return CLERK; + case "stripe": + return STRIPE; + default: + return new IntegrationType(Value._UNKNOWN, value); + } + } + + public enum Value { + CLERK, + + ORB, + + STRIPE, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitClerk(); + + T visitOrb(); + + T visitStripe(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/IntegrationWebhookUrlResponseData.java b/src/main/java/com/schematic/api/types/IntegrationWebhookUrlResponseData.java new file mode 100644 index 0000000..6eeaa22 --- /dev/null +++ b/src/main/java/com/schematic/api/types/IntegrationWebhookUrlResponseData.java @@ -0,0 +1,141 @@ +/** + * 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 = IntegrationWebhookUrlResponseData.Builder.class) +public final class IntegrationWebhookUrlResponseData { + private final IntegrationType type; + + private final String url; + + private final Map additionalProperties; + + private IntegrationWebhookUrlResponseData( + IntegrationType type, String url, Map additionalProperties) { + this.type = type; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public IntegrationType getType() { + return type; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof IntegrationWebhookUrlResponseData && equalTo((IntegrationWebhookUrlResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(IntegrationWebhookUrlResponseData other) { + return type.equals(other.type) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + UrlStage type(@NotNull IntegrationType type); + + Builder from(IntegrationWebhookUrlResponseData other); + } + + public interface UrlStage { + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + IntegrationWebhookUrlResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, UrlStage, _FinalStage { + private IntegrationType type; + + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(IntegrationWebhookUrlResponseData other) { + type(other.getType()); + url(other.getUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public UrlStage type(@NotNull IntegrationType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public IntegrationWebhookUrlResponseData build() { + return new IntegrationWebhookUrlResponseData(type, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java index 46b8673..12ad002 100644 --- a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java @@ -34,6 +34,8 @@ public final class PlanCreditGrantView { private final Optional billingCreditAutoTopupExpiryUnitCount; + private final Optional billingCreditAutoTopupThresholdCredits; + private final Optional billingCreditAutoTopupThresholdPercent; private final OffsetDateTime createdAt; @@ -85,6 +87,7 @@ private PlanCreditGrantView( Optional billingCreditAutoTopupExpiryType, Optional billingCreditAutoTopupExpiryUnit, Optional billingCreditAutoTopupExpiryUnitCount, + Optional billingCreditAutoTopupThresholdCredits, Optional billingCreditAutoTopupThresholdPercent, OffsetDateTime createdAt, Optional credit, @@ -113,6 +116,7 @@ private PlanCreditGrantView( this.billingCreditAutoTopupExpiryType = billingCreditAutoTopupExpiryType; this.billingCreditAutoTopupExpiryUnit = billingCreditAutoTopupExpiryUnit; this.billingCreditAutoTopupExpiryUnitCount = billingCreditAutoTopupExpiryUnitCount; + this.billingCreditAutoTopupThresholdCredits = billingCreditAutoTopupThresholdCredits; this.billingCreditAutoTopupThresholdPercent = billingCreditAutoTopupThresholdPercent; this.createdAt = createdAt; this.credit = credit; @@ -167,6 +171,11 @@ public Optional getBillingCreditAutoTopupExpiryUnitCount() { return billingCreditAutoTopupExpiryUnitCount; } + @JsonProperty("billing_credit_auto_topup_threshold_credits") + public Optional getBillingCreditAutoTopupThresholdCredits() { + return billingCreditAutoTopupThresholdCredits; + } + @JsonProperty("billing_credit_auto_topup_threshold_percent") public Optional getBillingCreditAutoTopupThresholdPercent() { return billingCreditAutoTopupThresholdPercent; @@ -305,6 +314,7 @@ private boolean equalTo(PlanCreditGrantView other) { && billingCreditAutoTopupExpiryType.equals(other.billingCreditAutoTopupExpiryType) && billingCreditAutoTopupExpiryUnit.equals(other.billingCreditAutoTopupExpiryUnit) && billingCreditAutoTopupExpiryUnitCount.equals(other.billingCreditAutoTopupExpiryUnitCount) + && billingCreditAutoTopupThresholdCredits.equals(other.billingCreditAutoTopupThresholdCredits) && billingCreditAutoTopupThresholdPercent.equals(other.billingCreditAutoTopupThresholdPercent) && createdAt.equals(other.createdAt) && credit.equals(other.credit) @@ -337,6 +347,7 @@ public int hashCode() { this.billingCreditAutoTopupExpiryType, this.billingCreditAutoTopupExpiryUnit, this.billingCreditAutoTopupExpiryUnitCount, + this.billingCreditAutoTopupThresholdCredits, this.billingCreditAutoTopupThresholdPercent, this.createdAt, this.credit, @@ -446,6 +457,10 @@ _FinalStage billingCreditAutoTopupExpiryUnit( _FinalStage billingCreditAutoTopupExpiryUnitCount(Long billingCreditAutoTopupExpiryUnitCount); + _FinalStage billingCreditAutoTopupThresholdCredits(Optional billingCreditAutoTopupThresholdCredits); + + _FinalStage billingCreditAutoTopupThresholdCredits(Long billingCreditAutoTopupThresholdCredits); + _FinalStage billingCreditAutoTopupThresholdPercent(Optional billingCreditAutoTopupThresholdPercent); _FinalStage billingCreditAutoTopupThresholdPercent(Long billingCreditAutoTopupThresholdPercent); @@ -561,6 +576,8 @@ public static final class Builder private Optional billingCreditAutoTopupThresholdPercent = Optional.empty(); + private Optional billingCreditAutoTopupThresholdCredits = Optional.empty(); + private Optional billingCreditAutoTopupExpiryUnitCount = Optional.empty(); private Optional billingCreditAutoTopupExpiryUnit = Optional.empty(); @@ -584,6 +601,7 @@ public Builder from(PlanCreditGrantView other) { billingCreditAutoTopupExpiryType(other.getBillingCreditAutoTopupExpiryType()); billingCreditAutoTopupExpiryUnit(other.getBillingCreditAutoTopupExpiryUnit()); billingCreditAutoTopupExpiryUnitCount(other.getBillingCreditAutoTopupExpiryUnitCount()); + billingCreditAutoTopupThresholdCredits(other.getBillingCreditAutoTopupThresholdCredits()); billingCreditAutoTopupThresholdPercent(other.getBillingCreditAutoTopupThresholdPercent()); createdAt(other.getCreatedAt()); credit(other.getCredit()); @@ -866,6 +884,20 @@ public _FinalStage billingCreditAutoTopupThresholdPercent( return this; } + @java.lang.Override + public _FinalStage billingCreditAutoTopupThresholdCredits(Long billingCreditAutoTopupThresholdCredits) { + this.billingCreditAutoTopupThresholdCredits = Optional.ofNullable(billingCreditAutoTopupThresholdCredits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_threshold_credits", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupThresholdCredits( + Optional billingCreditAutoTopupThresholdCredits) { + this.billingCreditAutoTopupThresholdCredits = billingCreditAutoTopupThresholdCredits; + return this; + } + @java.lang.Override public _FinalStage billingCreditAutoTopupExpiryUnitCount(Long billingCreditAutoTopupExpiryUnitCount) { this.billingCreditAutoTopupExpiryUnitCount = Optional.ofNullable(billingCreditAutoTopupExpiryUnitCount); @@ -942,6 +974,7 @@ public PlanCreditGrantView build() { billingCreditAutoTopupExpiryType, billingCreditAutoTopupExpiryUnit, billingCreditAutoTopupExpiryUnitCount, + billingCreditAutoTopupThresholdCredits, billingCreditAutoTopupThresholdPercent, createdAt, credit, diff --git a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java index e5a85a1..84a9845 100644 --- a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java @@ -28,13 +28,21 @@ public final class PlanDetailResponseData { private final Optional audienceType; + private final Optional billingLinkedResource; + private final Optional billingProduct; private final ChargeType chargeType; private final long companyCount; - private final PlanControlledByType controlledBy; + private final Optional companyId; + + private final Optional companyName; + + private final String controlledBy; + + private final Optional copiedFromPlanId; private final OffsetDateTime createdAt; @@ -46,7 +54,7 @@ public final class PlanDetailResponseData { private final List features; - private final String icon; + private final PlanIcon icon; private final String id; @@ -79,16 +87,20 @@ public final class PlanDetailResponseData { private PlanDetailResponseData( Optional activeVersion, Optional audienceType, + Optional billingLinkedResource, Optional billingProduct, ChargeType chargeType, long companyCount, - PlanControlledByType controlledBy, + Optional companyId, + Optional companyName, + String controlledBy, + Optional copiedFromPlanId, OffsetDateTime createdAt, List currencyPrices, String description, Optional draftVersion, List features, - String icon, + PlanIcon icon, String id, Optional> includedCreditGrants, boolean isDefault, @@ -105,10 +117,14 @@ private PlanDetailResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.chargeType = chargeType; this.companyCount = companyCount; + this.companyId = companyId; + this.companyName = companyName; this.controlledBy = controlledBy; + this.copiedFromPlanId = copiedFromPlanId; this.createdAt = createdAt; this.currencyPrices = currencyPrices; this.description = description; @@ -141,6 +157,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("billing_product") public Optional getBillingProduct() { return billingProduct; @@ -156,11 +177,26 @@ public long getCompanyCount() { return companyCount; } + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("company_name") + public Optional getCompanyName() { + return companyName; + } + @JsonProperty("controlled_by") - public PlanControlledByType getControlledBy() { + public String getControlledBy() { return controlledBy; } + @JsonProperty("copied_from_plan_id") + public Optional getCopiedFromPlanId() { + return copiedFromPlanId; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -187,7 +223,7 @@ public List getFeatures() { } @JsonProperty("icon") - public String getIcon() { + public PlanIcon getIcon() { return icon; } @@ -270,10 +306,14 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanDetailResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCount == other.companyCount + && companyId.equals(other.companyId) + && companyName.equals(other.companyName) && controlledBy.equals(other.controlledBy) + && copiedFromPlanId.equals(other.copiedFromPlanId) && createdAt.equals(other.createdAt) && currencyPrices.equals(other.currencyPrices) && description.equals(other.description) @@ -300,10 +340,14 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.billingLinkedResource, this.billingProduct, this.chargeType, this.companyCount, + this.companyId, + this.companyName, this.controlledBy, + this.copiedFromPlanId, this.createdAt, this.currencyPrices, this.description, @@ -345,7 +389,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); + CreatedAtStage controlledBy(@NotNull String controlledBy); } public interface CreatedAtStage { @@ -357,7 +401,7 @@ public interface DescriptionStage { } public interface IconStage { - IdStage icon(@NotNull String icon); + IdStage icon(@NotNull PlanIcon icon); } public interface IdStage { @@ -403,10 +447,26 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage billingProduct(Optional billingProduct); _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyName(Optional companyName); + + _FinalStage companyName(String companyName); + + _FinalStage copiedFromPlanId(Optional copiedFromPlanId); + + _FinalStage copiedFromPlanId(String copiedFromPlanId); + _FinalStage currencyPrices(List currencyPrices); _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); @@ -470,13 +530,13 @@ public static final class Builder private long companyCount; - private PlanControlledByType controlledBy; + private String controlledBy; private OffsetDateTime createdAt; private String description; - private String icon; + private PlanIcon icon; private String id; @@ -510,8 +570,16 @@ public static final class Builder private List currencyPrices = new ArrayList<>(); + private Optional copiedFromPlanId = Optional.empty(); + + private Optional companyName = Optional.empty(); + + private Optional companyId = Optional.empty(); + private Optional billingProduct = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -525,10 +593,14 @@ private Builder() {} public Builder from(PlanDetailResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); + companyId(other.getCompanyId()); + companyName(other.getCompanyName()); controlledBy(other.getControlledBy()); + copiedFromPlanId(other.getCopiedFromPlanId()); createdAt(other.getCreatedAt()); currencyPrices(other.getCurrencyPrices()); description(other.getDescription()); @@ -567,7 +639,7 @@ public ControlledByStage companyCount(long companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { + public CreatedAtStage controlledBy(@NotNull String controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -588,7 +660,7 @@ public IconStage description(@NotNull String description) { @java.lang.Override @JsonSetter("icon") - public IdStage icon(@NotNull String icon) { + public IdStage icon(@NotNull PlanIcon icon) { this.icon = Objects.requireNonNull(icon, "icon must not be null"); return this; } @@ -793,6 +865,45 @@ public _FinalStage currencyPrices(List currencyP return this; } + @java.lang.Override + public _FinalStage copiedFromPlanId(String copiedFromPlanId) { + this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_from_plan_id", nulls = Nulls.SKIP) + public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { + this.copiedFromPlanId = copiedFromPlanId; + return this; + } + + @java.lang.Override + public _FinalStage companyName(String companyName) { + this.companyName = Optional.ofNullable(companyName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_name", nulls = Nulls.SKIP) + public _FinalStage companyName(Optional companyName) { + this.companyName = companyName; + return this; + } + + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -806,6 +917,19 @@ public _FinalStage billingProduct(Optional bil return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -837,10 +961,14 @@ public PlanDetailResponseData build() { return new PlanDetailResponseData( activeVersion, audienceType, + billingLinkedResource, billingProduct, chargeType, companyCount, + companyId, + companyName, controlledBy, + copiedFromPlanId, createdAt, currencyPrices, description, diff --git a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java index 1aa473c..5ddd824 100644 --- a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java @@ -24,6 +24,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanEntitlementResponseData.Builder.class) public final class PlanEntitlementResponseData { + private final Optional billingLinkedResource; + private final Optional billingThreshold; private final Optional consumptionRate; @@ -79,6 +81,7 @@ public final class PlanEntitlementResponseData { private final Map additionalProperties; private PlanEntitlementResponseData( + Optional billingLinkedResource, Optional billingThreshold, Optional consumptionRate, OffsetDateTime createdAt, @@ -106,6 +109,7 @@ private PlanEntitlementResponseData( Optional valueTraitId, EntitlementValueType valueType, Map additionalProperties) { + this.billingLinkedResource = billingLinkedResource; this.billingThreshold = billingThreshold; this.consumptionRate = consumptionRate; this.createdAt = createdAt; @@ -135,6 +139,11 @@ private PlanEntitlementResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("billing_threshold") public Optional getBillingThreshold() { return billingThreshold; @@ -277,7 +286,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(PlanEntitlementResponseData other) { - return billingThreshold.equals(other.billingThreshold) + return billingLinkedResource.equals(other.billingLinkedResource) + && billingThreshold.equals(other.billingThreshold) && consumptionRate.equals(other.consumptionRate) && createdAt.equals(other.createdAt) && currencyPrices.equals(other.currencyPrices) @@ -308,6 +318,7 @@ private boolean equalTo(PlanEntitlementResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.billingLinkedResource, this.billingThreshold, this.consumptionRate, this.createdAt, @@ -386,6 +397,10 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage billingThreshold(Optional billingThreshold); _FinalStage billingThreshold(Long billingThreshold); @@ -524,6 +539,8 @@ public static final class Builder private Optional billingThreshold = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -531,6 +548,7 @@ private Builder() {} @java.lang.Override public Builder from(PlanEntitlementResponseData other) { + billingLinkedResource(other.getBillingLinkedResource()); billingThreshold(other.getBillingThreshold()); consumptionRate(other.getConsumptionRate()); createdAt(other.getCreatedAt()); @@ -861,9 +879,23 @@ public _FinalStage billingThreshold(Optional billingThreshold) { return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public PlanEntitlementResponseData build() { return new PlanEntitlementResponseData( + billingLinkedResource, billingThreshold, consumptionRate, createdAt, diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java index 1b31de5..109a00e 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java @@ -28,15 +28,23 @@ public final class PlanGroupPlanDetailResponseData { private final Optional audienceType; + private final Optional billingLinkedResource; + private final Optional billingProduct; private final ChargeType chargeType; private final long companyCount; + private final Optional companyId; + + private final Optional companyName; + private final List compatiblePlanIds; - private final PlanControlledByType controlledBy; + private final String controlledBy; + + private final Optional copiedFromPlanId; private final OffsetDateTime createdAt; @@ -52,7 +60,7 @@ public final class PlanGroupPlanDetailResponseData { private final List features; - private final String icon; + private final PlanIcon icon; private final String id; @@ -87,11 +95,15 @@ public final class PlanGroupPlanDetailResponseData { private PlanGroupPlanDetailResponseData( Optional activeVersion, Optional audienceType, + Optional billingLinkedResource, Optional billingProduct, ChargeType chargeType, long companyCount, + Optional companyId, + Optional companyName, List compatiblePlanIds, - PlanControlledByType controlledBy, + String controlledBy, + Optional copiedFromPlanId, OffsetDateTime createdAt, List currencyPrices, Optional customPlanConfig, @@ -99,7 +111,7 @@ private PlanGroupPlanDetailResponseData( Optional draftVersion, List entitlements, List features, - String icon, + PlanIcon icon, String id, Optional> includedCreditGrants, boolean isCustom, @@ -117,11 +129,15 @@ private PlanGroupPlanDetailResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.chargeType = chargeType; this.companyCount = companyCount; + this.companyId = companyId; + this.companyName = companyName; this.compatiblePlanIds = compatiblePlanIds; this.controlledBy = controlledBy; + this.copiedFromPlanId = copiedFromPlanId; this.createdAt = createdAt; this.currencyPrices = currencyPrices; this.customPlanConfig = customPlanConfig; @@ -157,6 +173,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("billing_product") public Optional getBillingProduct() { return billingProduct; @@ -172,16 +193,31 @@ public long getCompanyCount() { return companyCount; } + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("company_name") + public Optional getCompanyName() { + return companyName; + } + @JsonProperty("compatible_plan_ids") public List getCompatiblePlanIds() { return compatiblePlanIds; } @JsonProperty("controlled_by") - public PlanControlledByType getControlledBy() { + public String getControlledBy() { return controlledBy; } + @JsonProperty("copied_from_plan_id") + public Optional getCopiedFromPlanId() { + return copiedFromPlanId; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -218,7 +254,7 @@ public List getFeatures() { } @JsonProperty("icon") - public String getIcon() { + public PlanIcon getIcon() { return icon; } @@ -306,11 +342,15 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanGroupPlanDetailResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCount == other.companyCount + && companyId.equals(other.companyId) + && companyName.equals(other.companyName) && compatiblePlanIds.equals(other.compatiblePlanIds) && controlledBy.equals(other.controlledBy) + && copiedFromPlanId.equals(other.copiedFromPlanId) && createdAt.equals(other.createdAt) && currencyPrices.equals(other.currencyPrices) && customPlanConfig.equals(other.customPlanConfig) @@ -340,11 +380,15 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.billingLinkedResource, this.billingProduct, this.chargeType, this.companyCount, + this.companyId, + this.companyName, this.compatiblePlanIds, this.controlledBy, + this.copiedFromPlanId, this.createdAt, this.currencyPrices, this.customPlanConfig, @@ -389,7 +433,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); + CreatedAtStage controlledBy(@NotNull String controlledBy); } public interface CreatedAtStage { @@ -401,7 +445,7 @@ public interface DescriptionStage { } public interface IconStage { - IdStage icon(@NotNull String icon); + IdStage icon(@NotNull PlanIcon icon); } public interface IdStage { @@ -451,16 +495,32 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage billingProduct(Optional billingProduct); _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyName(Optional companyName); + + _FinalStage companyName(String companyName); + _FinalStage compatiblePlanIds(List compatiblePlanIds); _FinalStage addCompatiblePlanIds(String compatiblePlanIds); _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage copiedFromPlanId(Optional copiedFromPlanId); + + _FinalStage copiedFromPlanId(String copiedFromPlanId); + _FinalStage currencyPrices(List currencyPrices); _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); @@ -535,13 +595,13 @@ public static final class Builder private long companyCount; - private PlanControlledByType controlledBy; + private String controlledBy; private OffsetDateTime createdAt; private String description; - private String icon; + private PlanIcon icon; private String id; @@ -581,10 +641,18 @@ public static final class Builder private List currencyPrices = new ArrayList<>(); + private Optional copiedFromPlanId = Optional.empty(); + private List compatiblePlanIds = new ArrayList<>(); + private Optional companyName = Optional.empty(); + + private Optional companyId = Optional.empty(); + private Optional billingProduct = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -598,11 +666,15 @@ private Builder() {} public Builder from(PlanGroupPlanDetailResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); + companyId(other.getCompanyId()); + companyName(other.getCompanyName()); compatiblePlanIds(other.getCompatiblePlanIds()); controlledBy(other.getControlledBy()); + copiedFromPlanId(other.getCopiedFromPlanId()); createdAt(other.getCreatedAt()); currencyPrices(other.getCurrencyPrices()); customPlanConfig(other.getCustomPlanConfig()); @@ -644,7 +716,7 @@ public ControlledByStage companyCount(long companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { + public CreatedAtStage controlledBy(@NotNull String controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -665,7 +737,7 @@ public IconStage description(@NotNull String description) { @java.lang.Override @JsonSetter("icon") - public IdStage icon(@NotNull String icon) { + public IdStage icon(@NotNull PlanIcon icon) { this.icon = Objects.requireNonNull(icon, "icon must not be null"); return this; } @@ -914,6 +986,19 @@ public _FinalStage currencyPrices(List currencyP return this; } + @java.lang.Override + public _FinalStage copiedFromPlanId(String copiedFromPlanId) { + this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_from_plan_id", nulls = Nulls.SKIP) + public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { + this.copiedFromPlanId = copiedFromPlanId; + return this; + } + @java.lang.Override public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { if (compatiblePlanIds != null) { @@ -938,6 +1023,32 @@ public _FinalStage compatiblePlanIds(List compatiblePlanIds) { return this; } + @java.lang.Override + public _FinalStage companyName(String companyName) { + this.companyName = Optional.ofNullable(companyName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_name", nulls = Nulls.SKIP) + public _FinalStage companyName(Optional companyName) { + this.companyName = companyName; + return this; + } + + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -951,6 +1062,19 @@ public _FinalStage billingProduct(Optional bil return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -982,11 +1106,15 @@ public PlanGroupPlanDetailResponseData build() { return new PlanGroupPlanDetailResponseData( activeVersion, audienceType, + billingLinkedResource, billingProduct, chargeType, companyCount, + companyId, + companyName, compatiblePlanIds, controlledBy, + copiedFromPlanId, createdAt, currencyPrices, customPlanConfig, diff --git a/src/main/java/com/schematic/api/types/PlanIcon.java b/src/main/java/com/schematic/api/types/PlanIcon.java new file mode 100644 index 0000000..5179bf4 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanIcon.java @@ -0,0 +1,312 @@ +/** + * 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 PlanIcon { + public static final PlanIcon FUCHSIA = new PlanIcon(Value.FUCHSIA, "fuchsia"); + + public static final PlanIcon EMERALD = new PlanIcon(Value.EMERALD, "emerald"); + + public static final PlanIcon BLUE_GRAY = new PlanIcon(Value.BLUE_GRAY, "blueGray"); + + public static final PlanIcon YELLOW = new PlanIcon(Value.YELLOW, "yellow"); + + public static final PlanIcon LIME = new PlanIcon(Value.LIME, "lime"); + + public static final PlanIcon SKY = new PlanIcon(Value.SKY, "sky"); + + public static final PlanIcon GRAY = new PlanIcon(Value.GRAY, "gray"); + + public static final PlanIcon CYAN = new PlanIcon(Value.CYAN, "cyan"); + + public static final PlanIcon ROSE = new PlanIcon(Value.ROSE, "rose"); + + public static final PlanIcon BLUE = new PlanIcon(Value.BLUE, "blue"); + + public static final PlanIcon VIOLET = new PlanIcon(Value.VIOLET, "violet"); + + public static final PlanIcon BLUE_GREEN = new PlanIcon(Value.BLUE_GREEN, "blueGreen"); + + public static final PlanIcon WARM_GRAY = new PlanIcon(Value.WARM_GRAY, "warmGray"); + + public static final PlanIcon GREEN = new PlanIcon(Value.GREEN, "green"); + + public static final PlanIcon LIGHT_BLUE = new PlanIcon(Value.LIGHT_BLUE, "lightBlue"); + + public static final PlanIcon TEAL = new PlanIcon(Value.TEAL, "teal"); + + public static final PlanIcon ORANGE = new PlanIcon(Value.ORANGE, "orange"); + + public static final PlanIcon PINK = new PlanIcon(Value.PINK, "pink"); + + public static final PlanIcon RED_ORANGE = new PlanIcon(Value.RED_ORANGE, "redOrange"); + + public static final PlanIcon TRUE_GRAY = new PlanIcon(Value.TRUE_GRAY, "trueGray"); + + public static final PlanIcon INDIGO = new PlanIcon(Value.INDIGO, "indigo"); + + public static final PlanIcon SLATE = new PlanIcon(Value.SLATE, "slate"); + + public static final PlanIcon AMBER = new PlanIcon(Value.AMBER, "amber"); + + public static final PlanIcon RED = new PlanIcon(Value.RED, "red"); + + public static final PlanIcon PURPLE = new PlanIcon(Value.PURPLE, "purple"); + + private final Value value; + + private final String string; + + PlanIcon(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 PlanIcon && this.string.equals(((PlanIcon) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FUCHSIA: + return visitor.visitFuchsia(); + case EMERALD: + return visitor.visitEmerald(); + case BLUE_GRAY: + return visitor.visitBlueGray(); + case YELLOW: + return visitor.visitYellow(); + case LIME: + return visitor.visitLime(); + case SKY: + return visitor.visitSky(); + case GRAY: + return visitor.visitGray(); + case CYAN: + return visitor.visitCyan(); + case ROSE: + return visitor.visitRose(); + case BLUE: + return visitor.visitBlue(); + case VIOLET: + return visitor.visitViolet(); + case BLUE_GREEN: + return visitor.visitBlueGreen(); + case WARM_GRAY: + return visitor.visitWarmGray(); + case GREEN: + return visitor.visitGreen(); + case LIGHT_BLUE: + return visitor.visitLightBlue(); + case TEAL: + return visitor.visitTeal(); + case ORANGE: + return visitor.visitOrange(); + case PINK: + return visitor.visitPink(); + case RED_ORANGE: + return visitor.visitRedOrange(); + case TRUE_GRAY: + return visitor.visitTrueGray(); + case INDIGO: + return visitor.visitIndigo(); + case SLATE: + return visitor.visitSlate(); + case AMBER: + return visitor.visitAmber(); + case RED: + return visitor.visitRed(); + case PURPLE: + return visitor.visitPurple(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanIcon valueOf(String value) { + switch (value) { + case "fuchsia": + return FUCHSIA; + case "emerald": + return EMERALD; + case "blueGray": + return BLUE_GRAY; + case "yellow": + return YELLOW; + case "lime": + return LIME; + case "sky": + return SKY; + case "gray": + return GRAY; + case "cyan": + return CYAN; + case "rose": + return ROSE; + case "blue": + return BLUE; + case "violet": + return VIOLET; + case "blueGreen": + return BLUE_GREEN; + case "warmGray": + return WARM_GRAY; + case "green": + return GREEN; + case "lightBlue": + return LIGHT_BLUE; + case "teal": + return TEAL; + case "orange": + return ORANGE; + case "pink": + return PINK; + case "redOrange": + return RED_ORANGE; + case "trueGray": + return TRUE_GRAY; + case "indigo": + return INDIGO; + case "slate": + return SLATE; + case "amber": + return AMBER; + case "red": + return RED; + case "purple": + return PURPLE; + default: + return new PlanIcon(Value.UNKNOWN, value); + } + } + + public enum Value { + AMBER, + + BLUE, + + BLUE_GRAY, + + BLUE_GREEN, + + CYAN, + + EMERALD, + + FUCHSIA, + + GRAY, + + GREEN, + + INDIGO, + + LIGHT_BLUE, + + LIME, + + ORANGE, + + PINK, + + PURPLE, + + RED, + + RED_ORANGE, + + ROSE, + + SKY, + + SLATE, + + TEAL, + + TRUE_GRAY, + + VIOLET, + + WARM_GRAY, + + YELLOW, + + UNKNOWN + } + + public interface Visitor { + T visitAmber(); + + T visitBlue(); + + T visitBlueGray(); + + T visitBlueGreen(); + + T visitCyan(); + + T visitEmerald(); + + T visitFuchsia(); + + T visitGray(); + + T visitGreen(); + + T visitIndigo(); + + T visitLightBlue(); + + T visitLime(); + + T visitOrange(); + + T visitPink(); + + T visitPurple(); + + T visitRed(); + + T visitRedOrange(); + + T visitRose(); + + T visitSky(); + + T visitSlate(); + + T visitTeal(); + + T visitTrueGray(); + + T visitViolet(); + + T visitWarmGray(); + + T visitYellow(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanResponseData.java b/src/main/java/com/schematic/api/types/PlanResponseData.java index dc1815c..3288db3 100644 --- a/src/main/java/com/schematic/api/types/PlanResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanResponseData.java @@ -24,11 +24,15 @@ public final class PlanResponseData { private final Optional audienceType; + private final Optional companyId; + + private final Optional copiedFromPlanId; + private final OffsetDateTime createdAt; private final String description; - private final String icon; + private final PlanIcon icon; private final String id; @@ -42,15 +46,19 @@ public final class PlanResponseData { private PlanResponseData( Optional audienceType, + Optional companyId, + Optional copiedFromPlanId, OffsetDateTime createdAt, String description, - String icon, + PlanIcon icon, String id, String name, PlanType planType, OffsetDateTime updatedAt, Map additionalProperties) { this.audienceType = audienceType; + this.companyId = companyId; + this.copiedFromPlanId = copiedFromPlanId; this.createdAt = createdAt; this.description = description; this.icon = icon; @@ -66,6 +74,16 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("copied_from_plan_id") + public Optional getCopiedFromPlanId() { + return copiedFromPlanId; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -77,7 +95,7 @@ public String getDescription() { } @JsonProperty("icon") - public String getIcon() { + public PlanIcon getIcon() { return icon; } @@ -114,6 +132,8 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanResponseData other) { return audienceType.equals(other.audienceType) + && companyId.equals(other.companyId) + && copiedFromPlanId.equals(other.copiedFromPlanId) && createdAt.equals(other.createdAt) && description.equals(other.description) && icon.equals(other.icon) @@ -127,6 +147,8 @@ private boolean equalTo(PlanResponseData other) { public int hashCode() { return Objects.hash( this.audienceType, + this.companyId, + this.copiedFromPlanId, this.createdAt, this.description, this.icon, @@ -156,7 +178,7 @@ public interface DescriptionStage { } public interface IconStage { - IdStage icon(@NotNull String icon); + IdStage icon(@NotNull PlanIcon icon); } public interface IdStage { @@ -185,6 +207,14 @@ public interface _FinalStage { _FinalStage audienceType(Optional audienceType); _FinalStage audienceType(String audienceType); + + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage copiedFromPlanId(Optional copiedFromPlanId); + + _FinalStage copiedFromPlanId(String copiedFromPlanId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -201,7 +231,7 @@ public static final class Builder private String description; - private String icon; + private PlanIcon icon; private String id; @@ -211,6 +241,10 @@ public static final class Builder private OffsetDateTime updatedAt; + private Optional copiedFromPlanId = Optional.empty(); + + private Optional companyId = Optional.empty(); + private Optional audienceType = Optional.empty(); @JsonAnySetter @@ -221,6 +255,8 @@ private Builder() {} @java.lang.Override public Builder from(PlanResponseData other) { audienceType(other.getAudienceType()); + companyId(other.getCompanyId()); + copiedFromPlanId(other.getCopiedFromPlanId()); createdAt(other.getCreatedAt()); description(other.getDescription()); icon(other.getIcon()); @@ -247,7 +283,7 @@ public IconStage description(@NotNull String description) { @java.lang.Override @JsonSetter("icon") - public IdStage icon(@NotNull String icon) { + public IdStage icon(@NotNull PlanIcon icon) { this.icon = Objects.requireNonNull(icon, "icon must not be null"); return this; } @@ -280,6 +316,32 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + @java.lang.Override + public _FinalStage copiedFromPlanId(String copiedFromPlanId) { + this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_from_plan_id", nulls = Nulls.SKIP) + public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { + this.copiedFromPlanId = copiedFromPlanId; + return this; + } + + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -296,7 +358,17 @@ public _FinalStage audienceType(Optional audienceType) { @java.lang.Override public PlanResponseData build() { return new PlanResponseData( - audienceType, createdAt, description, icon, id, name, planType, updatedAt, additionalProperties); + audienceType, + companyId, + copiedFromPlanId, + createdAt, + description, + icon, + id, + name, + planType, + updatedAt, + additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/schematic/api/types/PlanVersionResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java index c4201cf..272deba 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java @@ -28,7 +28,7 @@ public final class PlanVersionResponseData { private final String environmentId; - private final String icon; + private final PlanIcon icon; private final String id; @@ -50,7 +50,7 @@ private PlanVersionResponseData( OffsetDateTime createdAt, String description, String environmentId, - String icon, + PlanIcon icon, String id, String name, Optional originalPlanId, @@ -89,7 +89,7 @@ public String getEnvironmentId() { } @JsonProperty("icon") - public String getIcon() { + public PlanIcon getIcon() { return icon; } @@ -193,7 +193,7 @@ public interface EnvironmentIdStage { } public interface IconStage { - IdStage icon(@NotNull String icon); + IdStage icon(@NotNull PlanIcon icon); } public interface IdStage { @@ -251,7 +251,7 @@ public static final class Builder private String environmentId; - private String icon; + private PlanIcon icon; private String id; @@ -311,7 +311,7 @@ public IconStage environmentId(@NotNull String environmentId) { @java.lang.Override @JsonSetter("icon") - public IdStage icon(@NotNull String icon) { + public IdStage icon(@NotNull PlanIcon icon) { this.icon = Objects.requireNonNull(icon, "icon must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java index eab4b9e..444cac5 100644 --- a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java @@ -28,15 +28,23 @@ public final class PlanViewPublicResponseData { private final Optional audienceType; + private final Optional billingLinkedResource; + private final Optional billingProduct; private final ChargeType chargeType; private final long companyCount; + private final Optional companyId; + + private final Optional companyName; + private final List compatiblePlanIds; - private final PlanControlledByType controlledBy; + private final String controlledBy; + + private final Optional copiedFromPlanId; private final OffsetDateTime createdAt; @@ -54,7 +62,7 @@ public final class PlanViewPublicResponseData { private final List features; - private final String icon; + private final PlanIcon icon; private final String id; @@ -89,11 +97,15 @@ public final class PlanViewPublicResponseData { private PlanViewPublicResponseData( Optional activeVersion, Optional audienceType, + Optional billingLinkedResource, Optional billingProduct, ChargeType chargeType, long companyCount, + Optional companyId, + Optional companyName, List compatiblePlanIds, - PlanControlledByType controlledBy, + String controlledBy, + Optional copiedFromPlanId, OffsetDateTime createdAt, List currencyPrices, boolean custom, @@ -102,7 +114,7 @@ private PlanViewPublicResponseData( Optional draftVersion, List entitlements, List features, - String icon, + PlanIcon icon, String id, List includedCreditGrants, boolean isCustom, @@ -120,11 +132,15 @@ private PlanViewPublicResponseData( Map additionalProperties) { this.activeVersion = activeVersion; this.audienceType = audienceType; + this.billingLinkedResource = billingLinkedResource; this.billingProduct = billingProduct; this.chargeType = chargeType; this.companyCount = companyCount; + this.companyId = companyId; + this.companyName = companyName; this.compatiblePlanIds = compatiblePlanIds; this.controlledBy = controlledBy; + this.copiedFromPlanId = copiedFromPlanId; this.createdAt = createdAt; this.currencyPrices = currencyPrices; this.custom = custom; @@ -161,6 +177,11 @@ public Optional getAudienceType() { return audienceType; } + @JsonProperty("billing_linked_resource") + public Optional getBillingLinkedResource() { + return billingLinkedResource; + } + @JsonProperty("billing_product") public Optional getBillingProduct() { return billingProduct; @@ -176,16 +197,31 @@ public long getCompanyCount() { return companyCount; } + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("company_name") + public Optional getCompanyName() { + return companyName; + } + @JsonProperty("compatible_plan_ids") public List getCompatiblePlanIds() { return compatiblePlanIds; } @JsonProperty("controlled_by") - public PlanControlledByType getControlledBy() { + public String getControlledBy() { return controlledBy; } + @JsonProperty("copied_from_plan_id") + public Optional getCopiedFromPlanId() { + return copiedFromPlanId; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -227,7 +263,7 @@ public List getFeatures() { } @JsonProperty("icon") - public String getIcon() { + public PlanIcon getIcon() { return icon; } @@ -315,11 +351,15 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanViewPublicResponseData other) { return activeVersion.equals(other.activeVersion) && audienceType.equals(other.audienceType) + && billingLinkedResource.equals(other.billingLinkedResource) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCount == other.companyCount + && companyId.equals(other.companyId) + && companyName.equals(other.companyName) && compatiblePlanIds.equals(other.compatiblePlanIds) && controlledBy.equals(other.controlledBy) + && copiedFromPlanId.equals(other.copiedFromPlanId) && createdAt.equals(other.createdAt) && currencyPrices.equals(other.currencyPrices) && custom == other.custom @@ -350,11 +390,15 @@ public int hashCode() { return Objects.hash( this.activeVersion, this.audienceType, + this.billingLinkedResource, this.billingProduct, this.chargeType, this.companyCount, + this.companyId, + this.companyName, this.compatiblePlanIds, this.controlledBy, + this.copiedFromPlanId, this.createdAt, this.currencyPrices, this.custom, @@ -400,7 +444,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); + CreatedAtStage controlledBy(@NotNull String controlledBy); } public interface CreatedAtStage { @@ -416,7 +460,7 @@ public interface DescriptionStage { } public interface IconStage { - IdStage icon(@NotNull String icon); + IdStage icon(@NotNull PlanIcon icon); } public interface IdStage { @@ -466,16 +510,32 @@ public interface _FinalStage { _FinalStage audienceType(String audienceType); + _FinalStage billingLinkedResource(Optional billingLinkedResource); + + _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource); + _FinalStage billingProduct(Optional billingProduct); _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage companyName(Optional companyName); + + _FinalStage companyName(String companyName); + _FinalStage compatiblePlanIds(List compatiblePlanIds); _FinalStage addCompatiblePlanIds(String compatiblePlanIds); _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage copiedFromPlanId(Optional copiedFromPlanId); + + _FinalStage copiedFromPlanId(String copiedFromPlanId); + _FinalStage currencyPrices(List currencyPrices); _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); @@ -553,7 +613,7 @@ public static final class Builder private long companyCount; - private PlanControlledByType controlledBy; + private String controlledBy; private OffsetDateTime createdAt; @@ -561,7 +621,7 @@ public static final class Builder private String description; - private String icon; + private PlanIcon icon; private String id; @@ -601,10 +661,18 @@ public static final class Builder private List currencyPrices = new ArrayList<>(); + private Optional copiedFromPlanId = Optional.empty(); + private List compatiblePlanIds = new ArrayList<>(); + private Optional companyName = Optional.empty(); + + private Optional companyId = Optional.empty(); + private Optional billingProduct = Optional.empty(); + private Optional billingLinkedResource = Optional.empty(); + private Optional audienceType = Optional.empty(); private Optional activeVersion = Optional.empty(); @@ -618,11 +686,15 @@ private Builder() {} public Builder from(PlanViewPublicResponseData other) { activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); + billingLinkedResource(other.getBillingLinkedResource()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); + companyId(other.getCompanyId()); + companyName(other.getCompanyName()); compatiblePlanIds(other.getCompatiblePlanIds()); controlledBy(other.getControlledBy()); + copiedFromPlanId(other.getCopiedFromPlanId()); createdAt(other.getCreatedAt()); currencyPrices(other.getCurrencyPrices()); custom(other.getCustom()); @@ -665,7 +737,7 @@ public ControlledByStage companyCount(long companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { + public CreatedAtStage controlledBy(@NotNull String controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -693,7 +765,7 @@ public IconStage description(@NotNull String description) { @java.lang.Override @JsonSetter("icon") - public IdStage icon(@NotNull String icon) { + public IdStage icon(@NotNull PlanIcon icon) { this.icon = Objects.requireNonNull(icon, "icon must not be null"); return this; } @@ -952,6 +1024,19 @@ public _FinalStage currencyPrices(List currencyP return this; } + @java.lang.Override + public _FinalStage copiedFromPlanId(String copiedFromPlanId) { + this.copiedFromPlanId = Optional.ofNullable(copiedFromPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "copied_from_plan_id", nulls = Nulls.SKIP) + public _FinalStage copiedFromPlanId(Optional copiedFromPlanId) { + this.copiedFromPlanId = copiedFromPlanId; + return this; + } + @java.lang.Override public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { if (compatiblePlanIds != null) { @@ -976,6 +1061,32 @@ public _FinalStage compatiblePlanIds(List compatiblePlanIds) { return this; } + @java.lang.Override + public _FinalStage companyName(String companyName) { + this.companyName = Optional.ofNullable(companyName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_name", nulls = Nulls.SKIP) + public _FinalStage companyName(Optional companyName) { + this.companyName = companyName; + return this; + } + + @java.lang.Override + public _FinalStage companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public _FinalStage companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -989,6 +1100,19 @@ public _FinalStage billingProduct(Optional bil return this; } + @java.lang.Override + public _FinalStage billingLinkedResource(BillingLinkedResourceResponseData billingLinkedResource) { + this.billingLinkedResource = Optional.ofNullable(billingLinkedResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_linked_resource", nulls = Nulls.SKIP) + public _FinalStage billingLinkedResource(Optional billingLinkedResource) { + this.billingLinkedResource = billingLinkedResource; + return this; + } + @java.lang.Override public _FinalStage audienceType(String audienceType) { this.audienceType = Optional.ofNullable(audienceType); @@ -1020,11 +1144,15 @@ public PlanViewPublicResponseData build() { return new PlanViewPublicResponseData( activeVersion, audienceType, + billingLinkedResource, billingProduct, chargeType, companyCount, + companyId, + companyName, compatiblePlanIds, controlledBy, + copiedFromPlanId, createdAt, currencyPrices, custom, diff --git a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java index 6dfb440..81bf795 100644 --- a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java +++ b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java @@ -7,8 +7,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class RulesEngineSchemaVersion { - public static final RulesEngineSchemaVersion V_5_F_633_CC_3 = - new RulesEngineSchemaVersion(Value.V_5_F_633_CC_3, "v5f633cc3"); + public static final RulesEngineSchemaVersion V_313_FA_646 = + new RulesEngineSchemaVersion(Value.V_313_FA_646, "v313fa646"); public static final RulesEngineSchemaVersion PLACEHOLDER_FOR_FERN_COMPATIBILITY = new RulesEngineSchemaVersion( Value.PLACEHOLDER_FOR_FERN_COMPATIBILITY, "placeholder-for-fern-compatibility"); @@ -46,8 +46,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case V_5_F_633_CC_3: - return visitor.visitV5F633Cc3(); + case V_313_FA_646: + return visitor.visitV313Fa646(); case PLACEHOLDER_FOR_FERN_COMPATIBILITY: return visitor.visitPlaceholderForFernCompatibility(); case UNKNOWN: @@ -59,8 +59,8 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static RulesEngineSchemaVersion valueOf(String value) { switch (value) { - case "v5f633cc3": - return V_5_F_633_CC_3; + case "v313fa646": + return V_313_FA_646; case "placeholder-for-fern-compatibility": return PLACEHOLDER_FOR_FERN_COMPATIBILITY; default: @@ -69,7 +69,7 @@ public static RulesEngineSchemaVersion valueOf(String value) { } public enum Value { - V_5_F_633_CC_3, + V_313_FA_646, PLACEHOLDER_FOR_FERN_COMPATIBILITY, @@ -77,7 +77,7 @@ public enum Value { } public interface Visitor { - T visitV5F633Cc3(); + T visitV313Fa646(); T visitPlaceholderForFernCompatibility(); diff --git a/src/main/java/com/schematic/api/types/TrialStatus.java b/src/main/java/com/schematic/api/types/TrialStatus.java new file mode 100644 index 0000000..f5a87d2 --- /dev/null +++ b/src/main/java/com/schematic/api/types/TrialStatus.java @@ -0,0 +1,92 @@ +/** + * 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 TrialStatus { + public static final TrialStatus CONVERTED = new TrialStatus(Value.CONVERTED, "converted"); + + public static final TrialStatus EXPIRED = new TrialStatus(Value.EXPIRED, "expired"); + + public static final TrialStatus ACTIVE = new TrialStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + TrialStatus(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 TrialStatus && this.string.equals(((TrialStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CONVERTED: + return visitor.visitConverted(); + case EXPIRED: + return visitor.visitExpired(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TrialStatus valueOf(String value) { + switch (value) { + case "converted": + return CONVERTED; + case "expired": + return EXPIRED; + case "active": + return ACTIVE; + default: + return new TrialStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + CONVERTED, + + EXPIRED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitConverted(); + + T visitExpired(); + + 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 ba4b32f..a705a2c 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -35,6 +35,8 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional autoTopupExpiryUnitCount; + private final Optional autoTopupThresholdCredits; + private final Optional autoTopupThresholdPercent; private final Optional creditAmount; @@ -61,6 +63,7 @@ private UpdateBillingPlanCreditGrantRequestBody( Optional autoTopupExpiryType, Optional autoTopupExpiryUnit, Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdCredits, Optional autoTopupThresholdPercent, Optional creditAmount, Optional expiryType, @@ -77,6 +80,7 @@ private UpdateBillingPlanCreditGrantRequestBody( this.autoTopupExpiryType = autoTopupExpiryType; this.autoTopupExpiryUnit = autoTopupExpiryUnit; this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + this.autoTopupThresholdCredits = autoTopupThresholdCredits; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.creditAmount = creditAmount; this.expiryType = expiryType; @@ -123,6 +127,11 @@ public Optional getAutoTopupExpiryUnitCount() { return autoTopupExpiryUnitCount; } + @JsonProperty("auto_topup_threshold_credits") + public Optional getAutoTopupThresholdCredits() { + return autoTopupThresholdCredits; + } + @JsonProperty("auto_topup_threshold_percent") public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; @@ -183,6 +192,7 @@ private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { && autoTopupExpiryType.equals(other.autoTopupExpiryType) && autoTopupExpiryUnit.equals(other.autoTopupExpiryUnit) && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) + && autoTopupThresholdCredits.equals(other.autoTopupThresholdCredits) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && creditAmount.equals(other.creditAmount) && expiryType.equals(other.expiryType) @@ -203,6 +213,7 @@ public int hashCode() { this.autoTopupExpiryType, this.autoTopupExpiryUnit, this.autoTopupExpiryUnitCount, + this.autoTopupThresholdCredits, this.autoTopupThresholdPercent, this.creditAmount, this.expiryType, @@ -267,6 +278,10 @@ public interface _FinalStage { _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount); + _FinalStage autoTopupThresholdCredits(Optional autoTopupThresholdCredits); + + _FinalStage autoTopupThresholdCredits(Long autoTopupThresholdCredits); + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); @@ -310,6 +325,8 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private Optional autoTopupThresholdPercent = Optional.empty(); + private Optional autoTopupThresholdCredits = Optional.empty(); + private Optional autoTopupExpiryUnitCount = Optional.empty(); private Optional autoTopupExpiryUnit = Optional.empty(); @@ -338,6 +355,7 @@ public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { autoTopupExpiryType(other.getAutoTopupExpiryType()); autoTopupExpiryUnit(other.getAutoTopupExpiryUnit()); autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); + autoTopupThresholdCredits(other.getAutoTopupThresholdCredits()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); creditAmount(other.getCreditAmount()); expiryType(other.getExpiryType()); @@ -441,6 +459,19 @@ public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPe return this; } + @java.lang.Override + public _FinalStage autoTopupThresholdCredits(Long autoTopupThresholdCredits) { + this.autoTopupThresholdCredits = Optional.ofNullable(autoTopupThresholdCredits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_threshold_credits", nulls = Nulls.SKIP) + public _FinalStage autoTopupThresholdCredits(Optional autoTopupThresholdCredits) { + this.autoTopupThresholdCredits = autoTopupThresholdCredits; + return this; + } + @java.lang.Override public _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount) { this.autoTopupExpiryUnitCount = Optional.ofNullable(autoTopupExpiryUnitCount); @@ -542,6 +573,7 @@ public UpdateBillingPlanCreditGrantRequestBody build() { autoTopupExpiryType, autoTopupExpiryUnit, autoTopupExpiryUnitCount, + autoTopupThresholdCredits, autoTopupThresholdPercent, creditAmount, expiryType, diff --git a/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java b/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java index 1a63a28..8db5ef1 100644 --- a/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java @@ -23,7 +23,7 @@ public final class UpdatePlanRequestBody { private final Optional description; - private final Optional icon; + private final Optional icon; private final String name; @@ -31,7 +31,7 @@ public final class UpdatePlanRequestBody { private UpdatePlanRequestBody( Optional description, - Optional icon, + Optional icon, String name, Map additionalProperties) { this.description = description; @@ -46,7 +46,7 @@ public Optional getDescription() { } @JsonProperty("icon") - public Optional getIcon() { + public Optional getIcon() { return icon; } @@ -101,16 +101,16 @@ public interface _FinalStage { _FinalStage description(String description); - _FinalStage icon(Optional icon); + _FinalStage icon(Optional icon); - _FinalStage icon(String icon); + _FinalStage icon(PlanIcon icon); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; - private Optional icon = Optional.empty(); + private Optional icon = Optional.empty(); private Optional description = Optional.empty(); @@ -135,14 +135,14 @@ public _FinalStage name(@NotNull String name) { } @java.lang.Override - public _FinalStage icon(String icon) { + public _FinalStage icon(PlanIcon icon) { this.icon = Optional.ofNullable(icon); return this; } @java.lang.Override @JsonSetter(value = "icon", nulls = Nulls.SKIP) - public _FinalStage icon(Optional icon) { + public _FinalStage icon(Optional icon) { this.icon = icon; return this; } diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java index 66d3f77..1f1255b 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java @@ -27,6 +27,8 @@ public final class UsageBasedEntitlementRequestBody { private final Optional currency; + private final Optional> currencyPrices; + private final Optional monthlyMeteredPriceId; private final Optional> monthlyPriceTiers; @@ -59,6 +61,7 @@ private UsageBasedEntitlementRequestBody( Optional billingProductId, Optional billingThreshold, Optional currency, + Optional> currencyPrices, Optional monthlyMeteredPriceId, Optional> monthlyPriceTiers, Optional monthlyUnitPrice, @@ -76,6 +79,7 @@ private UsageBasedEntitlementRequestBody( this.billingProductId = billingProductId; this.billingThreshold = billingThreshold; this.currency = currency; + this.currencyPrices = currencyPrices; this.monthlyMeteredPriceId = monthlyMeteredPriceId; this.monthlyPriceTiers = monthlyPriceTiers; this.monthlyUnitPrice = monthlyUnitPrice; @@ -107,6 +111,11 @@ public Optional getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("monthly_metered_price_id") public Optional getMonthlyMeteredPriceId() { return monthlyMeteredPriceId; @@ -190,6 +199,7 @@ private boolean equalTo(UsageBasedEntitlementRequestBody other) { return billingProductId.equals(other.billingProductId) && billingThreshold.equals(other.billingThreshold) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && monthlyMeteredPriceId.equals(other.monthlyMeteredPriceId) && monthlyPriceTiers.equals(other.monthlyPriceTiers) && monthlyUnitPrice.equals(other.monthlyUnitPrice) @@ -211,6 +221,7 @@ public int hashCode() { this.billingProductId, this.billingThreshold, this.currency, + this.currencyPrices, this.monthlyMeteredPriceId, this.monthlyPriceTiers, this.monthlyUnitPrice, @@ -243,6 +254,8 @@ public static final class Builder { private Optional currency = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional monthlyMeteredPriceId = Optional.empty(); private Optional> monthlyPriceTiers = Optional.empty(); @@ -278,6 +291,7 @@ public Builder from(UsageBasedEntitlementRequestBody other) { billingProductId(other.getBillingProductId()); billingThreshold(other.getBillingThreshold()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); monthlyMeteredPriceId(other.getMonthlyMeteredPriceId()); monthlyPriceTiers(other.getMonthlyPriceTiers()); monthlyUnitPrice(other.getMonthlyUnitPrice()); @@ -327,6 +341,17 @@ public Builder currency(String currency) { return this; } + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public Builder currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + + public Builder currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + @JsonSetter(value = "monthly_metered_price_id", nulls = Nulls.SKIP) public Builder monthlyMeteredPriceId(Optional monthlyMeteredPriceId) { this.monthlyMeteredPriceId = monthlyMeteredPriceId; @@ -478,6 +503,7 @@ public UsageBasedEntitlementRequestBody build() { billingProductId, billingThreshold, currency, + currencyPrices, monthlyMeteredPriceId, monthlyPriceTiers, monthlyUnitPrice, diff --git a/src/main/java/com/schematic/api/types/WebhookUrl.java b/src/main/java/com/schematic/api/types/WebhookUrl.java new file mode 100644 index 0000000..98436d6 --- /dev/null +++ b/src/main/java/com/schematic/api/types/WebhookUrl.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WebhookUrl.Builder.class) +public final class WebhookUrl { + private final IntegrationType type; + + private final String url; + + private final Map additionalProperties; + + private WebhookUrl(IntegrationType type, String url, Map additionalProperties) { + this.type = type; + this.url = url; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public IntegrationType getType() { + return type; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WebhookUrl && equalTo((WebhookUrl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WebhookUrl other) { + return type.equals(other.type) && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + UrlStage type(@NotNull IntegrationType type); + + Builder from(WebhookUrl other); + } + + public interface UrlStage { + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + WebhookUrl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, UrlStage, _FinalStage { + private IntegrationType type; + + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WebhookUrl other) { + type(other.getType()); + url(other.getUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public UrlStage type(@NotNull IntegrationType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + @java.lang.Override + public WebhookUrl build() { + return new WebhookUrl(type, url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +}