diff --git a/.fernignore b/.fernignore index f34ea1d..b2e9f70 100644 --- a/.fernignore +++ b/.fernignore @@ -2,6 +2,7 @@ CLAUDE.md LICENSE README.md +.github/CODEOWNERS src/main/java/com/schematic/api/BaseSchematic.java src/main/java/com/schematic/api/EventBuffer.java src/main/java/com/schematic/api/Schematic.java diff --git a/build.gradle b/build.gradle index 1d74354..e1ffc06 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ java { group = 'com.schematichq' -version = '1.2.0' +version = '1.3.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -80,7 +80,7 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.2.0' + version = '1.3.0' from components.java pom { name = 'schematic' diff --git a/reference.md b/reference.md index 4960436..0d60eec 100644 --- a/reference.md +++ b/reference.md @@ -624,6 +624,208 @@ client.accounts().countApiRequests( + + + + +
client.accounts.listAuditLogs() -> ListAuditLogsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().listAuditLogs( + ListAuditLogsRequest + .builder() + .actorType(ActorType.API_KEY) + .environmentId("environment_id") + .q("q") + .limit(1) + .offset(1) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**actorType:** `Optional` + +
+
+ +
+
+ +**environmentId:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ + +
+
+
+ +
client.accounts.getAuditLog(auditLogId) -> GetAuditLogResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().getAuditLog("audit_log_id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**auditLogId:** `String` — audit_log_id + +
+
+
+
+ + +
+
+
+ +
client.accounts.countAuditLogs() -> CountAuditLogsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().countAuditLogs( + CountAuditLogsRequest + .builder() + .actorType(ActorType.API_KEY) + .environmentId("environment_id") + .q("q") + .limit(1) + .offset(1) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**actorType:** `Optional` + +
+
+ +
+
+ +**environmentId:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ +
@@ -706,7 +908,7 @@ client.accounts().listEnvironments( client.accounts().createEnvironment( CreateEnvironmentRequestBody .builder() - .environmentType(CreateEnvironmentRequestBodyEnvironmentType.DEVELOPMENT) + .environmentType(EnvironmentType.DEVELOPMENT) .name("name") .build() ); @@ -724,7 +926,7 @@ client.accounts().createEnvironment(
-**environmentType:** `CreateEnvironmentRequestBodyEnvironmentType` +**environmentType:** `EnvironmentType`
@@ -825,7 +1027,7 @@ client.accounts().updateEnvironment(
-**environmentType:** `Optional` +**environmentType:** `Optional`
@@ -1117,7 +1319,6 @@ client.billing().upsertBillingCustomer( .builder() .email("email") .externalId("external_id") - .failedToImport(true) .meta( new HashMap() {{ put("key", "value"); @@ -1172,7 +1373,7 @@ client.billing().upsertBillingCustomer(
-**failedToImport:** `Boolean` +**meta:** `Map`
@@ -1180,7 +1381,7 @@ client.billing().upsertBillingCustomer(
-**meta:** `Map` +**name:** `String`
@@ -1188,7 +1389,7 @@ client.billing().upsertBillingCustomer(
-**name:** `String` +**providerType:** `Optional`
@@ -1217,7 +1418,7 @@ client.billing().listCustomersWithSubscriptions( ListCustomersWithSubscriptionsRequest .builder() .name("name") - .failedToImport(true) + .providerType(BillingProviderType.SCHEMATIC) .q("q") .limit(1) .offset(1) @@ -1253,7 +1454,7 @@ client.billing().listCustomersWithSubscriptions(
-**failedToImport:** `Optional` +**providerType:** `Optional`
@@ -1306,7 +1507,7 @@ client.billing().countCustomers( CountCustomersRequest .builder() .name("name") - .failedToImport(true) + .providerType(BillingProviderType.SCHEMATIC) .q("q") .limit(1) .offset(1) @@ -1342,7 +1543,7 @@ client.billing().countCustomers(
-**failedToImport:** `Optional` +**providerType:** `Optional`
@@ -1940,7 +2141,7 @@ client.billing().upsertPaymentMethod( -
client.billing.searchBillingPrices() -> SearchBillingPricesResponse +
client.billing.listBillingPrices() -> ListBillingPricesResponse
@@ -1953,18 +2154,20 @@ client.billing().upsertPaymentMethod(
```java -client.billing().searchBillingPrices( - SearchBillingPricesRequest +client.billing().listBillingPrices( + ListBillingPricesRequest .builder() .forInitialPlan(true) .forTrialExpiryPlan(true) - .productId("product_id") .interval("interval") + .isActive(true) .price(1) + .productId("product_id") + .providerType(BillingProviderType.SCHEMATIC) .q("q") - .requiresPaymentMethod(true) - .tiersMode(SearchBillingPricesRequestTiersMode.VOLUME) - .usageType(SearchBillingPricesRequestUsageType.LICENSED) + .tiersMode(BillingTiersMode.GRADUATED) + .usageType(BillingPriceUsageType.LICENSED) + .withMeter(true) .limit(1) .offset(1) .build() @@ -2007,7 +2210,7 @@ client.billing().searchBillingPrices(
-**productId:** `Optional` +**interval:** `Optional`
@@ -2015,7 +2218,7 @@ client.billing().searchBillingPrices(
-**interval:** `Optional` +**isActive:** `Optional` — Filter for active prices on active products (defaults to true if not specified)
@@ -2031,6 +2234,30 @@ client.billing().searchBillingPrices(
+**productId:** `Optional` + +
+
+ +
+
+ +**productIds:** `Optional` + +
+
+ +
+
+ +**providerType:** `Optional` + +
+
+ +
+
+ **q:** `Optional`
@@ -2039,7 +2266,7 @@ client.billing().searchBillingPrices(
-**requiresPaymentMethod:** `Optional` — Filter for prices that require a payment method (inverse of ForInitialPlan) +**tiersMode:** `Optional`
@@ -2047,7 +2274,7 @@ client.billing().searchBillingPrices(
-**tiersMode:** `Optional` +**usageType:** `Optional`
@@ -2055,7 +2282,7 @@ client.billing().searchBillingPrices(
-**usageType:** `Optional` +**withMeter:** `Optional` — Filter for prices with a meter
@@ -2099,7 +2326,7 @@ client.billing().searchBillingPrices( client.billing().upsertBillingPrice( CreateBillingPriceRequestBody .builder() - .billingScheme(CreateBillingPriceRequestBodyBillingScheme.PER_UNIT) + .billingScheme(BillingPriceScheme.PER_UNIT) .currency("currency") .externalAccountId("external_account_id") .interval("interval") @@ -2115,7 +2342,7 @@ client.billing().upsertBillingPrice( ) ) .productExternalId("product_external_id") - .usageType(CreateBillingPriceRequestBodyUsageType.LICENSED) + .usageType(BillingPriceUsageType.LICENSED) .build() ); ``` @@ -2132,7 +2359,7 @@ client.billing().upsertBillingPrice(
-**billingScheme:** `CreateBillingPriceRequestBodyBillingScheme` +**billingScheme:** `BillingPriceScheme`
@@ -2228,7 +2455,15 @@ client.billing().upsertBillingPrice(
-**tiersMode:** `Optional` +**providerType:** `Optional` + +
+
+ +
+
+ +**tiersMode:** `Optional`
@@ -2236,7 +2471,7 @@ client.billing().upsertBillingPrice(
-**usageType:** `CreateBillingPriceRequestBodyUsageType` +**usageType:** `BillingPriceUsageType`
@@ -2288,7 +2523,7 @@ client.billing().deleteBillingProduct("billing_id");
-
client.billing.listProductPrices() -> ListProductPricesResponse +
client.billing.listBillingProductPrices() -> ListBillingProductPricesResponse
@@ -2301,17 +2536,20 @@ client.billing().deleteBillingProduct("billing_id");
```java -client.billing().listProductPrices( - ListProductPricesRequest +client.billing().listBillingProductPrices( + ListBillingProductPricesRequest .builder() - .name("name") - .q("q") - .priceUsageType(ListProductPricesRequestPriceUsageType.LICENSED) - .withoutLinkedToPlan(true) - .withOneTimeCharges(true) - .withZeroPrice(true) - .withPricesOnly(true) + .forInitialPlan(true) + .forTrialExpiryPlan(true) + .interval("interval") .isActive(true) + .price(1) + .productId("product_id") + .providerType(BillingProviderType.SCHEMATIC) + .q("q") + .tiersMode(BillingTiersMode.GRADUATED) + .usageType(BillingPriceUsageType.LICENSED) + .withMeter(true) .limit(1) .offset(1) .build() @@ -2330,7 +2568,7 @@ client.billing().listProductPrices(
-**ids:** `Optional` +**forInitialPlan:** `Optional` — Filter for prices valid for initial plans (free prices only)
@@ -2338,7 +2576,7 @@ client.billing().listProductPrices(
-**name:** `Optional` +**forTrialExpiryPlan:** `Optional` — Filter for prices valid for trial expiry plans (free prices only)
@@ -2346,7 +2584,7 @@ client.billing().listProductPrices(
-**q:** `Optional` +**ids:** `Optional`
@@ -2354,7 +2592,7 @@ client.billing().listProductPrices(
-**priceUsageType:** `Optional` +**interval:** `Optional`
@@ -2362,7 +2600,7 @@ client.billing().listProductPrices(
-**withoutLinkedToPlan:** `Optional` — Filter products that are not linked to any plan +**isActive:** `Optional` — Filter for active prices on active products (defaults to true if not specified)
@@ -2370,7 +2608,7 @@ client.billing().listProductPrices(
-**withOneTimeCharges:** `Optional` — Filter products that are one time charges +**price:** `Optional`
@@ -2378,7 +2616,7 @@ client.billing().listProductPrices(
-**withZeroPrice:** `Optional` — Filter products that have zero price for free subscription type +**productId:** `Optional`
@@ -2386,7 +2624,7 @@ client.billing().listProductPrices(
-**withPricesOnly:** `Optional` — Filter products that have prices +**productIds:** `Optional`
@@ -2394,7 +2632,7 @@ client.billing().listProductPrices(
-**isActive:** `Optional` — Filter products that are active +**providerType:** `Optional`
@@ -2402,7 +2640,7 @@ client.billing().listProductPrices(
-**limit:** `Optional` — Page limit (default 100) +**q:** `Optional`
@@ -2410,7 +2648,39 @@ client.billing().listProductPrices(
-**offset:** `Optional` — Page offset (default 0) +**tiersMode:** `Optional` + +
+
+ +
+
+ +**usageType:** `Optional` + +
+
+ +
+
+ +**withMeter:** `Optional` — Filter for prices with a meter + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0)
@@ -2523,6 +2793,14 @@ client.billing().upsertBillingProduct( **price:** `Double` +
+
+ +
+
+ +**providerType:** `Optional` +
@@ -2549,14 +2827,15 @@ client.billing().upsertBillingProduct( client.billing().listBillingProducts( ListBillingProductsRequest .builder() + .isActive(true) .name("name") + .priceUsageType(BillingPriceUsageType.LICENSED) + .providerType(BillingProviderType.SCHEMATIC) .q("q") - .priceUsageType(ListBillingProductsRequestPriceUsageType.LICENSED) - .withoutLinkedToPlan(true) .withOneTimeCharges(true) - .withZeroPrice(true) .withPricesOnly(true) - .isActive(true) + .withZeroPrice(true) + .withoutLinkedToPlan(true) .limit(1) .offset(1) .build() @@ -2583,6 +2862,14 @@ client.billing().listBillingProducts(
+**isActive:** `Optional` — Filter products that are active. Defaults to true if not specified + +
+
+ +
+
+ **name:** `Optional`
@@ -2591,7 +2878,7 @@ client.billing().listBillingProducts(
-**q:** `Optional` +**priceUsageType:** `Optional`
@@ -2599,7 +2886,7 @@ client.billing().listBillingProducts(
-**priceUsageType:** `Optional` +**providerType:** `Optional`
@@ -2607,7 +2894,7 @@ client.billing().listBillingProducts(
-**withoutLinkedToPlan:** `Optional` — Filter products that are not linked to any plan +**q:** `Optional`
@@ -2623,7 +2910,7 @@ client.billing().listBillingProducts(
-**withZeroPrice:** `Optional` — Filter products that have zero price for free subscription type +**withPricesOnly:** `Optional` — Filter products that have prices
@@ -2631,7 +2918,7 @@ client.billing().listBillingProducts(
-**withPricesOnly:** `Optional` — Filter products that have prices +**withZeroPrice:** `Optional` — Filter products that have zero price for free subscription type
@@ -2639,7 +2926,7 @@ client.billing().listBillingProducts(
-**isActive:** `Optional` — Filter products that are active +**withoutLinkedToPlan:** `Optional` — Filter products that are not linked to any plan
@@ -2683,14 +2970,15 @@ client.billing().listBillingProducts( client.billing().countBillingProducts( CountBillingProductsRequest .builder() + .isActive(true) .name("name") + .priceUsageType(BillingPriceUsageType.LICENSED) + .providerType(BillingProviderType.SCHEMATIC) .q("q") - .priceUsageType(CountBillingProductsRequestPriceUsageType.LICENSED) - .withoutLinkedToPlan(true) .withOneTimeCharges(true) - .withZeroPrice(true) .withPricesOnly(true) - .isActive(true) + .withZeroPrice(true) + .withoutLinkedToPlan(true) .limit(1) .offset(1) .build() @@ -2717,6 +3005,14 @@ client.billing().countBillingProducts(
+**isActive:** `Optional` — Filter products that are active. Defaults to true if not specified + +
+
+ +
+
+ **name:** `Optional`
@@ -2725,7 +3021,7 @@ client.billing().countBillingProducts(
-**q:** `Optional` +**priceUsageType:** `Optional`
@@ -2733,7 +3029,7 @@ client.billing().countBillingProducts(
-**priceUsageType:** `Optional` +**providerType:** `Optional`
@@ -2741,7 +3037,7 @@ client.billing().countBillingProducts(
-**withoutLinkedToPlan:** `Optional` — Filter products that are not linked to any plan +**q:** `Optional`
@@ -2757,7 +3053,7 @@ client.billing().countBillingProducts(
-**withZeroPrice:** `Optional` — Filter products that have zero price for free subscription type +**withPricesOnly:** `Optional` — Filter products that have prices
@@ -2765,7 +3061,7 @@ client.billing().countBillingProducts(
-**withPricesOnly:** `Optional` — Filter products that have prices +**withZeroPrice:** `Optional` — Filter products that have zero price for free subscription type
@@ -2773,7 +3069,7 @@ client.billing().countBillingProducts(
-**isActive:** `Optional` — Filter products that are active +**withoutLinkedToPlan:** `Optional` — Filter products that are not linked to any plan
@@ -2842,7 +3138,7 @@ client.billing().upsertBillingSubscription( .priceExternalId("price_external_id") .productExternalId("product_external_id") .quantity(1) - .usageType(BillingProductPricingUsageType.LICENSED) + .usageType(BillingPriceUsageType.LICENSED) .build() ) ) @@ -2864,6 +3160,14 @@ client.billing().upsertBillingSubscription(
+**applicationId:** `Optional` + +
+
+ +
+
+ **cancelAt:** `Optional`
@@ -3000,7 +3304,7 @@ client.billing().upsertBillingSubscription(
-**trialEndSetting:** `Optional` +**trialEndSetting:** `Optional`
@@ -3119,7 +3423,7 @@ client.credits().createBillingCredit(
-**burnStrategy:** `Optional` +**burnStrategy:** `Optional`
@@ -3135,7 +3439,7 @@ client.credits().createBillingCredit(
-**defaultExpiryUnit:** `Optional` +**defaultExpiryUnit:** `Optional`
@@ -3151,7 +3455,7 @@ client.credits().createBillingCredit(
-**defaultRolloverPolicy:** `Optional` +**defaultRolloverPolicy:** `Optional`
@@ -3302,7 +3606,7 @@ client.credits().updateBillingCredit(
-**burnStrategy:** `Optional` +**burnStrategy:** `Optional`
@@ -3310,7 +3614,7 @@ client.credits().updateBillingCredit(
-**defaultExpiryUnit:** `Optional` +**defaultExpiryUnit:** `Optional`
@@ -3326,7 +3630,7 @@ client.credits().updateBillingCredit(
-**defaultRolloverPolicy:** `Optional` +**defaultRolloverPolicy:** `Optional`
@@ -3451,7 +3755,7 @@ client.credits().listCreditBundles( ListCreditBundlesRequest .builder() .creditId("credit_id") - .status(ListCreditBundlesRequestStatus.ACTIVE) + .status(BillingCreditBundleStatus.ACTIVE) .bundleType("fixed") .limit(1) .offset(1) @@ -3487,7 +3791,7 @@ client.credits().listCreditBundles(
-**status:** `Optional` +**status:** `Optional`
@@ -3591,7 +3895,7 @@ client.credits().createCreditBundle(
-**expiryType:** `Optional` +**expiryType:** `Optional`
@@ -3599,7 +3903,7 @@ client.credits().createCreditBundle(
-**expiryUnit:** `Optional` +**expiryUnit:** `Optional`
@@ -3639,7 +3943,7 @@ client.credits().createCreditBundle(
-**status:** `Optional` +**status:** `Optional`
@@ -3742,7 +4046,7 @@ client.credits().updateCreditBundleDetails(
-**expiryType:** `Optional` +**expiryType:** `Optional`
@@ -3750,7 +4054,7 @@ client.credits().updateCreditBundleDetails(
-**expiryUnit:** `Optional` +**expiryUnit:** `Optional`
@@ -3790,7 +4094,7 @@ client.credits().updateCreditBundleDetails(
-**status:** `Optional` +**status:** `Optional`
@@ -3859,7 +4163,7 @@ client.credits().countCreditBundles( CountCreditBundlesRequest .builder() .creditId("credit_id") - .status(CountCreditBundlesRequestStatus.ACTIVE) + .status(BillingCreditBundleStatus.ACTIVE) .bundleType("fixed") .limit(1) .offset(1) @@ -3895,7 +4199,7 @@ client.credits().countCreditBundles(
-**status:** `Optional` +**status:** `Optional`
@@ -4043,7 +4347,7 @@ client.credits().zeroOutGrant(
-**reason:** `Optional` +**reason:** `Optional`
@@ -4074,7 +4378,7 @@ client.credits().grantBillingCreditsToCompany( .companyId("company_id") .creditId("credit_id") .quantity(1) - .reason("reason") + .reason(BillingCreditGrantReason.BILLING_CREDIT_AUTO_TOPUP) .build() ); ``` @@ -4123,7 +4427,7 @@ client.credits().grantBillingCreditsToCompany(
-**expiryType:** `Optional` +**expiryType:** `Optional`
@@ -4131,7 +4435,7 @@ client.credits().grantBillingCreditsToCompany(
-**expiryUnit:** `Optional` +**expiryUnit:** `Optional`
@@ -4155,7 +4459,104 @@ client.credits().grantBillingCreditsToCompany(
-**reason:** `String` +**reason:** `BillingCreditGrantReason` + +
+
+ +
+
+ +**renewalEnabled:** `Optional` + +
+
+ +
+
+ +**renewalPeriod:** `Optional` + +
+
+ +
+ + + +
+
+ +
client.credits.countCompanyGrants() -> CountCompanyGrantsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.credits().countCompanyGrants( + CountCompanyGrantsRequest + .builder() + .companyId("company_id") + .order(CreditGrantSortOrder.CREATED_AT) + .dir(SortDirection.ASC) + .limit(1) + .offset(1) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `Optional` + +
+
+ +
+
+ +**order:** `Optional` + +
+
+ +
+
+ +**dir:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0)
@@ -4184,8 +4585,8 @@ client.credits().listCompanyGrants( ListCompanyGrantsRequest .builder() .companyId("company_id") - .order(ListCompanyGrantsRequestOrder.CREATED_AT) - .dir(ListCompanyGrantsRequestDir.ASC) + .order(CreditGrantSortOrder.CREATED_AT) + .dir(SortDirection.ASC) .limit(1) .offset(1) .build() @@ -4212,7 +4613,7 @@ client.credits().listCompanyGrants(
-**order:** `Optional` +**order:** `Optional`
@@ -4220,7 +4621,7 @@ client.credits().listCompanyGrants(
-**dir:** `Optional` +**dir:** `Optional`
@@ -4407,7 +4808,7 @@ client.credits().getEnrichedCreditLedger( GetEnrichedCreditLedgerRequest .builder() .companyId("company_id") - .period(GetEnrichedCreditLedgerRequestPeriod.DAILY) + .period(CreditLedgerPeriod.DAILY) .billingCreditId("billing_credit_id") .featureId("feature_id") .startTime("start_time") @@ -4454,7 +4855,7 @@ client.credits().getEnrichedCreditLedger(
-**period:** `GetEnrichedCreditLedgerRequestPeriod` +**period:** `CreditLedgerPeriod`
@@ -4515,7 +4916,7 @@ client.credits().countCreditLedger( CountCreditLedgerRequest .builder() .companyId("company_id") - .period(CountCreditLedgerRequestPeriod.DAILY) + .period(CreditLedgerPeriod.DAILY) .billingCreditId("billing_credit_id") .featureId("feature_id") .startTime("start_time") @@ -4562,7 +4963,7 @@ client.credits().countCreditLedger(
-**period:** `CountCreditLedgerRequestPeriod` +**period:** `CreditLedgerPeriod`
@@ -4713,8 +5114,8 @@ client.credits().createBillingPlanCreditGrant( .creditAmount(1) .creditId("credit_id") .planId("plan_id") - .resetCadence(CreateBillingPlanCreditGrantRequestBodyResetCadence.MONTHLY) - .resetStart(CreateBillingPlanCreditGrantRequestBodyResetStart.BILLING_PERIOD) + .resetCadence(BillingPlanCreditGrantResetCadence.DAILY) + .resetStart(BillingPlanCreditGrantResetStart.BILLING_PERIOD) .build() ); ``` @@ -4731,71 +5132,54 @@ client.credits().createBillingPlanCreditGrant(
-**applyToExisting:** `Optional` +**request:** `CreateBillingPlanCreditGrantRequestBody`
- -
-
- -**creditAmount:** `Integer` -
-
-
-**creditId:** `String` -
+
+
client.credits.updateBillingPlanCreditGrant(planGrantId, request) -> UpdateBillingPlanCreditGrantResponse
-**expiryType:** `Optional` - -
-
+#### 🔌 Usage
-**expiryUnit:** `Optional` - -
-
-
-**expiryUnitCount:** `Optional` - +```java +client.credits().updateBillingPlanCreditGrant( + "plan_grant_id", + UpdateBillingPlanCreditGrantRequestBody + .builder() + .resetCadence(BillingPlanCreditGrantResetCadence.DAILY) + .resetStart(BillingPlanCreditGrantResetStart.BILLING_PERIOD) + .build() +); +```
- -
-
- -**planId:** `String` -
+#### ⚙️ Parameters +
-**resetCadence:** `CreateBillingPlanCreditGrantRequestBodyResetCadence` - -
-
-
-**resetStart:** `CreateBillingPlanCreditGrantRequestBodyResetStart` +**planGrantId:** `String` — plan_grant_id
@@ -4803,7 +5187,7 @@ client.credits().createBillingPlanCreditGrant(
-**resetType:** `Optional` +**request:** `UpdateBillingPlanCreditGrantRequestBody`
@@ -4815,7 +5199,7 @@ client.credits().createBillingPlanCreditGrant(
-
client.credits.updateBillingPlanCreditGrant(planGrantId, request) -> UpdateBillingPlanCreditGrantResponse +
client.credits.deleteBillingPlanCreditGrant(planGrantId) -> DeleteBillingPlanCreditGrantResponse
@@ -4828,12 +5212,11 @@ client.credits().createBillingPlanCreditGrant(
```java -client.credits().updateBillingPlanCreditGrant( +client.credits().deleteBillingPlanCreditGrant( "plan_grant_id", - UpdateBillingPlanCreditGrantRequestBody + DeleteBillingPlanCreditGrantRequest .builder() - .resetCadence(UpdateBillingPlanCreditGrantRequestBodyResetCadence.MONTHLY) - .resetStart(UpdateBillingPlanCreditGrantRequestBodyResetStart.BILLING_PERIOD) + .applyToExisting(true) .build() ); ``` @@ -4862,153 +5245,43 @@ client.credits().updateBillingPlanCreditGrant(
+ + -
-
-**creditAmount:** `Optional` -
+
+
client.credits.countBillingPlanCreditGrants() -> CountBillingPlanCreditGrantsResponse
-**expiryType:** `Optional` - -
-
+#### 🔌 Usage
-**expiryUnit:** `Optional` - -
-
-
-**expiryUnitCount:** `Optional` - +```java +client.credits().countBillingPlanCreditGrants( + CountBillingPlanCreditGrantsRequest + .builder() + .creditId("credit_id") + .planId("plan_id") + .limit(1) + .offset(1) + .build() +); +```
- -
-
- -**resetCadence:** `UpdateBillingPlanCreditGrantRequestBodyResetCadence` - -
-
- -
-
- -**resetStart:** `UpdateBillingPlanCreditGrantRequestBodyResetStart` - -
-
- -
-
- -**resetType:** `Optional` - -
-
- - - - - - -
- -
client.credits.deleteBillingPlanCreditGrant(planGrantId) -> DeleteBillingPlanCreditGrantResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.credits().deleteBillingPlanCreditGrant( - "plan_grant_id", - DeleteBillingPlanCreditGrantRequest - .builder() - .applyToExisting(true) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**planGrantId:** `String` — plan_grant_id - -
-
- -
-
- -**applyToExisting:** `Optional` - -
-
-
-
- - -
-
-
- -
client.credits.countBillingPlanCreditGrants() -> CountBillingPlanCreditGrantsResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.credits().countBillingPlanCreditGrants( - CountBillingPlanCreditGrantsRequest - .builder() - .creditId("credit_id") - .planId("plan_id") - .limit(1) - .offset(1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters +
+
+ +#### ⚙️ Parameters
@@ -5410,6 +5683,67 @@ client.checkout().previewManagePlan(
+ + +
+ +
client.checkout.cancelSubscription(request) -> CancelSubscriptionResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkout().cancelSubscription( + CancelSubscriptionRequest + .builder() + .companyId("company_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cancelImmediately:** `Optional` — If false, subscription cancels at period end. Defaults to true. + +
+
+ +
+
+ +**companyId:** `String` + +
+
+ +
+
+ +**prorate:** `Optional` — If true and cancel_immediately is true, issue prorated credit. Defaults to true. + +
+
+
+
+ +
@@ -5484,10 +5818,14 @@ client.checkout().updateCustomerSubscriptionTrialEnd( client.companies().listCompanies( ListCompaniesRequest .builder() + .monetizedSubscriptions(true) .planId("plan_id") .q("q") + .sortOrderColumn("sort_order_column") + .sortOrderDirection(SortDirection.ASC) .withoutFeatureOverrideFor("without_feature_override_for") .withoutPlan(true) + .withoutSubscription(true) .withSubscription(true) .limit(1) .offset(1) @@ -5507,6 +5845,14 @@ client.companies().listCompanies(
+**creditTypeIds:** `Optional` — Filter companies by one or more credit type IDs (each ID starts with bcrd_) + +
+
+ +
+
+ **ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_)
@@ -5515,6 +5861,14 @@ client.companies().listCompanies(
+**monetizedSubscriptions:** `Optional` — Filter companies that have monetized subscriptions + +
+
+ +
+
+ **planId:** `Optional` — Filter companies by plan ID (starts with plan_)
@@ -5523,6 +5877,14 @@ client.companies().listCompanies(
+**planIds:** `Optional` — Filter companies by one or more plan IDs (each ID starts with plan_) + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -5531,6 +5893,38 @@ client.companies().listCompanies(
+**sortOrderColumn:** `Optional` — Column to sort by (e.g. name, created_at, last_seen_at) + +
+
+ +
+
+ +**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc) + +
+
+ +
+
+ +**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses + +
+
+ +
+
+ +**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types + +
+
+ +
+
+ **withoutFeatureOverrideFor:** `Optional` — Filter out companies that already have a company override for the specified feature ID
@@ -5547,6 +5941,14 @@ client.companies().listCompanies(
+**withoutSubscription:** `Optional` — Filter out companies that have a subscription + +
+
+ +
+
+ **withSubscription:** `Optional` — Filter companies that have a subscription
@@ -5677,7 +6079,14 @@ client.companies().getCompany("company_id");
```java -client.companies().deleteCompany("company_id"); +client.companies().deleteCompany( + "company_id", + DeleteCompanyRequest + .builder() + .cancelSubscription(true) + .prorate(true) + .build() +); ```
@@ -5694,6 +6103,22 @@ client.companies().deleteCompany("company_id"); **companyId:** `String` — company_id + +
+ +
+
+ +**cancelSubscription:** `Optional` + +
+
+ +
+
+ +**prorate:** `Optional` +
@@ -5720,10 +6145,14 @@ client.companies().deleteCompany("company_id"); client.companies().countCompanies( CountCompaniesRequest .builder() + .monetizedSubscriptions(true) .planId("plan_id") .q("q") + .sortOrderColumn("sort_order_column") + .sortOrderDirection(SortDirection.ASC) .withoutFeatureOverrideFor("without_feature_override_for") .withoutPlan(true) + .withoutSubscription(true) .withSubscription(true) .limit(1) .offset(1) @@ -5743,7 +6172,7 @@ client.companies().countCompanies(
-**ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_) +**creditTypeIds:** `Optional` — Filter companies by one or more credit type IDs (each ID starts with bcrd_)
@@ -5751,7 +6180,31 @@ client.companies().countCompanies(
-**planId:** `Optional` — Filter companies by plan ID (starts with plan_) +**ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_) + +
+
+ +
+
+ +**monetizedSubscriptions:** `Optional` — Filter companies that have monetized subscriptions + +
+
+ +
+
+ +**planId:** `Optional` — Filter companies by plan ID (starts with plan_) + +
+
+ +
+
+ +**planIds:** `Optional` — Filter companies by one or more plan IDs (each ID starts with plan_)
@@ -5767,6 +6220,38 @@ client.companies().countCompanies(
+**sortOrderColumn:** `Optional` — Column to sort by (e.g. name, created_at, last_seen_at) + +
+
+ +
+
+ +**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc) + +
+
+ +
+
+ +**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses + +
+
+ +
+
+ +**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types + +
+
+ +
+
+ **withoutFeatureOverrideFor:** `Optional` — Filter out companies that already have a company override for the specified feature ID
@@ -5783,6 +6268,14 @@ client.companies().countCompanies(
+**withoutSubscription:** `Optional` — Filter out companies that have a subscription + +
+
+ +
+
+ **withSubscription:** `Optional` — Filter companies that have a subscription
@@ -5832,7 +6325,7 @@ client.companies().countCompaniesForAdvancedFilter( .withoutPlan(true) .withoutSubscription(true) .sortOrderColumn("sort_order_column") - .sortOrderDirection(CountCompaniesForAdvancedFilterRequestSortOrderDirection.ASC) + .sortOrderDirection(SortDirection.ASC) .limit(1) .offset(1) .build() @@ -5883,7 +6376,7 @@ client.companies().countCompaniesForAdvancedFilter(
-**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) +**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)
@@ -5891,7 +6384,7 @@ client.companies().countCompaniesForAdvancedFilter(
-**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types (paid, free, trial) +**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types (paid, free, trial)
@@ -5939,7 +6432,7 @@ client.companies().countCompaniesForAdvancedFilter(
-**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc) +**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc)
@@ -6094,7 +6587,7 @@ client.companies().listCompaniesForAdvancedFilter( .withoutPlan(true) .withoutSubscription(true) .sortOrderColumn("sort_order_column") - .sortOrderDirection(ListCompaniesForAdvancedFilterRequestSortOrderDirection.ASC) + .sortOrderDirection(SortDirection.ASC) .limit(1) .offset(1) .build() @@ -6145,7 +6638,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) +**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)
@@ -6153,7 +6646,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types (paid, free, trial) +**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types (paid, free, trial)
@@ -6201,7 +6694,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc) +**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc)
@@ -6282,78 +6775,6 @@ client.companies().lookupCompany(
- -
-
- -
client.companies.getActiveDeals() -> GetActiveDealsResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.companies().getActiveDeals( - GetActiveDealsRequest - .builder() - .companyId("company_id") - .dealStage("deal_stage") - .limit(1) - .offset(1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**companyId:** `String` - -
-
- -
-
- -**dealStage:** `String` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) - -
-
-
-
- -
@@ -6661,7 +7082,7 @@ client.companies().upsertCompanyTrait( client.companies().listEntityKeyDefinitions( ListEntityKeyDefinitionsRequest .builder() - .entityType(ListEntityKeyDefinitionsRequestEntityType.COMPANY) + .entityType(EntityType.COMPANY) .q("q") .limit(1) .offset(1) @@ -6681,7 +7102,7 @@ client.companies().listEntityKeyDefinitions(
-**entityType:** `Optional` +**entityType:** `Optional`
@@ -6741,7 +7162,7 @@ client.companies().listEntityKeyDefinitions( client.companies().countEntityKeyDefinitions( CountEntityKeyDefinitionsRequest .builder() - .entityType(CountEntityKeyDefinitionsRequestEntityType.COMPANY) + .entityType(EntityType.COMPANY) .q("q") .limit(1) .offset(1) @@ -6761,7 +7182,7 @@ client.companies().countEntityKeyDefinitions(
-**entityType:** `Optional` +**entityType:** `Optional`
@@ -6821,9 +7242,9 @@ client.companies().countEntityKeyDefinitions( client.companies().listEntityTraitDefinitions( ListEntityTraitDefinitionsRequest .builder() - .entityType(ListEntityTraitDefinitionsRequestEntityType.COMPANY) + .entityType(EntityType.COMPANY) .q("q") - .traitType(ListEntityTraitDefinitionsRequestTraitType.BOOLEAN) + .traitType(TraitType.BOOLEAN) .limit(1) .offset(1) .build() @@ -6842,7 +7263,7 @@ client.companies().listEntityTraitDefinitions(
-**entityType:** `Optional` +**entityType:** `Optional`
@@ -6866,7 +7287,15 @@ client.companies().listEntityTraitDefinitions(
-**traitType:** `Optional` +**traitType:** `Optional` + +
+
+ +
+
+ +**traitTypes:** `Optional`
@@ -6910,11 +7339,11 @@ client.companies().listEntityTraitDefinitions( client.companies().getOrCreateEntityTraitDefinition( CreateEntityTraitDefinitionRequestBody .builder() - .entityType(CreateEntityTraitDefinitionRequestBodyEntityType.COMPANY) + .entityType(EntityType.COMPANY) .hierarchy( Arrays.asList("hierarchy") ) - .traitType(CreateEntityTraitDefinitionRequestBodyTraitType.BOOLEAN) + .traitType(TraitType.BOOLEAN) .build() ); ``` @@ -6939,7 +7368,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-**entityType:** `CreateEntityTraitDefinitionRequestBodyEntityType` +**entityType:** `EntityType`
@@ -6955,7 +7384,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-**traitType:** `CreateEntityTraitDefinitionRequestBodyTraitType` +**traitType:** `TraitType`
@@ -7024,7 +7453,7 @@ client.companies().updateEntityTraitDefinition( "entity_trait_definition_id", UpdateEntityTraitDefinitionRequestBody .builder() - .traitType(UpdateEntityTraitDefinitionRequestBodyTraitType.BOOLEAN) + .traitType(TraitType.BOOLEAN) .build() ); ``` @@ -7057,7 +7486,7 @@ client.companies().updateEntityTraitDefinition(
-**traitType:** `UpdateEntityTraitDefinitionRequestBodyTraitType` +**traitType:** `TraitType`
@@ -7085,9 +7514,9 @@ client.companies().updateEntityTraitDefinition( client.companies().countEntityTraitDefinitions( CountEntityTraitDefinitionsRequest .builder() - .entityType(CountEntityTraitDefinitionsRequestEntityType.COMPANY) + .entityType(EntityType.COMPANY) .q("q") - .traitType(CountEntityTraitDefinitionsRequestTraitType.BOOLEAN) + .traitType(TraitType.BOOLEAN) .limit(1) .offset(1) .build() @@ -7106,7 +7535,7 @@ client.companies().countEntityTraitDefinitions(
-**entityType:** `Optional` +**entityType:** `Optional`
@@ -7130,7 +7559,15 @@ client.companies().countEntityTraitDefinitions(
-**traitType:** `Optional` +**traitType:** `Optional` + +
+
+ +
+
+ +**traitTypes:** `Optional`
@@ -7677,6 +8114,7 @@ client.companies().deletePlanTrait("plan_trait_id"); client.companies().updatePlanTraitsBulk( UpdatePlanTraitBulkRequestBody .builder() + .applyToExistingCompanies(true) .planId("plan_id") .traits( Arrays.asList( @@ -7703,6 +8141,14 @@ client.companies().updatePlanTraitsBulk(
+**applyToExistingCompanies:** `Boolean` + +
+
+ +
+
+ **planId:** `String`
@@ -8448,7 +8894,7 @@ client.entitlements().createCompanyOverride( .builder() .companyId("company_id") .featureId("feature_id") - .valueType(CreateCompanyOverrideRequestBodyValueType.BOOLEAN) + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -8553,7 +8999,7 @@ client.entitlements().createCompanyOverride(
-**valueType:** `CreateCompanyOverrideRequestBodyValueType` +**valueType:** `EntitlementValueType`
@@ -8622,7 +9068,7 @@ client.entitlements().updateCompanyOverride( "company_override_id", UpdateCompanyOverrideRequestBody .builder() - .valueType(UpdateCompanyOverrideRequestBodyValueType.BOOLEAN) + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -8719,7 +9165,7 @@ client.entitlements().updateCompanyOverride(
-**valueType:** `UpdateCompanyOverrideRequestBodyValueType` +**valueType:** `EntitlementValueType`
@@ -9046,6 +9492,7 @@ client.entitlements().listFeatureUsage( ListFeatureUsageRequest .builder() .companyId("company_id") + .includeUsageAggregation(true) .q("q") .withoutNegativeEntitlements(true) .limit(1) @@ -9090,6 +9537,14 @@ client.entitlements().listFeatureUsage(
+**includeUsageAggregation:** `Optional` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + +
+
+ +
+
+ **q:** `Optional`
@@ -9122,6 +9577,87 @@ client.entitlements().listFeatureUsage(
+ +
+
+ +
client.entitlements.getFeatureUsageTimeSeries() -> GetFeatureUsageTimeSeriesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entitlements().getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest + .builder() + .companyId("company_id") + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .featureId("feature_id") + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .granularity(TimeSeriesGranularity.DAILY) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**companyId:** `String` + +
+
+ +
+
+ +**endTime:** `OffsetDateTime` + +
+
+ +
+
+ +**featureId:** `String` + +
+
+ +
+
+ +**granularity:** `Optional` + +
+
+ +
+
+ +**startTime:** `OffsetDateTime` + +
+
+
+
+ +
@@ -9143,6 +9679,7 @@ client.entitlements().countFeatureUsage( CountFeatureUsageRequest .builder() .companyId("company_id") + .includeUsageAggregation(true) .q("q") .withoutNegativeEntitlements(true) .limit(1) @@ -9187,6 +9724,14 @@ client.entitlements().countFeatureUsage(
+**includeUsageAggregation:** `Optional` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + +
+
+ +
+
+ **q:** `Optional`
@@ -9385,6 +9930,7 @@ client.entitlements().listPlanEntitlements( .builder() .featureId("feature_id") .planId("plan_id") + .planVersionId("plan_version_id") .q("q") .withMeteredProducts(true) .limit(1) @@ -9445,6 +9991,22 @@ client.entitlements().listPlanEntitlements(
+**planVersionId:** `Optional` — Filter plan entitlements by a single plan version ID (starting with plvr_) + +
+
+ +
+
+ +**planVersionIds:** `Optional` — Filter plan entitlements by multiple plan version IDs (starting with plvr_) + +
+
+ +
+
+ **q:** `Optional` — Search for plan entitlements by feature or company name
@@ -9499,7 +10061,7 @@ client.entitlements().createPlanEntitlement( .builder() .featureId("feature_id") .planId("plan_id") - .valueType(CreatePlanEntitlementRequestBodyValueType.BOOLEAN) + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -9620,7 +10182,7 @@ client.entitlements().createPlanEntitlement(
-**priceBehavior:** `Optional` +**priceBehavior:** `Optional`
@@ -9644,7 +10206,7 @@ client.entitlements().createPlanEntitlement(
-**tierMode:** `Optional` +**tierMode:** `Optional`
@@ -9684,7 +10246,7 @@ client.entitlements().createPlanEntitlement(
-**valueType:** `CreatePlanEntitlementRequestBodyValueType` +**valueType:** `EntitlementValueType`
@@ -9785,7 +10347,7 @@ client.entitlements().updatePlanEntitlement( "plan_entitlement_id", UpdatePlanEntitlementRequestBody .builder() - .valueType(UpdatePlanEntitlementRequestBodyValueType.BOOLEAN) + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -9898,7 +10460,7 @@ client.entitlements().updatePlanEntitlement(
-**priceBehavior:** `Optional` +**priceBehavior:** `Optional`
@@ -9922,7 +10484,7 @@ client.entitlements().updatePlanEntitlement(
-**tierMode:** `Optional` +**tierMode:** `Optional`
@@ -9962,7 +10524,7 @@ client.entitlements().updatePlanEntitlement(
-**valueType:** `UpdatePlanEntitlementRequestBodyValueType` +**valueType:** `EntitlementValueType`
@@ -10064,6 +10626,7 @@ client.entitlements().countPlanEntitlements( .builder() .featureId("feature_id") .planId("plan_id") + .planVersionId("plan_version_id") .q("q") .withMeteredProducts(true) .limit(1) @@ -10124,7 +10687,7 @@ client.entitlements().countPlanEntitlements(
-**q:** `Optional` — Search for plan entitlements by feature or company name +**planVersionId:** `Optional` — Filter plan entitlements by a single plan version ID (starting with plvr_)
@@ -10132,7 +10695,7 @@ client.entitlements().countPlanEntitlements(
-**withMeteredProducts:** `Optional` — Filter plan entitlements only with metered products +**planVersionIds:** `Optional` — Filter plan entitlements by multiple plan version IDs (starting with plvr_)
@@ -10140,7 +10703,7 @@ client.entitlements().countPlanEntitlements(
-**limit:** `Optional` — Page limit (default 100) +**q:** `Optional` — Search for plan entitlements by feature or company name
@@ -10148,11 +10711,81 @@ client.entitlements().countPlanEntitlements(
-**offset:** `Optional` — Page offset (default 0) +**withMeteredProducts:** `Optional` — Filter plan entitlements only with metered products
- + +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+ +
+ + + +
+
+ +
client.entitlements.duplicatePlanEntitlements(request) -> DuplicatePlanEntitlementsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.entitlements().duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody + .builder() + .sourcePlanId("source_plan_id") + .targetPlanId("target_plan_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**sourcePlanId:** `String` + +
+
+ +
+
+ +**targetPlanId:** `String` + +
+
+
@@ -10295,11 +10928,9 @@ client.plans().listPlans( .forInitialPlan(true) .forTrialExpiryPlan(true) .hasProductId(true) - .planType(ListPlansRequestPlanType.PLAN) + .planType(PlanType.PLAN) .q("q") - .requiresPaymentMethod(true) .withoutEntitlementFor("without_entitlement_for") - .withoutProductId(true) .withoutPaidProductId(true) .limit(1) .offset(1) @@ -10367,7 +10998,7 @@ client.plans().listPlans(
-**planType:** `Optional` — Filter by plan type +**planType:** `Optional` — Filter by plan type
@@ -10383,14 +11014,6 @@ client.plans().listPlans(
-**requiresPaymentMethod:** `Optional` — Filter for plans that require a payment method (inverse of ForInitialPlan) - -
-
- -
-
- **withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -10399,14 +11022,6 @@ client.plans().listPlans(
-**withoutProductId:** `Optional` — Filter out plans that have a billing product ID - -
-
- -
-
- **withoutPaidProductId:** `Optional` — Filter out plans that have a paid billing product ID
@@ -10453,7 +11068,7 @@ client.plans().createPlan( .builder() .description("description") .name("name") - .planType(CreatePlanRequestBodyPlanType.PLAN) + .planType(PlanType.PLAN) .build() ); ``` @@ -10470,31 +11085,7 @@ client.plans().createPlan(
-**description:** `String` - -
-
- -
-
- -**icon:** `Optional` - -
-
- -
-
- -**name:** `String` - -
-
- -
-
- -**planType:** `CreatePlanRequestBodyPlanType` +**request:** `CreatePlanRequestBody`
@@ -10588,23 +11179,7 @@ client.plans().updatePlan(
-**description:** `Optional` - -
-
- -
-
- -**icon:** `Optional` - -
-
- -
-
- -**name:** `String` +**request:** `UpdatePlanRequestBody`
@@ -10673,7 +11248,7 @@ client.plans().upsertBillingProductPlan( "plan_id", UpsertBillingProductRequestBody .builder() - .chargeType(UpsertBillingProductRequestBodyChargeType.ONE_TIME) + .chargeType(ChargeType.FREE) .isTrialable(true) .build() ); @@ -10699,87 +11274,7 @@ client.plans().upsertBillingProductPlan(
-**billingProductId:** `Optional` - -
-
- -
-
- -**chargeType:** `UpsertBillingProductRequestBodyChargeType` - -
-
- -
-
- -**currency:** `Optional` - -
-
- -
-
- -**isTrialable:** `Boolean` - -
-
- -
-
- -**monthlyPrice:** `Optional` - -
-
- -
-
- -**monthlyPriceId:** `Optional` - -
-
- -
-
- -**oneTimePrice:** `Optional` - -
-
- -
-
- -**oneTimePriceId:** `Optional` - -
-
- -
-
- -**trialDays:** `Optional` - -
-
- -
-
- -**yearlyPrice:** `Optional` - -
-
- -
-
- -**yearlyPriceId:** `Optional` +**request:** `UpsertBillingProductRequestBody`
@@ -10812,11 +11307,9 @@ client.plans().countPlans( .forInitialPlan(true) .forTrialExpiryPlan(true) .hasProductId(true) - .planType(CountPlansRequestPlanType.PLAN) + .planType(PlanType.PLAN) .q("q") - .requiresPaymentMethod(true) .withoutEntitlementFor("without_entitlement_for") - .withoutProductId(true) .withoutPaidProductId(true) .limit(1) .offset(1) @@ -10884,7 +11377,7 @@ client.plans().countPlans(
-**planType:** `Optional` — Filter by plan type +**planType:** `Optional` — Filter by plan type
@@ -10900,14 +11393,6 @@ client.plans().countPlans(
-**requiresPaymentMethod:** `Optional` — Filter for plans that require a payment method (inverse of ForInitialPlan) - -
-
- -
-
- **withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -10916,14 +11401,6 @@ client.plans().countPlans(
-**withoutProductId:** `Optional` — Filter out plans that have a billing product ID - -
-
- -
-
- **withoutPaidProductId:** `Optional` — Filter out plans that have a paid billing product ID
@@ -11077,7 +11554,7 @@ client.components().listComponents( client.components().createComponent( CreateComponentRequestBody .builder() - .entityType(CreateComponentRequestBodyEntityType.ENTITLEMENT) + .entityType(ComponentEntityType.BILLING) .name("name") .build() ); @@ -11103,7 +11580,7 @@ client.components().createComponent(
-**entityType:** `CreateComponentRequestBodyEntityType` +**entityType:** `ComponentEntityType`
@@ -11212,7 +11689,7 @@ client.components().updateComponent(
-**entityType:** `Optional` +**entityType:** `Optional`
@@ -11228,7 +11705,7 @@ client.components().updateComponent(
-**state:** `Optional` +**state:** `Optional`
@@ -11397,8 +11874,8 @@ client.components().previewComponentData(
-## crm -
client.crm.upsertDealLineItemAssociation(request) -> UpsertDealLineItemAssociationResponse +## dataexports +
client.dataexports.createDataExport(request) -> CreateDataExportResponse
@@ -11411,11 +11888,12 @@ client.components().previewComponentData(
```java -client.crm().upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody +client.dataexports().createDataExport( + CreateDataExportRequestBody .builder() - .dealExternalId("deal_external_id") - .lineItemExternalId("line_item_external_id") + .exportType("company-feature-usage") + .metadata("metadata") + .outputFileType("csv") .build() ); ``` @@ -11432,7 +11910,15 @@ client.crm().upsertDealLineItemAssociation(
-**dealExternalId:** `String` +**exportType:** `String` + +
+
+ +
+
+ +**metadata:** `String`
@@ -11440,7 +11926,7 @@ client.crm().upsertDealLineItemAssociation(
-**lineItemExternalId:** `String` +**outputFileType:** `String`
@@ -11452,7 +11938,7 @@ client.crm().upsertDealLineItemAssociation(
-
client.crm.upsertLineItem(request) -> UpsertLineItemResponse +
client.dataexports.getDataExportArtifact(dataExportId) -> InputStream
@@ -11465,16 +11951,7 @@ client.crm().upsertDealLineItemAssociation(
```java -client.crm().upsertLineItem( - CreateCrmLineItemRequestBody - .builder() - .amount("amount") - .interval("interval") - .lineItemExternalId("line_item_external_id") - .productExternalId("product_external_id") - .quantity(1) - .build() -); +client.dataexports().getDataExportArtifact("data_export_id"); ```
@@ -11489,474 +11966,24 @@ client.crm().upsertLineItem(
-**amount:** `String` +**dataExportId:** `String` — data_export_id
- -
-
- -**discountPercentage:** `Optional` -
-
-
-**interval:** `String` -
+
+## events +
client.events.createEventBatch(request) -> CreateEventBatchResponse
-**lineItemExternalId:** `String` - -
-
- -
-
- -**productExternalId:** `String` - -
-
- -
-
- -**quantity:** `Integer` - -
-
- -
-
- -**termMonth:** `Optional` - -
-
- -
-
- -**totalDiscount:** `Optional` - -
-
- - - - - - -
- -
client.crm.upsertCrmDeal(request) -> UpsertCrmDealResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.crm().upsertCrmDeal( - CreateCrmDealRequestBody - .builder() - .crmCompanyKey("crm_company_key") - .crmType("crm_type") - .dealExternalId("deal_external_id") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**arr:** `Optional` - -
-
- -
-
- -**crmCompanyId:** `Optional` - -
-
- -
-
- -**crmCompanyKey:** `String` - -
-
- -
-
- -**crmProductId:** `Optional` - -
-
- -
-
- -**crmType:** `String` - -
-
- -
-
- -**dealExternalId:** `String` - -
-
- -
-
- -**dealName:** `Optional` - -
-
- -
-
- -**dealStage:** `Optional` - -
-
- -
-
- -**mrr:** `Optional` - -
-
-
-
- - -
-
-
- -
client.crm.listCrmProducts() -> ListCrmProductsResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.crm().listCrmProducts( - ListCrmProductsRequest - .builder() - .name("name") - .limit(1) - .offset(1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**ids:** `Optional` - -
-
- -
-
- -**name:** `Optional` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) - -
-
-
-
- - -
-
-
- -
client.crm.upsertCrmProduct(request) -> UpsertCrmProductResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.crm().upsertCrmProduct( - CreateCrmProductRequestBody - .builder() - .currency("currency") - .description("description") - .externalId("external_id") - .interval("interval") - .name("name") - .price("price") - .quantity(1) - .sku("sku") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**currency:** `String` - -
-
- -
-
- -**description:** `String` - -
-
- -
-
- -**externalId:** `String` - -
-
- -
-
- -**interval:** `String` - -
-
- -
-
- -**name:** `String` - -
-
- -
-
- -**price:** `String` - -
-
- -
-
- -**quantity:** `Integer` - -
-
- -
-
- -**sku:** `String` - -
-
-
-
- - -
-
-
- -## dataexports -
client.dataexports.createDataExport(request) -> CreateDataExportResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.dataexports().createDataExport( - CreateDataExportRequestBody - .builder() - .exportType("company-feature-usage") - .metadata("metadata") - .outputFileType("csv") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**exportType:** `String` - -
-
- -
-
- -**metadata:** `String` - -
-
- -
-
- -**outputFileType:** `String` - -
-
-
-
- - -
-
-
- -
client.dataexports.getDataExportArtifact(dataExportId) -> InputStream -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.dataexports().getDataExportArtifact("data_export_id"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**dataExportId:** `String` — data_export_id - -
-
-
-
- - -
-
-
- -## events -
client.events.createEventBatch(request) -> CreateEventBatchResponse -
-
- -#### 🔌 Usage +#### 🔌 Usage
@@ -11972,7 +11999,7 @@ client.events().createEventBatch( Arrays.asList( CreateEventRequestBody .builder() - .eventType(CreateEventRequestBodyEventType.IDENTIFY) + .eventType(EventType.FLAG_CHECK) .build() ) ) @@ -12129,7 +12156,7 @@ client.events().listEvents(
-**eventTypes:** `Optional` +**eventTypes:** `Optional`
@@ -12189,7 +12216,7 @@ client.events().listEvents( client.events().createEvent( CreateEventRequestBody .builder() - .eventType(CreateEventRequestBodyEventType.IDENTIFY) + .eventType(EventType.FLAG_CHECK) .build() ); ``` @@ -12354,7 +12381,7 @@ client.features().listFeatures(
-**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait) +**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait)
@@ -12407,7 +12434,7 @@ client.features().createFeature( CreateFeatureRequestBody .builder() .description("description") - .featureType(CreateFeatureRequestBodyFeatureType.BOOLEAN) + .featureType(FeatureType.BOOLEAN) .name("name") .build() ); @@ -12441,7 +12468,7 @@ client.features().createFeature(
-**featureType:** `CreateFeatureRequestBodyFeatureType` +**featureType:** `FeatureType`
@@ -12465,7 +12492,7 @@ client.features().createFeature(
-**lifecyclePhase:** `Optional` +**lifecyclePhase:** `Optional`
@@ -12614,7 +12641,7 @@ client.features().updateFeature(
-**featureType:** `Optional` +**featureType:** `Optional`
@@ -12638,7 +12665,7 @@ client.features().updateFeature(
-**lifecyclePhase:** `Optional` +**lifecyclePhase:** `Optional`
@@ -12800,7 +12827,7 @@ client.features().countFeatures(
-**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait) +**featureType:** `Optional` — Filter by one or more feature types (boolean, event, trait)
@@ -13177,15 +13204,163 @@ client.features().updateFlagRules(
-**flagId:** `String` — flag_id +**flagId:** `String` — flag_id + +
+
+ +
+
+ +**rules:** `List` + +
+
+
+
+ + +
+
+
+ +
client.features.checkFlag(key, request) -> CheckFlagResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.features().checkFlag( + "key", + CheckFlagRequestBody + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**key:** `String` — key + +
+
+ +
+
+ +**request:** `CheckFlagRequestBody` + +
+
+
+
+ + +
+
+
+ +
client.features.checkFlags(request) -> CheckFlagsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.features().checkFlags( + CheckFlagRequestBody + .builder() + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CheckFlagRequestBody`
+
+
+ + +
+
+
+
client.features.checkFlagsBulk(request) -> CheckFlagsBulkResponse
-**rules:** `List` +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.features().checkFlagsBulk( + CheckFlagsBulkRequestBody + .builder() + .contexts( + Arrays.asList( + CheckFlagRequestBody + .builder() + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**contexts:** `List`
@@ -13197,7 +13372,7 @@ client.features().updateFlagRules(
-
client.features.checkFlag(key, request) -> CheckFlagResponse +
client.features.countFlags() -> CountFlagsResponse
@@ -13210,10 +13385,13 @@ client.features().updateFlagRules(
```java -client.features().checkFlag( - "key", - CheckFlagRequestBody +client.features().countFlags( + CountFlagsRequest .builder() + .featureId("feature_id") + .q("q") + .limit(1) + .offset(1) .build() ); ``` @@ -13230,7 +13408,7 @@ client.features().checkFlag(
-**key:** `String` — key +**featureId:** `Optional`
@@ -13238,7 +13416,31 @@ client.features().checkFlag(
-**request:** `CheckFlagRequestBody` +**ids:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` — Search by flag name, key, or ID + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0)
@@ -13250,7 +13452,8 @@ client.features().checkFlag(
-
client.features.checkFlags(request) -> CheckFlagsResponse +## planbundle +
client.planbundle.createPlanBundle(request) -> CreatePlanBundleResponse
@@ -13263,9 +13466,17 @@ client.features().checkFlag(
```java -client.features().checkFlags( - CheckFlagRequestBody +client.planbundle().createPlanBundle( + CreatePlanBundleRequestBody .builder() + .entitlements( + Arrays.asList( + PlanBundleEntitlementRequestBody + .builder() + .action(PlanBundleAction.CREATE) + .build() + ) + ) .build() ); ``` @@ -13282,7 +13493,39 @@ client.features().checkFlags(
-**request:** `CheckFlagRequestBody` +**billingProduct:** `Optional` + +
+
+ +
+
+ +**creditGrants:** `Optional>` + +
+
+ +
+
+ +**entitlements:** `List` + +
+
+ +
+
+ +**plan:** `Optional` + +
+
+ +
+
+ +**traits:** `Optional>`
@@ -13294,7 +13537,7 @@ client.features().checkFlags(
-
client.features.countFlags() -> CountFlagsResponse +
client.planbundle.updatePlanBundle(planBundleId, request) -> UpdatePlanBundleResponse
@@ -13307,13 +13550,18 @@ client.features().checkFlags(
```java -client.features().countFlags( - CountFlagsRequest +client.planbundle().updatePlanBundle( + "plan_bundle_id", + UpdatePlanBundleRequestBody .builder() - .featureId("feature_id") - .q("q") - .limit(1) - .offset(1) + .entitlements( + Arrays.asList( + PlanBundleEntitlementRequestBody + .builder() + .action(PlanBundleAction.CREATE) + .build() + ) + ) .build() ); ``` @@ -13330,7 +13578,7 @@ client.features().countFlags(
-**featureId:** `Optional` +**planBundleId:** `String` — plan_bundle_id
@@ -13338,7 +13586,7 @@ client.features().countFlags(
-**ids:** `Optional` +**billingProduct:** `Optional`
@@ -13346,7 +13594,7 @@ client.features().countFlags(
-**q:** `Optional` — Search by flag name, key, or ID +**creditGrants:** `Optional>`
@@ -13354,7 +13602,7 @@ client.features().countFlags(
-**limit:** `Optional` — Page limit (default 100) +**entitlements:** `List`
@@ -13362,7 +13610,15 @@ client.features().countFlags(
-**offset:** `Optional` — Page offset (default 0) +**plan:** `Optional` + +
+
+ +
+
+ +**traits:** `Optional>`
@@ -13448,10 +13704,14 @@ client.plangroups().createPlanGroup( ) ) .preventDowngradesWhenOverLimit(true) + .preventSelfServiceDowngrade(true) + .prorationBehavior(ProrationBehavior.CREATE_PRORATIONS) + .showAsMonthlyPrices(true) .showCredits(true) + .showFeatureDescription(true) .showPeriodToggle(true) .showZeroPriceAsFree(true) - .syncCustomerBillingDetailsForTax(true) + .syncCustomerBillingDetails(true) .build() ); ``` @@ -13588,6 +13848,62 @@ client.plangroups().createPlanGroup(
+**preventSelfServiceDowngrade:** `Boolean` + +
+
+ +
+
+ +**preventSelfServiceDowngradeButtonText:** `Optional` + +
+
+ +
+
+ +**preventSelfServiceDowngradeUrl:** `Optional` + +
+
+ +
+
+ +**prorationBehavior:** `ProrationBehavior` + +
+
+ +
+
+ +**scheduledDowngradeBehavior:** `Optional` + +
+
+ +
+
+ +**scheduledDowngradePreventWhenOverLimit:** `Optional` + +
+
+ +
+
+ +**showAsMonthlyPrices:** `Boolean` + +
+
+ +
+
+ **showCredits:** `Boolean`
@@ -13596,6 +13912,14 @@ client.plangroups().createPlanGroup(
+**showFeatureDescription:** `Boolean` + +
+
+ +
+
+ **showPeriodToggle:** `Boolean`
@@ -13612,7 +13936,7 @@ client.plangroups().createPlanGroup(
-**syncCustomerBillingDetailsForTax:** `Boolean` +**syncCustomerBillingDetails:** `Boolean`
@@ -13705,10 +14029,14 @@ client.plangroups().updatePlanGroup( ) ) .preventDowngradesWhenOverLimit(true) + .preventSelfServiceDowngrade(true) + .prorationBehavior(ProrationBehavior.CREATE_PRORATIONS) + .showAsMonthlyPrices(true) .showCredits(true) + .showFeatureDescription(true) .showPeriodToggle(true) .showZeroPriceAsFree(true) - .syncCustomerBillingDetailsForTax(true) + .syncCustomerBillingDetails(true) .build() ); ``` @@ -13853,6 +14181,62 @@ client.plangroups().updatePlanGroup(
+**preventSelfServiceDowngrade:** `Boolean` + +
+
+ +
+
+ +**preventSelfServiceDowngradeButtonText:** `Optional` + +
+
+ +
+
+ +**preventSelfServiceDowngradeUrl:** `Optional` + +
+
+ +
+
+ +**prorationBehavior:** `ProrationBehavior` + +
+
+ +
+
+ +**scheduledDowngradeBehavior:** `Optional` + +
+
+ +
+
+ +**scheduledDowngradePreventWhenOverLimit:** `Optional` + +
+
+ +
+
+ +**showAsMonthlyPrices:** `Boolean` + +
+
+ +
+
+ **showCredits:** `Boolean`
@@ -13861,6 +14245,14 @@ client.plangroups().updatePlanGroup(
+**showFeatureDescription:** `Boolean` + +
+
+ +
+
+ **showPeriodToggle:** `Boolean`
@@ -13877,7 +14269,7 @@ client.plangroups().updatePlanGroup(
-**syncCustomerBillingDetailsForTax:** `Boolean` +**syncCustomerBillingDetails:** `Boolean`
@@ -14262,7 +14654,7 @@ client.webhooks().createWebhook( .builder() .name("name") .requestTypes( - Arrays.asList(CreateWebhookRequestBodyRequestTypesItem.COMPANY_UPDATED) + Arrays.asList(WebhookRequestType.SUBSCRIPTION_TRIAL_ENDED) ) .url("url") .build() @@ -14305,7 +14697,7 @@ client.webhooks().createWebhook(
-**requestTypes:** `List` +**requestTypes:** `List`
@@ -14430,7 +14822,7 @@ client.webhooks().updateWebhook(
-**requestTypes:** `Optional>` +**requestTypes:** `Optional>`
@@ -14438,7 +14830,7 @@ client.webhooks().updateWebhook(
-**status:** `Optional` +**status:** `Optional`
diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematic.java b/src/main/java/com/schematic/api/AsyncBaseSchematic.java index ee22084..f3f5133 100644 --- a/src/main/java/com/schematic/api/AsyncBaseSchematic.java +++ b/src/main/java/com/schematic/api/AsyncBaseSchematic.java @@ -13,11 +13,11 @@ import com.schematic.api.resources.companies.AsyncCompaniesClient; import com.schematic.api.resources.components.AsyncComponentsClient; import com.schematic.api.resources.credits.AsyncCreditsClient; -import com.schematic.api.resources.crm.AsyncCrmClient; import com.schematic.api.resources.dataexports.AsyncDataexportsClient; 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.planbundle.AsyncPlanbundleClient; import com.schematic.api.resources.plangroups.AsyncPlangroupsClient; import com.schematic.api.resources.plans.AsyncPlansClient; import com.schematic.api.resources.webhooks.AsyncWebhooksClient; @@ -45,14 +45,14 @@ public class AsyncBaseSchematic { protected final Supplier componentsClient; - protected final Supplier crmClient; - protected final Supplier dataexportsClient; protected final Supplier eventsClient; protected final Supplier featuresClient; + protected final Supplier planbundleClient; + protected final Supplier plangroupsClient; protected final Supplier accesstokensClient; @@ -70,10 +70,10 @@ public AsyncBaseSchematic(ClientOptions clientOptions) { this.entitlementsClient = Suppliers.memoize(() -> new AsyncEntitlementsClient(clientOptions)); this.plansClient = Suppliers.memoize(() -> new AsyncPlansClient(clientOptions)); this.componentsClient = Suppliers.memoize(() -> new AsyncComponentsClient(clientOptions)); - this.crmClient = Suppliers.memoize(() -> new AsyncCrmClient(clientOptions)); this.dataexportsClient = Suppliers.memoize(() -> new AsyncDataexportsClient(clientOptions)); this.eventsClient = Suppliers.memoize(() -> new AsyncEventsClient(clientOptions)); this.featuresClient = Suppliers.memoize(() -> new AsyncFeaturesClient(clientOptions)); + this.planbundleClient = Suppliers.memoize(() -> new AsyncPlanbundleClient(clientOptions)); this.plangroupsClient = Suppliers.memoize(() -> new AsyncPlangroupsClient(clientOptions)); this.accesstokensClient = Suppliers.memoize(() -> new AsyncAccesstokensClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new AsyncWebhooksClient(clientOptions)); @@ -140,10 +140,6 @@ public AsyncComponentsClient components() { return this.componentsClient.get(); } - public AsyncCrmClient crm() { - return this.crmClient.get(); - } - public AsyncDataexportsClient dataexports() { return this.dataexportsClient.get(); } @@ -156,6 +152,10 @@ public AsyncFeaturesClient features() { return this.featuresClient.get(); } + public AsyncPlanbundleClient planbundle() { + return this.planbundleClient.get(); + } + public AsyncPlangroupsClient plangroups() { return this.plangroupsClient.get(); } diff --git a/src/main/java/com/schematic/api/BaseSchematic.java b/src/main/java/com/schematic/api/BaseSchematic.java index bbfaa4e..2fba31a 100644 --- a/src/main/java/com/schematic/api/BaseSchematic.java +++ b/src/main/java/com/schematic/api/BaseSchematic.java @@ -11,10 +11,12 @@ import com.schematic.api.resources.checkout.CheckoutClient; import com.schematic.api.resources.companies.CompaniesClient; import com.schematic.api.resources.components.ComponentsClient; -import com.schematic.api.resources.crm.CrmClient; +import com.schematic.api.resources.credits.CreditsClient; +import com.schematic.api.resources.dataexports.DataexportsClient; import com.schematic.api.resources.entitlements.EntitlementsClient; import com.schematic.api.resources.events.EventsClient; import com.schematic.api.resources.features.FeaturesClient; +import com.schematic.api.resources.planbundle.PlanbundleClient; import com.schematic.api.resources.plangroups.PlangroupsClient; import com.schematic.api.resources.plans.PlansClient; import com.schematic.api.resources.webhooks.WebhooksClient; @@ -35,14 +37,18 @@ public class BaseSchematic { protected final Supplier entitlementsClient; + protected final Supplier creditsClient; + protected final Supplier componentsClient; - protected final Supplier crmClient; + protected final Supplier dataexportsClient; protected final Supplier eventsClient; protected final Supplier plansClient; + protected final Supplier planbundleClient; + protected final Supplier plangroupsClient; protected final Supplier accesstokensClient; @@ -58,9 +64,11 @@ public BaseSchematic(ClientOptions clientOptions) { this.companiesClient = Suppliers.memoize(() -> new CompaniesClient(clientOptions)); this.entitlementsClient = Suppliers.memoize(() -> new EntitlementsClient(clientOptions)); this.componentsClient = Suppliers.memoize(() -> new ComponentsClient(clientOptions)); - this.crmClient = Suppliers.memoize(() -> new CrmClient(clientOptions)); + this.creditsClient = Suppliers.memoize(() -> new CreditsClient(clientOptions)); + this.dataexportsClient = Suppliers.memoize(() -> new DataexportsClient(clientOptions)); this.eventsClient = Suppliers.memoize(() -> new EventsClient(clientOptions)); this.plansClient = Suppliers.memoize(() -> new PlansClient(clientOptions)); + this.planbundleClient = Suppliers.memoize(() -> new PlanbundleClient(clientOptions)); this.plangroupsClient = Suppliers.memoize(() -> new PlangroupsClient(clientOptions)); this.accesstokensClient = Suppliers.memoize(() -> new AccesstokensClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new WebhooksClient(clientOptions)); @@ -94,8 +102,12 @@ public ComponentsClient components() { return this.componentsClient.get(); } - public CrmClient crm() { - return this.crmClient.get(); + public CreditsClient credits() { + return this.creditsClient.get(); + } + + public DataexportsClient dataexports() { + return this.dataexportsClient.get(); } public EventsClient events() { @@ -106,6 +118,10 @@ public PlansClient plans() { return this.plansClient.get(); } + public PlanbundleClient planbundle() { + return this.planbundleClient.get(); + } + public PlangroupsClient plangroups() { return this.plangroupsClient.get(); } diff --git a/src/main/java/com/schematic/api/Schematic.java b/src/main/java/com/schematic/api/Schematic.java index 26ae85a..8bf13c4 100644 --- a/src/main/java/com/schematic/api/Schematic.java +++ b/src/main/java/com/schematic/api/Schematic.java @@ -12,11 +12,11 @@ import com.schematic.api.resources.features.types.CheckFlagResponse; import com.schematic.api.types.CheckFlagRequestBody; import com.schematic.api.types.CreateEventRequestBody; -import com.schematic.api.types.CreateEventRequestBodyEventType; import com.schematic.api.types.EventBody; import com.schematic.api.types.EventBodyIdentify; import com.schematic.api.types.EventBodyIdentifyCompany; import com.schematic.api.types.EventBodyTrack; +import com.schematic.api.types.EventType; import java.time.Duration; import java.time.OffsetDateTime; import java.util.Collections; @@ -212,7 +212,7 @@ public void identify( .build(); CreateEventRequestBody event = CreateEventRequestBody.builder() - .eventType(CreateEventRequestBodyEventType.IDENTIFY) + .eventType(EventType.IDENTIFY) .body(EventBody.of(body)) .sentAt(OffsetDateTime.now()) .build(); @@ -246,7 +246,7 @@ public void track( .build(); CreateEventRequestBody event = CreateEventRequestBody.builder() - .eventType(CreateEventRequestBodyEventType.TRACK) + .eventType(EventType.TRACK) .body(EventBody.of(body)) .sentAt(OffsetDateTime.now()) .build(); diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index a1f67f1..4c74d33 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -32,10 +32,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.2.0"); + put("User-Agent", "com.schematichq:schematic-java/1.3.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.2.0"); + put("X-Fern-SDK-Version", "1.3.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/schematic/api/resources/accesstokens/requests/IssueTemporaryAccessTokenRequestBody.java b/src/main/java/com/schematic/api/resources/accesstokens/requests/IssueTemporaryAccessTokenRequestBody.java index 0aa459d..9990e0d 100644 --- a/src/main/java/com/schematic/api/resources/accesstokens/requests/IssueTemporaryAccessTokenRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accesstokens/requests/IssueTemporaryAccessTokenRequestBody.java @@ -16,16 +16,21 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = IssueTemporaryAccessTokenRequestBody.Builder.class) public final class IssueTemporaryAccessTokenRequestBody { private final Map lookup; + private final String resourceType; + private final Map additionalProperties; - private IssueTemporaryAccessTokenRequestBody(Map lookup, Map additionalProperties) { + private IssueTemporaryAccessTokenRequestBody( + Map lookup, String resourceType, Map additionalProperties) { this.lookup = lookup; + this.resourceType = resourceType; this.additionalProperties = additionalProperties; } @@ -36,7 +41,7 @@ public Map getLookup() { @JsonProperty("resource_type") public String getResourceType() { - return "company"; + return resourceType; } @java.lang.Override @@ -52,12 +57,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(IssueTemporaryAccessTokenRequestBody other) { - return lookup.equals(other.lookup); + return lookup.equals(other.lookup) && resourceType.equals(other.resourceType); } @java.lang.Override public int hashCode() { - return Objects.hash(this.lookup); + return Objects.hash(this.lookup, this.resourceType); } @java.lang.Override @@ -65,12 +70,30 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static ResourceTypeStage builder() { return new Builder(); } + public interface ResourceTypeStage { + _FinalStage resourceType(@NotNull String resourceType); + + Builder from(IssueTemporaryAccessTokenRequestBody other); + } + + public interface _FinalStage { + IssueTemporaryAccessTokenRequestBody build(); + + _FinalStage lookup(Map lookup); + + _FinalStage putAllLookup(Map lookup); + + _FinalStage lookup(String key, String value); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { + public static final class Builder implements ResourceTypeStage, _FinalStage { + private String resourceType; + private Map lookup = new LinkedHashMap<>(); @JsonAnySetter @@ -78,34 +101,47 @@ public static final class Builder { private Builder() {} + @java.lang.Override public Builder from(IssueTemporaryAccessTokenRequestBody other) { lookup(other.getLookup()); + resourceType(other.getResourceType()); return this; } - @JsonSetter(value = "lookup", nulls = Nulls.SKIP) - public Builder lookup(Map lookup) { - this.lookup.clear(); - if (lookup != null) { - this.lookup.putAll(lookup); - } + @java.lang.Override + @JsonSetter("resource_type") + public _FinalStage resourceType(@NotNull String resourceType) { + this.resourceType = Objects.requireNonNull(resourceType, "resourceType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage lookup(String key, String value) { + this.lookup.put(key, value); return this; } - public Builder putAllLookup(Map lookup) { + @java.lang.Override + public _FinalStage putAllLookup(Map lookup) { if (lookup != null) { this.lookup.putAll(lookup); } return this; } - public Builder lookup(String key, String value) { - this.lookup.put(key, value); + @java.lang.Override + @JsonSetter(value = "lookup", nulls = Nulls.SKIP) + public _FinalStage lookup(Map lookup) { + this.lookup.clear(); + if (lookup != null) { + this.lookup.putAll(lookup); + } return this; } + @java.lang.Override public IssueTemporaryAccessTokenRequestBody build() { - return new IssueTemporaryAccessTokenRequestBody(lookup, additionalProperties); + return new IssueTemporaryAccessTokenRequestBody(lookup, resourceType, additionalProperties); } } } 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 44c7be5..45393d5 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java @@ -7,24 +7,29 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountApiRequestsRequest; +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.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListApiRequestsRequest; +import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountApiRequestsResponse; +import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetApiRequestResponse; +import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListApiRequestsResponse; +import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; @@ -132,6 +137,38 @@ public CountApiRequestsResponse countApiRequests(CountApiRequestsRequest request return this.rawClient.countApiRequests(request, requestOptions).body(); } + public ListAuditLogsResponse listAuditLogs() { + return this.rawClient.listAuditLogs().body(); + } + + public ListAuditLogsResponse listAuditLogs(ListAuditLogsRequest request) { + return this.rawClient.listAuditLogs(request).body(); + } + + public ListAuditLogsResponse listAuditLogs(ListAuditLogsRequest request, RequestOptions requestOptions) { + return this.rawClient.listAuditLogs(request, requestOptions).body(); + } + + public GetAuditLogResponse getAuditLog(String auditLogId) { + return this.rawClient.getAuditLog(auditLogId).body(); + } + + public GetAuditLogResponse getAuditLog(String auditLogId, RequestOptions requestOptions) { + return this.rawClient.getAuditLog(auditLogId, requestOptions).body(); + } + + public CountAuditLogsResponse countAuditLogs() { + return this.rawClient.countAuditLogs().body(); + } + + public CountAuditLogsResponse countAuditLogs(CountAuditLogsRequest request) { + return this.rawClient.countAuditLogs(request).body(); + } + + public CountAuditLogsResponse countAuditLogs(CountAuditLogsRequest request, RequestOptions requestOptions) { + return this.rawClient.countAuditLogs(request, requestOptions).body(); + } + public ListEnvironmentsResponse listEnvironments() { return this.rawClient.listEnvironments().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 a7b11ac..0e7b1a4 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java @@ -7,24 +7,29 @@ import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountApiRequestsRequest; +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.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListApiRequestsRequest; +import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountApiRequestsResponse; +import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetApiRequestResponse; +import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListApiRequestsResponse; +import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; @@ -138,6 +143,40 @@ public CompletableFuture countApiRequests( return this.rawClient.countApiRequests(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture listAuditLogs() { + return this.rawClient.listAuditLogs().thenApply(response -> response.body()); + } + + public CompletableFuture listAuditLogs(ListAuditLogsRequest request) { + return this.rawClient.listAuditLogs(request).thenApply(response -> response.body()); + } + + public CompletableFuture listAuditLogs( + ListAuditLogsRequest request, RequestOptions requestOptions) { + return this.rawClient.listAuditLogs(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture getAuditLog(String auditLogId) { + return this.rawClient.getAuditLog(auditLogId).thenApply(response -> response.body()); + } + + public CompletableFuture getAuditLog(String auditLogId, RequestOptions requestOptions) { + return this.rawClient.getAuditLog(auditLogId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countAuditLogs() { + return this.rawClient.countAuditLogs().thenApply(response -> response.body()); + } + + public CompletableFuture countAuditLogs(CountAuditLogsRequest request) { + return this.rawClient.countAuditLogs(request).thenApply(response -> response.body()); + } + + public CompletableFuture countAuditLogs( + CountAuditLogsRequest request, RequestOptions requestOptions) { + return this.rawClient.countAuditLogs(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listEnvironments() { return this.rawClient.listEnvironments().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 caf2ae4..c951ef4 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java @@ -19,24 +19,29 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountApiRequestsRequest; +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.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListApiRequestsRequest; +import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountApiRequestsResponse; +import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetApiRequestResponse; +import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListApiRequestsResponse; +import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; @@ -889,6 +894,295 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> listAuditLogs() { + return listAuditLogs(ListAuditLogsRequest.builder().build()); + } + + public CompletableFuture> listAuditLogs( + ListAuditLogsRequest request) { + return listAuditLogs(request, null); + } + + public CompletableFuture> listAuditLogs( + ListAuditLogsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audit-log"); + if (request.getActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actor_type", request.getActorType().get(), false); + } + if (request.getEnvironmentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "environment_id", request.getEnvironmentId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + 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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAuditLogsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> getAuditLog(String auditLogId) { + return getAuditLog(auditLogId, null); + } + + public CompletableFuture> getAuditLog( + String auditLogId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audit-log") + .addPathSegment(auditLogId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAuditLogResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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 + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> countAuditLogs() { + return countAuditLogs(CountAuditLogsRequest.builder().build()); + } + + public CompletableFuture> countAuditLogs( + CountAuditLogsRequest request) { + return countAuditLogs(request, null); + } + + public CompletableFuture> countAuditLogs( + CountAuditLogsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audit-log/count"); + if (request.getActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actor_type", request.getActorType().get(), false); + } + if (request.getEnvironmentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "environment_id", request.getEnvironmentId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + 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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CountAuditLogsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> listEnvironments() { return listEnvironments(ListEnvironmentsRequest.builder().build()); } 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 808a848..170a7d8 100644 --- a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java @@ -19,24 +19,29 @@ import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.accounts.requests.CountApiKeysRequest; import com.schematic.api.resources.accounts.requests.CountApiRequestsRequest; +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.ListApiKeysRequest; import com.schematic.api.resources.accounts.requests.ListApiRequestsRequest; +import com.schematic.api.resources.accounts.requests.ListAuditLogsRequest; import com.schematic.api.resources.accounts.requests.ListEnvironmentsRequest; import com.schematic.api.resources.accounts.requests.UpdateApiKeyRequestBody; import com.schematic.api.resources.accounts.requests.UpdateEnvironmentRequestBody; import com.schematic.api.resources.accounts.types.CountApiKeysResponse; import com.schematic.api.resources.accounts.types.CountApiRequestsResponse; +import com.schematic.api.resources.accounts.types.CountAuditLogsResponse; import com.schematic.api.resources.accounts.types.CreateApiKeyResponse; import com.schematic.api.resources.accounts.types.CreateEnvironmentResponse; import com.schematic.api.resources.accounts.types.DeleteApiKeyResponse; import com.schematic.api.resources.accounts.types.DeleteEnvironmentResponse; import com.schematic.api.resources.accounts.types.GetApiKeyResponse; import com.schematic.api.resources.accounts.types.GetApiRequestResponse; +import com.schematic.api.resources.accounts.types.GetAuditLogResponse; import com.schematic.api.resources.accounts.types.GetEnvironmentResponse; import com.schematic.api.resources.accounts.types.ListApiKeysResponse; import com.schematic.api.resources.accounts.types.ListApiRequestsResponse; +import com.schematic.api.resources.accounts.types.ListAuditLogsResponse; import com.schematic.api.resources.accounts.types.ListEnvironmentsResponse; import com.schematic.api.resources.accounts.types.QuickstartResponse; import com.schematic.api.resources.accounts.types.UpdateApiKeyResponse; @@ -674,6 +679,225 @@ public BaseSchematicHttpResponse countApiRequests( } } + public BaseSchematicHttpResponse listAuditLogs() { + return listAuditLogs(ListAuditLogsRequest.builder().build()); + } + + public BaseSchematicHttpResponse listAuditLogs(ListAuditLogsRequest request) { + return listAuditLogs(request, null); + } + + public BaseSchematicHttpResponse listAuditLogs( + ListAuditLogsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audit-log"); + if (request.getActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actor_type", request.getActorType().get(), false); + } + if (request.getEnvironmentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "environment_id", request.getEnvironmentId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + 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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAuditLogsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getAuditLog(String auditLogId) { + return getAuditLog(auditLogId, null); + } + + public BaseSchematicHttpResponse getAuditLog( + String auditLogId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audit-log") + .addPathSegment(auditLogId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAuditLogResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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 + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse countAuditLogs() { + return countAuditLogs(CountAuditLogsRequest.builder().build()); + } + + public BaseSchematicHttpResponse countAuditLogs(CountAuditLogsRequest request) { + return countAuditLogs(request, null); + } + + public BaseSchematicHttpResponse countAuditLogs( + CountAuditLogsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("audit-log/count"); + if (request.getActorType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "actor_type", request.getActorType().get(), false); + } + if (request.getEnvironmentId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "environment_id", request.getEnvironmentId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + 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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountAuditLogsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse listEnvironments() { return listEnvironments(ListEnvironmentsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/crm/types/ListCrmProductsParams.java b/src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java similarity index 55% rename from src/main/java/com/schematic/api/resources/crm/types/ListCrmProductsParams.java rename to src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java index dbaca93..16adb04 100644 --- a/src/main/java/com/schematic/api/resources/crm/types/ListCrmProductsParams.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.types; +package com.schematic.api.resources.accounts.requests; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,41 +12,55 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.ActorType; 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 = ListCrmProductsParams.Builder.class) -public final class ListCrmProductsParams { - private final Optional> ids; +@JsonDeserialize(builder = CountAuditLogsRequest.Builder.class) +public final class CountAuditLogsRequest { + private final Optional actorType; - private final Optional limit; + private final Optional environmentId; + + private final Optional q; - private final Optional name; + private final Optional limit; private final Optional offset; private final Map additionalProperties; - private ListCrmProductsParams( - Optional> ids, + private CountAuditLogsRequest( + Optional actorType, + Optional environmentId, + Optional q, Optional limit, - Optional name, Optional offset, Map additionalProperties) { - this.ids = ids; + this.actorType = actorType; + this.environmentId = environmentId; + this.q = q; this.limit = limit; - this.name = name; this.offset = offset; this.additionalProperties = additionalProperties; } - @JsonProperty("ids") - public Optional> getIds() { - return ids; + @JsonProperty("actor_type") + public Optional getActorType() { + return actorType; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + @JsonProperty("q") + public Optional getQ() { + return q; } /** @@ -57,11 +71,6 @@ public Optional getLimit() { return limit; } - @JsonProperty("name") - public Optional getName() { - return name; - } - /** * @return Page offset (default 0) */ @@ -73,7 +82,7 @@ public Optional getOffset() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListCrmProductsParams && equalTo((ListCrmProductsParams) other); + return other instanceof CountAuditLogsRequest && equalTo((CountAuditLogsRequest) other); } @JsonAnyGetter @@ -81,16 +90,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListCrmProductsParams other) { - return ids.equals(other.ids) + private boolean equalTo(CountAuditLogsRequest other) { + return actorType.equals(other.actorType) + && environmentId.equals(other.environmentId) + && q.equals(other.q) && limit.equals(other.limit) - && name.equals(other.name) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.ids, this.limit, this.name, this.offset); + return Objects.hash(this.actorType, this.environmentId, this.q, this.limit, this.offset); } @java.lang.Override @@ -104,11 +114,13 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> ids = Optional.empty(); + private Optional actorType = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional environmentId = Optional.empty(); - private Optional name = Optional.empty(); + private Optional q = Optional.empty(); + + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -117,22 +129,45 @@ public static final class Builder { private Builder() {} - public Builder from(ListCrmProductsParams other) { - ids(other.getIds()); + public Builder from(CountAuditLogsRequest other) { + actorType(other.getActorType()); + environmentId(other.getEnvironmentId()); + q(other.getQ()); limit(other.getLimit()); - name(other.getName()); offset(other.getOffset()); return this; } - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; + @JsonSetter(value = "actor_type", nulls = Nulls.SKIP) + public Builder actorType(Optional actorType) { + this.actorType = actorType; + return this; + } + + public Builder actorType(ActorType actorType) { + this.actorType = Optional.ofNullable(actorType); return this; } - public Builder ids(List ids) { - this.ids = Optional.ofNullable(ids); + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public Builder environmentId(Optional environmentId) { + this.environmentId = environmentId; + return this; + } + + public Builder environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); + return this; + } + + @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; } @@ -150,17 +185,6 @@ public Builder limit(Integer limit) { return this; } - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - /** *

Page offset (default 0)

*/ @@ -175,8 +199,8 @@ public Builder offset(Integer offset) { return this; } - public ListCrmProductsParams build() { - return new ListCrmProductsParams(ids, limit, name, offset, additionalProperties); + public CountAuditLogsRequest build() { + return new CountAuditLogsRequest(actorType, environmentId, q, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java index 84db934..b252591 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.accounts.types.CreateEnvironmentRequestBodyEnvironmentType; +import com.schematic.api.types.EnvironmentType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -20,23 +20,21 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateEnvironmentRequestBody.Builder.class) public final class CreateEnvironmentRequestBody { - private final CreateEnvironmentRequestBodyEnvironmentType environmentType; + private final EnvironmentType environmentType; private final String name; private final Map additionalProperties; private CreateEnvironmentRequestBody( - CreateEnvironmentRequestBodyEnvironmentType environmentType, - String name, - Map additionalProperties) { + EnvironmentType environmentType, String name, Map additionalProperties) { this.environmentType = environmentType; this.name = name; this.additionalProperties = additionalProperties; } @JsonProperty("environment_type") - public CreateEnvironmentRequestBodyEnvironmentType getEnvironmentType() { + public EnvironmentType getEnvironmentType() { return environmentType; } @@ -75,7 +73,7 @@ public static EnvironmentTypeStage builder() { } public interface EnvironmentTypeStage { - NameStage environmentType(@NotNull CreateEnvironmentRequestBodyEnvironmentType environmentType); + NameStage environmentType(@NotNull EnvironmentType environmentType); Builder from(CreateEnvironmentRequestBody other); } @@ -90,7 +88,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements EnvironmentTypeStage, NameStage, _FinalStage { - private CreateEnvironmentRequestBodyEnvironmentType environmentType; + private EnvironmentType environmentType; private String name; @@ -108,7 +106,7 @@ public Builder from(CreateEnvironmentRequestBody other) { @java.lang.Override @JsonSetter("environment_type") - public NameStage environmentType(@NotNull CreateEnvironmentRequestBodyEnvironmentType environmentType) { + public NameStage environmentType(@NotNull EnvironmentType environmentType) { this.environmentType = Objects.requireNonNull(environmentType, "environmentType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/crm/requests/ListCrmProductsRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java similarity index 56% rename from src/main/java/com/schematic/api/resources/crm/requests/ListCrmProductsRequest.java rename to src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java index 10bdd70..a4577da 100644 --- a/src/main/java/com/schematic/api/resources/crm/requests/ListCrmProductsRequest.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.requests; +package com.schematic.api.resources.accounts.requests; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,19 +12,20 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import java.util.Collections; +import com.schematic.api.types.ActorType; 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 = ListCrmProductsRequest.Builder.class) -public final class ListCrmProductsRequest { - private final Optional> ids; +@JsonDeserialize(builder = ListAuditLogsRequest.Builder.class) +public final class ListAuditLogsRequest { + private final Optional actorType; - private final Optional name; + private final Optional environmentId; + + private final Optional q; private final Optional limit; @@ -32,27 +33,34 @@ public final class ListCrmProductsRequest { private final Map additionalProperties; - private ListCrmProductsRequest( - Optional> ids, - Optional name, + private ListAuditLogsRequest( + Optional actorType, + Optional environmentId, + Optional q, Optional limit, Optional offset, Map additionalProperties) { - this.ids = ids; - this.name = name; + this.actorType = actorType; + this.environmentId = environmentId; + this.q = q; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } - @JsonProperty("ids") - public Optional> getIds() { - return ids; + @JsonProperty("actor_type") + public Optional getActorType() { + return actorType; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; } - @JsonProperty("name") - public Optional getName() { - return name; + @JsonProperty("q") + public Optional getQ() { + return q; } /** @@ -74,7 +82,7 @@ public Optional getOffset() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListCrmProductsRequest && equalTo((ListCrmProductsRequest) other); + return other instanceof ListAuditLogsRequest && equalTo((ListAuditLogsRequest) other); } @JsonAnyGetter @@ -82,16 +90,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListCrmProductsRequest other) { - return ids.equals(other.ids) - && name.equals(other.name) + private boolean equalTo(ListAuditLogsRequest other) { + return actorType.equals(other.actorType) + && environmentId.equals(other.environmentId) + && q.equals(other.q) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.ids, this.name, this.limit, this.offset); + return Objects.hash(this.actorType, this.environmentId, this.q, this.limit, this.offset); } @java.lang.Override @@ -105,9 +114,11 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> ids = Optional.empty(); + private Optional actorType = Optional.empty(); + + private Optional environmentId = Optional.empty(); - private Optional name = Optional.empty(); + private Optional q = Optional.empty(); private Optional limit = Optional.empty(); @@ -118,38 +129,45 @@ public static final class Builder { private Builder() {} - public Builder from(ListCrmProductsRequest other) { - ids(other.getIds()); - name(other.getName()); + public Builder from(ListAuditLogsRequest other) { + actorType(other.getActorType()); + environmentId(other.getEnvironmentId()); + 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; + @JsonSetter(value = "actor_type", nulls = Nulls.SKIP) + public Builder actorType(Optional actorType) { + this.actorType = actorType; + return this; + } + + public Builder actorType(ActorType actorType) { + this.actorType = Optional.ofNullable(actorType); return this; } - public Builder ids(List ids) { - this.ids = Optional.ofNullable(ids); + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public Builder environmentId(Optional environmentId) { + this.environmentId = environmentId; return this; } - public Builder ids(String ids) { - this.ids = Optional.of(Collections.singletonList(ids)); + public Builder environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); return this; } - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; return this; } - public Builder name(String name) { - this.name = Optional.ofNullable(name); + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } @@ -181,8 +199,8 @@ public Builder offset(Integer offset) { return this; } - public ListCrmProductsRequest build() { - return new ListCrmProductsRequest(ids, name, limit, offset, additionalProperties); + public ListAuditLogsRequest build() { + return new ListAuditLogsRequest(actorType, environmentId, q, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java index 43537d0..65510f4 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.accounts.types.UpdateEnvironmentRequestBodyEnvironmentType; +import com.schematic.api.types.EnvironmentType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -21,14 +21,14 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpdateEnvironmentRequestBody.Builder.class) public final class UpdateEnvironmentRequestBody { - private final Optional environmentType; + private final Optional environmentType; private final Optional name; private final Map additionalProperties; private UpdateEnvironmentRequestBody( - Optional environmentType, + Optional environmentType, Optional name, Map additionalProperties) { this.environmentType = environmentType; @@ -37,7 +37,7 @@ private UpdateEnvironmentRequestBody( } @JsonProperty("environment_type") - public Optional getEnvironmentType() { + public Optional getEnvironmentType() { return environmentType; } @@ -77,7 +77,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional environmentType = Optional.empty(); + private Optional environmentType = Optional.empty(); private Optional name = Optional.empty(); @@ -93,12 +93,12 @@ public Builder from(UpdateEnvironmentRequestBody other) { } @JsonSetter(value = "environment_type", nulls = Nulls.SKIP) - public Builder environmentType(Optional environmentType) { + public Builder environmentType(Optional environmentType) { this.environmentType = environmentType; return this; } - public Builder environmentType(UpdateEnvironmentRequestBodyEnvironmentType environmentType) { + public Builder environmentType(EnvironmentType environmentType) { this.environmentType = Optional.ofNullable(environmentType); return this; } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java new file mode 100644 index 0000000..0901ea8 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java @@ -0,0 +1,206 @@ +/** + * 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.ActorType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountAuditLogsParams.Builder.class) +public final class CountAuditLogsParams { + private final Optional actorType; + + private final Optional environmentId; + + private final Optional limit; + + private final Optional offset; + + private final Optional q; + + private final Map additionalProperties; + + private CountAuditLogsParams( + Optional actorType, + Optional environmentId, + Optional limit, + Optional offset, + Optional q, + Map additionalProperties) { + this.actorType = actorType; + this.environmentId = environmentId; + this.limit = limit; + this.offset = offset; + this.q = q; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actor_type") + public Optional getActorType() { + return actorType; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountAuditLogsParams && equalTo((CountAuditLogsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountAuditLogsParams other) { + return actorType.equals(other.actorType) + && environmentId.equals(other.environmentId) + && limit.equals(other.limit) + && offset.equals(other.offset) + && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actorType, this.environmentId, 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 actorType = Optional.empty(); + + private Optional environmentId = 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(CountAuditLogsParams other) { + actorType(other.getActorType()); + environmentId(other.getEnvironmentId()); + limit(other.getLimit()); + offset(other.getOffset()); + q(other.getQ()); + return this; + } + + @JsonSetter(value = "actor_type", nulls = Nulls.SKIP) + public Builder actorType(Optional actorType) { + this.actorType = actorType; + return this; + } + + public Builder actorType(ActorType actorType) { + this.actorType = Optional.ofNullable(actorType); + return this; + } + + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public Builder environmentId(Optional environmentId) { + this.environmentId = environmentId; + return this; + } + + public Builder environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); + 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(Integer 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(Integer offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @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 CountAuditLogsParams build() { + return new CountAuditLogsParams(actorType, environmentId, limit, offset, q, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java new file mode 100644 index 0000000..719a9a1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.accounts.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CountResponse; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountAuditLogsResponse.Builder.class) +public final class CountAuditLogsResponse { + private final CountResponse data; + + private final CountAuditLogsParams params; + + private final Map additionalProperties; + + private CountAuditLogsResponse( + CountResponse data, CountAuditLogsParams 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 CountAuditLogsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountAuditLogsResponse && equalTo((CountAuditLogsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountAuditLogsResponse 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(CountAuditLogsResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull CountAuditLogsParams params); + } + + public interface _FinalStage { + CountAuditLogsResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private CountResponse data; + + private CountAuditLogsParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountAuditLogsResponse 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 CountAuditLogsParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public CountAuditLogsResponse build() { + return new CountAuditLogsResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/crm/types/UpsertCrmDealResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java similarity index 78% rename from src/main/java/com/schematic/api/resources/crm/types/UpsertCrmDealResponse.java rename to src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java index 17987f3..23982de 100644 --- a/src/main/java/com/schematic/api/resources/crm/types/UpsertCrmDealResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.types; +package com.schematic.api.resources.accounts.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.CrmDealResponseData; +import com.schematic.api.types.AuditLogResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,23 +21,23 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpsertCrmDealResponse.Builder.class) -public final class UpsertCrmDealResponse { - private final CrmDealResponseData data; +@JsonDeserialize(builder = GetAuditLogResponse.Builder.class) +public final class GetAuditLogResponse { + private final AuditLogResponseData data; private final Map params; private final Map additionalProperties; - private UpsertCrmDealResponse( - CrmDealResponseData data, Map params, Map additionalProperties) { + private GetAuditLogResponse( + AuditLogResponseData data, Map params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public CrmDealResponseData getData() { + public AuditLogResponseData getData() { return data; } @@ -52,7 +52,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof UpsertCrmDealResponse && equalTo((UpsertCrmDealResponse) other); + return other instanceof GetAuditLogResponse && equalTo((GetAuditLogResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(UpsertCrmDealResponse other) { + private boolean equalTo(GetAuditLogResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -79,13 +79,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull CrmDealResponseData data); + _FinalStage data(@NotNull AuditLogResponseData data); - Builder from(UpsertCrmDealResponse other); + Builder from(GetAuditLogResponse other); } public interface _FinalStage { - UpsertCrmDealResponse build(); + GetAuditLogResponse build(); /** *

Input parameters

@@ -99,7 +99,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private CrmDealResponseData data; + private AuditLogResponseData data; private Map params = new LinkedHashMap<>(); @@ -109,7 +109,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(UpsertCrmDealResponse other) { + public Builder from(GetAuditLogResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -117,7 +117,7 @@ public Builder from(UpsertCrmDealResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull CrmDealResponseData data) { + public _FinalStage data(@NotNull AuditLogResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -158,8 +158,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public UpsertCrmDealResponse build() { - return new UpsertCrmDealResponse(data, params, additionalProperties); + public GetAuditLogResponse build() { + return new GetAuditLogResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java new file mode 100644 index 0000000..2d7380e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java @@ -0,0 +1,206 @@ +/** + * 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.ActorType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAuditLogsParams.Builder.class) +public final class ListAuditLogsParams { + private final Optional actorType; + + private final Optional environmentId; + + private final Optional limit; + + private final Optional offset; + + private final Optional q; + + private final Map additionalProperties; + + private ListAuditLogsParams( + Optional actorType, + Optional environmentId, + Optional limit, + Optional offset, + Optional q, + Map additionalProperties) { + this.actorType = actorType; + this.environmentId = environmentId; + this.limit = limit; + this.offset = offset; + this.q = q; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actor_type") + public Optional getActorType() { + return actorType; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAuditLogsParams && equalTo((ListAuditLogsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAuditLogsParams other) { + return actorType.equals(other.actorType) + && environmentId.equals(other.environmentId) + && limit.equals(other.limit) + && offset.equals(other.offset) + && q.equals(other.q); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.actorType, this.environmentId, 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 actorType = Optional.empty(); + + private Optional environmentId = 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(ListAuditLogsParams other) { + actorType(other.getActorType()); + environmentId(other.getEnvironmentId()); + limit(other.getLimit()); + offset(other.getOffset()); + q(other.getQ()); + return this; + } + + @JsonSetter(value = "actor_type", nulls = Nulls.SKIP) + public Builder actorType(Optional actorType) { + this.actorType = actorType; + return this; + } + + public Builder actorType(ActorType actorType) { + this.actorType = Optional.ofNullable(actorType); + return this; + } + + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public Builder environmentId(Optional environmentId) { + this.environmentId = environmentId; + return this; + } + + public Builder environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); + 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(Integer 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(Integer offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @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 ListAuditLogsParams build() { + return new ListAuditLogsParams(actorType, environmentId, limit, offset, q, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/crm/types/ListCrmProductsResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java similarity index 66% rename from src/main/java/com/schematic/api/resources/crm/types/ListCrmProductsResponse.java rename to src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java index 1733a46..da1c515 100644 --- a/src/main/java/com/schematic/api/resources/crm/types/ListCrmProductsResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.types; +package com.schematic.api.resources.accounts.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.CrmProductResponseData; +import com.schematic.api.types.AuditLogListResponseData; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -21,23 +21,23 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListCrmProductsResponse.Builder.class) -public final class ListCrmProductsResponse { - private final List data; +@JsonDeserialize(builder = ListAuditLogsResponse.Builder.class) +public final class ListAuditLogsResponse { + private final List data; - private final ListCrmProductsParams params; + private final ListAuditLogsParams params; private final Map additionalProperties; - private ListCrmProductsResponse( - List data, ListCrmProductsParams params, Map additionalProperties) { + private ListAuditLogsResponse( + List data, ListAuditLogsParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public List getData() { + public List getData() { return data; } @@ -45,14 +45,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public ListCrmProductsParams getParams() { + public ListAuditLogsParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListCrmProductsResponse && equalTo((ListCrmProductsResponse) other); + return other instanceof ListAuditLogsResponse && equalTo((ListAuditLogsResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListCrmProductsResponse other) { + private boolean equalTo(ListAuditLogsResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -82,26 +82,26 @@ public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull ListCrmProductsParams params); + _FinalStage params(@NotNull ListAuditLogsParams params); - Builder from(ListCrmProductsResponse other); + Builder from(ListAuditLogsResponse other); } public interface _FinalStage { - ListCrmProductsResponse build(); + ListAuditLogsResponse build(); - _FinalStage data(List data); + _FinalStage data(List data); - _FinalStage addData(CrmProductResponseData data); + _FinalStage addData(AuditLogListResponseData data); - _FinalStage addAllData(List data); + _FinalStage addAllData(List data); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ParamsStage, _FinalStage { - private ListCrmProductsParams params; + private ListAuditLogsParams params; - private List data = new ArrayList<>(); + private List data = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -109,7 +109,7 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(ListCrmProductsResponse other) { + public Builder from(ListAuditLogsResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -122,13 +122,13 @@ public Builder from(ListCrmProductsResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull ListCrmProductsParams params) { + public _FinalStage params(@NotNull ListAuditLogsParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @java.lang.Override - public _FinalStage addAllData(List data) { + public _FinalStage addAllData(List data) { if (data != null) { this.data.addAll(data); } @@ -136,14 +136,14 @@ public _FinalStage addAllData(List data) { } @java.lang.Override - public _FinalStage addData(CrmProductResponseData data) { + public _FinalStage addData(AuditLogListResponseData data) { this.data.add(data); return this; } @java.lang.Override @JsonSetter(value = "data", nulls = Nulls.SKIP) - public _FinalStage data(List data) { + public _FinalStage data(List data) { this.data.clear(); if (data != null) { this.data.addAll(data); @@ -152,8 +152,8 @@ public _FinalStage data(List data) { } @java.lang.Override - public ListCrmProductsResponse build() { - return new ListCrmProductsResponse(data, params, additionalProperties); + public ListAuditLogsResponse build() { + return new ListAuditLogsResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentRequestBodyEnvironmentType.java b/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentRequestBodyEnvironmentType.java deleted file mode 100644 index 39d9ea7..0000000 --- a/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentRequestBodyEnvironmentType.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.accounts.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateEnvironmentRequestBodyEnvironmentType { - public static final UpdateEnvironmentRequestBodyEnvironmentType DEVELOPMENT = - new UpdateEnvironmentRequestBodyEnvironmentType(Value.DEVELOPMENT, "development"); - - public static final UpdateEnvironmentRequestBodyEnvironmentType STAGING = - new UpdateEnvironmentRequestBodyEnvironmentType(Value.STAGING, "staging"); - - public static final UpdateEnvironmentRequestBodyEnvironmentType PRODUCTION = - new UpdateEnvironmentRequestBodyEnvironmentType(Value.PRODUCTION, "production"); - - private final Value value; - - private final String string; - - UpdateEnvironmentRequestBodyEnvironmentType(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 UpdateEnvironmentRequestBodyEnvironmentType - && this.string.equals(((UpdateEnvironmentRequestBodyEnvironmentType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case DEVELOPMENT: - return visitor.visitDevelopment(); - case STAGING: - return visitor.visitStaging(); - case PRODUCTION: - return visitor.visitProduction(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateEnvironmentRequestBodyEnvironmentType valueOf(String value) { - switch (value) { - case "development": - return DEVELOPMENT; - case "staging": - return STAGING; - case "production": - return PRODUCTION; - default: - return new UpdateEnvironmentRequestBodyEnvironmentType(Value.UNKNOWN, value); - } - } - - public enum Value { - DEVELOPMENT, - - STAGING, - - PRODUCTION, - - UNKNOWN - } - - public interface Visitor { - T visitDevelopment(); - - T visitStaging(); - - T visitProduction(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java b/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java index da31034..df85784 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java @@ -15,26 +15,26 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; +import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; import com.schematic.api.resources.billing.requests.ListCouponsRequest; import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; -import com.schematic.api.resources.billing.requests.ListProductPricesRequest; -import com.schematic.api.resources.billing.requests.SearchBillingPricesRequest; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; import com.schematic.api.resources.billing.types.DeleteBillingProductResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; +import com.schematic.api.resources.billing.types.ListBillingPricesResponse; +import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; import com.schematic.api.resources.billing.types.ListCouponsResponse; import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.ListProductPricesResponse; -import com.schematic.api.resources.billing.types.SearchBillingPricesResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; import com.schematic.api.resources.billing.types.UpsertBillingCustomerResponse; import com.schematic.api.resources.billing.types.UpsertBillingMeterResponse; @@ -180,17 +180,17 @@ public CompletableFuture upsertPaymentMethod( return this.rawClient.upsertPaymentMethod(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture searchBillingPrices() { - return this.rawClient.searchBillingPrices().thenApply(response -> response.body()); + public CompletableFuture listBillingPrices() { + return this.rawClient.listBillingPrices().thenApply(response -> response.body()); } - public CompletableFuture searchBillingPrices(SearchBillingPricesRequest request) { - return this.rawClient.searchBillingPrices(request).thenApply(response -> response.body()); + public CompletableFuture listBillingPrices(ListBillingPricesRequest request) { + return this.rawClient.listBillingPrices(request).thenApply(response -> response.body()); } - public CompletableFuture searchBillingPrices( - SearchBillingPricesRequest request, RequestOptions requestOptions) { - return this.rawClient.searchBillingPrices(request, requestOptions).thenApply(response -> response.body()); + public CompletableFuture listBillingPrices( + ListBillingPricesRequest request, RequestOptions requestOptions) { + return this.rawClient.listBillingPrices(request, requestOptions).thenApply(response -> response.body()); } public CompletableFuture upsertBillingPrice(CreateBillingPriceRequestBody request) { @@ -211,17 +211,18 @@ public CompletableFuture deleteBillingProduct( return this.rawClient.deleteBillingProduct(billingId, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture listProductPrices() { - return this.rawClient.listProductPrices().thenApply(response -> response.body()); + public CompletableFuture listBillingProductPrices() { + return this.rawClient.listBillingProductPrices().thenApply(response -> response.body()); } - public CompletableFuture listProductPrices(ListProductPricesRequest request) { - return this.rawClient.listProductPrices(request).thenApply(response -> response.body()); + public CompletableFuture listBillingProductPrices( + ListBillingProductPricesRequest request) { + return this.rawClient.listBillingProductPrices(request).thenApply(response -> response.body()); } - public CompletableFuture listProductPrices( - ListProductPricesRequest request, RequestOptions requestOptions) { - return this.rawClient.listProductPrices(request, requestOptions).thenApply(response -> response.body()); + public CompletableFuture listBillingProductPrices( + ListBillingProductPricesRequest request, RequestOptions requestOptions) { + return this.rawClient.listBillingProductPrices(request, requestOptions).thenApply(response -> response.body()); } public CompletableFuture deleteProductPrice(String billingId) { diff --git a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java index 975d9b0..44cda57 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java @@ -27,26 +27,26 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; +import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; import com.schematic.api.resources.billing.requests.ListCouponsRequest; import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; -import com.schematic.api.resources.billing.requests.ListProductPricesRequest; -import com.schematic.api.resources.billing.requests.SearchBillingPricesRequest; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; import com.schematic.api.resources.billing.types.DeleteBillingProductResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; +import com.schematic.api.resources.billing.types.ListBillingPricesResponse; +import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; import com.schematic.api.resources.billing.types.ListCouponsResponse; import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.ListProductPricesResponse; -import com.schematic.api.resources.billing.types.SearchBillingPricesResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; import com.schematic.api.resources.billing.types.UpsertBillingCustomerResponse; import com.schematic.api.resources.billing.types.UpsertBillingMeterResponse; @@ -381,9 +381,9 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getFailedToImport().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "failed_to_import", request.getFailedToImport().get(), false); + httpUrl, "provider_type", request.getProviderType().get(), false); } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); @@ -492,9 +492,9 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getFailedToImport().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "failed_to_import", request.getFailedToImport().get(), false); + httpUrl, "provider_type", request.getProviderType().get(), false); } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); @@ -1149,17 +1149,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> searchBillingPrices() { - return searchBillingPrices(SearchBillingPricesRequest.builder().build()); + public CompletableFuture> listBillingPrices() { + return listBillingPrices(ListBillingPricesRequest.builder().build()); } - public CompletableFuture> searchBillingPrices( - SearchBillingPricesRequest request) { - return searchBillingPrices(request, null); + public CompletableFuture> listBillingPrices( + ListBillingPricesRequest request) { + return listBillingPrices(request, null); } - public CompletableFuture> searchBillingPrices( - SearchBillingPricesRequest request, RequestOptions requestOptions) { + public CompletableFuture> listBillingPrices( + ListBillingPricesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/price"); @@ -1174,27 +1174,28 @@ public CompletableFuture> request.getForTrialExpiryPlan().get(), false); } - if (request.getProductId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "product_id", request.getProductId().get(), false); - } if (request.getInterval().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "interval", request.getInterval().get(), false); } + if (request.getIsActive().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "is_active", request.getIsActive().get(), false); + } if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price", request.getPrice().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); } - if (request.getRequiresPaymentMethod().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "requires_payment_method", - request.getRequiresPaymentMethod().get(), - false); + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } if (request.getTiersMode().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1204,6 +1205,10 @@ public CompletableFuture> QueryStringMapper.addQueryParameter( httpUrl, "usage_type", request.getUsageType().get(), false); } + if (request.getWithMeter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_meter", request.getWithMeter().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -1215,6 +1220,10 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1225,7 +1234,7 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -1233,7 +1242,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), SearchBillingPricesResponse.class), + responseBody.string(), ListBillingPricesResponse.class), response)); return; } @@ -1465,56 +1474,66 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> listProductPrices() { - return listProductPrices(ListProductPricesRequest.builder().build()); + public CompletableFuture> listBillingProductPrices() { + return listBillingProductPrices( + ListBillingProductPricesRequest.builder().build()); } - public CompletableFuture> listProductPrices( - ListProductPricesRequest request) { - return listProductPrices(request, null); + public CompletableFuture> listBillingProductPrices( + ListBillingProductPricesRequest request) { + return listBillingProductPrices(request, null); } - public CompletableFuture> listProductPrices( - ListProductPricesRequest request, RequestOptions requestOptions) { + public CompletableFuture> listBillingProductPrices( + ListBillingProductPricesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices"); - if (request.getName().isPresent()) { + if (request.getForInitialPlan().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "name", request.getName().get(), false); + httpUrl, "for_initial_plan", request.getForInitialPlan().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + if (request.getForTrialExpiryPlan().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "for_trial_expiry_plan", + request.getForTrialExpiryPlan().get(), + false); } - if (request.getPriceUsageType().isPresent()) { + if (request.getInterval().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "price_usage_type", request.getPriceUsageType().get(), false); + httpUrl, "interval", request.getInterval().get(), false); } - if (request.getWithoutLinkedToPlan().isPresent()) { + if (request.getIsActive().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "without_linked_to_plan", - request.getWithoutLinkedToPlan().get(), - false); + httpUrl, "is_active", request.getIsActive().get(), false); } - if (request.getWithOneTimeCharges().isPresent()) { + if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "with_one_time_charges", - request.getWithOneTimeCharges().get(), - false); + httpUrl, "price", request.getPrice().get(), false); } - if (request.getWithZeroPrice().isPresent()) { + if (request.getProductId().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); + httpUrl, "product_id", request.getProductId().get(), false); } - if (request.getWithPricesOnly().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "with_prices_only", request.getWithPricesOnly().get(), false); + httpUrl, "provider_type", request.getProviderType().get(), false); } - if (request.getIsActive().isPresent()) { + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getTiersMode().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "is_active", request.getIsActive().get(), false); + httpUrl, "tiers_mode", request.getTiersMode().get(), false); + } + if (request.getUsageType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "usage_type", request.getUsageType().get(), false); + } + if (request.getWithMeter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_meter", request.getWithMeter().get(), false); } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1527,6 +1546,10 @@ public CompletableFuture> l if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1537,7 +1560,8 @@ public CompletableFuture> l if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> future = + new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { @@ -1545,7 +1569,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListProductPricesResponse.class), + responseBody.string(), ListBillingProductPricesResponse.class), response)); return; } @@ -1791,23 +1815,24 @@ public CompletableFuture> HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/products"); + if (request.getIsActive().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "is_active", request.getIsActive().get(), false); + } if (request.getName().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } if (request.getPriceUsageType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price_usage_type", request.getPriceUsageType().get(), false); } - if (request.getWithoutLinkedToPlan().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "without_linked_to_plan", - request.getWithoutLinkedToPlan().get(), - false); + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } if (request.getWithOneTimeCharges().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1816,17 +1841,20 @@ public CompletableFuture> request.getWithOneTimeCharges().get(), false); } - if (request.getWithZeroPrice().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); - } if (request.getWithPricesOnly().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_prices_only", request.getWithPricesOnly().get(), false); } - if (request.getIsActive().isPresent()) { + if (request.getWithZeroPrice().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "is_active", request.getIsActive().get(), false); + httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); + } + if (request.getWithoutLinkedToPlan().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_linked_to_plan", + request.getWithoutLinkedToPlan().get(), + false); } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1926,23 +1954,24 @@ public CompletableFuture HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/products/count"); + if (request.getIsActive().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "is_active", request.getIsActive().get(), false); + } if (request.getName().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } if (request.getPriceUsageType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price_usage_type", request.getPriceUsageType().get(), false); } - if (request.getWithoutLinkedToPlan().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "without_linked_to_plan", - request.getWithoutLinkedToPlan().get(), - false); + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } if (request.getWithOneTimeCharges().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1951,17 +1980,20 @@ public CompletableFuture request.getWithOneTimeCharges().get(), false); } - if (request.getWithZeroPrice().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); - } if (request.getWithPricesOnly().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_prices_only", request.getWithPricesOnly().get(), false); } - if (request.getIsActive().isPresent()) { + if (request.getWithZeroPrice().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "is_active", request.getIsActive().get(), false); + httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); + } + if (request.getWithoutLinkedToPlan().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_linked_to_plan", + request.getWithoutLinkedToPlan().get(), + false); } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( diff --git a/src/main/java/com/schematic/api/resources/billing/BillingClient.java b/src/main/java/com/schematic/api/resources/billing/BillingClient.java index 6fa2651..e65d999 100644 --- a/src/main/java/com/schematic/api/resources/billing/BillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/BillingClient.java @@ -15,26 +15,26 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; +import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; import com.schematic.api.resources.billing.requests.ListCouponsRequest; import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; -import com.schematic.api.resources.billing.requests.ListProductPricesRequest; -import com.schematic.api.resources.billing.requests.SearchBillingPricesRequest; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; import com.schematic.api.resources.billing.types.DeleteBillingProductResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; +import com.schematic.api.resources.billing.types.ListBillingPricesResponse; +import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; import com.schematic.api.resources.billing.types.ListCouponsResponse; import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.ListProductPricesResponse; -import com.schematic.api.resources.billing.types.SearchBillingPricesResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; import com.schematic.api.resources.billing.types.UpsertBillingCustomerResponse; import com.schematic.api.resources.billing.types.UpsertBillingMeterResponse; @@ -174,17 +174,17 @@ public UpsertPaymentMethodResponse upsertPaymentMethod( return this.rawClient.upsertPaymentMethod(request, requestOptions).body(); } - public SearchBillingPricesResponse searchBillingPrices() { - return this.rawClient.searchBillingPrices().body(); + public ListBillingPricesResponse listBillingPrices() { + return this.rawClient.listBillingPrices().body(); } - public SearchBillingPricesResponse searchBillingPrices(SearchBillingPricesRequest request) { - return this.rawClient.searchBillingPrices(request).body(); + public ListBillingPricesResponse listBillingPrices(ListBillingPricesRequest request) { + return this.rawClient.listBillingPrices(request).body(); } - public SearchBillingPricesResponse searchBillingPrices( - SearchBillingPricesRequest request, RequestOptions requestOptions) { - return this.rawClient.searchBillingPrices(request, requestOptions).body(); + public ListBillingPricesResponse listBillingPrices( + ListBillingPricesRequest request, RequestOptions requestOptions) { + return this.rawClient.listBillingPrices(request, requestOptions).body(); } public UpsertBillingPriceResponse upsertBillingPrice(CreateBillingPriceRequestBody request) { @@ -204,17 +204,17 @@ public DeleteBillingProductResponse deleteBillingProduct(String billingId, Reque return this.rawClient.deleteBillingProduct(billingId, requestOptions).body(); } - public ListProductPricesResponse listProductPrices() { - return this.rawClient.listProductPrices().body(); + public ListBillingProductPricesResponse listBillingProductPrices() { + return this.rawClient.listBillingProductPrices().body(); } - public ListProductPricesResponse listProductPrices(ListProductPricesRequest request) { - return this.rawClient.listProductPrices(request).body(); + public ListBillingProductPricesResponse listBillingProductPrices(ListBillingProductPricesRequest request) { + return this.rawClient.listBillingProductPrices(request).body(); } - public ListProductPricesResponse listProductPrices( - ListProductPricesRequest request, RequestOptions requestOptions) { - return this.rawClient.listProductPrices(request, requestOptions).body(); + public ListBillingProductPricesResponse listBillingProductPrices( + ListBillingProductPricesRequest request, RequestOptions requestOptions) { + return this.rawClient.listBillingProductPrices(request, requestOptions).body(); } public DeleteProductPriceResponse deleteProductPrice(String billingId) { diff --git a/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java b/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java index bc7a7f0..52a949f 100644 --- a/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java @@ -27,26 +27,26 @@ import com.schematic.api.resources.billing.requests.CreateInvoiceRequestBody; import com.schematic.api.resources.billing.requests.CreateMeterRequestBody; import com.schematic.api.resources.billing.requests.CreatePaymentMethodRequestBody; +import com.schematic.api.resources.billing.requests.ListBillingPricesRequest; +import com.schematic.api.resources.billing.requests.ListBillingProductPricesRequest; import com.schematic.api.resources.billing.requests.ListBillingProductsRequest; import com.schematic.api.resources.billing.requests.ListCouponsRequest; import com.schematic.api.resources.billing.requests.ListCustomersWithSubscriptionsRequest; import com.schematic.api.resources.billing.requests.ListInvoicesRequest; import com.schematic.api.resources.billing.requests.ListMetersRequest; import com.schematic.api.resources.billing.requests.ListPaymentMethodsRequest; -import com.schematic.api.resources.billing.requests.ListProductPricesRequest; -import com.schematic.api.resources.billing.requests.SearchBillingPricesRequest; import com.schematic.api.resources.billing.types.CountBillingProductsResponse; import com.schematic.api.resources.billing.types.CountCustomersResponse; import com.schematic.api.resources.billing.types.DeleteBillingProductResponse; import com.schematic.api.resources.billing.types.DeleteProductPriceResponse; +import com.schematic.api.resources.billing.types.ListBillingPricesResponse; +import com.schematic.api.resources.billing.types.ListBillingProductPricesResponse; import com.schematic.api.resources.billing.types.ListBillingProductsResponse; import com.schematic.api.resources.billing.types.ListCouponsResponse; import com.schematic.api.resources.billing.types.ListCustomersWithSubscriptionsResponse; import com.schematic.api.resources.billing.types.ListInvoicesResponse; import com.schematic.api.resources.billing.types.ListMetersResponse; import com.schematic.api.resources.billing.types.ListPaymentMethodsResponse; -import com.schematic.api.resources.billing.types.ListProductPricesResponse; -import com.schematic.api.resources.billing.types.SearchBillingPricesResponse; import com.schematic.api.resources.billing.types.UpsertBillingCouponResponse; import com.schematic.api.resources.billing.types.UpsertBillingCustomerResponse; import com.schematic.api.resources.billing.types.UpsertBillingMeterResponse; @@ -303,9 +303,9 @@ public BaseSchematicHttpResponse listCus QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getFailedToImport().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "failed_to_import", request.getFailedToImport().get(), false); + httpUrl, "provider_type", request.getProviderType().get(), false); } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); @@ -389,9 +389,9 @@ public BaseSchematicHttpResponse countCustomers( QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getFailedToImport().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "failed_to_import", request.getFailedToImport().get(), false); + httpUrl, "provider_type", request.getProviderType().get(), false); } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); @@ -876,17 +876,16 @@ public BaseSchematicHttpResponse upsertPaymentMetho } } - public BaseSchematicHttpResponse searchBillingPrices() { - return searchBillingPrices(SearchBillingPricesRequest.builder().build()); + public BaseSchematicHttpResponse listBillingPrices() { + return listBillingPrices(ListBillingPricesRequest.builder().build()); } - public BaseSchematicHttpResponse searchBillingPrices( - SearchBillingPricesRequest request) { - return searchBillingPrices(request, null); + public BaseSchematicHttpResponse listBillingPrices(ListBillingPricesRequest request) { + return listBillingPrices(request, null); } - public BaseSchematicHttpResponse searchBillingPrices( - SearchBillingPricesRequest request, RequestOptions requestOptions) { + public BaseSchematicHttpResponse listBillingPrices( + ListBillingPricesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/price"); @@ -901,27 +900,28 @@ public BaseSchematicHttpResponse searchBillingPrice request.getForTrialExpiryPlan().get(), false); } - if (request.getProductId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "product_id", request.getProductId().get(), false); - } if (request.getInterval().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "interval", request.getInterval().get(), false); } + if (request.getIsActive().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "is_active", request.getIsActive().get(), false); + } if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price", request.getPrice().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + if (request.getProductId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_id", request.getProductId().get(), false); } - if (request.getRequiresPaymentMethod().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "requires_payment_method", - request.getRequiresPaymentMethod().get(), - false); + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } if (request.getTiersMode().isPresent()) { QueryStringMapper.addQueryParameter( @@ -931,6 +931,10 @@ public BaseSchematicHttpResponse searchBillingPrice QueryStringMapper.addQueryParameter( httpUrl, "usage_type", request.getUsageType().get(), false); } + if (request.getWithMeter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_meter", request.getWithMeter().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -942,6 +946,10 @@ public BaseSchematicHttpResponse searchBillingPrice if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -956,7 +964,7 @@ public BaseSchematicHttpResponse searchBillingPrice ResponseBody responseBody = response.body(); if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), SearchBillingPricesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListBillingPricesResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -1119,55 +1127,66 @@ public BaseSchematicHttpResponse deleteBillingProd } } - public BaseSchematicHttpResponse listProductPrices() { - return listProductPrices(ListProductPricesRequest.builder().build()); + public BaseSchematicHttpResponse listBillingProductPrices() { + return listBillingProductPrices( + ListBillingProductPricesRequest.builder().build()); } - public BaseSchematicHttpResponse listProductPrices(ListProductPricesRequest request) { - return listProductPrices(request, null); + public BaseSchematicHttpResponse listBillingProductPrices( + ListBillingProductPricesRequest request) { + return listBillingProductPrices(request, null); } - public BaseSchematicHttpResponse listProductPrices( - ListProductPricesRequest request, RequestOptions requestOptions) { + public BaseSchematicHttpResponse listBillingProductPrices( + ListBillingProductPricesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices"); - if (request.getName().isPresent()) { + if (request.getForInitialPlan().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "name", request.getName().get(), false); + httpUrl, "for_initial_plan", request.getForInitialPlan().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + if (request.getForTrialExpiryPlan().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "for_trial_expiry_plan", + request.getForTrialExpiryPlan().get(), + false); } - if (request.getPriceUsageType().isPresent()) { + if (request.getInterval().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "price_usage_type", request.getPriceUsageType().get(), false); + httpUrl, "interval", request.getInterval().get(), false); } - if (request.getWithoutLinkedToPlan().isPresent()) { + if (request.getIsActive().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "without_linked_to_plan", - request.getWithoutLinkedToPlan().get(), - false); + httpUrl, "is_active", request.getIsActive().get(), false); } - if (request.getWithOneTimeCharges().isPresent()) { + if (request.getPrice().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "with_one_time_charges", - request.getWithOneTimeCharges().get(), - false); + httpUrl, "price", request.getPrice().get(), false); } - if (request.getWithZeroPrice().isPresent()) { + if (request.getProductId().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); + httpUrl, "product_id", request.getProductId().get(), false); } - if (request.getWithPricesOnly().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "with_prices_only", request.getWithPricesOnly().get(), false); + httpUrl, "provider_type", request.getProviderType().get(), false); } - if (request.getIsActive().isPresent()) { + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getTiersMode().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "is_active", request.getIsActive().get(), false); + httpUrl, "tiers_mode", request.getTiersMode().get(), false); + } + if (request.getUsageType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "usage_type", request.getUsageType().get(), false); + } + if (request.getWithMeter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "with_meter", request.getWithMeter().get(), false); } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1180,6 +1199,10 @@ public BaseSchematicHttpResponse listProductPrices( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getProductIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "product_ids", request.getProductIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1194,7 +1217,8 @@ public BaseSchematicHttpResponse listProductPrices( ResponseBody responseBody = response.body(); if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListProductPricesResponse.class), + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), ListBillingProductPricesResponse.class), response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -1371,23 +1395,24 @@ public BaseSchematicHttpResponse listBillingProduct HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/products"); + if (request.getIsActive().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "is_active", request.getIsActive().get(), false); + } if (request.getName().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } if (request.getPriceUsageType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price_usage_type", request.getPriceUsageType().get(), false); } - if (request.getWithoutLinkedToPlan().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "without_linked_to_plan", - request.getWithoutLinkedToPlan().get(), - false); + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } if (request.getWithOneTimeCharges().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1396,17 +1421,20 @@ public BaseSchematicHttpResponse listBillingProduct request.getWithOneTimeCharges().get(), false); } - if (request.getWithZeroPrice().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); - } if (request.getWithPricesOnly().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_prices_only", request.getWithPricesOnly().get(), false); } - if (request.getIsActive().isPresent()) { + if (request.getWithZeroPrice().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "is_active", request.getIsActive().get(), false); + httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); + } + if (request.getWithoutLinkedToPlan().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_linked_to_plan", + request.getWithoutLinkedToPlan().get(), + false); } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1482,23 +1510,24 @@ public BaseSchematicHttpResponse countBillingProdu HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/products/count"); + if (request.getIsActive().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "is_active", request.getIsActive().get(), false); + } if (request.getName().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "name", request.getName().get(), false); } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } if (request.getPriceUsageType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "price_usage_type", request.getPriceUsageType().get(), false); } - if (request.getWithoutLinkedToPlan().isPresent()) { + if (request.getProviderType().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, - "without_linked_to_plan", - request.getWithoutLinkedToPlan().get(), - false); + httpUrl, "provider_type", request.getProviderType().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } if (request.getWithOneTimeCharges().isPresent()) { QueryStringMapper.addQueryParameter( @@ -1507,17 +1536,20 @@ public BaseSchematicHttpResponse countBillingProdu request.getWithOneTimeCharges().get(), false); } - if (request.getWithZeroPrice().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); - } if (request.getWithPricesOnly().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_prices_only", request.getWithPricesOnly().get(), false); } - if (request.getIsActive().isPresent()) { + if (request.getWithZeroPrice().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "is_active", request.getIsActive().get(), false); + httpUrl, "with_zero_price", request.getWithZeroPrice().get(), false); + } + if (request.getWithoutLinkedToPlan().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_linked_to_plan", + request.getWithoutLinkedToPlan().get(), + false); } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CountBillingProductsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/CountBillingProductsRequest.java index 69ff4f0..cbd5b7b 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CountBillingProductsRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CountBillingProductsRequest.java @@ -12,7 +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.resources.billing.types.CountBillingProductsRequestPriceUsageType; +import com.schematic.api.types.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -25,21 +26,23 @@ public final class CountBillingProductsRequest { private final Optional> ids; + private final Optional isActive; + private final Optional name; - private final Optional q; + private final Optional priceUsageType; - private final Optional priceUsageType; + private final Optional providerType; - private final Optional withoutLinkedToPlan; + private final Optional q; private final Optional withOneTimeCharges; - private final Optional withZeroPrice; - private final Optional withPricesOnly; - private final Optional isActive; + private final Optional withZeroPrice; + + private final Optional withoutLinkedToPlan; private final Optional limit; @@ -49,26 +52,28 @@ public final class CountBillingProductsRequest { private CountBillingProductsRequest( Optional> ids, + Optional isActive, Optional name, + Optional priceUsageType, + Optional providerType, Optional q, - Optional priceUsageType, - Optional withoutLinkedToPlan, Optional withOneTimeCharges, - Optional withZeroPrice, Optional withPricesOnly, - Optional isActive, + Optional withZeroPrice, + Optional withoutLinkedToPlan, Optional limit, Optional offset, Map additionalProperties) { this.ids = ids; + this.isActive = isActive; this.name = name; - this.q = q; this.priceUsageType = priceUsageType; - this.withoutLinkedToPlan = withoutLinkedToPlan; + this.providerType = providerType; + this.q = q; this.withOneTimeCharges = withOneTimeCharges; - this.withZeroPrice = withZeroPrice; this.withPricesOnly = withPricesOnly; - this.isActive = isActive; + this.withZeroPrice = withZeroPrice; + this.withoutLinkedToPlan = withoutLinkedToPlan; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -79,27 +84,32 @@ public Optional> getIds() { return ids; } + /** + * @return Filter products that are active. Defaults to true if not specified + */ + @JsonProperty("is_active") + public Optional getIsActive() { + return isActive; + } + @JsonProperty("name") public Optional getName() { return name; } - @JsonProperty("q") - public Optional getQ() { - return q; - } - @JsonProperty("price_usage_type") - public Optional getPriceUsageType() { + public Optional getPriceUsageType() { return priceUsageType; } - /** - * @return Filter products that are not linked to any plan - */ - @JsonProperty("without_linked_to_plan") - public Optional getWithoutLinkedToPlan() { - return withoutLinkedToPlan; + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + @JsonProperty("q") + public Optional getQ() { + return q; } /** @@ -110,14 +120,6 @@ public Optional getWithOneTimeCharges() { return withOneTimeCharges; } - /** - * @return Filter products that have zero price for free subscription type - */ - @JsonProperty("with_zero_price") - public Optional getWithZeroPrice() { - return withZeroPrice; - } - /** * @return Filter products that have prices */ @@ -127,11 +129,19 @@ public Optional getWithPricesOnly() { } /** - * @return Filter products that are active + * @return Filter products that have zero price for free subscription type */ - @JsonProperty("is_active") - public Optional getIsActive() { - return isActive; + @JsonProperty("with_zero_price") + public Optional getWithZeroPrice() { + return withZeroPrice; + } + + /** + * @return Filter products that are not linked to any plan + */ + @JsonProperty("without_linked_to_plan") + public Optional getWithoutLinkedToPlan() { + return withoutLinkedToPlan; } /** @@ -163,14 +173,15 @@ public Map getAdditionalProperties() { private boolean equalTo(CountBillingProductsRequest other) { return ids.equals(other.ids) + && isActive.equals(other.isActive) && name.equals(other.name) - && q.equals(other.q) && priceUsageType.equals(other.priceUsageType) - && withoutLinkedToPlan.equals(other.withoutLinkedToPlan) + && providerType.equals(other.providerType) + && q.equals(other.q) && withOneTimeCharges.equals(other.withOneTimeCharges) - && withZeroPrice.equals(other.withZeroPrice) && withPricesOnly.equals(other.withPricesOnly) - && isActive.equals(other.isActive) + && withZeroPrice.equals(other.withZeroPrice) + && withoutLinkedToPlan.equals(other.withoutLinkedToPlan) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -179,14 +190,15 @@ private boolean equalTo(CountBillingProductsRequest other) { public int hashCode() { return Objects.hash( this.ids, + this.isActive, this.name, - this.q, this.priceUsageType, - this.withoutLinkedToPlan, + this.providerType, + this.q, this.withOneTimeCharges, - this.withZeroPrice, this.withPricesOnly, - this.isActive, + this.withZeroPrice, + this.withoutLinkedToPlan, this.limit, this.offset); } @@ -204,21 +216,23 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); + private Optional isActive = Optional.empty(); + private Optional name = Optional.empty(); - private Optional q = Optional.empty(); + private Optional priceUsageType = Optional.empty(); - private Optional priceUsageType = Optional.empty(); + private Optional providerType = Optional.empty(); - private Optional withoutLinkedToPlan = Optional.empty(); + private Optional q = Optional.empty(); private Optional withOneTimeCharges = Optional.empty(); - private Optional withZeroPrice = Optional.empty(); - private Optional withPricesOnly = Optional.empty(); - private Optional isActive = Optional.empty(); + private Optional withZeroPrice = Optional.empty(); + + private Optional withoutLinkedToPlan = Optional.empty(); private Optional limit = Optional.empty(); @@ -231,14 +245,15 @@ private Builder() {} public Builder from(CountBillingProductsRequest other) { ids(other.getIds()); + isActive(other.getIsActive()); name(other.getName()); - q(other.getQ()); priceUsageType(other.getPriceUsageType()); - withoutLinkedToPlan(other.getWithoutLinkedToPlan()); + providerType(other.getProviderType()); + q(other.getQ()); withOneTimeCharges(other.getWithOneTimeCharges()); - withZeroPrice(other.getWithZeroPrice()); withPricesOnly(other.getWithPricesOnly()); - isActive(other.getIsActive()); + withZeroPrice(other.getWithZeroPrice()); + withoutLinkedToPlan(other.getWithoutLinkedToPlan()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -260,6 +275,20 @@ public Builder ids(String ids) { return this; } + /** + *

Filter products that are active. Defaults to true if not specified

+ */ + @JsonSetter(value = "is_active", nulls = Nulls.SKIP) + public Builder isActive(Optional isActive) { + this.isActive = isActive; + return this; + } + + public Builder isActive(Boolean isActive) { + this.isActive = Optional.ofNullable(isActive); + return this; + } + @JsonSetter(value = "name", nulls = Nulls.SKIP) public Builder name(Optional name) { this.name = name; @@ -271,39 +300,36 @@ public Builder name(String name) { return this; } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) + public Builder priceUsageType(Optional priceUsageType) { + this.priceUsageType = priceUsageType; return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + public Builder priceUsageType(BillingPriceUsageType priceUsageType) { + this.priceUsageType = Optional.ofNullable(priceUsageType); return this; } - @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) - public Builder priceUsageType(Optional priceUsageType) { - this.priceUsageType = priceUsageType; + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; return this; } - public Builder priceUsageType(CountBillingProductsRequestPriceUsageType priceUsageType) { - this.priceUsageType = Optional.ofNullable(priceUsageType); + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); return this; } - /** - *

Filter products that are not linked to any plan

- */ - @JsonSetter(value = "without_linked_to_plan", nulls = Nulls.SKIP) - public Builder withoutLinkedToPlan(Optional withoutLinkedToPlan) { - this.withoutLinkedToPlan = withoutLinkedToPlan; + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; return this; } - public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { - this.withoutLinkedToPlan = Optional.ofNullable(withoutLinkedToPlan); + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } @@ -322,44 +348,44 @@ public Builder withOneTimeCharges(Boolean withOneTimeCharges) { } /** - *

Filter products that have zero price for free subscription type

+ *

Filter products that have prices

*/ - @JsonSetter(value = "with_zero_price", nulls = Nulls.SKIP) - public Builder withZeroPrice(Optional withZeroPrice) { - this.withZeroPrice = withZeroPrice; + @JsonSetter(value = "with_prices_only", nulls = Nulls.SKIP) + public Builder withPricesOnly(Optional withPricesOnly) { + this.withPricesOnly = withPricesOnly; return this; } - public Builder withZeroPrice(Boolean withZeroPrice) { - this.withZeroPrice = Optional.ofNullable(withZeroPrice); + public Builder withPricesOnly(Boolean withPricesOnly) { + this.withPricesOnly = Optional.ofNullable(withPricesOnly); return this; } /** - *

Filter products that have prices

+ *

Filter products that have zero price for free subscription type

*/ - @JsonSetter(value = "with_prices_only", nulls = Nulls.SKIP) - public Builder withPricesOnly(Optional withPricesOnly) { - this.withPricesOnly = withPricesOnly; + @JsonSetter(value = "with_zero_price", nulls = Nulls.SKIP) + public Builder withZeroPrice(Optional withZeroPrice) { + this.withZeroPrice = withZeroPrice; return this; } - public Builder withPricesOnly(Boolean withPricesOnly) { - this.withPricesOnly = Optional.ofNullable(withPricesOnly); + public Builder withZeroPrice(Boolean withZeroPrice) { + this.withZeroPrice = Optional.ofNullable(withZeroPrice); return this; } /** - *

Filter products that are active

+ *

Filter products that are not linked to any plan

*/ - @JsonSetter(value = "is_active", nulls = Nulls.SKIP) - public Builder isActive(Optional isActive) { - this.isActive = isActive; + @JsonSetter(value = "without_linked_to_plan", nulls = Nulls.SKIP) + public Builder withoutLinkedToPlan(Optional withoutLinkedToPlan) { + this.withoutLinkedToPlan = withoutLinkedToPlan; return this; } - public Builder isActive(Boolean isActive) { - this.isActive = Optional.ofNullable(isActive); + public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { + this.withoutLinkedToPlan = Optional.ofNullable(withoutLinkedToPlan); return this; } @@ -394,14 +420,15 @@ public Builder offset(Integer offset) { public CountBillingProductsRequest build() { return new CountBillingProductsRequest( ids, + isActive, name, - q, priceUsageType, - withoutLinkedToPlan, + providerType, + q, withOneTimeCharges, - withZeroPrice, withPricesOnly, - isActive, + withZeroPrice, + withoutLinkedToPlan, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CountCustomersRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/CountCustomersRequest.java index f786a79..6eb10dc 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CountCustomersRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CountCustomersRequest.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -26,7 +27,7 @@ public final class CountCustomersRequest { private final Optional name; - private final Optional failedToImport; + private final Optional providerType; private final Optional q; @@ -39,14 +40,14 @@ public final class CountCustomersRequest { private CountCustomersRequest( Optional> companyIds, Optional name, - Optional failedToImport, + Optional providerType, Optional q, Optional limit, Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.name = name; - this.failedToImport = failedToImport; + this.providerType = providerType; this.q = q; this.limit = limit; this.offset = offset; @@ -63,9 +64,9 @@ public Optional getName() { return name; } - @JsonProperty("failed_to_import") - public Optional getFailedToImport() { - return failedToImport; + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; } @JsonProperty("q") @@ -103,7 +104,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CountCustomersRequest other) { return companyIds.equals(other.companyIds) && name.equals(other.name) - && failedToImport.equals(other.failedToImport) + && providerType.equals(other.providerType) && q.equals(other.q) && limit.equals(other.limit) && offset.equals(other.offset); @@ -111,7 +112,7 @@ private boolean equalTo(CountCustomersRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.companyIds, this.name, this.failedToImport, this.q, this.limit, this.offset); + return Objects.hash(this.companyIds, this.name, this.providerType, this.q, this.limit, this.offset); } @java.lang.Override @@ -129,7 +130,7 @@ public static final class Builder { private Optional name = Optional.empty(); - private Optional failedToImport = Optional.empty(); + private Optional providerType = Optional.empty(); private Optional q = Optional.empty(); @@ -145,7 +146,7 @@ private Builder() {} public Builder from(CountCustomersRequest other) { companyIds(other.getCompanyIds()); name(other.getName()); - failedToImport(other.getFailedToImport()); + providerType(other.getProviderType()); q(other.getQ()); limit(other.getLimit()); offset(other.getOffset()); @@ -179,14 +180,14 @@ public Builder name(String name) { return this; } - @JsonSetter(value = "failed_to_import", nulls = Nulls.SKIP) - public Builder failedToImport(Optional failedToImport) { - this.failedToImport = failedToImport; + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; return this; } - public Builder failedToImport(Boolean failedToImport) { - this.failedToImport = Optional.ofNullable(failedToImport); + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); return this; } @@ -230,7 +231,7 @@ public Builder offset(Integer offset) { } public CountCustomersRequest build() { - return new CountCustomersRequest(companyIds, name, failedToImport, q, limit, offset, additionalProperties); + return new CountCustomersRequest(companyIds, name, providerType, q, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingCustomerRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingCustomerRequestBody.java index 8c34ad6..415b17f 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingCustomerRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingCustomerRequestBody.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -30,12 +31,12 @@ public final class CreateBillingCustomerRequestBody { private final String externalId; - private final boolean failedToImport; - private final Map meta; private final String name; + private final Optional providerType; + private final Map additionalProperties; private CreateBillingCustomerRequestBody( @@ -43,17 +44,17 @@ private CreateBillingCustomerRequestBody( Optional defaultPaymentMethodId, String email, String externalId, - boolean failedToImport, Map meta, String name, + Optional providerType, Map additionalProperties) { this.companyId = companyId; this.defaultPaymentMethodId = defaultPaymentMethodId; this.email = email; this.externalId = externalId; - this.failedToImport = failedToImport; this.meta = meta; this.name = name; + this.providerType = providerType; this.additionalProperties = additionalProperties; } @@ -77,11 +78,6 @@ public String getExternalId() { return externalId; } - @JsonProperty("failed_to_import") - public boolean getFailedToImport() { - return failedToImport; - } - @JsonProperty("meta") public Map getMeta() { return meta; @@ -92,6 +88,11 @@ public String getName() { return name; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -108,9 +109,9 @@ private boolean equalTo(CreateBillingCustomerRequestBody other) { && defaultPaymentMethodId.equals(other.defaultPaymentMethodId) && email.equals(other.email) && externalId.equals(other.externalId) - && failedToImport == other.failedToImport && meta.equals(other.meta) - && name.equals(other.name); + && name.equals(other.name) + && providerType.equals(other.providerType); } @java.lang.Override @@ -120,9 +121,9 @@ public int hashCode() { this.defaultPaymentMethodId, this.email, this.externalId, - this.failedToImport, this.meta, - this.name); + this.name, + this.providerType); } @java.lang.Override @@ -141,11 +142,7 @@ public interface EmailStage { } public interface ExternalIdStage { - FailedToImportStage externalId(@NotNull String externalId); - } - - public interface FailedToImportStage { - NameStage failedToImport(boolean failedToImport); + NameStage externalId(@NotNull String externalId); } public interface NameStage { @@ -168,19 +165,22 @@ public interface _FinalStage { _FinalStage putAllMeta(Map meta); _FinalStage meta(String key, String value); + + _FinalStage providerType(Optional providerType); + + _FinalStage providerType(BillingProviderType providerType); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements EmailStage, ExternalIdStage, FailedToImportStage, NameStage, _FinalStage { + public static final class Builder implements EmailStage, ExternalIdStage, NameStage, _FinalStage { private String email; private String externalId; - private boolean failedToImport; - private String name; + private Optional providerType = Optional.empty(); + private Map meta = new LinkedHashMap<>(); private Optional defaultPaymentMethodId = Optional.empty(); @@ -198,9 +198,9 @@ public Builder from(CreateBillingCustomerRequestBody other) { defaultPaymentMethodId(other.getDefaultPaymentMethodId()); email(other.getEmail()); externalId(other.getExternalId()); - failedToImport(other.getFailedToImport()); meta(other.getMeta()); name(other.getName()); + providerType(other.getProviderType()); return this; } @@ -213,22 +213,28 @@ public ExternalIdStage email(@NotNull String email) { @java.lang.Override @JsonSetter("external_id") - public FailedToImportStage externalId(@NotNull String externalId) { + public NameStage externalId(@NotNull String externalId) { this.externalId = Objects.requireNonNull(externalId, "externalId must not be null"); return this; } @java.lang.Override - @JsonSetter("failed_to_import") - public NameStage failedToImport(boolean failedToImport) { - this.failedToImport = failedToImport; + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name 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"); + 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; } @@ -289,9 +295,9 @@ public CreateBillingCustomerRequestBody build() { defaultPaymentMethodId, email, externalId, - failedToImport, meta, name, + providerType, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java index a9212ba..a9b977a 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java @@ -12,9 +12,10 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.billing.types.CreateBillingPriceRequestBodyBillingScheme; -import com.schematic.api.resources.billing.types.CreateBillingPriceRequestBodyTiersMode; -import com.schematic.api.resources.billing.types.CreateBillingPriceRequestBodyUsageType; +import com.schematic.api.types.BillingPriceScheme; +import com.schematic.api.types.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.BillingTiersMode; import com.schematic.api.types.CreateBillingPriceTierRequestBody; import java.util.ArrayList; import java.util.HashMap; @@ -27,7 +28,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateBillingPriceRequestBody.Builder.class) public final class CreateBillingPriceRequestBody { - private final CreateBillingPriceRequestBodyBillingScheme billingScheme; + private final BillingPriceScheme billingScheme; private final String currency; @@ -51,14 +52,16 @@ public final class CreateBillingPriceRequestBody { private final String productExternalId; - private final Optional tiersMode; + private final Optional providerType; - private final CreateBillingPriceRequestBodyUsageType usageType; + private final Optional tiersMode; + + private final BillingPriceUsageType usageType; private final Map additionalProperties; private CreateBillingPriceRequestBody( - CreateBillingPriceRequestBodyBillingScheme billingScheme, + BillingPriceScheme billingScheme, String currency, String externalAccountId, String interval, @@ -70,8 +73,9 @@ private CreateBillingPriceRequestBody( String priceExternalId, List priceTiers, String productExternalId, - Optional tiersMode, - CreateBillingPriceRequestBodyUsageType usageType, + Optional providerType, + Optional tiersMode, + BillingPriceUsageType usageType, Map additionalProperties) { this.billingScheme = billingScheme; this.currency = currency; @@ -85,13 +89,14 @@ private CreateBillingPriceRequestBody( this.priceExternalId = priceExternalId; this.priceTiers = priceTiers; this.productExternalId = productExternalId; + this.providerType = providerType; this.tiersMode = tiersMode; this.usageType = usageType; this.additionalProperties = additionalProperties; } @JsonProperty("billing_scheme") - public CreateBillingPriceRequestBodyBillingScheme getBillingScheme() { + public BillingPriceScheme getBillingScheme() { return billingScheme; } @@ -150,13 +155,18 @@ public String getProductExternalId() { return productExternalId; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("tiers_mode") - public Optional getTiersMode() { + public Optional getTiersMode() { return tiersMode; } @JsonProperty("usage_type") - public CreateBillingPriceRequestBodyUsageType getUsageType() { + public BillingPriceUsageType getUsageType() { return usageType; } @@ -184,6 +194,7 @@ private boolean equalTo(CreateBillingPriceRequestBody other) { && priceExternalId.equals(other.priceExternalId) && priceTiers.equals(other.priceTiers) && productExternalId.equals(other.productExternalId) + && providerType.equals(other.providerType) && tiersMode.equals(other.tiersMode) && usageType.equals(other.usageType); } @@ -203,6 +214,7 @@ public int hashCode() { this.priceExternalId, this.priceTiers, this.productExternalId, + this.providerType, this.tiersMode, this.usageType); } @@ -217,7 +229,7 @@ public static BillingSchemeStage builder() { } public interface BillingSchemeStage { - CurrencyStage billingScheme(@NotNull CreateBillingPriceRequestBodyBillingScheme billingScheme); + CurrencyStage billingScheme(@NotNull BillingPriceScheme billingScheme); Builder from(CreateBillingPriceRequestBody other); } @@ -251,7 +263,7 @@ public interface ProductExternalIdStage { } public interface UsageTypeStage { - _FinalStage usageType(@NotNull CreateBillingPriceRequestBodyUsageType usageType); + _FinalStage usageType(@NotNull BillingPriceUsageType usageType); } public interface _FinalStage { @@ -275,9 +287,13 @@ public interface _FinalStage { _FinalStage addAllPriceTiers(List priceTiers); - _FinalStage tiersMode(Optional tiersMode); + _FinalStage providerType(Optional providerType); + + _FinalStage providerType(BillingProviderType providerType); - _FinalStage tiersMode(CreateBillingPriceRequestBodyTiersMode tiersMode); + _FinalStage tiersMode(Optional tiersMode); + + _FinalStage tiersMode(BillingTiersMode tiersMode); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -292,7 +308,7 @@ public static final class Builder ProductExternalIdStage, UsageTypeStage, _FinalStage { - private CreateBillingPriceRequestBodyBillingScheme billingScheme; + private BillingPriceScheme billingScheme; private String currency; @@ -308,9 +324,11 @@ public static final class Builder private String productExternalId; - private CreateBillingPriceRequestBodyUsageType usageType; + private BillingPriceUsageType usageType; + + private Optional tiersMode = Optional.empty(); - private Optional tiersMode = Optional.empty(); + private Optional providerType = Optional.empty(); private List priceTiers = new ArrayList<>(); @@ -339,6 +357,7 @@ public Builder from(CreateBillingPriceRequestBody other) { priceExternalId(other.getPriceExternalId()); priceTiers(other.getPriceTiers()); productExternalId(other.getProductExternalId()); + providerType(other.getProviderType()); tiersMode(other.getTiersMode()); usageType(other.getUsageType()); return this; @@ -346,7 +365,7 @@ public Builder from(CreateBillingPriceRequestBody other) { @java.lang.Override @JsonSetter("billing_scheme") - public CurrencyStage billingScheme(@NotNull CreateBillingPriceRequestBodyBillingScheme billingScheme) { + public CurrencyStage billingScheme(@NotNull BillingPriceScheme billingScheme) { this.billingScheme = Objects.requireNonNull(billingScheme, "billingScheme must not be null"); return this; } @@ -402,24 +421,37 @@ public UsageTypeStage productExternalId(@NotNull String productExternalId) { @java.lang.Override @JsonSetter("usage_type") - public _FinalStage usageType(@NotNull CreateBillingPriceRequestBodyUsageType usageType) { + public _FinalStage usageType(@NotNull BillingPriceUsageType usageType) { this.usageType = Objects.requireNonNull(usageType, "usageType must not be null"); return this; } @java.lang.Override - public _FinalStage tiersMode(CreateBillingPriceRequestBodyTiersMode tiersMode) { + public _FinalStage tiersMode(BillingTiersMode tiersMode) { this.tiersMode = Optional.ofNullable(tiersMode); return this; } @java.lang.Override @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) - public _FinalStage tiersMode(Optional tiersMode) { + public _FinalStage tiersMode(Optional tiersMode) { this.tiersMode = tiersMode; 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 addAllPriceTiers(List priceTiers) { if (priceTiers != null) { @@ -498,6 +530,7 @@ public CreateBillingPriceRequestBody build() { priceExternalId, priceTiers, productExternalId, + providerType, tiersMode, usageType, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingProductRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingProductRequestBody.java index ea226ec..8ce4a0c 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingProductRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingProductRequestBody.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -29,6 +30,8 @@ public final class CreateBillingProductRequestBody { private final double price; + private final Optional providerType; + private final Map additionalProperties; private CreateBillingProductRequestBody( @@ -36,11 +39,13 @@ private CreateBillingProductRequestBody( Optional isActive, String name, double price, + Optional providerType, Map additionalProperties) { this.externalId = externalId; this.isActive = isActive; this.name = name; this.price = price; + this.providerType = providerType; this.additionalProperties = additionalProperties; } @@ -64,6 +69,11 @@ public double getPrice() { return price; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -79,12 +89,13 @@ private boolean equalTo(CreateBillingProductRequestBody other) { return externalId.equals(other.externalId) && isActive.equals(other.isActive) && name.equals(other.name) - && price == other.price; + && price == other.price + && providerType.equals(other.providerType); } @java.lang.Override public int hashCode() { - return Objects.hash(this.externalId, this.isActive, this.name, this.price); + return Objects.hash(this.externalId, this.isActive, this.name, this.price, this.providerType); } @java.lang.Override @@ -116,6 +127,10 @@ public interface _FinalStage { _FinalStage isActive(Optional isActive); _FinalStage isActive(Boolean isActive); + + _FinalStage providerType(Optional providerType); + + _FinalStage providerType(BillingProviderType providerType); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -126,6 +141,8 @@ public static final class Builder implements ExternalIdStage, NameStage, PriceSt private double price; + private Optional providerType = Optional.empty(); + private Optional isActive = Optional.empty(); @JsonAnySetter @@ -139,6 +156,7 @@ public Builder from(CreateBillingProductRequestBody other) { isActive(other.getIsActive()); name(other.getName()); price(other.getPrice()); + providerType(other.getProviderType()); return this; } @@ -163,6 +181,19 @@ public _FinalStage price(double price) { 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 isActive(Boolean isActive) { this.isActive = Optional.ofNullable(isActive); @@ -178,7 +209,8 @@ public _FinalStage isActive(Optional isActive) { @java.lang.Override public CreateBillingProductRequestBody build() { - return new CreateBillingProductRequestBody(externalId, isActive, name, price, additionalProperties); + return new CreateBillingProductRequestBody( + externalId, isActive, name, price, providerType, additionalProperties); } } } 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 d3f6b0f..76167f9 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 @@ -13,9 +13,9 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.billing.types.CreateBillingSubscriptionRequestBodyTrialEndSetting; import com.schematic.api.types.BillingProductPricing; import com.schematic.api.types.BillingSubscriptionDiscount; +import com.schematic.api.types.BillingSubscriptionTrialEndSetting; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; @@ -28,6 +28,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateBillingSubscriptionRequestBody.Builder.class) public final class CreateBillingSubscriptionRequestBody { + private final Optional applicationId; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -62,11 +64,12 @@ public final class CreateBillingSubscriptionRequestBody { private final Optional trialEnd; - private final Optional trialEndSetting; + private final Optional trialEndSetting; private final Map additionalProperties; private CreateBillingSubscriptionRequestBody( + Optional applicationId, Optional cancelAt, boolean cancelAtPeriodEnd, String currency, @@ -84,8 +87,9 @@ private CreateBillingSubscriptionRequestBody( String subscriptionExternalId, int totalPrice, Optional trialEnd, - Optional trialEndSetting, + Optional trialEndSetting, Map additionalProperties) { + this.applicationId = applicationId; this.cancelAt = cancelAt; this.cancelAtPeriodEnd = cancelAtPeriodEnd; this.currency = currency; @@ -107,6 +111,11 @@ private CreateBillingSubscriptionRequestBody( this.additionalProperties = additionalProperties; } + @JsonProperty("application_id") + public Optional getApplicationId() { + return applicationId; + } + @JsonProperty("cancel_at") public Optional getCancelAt() { return cancelAt; @@ -193,7 +202,7 @@ public Optional getTrialEnd() { } @JsonProperty("trial_end_setting") - public Optional getTrialEndSetting() { + public Optional getTrialEndSetting() { return trialEndSetting; } @@ -210,7 +219,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(CreateBillingSubscriptionRequestBody other) { - return cancelAt.equals(other.cancelAt) + return applicationId.equals(other.applicationId) + && cancelAt.equals(other.cancelAt) && cancelAtPeriodEnd == other.cancelAtPeriodEnd && currency.equals(other.currency) && customerExternalId.equals(other.customerExternalId) @@ -233,6 +243,7 @@ private boolean equalTo(CreateBillingSubscriptionRequestBody other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.applicationId, this.cancelAt, this.cancelAtPeriodEnd, this.currency, @@ -291,6 +302,10 @@ public interface TotalPriceStage { public interface _FinalStage { CreateBillingSubscriptionRequestBody build(); + _FinalStage applicationId(Optional applicationId); + + _FinalStage applicationId(String applicationId); + _FinalStage cancelAt(Optional cancelAt); _FinalStage cancelAt(Integer cancelAt); @@ -339,9 +354,9 @@ public interface _FinalStage { _FinalStage trialEnd(Integer trialEnd); - _FinalStage trialEndSetting(Optional trialEndSetting); + _FinalStage trialEndSetting(Optional trialEndSetting); - _FinalStage trialEndSetting(CreateBillingSubscriptionRequestBodyTrialEndSetting trialEndSetting); + _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -365,7 +380,7 @@ public static final class Builder private int totalPrice; - private Optional trialEndSetting = Optional.empty(); + private Optional trialEndSetting = Optional.empty(); private Optional trialEnd = Optional.empty(); @@ -389,6 +404,8 @@ public static final class Builder private Optional cancelAt = Optional.empty(); + private Optional applicationId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -396,6 +413,7 @@ private Builder() {} @java.lang.Override public Builder from(CreateBillingSubscriptionRequestBody other) { + applicationId(other.getApplicationId()); cancelAt(other.getCancelAt()); cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); currency(other.getCurrency()); @@ -461,15 +479,14 @@ public _FinalStage totalPrice(int totalPrice) { } @java.lang.Override - public _FinalStage trialEndSetting(CreateBillingSubscriptionRequestBodyTrialEndSetting trialEndSetting) { + public _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting) { this.trialEndSetting = Optional.ofNullable(trialEndSetting); return this; } @java.lang.Override @JsonSetter(value = "trial_end_setting", nulls = Nulls.SKIP) - public _FinalStage trialEndSetting( - Optional trialEndSetting) { + public _FinalStage trialEndSetting(Optional trialEndSetting) { this.trialEndSetting = trialEndSetting; return this; } @@ -639,9 +656,23 @@ public _FinalStage cancelAt(Optional cancelAt) { return this; } + @java.lang.Override + public _FinalStage applicationId(String applicationId) { + this.applicationId = Optional.ofNullable(applicationId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "application_id", nulls = Nulls.SKIP) + public _FinalStage applicationId(Optional applicationId) { + this.applicationId = applicationId; + return this; + } + @java.lang.Override public CreateBillingSubscriptionRequestBody build() { return new CreateBillingSubscriptionRequestBody( + applicationId, cancelAt, cancelAtPeriodEnd, currency, diff --git a/src/main/java/com/schematic/api/resources/billing/requests/SearchBillingPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java similarity index 67% rename from src/main/java/com/schematic/api/resources/billing/requests/SearchBillingPricesRequest.java rename to src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java index 91e7e7e..eb633ca 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/SearchBillingPricesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java @@ -12,8 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.billing.types.SearchBillingPricesRequestTiersMode; -import com.schematic.api.resources.billing.types.SearchBillingPricesRequestUsageType; +import com.schematic.api.types.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.BillingTiersMode; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -22,27 +23,33 @@ import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = SearchBillingPricesRequest.Builder.class) -public final class SearchBillingPricesRequest { +@JsonDeserialize(builder = ListBillingPricesRequest.Builder.class) +public final class ListBillingPricesRequest { private final Optional> ids; + private final Optional> productIds; + private final Optional forInitialPlan; private final Optional forTrialExpiryPlan; - private final Optional productId; - private final Optional interval; + private final Optional isActive; + private final Optional price; + private final Optional productId; + + private final Optional providerType; + private final Optional q; - private final Optional requiresPaymentMethod; + private final Optional tiersMode; - private final Optional tiersMode; + private final Optional usageType; - private final Optional usageType; + private final Optional withMeter; private final Optional limit; @@ -50,30 +57,36 @@ public final class SearchBillingPricesRequest { private final Map additionalProperties; - private SearchBillingPricesRequest( + private ListBillingPricesRequest( Optional> ids, + Optional> productIds, Optional forInitialPlan, Optional forTrialExpiryPlan, - Optional productId, Optional interval, + Optional isActive, Optional price, + Optional productId, + Optional providerType, Optional q, - Optional requiresPaymentMethod, - Optional tiersMode, - Optional usageType, + Optional tiersMode, + Optional usageType, + Optional withMeter, Optional limit, Optional offset, Map additionalProperties) { this.ids = ids; + this.productIds = productIds; this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; - this.productId = productId; this.interval = interval; + this.isActive = isActive; this.price = price; + this.productId = productId; + this.providerType = providerType; this.q = q; - this.requiresPaymentMethod = requiresPaymentMethod; this.tiersMode = tiersMode; this.usageType = usageType; + this.withMeter = withMeter; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -84,6 +97,11 @@ public Optional> getIds() { return ids; } + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + /** * @return Filter for prices valid for initial plans (free prices only) */ @@ -100,44 +118,57 @@ public Optional getForTrialExpiryPlan() { return forTrialExpiryPlan; } - @JsonProperty("product_id") - public Optional getProductId() { - return productId; - } - @JsonProperty("interval") public Optional getInterval() { return interval; } + /** + * @return Filter for active prices on active products (defaults to true if not specified) + */ + @JsonProperty("is_active") + public Optional getIsActive() { + return isActive; + } + @JsonProperty("price") public Optional getPrice() { return price; } + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("q") public Optional getQ() { return q; } - /** - * @return Filter for prices that require a payment method (inverse of ForInitialPlan) - */ - @JsonProperty("requires_payment_method") - public Optional getRequiresPaymentMethod() { - return requiresPaymentMethod; - } - @JsonProperty("tiers_mode") - public Optional getTiersMode() { + public Optional getTiersMode() { return tiersMode; } @JsonProperty("usage_type") - public Optional getUsageType() { + public Optional getUsageType() { return usageType; } + /** + * @return Filter for prices with a meter + */ + @JsonProperty("with_meter") + public Optional getWithMeter() { + return withMeter; + } + /** * @return Page limit (default 100) */ @@ -157,7 +188,7 @@ public Optional getOffset() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof SearchBillingPricesRequest && equalTo((SearchBillingPricesRequest) other); + return other instanceof ListBillingPricesRequest && equalTo((ListBillingPricesRequest) other); } @JsonAnyGetter @@ -165,17 +196,20 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(SearchBillingPricesRequest other) { + private boolean equalTo(ListBillingPricesRequest other) { return ids.equals(other.ids) + && productIds.equals(other.productIds) && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) - && productId.equals(other.productId) && interval.equals(other.interval) + && isActive.equals(other.isActive) && price.equals(other.price) + && productId.equals(other.productId) + && providerType.equals(other.providerType) && q.equals(other.q) - && requiresPaymentMethod.equals(other.requiresPaymentMethod) && tiersMode.equals(other.tiersMode) && usageType.equals(other.usageType) + && withMeter.equals(other.withMeter) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -184,15 +218,18 @@ private boolean equalTo(SearchBillingPricesRequest other) { public int hashCode() { return Objects.hash( this.ids, + this.productIds, this.forInitialPlan, this.forTrialExpiryPlan, - this.productId, this.interval, + this.isActive, this.price, + this.productId, + this.providerType, this.q, - this.requiresPaymentMethod, this.tiersMode, this.usageType, + this.withMeter, this.limit, this.offset); } @@ -210,23 +247,29 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); + private Optional> productIds = Optional.empty(); + private Optional forInitialPlan = Optional.empty(); private Optional forTrialExpiryPlan = Optional.empty(); - private Optional productId = Optional.empty(); - private Optional interval = Optional.empty(); + private Optional isActive = Optional.empty(); + private Optional price = Optional.empty(); + private Optional productId = Optional.empty(); + + private Optional providerType = Optional.empty(); + private Optional q = Optional.empty(); - private Optional requiresPaymentMethod = Optional.empty(); + private Optional tiersMode = Optional.empty(); - private Optional tiersMode = Optional.empty(); + private Optional usageType = Optional.empty(); - private Optional usageType = Optional.empty(); + private Optional withMeter = Optional.empty(); private Optional limit = Optional.empty(); @@ -237,17 +280,20 @@ public static final class Builder { private Builder() {} - public Builder from(SearchBillingPricesRequest other) { + public Builder from(ListBillingPricesRequest other) { ids(other.getIds()); + productIds(other.getProductIds()); forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); - productId(other.getProductId()); interval(other.getInterval()); + isActive(other.getIsActive()); price(other.getPrice()); + productId(other.getProductId()); + providerType(other.getProviderType()); q(other.getQ()); - requiresPaymentMethod(other.getRequiresPaymentMethod()); tiersMode(other.getTiersMode()); usageType(other.getUsageType()); + withMeter(other.getWithMeter()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -269,6 +315,22 @@ public Builder ids(String ids) { return this; } + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public Builder productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + public Builder productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + public Builder productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + /** *

Filter for prices valid for initial plans (free prices only)

*/ @@ -297,25 +359,28 @@ public Builder forTrialExpiryPlan(Boolean forTrialExpiryPlan) { return this; } - @JsonSetter(value = "product_id", nulls = Nulls.SKIP) - public Builder productId(Optional productId) { - this.productId = productId; + @JsonSetter(value = "interval", nulls = Nulls.SKIP) + public Builder interval(Optional interval) { + this.interval = interval; return this; } - public Builder productId(String productId) { - this.productId = Optional.ofNullable(productId); + public Builder interval(String interval) { + this.interval = Optional.ofNullable(interval); return this; } - @JsonSetter(value = "interval", nulls = Nulls.SKIP) - public Builder interval(Optional interval) { - this.interval = interval; + /** + *

Filter for active prices on active products (defaults to true if not specified)

+ */ + @JsonSetter(value = "is_active", nulls = Nulls.SKIP) + public Builder isActive(Optional isActive) { + this.isActive = isActive; return this; } - public Builder interval(String interval) { - this.interval = Optional.ofNullable(interval); + public Builder isActive(Boolean isActive) { + this.isActive = Optional.ofNullable(isActive); return this; } @@ -330,53 +395,75 @@ public Builder price(Integer price) { return this; } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); return this; } - /** - *

Filter for prices that require a payment method (inverse of ForInitialPlan)

- */ - @JsonSetter(value = "requires_payment_method", nulls = Nulls.SKIP) - public Builder requiresPaymentMethod(Optional requiresPaymentMethod) { - this.requiresPaymentMethod = requiresPaymentMethod; + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); return this; } - public Builder requiresPaymentMethod(Boolean requiresPaymentMethod) { - this.requiresPaymentMethod = Optional.ofNullable(requiresPaymentMethod); + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) - public Builder tiersMode(Optional tiersMode) { + public Builder tiersMode(Optional tiersMode) { this.tiersMode = tiersMode; return this; } - public Builder tiersMode(SearchBillingPricesRequestTiersMode tiersMode) { + public Builder tiersMode(BillingTiersMode tiersMode) { this.tiersMode = Optional.ofNullable(tiersMode); return this; } @JsonSetter(value = "usage_type", nulls = Nulls.SKIP) - public Builder usageType(Optional usageType) { + public Builder usageType(Optional usageType) { this.usageType = usageType; return this; } - public Builder usageType(SearchBillingPricesRequestUsageType usageType) { + public Builder usageType(BillingPriceUsageType usageType) { this.usageType = Optional.ofNullable(usageType); return this; } + /** + *

Filter for prices with a meter

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

Page limit (default 100)

*/ @@ -405,18 +492,21 @@ public Builder offset(Integer offset) { return this; } - public SearchBillingPricesRequest build() { - return new SearchBillingPricesRequest( + public ListBillingPricesRequest build() { + return new ListBillingPricesRequest( ids, + productIds, forInitialPlan, forTrialExpiryPlan, - productId, interval, + isActive, price, + productId, + providerType, q, - requiresPaymentMethod, tiersMode, usageType, + withMeter, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java new file mode 100644 index 0000000..27a0c07 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java @@ -0,0 +1,515 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.billing.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.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.BillingTiersMode; +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 = ListBillingProductPricesRequest.Builder.class) +public final class ListBillingProductPricesRequest { + private final Optional> ids; + + private final Optional> productIds; + + private final Optional forInitialPlan; + + private final Optional forTrialExpiryPlan; + + private final Optional interval; + + private final Optional isActive; + + private final Optional price; + + private final Optional productId; + + private final Optional providerType; + + private final Optional q; + + private final Optional tiersMode; + + private final Optional usageType; + + private final Optional withMeter; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListBillingProductPricesRequest( + Optional> ids, + Optional> productIds, + Optional forInitialPlan, + Optional forTrialExpiryPlan, + Optional interval, + Optional isActive, + Optional price, + Optional productId, + Optional providerType, + Optional q, + Optional tiersMode, + Optional usageType, + Optional withMeter, + Optional limit, + Optional offset, + Map additionalProperties) { + this.ids = ids; + this.productIds = productIds; + this.forInitialPlan = forInitialPlan; + this.forTrialExpiryPlan = forTrialExpiryPlan; + this.interval = interval; + this.isActive = isActive; + this.price = price; + this.productId = productId; + this.providerType = providerType; + this.q = q; + this.tiersMode = tiersMode; + this.usageType = usageType; + this.withMeter = withMeter; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + /** + * @return Filter for prices valid for initial plans (free prices only) + */ + @JsonProperty("for_initial_plan") + public Optional getForInitialPlan() { + return forInitialPlan; + } + + /** + * @return Filter for prices valid for trial expiry plans (free prices only) + */ + @JsonProperty("for_trial_expiry_plan") + public Optional getForTrialExpiryPlan() { + return forTrialExpiryPlan; + } + + @JsonProperty("interval") + public Optional getInterval() { + return interval; + } + + /** + * @return Filter for active prices on active products (defaults to true if not specified) + */ + @JsonProperty("is_active") + public Optional getIsActive() { + return isActive; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @JsonProperty("tiers_mode") + public Optional getTiersMode() { + return tiersMode; + } + + @JsonProperty("usage_type") + public Optional getUsageType() { + return usageType; + } + + /** + * @return Filter for prices with a meter + */ + @JsonProperty("with_meter") + public Optional getWithMeter() { + return withMeter; + } + + /** + * @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 ListBillingProductPricesRequest && equalTo((ListBillingProductPricesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBillingProductPricesRequest other) { + return ids.equals(other.ids) + && productIds.equals(other.productIds) + && forInitialPlan.equals(other.forInitialPlan) + && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) + && interval.equals(other.interval) + && isActive.equals(other.isActive) + && price.equals(other.price) + && productId.equals(other.productId) + && providerType.equals(other.providerType) + && q.equals(other.q) + && tiersMode.equals(other.tiersMode) + && usageType.equals(other.usageType) + && withMeter.equals(other.withMeter) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ids, + this.productIds, + this.forInitialPlan, + this.forTrialExpiryPlan, + this.interval, + this.isActive, + this.price, + this.productId, + this.providerType, + this.q, + this.tiersMode, + this.usageType, + this.withMeter, + 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> productIds = Optional.empty(); + + private Optional forInitialPlan = Optional.empty(); + + private Optional forTrialExpiryPlan = Optional.empty(); + + private Optional interval = Optional.empty(); + + private Optional isActive = Optional.empty(); + + private Optional price = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional providerType = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional tiersMode = Optional.empty(); + + private Optional usageType = Optional.empty(); + + private Optional withMeter = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBillingProductPricesRequest other) { + ids(other.getIds()); + productIds(other.getProductIds()); + forInitialPlan(other.getForInitialPlan()); + forTrialExpiryPlan(other.getForTrialExpiryPlan()); + interval(other.getInterval()); + isActive(other.getIsActive()); + price(other.getPrice()); + productId(other.getProductId()); + providerType(other.getProviderType()); + q(other.getQ()); + tiersMode(other.getTiersMode()); + usageType(other.getUsageType()); + withMeter(other.getWithMeter()); + 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; + } + + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public Builder productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + public Builder productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + public Builder productIds(String productIds) { + this.productIds = Optional.of(Collections.singletonList(productIds)); + return this; + } + + /** + *

Filter for prices valid for initial plans (free prices only)

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

Filter for prices valid for trial expiry plans (free prices only)

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

Filter for active prices on active products (defaults to true if not specified)

+ */ + @JsonSetter(value = "is_active", nulls = Nulls.SKIP) + public Builder isActive(Optional isActive) { + this.isActive = isActive; + return this; + } + + public Builder isActive(Boolean isActive) { + this.isActive = Optional.ofNullable(isActive); + return this; + } + + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public Builder price(Optional price) { + this.price = price; + return this; + } + + public Builder price(Integer price) { + this.price = Optional.ofNullable(price); + return this; + } + + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; + return this; + } + + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) + public Builder tiersMode(Optional tiersMode) { + this.tiersMode = tiersMode; + return this; + } + + public Builder tiersMode(BillingTiersMode tiersMode) { + this.tiersMode = Optional.ofNullable(tiersMode); + return this; + } + + @JsonSetter(value = "usage_type", nulls = Nulls.SKIP) + public Builder usageType(Optional usageType) { + this.usageType = usageType; + return this; + } + + public Builder usageType(BillingPriceUsageType usageType) { + this.usageType = Optional.ofNullable(usageType); + return this; + } + + /** + *

Filter for prices with a meter

+ */ + @JsonSetter(value = "with_meter", nulls = Nulls.SKIP) + public Builder withMeter(Optional withMeter) { + this.withMeter = withMeter; + return this; + } + + public Builder withMeter(Boolean withMeter) { + this.withMeter = Optional.ofNullable(withMeter); + 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(Integer 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(Integer offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public ListBillingProductPricesRequest build() { + return new ListBillingProductPricesRequest( + ids, + productIds, + forInitialPlan, + forTrialExpiryPlan, + interval, + isActive, + price, + productId, + providerType, + q, + tiersMode, + usageType, + withMeter, + limit, + offset, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductsRequest.java index 0f15fce..1d26af3 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductsRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductsRequest.java @@ -12,7 +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.resources.billing.types.ListBillingProductsRequestPriceUsageType; +import com.schematic.api.types.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -25,21 +26,23 @@ public final class ListBillingProductsRequest { private final Optional> ids; + private final Optional isActive; + private final Optional name; - private final Optional q; + private final Optional priceUsageType; - private final Optional priceUsageType; + private final Optional providerType; - private final Optional withoutLinkedToPlan; + private final Optional q; private final Optional withOneTimeCharges; - private final Optional withZeroPrice; - private final Optional withPricesOnly; - private final Optional isActive; + private final Optional withZeroPrice; + + private final Optional withoutLinkedToPlan; private final Optional limit; @@ -49,26 +52,28 @@ public final class ListBillingProductsRequest { private ListBillingProductsRequest( Optional> ids, + Optional isActive, Optional name, + Optional priceUsageType, + Optional providerType, Optional q, - Optional priceUsageType, - Optional withoutLinkedToPlan, Optional withOneTimeCharges, - Optional withZeroPrice, Optional withPricesOnly, - Optional isActive, + Optional withZeroPrice, + Optional withoutLinkedToPlan, Optional limit, Optional offset, Map additionalProperties) { this.ids = ids; + this.isActive = isActive; this.name = name; - this.q = q; this.priceUsageType = priceUsageType; - this.withoutLinkedToPlan = withoutLinkedToPlan; + this.providerType = providerType; + this.q = q; this.withOneTimeCharges = withOneTimeCharges; - this.withZeroPrice = withZeroPrice; this.withPricesOnly = withPricesOnly; - this.isActive = isActive; + this.withZeroPrice = withZeroPrice; + this.withoutLinkedToPlan = withoutLinkedToPlan; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -79,27 +84,32 @@ public Optional> getIds() { return ids; } + /** + * @return Filter products that are active. Defaults to true if not specified + */ + @JsonProperty("is_active") + public Optional getIsActive() { + return isActive; + } + @JsonProperty("name") public Optional getName() { return name; } - @JsonProperty("q") - public Optional getQ() { - return q; - } - @JsonProperty("price_usage_type") - public Optional getPriceUsageType() { + public Optional getPriceUsageType() { return priceUsageType; } - /** - * @return Filter products that are not linked to any plan - */ - @JsonProperty("without_linked_to_plan") - public Optional getWithoutLinkedToPlan() { - return withoutLinkedToPlan; + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + @JsonProperty("q") + public Optional getQ() { + return q; } /** @@ -110,14 +120,6 @@ public Optional getWithOneTimeCharges() { return withOneTimeCharges; } - /** - * @return Filter products that have zero price for free subscription type - */ - @JsonProperty("with_zero_price") - public Optional getWithZeroPrice() { - return withZeroPrice; - } - /** * @return Filter products that have prices */ @@ -127,11 +129,19 @@ public Optional getWithPricesOnly() { } /** - * @return Filter products that are active + * @return Filter products that have zero price for free subscription type */ - @JsonProperty("is_active") - public Optional getIsActive() { - return isActive; + @JsonProperty("with_zero_price") + public Optional getWithZeroPrice() { + return withZeroPrice; + } + + /** + * @return Filter products that are not linked to any plan + */ + @JsonProperty("without_linked_to_plan") + public Optional getWithoutLinkedToPlan() { + return withoutLinkedToPlan; } /** @@ -163,14 +173,15 @@ public Map getAdditionalProperties() { private boolean equalTo(ListBillingProductsRequest other) { return ids.equals(other.ids) + && isActive.equals(other.isActive) && name.equals(other.name) - && q.equals(other.q) && priceUsageType.equals(other.priceUsageType) - && withoutLinkedToPlan.equals(other.withoutLinkedToPlan) + && providerType.equals(other.providerType) + && q.equals(other.q) && withOneTimeCharges.equals(other.withOneTimeCharges) - && withZeroPrice.equals(other.withZeroPrice) && withPricesOnly.equals(other.withPricesOnly) - && isActive.equals(other.isActive) + && withZeroPrice.equals(other.withZeroPrice) + && withoutLinkedToPlan.equals(other.withoutLinkedToPlan) && limit.equals(other.limit) && offset.equals(other.offset); } @@ -179,14 +190,15 @@ private boolean equalTo(ListBillingProductsRequest other) { public int hashCode() { return Objects.hash( this.ids, + this.isActive, this.name, - this.q, this.priceUsageType, - this.withoutLinkedToPlan, + this.providerType, + this.q, this.withOneTimeCharges, - this.withZeroPrice, this.withPricesOnly, - this.isActive, + this.withZeroPrice, + this.withoutLinkedToPlan, this.limit, this.offset); } @@ -204,21 +216,23 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); + private Optional isActive = Optional.empty(); + private Optional name = Optional.empty(); - private Optional q = Optional.empty(); + private Optional priceUsageType = Optional.empty(); - private Optional priceUsageType = Optional.empty(); + private Optional providerType = Optional.empty(); - private Optional withoutLinkedToPlan = Optional.empty(); + private Optional q = Optional.empty(); private Optional withOneTimeCharges = Optional.empty(); - private Optional withZeroPrice = Optional.empty(); - private Optional withPricesOnly = Optional.empty(); - private Optional isActive = Optional.empty(); + private Optional withZeroPrice = Optional.empty(); + + private Optional withoutLinkedToPlan = Optional.empty(); private Optional limit = Optional.empty(); @@ -231,14 +245,15 @@ private Builder() {} public Builder from(ListBillingProductsRequest other) { ids(other.getIds()); + isActive(other.getIsActive()); name(other.getName()); - q(other.getQ()); priceUsageType(other.getPriceUsageType()); - withoutLinkedToPlan(other.getWithoutLinkedToPlan()); + providerType(other.getProviderType()); + q(other.getQ()); withOneTimeCharges(other.getWithOneTimeCharges()); - withZeroPrice(other.getWithZeroPrice()); withPricesOnly(other.getWithPricesOnly()); - isActive(other.getIsActive()); + withZeroPrice(other.getWithZeroPrice()); + withoutLinkedToPlan(other.getWithoutLinkedToPlan()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -260,6 +275,20 @@ public Builder ids(String ids) { return this; } + /** + *

Filter products that are active. Defaults to true if not specified

+ */ + @JsonSetter(value = "is_active", nulls = Nulls.SKIP) + public Builder isActive(Optional isActive) { + this.isActive = isActive; + return this; + } + + public Builder isActive(Boolean isActive) { + this.isActive = Optional.ofNullable(isActive); + return this; + } + @JsonSetter(value = "name", nulls = Nulls.SKIP) public Builder name(Optional name) { this.name = name; @@ -271,39 +300,36 @@ public Builder name(String name) { return this; } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) + public Builder priceUsageType(Optional priceUsageType) { + this.priceUsageType = priceUsageType; return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + public Builder priceUsageType(BillingPriceUsageType priceUsageType) { + this.priceUsageType = Optional.ofNullable(priceUsageType); return this; } - @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) - public Builder priceUsageType(Optional priceUsageType) { - this.priceUsageType = priceUsageType; + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; return this; } - public Builder priceUsageType(ListBillingProductsRequestPriceUsageType priceUsageType) { - this.priceUsageType = Optional.ofNullable(priceUsageType); + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); return this; } - /** - *

Filter products that are not linked to any plan

- */ - @JsonSetter(value = "without_linked_to_plan", nulls = Nulls.SKIP) - public Builder withoutLinkedToPlan(Optional withoutLinkedToPlan) { - this.withoutLinkedToPlan = withoutLinkedToPlan; + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; return this; } - public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { - this.withoutLinkedToPlan = Optional.ofNullable(withoutLinkedToPlan); + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } @@ -322,44 +348,44 @@ public Builder withOneTimeCharges(Boolean withOneTimeCharges) { } /** - *

Filter products that have zero price for free subscription type

+ *

Filter products that have prices

*/ - @JsonSetter(value = "with_zero_price", nulls = Nulls.SKIP) - public Builder withZeroPrice(Optional withZeroPrice) { - this.withZeroPrice = withZeroPrice; + @JsonSetter(value = "with_prices_only", nulls = Nulls.SKIP) + public Builder withPricesOnly(Optional withPricesOnly) { + this.withPricesOnly = withPricesOnly; return this; } - public Builder withZeroPrice(Boolean withZeroPrice) { - this.withZeroPrice = Optional.ofNullable(withZeroPrice); + public Builder withPricesOnly(Boolean withPricesOnly) { + this.withPricesOnly = Optional.ofNullable(withPricesOnly); return this; } /** - *

Filter products that have prices

+ *

Filter products that have zero price for free subscription type

*/ - @JsonSetter(value = "with_prices_only", nulls = Nulls.SKIP) - public Builder withPricesOnly(Optional withPricesOnly) { - this.withPricesOnly = withPricesOnly; + @JsonSetter(value = "with_zero_price", nulls = Nulls.SKIP) + public Builder withZeroPrice(Optional withZeroPrice) { + this.withZeroPrice = withZeroPrice; return this; } - public Builder withPricesOnly(Boolean withPricesOnly) { - this.withPricesOnly = Optional.ofNullable(withPricesOnly); + public Builder withZeroPrice(Boolean withZeroPrice) { + this.withZeroPrice = Optional.ofNullable(withZeroPrice); return this; } /** - *

Filter products that are active

+ *

Filter products that are not linked to any plan

*/ - @JsonSetter(value = "is_active", nulls = Nulls.SKIP) - public Builder isActive(Optional isActive) { - this.isActive = isActive; + @JsonSetter(value = "without_linked_to_plan", nulls = Nulls.SKIP) + public Builder withoutLinkedToPlan(Optional withoutLinkedToPlan) { + this.withoutLinkedToPlan = withoutLinkedToPlan; return this; } - public Builder isActive(Boolean isActive) { - this.isActive = Optional.ofNullable(isActive); + public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { + this.withoutLinkedToPlan = Optional.ofNullable(withoutLinkedToPlan); return this; } @@ -394,14 +420,15 @@ public Builder offset(Integer offset) { public ListBillingProductsRequest build() { return new ListBillingProductsRequest( ids, + isActive, name, - q, priceUsageType, - withoutLinkedToPlan, + providerType, + q, withOneTimeCharges, - withZeroPrice, withPricesOnly, - isActive, + withZeroPrice, + withoutLinkedToPlan, limit, offset, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListCustomersWithSubscriptionsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListCustomersWithSubscriptionsRequest.java index 505457b..355d88c 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListCustomersWithSubscriptionsRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListCustomersWithSubscriptionsRequest.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -26,7 +27,7 @@ public final class ListCustomersWithSubscriptionsRequest { private final Optional name; - private final Optional failedToImport; + private final Optional providerType; private final Optional q; @@ -39,14 +40,14 @@ public final class ListCustomersWithSubscriptionsRequest { private ListCustomersWithSubscriptionsRequest( Optional> companyIds, Optional name, - Optional failedToImport, + Optional providerType, Optional q, Optional limit, Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.name = name; - this.failedToImport = failedToImport; + this.providerType = providerType; this.q = q; this.limit = limit; this.offset = offset; @@ -63,9 +64,9 @@ public Optional getName() { return name; } - @JsonProperty("failed_to_import") - public Optional getFailedToImport() { - return failedToImport; + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; } @JsonProperty("q") @@ -104,7 +105,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ListCustomersWithSubscriptionsRequest other) { return companyIds.equals(other.companyIds) && name.equals(other.name) - && failedToImport.equals(other.failedToImport) + && providerType.equals(other.providerType) && q.equals(other.q) && limit.equals(other.limit) && offset.equals(other.offset); @@ -112,7 +113,7 @@ private boolean equalTo(ListCustomersWithSubscriptionsRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.companyIds, this.name, this.failedToImport, this.q, this.limit, this.offset); + return Objects.hash(this.companyIds, this.name, this.providerType, this.q, this.limit, this.offset); } @java.lang.Override @@ -130,7 +131,7 @@ public static final class Builder { private Optional name = Optional.empty(); - private Optional failedToImport = Optional.empty(); + private Optional providerType = Optional.empty(); private Optional q = Optional.empty(); @@ -146,7 +147,7 @@ private Builder() {} public Builder from(ListCustomersWithSubscriptionsRequest other) { companyIds(other.getCompanyIds()); name(other.getName()); - failedToImport(other.getFailedToImport()); + providerType(other.getProviderType()); q(other.getQ()); limit(other.getLimit()); offset(other.getOffset()); @@ -180,14 +181,14 @@ public Builder name(String name) { return this; } - @JsonSetter(value = "failed_to_import", nulls = Nulls.SKIP) - public Builder failedToImport(Optional failedToImport) { - this.failedToImport = failedToImport; + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; return this; } - public Builder failedToImport(Boolean failedToImport) { - this.failedToImport = Optional.ofNullable(failedToImport); + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); return this; } @@ -232,7 +233,7 @@ public Builder offset(Integer offset) { public ListCustomersWithSubscriptionsRequest build() { return new ListCustomersWithSubscriptionsRequest( - companyIds, name, failedToImport, q, limit, offset, additionalProperties); + companyIds, name, providerType, q, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListProductPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListProductPricesRequest.java deleted file mode 100644 index a6d6661..0000000 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListProductPricesRequest.java +++ /dev/null @@ -1,410 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.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.billing.types.ListProductPricesRequestPriceUsageType; -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 = ListProductPricesRequest.Builder.class) -public final class ListProductPricesRequest { - private final Optional> ids; - - private final Optional name; - - private final Optional q; - - private final Optional priceUsageType; - - private final Optional withoutLinkedToPlan; - - private final Optional withOneTimeCharges; - - private final Optional withZeroPrice; - - private final Optional withPricesOnly; - - private final Optional isActive; - - private final Optional limit; - - private final Optional offset; - - private final Map additionalProperties; - - private ListProductPricesRequest( - Optional> ids, - Optional name, - Optional q, - Optional priceUsageType, - Optional withoutLinkedToPlan, - Optional withOneTimeCharges, - Optional withZeroPrice, - Optional withPricesOnly, - Optional isActive, - Optional limit, - Optional offset, - Map additionalProperties) { - this.ids = ids; - this.name = name; - this.q = q; - this.priceUsageType = priceUsageType; - this.withoutLinkedToPlan = withoutLinkedToPlan; - this.withOneTimeCharges = withOneTimeCharges; - this.withZeroPrice = withZeroPrice; - this.withPricesOnly = withPricesOnly; - this.isActive = isActive; - this.limit = limit; - this.offset = offset; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @JsonProperty("price_usage_type") - public Optional getPriceUsageType() { - return priceUsageType; - } - - /** - * @return Filter products that are not linked to any plan - */ - @JsonProperty("without_linked_to_plan") - public Optional getWithoutLinkedToPlan() { - return withoutLinkedToPlan; - } - - /** - * @return Filter products that are one time charges - */ - @JsonProperty("with_one_time_charges") - public Optional getWithOneTimeCharges() { - return withOneTimeCharges; - } - - /** - * @return Filter products that have zero price for free subscription type - */ - @JsonProperty("with_zero_price") - public Optional getWithZeroPrice() { - return withZeroPrice; - } - - /** - * @return Filter products that have prices - */ - @JsonProperty("with_prices_only") - public Optional getWithPricesOnly() { - return withPricesOnly; - } - - /** - * @return Filter products that are active - */ - @JsonProperty("is_active") - public Optional getIsActive() { - return isActive; - } - - /** - * @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 ListProductPricesRequest && equalTo((ListProductPricesRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProductPricesRequest other) { - return ids.equals(other.ids) - && name.equals(other.name) - && q.equals(other.q) - && priceUsageType.equals(other.priceUsageType) - && withoutLinkedToPlan.equals(other.withoutLinkedToPlan) - && withOneTimeCharges.equals(other.withOneTimeCharges) - && withZeroPrice.equals(other.withZeroPrice) - && withPricesOnly.equals(other.withPricesOnly) - && isActive.equals(other.isActive) - && limit.equals(other.limit) - && offset.equals(other.offset); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.ids, - this.name, - this.q, - this.priceUsageType, - this.withoutLinkedToPlan, - this.withOneTimeCharges, - this.withZeroPrice, - this.withPricesOnly, - this.isActive, - 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 name = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional priceUsageType = Optional.empty(); - - private Optional withoutLinkedToPlan = Optional.empty(); - - private Optional withOneTimeCharges = Optional.empty(); - - private Optional withZeroPrice = Optional.empty(); - - private Optional withPricesOnly = Optional.empty(); - - private Optional isActive = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional offset = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProductPricesRequest other) { - ids(other.getIds()); - name(other.getName()); - q(other.getQ()); - priceUsageType(other.getPriceUsageType()); - withoutLinkedToPlan(other.getWithoutLinkedToPlan()); - withOneTimeCharges(other.getWithOneTimeCharges()); - withZeroPrice(other.getWithZeroPrice()); - withPricesOnly(other.getWithPricesOnly()); - isActive(other.getIsActive()); - 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; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.ofNullable(q); - return this; - } - - @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) - public Builder priceUsageType(Optional priceUsageType) { - this.priceUsageType = priceUsageType; - return this; - } - - public Builder priceUsageType(ListProductPricesRequestPriceUsageType priceUsageType) { - this.priceUsageType = Optional.ofNullable(priceUsageType); - return this; - } - - /** - *

Filter products that are not linked to any plan

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

Filter products that are one time charges

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

Filter products that have zero price for free subscription type

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

Filter products that have prices

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

Filter products that are active

- */ - @JsonSetter(value = "is_active", nulls = Nulls.SKIP) - public Builder isActive(Optional isActive) { - this.isActive = isActive; - return this; - } - - public Builder isActive(Boolean isActive) { - this.isActive = Optional.ofNullable(isActive); - 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(Integer 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(Integer offset) { - this.offset = Optional.ofNullable(offset); - return this; - } - - public ListProductPricesRequest build() { - return new ListProductPricesRequest( - ids, - name, - q, - priceUsageType, - withoutLinkedToPlan, - withOneTimeCharges, - withZeroPrice, - withPricesOnly, - isActive, - limit, - offset, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsParams.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsParams.java index 3a0893a..7204246 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsParams.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.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,7 +33,9 @@ public final class CountBillingProductsParams { private final Optional offset; - private final Optional priceUsageType; + private final Optional priceUsageType; + + private final Optional providerType; private final Optional q; @@ -51,7 +55,8 @@ private CountBillingProductsParams( Optional limit, Optional name, Optional offset, - Optional priceUsageType, + Optional priceUsageType, + Optional providerType, Optional q, Optional withOneTimeCharges, Optional withPricesOnly, @@ -64,6 +69,7 @@ private CountBillingProductsParams( this.name = name; this.offset = offset; this.priceUsageType = priceUsageType; + this.providerType = providerType; this.q = q; this.withOneTimeCharges = withOneTimeCharges; this.withPricesOnly = withPricesOnly; @@ -78,7 +84,7 @@ public Optional> getIds() { } /** - * @return Filter products that are active + * @return Filter products that are active. Defaults to true if not specified */ @JsonProperty("is_active") public Optional getIsActive() { @@ -107,10 +113,15 @@ public Optional getOffset() { } @JsonProperty("price_usage_type") - public Optional getPriceUsageType() { + public Optional getPriceUsageType() { return priceUsageType; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("q") public Optional getQ() { return q; @@ -166,6 +177,7 @@ private boolean equalTo(CountBillingProductsParams other) { && name.equals(other.name) && offset.equals(other.offset) && priceUsageType.equals(other.priceUsageType) + && providerType.equals(other.providerType) && q.equals(other.q) && withOneTimeCharges.equals(other.withOneTimeCharges) && withPricesOnly.equals(other.withPricesOnly) @@ -182,6 +194,7 @@ public int hashCode() { this.name, this.offset, this.priceUsageType, + this.providerType, this.q, this.withOneTimeCharges, this.withPricesOnly, @@ -210,7 +223,9 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional priceUsageType = Optional.empty(); + private Optional priceUsageType = Optional.empty(); + + private Optional providerType = Optional.empty(); private Optional q = Optional.empty(); @@ -234,6 +249,7 @@ public Builder from(CountBillingProductsParams other) { name(other.getName()); offset(other.getOffset()); priceUsageType(other.getPriceUsageType()); + providerType(other.getProviderType()); q(other.getQ()); withOneTimeCharges(other.getWithOneTimeCharges()); withPricesOnly(other.getWithPricesOnly()); @@ -254,7 +270,7 @@ public Builder ids(List ids) { } /** - *

Filter products that are active

+ *

Filter products that are active. Defaults to true if not specified

*/ @JsonSetter(value = "is_active", nulls = Nulls.SKIP) public Builder isActive(Optional isActive) { @@ -307,16 +323,27 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) - public Builder priceUsageType(Optional priceUsageType) { + public Builder priceUsageType(Optional priceUsageType) { this.priceUsageType = priceUsageType; return this; } - public Builder priceUsageType(CountBillingProductsResponseParamsPriceUsageType priceUsageType) { + public Builder priceUsageType(BillingPriceUsageType priceUsageType) { this.priceUsageType = Optional.ofNullable(priceUsageType); return this; } + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + @JsonSetter(value = "q", nulls = Nulls.SKIP) public Builder q(Optional q) { this.q = q; @@ -392,6 +419,7 @@ public CountBillingProductsParams build() { name, offset, priceUsageType, + providerType, q, withOneTimeCharges, withPricesOnly, diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsRequestPriceUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsRequestPriceUsageType.java deleted file mode 100644 index f769090..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsRequestPriceUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountBillingProductsRequestPriceUsageType { - public static final CountBillingProductsRequestPriceUsageType METERED = - new CountBillingProductsRequestPriceUsageType(Value.METERED, "metered"); - - public static final CountBillingProductsRequestPriceUsageType LICENSED = - new CountBillingProductsRequestPriceUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - CountBillingProductsRequestPriceUsageType(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 CountBillingProductsRequestPriceUsageType - && this.string.equals(((CountBillingProductsRequestPriceUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountBillingProductsRequestPriceUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new CountBillingProductsRequestPriceUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponseParamsPriceUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponseParamsPriceUsageType.java deleted file mode 100644 index 504b768..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponseParamsPriceUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountBillingProductsResponseParamsPriceUsageType { - public static final CountBillingProductsResponseParamsPriceUsageType METERED = - new CountBillingProductsResponseParamsPriceUsageType(Value.METERED, "metered"); - - public static final CountBillingProductsResponseParamsPriceUsageType LICENSED = - new CountBillingProductsResponseParamsPriceUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - CountBillingProductsResponseParamsPriceUsageType(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 CountBillingProductsResponseParamsPriceUsageType - && this.string.equals(((CountBillingProductsResponseParamsPriceUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountBillingProductsResponseParamsPriceUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new CountBillingProductsResponseParamsPriceUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountCustomersParams.java b/src/main/java/com/schematic/api/resources/billing/types/CountCustomersParams.java index b768079..a8724db 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CountCustomersParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/CountCustomersParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,31 +24,31 @@ public final class CountCustomersParams { private final Optional> companyIds; - private final Optional failedToImport; - private final Optional limit; private final Optional name; private final Optional offset; + private final Optional providerType; + private final Optional q; private final Map additionalProperties; private CountCustomersParams( Optional> companyIds, - Optional failedToImport, Optional limit, Optional name, Optional offset, + Optional providerType, Optional q, Map additionalProperties) { this.companyIds = companyIds; - this.failedToImport = failedToImport; this.limit = limit; this.name = name; this.offset = offset; + this.providerType = providerType; this.q = q; this.additionalProperties = additionalProperties; } @@ -57,11 +58,6 @@ public Optional> getCompanyIds() { return companyIds; } - @JsonProperty("failed_to_import") - public Optional getFailedToImport() { - return failedToImport; - } - /** * @return Page limit (default 100) */ @@ -83,6 +79,11 @@ public Optional getOffset() { return offset; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("q") public Optional getQ() { return q; @@ -101,16 +102,16 @@ public Map getAdditionalProperties() { private boolean equalTo(CountCustomersParams other) { return companyIds.equals(other.companyIds) - && failedToImport.equals(other.failedToImport) && limit.equals(other.limit) && name.equals(other.name) && offset.equals(other.offset) + && providerType.equals(other.providerType) && q.equals(other.q); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyIds, this.failedToImport, this.limit, this.name, this.offset, this.q); + return Objects.hash(this.companyIds, this.limit, this.name, this.offset, this.providerType, this.q); } @java.lang.Override @@ -126,14 +127,14 @@ public static Builder builder() { public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional failedToImport = Optional.empty(); - private Optional limit = Optional.empty(); private Optional name = Optional.empty(); private Optional offset = Optional.empty(); + private Optional providerType = Optional.empty(); + private Optional q = Optional.empty(); @JsonAnySetter @@ -143,10 +144,10 @@ private Builder() {} public Builder from(CountCustomersParams other) { companyIds(other.getCompanyIds()); - failedToImport(other.getFailedToImport()); limit(other.getLimit()); name(other.getName()); offset(other.getOffset()); + providerType(other.getProviderType()); q(other.getQ()); return this; } @@ -162,17 +163,6 @@ public Builder companyIds(List companyIds) { return this; } - @JsonSetter(value = "failed_to_import", nulls = Nulls.SKIP) - public Builder failedToImport(Optional failedToImport) { - this.failedToImport = failedToImport; - return this; - } - - public Builder failedToImport(Boolean failedToImport) { - this.failedToImport = Optional.ofNullable(failedToImport); - return this; - } - /** *

Page limit (default 100)

*/ @@ -212,6 +202,17 @@ public Builder offset(Integer offset) { return this; } + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + @JsonSetter(value = "q", nulls = Nulls.SKIP) public Builder q(Optional q) { this.q = q; @@ -224,7 +225,7 @@ public Builder q(String q) { } public CountCustomersParams build() { - return new CountCustomersParams(companyIds, failedToImport, limit, name, offset, q, additionalProperties); + return new CountCustomersParams(companyIds, limit, name, offset, providerType, q, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyTiersMode.java b/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyTiersMode.java deleted file mode 100644 index 1dd8784..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyTiersMode.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingPriceRequestBodyTiersMode { - public static final CreateBillingPriceRequestBodyTiersMode GRADUATED = - new CreateBillingPriceRequestBodyTiersMode(Value.GRADUATED, "graduated"); - - public static final CreateBillingPriceRequestBodyTiersMode VOLUME = - new CreateBillingPriceRequestBodyTiersMode(Value.VOLUME, "volume"); - - private final Value value; - - private final String string; - - CreateBillingPriceRequestBodyTiersMode(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 CreateBillingPriceRequestBodyTiersMode - && this.string.equals(((CreateBillingPriceRequestBodyTiersMode) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GRADUATED: - return visitor.visitGraduated(); - case VOLUME: - return visitor.visitVolume(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPriceRequestBodyTiersMode valueOf(String value) { - switch (value) { - case "graduated": - return GRADUATED; - case "volume": - return VOLUME; - default: - return new CreateBillingPriceRequestBodyTiersMode(Value.UNKNOWN, value); - } - } - - public enum Value { - VOLUME, - - GRADUATED, - - UNKNOWN - } - - public interface Visitor { - T visitVolume(); - - T visitGraduated(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyUsageType.java deleted file mode 100644 index b5d5ac5..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingPriceRequestBodyUsageType { - public static final CreateBillingPriceRequestBodyUsageType METERED = - new CreateBillingPriceRequestBodyUsageType(Value.METERED, "metered"); - - public static final CreateBillingPriceRequestBodyUsageType LICENSED = - new CreateBillingPriceRequestBodyUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - CreateBillingPriceRequestBodyUsageType(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 CreateBillingPriceRequestBodyUsageType - && this.string.equals(((CreateBillingPriceRequestBodyUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPriceRequestBodyUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new CreateBillingPriceRequestBodyUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java similarity index 67% rename from src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesParams.java rename to src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java index ddf7f05..601fe06 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.BillingTiersMode; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -19,8 +22,8 @@ import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = SearchBillingPricesParams.Builder.class) -public final class SearchBillingPricesParams { +@JsonDeserialize(builder = ListBillingPricesParams.Builder.class) +public final class ListBillingPricesParams { private final Optional forInitialPlan; private final Optional forTrialExpiryPlan; @@ -29,6 +32,8 @@ public final class SearchBillingPricesParams { private final Optional interval; + private final Optional isActive; + private final Optional limit; private final Optional offset; @@ -37,42 +42,52 @@ public final class SearchBillingPricesParams { private final Optional productId; + private final Optional> productIds; + + private final Optional providerType; + private final Optional q; - private final Optional requiresPaymentMethod; + private final Optional tiersMode; - private final Optional tiersMode; + private final Optional usageType; - private final Optional usageType; + private final Optional withMeter; private final Map additionalProperties; - private SearchBillingPricesParams( + private ListBillingPricesParams( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional> ids, Optional interval, + Optional isActive, Optional limit, Optional offset, Optional price, Optional productId, + Optional> productIds, + Optional providerType, Optional q, - Optional requiresPaymentMethod, - Optional tiersMode, - Optional usageType, + Optional tiersMode, + Optional usageType, + Optional withMeter, Map additionalProperties) { this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.ids = ids; this.interval = interval; + this.isActive = isActive; this.limit = limit; this.offset = offset; this.price = price; this.productId = productId; + this.productIds = productIds; + this.providerType = providerType; this.q = q; - this.requiresPaymentMethod = requiresPaymentMethod; this.tiersMode = tiersMode; this.usageType = usageType; + this.withMeter = withMeter; this.additionalProperties = additionalProperties; } @@ -102,6 +117,14 @@ public Optional getInterval() { return interval; } + /** + * @return Filter for active prices on active products (defaults to true if not specified) + */ + @JsonProperty("is_active") + public Optional getIsActive() { + return isActive; + } + /** * @return Page limit (default 100) */ @@ -128,33 +151,43 @@ public Optional getProductId() { return productId; } + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("q") public Optional getQ() { return q; } - /** - * @return Filter for prices that require a payment method (inverse of ForInitialPlan) - */ - @JsonProperty("requires_payment_method") - public Optional getRequiresPaymentMethod() { - return requiresPaymentMethod; - } - @JsonProperty("tiers_mode") - public Optional getTiersMode() { + public Optional getTiersMode() { return tiersMode; } @JsonProperty("usage_type") - public Optional getUsageType() { + public Optional getUsageType() { return usageType; } + /** + * @return Filter for prices with a meter + */ + @JsonProperty("with_meter") + public Optional getWithMeter() { + return withMeter; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof SearchBillingPricesParams && equalTo((SearchBillingPricesParams) other); + return other instanceof ListBillingPricesParams && equalTo((ListBillingPricesParams) other); } @JsonAnyGetter @@ -162,19 +195,22 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(SearchBillingPricesParams other) { + private boolean equalTo(ListBillingPricesParams other) { return forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && ids.equals(other.ids) && interval.equals(other.interval) + && isActive.equals(other.isActive) && limit.equals(other.limit) && offset.equals(other.offset) && price.equals(other.price) && productId.equals(other.productId) + && productIds.equals(other.productIds) + && providerType.equals(other.providerType) && q.equals(other.q) - && requiresPaymentMethod.equals(other.requiresPaymentMethod) && tiersMode.equals(other.tiersMode) - && usageType.equals(other.usageType); + && usageType.equals(other.usageType) + && withMeter.equals(other.withMeter); } @java.lang.Override @@ -184,14 +220,17 @@ public int hashCode() { this.forTrialExpiryPlan, this.ids, this.interval, + this.isActive, this.limit, this.offset, this.price, this.productId, + this.productIds, + this.providerType, this.q, - this.requiresPaymentMethod, this.tiersMode, - this.usageType); + this.usageType, + this.withMeter); } @java.lang.Override @@ -213,6 +252,8 @@ public static final class Builder { private Optional interval = Optional.empty(); + private Optional isActive = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -221,32 +262,39 @@ public static final class Builder { private Optional productId = Optional.empty(); + private Optional> productIds = Optional.empty(); + + private Optional providerType = Optional.empty(); + private Optional q = Optional.empty(); - private Optional requiresPaymentMethod = Optional.empty(); + private Optional tiersMode = Optional.empty(); - private Optional tiersMode = Optional.empty(); + private Optional usageType = Optional.empty(); - private Optional usageType = Optional.empty(); + private Optional withMeter = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(SearchBillingPricesParams other) { + public Builder from(ListBillingPricesParams other) { forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); ids(other.getIds()); interval(other.getInterval()); + isActive(other.getIsActive()); limit(other.getLimit()); offset(other.getOffset()); price(other.getPrice()); productId(other.getProductId()); + productIds(other.getProductIds()); + providerType(other.getProviderType()); q(other.getQ()); - requiresPaymentMethod(other.getRequiresPaymentMethod()); tiersMode(other.getTiersMode()); usageType(other.getUsageType()); + withMeter(other.getWithMeter()); return this; } @@ -300,6 +348,20 @@ public Builder interval(String interval) { return this; } + /** + *

Filter for active prices on active products (defaults to true if not specified)

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

Page limit (default 100)

*/ @@ -350,67 +412,92 @@ public Builder productId(String productId) { return this; } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public Builder productIds(Optional> productIds) { + this.productIds = productIds; return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + public Builder productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); return this; } - /** - *

Filter for prices that require a payment method (inverse of ForInitialPlan)

- */ - @JsonSetter(value = "requires_payment_method", nulls = Nulls.SKIP) - public Builder requiresPaymentMethod(Optional requiresPaymentMethod) { - this.requiresPaymentMethod = requiresPaymentMethod; + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; return this; } - public Builder requiresPaymentMethod(Boolean requiresPaymentMethod) { - this.requiresPaymentMethod = Optional.ofNullable(requiresPaymentMethod); + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) - public Builder tiersMode(Optional tiersMode) { + public Builder tiersMode(Optional tiersMode) { this.tiersMode = tiersMode; return this; } - public Builder tiersMode(SearchBillingPricesResponseParamsTiersMode tiersMode) { + public Builder tiersMode(BillingTiersMode tiersMode) { this.tiersMode = Optional.ofNullable(tiersMode); return this; } @JsonSetter(value = "usage_type", nulls = Nulls.SKIP) - public Builder usageType(Optional usageType) { + public Builder usageType(Optional usageType) { this.usageType = usageType; return this; } - public Builder usageType(SearchBillingPricesResponseParamsUsageType usageType) { + public Builder usageType(BillingPriceUsageType usageType) { this.usageType = Optional.ofNullable(usageType); return this; } - public SearchBillingPricesParams build() { - return new SearchBillingPricesParams( + /** + *

Filter for prices with a meter

+ */ + @JsonSetter(value = "with_meter", nulls = Nulls.SKIP) + public Builder withMeter(Optional withMeter) { + this.withMeter = withMeter; + return this; + } + + public Builder withMeter(Boolean withMeter) { + this.withMeter = Optional.ofNullable(withMeter); + return this; + } + + public ListBillingPricesParams build() { + return new ListBillingPricesParams( forInitialPlan, forTrialExpiryPlan, ids, interval, + isActive, limit, offset, price, productId, + productIds, + providerType, q, - requiresPaymentMethod, tiersMode, usageType, + withMeter, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java similarity index 78% rename from src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponse.java rename to src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java index 08e82ac..86db514 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java @@ -21,16 +21,16 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = SearchBillingPricesResponse.Builder.class) -public final class SearchBillingPricesResponse { +@JsonDeserialize(builder = ListBillingPricesResponse.Builder.class) +public final class ListBillingPricesResponse { private final List data; - private final SearchBillingPricesParams params; + private final ListBillingPricesParams params; private final Map additionalProperties; - private SearchBillingPricesResponse( - List data, SearchBillingPricesParams params, Map additionalProperties) { + private ListBillingPricesResponse( + List data, ListBillingPricesParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -45,14 +45,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public SearchBillingPricesParams getParams() { + public ListBillingPricesParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof SearchBillingPricesResponse && equalTo((SearchBillingPricesResponse) other); + return other instanceof ListBillingPricesResponse && equalTo((ListBillingPricesResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(SearchBillingPricesResponse other) { + private boolean equalTo(ListBillingPricesResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -82,13 +82,13 @@ public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull SearchBillingPricesParams params); + _FinalStage params(@NotNull ListBillingPricesParams params); - Builder from(SearchBillingPricesResponse other); + Builder from(ListBillingPricesResponse other); } public interface _FinalStage { - SearchBillingPricesResponse build(); + ListBillingPricesResponse build(); _FinalStage data(List data); @@ -99,7 +99,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ParamsStage, _FinalStage { - private SearchBillingPricesParams params; + private ListBillingPricesParams params; private List data = new ArrayList<>(); @@ -109,7 +109,7 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(SearchBillingPricesResponse other) { + public Builder from(ListBillingPricesResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -122,7 +122,7 @@ public Builder from(SearchBillingPricesResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull SearchBillingPricesParams params) { + public _FinalStage params(@NotNull ListBillingPricesParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @@ -152,8 +152,8 @@ public _FinalStage data(List data) { } @java.lang.Override - public SearchBillingPricesResponse build() { - return new SearchBillingPricesResponse(data, params, additionalProperties); + public ListBillingPricesResponse build() { + return new ListBillingPricesResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java new file mode 100644 index 0000000..f2d6689 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java @@ -0,0 +1,504 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.billing.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.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; +import com.schematic.api.types.BillingTiersMode; +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 = ListBillingProductPricesParams.Builder.class) +public final class ListBillingProductPricesParams { + private final Optional forInitialPlan; + + private final Optional forTrialExpiryPlan; + + private final Optional> ids; + + private final Optional interval; + + private final Optional isActive; + + private final Optional limit; + + private final Optional offset; + + private final Optional price; + + private final Optional productId; + + private final Optional> productIds; + + private final Optional providerType; + + private final Optional q; + + private final Optional tiersMode; + + private final Optional usageType; + + private final Optional withMeter; + + private final Map additionalProperties; + + private ListBillingProductPricesParams( + Optional forInitialPlan, + Optional forTrialExpiryPlan, + Optional> ids, + Optional interval, + Optional isActive, + Optional limit, + Optional offset, + Optional price, + Optional productId, + Optional> productIds, + Optional providerType, + Optional q, + Optional tiersMode, + Optional usageType, + Optional withMeter, + Map additionalProperties) { + this.forInitialPlan = forInitialPlan; + this.forTrialExpiryPlan = forTrialExpiryPlan; + this.ids = ids; + this.interval = interval; + this.isActive = isActive; + this.limit = limit; + this.offset = offset; + this.price = price; + this.productId = productId; + this.productIds = productIds; + this.providerType = providerType; + this.q = q; + this.tiersMode = tiersMode; + this.usageType = usageType; + this.withMeter = withMeter; + this.additionalProperties = additionalProperties; + } + + /** + * @return Filter for prices valid for initial plans (free prices only) + */ + @JsonProperty("for_initial_plan") + public Optional getForInitialPlan() { + return forInitialPlan; + } + + /** + * @return Filter for prices valid for trial expiry plans (free prices only) + */ + @JsonProperty("for_trial_expiry_plan") + public Optional getForTrialExpiryPlan() { + return forTrialExpiryPlan; + } + + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + @JsonProperty("interval") + public Optional getInterval() { + return interval; + } + + /** + * @return Filter for active prices on active products (defaults to true if not specified) + */ + @JsonProperty("is_active") + public Optional getIsActive() { + return isActive; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @JsonProperty("product_id") + public Optional getProductId() { + return productId; + } + + @JsonProperty("product_ids") + public Optional> getProductIds() { + return productIds; + } + + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + + @JsonProperty("q") + public Optional getQ() { + return q; + } + + @JsonProperty("tiers_mode") + public Optional getTiersMode() { + return tiersMode; + } + + @JsonProperty("usage_type") + public Optional getUsageType() { + return usageType; + } + + /** + * @return Filter for prices with a meter + */ + @JsonProperty("with_meter") + public Optional getWithMeter() { + return withMeter; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBillingProductPricesParams && equalTo((ListBillingProductPricesParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBillingProductPricesParams other) { + return forInitialPlan.equals(other.forInitialPlan) + && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) + && ids.equals(other.ids) + && interval.equals(other.interval) + && isActive.equals(other.isActive) + && limit.equals(other.limit) + && offset.equals(other.offset) + && price.equals(other.price) + && productId.equals(other.productId) + && productIds.equals(other.productIds) + && providerType.equals(other.providerType) + && q.equals(other.q) + && tiersMode.equals(other.tiersMode) + && usageType.equals(other.usageType) + && withMeter.equals(other.withMeter); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.forInitialPlan, + this.forTrialExpiryPlan, + this.ids, + this.interval, + this.isActive, + this.limit, + this.offset, + this.price, + this.productId, + this.productIds, + this.providerType, + this.q, + this.tiersMode, + this.usageType, + this.withMeter); + } + + @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 forInitialPlan = Optional.empty(); + + private Optional forTrialExpiryPlan = Optional.empty(); + + private Optional> ids = Optional.empty(); + + private Optional interval = Optional.empty(); + + private Optional isActive = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional price = Optional.empty(); + + private Optional productId = Optional.empty(); + + private Optional> productIds = Optional.empty(); + + private Optional providerType = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional tiersMode = Optional.empty(); + + private Optional usageType = Optional.empty(); + + private Optional withMeter = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBillingProductPricesParams other) { + forInitialPlan(other.getForInitialPlan()); + forTrialExpiryPlan(other.getForTrialExpiryPlan()); + ids(other.getIds()); + interval(other.getInterval()); + isActive(other.getIsActive()); + limit(other.getLimit()); + offset(other.getOffset()); + price(other.getPrice()); + productId(other.getProductId()); + productIds(other.getProductIds()); + providerType(other.getProviderType()); + q(other.getQ()); + tiersMode(other.getTiersMode()); + usageType(other.getUsageType()); + withMeter(other.getWithMeter()); + return this; + } + + /** + *

Filter for prices valid for initial plans (free prices only)

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

Filter for prices valid for trial expiry plans (free prices only)

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

Filter for active prices on active products (defaults to true if not specified)

+ */ + @JsonSetter(value = "is_active", nulls = Nulls.SKIP) + public Builder isActive(Optional isActive) { + this.isActive = isActive; + return this; + } + + public Builder isActive(Boolean isActive) { + this.isActive = Optional.ofNullable(isActive); + 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(Integer 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(Integer offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public Builder price(Optional price) { + this.price = price; + return this; + } + + public Builder price(Integer price) { + this.price = Optional.ofNullable(price); + return this; + } + + @JsonSetter(value = "product_id", nulls = Nulls.SKIP) + public Builder productId(Optional productId) { + this.productId = productId; + return this; + } + + public Builder productId(String productId) { + this.productId = Optional.ofNullable(productId); + return this; + } + + @JsonSetter(value = "product_ids", nulls = Nulls.SKIP) + public Builder productIds(Optional> productIds) { + this.productIds = productIds; + return this; + } + + public Builder productIds(List productIds) { + this.productIds = Optional.ofNullable(productIds); + return this; + } + + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) + public Builder tiersMode(Optional tiersMode) { + this.tiersMode = tiersMode; + return this; + } + + public Builder tiersMode(BillingTiersMode tiersMode) { + this.tiersMode = Optional.ofNullable(tiersMode); + return this; + } + + @JsonSetter(value = "usage_type", nulls = Nulls.SKIP) + public Builder usageType(Optional usageType) { + this.usageType = usageType; + return this; + } + + public Builder usageType(BillingPriceUsageType usageType) { + this.usageType = Optional.ofNullable(usageType); + return this; + } + + /** + *

Filter for prices with a meter

+ */ + @JsonSetter(value = "with_meter", nulls = Nulls.SKIP) + public Builder withMeter(Optional withMeter) { + this.withMeter = withMeter; + return this; + } + + public Builder withMeter(Boolean withMeter) { + this.withMeter = Optional.ofNullable(withMeter); + return this; + } + + public ListBillingProductPricesParams build() { + return new ListBillingProductPricesParams( + forInitialPlan, + forTrialExpiryPlan, + ids, + interval, + isActive, + limit, + offset, + price, + productId, + productIds, + providerType, + q, + tiersMode, + usageType, + withMeter, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java similarity index 66% rename from src/main/java/com/schematic/api/resources/billing/types/ListProductPricesResponse.java rename to src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java index 70032cb..e28cf04 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.BillingPriceResponseData; +import com.schematic.api.types.BillingPriceView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -21,17 +21,17 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListProductPricesResponse.Builder.class) -public final class ListProductPricesResponse { - private final List data; +@JsonDeserialize(builder = ListBillingProductPricesResponse.Builder.class) +public final class ListBillingProductPricesResponse { + private final List data; - private final ListProductPricesParams params; + private final ListBillingProductPricesParams params; private final Map additionalProperties; - private ListProductPricesResponse( - List data, - ListProductPricesParams params, + private ListBillingProductPricesResponse( + List data, + ListBillingProductPricesParams params, Map additionalProperties) { this.data = data; this.params = params; @@ -39,7 +39,7 @@ private ListProductPricesResponse( } @JsonProperty("data") - public List getData() { + public List getData() { return data; } @@ -47,14 +47,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public ListProductPricesParams getParams() { + public ListBillingProductPricesParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListProductPricesResponse && equalTo((ListProductPricesResponse) other); + return other instanceof ListBillingProductPricesResponse && equalTo((ListBillingProductPricesResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListProductPricesResponse other) { + private boolean equalTo(ListBillingProductPricesResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -84,26 +84,26 @@ public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull ListProductPricesParams params); + _FinalStage params(@NotNull ListBillingProductPricesParams params); - Builder from(ListProductPricesResponse other); + Builder from(ListBillingProductPricesResponse other); } public interface _FinalStage { - ListProductPricesResponse build(); + ListBillingProductPricesResponse build(); - _FinalStage data(List data); + _FinalStage data(List data); - _FinalStage addData(BillingPriceResponseData data); + _FinalStage addData(BillingPriceView data); - _FinalStage addAllData(List data); + _FinalStage addAllData(List data); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ParamsStage, _FinalStage { - private ListProductPricesParams params; + private ListBillingProductPricesParams params; - private List data = new ArrayList<>(); + private List data = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -111,7 +111,7 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(ListProductPricesResponse other) { + public Builder from(ListBillingProductPricesResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -124,13 +124,13 @@ public Builder from(ListProductPricesResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull ListProductPricesParams params) { + public _FinalStage params(@NotNull ListBillingProductPricesParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @java.lang.Override - public _FinalStage addAllData(List data) { + public _FinalStage addAllData(List data) { if (data != null) { this.data.addAll(data); } @@ -138,14 +138,14 @@ public _FinalStage addAllData(List data) { } @java.lang.Override - public _FinalStage addData(BillingPriceResponseData data) { + public _FinalStage addData(BillingPriceView data) { this.data.add(data); return this; } @java.lang.Override @JsonSetter(value = "data", nulls = Nulls.SKIP) - public _FinalStage data(List data) { + public _FinalStage data(List data) { this.data.clear(); if (data != null) { this.data.addAll(data); @@ -154,8 +154,8 @@ public _FinalStage data(List data) { } @java.lang.Override - public ListProductPricesResponse build() { - return new ListProductPricesResponse(data, params, additionalProperties); + public ListBillingProductPricesResponse build() { + return new ListBillingProductPricesResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsParams.java index b6d55b8..d7a9286 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsParams.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.BillingPriceUsageType; +import com.schematic.api.types.BillingProviderType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,7 +33,9 @@ public final class ListBillingProductsParams { private final Optional offset; - private final Optional priceUsageType; + private final Optional priceUsageType; + + private final Optional providerType; private final Optional q; @@ -51,7 +55,8 @@ private ListBillingProductsParams( Optional limit, Optional name, Optional offset, - Optional priceUsageType, + Optional priceUsageType, + Optional providerType, Optional q, Optional withOneTimeCharges, Optional withPricesOnly, @@ -64,6 +69,7 @@ private ListBillingProductsParams( this.name = name; this.offset = offset; this.priceUsageType = priceUsageType; + this.providerType = providerType; this.q = q; this.withOneTimeCharges = withOneTimeCharges; this.withPricesOnly = withPricesOnly; @@ -78,7 +84,7 @@ public Optional> getIds() { } /** - * @return Filter products that are active + * @return Filter products that are active. Defaults to true if not specified */ @JsonProperty("is_active") public Optional getIsActive() { @@ -107,10 +113,15 @@ public Optional getOffset() { } @JsonProperty("price_usage_type") - public Optional getPriceUsageType() { + public Optional getPriceUsageType() { return priceUsageType; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("q") public Optional getQ() { return q; @@ -166,6 +177,7 @@ private boolean equalTo(ListBillingProductsParams other) { && name.equals(other.name) && offset.equals(other.offset) && priceUsageType.equals(other.priceUsageType) + && providerType.equals(other.providerType) && q.equals(other.q) && withOneTimeCharges.equals(other.withOneTimeCharges) && withPricesOnly.equals(other.withPricesOnly) @@ -182,6 +194,7 @@ public int hashCode() { this.name, this.offset, this.priceUsageType, + this.providerType, this.q, this.withOneTimeCharges, this.withPricesOnly, @@ -210,7 +223,9 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional priceUsageType = Optional.empty(); + private Optional priceUsageType = Optional.empty(); + + private Optional providerType = Optional.empty(); private Optional q = Optional.empty(); @@ -234,6 +249,7 @@ public Builder from(ListBillingProductsParams other) { name(other.getName()); offset(other.getOffset()); priceUsageType(other.getPriceUsageType()); + providerType(other.getProviderType()); q(other.getQ()); withOneTimeCharges(other.getWithOneTimeCharges()); withPricesOnly(other.getWithPricesOnly()); @@ -254,7 +270,7 @@ public Builder ids(List ids) { } /** - *

Filter products that are active

+ *

Filter products that are active. Defaults to true if not specified

*/ @JsonSetter(value = "is_active", nulls = Nulls.SKIP) public Builder isActive(Optional isActive) { @@ -307,16 +323,27 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) - public Builder priceUsageType(Optional priceUsageType) { + public Builder priceUsageType(Optional priceUsageType) { this.priceUsageType = priceUsageType; return this; } - public Builder priceUsageType(ListBillingProductsResponseParamsPriceUsageType priceUsageType) { + public Builder priceUsageType(BillingPriceUsageType priceUsageType) { this.priceUsageType = Optional.ofNullable(priceUsageType); return this; } + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + @JsonSetter(value = "q", nulls = Nulls.SKIP) public Builder q(Optional q) { this.q = q; @@ -392,6 +419,7 @@ public ListBillingProductsParams build() { name, offset, priceUsageType, + providerType, q, withOneTimeCharges, withPricesOnly, diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsRequestPriceUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsRequestPriceUsageType.java deleted file mode 100644 index 1e1d07f..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsRequestPriceUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListBillingProductsRequestPriceUsageType { - public static final ListBillingProductsRequestPriceUsageType METERED = - new ListBillingProductsRequestPriceUsageType(Value.METERED, "metered"); - - public static final ListBillingProductsRequestPriceUsageType LICENSED = - new ListBillingProductsRequestPriceUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - ListBillingProductsRequestPriceUsageType(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 ListBillingProductsRequestPriceUsageType - && this.string.equals(((ListBillingProductsRequestPriceUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListBillingProductsRequestPriceUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new ListBillingProductsRequestPriceUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponseParamsPriceUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponseParamsPriceUsageType.java deleted file mode 100644 index 904f1d3..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponseParamsPriceUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListBillingProductsResponseParamsPriceUsageType { - public static final ListBillingProductsResponseParamsPriceUsageType METERED = - new ListBillingProductsResponseParamsPriceUsageType(Value.METERED, "metered"); - - public static final ListBillingProductsResponseParamsPriceUsageType LICENSED = - new ListBillingProductsResponseParamsPriceUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - ListBillingProductsResponseParamsPriceUsageType(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 ListBillingProductsResponseParamsPriceUsageType - && this.string.equals(((ListBillingProductsResponseParamsPriceUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListBillingProductsResponseParamsPriceUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new ListBillingProductsResponseParamsPriceUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsParams.java index e720a04..2578b1e 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingProviderType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,31 +24,31 @@ public final class ListCustomersWithSubscriptionsParams { private final Optional> companyIds; - private final Optional failedToImport; - private final Optional limit; private final Optional name; private final Optional offset; + private final Optional providerType; + private final Optional q; private final Map additionalProperties; private ListCustomersWithSubscriptionsParams( Optional> companyIds, - Optional failedToImport, Optional limit, Optional name, Optional offset, + Optional providerType, Optional q, Map additionalProperties) { this.companyIds = companyIds; - this.failedToImport = failedToImport; this.limit = limit; this.name = name; this.offset = offset; + this.providerType = providerType; this.q = q; this.additionalProperties = additionalProperties; } @@ -57,11 +58,6 @@ public Optional> getCompanyIds() { return companyIds; } - @JsonProperty("failed_to_import") - public Optional getFailedToImport() { - return failedToImport; - } - /** * @return Page limit (default 100) */ @@ -83,6 +79,11 @@ public Optional getOffset() { return offset; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("q") public Optional getQ() { return q; @@ -102,16 +103,16 @@ public Map getAdditionalProperties() { private boolean equalTo(ListCustomersWithSubscriptionsParams other) { return companyIds.equals(other.companyIds) - && failedToImport.equals(other.failedToImport) && limit.equals(other.limit) && name.equals(other.name) && offset.equals(other.offset) + && providerType.equals(other.providerType) && q.equals(other.q); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyIds, this.failedToImport, this.limit, this.name, this.offset, this.q); + return Objects.hash(this.companyIds, this.limit, this.name, this.offset, this.providerType, this.q); } @java.lang.Override @@ -127,14 +128,14 @@ public static Builder builder() { public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional failedToImport = Optional.empty(); - private Optional limit = Optional.empty(); private Optional name = Optional.empty(); private Optional offset = Optional.empty(); + private Optional providerType = Optional.empty(); + private Optional q = Optional.empty(); @JsonAnySetter @@ -144,10 +145,10 @@ private Builder() {} public Builder from(ListCustomersWithSubscriptionsParams other) { companyIds(other.getCompanyIds()); - failedToImport(other.getFailedToImport()); limit(other.getLimit()); name(other.getName()); offset(other.getOffset()); + providerType(other.getProviderType()); q(other.getQ()); return this; } @@ -163,17 +164,6 @@ public Builder companyIds(List companyIds) { return this; } - @JsonSetter(value = "failed_to_import", nulls = Nulls.SKIP) - public Builder failedToImport(Optional failedToImport) { - this.failedToImport = failedToImport; - return this; - } - - public Builder failedToImport(Boolean failedToImport) { - this.failedToImport = Optional.ofNullable(failedToImport); - return this; - } - /** *

Page limit (default 100)

*/ @@ -213,6 +203,17 @@ public Builder offset(Integer offset) { return this; } + @JsonSetter(value = "provider_type", nulls = Nulls.SKIP) + public Builder providerType(Optional providerType) { + this.providerType = providerType; + return this; + } + + public Builder providerType(BillingProviderType providerType) { + this.providerType = Optional.ofNullable(providerType); + return this; + } + @JsonSetter(value = "q", nulls = Nulls.SKIP) public Builder q(Optional q) { this.q = q; @@ -226,7 +227,7 @@ public Builder q(String q) { public ListCustomersWithSubscriptionsParams build() { return new ListCustomersWithSubscriptionsParams( - companyIds, failedToImport, limit, name, offset, q, additionalProperties); + companyIds, limit, name, offset, providerType, q, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesParams.java deleted file mode 100644 index 88b6f52..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesParams.java +++ /dev/null @@ -1,403 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.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 = ListProductPricesParams.Builder.class) -public final class ListProductPricesParams { - private final Optional> ids; - - private final Optional isActive; - - private final Optional limit; - - private final Optional name; - - private final Optional offset; - - private final Optional priceUsageType; - - private final Optional q; - - private final Optional withOneTimeCharges; - - private final Optional withPricesOnly; - - private final Optional withZeroPrice; - - private final Optional withoutLinkedToPlan; - - private final Map additionalProperties; - - private ListProductPricesParams( - Optional> ids, - Optional isActive, - Optional limit, - Optional name, - Optional offset, - Optional priceUsageType, - Optional q, - Optional withOneTimeCharges, - Optional withPricesOnly, - Optional withZeroPrice, - Optional withoutLinkedToPlan, - Map additionalProperties) { - this.ids = ids; - this.isActive = isActive; - this.limit = limit; - this.name = name; - this.offset = offset; - this.priceUsageType = priceUsageType; - this.q = q; - this.withOneTimeCharges = withOneTimeCharges; - this.withPricesOnly = withPricesOnly; - this.withZeroPrice = withZeroPrice; - this.withoutLinkedToPlan = withoutLinkedToPlan; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - /** - * @return Filter products that are active - */ - @JsonProperty("is_active") - public Optional getIsActive() { - return isActive; - } - - /** - * @return Page limit (default 100) - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return Page offset (default 0) - */ - @JsonProperty("offset") - public Optional getOffset() { - return offset; - } - - @JsonProperty("price_usage_type") - public Optional getPriceUsageType() { - return priceUsageType; - } - - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Filter products that are one time charges - */ - @JsonProperty("with_one_time_charges") - public Optional getWithOneTimeCharges() { - return withOneTimeCharges; - } - - /** - * @return Filter products that have prices - */ - @JsonProperty("with_prices_only") - public Optional getWithPricesOnly() { - return withPricesOnly; - } - - /** - * @return Filter products that have zero price for free subscription type - */ - @JsonProperty("with_zero_price") - public Optional getWithZeroPrice() { - return withZeroPrice; - } - - /** - * @return Filter products that are not linked to any plan - */ - @JsonProperty("without_linked_to_plan") - public Optional getWithoutLinkedToPlan() { - return withoutLinkedToPlan; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProductPricesParams && equalTo((ListProductPricesParams) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProductPricesParams other) { - return ids.equals(other.ids) - && isActive.equals(other.isActive) - && limit.equals(other.limit) - && name.equals(other.name) - && offset.equals(other.offset) - && priceUsageType.equals(other.priceUsageType) - && q.equals(other.q) - && withOneTimeCharges.equals(other.withOneTimeCharges) - && withPricesOnly.equals(other.withPricesOnly) - && withZeroPrice.equals(other.withZeroPrice) - && withoutLinkedToPlan.equals(other.withoutLinkedToPlan); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.ids, - this.isActive, - this.limit, - this.name, - this.offset, - this.priceUsageType, - this.q, - this.withOneTimeCharges, - this.withPricesOnly, - this.withZeroPrice, - this.withoutLinkedToPlan); - } - - @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 isActive = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional offset = Optional.empty(); - - private Optional priceUsageType = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional withOneTimeCharges = Optional.empty(); - - private Optional withPricesOnly = Optional.empty(); - - private Optional withZeroPrice = Optional.empty(); - - private Optional withoutLinkedToPlan = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProductPricesParams other) { - ids(other.getIds()); - isActive(other.getIsActive()); - limit(other.getLimit()); - name(other.getName()); - offset(other.getOffset()); - priceUsageType(other.getPriceUsageType()); - q(other.getQ()); - withOneTimeCharges(other.getWithOneTimeCharges()); - withPricesOnly(other.getWithPricesOnly()); - withZeroPrice(other.getWithZeroPrice()); - withoutLinkedToPlan(other.getWithoutLinkedToPlan()); - 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; - } - - /** - *

Filter products that are active

- */ - @JsonSetter(value = "is_active", nulls = Nulls.SKIP) - public Builder isActive(Optional isActive) { - this.isActive = isActive; - return this; - } - - public Builder isActive(Boolean isActive) { - this.isActive = Optional.ofNullable(isActive); - 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(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

Page offset (default 0)

- */ - @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { - this.offset = offset; - return this; - } - - public Builder offset(Integer offset) { - this.offset = Optional.ofNullable(offset); - return this; - } - - @JsonSetter(value = "price_usage_type", nulls = Nulls.SKIP) - public Builder priceUsageType(Optional priceUsageType) { - this.priceUsageType = priceUsageType; - return this; - } - - public Builder priceUsageType(ListProductPricesResponseParamsPriceUsageType priceUsageType) { - this.priceUsageType = Optional.ofNullable(priceUsageType); - return this; - } - - @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; - } - - /** - *

Filter products that are one time charges

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

Filter products that have prices

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

Filter products that have zero price for free subscription type

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

Filter products that are not linked to any plan

- */ - @JsonSetter(value = "without_linked_to_plan", nulls = Nulls.SKIP) - public Builder withoutLinkedToPlan(Optional withoutLinkedToPlan) { - this.withoutLinkedToPlan = withoutLinkedToPlan; - return this; - } - - public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { - this.withoutLinkedToPlan = Optional.ofNullable(withoutLinkedToPlan); - return this; - } - - public ListProductPricesParams build() { - return new ListProductPricesParams( - ids, - isActive, - limit, - name, - offset, - priceUsageType, - q, - withOneTimeCharges, - withPricesOnly, - withZeroPrice, - withoutLinkedToPlan, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesRequestPriceUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesRequestPriceUsageType.java deleted file mode 100644 index ec1594a..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesRequestPriceUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListProductPricesRequestPriceUsageType { - public static final ListProductPricesRequestPriceUsageType METERED = - new ListProductPricesRequestPriceUsageType(Value.METERED, "metered"); - - public static final ListProductPricesRequestPriceUsageType LICENSED = - new ListProductPricesRequestPriceUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - ListProductPricesRequestPriceUsageType(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 ListProductPricesRequestPriceUsageType - && this.string.equals(((ListProductPricesRequestPriceUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListProductPricesRequestPriceUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new ListProductPricesRequestPriceUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesResponseParamsPriceUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesResponseParamsPriceUsageType.java deleted file mode 100644 index 987dae9..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/ListProductPricesResponseParamsPriceUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListProductPricesResponseParamsPriceUsageType { - public static final ListProductPricesResponseParamsPriceUsageType METERED = - new ListProductPricesResponseParamsPriceUsageType(Value.METERED, "metered"); - - public static final ListProductPricesResponseParamsPriceUsageType LICENSED = - new ListProductPricesResponseParamsPriceUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - ListProductPricesResponseParamsPriceUsageType(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 ListProductPricesResponseParamsPriceUsageType - && this.string.equals(((ListProductPricesResponseParamsPriceUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListProductPricesResponseParamsPriceUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new ListProductPricesResponseParamsPriceUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesRequestUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesRequestUsageType.java deleted file mode 100644 index f10f0cd..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesRequestUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SearchBillingPricesRequestUsageType { - public static final SearchBillingPricesRequestUsageType METERED = - new SearchBillingPricesRequestUsageType(Value.METERED, "metered"); - - public static final SearchBillingPricesRequestUsageType LICENSED = - new SearchBillingPricesRequestUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - SearchBillingPricesRequestUsageType(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 SearchBillingPricesRequestUsageType - && this.string.equals(((SearchBillingPricesRequestUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SearchBillingPricesRequestUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new SearchBillingPricesRequestUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponseParamsTiersMode.java b/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponseParamsTiersMode.java deleted file mode 100644 index 02b14a7..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponseParamsTiersMode.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SearchBillingPricesResponseParamsTiersMode { - public static final SearchBillingPricesResponseParamsTiersMode GRADUATED = - new SearchBillingPricesResponseParamsTiersMode(Value.GRADUATED, "graduated"); - - public static final SearchBillingPricesResponseParamsTiersMode VOLUME = - new SearchBillingPricesResponseParamsTiersMode(Value.VOLUME, "volume"); - - private final Value value; - - private final String string; - - SearchBillingPricesResponseParamsTiersMode(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 SearchBillingPricesResponseParamsTiersMode - && this.string.equals(((SearchBillingPricesResponseParamsTiersMode) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GRADUATED: - return visitor.visitGraduated(); - case VOLUME: - return visitor.visitVolume(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SearchBillingPricesResponseParamsTiersMode valueOf(String value) { - switch (value) { - case "graduated": - return GRADUATED; - case "volume": - return VOLUME; - default: - return new SearchBillingPricesResponseParamsTiersMode(Value.UNKNOWN, value); - } - } - - public enum Value { - VOLUME, - - GRADUATED, - - UNKNOWN - } - - public interface Visitor { - T visitVolume(); - - T visitGraduated(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponseParamsUsageType.java b/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponseParamsUsageType.java deleted file mode 100644 index 9e7a5be..0000000 --- a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesResponseParamsUsageType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.billing.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SearchBillingPricesResponseParamsUsageType { - public static final SearchBillingPricesResponseParamsUsageType METERED = - new SearchBillingPricesResponseParamsUsageType(Value.METERED, "metered"); - - public static final SearchBillingPricesResponseParamsUsageType LICENSED = - new SearchBillingPricesResponseParamsUsageType(Value.LICENSED, "licensed"); - - private final Value value; - - private final String string; - - SearchBillingPricesResponseParamsUsageType(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 SearchBillingPricesResponseParamsUsageType - && this.string.equals(((SearchBillingPricesResponseParamsUsageType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METERED: - return visitor.visitMetered(); - case LICENSED: - return visitor.visitLicensed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SearchBillingPricesResponseParamsUsageType valueOf(String value) { - switch (value) { - case "metered": - return METERED; - case "licensed": - return LICENSED; - default: - return new SearchBillingPricesResponseParamsUsageType(Value.UNKNOWN, value); - } - } - - public enum Value { - LICENSED, - - METERED, - - UNKNOWN - } - - public interface Visitor { - T visitLicensed(); - - T visitMetered(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java index fc0b9b9..679c29a 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java @@ -5,8 +5,10 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; +import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; @@ -79,6 +81,15 @@ public CompletableFuture previewManagePlan( return this.rawClient.previewManagePlan(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture cancelSubscription(CancelSubscriptionRequest request) { + return this.rawClient.cancelSubscription(request).thenApply(response -> response.body()); + } + + public CompletableFuture cancelSubscription( + CancelSubscriptionRequest request, RequestOptions requestOptions) { + return this.rawClient.cancelSubscription(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updateCustomerSubscriptionTrialEnd( String subscriptionId) { return this.rawClient.updateCustomerSubscriptionTrialEnd(subscriptionId).thenApply(response -> response.body()); diff --git a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java index 6155c83..9e5d971 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java @@ -16,8 +16,10 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; +import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; @@ -506,6 +508,98 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> cancelSubscription( + CancelSubscriptionRequest request) { + return cancelSubscription(request, null); + } + + public CompletableFuture> cancelSubscription( + CancelSubscriptionRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("manage-plan/subscription/cancel") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CancelSubscriptionResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> updateCustomerSubscriptionTrialEnd(String subscriptionId) { return updateCustomerSubscriptionTrialEnd( diff --git a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java index ce31ded..c1abb79 100644 --- a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java @@ -5,8 +5,10 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; +import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; @@ -75,6 +77,15 @@ public PreviewManagePlanResponse previewManagePlan(ManagePlanRequest request, Re return this.rawClient.previewManagePlan(request, requestOptions).body(); } + public CancelSubscriptionResponse cancelSubscription(CancelSubscriptionRequest request) { + return this.rawClient.cancelSubscription(request).body(); + } + + public CancelSubscriptionResponse cancelSubscription( + CancelSubscriptionRequest request, RequestOptions requestOptions) { + return this.rawClient.cancelSubscription(request, requestOptions).body(); + } + public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTrialEnd(String subscriptionId) { return this.rawClient.updateCustomerSubscriptionTrialEnd(subscriptionId).body(); } diff --git a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java index a4435e9..3e1e04d 100644 --- a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java @@ -16,8 +16,10 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.checkout.requests.CancelSubscriptionRequest; import com.schematic.api.resources.checkout.requests.CheckoutDataRequestBody; import com.schematic.api.resources.checkout.requests.UpdateTrialEndRequestBody; +import com.schematic.api.resources.checkout.types.CancelSubscriptionResponse; import com.schematic.api.resources.checkout.types.CheckoutInternalResponse; import com.schematic.api.resources.checkout.types.GetCheckoutDataResponse; import com.schematic.api.resources.checkout.types.ManagePlanResponse; @@ -379,6 +381,73 @@ public BaseSchematicHttpResponse previewManagePlan( } } + public BaseSchematicHttpResponse cancelSubscription(CancelSubscriptionRequest request) { + return cancelSubscription(request, null); + } + + public BaseSchematicHttpResponse cancelSubscription( + CancelSubscriptionRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("manage-plan/subscription/cancel") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelSubscriptionResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse updateCustomerSubscriptionTrialEnd( String subscriptionId) { return updateCustomerSubscriptionTrialEnd( diff --git a/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java b/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java new file mode 100644 index 0000000..7639e29 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.checkout.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 = CancelSubscriptionRequest.Builder.class) +public final class CancelSubscriptionRequest { + private final Optional cancelImmediately; + + private final String companyId; + + private final Optional prorate; + + private final Map additionalProperties; + + private CancelSubscriptionRequest( + Optional cancelImmediately, + String companyId, + Optional prorate, + Map additionalProperties) { + this.cancelImmediately = cancelImmediately; + this.companyId = companyId; + this.prorate = prorate; + this.additionalProperties = additionalProperties; + } + + /** + * @return If false, subscription cancels at period end. Defaults to true. + */ + @JsonProperty("cancel_immediately") + public Optional getCancelImmediately() { + return cancelImmediately; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + /** + * @return If true and cancel_immediately is true, issue prorated credit. Defaults to true. + */ + @JsonProperty("prorate") + public Optional getProrate() { + return prorate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CancelSubscriptionRequest && equalTo((CancelSubscriptionRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CancelSubscriptionRequest other) { + return cancelImmediately.equals(other.cancelImmediately) + && companyId.equals(other.companyId) + && prorate.equals(other.prorate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cancelImmediately, this.companyId, this.prorate); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + _FinalStage companyId(@NotNull String companyId); + + Builder from(CancelSubscriptionRequest other); + } + + public interface _FinalStage { + CancelSubscriptionRequest build(); + + /** + *

If false, subscription cancels at period end. Defaults to true.

+ */ + _FinalStage cancelImmediately(Optional cancelImmediately); + + _FinalStage cancelImmediately(Boolean cancelImmediately); + + /** + *

If true and cancel_immediately is true, issue prorated credit. Defaults to true.

+ */ + _FinalStage prorate(Optional prorate); + + _FinalStage prorate(Boolean prorate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional prorate = Optional.empty(); + + private Optional cancelImmediately = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CancelSubscriptionRequest other) { + cancelImmediately(other.getCancelImmediately()); + companyId(other.getCompanyId()); + prorate(other.getProrate()); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public _FinalStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + /** + *

If true and cancel_immediately is true, issue prorated credit. Defaults to true.

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

If true and cancel_immediately is true, issue prorated credit. Defaults to true.

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

If false, subscription cancels at period end. Defaults to true.

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

If false, subscription cancels at period end. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_immediately", nulls = Nulls.SKIP) + public _FinalStage cancelImmediately(Optional cancelImmediately) { + this.cancelImmediately = cancelImmediately; + return this; + } + + @java.lang.Override + public CancelSubscriptionRequest build() { + return new CancelSubscriptionRequest(cancelImmediately, companyId, prorate, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/crm/types/UpsertDealLineItemAssociationResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java similarity index 75% rename from src/main/java/com/schematic/api/resources/crm/types/UpsertDealLineItemAssociationResponse.java rename to src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java index a8ace2a..cf0dd4d 100644 --- a/src/main/java/com/schematic/api/resources/crm/types/UpsertDealLineItemAssociationResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.types; +package com.schematic.api.resources.checkout.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.CrmLineItemResponseData; +import com.schematic.api.types.ManagePlanResponseResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,23 +21,25 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpsertDealLineItemAssociationResponse.Builder.class) -public final class UpsertDealLineItemAssociationResponse { - private final CrmLineItemResponseData data; +@JsonDeserialize(builder = CancelSubscriptionResponse.Builder.class) +public final class CancelSubscriptionResponse { + private final ManagePlanResponseResponseData data; private final Map params; private final Map additionalProperties; - private UpsertDealLineItemAssociationResponse( - CrmLineItemResponseData data, Map params, Map additionalProperties) { + private CancelSubscriptionResponse( + ManagePlanResponseResponseData data, + Map params, + Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public CrmLineItemResponseData getData() { + public ManagePlanResponseResponseData getData() { return data; } @@ -52,8 +54,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof UpsertDealLineItemAssociationResponse - && equalTo((UpsertDealLineItemAssociationResponse) other); + return other instanceof CancelSubscriptionResponse && equalTo((CancelSubscriptionResponse) other); } @JsonAnyGetter @@ -61,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(UpsertDealLineItemAssociationResponse other) { + private boolean equalTo(CancelSubscriptionResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -80,13 +81,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull CrmLineItemResponseData data); + _FinalStage data(@NotNull ManagePlanResponseResponseData data); - Builder from(UpsertDealLineItemAssociationResponse other); + Builder from(CancelSubscriptionResponse other); } public interface _FinalStage { - UpsertDealLineItemAssociationResponse build(); + CancelSubscriptionResponse build(); /** *

Input parameters

@@ -100,7 +101,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private CrmLineItemResponseData data; + private ManagePlanResponseResponseData data; private Map params = new LinkedHashMap<>(); @@ -110,7 +111,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(UpsertDealLineItemAssociationResponse other) { + public Builder from(CancelSubscriptionResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -118,7 +119,7 @@ public Builder from(UpsertDealLineItemAssociationResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull CrmLineItemResponseData data) { + public _FinalStage data(@NotNull ManagePlanResponseResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -159,8 +160,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public UpsertDealLineItemAssociationResponse build() { - return new UpsertDealLineItemAssociationResponse(data, params, additionalProperties); + public CancelSubscriptionResponse build() { + return new CancelSubscriptionResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java index 4a306b4..cb5da48 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java @@ -13,8 +13,8 @@ import com.schematic.api.resources.companies.requests.CountUsersRequest; import com.schematic.api.resources.companies.requests.CreateEntityTraitDefinitionRequestBody; import com.schematic.api.resources.companies.requests.CreatePlanTraitRequestBody; +import com.schematic.api.resources.companies.requests.DeleteCompanyRequest; import com.schematic.api.resources.companies.requests.GetActiveCompanySubscriptionRequest; -import com.schematic.api.resources.companies.requests.GetActiveDealsRequest; import com.schematic.api.resources.companies.requests.GetEntityTraitValuesRequest; import com.schematic.api.resources.companies.requests.GetOrCreateCompanyMembershipRequestBody; import com.schematic.api.resources.companies.requests.ListCompaniesForAdvancedFilterRequest; @@ -46,7 +46,6 @@ import com.schematic.api.resources.companies.types.DeleteUserByKeysResponse; import com.schematic.api.resources.companies.types.DeleteUserResponse; import com.schematic.api.resources.companies.types.GetActiveCompanySubscriptionResponse; -import com.schematic.api.resources.companies.types.GetActiveDealsResponse; import com.schematic.api.resources.companies.types.GetCompanyResponse; import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionResponse; import com.schematic.api.resources.companies.types.GetEntityTraitValuesResponse; @@ -129,8 +128,13 @@ public CompletableFuture deleteCompany(String companyId) return this.rawClient.deleteCompany(companyId).thenApply(response -> response.body()); } - public CompletableFuture deleteCompany(String companyId, RequestOptions requestOptions) { - return this.rawClient.deleteCompany(companyId, requestOptions).thenApply(response -> response.body()); + public CompletableFuture deleteCompany(String companyId, DeleteCompanyRequest request) { + return this.rawClient.deleteCompany(companyId, request).thenApply(response -> response.body()); + } + + public CompletableFuture deleteCompany( + String companyId, DeleteCompanyRequest request, RequestOptions requestOptions) { + return this.rawClient.deleteCompany(companyId, request, requestOptions).thenApply(response -> response.body()); } public CompletableFuture countCompanies() { @@ -205,15 +209,6 @@ public CompletableFuture lookupCompany( return this.rawClient.lookupCompany(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture getActiveDeals(GetActiveDealsRequest request) { - return this.rawClient.getActiveDeals(request).thenApply(response -> response.body()); - } - - public CompletableFuture getActiveDeals( - GetActiveDealsRequest request, RequestOptions requestOptions) { - return this.rawClient.getActiveDeals(request, requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture listCompanyMemberships() { return this.rawClient.listCompanyMemberships().thenApply(response -> response.body()); } 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 bf011bb..a5d1dff 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -25,8 +25,8 @@ import com.schematic.api.resources.companies.requests.CountUsersRequest; import com.schematic.api.resources.companies.requests.CreateEntityTraitDefinitionRequestBody; import com.schematic.api.resources.companies.requests.CreatePlanTraitRequestBody; +import com.schematic.api.resources.companies.requests.DeleteCompanyRequest; import com.schematic.api.resources.companies.requests.GetActiveCompanySubscriptionRequest; -import com.schematic.api.resources.companies.requests.GetActiveDealsRequest; import com.schematic.api.resources.companies.requests.GetEntityTraitValuesRequest; import com.schematic.api.resources.companies.requests.GetOrCreateCompanyMembershipRequestBody; import com.schematic.api.resources.companies.requests.ListCompaniesForAdvancedFilterRequest; @@ -58,7 +58,6 @@ import com.schematic.api.resources.companies.types.DeleteUserByKeysResponse; import com.schematic.api.resources.companies.types.DeleteUserResponse; import com.schematic.api.resources.companies.types.GetActiveCompanySubscriptionResponse; -import com.schematic.api.resources.companies.types.GetActiveDealsResponse; import com.schematic.api.resources.companies.types.GetCompanyResponse; import com.schematic.api.resources.companies.types.GetEntityTraitDefinitionResponse; import com.schematic.api.resources.companies.types.GetEntityTraitValuesResponse; @@ -123,6 +122,13 @@ public CompletableFuture> listC HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies"); + if (request.getMonetizedSubscriptions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "monetized_subscriptions", + request.getMonetizedSubscriptions().get(), + false); + } if (request.getPlanId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().get(), false); @@ -130,6 +136,17 @@ public CompletableFuture> listC if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getSortOrderColumn().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_order_column", request.getSortOrderColumn().get(), false); + } + if (request.getSortOrderDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "sort_order_direction", + request.getSortOrderDirection().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -141,6 +158,13 @@ public CompletableFuture> listC QueryStringMapper.addQueryParameter( httpUrl, "without_plan", request.getWithoutPlan().get(), false); } + if (request.getWithoutSubscription().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_subscription", + request.getWithoutSubscription().get(), + false); + } if (request.getWithSubscription().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_subscription", request.getWithSubscription().get(), false); @@ -153,9 +177,31 @@ public CompletableFuture> listC QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (request.getCreditTypeIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "credit_type_ids", request.getCreditTypeIds().get(), true); + } if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getSubscriptionStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_statuses", + request.getSubscriptionStatuses().get(), + true); + } + if (request.getSubscriptionTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_types", + request.getSubscriptionTypes().get(), + true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -398,22 +444,37 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } public CompletableFuture> deleteCompany(String companyId) { - return deleteCompany(companyId, null); + return deleteCompany(companyId, DeleteCompanyRequest.builder().build()); } public CompletableFuture> deleteCompany( - String companyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + String companyId, DeleteCompanyRequest request) { + return deleteCompany(companyId, request, null); + } + + public CompletableFuture> deleteCompany( + String companyId, DeleteCompanyRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .addPathSegment(companyId); + if (request.getCancelSubscription().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "cancel_subscription", + request.getCancelSubscription().get(), + false); + } + if (request.getProrate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "prorate", request.getProrate().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); @@ -494,6 +555,13 @@ public CompletableFuture> coun HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies/count"); + if (request.getMonetizedSubscriptions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "monetized_subscriptions", + request.getMonetizedSubscriptions().get(), + false); + } if (request.getPlanId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().get(), false); @@ -501,6 +569,17 @@ public CompletableFuture> coun if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getSortOrderColumn().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_order_column", request.getSortOrderColumn().get(), false); + } + if (request.getSortOrderDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "sort_order_direction", + request.getSortOrderDirection().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -512,6 +591,13 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "without_plan", request.getWithoutPlan().get(), false); } + if (request.getWithoutSubscription().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_subscription", + request.getWithoutSubscription().get(), + false); + } if (request.getWithSubscription().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_subscription", request.getWithSubscription().get(), false); @@ -524,9 +610,31 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (request.getCreditTypeIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "credit_type_ids", request.getCreditTypeIds().get(), true); + } if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getSubscriptionStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_statuses", + request.getSubscriptionStatuses().get(), + true); + } + if (request.getSubscriptionTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_types", + request.getSubscriptionTypes().get(), + true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1195,99 +1303,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - public CompletableFuture> getActiveDeals( - GetActiveDealsRequest request) { - return getActiveDeals(request, null); - } - - public CompletableFuture> getActiveDeals( - GetActiveDealsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("company-crm-deals"); - QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); - QueryStringMapper.addQueryParameter(httpUrl, "deal_stage", request.getDealStage(), 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); - } - 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()) { - if (response.isSuccessful()) { - future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetActiveDealsResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - return future; - } - public CompletableFuture> listCompanyMemberships() { return listCompanyMemberships(ListCompanyMembershipsRequest.builder().build()); } @@ -2021,6 +2036,10 @@ public CompletableFuture listCompanies( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies"); + if (request.getMonetizedSubscriptions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "monetized_subscriptions", + request.getMonetizedSubscriptions().get(), + false); + } if (request.getPlanId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().get(), false); @@ -125,6 +131,17 @@ public BaseSchematicHttpResponse listCompanies( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getSortOrderColumn().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_order_column", request.getSortOrderColumn().get(), false); + } + if (request.getSortOrderDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "sort_order_direction", + request.getSortOrderDirection().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -136,6 +153,13 @@ public BaseSchematicHttpResponse listCompanies( QueryStringMapper.addQueryParameter( httpUrl, "without_plan", request.getWithoutPlan().get(), false); } + if (request.getWithoutSubscription().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_subscription", + request.getWithoutSubscription().get(), + false); + } if (request.getWithSubscription().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_subscription", request.getWithSubscription().get(), false); @@ -148,9 +172,31 @@ public BaseSchematicHttpResponse listCompanies( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (request.getCreditTypeIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "credit_type_ids", request.getCreditTypeIds().get(), true); + } if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getSubscriptionStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_statuses", + request.getSubscriptionStatuses().get(), + true); + } + if (request.getSubscriptionTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_types", + request.getSubscriptionTypes().get(), + true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -323,22 +369,37 @@ public BaseSchematicHttpResponse getCompany(String companyId } public BaseSchematicHttpResponse deleteCompany(String companyId) { - return deleteCompany(companyId, null); + return deleteCompany(companyId, DeleteCompanyRequest.builder().build()); } public BaseSchematicHttpResponse deleteCompany( - String companyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + String companyId, DeleteCompanyRequest request) { + return deleteCompany(companyId, request, null); + } + + public BaseSchematicHttpResponse deleteCompany( + String companyId, DeleteCompanyRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .addPathSegment(companyId); + if (request.getCancelSubscription().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "cancel_subscription", + request.getCancelSubscription().get(), + false); + } + if (request.getProrate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "prorate", request.getProrate().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); @@ -395,6 +456,13 @@ public BaseSchematicHttpResponse countCompanies( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies/count"); + if (request.getMonetizedSubscriptions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "monetized_subscriptions", + request.getMonetizedSubscriptions().get(), + false); + } if (request.getPlanId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().get(), false); @@ -402,6 +470,17 @@ public BaseSchematicHttpResponse countCompanies( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getSortOrderColumn().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_order_column", request.getSortOrderColumn().get(), false); + } + if (request.getSortOrderDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "sort_order_direction", + request.getSortOrderDirection().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -413,6 +492,13 @@ public BaseSchematicHttpResponse countCompanies( QueryStringMapper.addQueryParameter( httpUrl, "without_plan", request.getWithoutPlan().get(), false); } + if (request.getWithoutSubscription().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "without_subscription", + request.getWithoutSubscription().get(), + false); + } if (request.getWithSubscription().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "with_subscription", request.getWithSubscription().get(), false); @@ -425,9 +511,31 @@ public BaseSchematicHttpResponse countCompanies( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (request.getCreditTypeIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "credit_type_ids", request.getCreditTypeIds().get(), true); + } if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getPlanIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_ids", request.getPlanIds().get(), true); + } + if (request.getSubscriptionStatuses().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_statuses", + request.getSubscriptionStatuses().get(), + true); + } + if (request.getSubscriptionTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "subscription_types", + request.getSubscriptionTypes().get(), + true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -949,74 +1057,6 @@ public BaseSchematicHttpResponse lookupCompany( } } - public BaseSchematicHttpResponse getActiveDeals(GetActiveDealsRequest request) { - return getActiveDeals(request, null); - } - - public BaseSchematicHttpResponse getActiveDeals( - GetActiveDealsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("company-crm-deals"); - QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); - QueryStringMapper.addQueryParameter(httpUrl, "deal_stage", request.getDealStage(), 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); - } - 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(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetActiveDealsResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - public BaseSchematicHttpResponse listCompanyMemberships() { return listCompanyMemberships(ListCompanyMembershipsRequest.builder().build()); } @@ -1579,6 +1619,10 @@ public BaseSchematicHttpResponse listEntityT if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getTraitTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "trait_types", request.getTraitTypes().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1866,6 +1910,10 @@ public BaseSchematicHttpResponse countEntit if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (request.getTraitTypes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "trait_types", request.getTraitTypes().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java index 9a28b84..d220291 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java @@ -12,7 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.companies.types.CountCompaniesForAdvancedFilterRequestSortOrderDirection; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -31,9 +33,9 @@ public final class CountCompaniesForAdvancedFilterRequest { private final Optional> creditTypeIds; - private final Optional> subscriptionStatuses; + private final Optional> subscriptionStatuses; - private final Optional> subscriptionTypes; + private final Optional> subscriptionTypes; private final Optional> displayProperties; @@ -47,7 +49,7 @@ public final class CountCompaniesForAdvancedFilterRequest { private final Optional sortOrderColumn; - private final Optional sortOrderDirection; + private final Optional sortOrderDirection; private final Optional limit; @@ -60,15 +62,15 @@ private CountCompaniesForAdvancedFilterRequest( Optional> planIds, Optional> featureIds, Optional> creditTypeIds, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, Optional> displayProperties, Optional monetizedSubscriptions, Optional q, Optional withoutPlan, Optional withoutSubscription, Optional sortOrderColumn, - Optional sortOrderDirection, + Optional sortOrderDirection, Optional limit, Optional offset, Map additionalProperties) { @@ -126,7 +128,7 @@ public Optional> getCreditTypeIds() { * @return Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) */ @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { + public Optional> getSubscriptionStatuses() { return subscriptionStatuses; } @@ -134,7 +136,7 @@ public Optional> getSubscriptionStatuses() { * @return Filter companies by one or more subscription types (paid, free, trial) */ @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { + public Optional> getSubscriptionTypes() { return subscriptionTypes; } @@ -190,7 +192,7 @@ public Optional getSortOrderColumn() { * @return Direction to sort by (asc or desc) */ @JsonProperty("sort_order_direction") - public Optional getSortOrderDirection() { + public Optional getSortOrderDirection() { return sortOrderDirection; } @@ -279,9 +281,9 @@ public static final class Builder { private Optional> creditTypeIds = Optional.empty(); - private Optional> subscriptionStatuses = Optional.empty(); + private Optional> subscriptionStatuses = Optional.empty(); - private Optional> subscriptionTypes = Optional.empty(); + private Optional> subscriptionTypes = Optional.empty(); private Optional> displayProperties = Optional.empty(); @@ -295,8 +297,7 @@ public static final class Builder { private Optional sortOrderColumn = Optional.empty(); - private Optional sortOrderDirection = - Optional.empty(); + private Optional sortOrderDirection = Optional.empty(); private Optional limit = Optional.empty(); @@ -406,17 +407,17 @@ public Builder creditTypeIds(String creditTypeIds) { *

Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

*/ @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) - public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { this.subscriptionStatuses = subscriptionStatuses; return this; } - public Builder subscriptionStatuses(List subscriptionStatuses) { + public Builder subscriptionStatuses(List subscriptionStatuses) { this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); return this; } - public Builder subscriptionStatuses(String subscriptionStatuses) { + public Builder subscriptionStatuses(SubscriptionStatus subscriptionStatuses) { this.subscriptionStatuses = Optional.of(Collections.singletonList(subscriptionStatuses)); return this; } @@ -425,17 +426,17 @@ public Builder subscriptionStatuses(String subscriptionStatuses) { *

Filter companies by one or more subscription types (paid, free, trial)

*/ @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) - public Builder subscriptionTypes(Optional> subscriptionTypes) { + public Builder subscriptionTypes(Optional> subscriptionTypes) { this.subscriptionTypes = subscriptionTypes; return this; } - public Builder subscriptionTypes(List subscriptionTypes) { + public Builder subscriptionTypes(List subscriptionTypes) { this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); return this; } - public Builder subscriptionTypes(String subscriptionTypes) { + public Builder subscriptionTypes(SubscriptionType subscriptionTypes) { this.subscriptionTypes = Optional.of(Collections.singletonList(subscriptionTypes)); return this; } @@ -533,13 +534,12 @@ public Builder sortOrderColumn(String sortOrderColumn) { *

Direction to sort by (asc or desc)

*/ @JsonSetter(value = "sort_order_direction", nulls = Nulls.SKIP) - public Builder sortOrderDirection( - Optional sortOrderDirection) { + public Builder sortOrderDirection(Optional sortOrderDirection) { this.sortOrderDirection = sortOrderDirection; return this; } - public Builder sortOrderDirection(CountCompaniesForAdvancedFilterRequestSortOrderDirection sortOrderDirection) { + public Builder sortOrderDirection(SortDirection sortOrderDirection) { this.sortOrderDirection = Optional.ofNullable(sortOrderDirection); return this; } 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 f0a6d40..454e002 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 @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -22,16 +25,32 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountCompaniesRequest.Builder.class) public final class CountCompaniesRequest { + private final Optional> creditTypeIds; + private final Optional> ids; + private final Optional> planIds; + + private final Optional> subscriptionStatuses; + + private final Optional> subscriptionTypes; + + private final Optional monetizedSubscriptions; + private final Optional planId; private final Optional q; + private final Optional sortOrderColumn; + + private final Optional sortOrderDirection; + private final Optional withoutFeatureOverrideFor; private final Optional withoutPlan; + private final Optional withoutSubscription; + private final Optional withSubscription; private final Optional limit; @@ -41,26 +60,50 @@ public final class CountCompaniesRequest { private final Map additionalProperties; private CountCompaniesRequest( + Optional> creditTypeIds, Optional> ids, + Optional> planIds, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, + Optional monetizedSubscriptions, Optional planId, Optional q, + Optional sortOrderColumn, + Optional sortOrderDirection, Optional withoutFeatureOverrideFor, Optional withoutPlan, + Optional withoutSubscription, Optional withSubscription, Optional limit, Optional offset, Map additionalProperties) { + this.creditTypeIds = creditTypeIds; this.ids = ids; + this.planIds = planIds; + this.subscriptionStatuses = subscriptionStatuses; + this.subscriptionTypes = subscriptionTypes; + this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; this.q = q; + this.sortOrderColumn = sortOrderColumn; + this.sortOrderDirection = sortOrderDirection; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; + this.withoutSubscription = withoutSubscription; this.withSubscription = withSubscription; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } + /** + * @return Filter companies by one or more credit type IDs (each ID starts with bcrd_) + */ + @JsonProperty("credit_type_ids") + public Optional> getCreditTypeIds() { + return creditTypeIds; + } + /** * @return Filter companies by multiple company IDs (starts with comp_) */ @@ -69,6 +112,38 @@ public Optional> getIds() { return ids; } + /** + * @return Filter companies by one or more plan IDs (each ID starts with plan_) + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + /** + * @return Filter companies by one or more subscription statuses + */ + @JsonProperty("subscription_statuses") + public Optional> getSubscriptionStatuses() { + return subscriptionStatuses; + } + + /** + * @return Filter companies by one or more subscription types + */ + @JsonProperty("subscription_types") + public Optional> getSubscriptionTypes() { + return subscriptionTypes; + } + + /** + * @return Filter companies that have monetized subscriptions + */ + @JsonProperty("monetized_subscriptions") + public Optional getMonetizedSubscriptions() { + return monetizedSubscriptions; + } + /** * @return Filter companies by plan ID (starts with plan_) */ @@ -85,6 +160,22 @@ public Optional getQ() { return q; } + /** + * @return Column to sort by (e.g. name, created_at, last_seen_at) + */ + @JsonProperty("sort_order_column") + public Optional getSortOrderColumn() { + return sortOrderColumn; + } + + /** + * @return Direction to sort by (asc or desc) + */ + @JsonProperty("sort_order_direction") + public Optional getSortOrderDirection() { + return sortOrderDirection; + } + /** * @return Filter out companies that already have a company override for the specified feature ID */ @@ -101,6 +192,14 @@ public Optional getWithoutPlan() { return withoutPlan; } + /** + * @return Filter out companies that have a subscription + */ + @JsonProperty("without_subscription") + public Optional getWithoutSubscription() { + return withoutSubscription; + } + /** * @return Filter companies that have a subscription */ @@ -137,11 +236,19 @@ public Map getAdditionalProperties() { } private boolean equalTo(CountCompaniesRequest other) { - return ids.equals(other.ids) + return creditTypeIds.equals(other.creditTypeIds) + && ids.equals(other.ids) + && planIds.equals(other.planIds) + && subscriptionStatuses.equals(other.subscriptionStatuses) + && subscriptionTypes.equals(other.subscriptionTypes) + && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) && q.equals(other.q) + && sortOrderColumn.equals(other.sortOrderColumn) + && sortOrderDirection.equals(other.sortOrderDirection) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) && withoutPlan.equals(other.withoutPlan) + && withoutSubscription.equals(other.withoutSubscription) && withSubscription.equals(other.withSubscription) && limit.equals(other.limit) && offset.equals(other.offset); @@ -150,11 +257,19 @@ private boolean equalTo(CountCompaniesRequest other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.creditTypeIds, this.ids, + this.planIds, + this.subscriptionStatuses, + this.subscriptionTypes, + this.monetizedSubscriptions, this.planId, this.q, + this.sortOrderColumn, + this.sortOrderDirection, this.withoutFeatureOverrideFor, this.withoutPlan, + this.withoutSubscription, this.withSubscription, this.limit, this.offset); @@ -171,16 +286,32 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> creditTypeIds = Optional.empty(); + private Optional> ids = Optional.empty(); + private Optional> planIds = Optional.empty(); + + private Optional> subscriptionStatuses = Optional.empty(); + + private Optional> subscriptionTypes = Optional.empty(); + + private Optional monetizedSubscriptions = Optional.empty(); + private Optional planId = Optional.empty(); private Optional q = Optional.empty(); + private Optional sortOrderColumn = Optional.empty(); + + private Optional sortOrderDirection = Optional.empty(); + private Optional withoutFeatureOverrideFor = Optional.empty(); private Optional withoutPlan = Optional.empty(); + private Optional withoutSubscription = Optional.empty(); + private Optional withSubscription = Optional.empty(); private Optional limit = Optional.empty(); @@ -193,17 +324,44 @@ public static final class Builder { private Builder() {} public Builder from(CountCompaniesRequest other) { + creditTypeIds(other.getCreditTypeIds()); ids(other.getIds()); + planIds(other.getPlanIds()); + subscriptionStatuses(other.getSubscriptionStatuses()); + subscriptionTypes(other.getSubscriptionTypes()); + monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); q(other.getQ()); + sortOrderColumn(other.getSortOrderColumn()); + sortOrderDirection(other.getSortOrderDirection()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); + withoutSubscription(other.getWithoutSubscription()); withSubscription(other.getWithSubscription()); limit(other.getLimit()); offset(other.getOffset()); return this; } + /** + *

Filter companies by one or more credit type IDs (each ID starts with bcrd_)

+ */ + @JsonSetter(value = "credit_type_ids", nulls = Nulls.SKIP) + public Builder creditTypeIds(Optional> creditTypeIds) { + this.creditTypeIds = creditTypeIds; + return this; + } + + public Builder creditTypeIds(List creditTypeIds) { + this.creditTypeIds = Optional.ofNullable(creditTypeIds); + return this; + } + + public Builder creditTypeIds(String creditTypeIds) { + this.creditTypeIds = Optional.of(Collections.singletonList(creditTypeIds)); + return this; + } + /** *

Filter companies by multiple company IDs (starts with comp_)

*/ @@ -223,6 +381,77 @@ public Builder ids(String ids) { return this; } + /** + *

Filter companies by one or more plan IDs (each ID starts with plan_)

+ */ + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + public Builder planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + public Builder planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); + return this; + } + + /** + *

Filter companies by one or more subscription statuses

+ */ + @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + this.subscriptionStatuses = subscriptionStatuses; + return this; + } + + public Builder subscriptionStatuses(List subscriptionStatuses) { + this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); + return this; + } + + public Builder subscriptionStatuses(SubscriptionStatus subscriptionStatuses) { + this.subscriptionStatuses = Optional.of(Collections.singletonList(subscriptionStatuses)); + return this; + } + + /** + *

Filter companies by one or more subscription types

+ */ + @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) + public Builder subscriptionTypes(Optional> subscriptionTypes) { + this.subscriptionTypes = subscriptionTypes; + return this; + } + + public Builder subscriptionTypes(List subscriptionTypes) { + this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); + return this; + } + + public Builder subscriptionTypes(SubscriptionType subscriptionTypes) { + this.subscriptionTypes = Optional.of(Collections.singletonList(subscriptionTypes)); + return this; + } + + /** + *

Filter companies that have monetized subscriptions

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

Filter companies by plan ID (starts with plan_)

*/ @@ -251,6 +480,34 @@ public Builder q(String q) { return this; } + /** + *

Column to sort by (e.g. name, created_at, last_seen_at)

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

Direction to sort by (asc or desc)

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

Filter out companies that already have a company override for the specified feature ID

*/ @@ -279,6 +536,20 @@ public Builder withoutPlan(Boolean withoutPlan) { return this; } + /** + *

Filter out companies that have a subscription

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

Filter companies that have a subscription

*/ @@ -323,11 +594,19 @@ public Builder offset(Integer offset) { public CountCompaniesRequest build() { return new CountCompaniesRequest( + creditTypeIds, ids, + planIds, + subscriptionStatuses, + subscriptionTypes, + monetizedSubscriptions, planId, q, + sortOrderColumn, + sortOrderDirection, withoutFeatureOverrideFor, withoutPlan, + withoutSubscription, withSubscription, limit, offset, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityKeyDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityKeyDefinitionsRequest.java index f78db03..a72510e 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityKeyDefinitionsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityKeyDefinitionsRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsRequestEntityType; +import com.schematic.api.types.EntityType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -25,7 +25,7 @@ public final class CountEntityKeyDefinitionsRequest { private final Optional> ids; - private final Optional entityType; + private final Optional entityType; private final Optional q; @@ -37,7 +37,7 @@ public final class CountEntityKeyDefinitionsRequest { private CountEntityKeyDefinitionsRequest( Optional> ids, - Optional entityType, + Optional entityType, Optional q, Optional limit, Optional offset, @@ -56,7 +56,7 @@ public Optional> getIds() { } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -118,7 +118,7 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional q = Optional.empty(); @@ -157,12 +157,12 @@ public Builder ids(String ids) { } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(CountEntityKeyDefinitionsRequestEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitDefinitionsRequest.java index 47ee499..4bb341e 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitDefinitionsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitDefinitionsRequest.java @@ -12,8 +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.resources.companies.types.CountEntityTraitDefinitionsRequestEntityType; -import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsRequestTraitType; +import com.schematic.api.types.EntityType; +import com.schematic.api.types.TraitType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -26,11 +26,13 @@ public final class CountEntityTraitDefinitionsRequest { private final Optional> ids; - private final Optional entityType; + private final Optional> traitTypes; + + private final Optional entityType; private final Optional q; - private final Optional traitType; + private final Optional traitType; private final Optional limit; @@ -40,13 +42,15 @@ public final class CountEntityTraitDefinitionsRequest { private CountEntityTraitDefinitionsRequest( Optional> ids, - Optional entityType, + Optional> traitTypes, + Optional entityType, Optional q, - Optional traitType, + Optional traitType, Optional limit, Optional offset, Map additionalProperties) { this.ids = ids; + this.traitTypes = traitTypes; this.entityType = entityType; this.q = q; this.traitType = traitType; @@ -60,8 +64,13 @@ public Optional> getIds() { return ids; } + @JsonProperty("trait_types") + public Optional> getTraitTypes() { + return traitTypes; + } + @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -71,7 +80,7 @@ public Optional getQ() { } @JsonProperty("trait_type") - public Optional getTraitType() { + public Optional getTraitType() { return traitType; } @@ -105,6 +114,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CountEntityTraitDefinitionsRequest other) { return ids.equals(other.ids) + && traitTypes.equals(other.traitTypes) && entityType.equals(other.entityType) && q.equals(other.q) && traitType.equals(other.traitType) @@ -114,7 +124,8 @@ private boolean equalTo(CountEntityTraitDefinitionsRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.ids, this.entityType, this.q, this.traitType, this.limit, this.offset); + return Objects.hash( + this.ids, this.traitTypes, this.entityType, this.q, this.traitType, this.limit, this.offset); } @java.lang.Override @@ -130,11 +141,13 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional entityType = Optional.empty(); + private Optional> traitTypes = Optional.empty(); + + private Optional entityType = Optional.empty(); private Optional q = Optional.empty(); - private Optional traitType = Optional.empty(); + private Optional traitType = Optional.empty(); private Optional limit = Optional.empty(); @@ -147,6 +160,7 @@ private Builder() {} public Builder from(CountEntityTraitDefinitionsRequest other) { ids(other.getIds()); + traitTypes(other.getTraitTypes()); entityType(other.getEntityType()); q(other.getQ()); traitType(other.getTraitType()); @@ -171,13 +185,29 @@ public Builder ids(String ids) { return this; } + @JsonSetter(value = "trait_types", nulls = Nulls.SKIP) + public Builder traitTypes(Optional> traitTypes) { + this.traitTypes = traitTypes; + return this; + } + + public Builder traitTypes(List traitTypes) { + this.traitTypes = Optional.ofNullable(traitTypes); + return this; + } + + public Builder traitTypes(TraitType traitTypes) { + this.traitTypes = Optional.of(Collections.singletonList(traitTypes)); + return this; + } + @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(CountEntityTraitDefinitionsRequestEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } @@ -194,12 +224,12 @@ public Builder q(String q) { } @JsonSetter(value = "trait_type", nulls = Nulls.SKIP) - public Builder traitType(Optional traitType) { + public Builder traitType(Optional traitType) { this.traitType = traitType; return this; } - public Builder traitType(CountEntityTraitDefinitionsRequestTraitType traitType) { + public Builder traitType(TraitType traitType) { this.traitType = Optional.ofNullable(traitType); return this; } @@ -234,7 +264,7 @@ public Builder offset(Integer offset) { public CountEntityTraitDefinitionsRequest build() { return new CountEntityTraitDefinitionsRequest( - ids, entityType, q, traitType, limit, offset, additionalProperties); + ids, traitTypes, entityType, q, traitType, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CreateEntityTraitDefinitionRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/CreateEntityTraitDefinitionRequestBody.java index a87979d..6a66256 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CreateEntityTraitDefinitionRequestBody.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CreateEntityTraitDefinitionRequestBody.java @@ -12,8 +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.resources.companies.types.CreateEntityTraitDefinitionRequestBodyEntityType; -import com.schematic.api.resources.companies.types.CreateEntityTraitDefinitionRequestBodyTraitType; +import com.schematic.api.types.EntityType; +import com.schematic.api.types.TraitType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -27,19 +27,19 @@ public final class CreateEntityTraitDefinitionRequestBody { private final Optional displayName; - private final CreateEntityTraitDefinitionRequestBodyEntityType entityType; + private final EntityType entityType; private final List hierarchy; - private final CreateEntityTraitDefinitionRequestBodyTraitType traitType; + private final TraitType traitType; private final Map additionalProperties; private CreateEntityTraitDefinitionRequestBody( Optional displayName, - CreateEntityTraitDefinitionRequestBodyEntityType entityType, + EntityType entityType, List hierarchy, - CreateEntityTraitDefinitionRequestBodyTraitType traitType, + TraitType traitType, Map additionalProperties) { this.displayName = displayName; this.entityType = entityType; @@ -54,7 +54,7 @@ public Optional getDisplayName() { } @JsonProperty("entity_type") - public CreateEntityTraitDefinitionRequestBodyEntityType getEntityType() { + public EntityType getEntityType() { return entityType; } @@ -64,7 +64,7 @@ public List getHierarchy() { } @JsonProperty("trait_type") - public CreateEntityTraitDefinitionRequestBodyTraitType getTraitType() { + public TraitType getTraitType() { return traitType; } @@ -102,13 +102,13 @@ public static EntityTypeStage builder() { } public interface EntityTypeStage { - TraitTypeStage entityType(@NotNull CreateEntityTraitDefinitionRequestBodyEntityType entityType); + TraitTypeStage entityType(@NotNull EntityType entityType); Builder from(CreateEntityTraitDefinitionRequestBody other); } public interface TraitTypeStage { - _FinalStage traitType(@NotNull CreateEntityTraitDefinitionRequestBodyTraitType traitType); + _FinalStage traitType(@NotNull TraitType traitType); } public interface _FinalStage { @@ -127,9 +127,9 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements EntityTypeStage, TraitTypeStage, _FinalStage { - private CreateEntityTraitDefinitionRequestBodyEntityType entityType; + private EntityType entityType; - private CreateEntityTraitDefinitionRequestBodyTraitType traitType; + private TraitType traitType; private List hierarchy = new ArrayList<>(); @@ -151,14 +151,14 @@ public Builder from(CreateEntityTraitDefinitionRequestBody other) { @java.lang.Override @JsonSetter("entity_type") - public TraitTypeStage entityType(@NotNull CreateEntityTraitDefinitionRequestBodyEntityType entityType) { + public TraitTypeStage entityType(@NotNull EntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } @java.lang.Override @JsonSetter("trait_type") - public _FinalStage traitType(@NotNull CreateEntityTraitDefinitionRequestBodyTraitType traitType) { + public _FinalStage traitType(@NotNull TraitType traitType) { this.traitType = Objects.requireNonNull(traitType, "traitType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java new file mode 100644 index 0000000..a56caf1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteCompanyRequest.Builder.class) +public final class DeleteCompanyRequest { + private final Optional cancelSubscription; + + private final Optional prorate; + + private final Map additionalProperties; + + private DeleteCompanyRequest( + Optional cancelSubscription, Optional prorate, Map additionalProperties) { + this.cancelSubscription = cancelSubscription; + this.prorate = prorate; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("cancel_subscription") + public Optional getCancelSubscription() { + return cancelSubscription; + } + + @JsonProperty("prorate") + public Optional getProrate() { + return prorate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCompanyRequest && equalTo((DeleteCompanyRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteCompanyRequest other) { + return cancelSubscription.equals(other.cancelSubscription) && prorate.equals(other.prorate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cancelSubscription, this.prorate); + } + + @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 cancelSubscription = Optional.empty(); + + private Optional prorate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteCompanyRequest other) { + cancelSubscription(other.getCancelSubscription()); + prorate(other.getProrate()); + return this; + } + + @JsonSetter(value = "cancel_subscription", nulls = Nulls.SKIP) + public Builder cancelSubscription(Optional cancelSubscription) { + this.cancelSubscription = cancelSubscription; + return this; + } + + public Builder cancelSubscription(Boolean cancelSubscription) { + this.cancelSubscription = Optional.ofNullable(cancelSubscription); + return this; + } + + @JsonSetter(value = "prorate", nulls = Nulls.SKIP) + public Builder prorate(Optional prorate) { + this.prorate = prorate; + return this; + } + + public Builder prorate(Boolean prorate) { + this.prorate = Optional.ofNullable(prorate); + return this; + } + + public DeleteCompanyRequest build() { + return new DeleteCompanyRequest(cancelSubscription, prorate, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java index 850e2de..3377ecd 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java @@ -12,7 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.companies.types.ListCompaniesForAdvancedFilterRequestSortOrderDirection; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -31,9 +33,9 @@ public final class ListCompaniesForAdvancedFilterRequest { private final Optional> creditTypeIds; - private final Optional> subscriptionStatuses; + private final Optional> subscriptionStatuses; - private final Optional> subscriptionTypes; + private final Optional> subscriptionTypes; private final Optional> displayProperties; @@ -47,7 +49,7 @@ public final class ListCompaniesForAdvancedFilterRequest { private final Optional sortOrderColumn; - private final Optional sortOrderDirection; + private final Optional sortOrderDirection; private final Optional limit; @@ -60,15 +62,15 @@ private ListCompaniesForAdvancedFilterRequest( Optional> planIds, Optional> featureIds, Optional> creditTypeIds, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, Optional> displayProperties, Optional monetizedSubscriptions, Optional q, Optional withoutPlan, Optional withoutSubscription, Optional sortOrderColumn, - Optional sortOrderDirection, + Optional sortOrderDirection, Optional limit, Optional offset, Map additionalProperties) { @@ -126,7 +128,7 @@ public Optional> getCreditTypeIds() { * @return Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) */ @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { + public Optional> getSubscriptionStatuses() { return subscriptionStatuses; } @@ -134,7 +136,7 @@ public Optional> getSubscriptionStatuses() { * @return Filter companies by one or more subscription types (paid, free, trial) */ @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { + public Optional> getSubscriptionTypes() { return subscriptionTypes; } @@ -190,7 +192,7 @@ public Optional getSortOrderColumn() { * @return Direction to sort by (asc or desc) */ @JsonProperty("sort_order_direction") - public Optional getSortOrderDirection() { + public Optional getSortOrderDirection() { return sortOrderDirection; } @@ -279,9 +281,9 @@ public static final class Builder { private Optional> creditTypeIds = Optional.empty(); - private Optional> subscriptionStatuses = Optional.empty(); + private Optional> subscriptionStatuses = Optional.empty(); - private Optional> subscriptionTypes = Optional.empty(); + private Optional> subscriptionTypes = Optional.empty(); private Optional> displayProperties = Optional.empty(); @@ -295,7 +297,7 @@ public static final class Builder { private Optional sortOrderColumn = Optional.empty(); - private Optional sortOrderDirection = Optional.empty(); + private Optional sortOrderDirection = Optional.empty(); private Optional limit = Optional.empty(); @@ -405,17 +407,17 @@ public Builder creditTypeIds(String creditTypeIds) { *

Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

*/ @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) - public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { this.subscriptionStatuses = subscriptionStatuses; return this; } - public Builder subscriptionStatuses(List subscriptionStatuses) { + public Builder subscriptionStatuses(List subscriptionStatuses) { this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); return this; } - public Builder subscriptionStatuses(String subscriptionStatuses) { + public Builder subscriptionStatuses(SubscriptionStatus subscriptionStatuses) { this.subscriptionStatuses = Optional.of(Collections.singletonList(subscriptionStatuses)); return this; } @@ -424,17 +426,17 @@ public Builder subscriptionStatuses(String subscriptionStatuses) { *

Filter companies by one or more subscription types (paid, free, trial)

*/ @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) - public Builder subscriptionTypes(Optional> subscriptionTypes) { + public Builder subscriptionTypes(Optional> subscriptionTypes) { this.subscriptionTypes = subscriptionTypes; return this; } - public Builder subscriptionTypes(List subscriptionTypes) { + public Builder subscriptionTypes(List subscriptionTypes) { this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); return this; } - public Builder subscriptionTypes(String subscriptionTypes) { + public Builder subscriptionTypes(SubscriptionType subscriptionTypes) { this.subscriptionTypes = Optional.of(Collections.singletonList(subscriptionTypes)); return this; } @@ -532,13 +534,12 @@ public Builder sortOrderColumn(String sortOrderColumn) { *

Direction to sort by (asc or desc)

*/ @JsonSetter(value = "sort_order_direction", nulls = Nulls.SKIP) - public Builder sortOrderDirection( - Optional sortOrderDirection) { + public Builder sortOrderDirection(Optional sortOrderDirection) { this.sortOrderDirection = sortOrderDirection; return this; } - public Builder sortOrderDirection(ListCompaniesForAdvancedFilterRequestSortOrderDirection sortOrderDirection) { + public Builder sortOrderDirection(SortDirection sortOrderDirection) { this.sortOrderDirection = Optional.ofNullable(sortOrderDirection); return this; } 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 6e72f6a..a2253c1 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 @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -22,16 +25,32 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListCompaniesRequest.Builder.class) public final class ListCompaniesRequest { + private final Optional> creditTypeIds; + private final Optional> ids; + private final Optional> planIds; + + private final Optional> subscriptionStatuses; + + private final Optional> subscriptionTypes; + + private final Optional monetizedSubscriptions; + private final Optional planId; private final Optional q; + private final Optional sortOrderColumn; + + private final Optional sortOrderDirection; + private final Optional withoutFeatureOverrideFor; private final Optional withoutPlan; + private final Optional withoutSubscription; + private final Optional withSubscription; private final Optional limit; @@ -41,26 +60,50 @@ public final class ListCompaniesRequest { private final Map additionalProperties; private ListCompaniesRequest( + Optional> creditTypeIds, Optional> ids, + Optional> planIds, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, + Optional monetizedSubscriptions, Optional planId, Optional q, + Optional sortOrderColumn, + Optional sortOrderDirection, Optional withoutFeatureOverrideFor, Optional withoutPlan, + Optional withoutSubscription, Optional withSubscription, Optional limit, Optional offset, Map additionalProperties) { + this.creditTypeIds = creditTypeIds; this.ids = ids; + this.planIds = planIds; + this.subscriptionStatuses = subscriptionStatuses; + this.subscriptionTypes = subscriptionTypes; + this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; this.q = q; + this.sortOrderColumn = sortOrderColumn; + this.sortOrderDirection = sortOrderDirection; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; + this.withoutSubscription = withoutSubscription; this.withSubscription = withSubscription; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } + /** + * @return Filter companies by one or more credit type IDs (each ID starts with bcrd_) + */ + @JsonProperty("credit_type_ids") + public Optional> getCreditTypeIds() { + return creditTypeIds; + } + /** * @return Filter companies by multiple company IDs (starts with comp_) */ @@ -69,6 +112,38 @@ public Optional> getIds() { return ids; } + /** + * @return Filter companies by one or more plan IDs (each ID starts with plan_) + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + + /** + * @return Filter companies by one or more subscription statuses + */ + @JsonProperty("subscription_statuses") + public Optional> getSubscriptionStatuses() { + return subscriptionStatuses; + } + + /** + * @return Filter companies by one or more subscription types + */ + @JsonProperty("subscription_types") + public Optional> getSubscriptionTypes() { + return subscriptionTypes; + } + + /** + * @return Filter companies that have monetized subscriptions + */ + @JsonProperty("monetized_subscriptions") + public Optional getMonetizedSubscriptions() { + return monetizedSubscriptions; + } + /** * @return Filter companies by plan ID (starts with plan_) */ @@ -85,6 +160,22 @@ public Optional getQ() { return q; } + /** + * @return Column to sort by (e.g. name, created_at, last_seen_at) + */ + @JsonProperty("sort_order_column") + public Optional getSortOrderColumn() { + return sortOrderColumn; + } + + /** + * @return Direction to sort by (asc or desc) + */ + @JsonProperty("sort_order_direction") + public Optional getSortOrderDirection() { + return sortOrderDirection; + } + /** * @return Filter out companies that already have a company override for the specified feature ID */ @@ -101,6 +192,14 @@ public Optional getWithoutPlan() { return withoutPlan; } + /** + * @return Filter out companies that have a subscription + */ + @JsonProperty("without_subscription") + public Optional getWithoutSubscription() { + return withoutSubscription; + } + /** * @return Filter companies that have a subscription */ @@ -137,11 +236,19 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListCompaniesRequest other) { - return ids.equals(other.ids) + return creditTypeIds.equals(other.creditTypeIds) + && ids.equals(other.ids) + && planIds.equals(other.planIds) + && subscriptionStatuses.equals(other.subscriptionStatuses) + && subscriptionTypes.equals(other.subscriptionTypes) + && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) && q.equals(other.q) + && sortOrderColumn.equals(other.sortOrderColumn) + && sortOrderDirection.equals(other.sortOrderDirection) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) && withoutPlan.equals(other.withoutPlan) + && withoutSubscription.equals(other.withoutSubscription) && withSubscription.equals(other.withSubscription) && limit.equals(other.limit) && offset.equals(other.offset); @@ -150,11 +257,19 @@ private boolean equalTo(ListCompaniesRequest other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.creditTypeIds, this.ids, + this.planIds, + this.subscriptionStatuses, + this.subscriptionTypes, + this.monetizedSubscriptions, this.planId, this.q, + this.sortOrderColumn, + this.sortOrderDirection, this.withoutFeatureOverrideFor, this.withoutPlan, + this.withoutSubscription, this.withSubscription, this.limit, this.offset); @@ -171,16 +286,32 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> creditTypeIds = Optional.empty(); + private Optional> ids = Optional.empty(); + private Optional> planIds = Optional.empty(); + + private Optional> subscriptionStatuses = Optional.empty(); + + private Optional> subscriptionTypes = Optional.empty(); + + private Optional monetizedSubscriptions = Optional.empty(); + private Optional planId = Optional.empty(); private Optional q = Optional.empty(); + private Optional sortOrderColumn = Optional.empty(); + + private Optional sortOrderDirection = Optional.empty(); + private Optional withoutFeatureOverrideFor = Optional.empty(); private Optional withoutPlan = Optional.empty(); + private Optional withoutSubscription = Optional.empty(); + private Optional withSubscription = Optional.empty(); private Optional limit = Optional.empty(); @@ -193,17 +324,44 @@ public static final class Builder { private Builder() {} public Builder from(ListCompaniesRequest other) { + creditTypeIds(other.getCreditTypeIds()); ids(other.getIds()); + planIds(other.getPlanIds()); + subscriptionStatuses(other.getSubscriptionStatuses()); + subscriptionTypes(other.getSubscriptionTypes()); + monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); q(other.getQ()); + sortOrderColumn(other.getSortOrderColumn()); + sortOrderDirection(other.getSortOrderDirection()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); + withoutSubscription(other.getWithoutSubscription()); withSubscription(other.getWithSubscription()); limit(other.getLimit()); offset(other.getOffset()); return this; } + /** + *

Filter companies by one or more credit type IDs (each ID starts with bcrd_)

+ */ + @JsonSetter(value = "credit_type_ids", nulls = Nulls.SKIP) + public Builder creditTypeIds(Optional> creditTypeIds) { + this.creditTypeIds = creditTypeIds; + return this; + } + + public Builder creditTypeIds(List creditTypeIds) { + this.creditTypeIds = Optional.ofNullable(creditTypeIds); + return this; + } + + public Builder creditTypeIds(String creditTypeIds) { + this.creditTypeIds = Optional.of(Collections.singletonList(creditTypeIds)); + return this; + } + /** *

Filter companies by multiple company IDs (starts with comp_)

*/ @@ -223,6 +381,77 @@ public Builder ids(String ids) { return this; } + /** + *

Filter companies by one or more plan IDs (each ID starts with plan_)

+ */ + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(Optional> planIds) { + this.planIds = planIds; + return this; + } + + public Builder planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); + return this; + } + + public Builder planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); + return this; + } + + /** + *

Filter companies by one or more subscription statuses

+ */ + @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + this.subscriptionStatuses = subscriptionStatuses; + return this; + } + + public Builder subscriptionStatuses(List subscriptionStatuses) { + this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); + return this; + } + + public Builder subscriptionStatuses(SubscriptionStatus subscriptionStatuses) { + this.subscriptionStatuses = Optional.of(Collections.singletonList(subscriptionStatuses)); + return this; + } + + /** + *

Filter companies by one or more subscription types

+ */ + @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) + public Builder subscriptionTypes(Optional> subscriptionTypes) { + this.subscriptionTypes = subscriptionTypes; + return this; + } + + public Builder subscriptionTypes(List subscriptionTypes) { + this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); + return this; + } + + public Builder subscriptionTypes(SubscriptionType subscriptionTypes) { + this.subscriptionTypes = Optional.of(Collections.singletonList(subscriptionTypes)); + return this; + } + + /** + *

Filter companies that have monetized subscriptions

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

Filter companies by plan ID (starts with plan_)

*/ @@ -251,6 +480,34 @@ public Builder q(String q) { return this; } + /** + *

Column to sort by (e.g. name, created_at, last_seen_at)

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

Direction to sort by (asc or desc)

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

Filter out companies that already have a company override for the specified feature ID

*/ @@ -279,6 +536,20 @@ public Builder withoutPlan(Boolean withoutPlan) { return this; } + /** + *

Filter out companies that have a subscription

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

Filter companies that have a subscription

*/ @@ -323,11 +594,19 @@ public Builder offset(Integer offset) { public ListCompaniesRequest build() { return new ListCompaniesRequest( + creditTypeIds, ids, + planIds, + subscriptionStatuses, + subscriptionTypes, + monetizedSubscriptions, planId, q, + sortOrderColumn, + sortOrderDirection, withoutFeatureOverrideFor, withoutPlan, + withoutSubscription, withSubscription, limit, offset, diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListEntityKeyDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListEntityKeyDefinitionsRequest.java index c013408..e3f3ff5 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListEntityKeyDefinitionsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListEntityKeyDefinitionsRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.companies.types.ListEntityKeyDefinitionsRequestEntityType; +import com.schematic.api.types.EntityType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -25,7 +25,7 @@ public final class ListEntityKeyDefinitionsRequest { private final Optional> ids; - private final Optional entityType; + private final Optional entityType; private final Optional q; @@ -37,7 +37,7 @@ public final class ListEntityKeyDefinitionsRequest { private ListEntityKeyDefinitionsRequest( Optional> ids, - Optional entityType, + Optional entityType, Optional q, Optional limit, Optional offset, @@ -56,7 +56,7 @@ public Optional> getIds() { } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -118,7 +118,7 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional q = Optional.empty(); @@ -157,12 +157,12 @@ public Builder ids(String ids) { } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(ListEntityKeyDefinitionsRequestEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListEntityTraitDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListEntityTraitDefinitionsRequest.java index 4e7c088..160940a 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListEntityTraitDefinitionsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListEntityTraitDefinitionsRequest.java @@ -12,8 +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.resources.companies.types.ListEntityTraitDefinitionsRequestEntityType; -import com.schematic.api.resources.companies.types.ListEntityTraitDefinitionsRequestTraitType; +import com.schematic.api.types.EntityType; +import com.schematic.api.types.TraitType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -26,11 +26,13 @@ public final class ListEntityTraitDefinitionsRequest { private final Optional> ids; - private final Optional entityType; + private final Optional> traitTypes; + + private final Optional entityType; private final Optional q; - private final Optional traitType; + private final Optional traitType; private final Optional limit; @@ -40,13 +42,15 @@ public final class ListEntityTraitDefinitionsRequest { private ListEntityTraitDefinitionsRequest( Optional> ids, - Optional entityType, + Optional> traitTypes, + Optional entityType, Optional q, - Optional traitType, + Optional traitType, Optional limit, Optional offset, Map additionalProperties) { this.ids = ids; + this.traitTypes = traitTypes; this.entityType = entityType; this.q = q; this.traitType = traitType; @@ -60,8 +64,13 @@ public Optional> getIds() { return ids; } + @JsonProperty("trait_types") + public Optional> getTraitTypes() { + return traitTypes; + } + @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -71,7 +80,7 @@ public Optional getQ() { } @JsonProperty("trait_type") - public Optional getTraitType() { + public Optional getTraitType() { return traitType; } @@ -104,6 +113,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ListEntityTraitDefinitionsRequest other) { return ids.equals(other.ids) + && traitTypes.equals(other.traitTypes) && entityType.equals(other.entityType) && q.equals(other.q) && traitType.equals(other.traitType) @@ -113,7 +123,8 @@ private boolean equalTo(ListEntityTraitDefinitionsRequest other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.ids, this.entityType, this.q, this.traitType, this.limit, this.offset); + return Objects.hash( + this.ids, this.traitTypes, this.entityType, this.q, this.traitType, this.limit, this.offset); } @java.lang.Override @@ -129,11 +140,13 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional entityType = Optional.empty(); + private Optional> traitTypes = Optional.empty(); + + private Optional entityType = Optional.empty(); private Optional q = Optional.empty(); - private Optional traitType = Optional.empty(); + private Optional traitType = Optional.empty(); private Optional limit = Optional.empty(); @@ -146,6 +159,7 @@ private Builder() {} public Builder from(ListEntityTraitDefinitionsRequest other) { ids(other.getIds()); + traitTypes(other.getTraitTypes()); entityType(other.getEntityType()); q(other.getQ()); traitType(other.getTraitType()); @@ -170,13 +184,29 @@ public Builder ids(String ids) { return this; } + @JsonSetter(value = "trait_types", nulls = Nulls.SKIP) + public Builder traitTypes(Optional> traitTypes) { + this.traitTypes = traitTypes; + return this; + } + + public Builder traitTypes(List traitTypes) { + this.traitTypes = Optional.ofNullable(traitTypes); + return this; + } + + public Builder traitTypes(TraitType traitTypes) { + this.traitTypes = Optional.of(Collections.singletonList(traitTypes)); + return this; + } + @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(ListEntityTraitDefinitionsRequestEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } @@ -193,12 +223,12 @@ public Builder q(String q) { } @JsonSetter(value = "trait_type", nulls = Nulls.SKIP) - public Builder traitType(Optional traitType) { + public Builder traitType(Optional traitType) { this.traitType = traitType; return this; } - public Builder traitType(ListEntityTraitDefinitionsRequestTraitType traitType) { + public Builder traitType(TraitType traitType) { this.traitType = Optional.ofNullable(traitType); return this; } @@ -233,7 +263,7 @@ public Builder offset(Integer offset) { public ListEntityTraitDefinitionsRequest build() { return new ListEntityTraitDefinitionsRequest( - ids, entityType, q, traitType, limit, offset, additionalProperties); + ids, traitTypes, entityType, q, traitType, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/UpdateEntityTraitDefinitionRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/UpdateEntityTraitDefinitionRequestBody.java index 04e396c..ec8e910 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/UpdateEntityTraitDefinitionRequestBody.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/UpdateEntityTraitDefinitionRequestBody.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.companies.types.UpdateEntityTraitDefinitionRequestBodyTraitType; +import com.schematic.api.types.TraitType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -24,14 +24,12 @@ public final class UpdateEntityTraitDefinitionRequestBody { private final Optional displayName; - private final UpdateEntityTraitDefinitionRequestBodyTraitType traitType; + private final TraitType traitType; private final Map additionalProperties; private UpdateEntityTraitDefinitionRequestBody( - Optional displayName, - UpdateEntityTraitDefinitionRequestBodyTraitType traitType, - Map additionalProperties) { + Optional displayName, TraitType traitType, Map additionalProperties) { this.displayName = displayName; this.traitType = traitType; this.additionalProperties = additionalProperties; @@ -43,7 +41,7 @@ public Optional getDisplayName() { } @JsonProperty("trait_type") - public UpdateEntityTraitDefinitionRequestBodyTraitType getTraitType() { + public TraitType getTraitType() { return traitType; } @@ -78,7 +76,7 @@ public static TraitTypeStage builder() { } public interface TraitTypeStage { - _FinalStage traitType(@NotNull UpdateEntityTraitDefinitionRequestBodyTraitType traitType); + _FinalStage traitType(@NotNull TraitType traitType); Builder from(UpdateEntityTraitDefinitionRequestBody other); } @@ -93,7 +91,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements TraitTypeStage, _FinalStage { - private UpdateEntityTraitDefinitionRequestBodyTraitType traitType; + private TraitType traitType; private Optional displayName = Optional.empty(); @@ -111,7 +109,7 @@ public Builder from(UpdateEntityTraitDefinitionRequestBody other) { @java.lang.Override @JsonSetter("trait_type") - public _FinalStage traitType(@NotNull UpdateEntityTraitDefinitionRequestBodyTraitType traitType) { + public _FinalStage traitType(@NotNull TraitType traitType) { this.traitType = Objects.requireNonNull(traitType, "traitType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitBulkRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitBulkRequestBody.java index 9a61f69..93f027d 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitBulkRequestBody.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitBulkRequestBody.java @@ -23,6 +23,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpdatePlanTraitBulkRequestBody.Builder.class) public final class UpdatePlanTraitBulkRequestBody { + private final boolean applyToExistingCompanies; + private final String planId; private final List traits; @@ -30,12 +32,21 @@ public final class UpdatePlanTraitBulkRequestBody { private final Map additionalProperties; private UpdatePlanTraitBulkRequestBody( - String planId, List traits, Map additionalProperties) { + boolean applyToExistingCompanies, + String planId, + List traits, + Map additionalProperties) { + this.applyToExistingCompanies = applyToExistingCompanies; this.planId = planId; this.traits = traits; this.additionalProperties = additionalProperties; } + @JsonProperty("apply_to_existing_companies") + public boolean getApplyToExistingCompanies() { + return applyToExistingCompanies; + } + @JsonProperty("plan_id") public String getPlanId() { return planId; @@ -58,12 +69,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(UpdatePlanTraitBulkRequestBody other) { - return planId.equals(other.planId) && traits.equals(other.traits); + return applyToExistingCompanies == other.applyToExistingCompanies + && planId.equals(other.planId) + && traits.equals(other.traits); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planId, this.traits); + return Objects.hash(this.applyToExistingCompanies, this.planId, this.traits); } @java.lang.Override @@ -71,16 +84,20 @@ public String toString() { return ObjectMappers.stringify(this); } - public static PlanIdStage builder() { + public static ApplyToExistingCompaniesStage builder() { return new Builder(); } - public interface PlanIdStage { - _FinalStage planId(@NotNull String planId); + public interface ApplyToExistingCompaniesStage { + PlanIdStage applyToExistingCompanies(boolean applyToExistingCompanies); Builder from(UpdatePlanTraitBulkRequestBody other); } + public interface PlanIdStage { + _FinalStage planId(@NotNull String planId); + } + public interface _FinalStage { UpdatePlanTraitBulkRequestBody build(); @@ -92,7 +109,9 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PlanIdStage, _FinalStage { + public static final class Builder implements ApplyToExistingCompaniesStage, PlanIdStage, _FinalStage { + private boolean applyToExistingCompanies; + private String planId; private List traits = new ArrayList<>(); @@ -104,11 +123,19 @@ private Builder() {} @java.lang.Override public Builder from(UpdatePlanTraitBulkRequestBody other) { + applyToExistingCompanies(other.getApplyToExistingCompanies()); planId(other.getPlanId()); traits(other.getTraits()); return this; } + @java.lang.Override + @JsonSetter("apply_to_existing_companies") + public PlanIdStage applyToExistingCompanies(boolean applyToExistingCompanies) { + this.applyToExistingCompanies = applyToExistingCompanies; + return this; + } + @java.lang.Override @JsonSetter("plan_id") public _FinalStage planId(@NotNull String planId) { @@ -142,7 +169,7 @@ public _FinalStage traits(List traits) { @java.lang.Override public UpdatePlanTraitBulkRequestBody build() { - return new UpdatePlanTraitBulkRequestBody(planId, traits, additionalProperties); + return new UpdatePlanTraitBulkRequestBody(applyToExistingCompanies, planId, traits, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java index 6cc2f53..c08ad69 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,11 +44,11 @@ public final class CountCompaniesForAdvancedFilterParams { private final Optional sortOrderColumn; - private final Optional sortOrderDirection; + private final Optional sortOrderDirection; - private final Optional> subscriptionStatuses; + private final Optional> subscriptionStatuses; - private final Optional> subscriptionTypes; + private final Optional> subscriptionTypes; private final Optional withoutPlan; @@ -64,9 +67,9 @@ private CountCompaniesForAdvancedFilterParams( Optional> planIds, Optional q, Optional sortOrderColumn, - Optional sortOrderDirection, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, + Optional sortOrderDirection, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, Optional withoutPlan, Optional withoutSubscription, Map additionalProperties) { @@ -168,11 +171,8 @@ public Optional getSortOrderColumn() { return sortOrderColumn; } - /** - * @return Direction to sort by (asc or desc) - */ @JsonProperty("sort_order_direction") - public Optional getSortOrderDirection() { + public Optional getSortOrderDirection() { return sortOrderDirection; } @@ -180,7 +180,7 @@ public Optional * @return Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) */ @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { + public Optional> getSubscriptionStatuses() { return subscriptionStatuses; } @@ -188,7 +188,7 @@ public Optional> getSubscriptionStatuses() { * @return Filter companies by one or more subscription types (paid, free, trial) */ @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { + public Optional> getSubscriptionTypes() { return subscriptionTypes; } @@ -289,12 +289,11 @@ public static final class Builder { private Optional sortOrderColumn = Optional.empty(); - private Optional sortOrderDirection = - Optional.empty(); + private Optional sortOrderDirection = Optional.empty(); - private Optional> subscriptionStatuses = Optional.empty(); + private Optional> subscriptionStatuses = Optional.empty(); - private Optional> subscriptionTypes = Optional.empty(); + private Optional> subscriptionTypes = Optional.empty(); private Optional withoutPlan = Optional.empty(); @@ -464,18 +463,13 @@ public Builder sortOrderColumn(String sortOrderColumn) { return this; } - /** - *

Direction to sort by (asc or desc)

- */ @JsonSetter(value = "sort_order_direction", nulls = Nulls.SKIP) - public Builder sortOrderDirection( - Optional sortOrderDirection) { + public Builder sortOrderDirection(Optional sortOrderDirection) { this.sortOrderDirection = sortOrderDirection; return this; } - public Builder sortOrderDirection( - CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection sortOrderDirection) { + public Builder sortOrderDirection(SortDirection sortOrderDirection) { this.sortOrderDirection = Optional.ofNullable(sortOrderDirection); return this; } @@ -484,12 +478,12 @@ public Builder sortOrderDirection( *

Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

*/ @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) - public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { this.subscriptionStatuses = subscriptionStatuses; return this; } - public Builder subscriptionStatuses(List subscriptionStatuses) { + public Builder subscriptionStatuses(List subscriptionStatuses) { this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); return this; } @@ -498,12 +492,12 @@ public Builder subscriptionStatuses(List subscriptionStatuses) { *

Filter companies by one or more subscription types (paid, free, trial)

*/ @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) - public Builder subscriptionTypes(Optional> subscriptionTypes) { + public Builder subscriptionTypes(Optional> subscriptionTypes) { this.subscriptionTypes = subscriptionTypes; return this; } - public Builder subscriptionTypes(List subscriptionTypes) { + public Builder subscriptionTypes(List subscriptionTypes) { this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterRequestSortOrderDirection.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterRequestSortOrderDirection.java deleted file mode 100644 index 2e651ff..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterRequestSortOrderDirection.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountCompaniesForAdvancedFilterRequestSortOrderDirection { - public static final CountCompaniesForAdvancedFilterRequestSortOrderDirection ASC = - new CountCompaniesForAdvancedFilterRequestSortOrderDirection(Value.ASC, "asc"); - - public static final CountCompaniesForAdvancedFilterRequestSortOrderDirection DESC = - new CountCompaniesForAdvancedFilterRequestSortOrderDirection(Value.DESC, "desc"); - - private final Value value; - - private final String string; - - CountCompaniesForAdvancedFilterRequestSortOrderDirection(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 CountCompaniesForAdvancedFilterRequestSortOrderDirection - && this.string.equals( - ((CountCompaniesForAdvancedFilterRequestSortOrderDirection) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASC: - return visitor.visitAsc(); - case DESC: - return visitor.visitDesc(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountCompaniesForAdvancedFilterRequestSortOrderDirection valueOf(String value) { - switch (value) { - case "asc": - return ASC; - case "desc": - return DESC; - default: - return new CountCompaniesForAdvancedFilterRequestSortOrderDirection(Value.UNKNOWN, value); - } - } - - public enum Value { - ASC, - - DESC, - - UNKNOWN - } - - public interface Visitor { - T visitAsc(); - - T visitDesc(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection.java deleted file mode 100644 index 4ffea4c..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection { - public static final CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection ASC = - new CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection(Value.ASC, "asc"); - - public static final CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection DESC = - new CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection(Value.DESC, "desc"); - - private final Value value; - - private final String string; - - CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection(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 CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection - && this.string.equals( - ((CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASC: - return visitor.visitAsc(); - case DESC: - return visitor.visitDesc(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection valueOf(String value) { - switch (value) { - case "asc": - return ASC; - case "desc": - return DESC; - default: - return new CountCompaniesForAdvancedFilterResponseParamsSortOrderDirection(Value.UNKNOWN, value); - } - } - - public enum Value { - ASC, - - DESC, - - UNKNOWN - } - - public interface Visitor { - T visitAsc(); - - T visitDesc(); - - T visitUnknown(String unknownType); - } -} 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 f0409cb..977f9bd 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 @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,45 +24,85 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountCompaniesParams.Builder.class) public final class CountCompaniesParams { + private final Optional> creditTypeIds; + private final Optional> ids; private final Optional limit; + private final Optional monetizedSubscriptions; + private final Optional offset; private final Optional planId; + private final Optional> planIds; + private final Optional q; + private final Optional sortOrderColumn; + + private final Optional sortOrderDirection; + + private final Optional> subscriptionStatuses; + + private final Optional> subscriptionTypes; + private final Optional withSubscription; private final Optional withoutFeatureOverrideFor; private final Optional withoutPlan; + private final Optional withoutSubscription; + private final Map additionalProperties; private CountCompaniesParams( + Optional> creditTypeIds, Optional> ids, Optional limit, + Optional monetizedSubscriptions, Optional offset, Optional planId, + Optional> planIds, Optional q, + Optional sortOrderColumn, + Optional sortOrderDirection, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, Optional withSubscription, Optional withoutFeatureOverrideFor, Optional withoutPlan, + Optional withoutSubscription, Map additionalProperties) { + this.creditTypeIds = creditTypeIds; this.ids = ids; this.limit = limit; + this.monetizedSubscriptions = monetizedSubscriptions; this.offset = offset; this.planId = planId; + this.planIds = planIds; this.q = q; + this.sortOrderColumn = sortOrderColumn; + this.sortOrderDirection = sortOrderDirection; + this.subscriptionStatuses = subscriptionStatuses; + this.subscriptionTypes = subscriptionTypes; this.withSubscription = withSubscription; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; + this.withoutSubscription = withoutSubscription; this.additionalProperties = additionalProperties; } + /** + * @return Filter companies by one or more credit type IDs (each ID starts with bcrd_) + */ + @JsonProperty("credit_type_ids") + public Optional> getCreditTypeIds() { + return creditTypeIds; + } + /** * @return Filter companies by multiple company IDs (starts with comp_) */ @@ -76,6 +119,14 @@ public Optional getLimit() { return limit; } + /** + * @return Filter companies that have monetized subscriptions + */ + @JsonProperty("monetized_subscriptions") + public Optional getMonetizedSubscriptions() { + return monetizedSubscriptions; + } + /** * @return Page offset (default 0) */ @@ -92,6 +143,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter companies by one or more plan IDs (each ID starts with plan_) + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + /** * @return Search for companies by name, keys or string traits */ @@ -100,6 +159,35 @@ public Optional getQ() { return q; } + /** + * @return Column to sort by (e.g. name, created_at, last_seen_at) + */ + @JsonProperty("sort_order_column") + public Optional getSortOrderColumn() { + return sortOrderColumn; + } + + @JsonProperty("sort_order_direction") + public Optional getSortOrderDirection() { + return sortOrderDirection; + } + + /** + * @return Filter companies by one or more subscription statuses + */ + @JsonProperty("subscription_statuses") + public Optional> getSubscriptionStatuses() { + return subscriptionStatuses; + } + + /** + * @return Filter companies by one or more subscription types + */ + @JsonProperty("subscription_types") + public Optional> getSubscriptionTypes() { + return subscriptionTypes; + } + /** * @return Filter companies that have a subscription */ @@ -124,6 +212,14 @@ public Optional getWithoutPlan() { return withoutPlan; } + /** + * @return Filter out companies that have a subscription + */ + @JsonProperty("without_subscription") + public Optional getWithoutSubscription() { + return withoutSubscription; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -136,27 +232,43 @@ public Map getAdditionalProperties() { } private boolean equalTo(CountCompaniesParams other) { - return ids.equals(other.ids) + return creditTypeIds.equals(other.creditTypeIds) + && ids.equals(other.ids) && limit.equals(other.limit) + && monetizedSubscriptions.equals(other.monetizedSubscriptions) && offset.equals(other.offset) && planId.equals(other.planId) + && planIds.equals(other.planIds) && q.equals(other.q) + && sortOrderColumn.equals(other.sortOrderColumn) + && sortOrderDirection.equals(other.sortOrderDirection) + && subscriptionStatuses.equals(other.subscriptionStatuses) + && subscriptionTypes.equals(other.subscriptionTypes) && withSubscription.equals(other.withSubscription) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) - && withoutPlan.equals(other.withoutPlan); + && withoutPlan.equals(other.withoutPlan) + && withoutSubscription.equals(other.withoutSubscription); } @java.lang.Override public int hashCode() { return Objects.hash( + this.creditTypeIds, this.ids, this.limit, + this.monetizedSubscriptions, this.offset, this.planId, + this.planIds, this.q, + this.sortOrderColumn, + this.sortOrderDirection, + this.subscriptionStatuses, + this.subscriptionTypes, this.withSubscription, this.withoutFeatureOverrideFor, - this.withoutPlan); + this.withoutPlan, + this.withoutSubscription); } @java.lang.Override @@ -170,36 +282,74 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> creditTypeIds = Optional.empty(); + private Optional> ids = Optional.empty(); private Optional limit = Optional.empty(); + private Optional monetizedSubscriptions = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); + private Optional> planIds = Optional.empty(); + private Optional q = Optional.empty(); + private Optional sortOrderColumn = Optional.empty(); + + private Optional sortOrderDirection = Optional.empty(); + + private Optional> subscriptionStatuses = Optional.empty(); + + private Optional> subscriptionTypes = Optional.empty(); + private Optional withSubscription = Optional.empty(); private Optional withoutFeatureOverrideFor = Optional.empty(); private Optional withoutPlan = Optional.empty(); + private Optional withoutSubscription = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} public Builder from(CountCompaniesParams other) { + creditTypeIds(other.getCreditTypeIds()); ids(other.getIds()); limit(other.getLimit()); + monetizedSubscriptions(other.getMonetizedSubscriptions()); offset(other.getOffset()); planId(other.getPlanId()); + planIds(other.getPlanIds()); q(other.getQ()); + sortOrderColumn(other.getSortOrderColumn()); + sortOrderDirection(other.getSortOrderDirection()); + subscriptionStatuses(other.getSubscriptionStatuses()); + subscriptionTypes(other.getSubscriptionTypes()); withSubscription(other.getWithSubscription()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); + withoutSubscription(other.getWithoutSubscription()); + return this; + } + + /** + *

Filter companies by one or more credit type IDs (each ID starts with bcrd_)

+ */ + @JsonSetter(value = "credit_type_ids", nulls = Nulls.SKIP) + public Builder creditTypeIds(Optional> creditTypeIds) { + this.creditTypeIds = creditTypeIds; + return this; + } + + public Builder creditTypeIds(List creditTypeIds) { + this.creditTypeIds = Optional.ofNullable(creditTypeIds); return this; } @@ -231,6 +381,20 @@ public Builder limit(Integer limit) { return this; } + /** + *

Filter companies that have monetized subscriptions

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

Page offset (default 0)

*/ @@ -259,6 +423,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter companies by one or more plan IDs (each ID starts with plan_)

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

Search for companies by name, keys or string traits

*/ @@ -273,6 +451,59 @@ public Builder q(String q) { return this; } + /** + *

Column to sort by (e.g. name, created_at, last_seen_at)

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

Filter companies by one or more subscription statuses

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

Filter companies by one or more subscription types

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

Filter companies that have a subscription

*/ @@ -315,16 +546,38 @@ public Builder withoutPlan(Boolean withoutPlan) { return this; } + /** + *

Filter out companies that have a subscription

+ */ + @JsonSetter(value = "without_subscription", nulls = Nulls.SKIP) + public Builder withoutSubscription(Optional withoutSubscription) { + this.withoutSubscription = withoutSubscription; + return this; + } + + public Builder withoutSubscription(Boolean withoutSubscription) { + this.withoutSubscription = Optional.ofNullable(withoutSubscription); + return this; + } + public CountCompaniesParams build() { return new CountCompaniesParams( + creditTypeIds, ids, limit, + monetizedSubscriptions, offset, planId, + planIds, q, + sortOrderColumn, + sortOrderDirection, + subscriptionStatuses, + subscriptionTypes, withSubscription, withoutFeatureOverrideFor, withoutPlan, + withoutSubscription, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsParams.java index 066e399..a71dbac 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.EntityType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountEntityKeyDefinitionsParams.Builder.class) public final class CountEntityKeyDefinitionsParams { - private final Optional entityType; + private final Optional entityType; private final Optional> ids; @@ -34,7 +35,7 @@ public final class CountEntityKeyDefinitionsParams { private final Map additionalProperties; private CountEntityKeyDefinitionsParams( - Optional entityType, + Optional entityType, Optional> ids, Optional limit, Optional offset, @@ -49,7 +50,7 @@ private CountEntityKeyDefinitionsParams( } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -114,7 +115,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional> ids = Optional.empty(); @@ -139,12 +140,12 @@ public Builder from(CountEntityKeyDefinitionsParams other) { } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(CountEntityKeyDefinitionsResponseParamsEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsRequestEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsRequestEntityType.java deleted file mode 100644 index edf9349..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsRequestEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountEntityKeyDefinitionsRequestEntityType { - public static final CountEntityKeyDefinitionsRequestEntityType USER = - new CountEntityKeyDefinitionsRequestEntityType(Value.USER, "user"); - - public static final CountEntityKeyDefinitionsRequestEntityType COMPANY = - new CountEntityKeyDefinitionsRequestEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - CountEntityKeyDefinitionsRequestEntityType(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 CountEntityKeyDefinitionsRequestEntityType - && this.string.equals(((CountEntityKeyDefinitionsRequestEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountEntityKeyDefinitionsRequestEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new CountEntityKeyDefinitionsRequestEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponseParamsEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponseParamsEntityType.java deleted file mode 100644 index af6bd58..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponseParamsEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountEntityKeyDefinitionsResponseParamsEntityType { - public static final CountEntityKeyDefinitionsResponseParamsEntityType USER = - new CountEntityKeyDefinitionsResponseParamsEntityType(Value.USER, "user"); - - public static final CountEntityKeyDefinitionsResponseParamsEntityType COMPANY = - new CountEntityKeyDefinitionsResponseParamsEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - CountEntityKeyDefinitionsResponseParamsEntityType(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 CountEntityKeyDefinitionsResponseParamsEntityType - && this.string.equals(((CountEntityKeyDefinitionsResponseParamsEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountEntityKeyDefinitionsResponseParamsEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new CountEntityKeyDefinitionsResponseParamsEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsParams.java index a137a65..aeced1a 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsParams.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.EntityType; +import com.schematic.api.types.TraitType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,7 +23,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountEntityTraitDefinitionsParams.Builder.class) public final class CountEntityTraitDefinitionsParams { - private final Optional entityType; + private final Optional entityType; private final Optional> ids; @@ -31,17 +33,20 @@ public final class CountEntityTraitDefinitionsParams { private final Optional q; - private final Optional traitType; + private final Optional traitType; + + private final Optional> traitTypes; private final Map additionalProperties; private CountEntityTraitDefinitionsParams( - Optional entityType, + Optional entityType, Optional> ids, Optional limit, Optional offset, Optional q, - Optional traitType, + Optional traitType, + Optional> traitTypes, Map additionalProperties) { this.entityType = entityType; this.ids = ids; @@ -49,11 +54,12 @@ private CountEntityTraitDefinitionsParams( this.offset = offset; this.q = q; this.traitType = traitType; + this.traitTypes = traitTypes; this.additionalProperties = additionalProperties; } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -84,10 +90,15 @@ public Optional getQ() { } @JsonProperty("trait_type") - public Optional getTraitType() { + public Optional getTraitType() { return traitType; } + @JsonProperty("trait_types") + public Optional> getTraitTypes() { + return traitTypes; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -105,12 +116,14 @@ private boolean equalTo(CountEntityTraitDefinitionsParams other) { && limit.equals(other.limit) && offset.equals(other.offset) && q.equals(other.q) - && traitType.equals(other.traitType); + && traitType.equals(other.traitType) + && traitTypes.equals(other.traitTypes); } @java.lang.Override public int hashCode() { - return Objects.hash(this.entityType, this.ids, this.limit, this.offset, this.q, this.traitType); + return Objects.hash( + this.entityType, this.ids, this.limit, this.offset, this.q, this.traitType, this.traitTypes); } @java.lang.Override @@ -124,7 +137,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional> ids = Optional.empty(); @@ -134,7 +147,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional traitType = Optional.empty(); + private Optional traitType = Optional.empty(); + + private Optional> traitTypes = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -148,16 +163,17 @@ public Builder from(CountEntityTraitDefinitionsParams other) { offset(other.getOffset()); q(other.getQ()); traitType(other.getTraitType()); + traitTypes(other.getTraitTypes()); return this; } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(CountEntityTraitDefinitionsResponseParamsEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } @@ -213,19 +229,30 @@ public Builder q(String q) { } @JsonSetter(value = "trait_type", nulls = Nulls.SKIP) - public Builder traitType(Optional traitType) { + public Builder traitType(Optional traitType) { this.traitType = traitType; return this; } - public Builder traitType(CountEntityTraitDefinitionsResponseParamsTraitType traitType) { + public Builder traitType(TraitType traitType) { this.traitType = Optional.ofNullable(traitType); return this; } + @JsonSetter(value = "trait_types", nulls = Nulls.SKIP) + public Builder traitTypes(Optional> traitTypes) { + this.traitTypes = traitTypes; + return this; + } + + public Builder traitTypes(List traitTypes) { + this.traitTypes = Optional.ofNullable(traitTypes); + return this; + } + public CountEntityTraitDefinitionsParams build() { return new CountEntityTraitDefinitionsParams( - entityType, ids, limit, offset, q, traitType, additionalProperties); + entityType, ids, limit, offset, q, traitType, traitTypes, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsRequestEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsRequestEntityType.java deleted file mode 100644 index 06eeb61..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsRequestEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountEntityTraitDefinitionsRequestEntityType { - public static final CountEntityTraitDefinitionsRequestEntityType USER = - new CountEntityTraitDefinitionsRequestEntityType(Value.USER, "user"); - - public static final CountEntityTraitDefinitionsRequestEntityType COMPANY = - new CountEntityTraitDefinitionsRequestEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - CountEntityTraitDefinitionsRequestEntityType(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 CountEntityTraitDefinitionsRequestEntityType - && this.string.equals(((CountEntityTraitDefinitionsRequestEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountEntityTraitDefinitionsRequestEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new CountEntityTraitDefinitionsRequestEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsRequestTraitType.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsRequestTraitType.java deleted file mode 100644 index f29c161..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsRequestTraitType.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountEntityTraitDefinitionsRequestTraitType { - public static final CountEntityTraitDefinitionsRequestTraitType NUMBER = - new CountEntityTraitDefinitionsRequestTraitType(Value.NUMBER, "number"); - - public static final CountEntityTraitDefinitionsRequestTraitType STRING = - new CountEntityTraitDefinitionsRequestTraitType(Value.STRING, "string"); - - public static final CountEntityTraitDefinitionsRequestTraitType BOOLEAN = - new CountEntityTraitDefinitionsRequestTraitType(Value.BOOLEAN, "boolean"); - - public static final CountEntityTraitDefinitionsRequestTraitType CURRENCY = - new CountEntityTraitDefinitionsRequestTraitType(Value.CURRENCY, "currency"); - - public static final CountEntityTraitDefinitionsRequestTraitType DATE = - new CountEntityTraitDefinitionsRequestTraitType(Value.DATE, "date"); - - public static final CountEntityTraitDefinitionsRequestTraitType URL = - new CountEntityTraitDefinitionsRequestTraitType(Value.URL, "url"); - - private final Value value; - - private final String string; - - CountEntityTraitDefinitionsRequestTraitType(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 CountEntityTraitDefinitionsRequestTraitType - && this.string.equals(((CountEntityTraitDefinitionsRequestTraitType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMBER: - return visitor.visitNumber(); - case STRING: - return visitor.visitString(); - case BOOLEAN: - return visitor.visitBoolean(); - case CURRENCY: - return visitor.visitCurrency(); - case DATE: - return visitor.visitDate(); - case URL: - return visitor.visitUrl(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountEntityTraitDefinitionsRequestTraitType valueOf(String value) { - switch (value) { - case "number": - return NUMBER; - case "string": - return STRING; - case "boolean": - return BOOLEAN; - case "currency": - return CURRENCY; - case "date": - return DATE; - case "url": - return URL; - default: - return new CountEntityTraitDefinitionsRequestTraitType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CURRENCY, - - DATE, - - NUMBER, - - STRING, - - URL, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCurrency(); - - T visitDate(); - - T visitNumber(); - - T visitString(); - - T visitUrl(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsEntityType.java deleted file mode 100644 index 1838c0e..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountEntityTraitDefinitionsResponseParamsEntityType { - public static final CountEntityTraitDefinitionsResponseParamsEntityType USER = - new CountEntityTraitDefinitionsResponseParamsEntityType(Value.USER, "user"); - - public static final CountEntityTraitDefinitionsResponseParamsEntityType COMPANY = - new CountEntityTraitDefinitionsResponseParamsEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - CountEntityTraitDefinitionsResponseParamsEntityType(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 CountEntityTraitDefinitionsResponseParamsEntityType - && this.string.equals(((CountEntityTraitDefinitionsResponseParamsEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountEntityTraitDefinitionsResponseParamsEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new CountEntityTraitDefinitionsResponseParamsEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsTraitType.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsTraitType.java deleted file mode 100644 index 30bcfcd..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponseParamsTraitType.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountEntityTraitDefinitionsResponseParamsTraitType { - public static final CountEntityTraitDefinitionsResponseParamsTraitType NUMBER = - new CountEntityTraitDefinitionsResponseParamsTraitType(Value.NUMBER, "number"); - - public static final CountEntityTraitDefinitionsResponseParamsTraitType STRING = - new CountEntityTraitDefinitionsResponseParamsTraitType(Value.STRING, "string"); - - public static final CountEntityTraitDefinitionsResponseParamsTraitType BOOLEAN = - new CountEntityTraitDefinitionsResponseParamsTraitType(Value.BOOLEAN, "boolean"); - - public static final CountEntityTraitDefinitionsResponseParamsTraitType CURRENCY = - new CountEntityTraitDefinitionsResponseParamsTraitType(Value.CURRENCY, "currency"); - - public static final CountEntityTraitDefinitionsResponseParamsTraitType DATE = - new CountEntityTraitDefinitionsResponseParamsTraitType(Value.DATE, "date"); - - public static final CountEntityTraitDefinitionsResponseParamsTraitType URL = - new CountEntityTraitDefinitionsResponseParamsTraitType(Value.URL, "url"); - - private final Value value; - - private final String string; - - CountEntityTraitDefinitionsResponseParamsTraitType(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 CountEntityTraitDefinitionsResponseParamsTraitType - && this.string.equals(((CountEntityTraitDefinitionsResponseParamsTraitType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMBER: - return visitor.visitNumber(); - case STRING: - return visitor.visitString(); - case BOOLEAN: - return visitor.visitBoolean(); - case CURRENCY: - return visitor.visitCurrency(); - case DATE: - return visitor.visitDate(); - case URL: - return visitor.visitUrl(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountEntityTraitDefinitionsResponseParamsTraitType valueOf(String value) { - switch (value) { - case "number": - return NUMBER; - case "string": - return STRING; - case "boolean": - return BOOLEAN; - case "currency": - return CURRENCY; - case "date": - return DATE; - case "url": - return URL; - default: - return new CountEntityTraitDefinitionsResponseParamsTraitType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CURRENCY, - - DATE, - - NUMBER, - - STRING, - - URL, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCurrency(); - - T visitDate(); - - T visitNumber(); - - T visitString(); - - T visitUrl(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyEntityType.java deleted file mode 100644 index c867a82..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateEntityTraitDefinitionRequestBodyEntityType { - public static final CreateEntityTraitDefinitionRequestBodyEntityType USER = - new CreateEntityTraitDefinitionRequestBodyEntityType(Value.USER, "user"); - - public static final CreateEntityTraitDefinitionRequestBodyEntityType COMPANY = - new CreateEntityTraitDefinitionRequestBodyEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - CreateEntityTraitDefinitionRequestBodyEntityType(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 CreateEntityTraitDefinitionRequestBodyEntityType - && this.string.equals(((CreateEntityTraitDefinitionRequestBodyEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateEntityTraitDefinitionRequestBodyEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new CreateEntityTraitDefinitionRequestBodyEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyTraitType.java b/src/main/java/com/schematic/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyTraitType.java deleted file mode 100644 index 4cc92b2..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CreateEntityTraitDefinitionRequestBodyTraitType.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateEntityTraitDefinitionRequestBodyTraitType { - public static final CreateEntityTraitDefinitionRequestBodyTraitType NUMBER = - new CreateEntityTraitDefinitionRequestBodyTraitType(Value.NUMBER, "number"); - - public static final CreateEntityTraitDefinitionRequestBodyTraitType STRING = - new CreateEntityTraitDefinitionRequestBodyTraitType(Value.STRING, "string"); - - public static final CreateEntityTraitDefinitionRequestBodyTraitType BOOLEAN = - new CreateEntityTraitDefinitionRequestBodyTraitType(Value.BOOLEAN, "boolean"); - - public static final CreateEntityTraitDefinitionRequestBodyTraitType CURRENCY = - new CreateEntityTraitDefinitionRequestBodyTraitType(Value.CURRENCY, "currency"); - - public static final CreateEntityTraitDefinitionRequestBodyTraitType DATE = - new CreateEntityTraitDefinitionRequestBodyTraitType(Value.DATE, "date"); - - public static final CreateEntityTraitDefinitionRequestBodyTraitType URL = - new CreateEntityTraitDefinitionRequestBodyTraitType(Value.URL, "url"); - - private final Value value; - - private final String string; - - CreateEntityTraitDefinitionRequestBodyTraitType(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 CreateEntityTraitDefinitionRequestBodyTraitType - && this.string.equals(((CreateEntityTraitDefinitionRequestBodyTraitType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMBER: - return visitor.visitNumber(); - case STRING: - return visitor.visitString(); - case BOOLEAN: - return visitor.visitBoolean(); - case CURRENCY: - return visitor.visitCurrency(); - case DATE: - return visitor.visitDate(); - case URL: - return visitor.visitUrl(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateEntityTraitDefinitionRequestBodyTraitType valueOf(String value) { - switch (value) { - case "number": - return NUMBER; - case "string": - return STRING; - case "boolean": - return BOOLEAN; - case "currency": - return CURRENCY; - case "date": - return DATE; - case "url": - return URL; - default: - return new CreateEntityTraitDefinitionRequestBodyTraitType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CURRENCY, - - DATE, - - NUMBER, - - STRING, - - URL, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCurrency(); - - T visitDate(); - - T visitNumber(); - - T visitString(); - - T visitUrl(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java new file mode 100644 index 0000000..b1d7c6e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.companies.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 = DeleteCompanyParams.Builder.class) +public final class DeleteCompanyParams { + private final Optional cancelSubscription; + + private final Optional prorate; + + private final Map additionalProperties; + + private DeleteCompanyParams( + Optional cancelSubscription, Optional prorate, Map additionalProperties) { + this.cancelSubscription = cancelSubscription; + this.prorate = prorate; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("cancel_subscription") + public Optional getCancelSubscription() { + return cancelSubscription; + } + + @JsonProperty("prorate") + public Optional getProrate() { + return prorate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteCompanyParams && equalTo((DeleteCompanyParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteCompanyParams other) { + return cancelSubscription.equals(other.cancelSubscription) && prorate.equals(other.prorate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.cancelSubscription, this.prorate); + } + + @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 cancelSubscription = Optional.empty(); + + private Optional prorate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteCompanyParams other) { + cancelSubscription(other.getCancelSubscription()); + prorate(other.getProrate()); + return this; + } + + @JsonSetter(value = "cancel_subscription", nulls = Nulls.SKIP) + public Builder cancelSubscription(Optional cancelSubscription) { + this.cancelSubscription = cancelSubscription; + return this; + } + + public Builder cancelSubscription(Boolean cancelSubscription) { + this.cancelSubscription = Optional.ofNullable(cancelSubscription); + return this; + } + + @JsonSetter(value = "prorate", nulls = Nulls.SKIP) + public Builder prorate(Optional prorate) { + this.prorate = prorate; + return this; + } + + public Builder prorate(Boolean prorate) { + this.prorate = Optional.ofNullable(prorate); + return this; + } + + public DeleteCompanyParams build() { + return new DeleteCompanyParams(cancelSubscription, prorate, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyResponse.java index 26d3082..b6df20d 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyResponse.java @@ -9,13 +9,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.DeleteResponse; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import org.jetbrains.annotations.NotNull; @@ -25,12 +22,12 @@ public final class DeleteCompanyResponse { private final DeleteResponse data; - private final Map params; + private final DeleteCompanyParams params; private final Map additionalProperties; private DeleteCompanyResponse( - DeleteResponse data, Map params, Map additionalProperties) { + DeleteResponse data, DeleteCompanyParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -45,7 +42,7 @@ public DeleteResponse getData() { * @return Input parameters */ @JsonProperty("params") - public Map getParams() { + public DeleteCompanyParams getParams() { return params; } @@ -79,29 +76,27 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull DeleteResponse data); + ParamsStage data(@NotNull DeleteResponse data); Builder from(DeleteCompanyResponse other); } - public interface _FinalStage { - DeleteCompanyResponse build(); - + public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(Map params); - - _FinalStage putAllParams(Map params); + _FinalStage params(@NotNull DeleteCompanyParams params); + } - _FinalStage params(String key, JsonNode value); + public interface _FinalStage { + DeleteCompanyResponse build(); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DataStage, _FinalStage { + public static final class Builder implements DataStage, ParamsStage, _FinalStage { private DeleteResponse data; - private Map params = new LinkedHashMap<>(); + private DeleteCompanyParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -117,43 +112,20 @@ public Builder from(DeleteCompanyResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull DeleteResponse data) { + public ParamsStage data(@NotNull DeleteResponse data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } /** *

Input parameters

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

Input parameters

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

Input parameters

- */ - @java.lang.Override - @JsonSetter(value = "params", nulls = Nulls.SKIP) - public _FinalStage params(Map params) { - this.params.clear(); - if (params != null) { - this.params.putAll(params); - } + @JsonSetter("params") + public _FinalStage params(@NotNull DeleteCompanyParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java index 76d863e..7466b19 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,11 +44,11 @@ public final class ListCompaniesForAdvancedFilterParams { private final Optional sortOrderColumn; - private final Optional sortOrderDirection; + private final Optional sortOrderDirection; - private final Optional> subscriptionStatuses; + private final Optional> subscriptionStatuses; - private final Optional> subscriptionTypes; + private final Optional> subscriptionTypes; private final Optional withoutPlan; @@ -64,9 +67,9 @@ private ListCompaniesForAdvancedFilterParams( Optional> planIds, Optional q, Optional sortOrderColumn, - Optional sortOrderDirection, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, + Optional sortOrderDirection, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, Optional withoutPlan, Optional withoutSubscription, Map additionalProperties) { @@ -168,11 +171,8 @@ public Optional getSortOrderColumn() { return sortOrderColumn; } - /** - * @return Direction to sort by (asc or desc) - */ @JsonProperty("sort_order_direction") - public Optional getSortOrderDirection() { + public Optional getSortOrderDirection() { return sortOrderDirection; } @@ -180,7 +180,7 @@ public Optional * @return Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) */ @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { + public Optional> getSubscriptionStatuses() { return subscriptionStatuses; } @@ -188,7 +188,7 @@ public Optional> getSubscriptionStatuses() { * @return Filter companies by one or more subscription types (paid, free, trial) */ @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { + public Optional> getSubscriptionTypes() { return subscriptionTypes; } @@ -289,12 +289,11 @@ public static final class Builder { private Optional sortOrderColumn = Optional.empty(); - private Optional sortOrderDirection = - Optional.empty(); + private Optional sortOrderDirection = Optional.empty(); - private Optional> subscriptionStatuses = Optional.empty(); + private Optional> subscriptionStatuses = Optional.empty(); - private Optional> subscriptionTypes = Optional.empty(); + private Optional> subscriptionTypes = Optional.empty(); private Optional withoutPlan = Optional.empty(); @@ -464,18 +463,13 @@ public Builder sortOrderColumn(String sortOrderColumn) { return this; } - /** - *

Direction to sort by (asc or desc)

- */ @JsonSetter(value = "sort_order_direction", nulls = Nulls.SKIP) - public Builder sortOrderDirection( - Optional sortOrderDirection) { + public Builder sortOrderDirection(Optional sortOrderDirection) { this.sortOrderDirection = sortOrderDirection; return this; } - public Builder sortOrderDirection( - ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection sortOrderDirection) { + public Builder sortOrderDirection(SortDirection sortOrderDirection) { this.sortOrderDirection = Optional.ofNullable(sortOrderDirection); return this; } @@ -484,12 +478,12 @@ public Builder sortOrderDirection( *

Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

*/ @JsonSetter(value = "subscription_statuses", nulls = Nulls.SKIP) - public Builder subscriptionStatuses(Optional> subscriptionStatuses) { + public Builder subscriptionStatuses(Optional> subscriptionStatuses) { this.subscriptionStatuses = subscriptionStatuses; return this; } - public Builder subscriptionStatuses(List subscriptionStatuses) { + public Builder subscriptionStatuses(List subscriptionStatuses) { this.subscriptionStatuses = Optional.ofNullable(subscriptionStatuses); return this; } @@ -498,12 +492,12 @@ public Builder subscriptionStatuses(List subscriptionStatuses) { *

Filter companies by one or more subscription types (paid, free, trial)

*/ @JsonSetter(value = "subscription_types", nulls = Nulls.SKIP) - public Builder subscriptionTypes(Optional> subscriptionTypes) { + public Builder subscriptionTypes(Optional> subscriptionTypes) { this.subscriptionTypes = subscriptionTypes; return this; } - public Builder subscriptionTypes(List subscriptionTypes) { + public Builder subscriptionTypes(List subscriptionTypes) { this.subscriptionTypes = Optional.ofNullable(subscriptionTypes); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterRequestSortOrderDirection.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterRequestSortOrderDirection.java deleted file mode 100644 index 1fa2420..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterRequestSortOrderDirection.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListCompaniesForAdvancedFilterRequestSortOrderDirection { - public static final ListCompaniesForAdvancedFilterRequestSortOrderDirection ASC = - new ListCompaniesForAdvancedFilterRequestSortOrderDirection(Value.ASC, "asc"); - - public static final ListCompaniesForAdvancedFilterRequestSortOrderDirection DESC = - new ListCompaniesForAdvancedFilterRequestSortOrderDirection(Value.DESC, "desc"); - - private final Value value; - - private final String string; - - ListCompaniesForAdvancedFilterRequestSortOrderDirection(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 ListCompaniesForAdvancedFilterRequestSortOrderDirection - && this.string.equals( - ((ListCompaniesForAdvancedFilterRequestSortOrderDirection) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASC: - return visitor.visitAsc(); - case DESC: - return visitor.visitDesc(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCompaniesForAdvancedFilterRequestSortOrderDirection valueOf(String value) { - switch (value) { - case "asc": - return ASC; - case "desc": - return DESC; - default: - return new ListCompaniesForAdvancedFilterRequestSortOrderDirection(Value.UNKNOWN, value); - } - } - - public enum Value { - ASC, - - DESC, - - UNKNOWN - } - - public interface Visitor { - T visitAsc(); - - T visitDesc(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection.java deleted file mode 100644 index 5e699a0..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection { - public static final ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection ASC = - new ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection(Value.ASC, "asc"); - - public static final ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection DESC = - new ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection(Value.DESC, "desc"); - - private final Value value; - - private final String string; - - ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection(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 ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection - && this.string.equals( - ((ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASC: - return visitor.visitAsc(); - case DESC: - return visitor.visitDesc(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection valueOf(String value) { - switch (value) { - case "asc": - return ASC; - case "desc": - return DESC; - default: - return new ListCompaniesForAdvancedFilterResponseParamsSortOrderDirection(Value.UNKNOWN, value); - } - } - - public enum Value { - ASC, - - DESC, - - UNKNOWN - } - - public interface Visitor { - T visitAsc(); - - T visitDesc(); - - T visitUnknown(String unknownType); - } -} 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 c871420..cda01d0 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 @@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.SortDirection; +import com.schematic.api.types.SubscriptionStatus; +import com.schematic.api.types.SubscriptionType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,45 +24,85 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListCompaniesParams.Builder.class) public final class ListCompaniesParams { + private final Optional> creditTypeIds; + private final Optional> ids; private final Optional limit; + private final Optional monetizedSubscriptions; + private final Optional offset; private final Optional planId; + private final Optional> planIds; + private final Optional q; + private final Optional sortOrderColumn; + + private final Optional sortOrderDirection; + + private final Optional> subscriptionStatuses; + + private final Optional> subscriptionTypes; + private final Optional withSubscription; private final Optional withoutFeatureOverrideFor; private final Optional withoutPlan; + private final Optional withoutSubscription; + private final Map additionalProperties; private ListCompaniesParams( + Optional> creditTypeIds, Optional> ids, Optional limit, + Optional monetizedSubscriptions, Optional offset, Optional planId, + Optional> planIds, Optional q, + Optional sortOrderColumn, + Optional sortOrderDirection, + Optional> subscriptionStatuses, + Optional> subscriptionTypes, Optional withSubscription, Optional withoutFeatureOverrideFor, Optional withoutPlan, + Optional withoutSubscription, Map additionalProperties) { + this.creditTypeIds = creditTypeIds; this.ids = ids; this.limit = limit; + this.monetizedSubscriptions = monetizedSubscriptions; this.offset = offset; this.planId = planId; + this.planIds = planIds; this.q = q; + this.sortOrderColumn = sortOrderColumn; + this.sortOrderDirection = sortOrderDirection; + this.subscriptionStatuses = subscriptionStatuses; + this.subscriptionTypes = subscriptionTypes; this.withSubscription = withSubscription; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; + this.withoutSubscription = withoutSubscription; this.additionalProperties = additionalProperties; } + /** + * @return Filter companies by one or more credit type IDs (each ID starts with bcrd_) + */ + @JsonProperty("credit_type_ids") + public Optional> getCreditTypeIds() { + return creditTypeIds; + } + /** * @return Filter companies by multiple company IDs (starts with comp_) */ @@ -76,6 +119,14 @@ public Optional getLimit() { return limit; } + /** + * @return Filter companies that have monetized subscriptions + */ + @JsonProperty("monetized_subscriptions") + public Optional getMonetizedSubscriptions() { + return monetizedSubscriptions; + } + /** * @return Page offset (default 0) */ @@ -92,6 +143,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter companies by one or more plan IDs (each ID starts with plan_) + */ + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + /** * @return Search for companies by name, keys or string traits */ @@ -100,6 +159,35 @@ public Optional getQ() { return q; } + /** + * @return Column to sort by (e.g. name, created_at, last_seen_at) + */ + @JsonProperty("sort_order_column") + public Optional getSortOrderColumn() { + return sortOrderColumn; + } + + @JsonProperty("sort_order_direction") + public Optional getSortOrderDirection() { + return sortOrderDirection; + } + + /** + * @return Filter companies by one or more subscription statuses + */ + @JsonProperty("subscription_statuses") + public Optional> getSubscriptionStatuses() { + return subscriptionStatuses; + } + + /** + * @return Filter companies by one or more subscription types + */ + @JsonProperty("subscription_types") + public Optional> getSubscriptionTypes() { + return subscriptionTypes; + } + /** * @return Filter companies that have a subscription */ @@ -124,6 +212,14 @@ public Optional getWithoutPlan() { return withoutPlan; } + /** + * @return Filter out companies that have a subscription + */ + @JsonProperty("without_subscription") + public Optional getWithoutSubscription() { + return withoutSubscription; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -136,27 +232,43 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListCompaniesParams other) { - return ids.equals(other.ids) + return creditTypeIds.equals(other.creditTypeIds) + && ids.equals(other.ids) && limit.equals(other.limit) + && monetizedSubscriptions.equals(other.monetizedSubscriptions) && offset.equals(other.offset) && planId.equals(other.planId) + && planIds.equals(other.planIds) && q.equals(other.q) + && sortOrderColumn.equals(other.sortOrderColumn) + && sortOrderDirection.equals(other.sortOrderDirection) + && subscriptionStatuses.equals(other.subscriptionStatuses) + && subscriptionTypes.equals(other.subscriptionTypes) && withSubscription.equals(other.withSubscription) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) - && withoutPlan.equals(other.withoutPlan); + && withoutPlan.equals(other.withoutPlan) + && withoutSubscription.equals(other.withoutSubscription); } @java.lang.Override public int hashCode() { return Objects.hash( + this.creditTypeIds, this.ids, this.limit, + this.monetizedSubscriptions, this.offset, this.planId, + this.planIds, this.q, + this.sortOrderColumn, + this.sortOrderDirection, + this.subscriptionStatuses, + this.subscriptionTypes, this.withSubscription, this.withoutFeatureOverrideFor, - this.withoutPlan); + this.withoutPlan, + this.withoutSubscription); } @java.lang.Override @@ -170,36 +282,74 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional> creditTypeIds = Optional.empty(); + private Optional> ids = Optional.empty(); private Optional limit = Optional.empty(); + private Optional monetizedSubscriptions = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); + private Optional> planIds = Optional.empty(); + private Optional q = Optional.empty(); + private Optional sortOrderColumn = Optional.empty(); + + private Optional sortOrderDirection = Optional.empty(); + + private Optional> subscriptionStatuses = Optional.empty(); + + private Optional> subscriptionTypes = Optional.empty(); + private Optional withSubscription = Optional.empty(); private Optional withoutFeatureOverrideFor = Optional.empty(); private Optional withoutPlan = Optional.empty(); + private Optional withoutSubscription = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} public Builder from(ListCompaniesParams other) { + creditTypeIds(other.getCreditTypeIds()); ids(other.getIds()); limit(other.getLimit()); + monetizedSubscriptions(other.getMonetizedSubscriptions()); offset(other.getOffset()); planId(other.getPlanId()); + planIds(other.getPlanIds()); q(other.getQ()); + sortOrderColumn(other.getSortOrderColumn()); + sortOrderDirection(other.getSortOrderDirection()); + subscriptionStatuses(other.getSubscriptionStatuses()); + subscriptionTypes(other.getSubscriptionTypes()); withSubscription(other.getWithSubscription()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); + withoutSubscription(other.getWithoutSubscription()); + return this; + } + + /** + *

Filter companies by one or more credit type IDs (each ID starts with bcrd_)

+ */ + @JsonSetter(value = "credit_type_ids", nulls = Nulls.SKIP) + public Builder creditTypeIds(Optional> creditTypeIds) { + this.creditTypeIds = creditTypeIds; + return this; + } + + public Builder creditTypeIds(List creditTypeIds) { + this.creditTypeIds = Optional.ofNullable(creditTypeIds); return this; } @@ -231,6 +381,20 @@ public Builder limit(Integer limit) { return this; } + /** + *

Filter companies that have monetized subscriptions

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

Page offset (default 0)

*/ @@ -259,6 +423,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter companies by one or more plan IDs (each ID starts with plan_)

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

Search for companies by name, keys or string traits

*/ @@ -273,6 +451,59 @@ public Builder q(String q) { return this; } + /** + *

Column to sort by (e.g. name, created_at, last_seen_at)

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

Filter companies by one or more subscription statuses

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

Filter companies by one or more subscription types

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

Filter companies that have a subscription

*/ @@ -315,16 +546,38 @@ public Builder withoutPlan(Boolean withoutPlan) { return this; } + /** + *

Filter out companies that have a subscription

+ */ + @JsonSetter(value = "without_subscription", nulls = Nulls.SKIP) + public Builder withoutSubscription(Optional withoutSubscription) { + this.withoutSubscription = withoutSubscription; + return this; + } + + public Builder withoutSubscription(Boolean withoutSubscription) { + this.withoutSubscription = Optional.ofNullable(withoutSubscription); + return this; + } + public ListCompaniesParams build() { return new ListCompaniesParams( + creditTypeIds, ids, limit, + monetizedSubscriptions, offset, planId, + planIds, q, + sortOrderColumn, + sortOrderDirection, + subscriptionStatuses, + subscriptionTypes, withSubscription, withoutFeatureOverrideFor, withoutPlan, + withoutSubscription, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsParams.java index c39dbdc..7928b91 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.EntityType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListEntityKeyDefinitionsParams.Builder.class) public final class ListEntityKeyDefinitionsParams { - private final Optional entityType; + private final Optional entityType; private final Optional> ids; @@ -34,7 +35,7 @@ public final class ListEntityKeyDefinitionsParams { private final Map additionalProperties; private ListEntityKeyDefinitionsParams( - Optional entityType, + Optional entityType, Optional> ids, Optional limit, Optional offset, @@ -49,7 +50,7 @@ private ListEntityKeyDefinitionsParams( } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -114,7 +115,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional> ids = Optional.empty(); @@ -139,12 +140,12 @@ public Builder from(ListEntityKeyDefinitionsParams other) { } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(ListEntityKeyDefinitionsResponseParamsEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponseParamsEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponseParamsEntityType.java deleted file mode 100644 index 0906ca0..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponseParamsEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListEntityKeyDefinitionsResponseParamsEntityType { - public static final ListEntityKeyDefinitionsResponseParamsEntityType USER = - new ListEntityKeyDefinitionsResponseParamsEntityType(Value.USER, "user"); - - public static final ListEntityKeyDefinitionsResponseParamsEntityType COMPANY = - new ListEntityKeyDefinitionsResponseParamsEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - ListEntityKeyDefinitionsResponseParamsEntityType(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 ListEntityKeyDefinitionsResponseParamsEntityType - && this.string.equals(((ListEntityKeyDefinitionsResponseParamsEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEntityKeyDefinitionsResponseParamsEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new ListEntityKeyDefinitionsResponseParamsEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsParams.java index 2720255..6a894b6 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsParams.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.EntityType; +import com.schematic.api.types.TraitType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -21,7 +23,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListEntityTraitDefinitionsParams.Builder.class) public final class ListEntityTraitDefinitionsParams { - private final Optional entityType; + private final Optional entityType; private final Optional> ids; @@ -31,17 +33,20 @@ public final class ListEntityTraitDefinitionsParams { private final Optional q; - private final Optional traitType; + private final Optional traitType; + + private final Optional> traitTypes; private final Map additionalProperties; private ListEntityTraitDefinitionsParams( - Optional entityType, + Optional entityType, Optional> ids, Optional limit, Optional offset, Optional q, - Optional traitType, + Optional traitType, + Optional> traitTypes, Map additionalProperties) { this.entityType = entityType; this.ids = ids; @@ -49,11 +54,12 @@ private ListEntityTraitDefinitionsParams( this.offset = offset; this.q = q; this.traitType = traitType; + this.traitTypes = traitTypes; this.additionalProperties = additionalProperties; } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -84,10 +90,15 @@ public Optional getQ() { } @JsonProperty("trait_type") - public Optional getTraitType() { + public Optional getTraitType() { return traitType; } + @JsonProperty("trait_types") + public Optional> getTraitTypes() { + return traitTypes; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -105,12 +116,14 @@ private boolean equalTo(ListEntityTraitDefinitionsParams other) { && limit.equals(other.limit) && offset.equals(other.offset) && q.equals(other.q) - && traitType.equals(other.traitType); + && traitType.equals(other.traitType) + && traitTypes.equals(other.traitTypes); } @java.lang.Override public int hashCode() { - return Objects.hash(this.entityType, this.ids, this.limit, this.offset, this.q, this.traitType); + return Objects.hash( + this.entityType, this.ids, this.limit, this.offset, this.q, this.traitType, this.traitTypes); } @java.lang.Override @@ -124,7 +137,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional> ids = Optional.empty(); @@ -134,7 +147,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional traitType = Optional.empty(); + private Optional traitType = Optional.empty(); + + private Optional> traitTypes = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -148,16 +163,17 @@ public Builder from(ListEntityTraitDefinitionsParams other) { offset(other.getOffset()); q(other.getQ()); traitType(other.getTraitType()); + traitTypes(other.getTraitTypes()); return this; } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(ListEntityTraitDefinitionsResponseParamsEntityType entityType) { + public Builder entityType(EntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } @@ -213,19 +229,30 @@ public Builder q(String q) { } @JsonSetter(value = "trait_type", nulls = Nulls.SKIP) - public Builder traitType(Optional traitType) { + public Builder traitType(Optional traitType) { this.traitType = traitType; return this; } - public Builder traitType(ListEntityTraitDefinitionsResponseParamsTraitType traitType) { + public Builder traitType(TraitType traitType) { this.traitType = Optional.ofNullable(traitType); return this; } + @JsonSetter(value = "trait_types", nulls = Nulls.SKIP) + public Builder traitTypes(Optional> traitTypes) { + this.traitTypes = traitTypes; + return this; + } + + public Builder traitTypes(List traitTypes) { + this.traitTypes = Optional.ofNullable(traitTypes); + return this; + } + public ListEntityTraitDefinitionsParams build() { return new ListEntityTraitDefinitionsParams( - entityType, ids, limit, offset, q, traitType, additionalProperties); + entityType, ids, limit, offset, q, traitType, traitTypes, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsEntityType.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsEntityType.java deleted file mode 100644 index 272fa38..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListEntityTraitDefinitionsResponseParamsEntityType { - public static final ListEntityTraitDefinitionsResponseParamsEntityType USER = - new ListEntityTraitDefinitionsResponseParamsEntityType(Value.USER, "user"); - - public static final ListEntityTraitDefinitionsResponseParamsEntityType COMPANY = - new ListEntityTraitDefinitionsResponseParamsEntityType(Value.COMPANY, "company"); - - private final Value value; - - private final String string; - - ListEntityTraitDefinitionsResponseParamsEntityType(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 ListEntityTraitDefinitionsResponseParamsEntityType - && this.string.equals(((ListEntityTraitDefinitionsResponseParamsEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case USER: - return visitor.visitUser(); - case COMPANY: - return visitor.visitCompany(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEntityTraitDefinitionsResponseParamsEntityType valueOf(String value) { - switch (value) { - case "user": - return USER; - case "company": - return COMPANY; - default: - return new ListEntityTraitDefinitionsResponseParamsEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY, - - USER, - - UNKNOWN - } - - public interface Visitor { - T visitCompany(); - - T visitUser(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsTraitType.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsTraitType.java deleted file mode 100644 index 806e485..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponseParamsTraitType.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListEntityTraitDefinitionsResponseParamsTraitType { - public static final ListEntityTraitDefinitionsResponseParamsTraitType NUMBER = - new ListEntityTraitDefinitionsResponseParamsTraitType(Value.NUMBER, "number"); - - public static final ListEntityTraitDefinitionsResponseParamsTraitType STRING = - new ListEntityTraitDefinitionsResponseParamsTraitType(Value.STRING, "string"); - - public static final ListEntityTraitDefinitionsResponseParamsTraitType BOOLEAN = - new ListEntityTraitDefinitionsResponseParamsTraitType(Value.BOOLEAN, "boolean"); - - public static final ListEntityTraitDefinitionsResponseParamsTraitType CURRENCY = - new ListEntityTraitDefinitionsResponseParamsTraitType(Value.CURRENCY, "currency"); - - public static final ListEntityTraitDefinitionsResponseParamsTraitType DATE = - new ListEntityTraitDefinitionsResponseParamsTraitType(Value.DATE, "date"); - - public static final ListEntityTraitDefinitionsResponseParamsTraitType URL = - new ListEntityTraitDefinitionsResponseParamsTraitType(Value.URL, "url"); - - private final Value value; - - private final String string; - - ListEntityTraitDefinitionsResponseParamsTraitType(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 ListEntityTraitDefinitionsResponseParamsTraitType - && this.string.equals(((ListEntityTraitDefinitionsResponseParamsTraitType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMBER: - return visitor.visitNumber(); - case STRING: - return visitor.visitString(); - case BOOLEAN: - return visitor.visitBoolean(); - case CURRENCY: - return visitor.visitCurrency(); - case DATE: - return visitor.visitDate(); - case URL: - return visitor.visitUrl(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEntityTraitDefinitionsResponseParamsTraitType valueOf(String value) { - switch (value) { - case "number": - return NUMBER; - case "string": - return STRING; - case "boolean": - return BOOLEAN; - case "currency": - return CURRENCY; - case "date": - return DATE; - case "url": - return URL; - default: - return new ListEntityTraitDefinitionsResponseParamsTraitType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CURRENCY, - - DATE, - - NUMBER, - - STRING, - - URL, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCurrency(); - - T visitDate(); - - T visitNumber(); - - T visitString(); - - T visitUrl(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionRequestBodyTraitType.java b/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionRequestBodyTraitType.java deleted file mode 100644 index 1f970c7..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionRequestBodyTraitType.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.companies.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateEntityTraitDefinitionRequestBodyTraitType { - public static final UpdateEntityTraitDefinitionRequestBodyTraitType NUMBER = - new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.NUMBER, "number"); - - public static final UpdateEntityTraitDefinitionRequestBodyTraitType STRING = - new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.STRING, "string"); - - public static final UpdateEntityTraitDefinitionRequestBodyTraitType BOOLEAN = - new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.BOOLEAN, "boolean"); - - public static final UpdateEntityTraitDefinitionRequestBodyTraitType CURRENCY = - new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.CURRENCY, "currency"); - - public static final UpdateEntityTraitDefinitionRequestBodyTraitType DATE = - new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.DATE, "date"); - - public static final UpdateEntityTraitDefinitionRequestBodyTraitType URL = - new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.URL, "url"); - - private final Value value; - - private final String string; - - UpdateEntityTraitDefinitionRequestBodyTraitType(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 UpdateEntityTraitDefinitionRequestBodyTraitType - && this.string.equals(((UpdateEntityTraitDefinitionRequestBodyTraitType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMBER: - return visitor.visitNumber(); - case STRING: - return visitor.visitString(); - case BOOLEAN: - return visitor.visitBoolean(); - case CURRENCY: - return visitor.visitCurrency(); - case DATE: - return visitor.visitDate(); - case URL: - return visitor.visitUrl(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateEntityTraitDefinitionRequestBodyTraitType valueOf(String value) { - switch (value) { - case "number": - return NUMBER; - case "string": - return STRING; - case "boolean": - return BOOLEAN; - case "currency": - return CURRENCY; - case "date": - return DATE; - case "url": - return URL; - default: - return new UpdateEntityTraitDefinitionRequestBodyTraitType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CURRENCY, - - DATE, - - NUMBER, - - STRING, - - URL, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCurrency(); - - T visitDate(); - - T visitNumber(); - - T visitString(); - - T visitUrl(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/components/requests/CreateComponentRequestBody.java b/src/main/java/com/schematic/api/resources/components/requests/CreateComponentRequestBody.java index 6abf675..02d9a0a 100644 --- a/src/main/java/com/schematic/api/resources/components/requests/CreateComponentRequestBody.java +++ b/src/main/java/com/schematic/api/resources/components/requests/CreateComponentRequestBody.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.components.types.CreateComponentRequestBodyEntityType; +import com.schematic.api.types.ComponentEntityType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -24,7 +24,7 @@ public final class CreateComponentRequestBody { private final Optional> ast; - private final CreateComponentRequestBodyEntityType entityType; + private final ComponentEntityType entityType; private final String name; @@ -32,7 +32,7 @@ public final class CreateComponentRequestBody { private CreateComponentRequestBody( Optional> ast, - CreateComponentRequestBodyEntityType entityType, + ComponentEntityType entityType, String name, Map additionalProperties) { this.ast = ast; @@ -47,7 +47,7 @@ public Optional> getAst() { } @JsonProperty("entity_type") - public CreateComponentRequestBodyEntityType getEntityType() { + public ComponentEntityType getEntityType() { return entityType; } @@ -86,7 +86,7 @@ public static EntityTypeStage builder() { } public interface EntityTypeStage { - NameStage entityType(@NotNull CreateComponentRequestBodyEntityType entityType); + NameStage entityType(@NotNull ComponentEntityType entityType); Builder from(CreateComponentRequestBody other); } @@ -105,7 +105,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements EntityTypeStage, NameStage, _FinalStage { - private CreateComponentRequestBodyEntityType entityType; + private ComponentEntityType entityType; private String name; @@ -126,7 +126,7 @@ public Builder from(CreateComponentRequestBody other) { @java.lang.Override @JsonSetter("entity_type") - public NameStage entityType(@NotNull CreateComponentRequestBodyEntityType entityType) { + public NameStage entityType(@NotNull ComponentEntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/components/requests/UpdateComponentRequestBody.java b/src/main/java/com/schematic/api/resources/components/requests/UpdateComponentRequestBody.java index 0a3f4c1..d0078a7 100644 --- a/src/main/java/com/schematic/api/resources/components/requests/UpdateComponentRequestBody.java +++ b/src/main/java/com/schematic/api/resources/components/requests/UpdateComponentRequestBody.java @@ -12,8 +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.resources.components.types.UpdateComponentRequestBodyEntityType; -import com.schematic.api.resources.components.types.UpdateComponentRequestBodyState; +import com.schematic.api.types.ComponentEntityType; +import com.schematic.api.types.ComponentState; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -24,19 +24,19 @@ public final class UpdateComponentRequestBody { private final Optional> ast; - private final Optional entityType; + private final Optional entityType; private final Optional name; - private final Optional state; + private final Optional state; private final Map additionalProperties; private UpdateComponentRequestBody( Optional> ast, - Optional entityType, + Optional entityType, Optional name, - Optional state, + Optional state, Map additionalProperties) { this.ast = ast; this.entityType = entityType; @@ -51,7 +51,7 @@ public Optional> getAst() { } @JsonProperty("entity_type") - public Optional getEntityType() { + public Optional getEntityType() { return entityType; } @@ -61,7 +61,7 @@ public Optional getName() { } @JsonProperty("state") - public Optional getState() { + public Optional getState() { return state; } @@ -101,11 +101,11 @@ public static Builder builder() { public static final class Builder { private Optional> ast = Optional.empty(); - private Optional entityType = Optional.empty(); + private Optional entityType = Optional.empty(); private Optional name = Optional.empty(); - private Optional state = Optional.empty(); + private Optional state = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -132,12 +132,12 @@ public Builder ast(Map ast) { } @JsonSetter(value = "entity_type", nulls = Nulls.SKIP) - public Builder entityType(Optional entityType) { + public Builder entityType(Optional entityType) { this.entityType = entityType; return this; } - public Builder entityType(UpdateComponentRequestBodyEntityType entityType) { + public Builder entityType(ComponentEntityType entityType) { this.entityType = Optional.ofNullable(entityType); return this; } @@ -154,12 +154,12 @@ public Builder name(String name) { } @JsonSetter(value = "state", nulls = Nulls.SKIP) - public Builder state(Optional state) { + public Builder state(Optional state) { this.state = state; return this; } - public Builder state(UpdateComponentRequestBodyState state) { + public Builder state(ComponentState state) { this.state = Optional.ofNullable(state); return this; } diff --git a/src/main/java/com/schematic/api/resources/components/types/CreateComponentRequestBodyEntityType.java b/src/main/java/com/schematic/api/resources/components/types/CreateComponentRequestBodyEntityType.java deleted file mode 100644 index b69f0b7..0000000 --- a/src/main/java/com/schematic/api/resources/components/types/CreateComponentRequestBodyEntityType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.components.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateComponentRequestBodyEntityType { - public static final CreateComponentRequestBodyEntityType BILLING = - new CreateComponentRequestBodyEntityType(Value.BILLING, "billing"); - - public static final CreateComponentRequestBodyEntityType ENTITLEMENT = - new CreateComponentRequestBodyEntityType(Value.ENTITLEMENT, "entitlement"); - - private final Value value; - - private final String string; - - CreateComponentRequestBodyEntityType(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 CreateComponentRequestBodyEntityType - && this.string.equals(((CreateComponentRequestBodyEntityType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case BILLING: - return visitor.visitBilling(); - case ENTITLEMENT: - return visitor.visitEntitlement(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateComponentRequestBodyEntityType valueOf(String value) { - switch (value) { - case "billing": - return BILLING; - case "entitlement": - return ENTITLEMENT; - default: - return new CreateComponentRequestBodyEntityType(Value.UNKNOWN, value); - } - } - - public enum Value { - ENTITLEMENT, - - BILLING, - - UNKNOWN - } - - public interface Visitor { - T visitEntitlement(); - - T visitBilling(); - - T visitUnknown(String unknownType); - } -} 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 2ffb7da..e23ea13 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java @@ -8,10 +8,10 @@ import com.schematic.api.resources.credits.requests.CountBillingCreditsGrantsRequest; import com.schematic.api.resources.credits.requests.CountBillingCreditsRequest; import com.schematic.api.resources.credits.requests.CountBillingPlanCreditGrantsRequest; +import com.schematic.api.resources.credits.requests.CountCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.CountCreditBundlesRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; @@ -22,12 +22,12 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; import com.schematic.api.resources.credits.types.CountBillingCreditsResponse; import com.schematic.api.resources.credits.types.CountBillingPlanCreditGrantsResponse; +import com.schematic.api.resources.credits.types.CountCompanyGrantsResponse; import com.schematic.api.resources.credits.types.CountCreditBundlesResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; @@ -49,6 +49,8 @@ import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; +import com.schematic.api.types.CreateBillingPlanCreditGrantRequestBody; +import com.schematic.api.types.UpdateBillingPlanCreditGrantRequestBody; import java.util.concurrent.CompletableFuture; public class AsyncCreditsClient { @@ -222,6 +224,19 @@ public CompletableFuture grantBillingCredi .thenApply(response -> response.body()); } + public CompletableFuture countCompanyGrants() { + return this.rawClient.countCompanyGrants().thenApply(response -> response.body()); + } + + public CompletableFuture countCompanyGrants(CountCompanyGrantsRequest request) { + return this.rawClient.countCompanyGrants(request).thenApply(response -> response.body()); + } + + public CompletableFuture countCompanyGrants( + CountCompanyGrantsRequest request, RequestOptions requestOptions) { + return this.rawClient.countCompanyGrants(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCompanyGrants() { return this.rawClient.listCompanyGrants().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 666c67d..3269a4c 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java @@ -20,10 +20,10 @@ import com.schematic.api.resources.credits.requests.CountBillingCreditsGrantsRequest; import com.schematic.api.resources.credits.requests.CountBillingCreditsRequest; import com.schematic.api.resources.credits.requests.CountBillingPlanCreditGrantsRequest; +import com.schematic.api.resources.credits.requests.CountCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.CountCreditBundlesRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; @@ -34,12 +34,12 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; import com.schematic.api.resources.credits.types.CountBillingCreditsResponse; import com.schematic.api.resources.credits.types.CountBillingPlanCreditGrantsResponse; +import com.schematic.api.resources.credits.types.CountCompanyGrantsResponse; import com.schematic.api.resources.credits.types.CountCreditBundlesResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; @@ -62,6 +62,8 @@ import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; import com.schematic.api.types.ApiError; +import com.schematic.api.types.CreateBillingPlanCreditGrantRequestBody; +import com.schematic.api.types.UpdateBillingPlanCreditGrantRequestBody; import java.io.IOException; import java.util.concurrent.CompletableFuture; import okhttp3.Call; @@ -1397,6 +1399,112 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> countCompanyGrants() { + return countCompanyGrants(CountCompanyGrantsRequest.builder().build()); + } + + public CompletableFuture> countCompanyGrants( + CountCompanyGrantsRequest request) { + return countCompanyGrants(request, null); + } + + public CompletableFuture> countCompanyGrants( + CountCompanyGrantsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("billing/credits/grants/company/count"); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDir().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "dir", request.getDir().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); + } + 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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CountCompanyGrantsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> listCompanyGrants() { return listCompanyGrants(ListCompanyGrantsRequest.builder().build()); } 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 7078b84..546a213 100644 --- a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java @@ -8,10 +8,10 @@ import com.schematic.api.resources.credits.requests.CountBillingCreditsGrantsRequest; import com.schematic.api.resources.credits.requests.CountBillingCreditsRequest; import com.schematic.api.resources.credits.requests.CountBillingPlanCreditGrantsRequest; +import com.schematic.api.resources.credits.requests.CountCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.CountCreditBundlesRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; @@ -22,12 +22,12 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; import com.schematic.api.resources.credits.types.CountBillingCreditsResponse; import com.schematic.api.resources.credits.types.CountBillingPlanCreditGrantsResponse; +import com.schematic.api.resources.credits.types.CountCompanyGrantsResponse; import com.schematic.api.resources.credits.types.CountCreditBundlesResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; @@ -49,6 +49,8 @@ import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantResponse; import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; +import com.schematic.api.types.CreateBillingPlanCreditGrantRequestBody; +import com.schematic.api.types.UpdateBillingPlanCreditGrantRequestBody; public class CreditsClient { protected final ClientOptions clientOptions; @@ -216,6 +218,19 @@ public GrantBillingCreditsToCompanyResponse grantBillingCreditsToCompany( .body(); } + public CountCompanyGrantsResponse countCompanyGrants() { + return this.rawClient.countCompanyGrants().body(); + } + + public CountCompanyGrantsResponse countCompanyGrants(CountCompanyGrantsRequest request) { + return this.rawClient.countCompanyGrants(request).body(); + } + + public CountCompanyGrantsResponse countCompanyGrants( + CountCompanyGrantsRequest request, RequestOptions requestOptions) { + return this.rawClient.countCompanyGrants(request, requestOptions).body(); + } + public ListCompanyGrantsResponse listCompanyGrants() { return this.rawClient.listCompanyGrants().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 6eb2d69..40c8014 100644 --- a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java @@ -20,10 +20,10 @@ import com.schematic.api.resources.credits.requests.CountBillingCreditsGrantsRequest; import com.schematic.api.resources.credits.requests.CountBillingCreditsRequest; import com.schematic.api.resources.credits.requests.CountBillingPlanCreditGrantsRequest; +import com.schematic.api.resources.credits.requests.CountCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.CountCreditBundlesRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.CreateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; import com.schematic.api.resources.credits.requests.CreateCreditBundleRequestBody; import com.schematic.api.resources.credits.requests.DeleteBillingPlanCreditGrantRequest; @@ -34,12 +34,12 @@ import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; -import com.schematic.api.resources.credits.requests.UpdateBillingPlanCreditGrantRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; import com.schematic.api.resources.credits.requests.ZeroOutGrantRequestBody; import com.schematic.api.resources.credits.types.CountBillingCreditsGrantsResponse; import com.schematic.api.resources.credits.types.CountBillingCreditsResponse; import com.schematic.api.resources.credits.types.CountBillingPlanCreditGrantsResponse; +import com.schematic.api.resources.credits.types.CountCompanyGrantsResponse; import com.schematic.api.resources.credits.types.CountCreditBundlesResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; @@ -62,6 +62,8 @@ import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsResponse; import com.schematic.api.resources.credits.types.ZeroOutGrantResponse; import com.schematic.api.types.ApiError; +import com.schematic.api.types.CreateBillingPlanCreditGrantRequestBody; +import com.schematic.api.types.UpdateBillingPlanCreditGrantRequestBody; import java.io.IOException; import okhttp3.Headers; import okhttp3.HttpUrl; @@ -1057,6 +1059,87 @@ public BaseSchematicHttpResponse grantBill } } + public BaseSchematicHttpResponse countCompanyGrants() { + return countCompanyGrants(CountCompanyGrantsRequest.builder().build()); + } + + public BaseSchematicHttpResponse countCompanyGrants(CountCompanyGrantsRequest request) { + return countCompanyGrants(request, null); + } + + public BaseSchematicHttpResponse countCompanyGrants( + CountCompanyGrantsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("billing/credits/grants/company/count"); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getOrder().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "order", request.getOrder().get(), false); + } + if (request.getDir().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "dir", request.getDir().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); + } + 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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountCompanyGrantsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse listCompanyGrants() { return listCompanyGrants(ListCompanyGrantsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetActiveDealsParams.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java similarity index 65% rename from src/main/java/com/schematic/api/resources/companies/types/GetActiveDealsParams.java rename to src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java index 4ca062e..bfb17dc 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetActiveDealsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.companies.types; +package com.schematic.api.resources.credits.requests; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,17 +12,21 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CreditGrantSortOrder; +import com.schematic.api.types.SortDirection; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = GetActiveDealsParams.Builder.class) -public final class GetActiveDealsParams { +@JsonDeserialize(builder = CountCompanyGrantsRequest.Builder.class) +public final class CountCompanyGrantsRequest { private final Optional companyId; - private final Optional dealStage; + private final Optional order; + + private final Optional dir; private final Optional limit; @@ -30,14 +34,16 @@ public final class GetActiveDealsParams { private final Map additionalProperties; - private GetActiveDealsParams( + private CountCompanyGrantsRequest( Optional companyId, - Optional dealStage, + Optional order, + Optional dir, Optional limit, Optional offset, Map additionalProperties) { this.companyId = companyId; - this.dealStage = dealStage; + this.order = order; + this.dir = dir; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -48,9 +54,14 @@ public Optional getCompanyId() { return companyId; } - @JsonProperty("deal_stage") - public Optional getDealStage() { - return dealStage; + @JsonProperty("order") + public Optional getOrder() { + return order; + } + + @JsonProperty("dir") + public Optional getDir() { + return dir; } /** @@ -72,7 +83,7 @@ public Optional getOffset() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof GetActiveDealsParams && equalTo((GetActiveDealsParams) other); + return other instanceof CountCompanyGrantsRequest && equalTo((CountCompanyGrantsRequest) other); } @JsonAnyGetter @@ -80,16 +91,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(GetActiveDealsParams other) { + private boolean equalTo(CountCompanyGrantsRequest other) { return companyId.equals(other.companyId) - && dealStage.equals(other.dealStage) + && order.equals(other.order) + && dir.equals(other.dir) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.dealStage, this.limit, this.offset); + return Objects.hash(this.companyId, this.order, this.dir, this.limit, this.offset); } @java.lang.Override @@ -105,7 +117,9 @@ public static Builder builder() { public static final class Builder { private Optional companyId = Optional.empty(); - private Optional dealStage = Optional.empty(); + private Optional order = Optional.empty(); + + private Optional dir = Optional.empty(); private Optional limit = Optional.empty(); @@ -116,9 +130,10 @@ public static final class Builder { private Builder() {} - public Builder from(GetActiveDealsParams other) { + public Builder from(CountCompanyGrantsRequest other) { companyId(other.getCompanyId()); - dealStage(other.getDealStage()); + order(other.getOrder()); + dir(other.getDir()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -135,14 +150,25 @@ public Builder companyId(String companyId) { return this; } - @JsonSetter(value = "deal_stage", nulls = Nulls.SKIP) - public Builder dealStage(Optional dealStage) { - this.dealStage = dealStage; + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(CreditGrantSortOrder order) { + this.order = Optional.ofNullable(order); + return this; + } + + @JsonSetter(value = "dir", nulls = Nulls.SKIP) + public Builder dir(Optional dir) { + this.dir = dir; return this; } - public Builder dealStage(String dealStage) { - this.dealStage = Optional.ofNullable(dealStage); + public Builder dir(SortDirection dir) { + this.dir = Optional.ofNullable(dir); return this; } @@ -174,8 +200,8 @@ public Builder offset(Integer offset) { return this; } - public GetActiveDealsParams build() { - return new GetActiveDealsParams(companyId, dealStage, limit, offset, additionalProperties); + public CountCompanyGrantsRequest build() { + return new CountCompanyGrantsRequest(companyId, order, dir, limit, offset, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditBundlesRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditBundlesRequest.java index c704107..6c6bfa3 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditBundlesRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditBundlesRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.CountCreditBundlesRequestStatus; +import com.schematic.api.types.BillingCreditBundleStatus; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -27,7 +27,7 @@ public final class CountCreditBundlesRequest { private final Optional creditId; - private final Optional status; + private final Optional status; private final Optional bundleType; @@ -40,7 +40,7 @@ public final class CountCreditBundlesRequest { private CountCreditBundlesRequest( Optional> ids, Optional creditId, - Optional status, + Optional status, Optional bundleType, Optional limit, Optional offset, @@ -65,7 +65,7 @@ public Optional getCreditId() { } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -130,7 +130,7 @@ public static final class Builder { private Optional creditId = Optional.empty(); - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); private Optional bundleType = Optional.empty(); @@ -181,12 +181,12 @@ public Builder creditId(String creditId) { } @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { + public Builder status(Optional status) { this.status = status; return this; } - public Builder status(CountCreditBundlesRequestStatus status) { + public Builder status(BillingCreditBundleStatus status) { this.status = Optional.ofNullable(status); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditLedgerRequest.java index be58ad7..c309efa 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditLedgerRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditLedgerRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.CountCreditLedgerRequestPeriod; +import com.schematic.api.types.CreditLedgerPeriod; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -28,7 +28,7 @@ public final class CountCreditLedgerRequest { private final Optional featureId; - private final CountCreditLedgerRequestPeriod period; + private final CreditLedgerPeriod period; private final Optional startTime; @@ -44,7 +44,7 @@ private CountCreditLedgerRequest( String companyId, Optional billingCreditId, Optional featureId, - CountCreditLedgerRequestPeriod period, + CreditLedgerPeriod period, Optional startTime, Optional endTime, Optional limit, @@ -77,7 +77,7 @@ public Optional getFeatureId() { } @JsonProperty("period") - public CountCreditLedgerRequestPeriod getPeriod() { + public CreditLedgerPeriod getPeriod() { return period; } @@ -158,7 +158,7 @@ public interface CompanyIdStage { } public interface PeriodStage { - _FinalStage period(@NotNull CountCreditLedgerRequestPeriod period); + _FinalStage period(@NotNull CreditLedgerPeriod period); } public interface _FinalStage { @@ -199,7 +199,7 @@ public interface _FinalStage { public static final class Builder implements CompanyIdStage, PeriodStage, _FinalStage { private String companyId; - private CountCreditLedgerRequestPeriod period; + private CreditLedgerPeriod period; private Optional offset = Optional.empty(); @@ -240,7 +240,7 @@ public PeriodStage companyId(@NotNull String companyId) { @java.lang.Override @JsonSetter("period") - public _FinalStage period(@NotNull CountCreditLedgerRequestPeriod period) { + public _FinalStage period(@NotNull CreditLedgerPeriod period) { this.period = Objects.requireNonNull(period, "period must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingCreditRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingCreditRequestBody.java index 8dc353f..3c072e9 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingCreditRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingCreditRequestBody.java @@ -12,8 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.CreateBillingCreditRequestBodyBurnStrategy; -import com.schematic.api.resources.credits.types.CreateBillingCreditRequestBodyDefaultRolloverPolicy; +import com.schematic.api.types.BillingCreditBurnStrategy; +import com.schematic.api.types.BillingCreditExpiryUnit; +import com.schematic.api.types.BillingCreditRolloverPolicy; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,15 +24,15 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateBillingCreditRequestBody.Builder.class) public final class CreateBillingCreditRequestBody { - private final Optional burnStrategy; + private final Optional burnStrategy; private final String currency; - private final Optional defaultExpiryUnit; + private final Optional defaultExpiryUnit; private final Optional defaultExpiryUnitCount; - private final Optional defaultRolloverPolicy; + private final Optional defaultRolloverPolicy; private final String description; @@ -50,11 +51,11 @@ public final class CreateBillingCreditRequestBody { private final Map additionalProperties; private CreateBillingCreditRequestBody( - Optional burnStrategy, + Optional burnStrategy, String currency, - Optional defaultExpiryUnit, + Optional defaultExpiryUnit, Optional defaultExpiryUnitCount, - Optional defaultRolloverPolicy, + Optional defaultRolloverPolicy, String description, Optional icon, String name, @@ -79,7 +80,7 @@ private CreateBillingCreditRequestBody( } @JsonProperty("burn_strategy") - public Optional getBurnStrategy() { + public Optional getBurnStrategy() { return burnStrategy; } @@ -89,7 +90,7 @@ public String getCurrency() { } @JsonProperty("default_expiry_unit") - public Optional getDefaultExpiryUnit() { + public Optional getDefaultExpiryUnit() { return defaultExpiryUnit; } @@ -99,7 +100,7 @@ public Optional getDefaultExpiryUnitCount() { } @JsonProperty("default_rollover_policy") - public Optional getDefaultRolloverPolicy() { + public Optional getDefaultRolloverPolicy() { return defaultRolloverPolicy; } @@ -207,22 +208,21 @@ public interface NameStage { public interface _FinalStage { CreateBillingCreditRequestBody build(); - _FinalStage burnStrategy(Optional burnStrategy); + _FinalStage burnStrategy(Optional burnStrategy); - _FinalStage burnStrategy(CreateBillingCreditRequestBodyBurnStrategy burnStrategy); + _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy); - _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit); + _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit); - _FinalStage defaultExpiryUnit(String defaultExpiryUnit); + _FinalStage defaultExpiryUnit(BillingCreditExpiryUnit defaultExpiryUnit); _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount); - _FinalStage defaultRolloverPolicy( - Optional defaultRolloverPolicy); + _FinalStage defaultRolloverPolicy(Optional defaultRolloverPolicy); - _FinalStage defaultRolloverPolicy(CreateBillingCreditRequestBodyDefaultRolloverPolicy defaultRolloverPolicy); + _FinalStage defaultRolloverPolicy(BillingCreditRolloverPolicy defaultRolloverPolicy); _FinalStage icon(Optional icon); @@ -263,13 +263,13 @@ public static final class Builder implements CurrencyStage, DescriptionStage, Na private Optional icon = Optional.empty(); - private Optional defaultRolloverPolicy = Optional.empty(); + private Optional defaultRolloverPolicy = Optional.empty(); private Optional defaultExpiryUnitCount = Optional.empty(); - private Optional defaultExpiryUnit = Optional.empty(); + private Optional defaultExpiryUnit = Optional.empty(); - private Optional burnStrategy = Optional.empty(); + private Optional burnStrategy = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -380,16 +380,14 @@ public _FinalStage icon(Optional icon) { } @java.lang.Override - public _FinalStage defaultRolloverPolicy( - CreateBillingCreditRequestBodyDefaultRolloverPolicy defaultRolloverPolicy) { + public _FinalStage defaultRolloverPolicy(BillingCreditRolloverPolicy defaultRolloverPolicy) { this.defaultRolloverPolicy = Optional.ofNullable(defaultRolloverPolicy); return this; } @java.lang.Override @JsonSetter(value = "default_rollover_policy", nulls = Nulls.SKIP) - public _FinalStage defaultRolloverPolicy( - Optional defaultRolloverPolicy) { + public _FinalStage defaultRolloverPolicy(Optional defaultRolloverPolicy) { this.defaultRolloverPolicy = defaultRolloverPolicy; return this; } @@ -408,27 +406,27 @@ public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCou } @java.lang.Override - public _FinalStage defaultExpiryUnit(String defaultExpiryUnit) { + public _FinalStage defaultExpiryUnit(BillingCreditExpiryUnit defaultExpiryUnit) { this.defaultExpiryUnit = Optional.ofNullable(defaultExpiryUnit); return this; } @java.lang.Override @JsonSetter(value = "default_expiry_unit", nulls = Nulls.SKIP) - public _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit) { + public _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit) { this.defaultExpiryUnit = defaultExpiryUnit; return this; } @java.lang.Override - public _FinalStage burnStrategy(CreateBillingCreditRequestBodyBurnStrategy burnStrategy) { + public _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy) { this.burnStrategy = Optional.ofNullable(burnStrategy); return this; } @java.lang.Override @JsonSetter(value = "burn_strategy", nulls = Nulls.SKIP) - public _FinalStage burnStrategy(Optional burnStrategy) { + public _FinalStage burnStrategy(Optional burnStrategy) { this.burnStrategy = burnStrategy; return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java deleted file mode 100644 index 25feca8..0000000 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingPlanCreditGrantRequestBody.java +++ /dev/null @@ -1,380 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantRequestBodyExpiryType; -import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantRequestBodyExpiryUnit; -import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantRequestBodyResetCadence; -import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantRequestBodyResetStart; -import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantRequestBodyResetType; -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 = CreateBillingPlanCreditGrantRequestBody.Builder.class) -public final class CreateBillingPlanCreditGrantRequestBody { - private final Optional applyToExisting; - - private final int creditAmount; - - private final String creditId; - - private final Optional expiryType; - - private final Optional expiryUnit; - - private final Optional expiryUnitCount; - - private final String planId; - - private final CreateBillingPlanCreditGrantRequestBodyResetCadence resetCadence; - - private final CreateBillingPlanCreditGrantRequestBodyResetStart resetStart; - - private final Optional resetType; - - private final Map additionalProperties; - - private CreateBillingPlanCreditGrantRequestBody( - Optional applyToExisting, - int creditAmount, - String creditId, - Optional expiryType, - Optional expiryUnit, - Optional expiryUnitCount, - String planId, - CreateBillingPlanCreditGrantRequestBodyResetCadence resetCadence, - CreateBillingPlanCreditGrantRequestBodyResetStart resetStart, - Optional resetType, - Map additionalProperties) { - this.applyToExisting = applyToExisting; - this.creditAmount = creditAmount; - this.creditId = creditId; - this.expiryType = expiryType; - this.expiryUnit = expiryUnit; - this.expiryUnitCount = expiryUnitCount; - this.planId = planId; - this.resetCadence = resetCadence; - this.resetStart = resetStart; - this.resetType = resetType; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("apply_to_existing") - public Optional getApplyToExisting() { - return applyToExisting; - } - - @JsonProperty("credit_amount") - public int getCreditAmount() { - return creditAmount; - } - - @JsonProperty("credit_id") - public String getCreditId() { - return creditId; - } - - @JsonProperty("expiry_type") - public Optional getExpiryType() { - return expiryType; - } - - @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { - return expiryUnit; - } - - @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { - return expiryUnitCount; - } - - @JsonProperty("plan_id") - public String getPlanId() { - return planId; - } - - @JsonProperty("reset_cadence") - public CreateBillingPlanCreditGrantRequestBodyResetCadence getResetCadence() { - return resetCadence; - } - - @JsonProperty("reset_start") - public CreateBillingPlanCreditGrantRequestBodyResetStart getResetStart() { - return resetStart; - } - - @JsonProperty("reset_type") - public Optional getResetType() { - return resetType; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateBillingPlanCreditGrantRequestBody - && equalTo((CreateBillingPlanCreditGrantRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { - return applyToExisting.equals(other.applyToExisting) - && creditAmount == other.creditAmount - && creditId.equals(other.creditId) - && expiryType.equals(other.expiryType) - && expiryUnit.equals(other.expiryUnit) - && expiryUnitCount.equals(other.expiryUnitCount) - && planId.equals(other.planId) - && resetCadence.equals(other.resetCadence) - && resetStart.equals(other.resetStart) - && resetType.equals(other.resetType); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.applyToExisting, - this.creditAmount, - this.creditId, - this.expiryType, - this.expiryUnit, - this.expiryUnitCount, - this.planId, - this.resetCadence, - this.resetStart, - this.resetType); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static CreditAmountStage builder() { - return new Builder(); - } - - public interface CreditAmountStage { - CreditIdStage creditAmount(int creditAmount); - - Builder from(CreateBillingPlanCreditGrantRequestBody other); - } - - public interface CreditIdStage { - PlanIdStage creditId(@NotNull String creditId); - } - - public interface PlanIdStage { - ResetCadenceStage planId(@NotNull String planId); - } - - public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull CreateBillingPlanCreditGrantRequestBodyResetCadence resetCadence); - } - - public interface ResetStartStage { - _FinalStage resetStart(@NotNull CreateBillingPlanCreditGrantRequestBodyResetStart resetStart); - } - - public interface _FinalStage { - CreateBillingPlanCreditGrantRequestBody build(); - - _FinalStage applyToExisting(Optional applyToExisting); - - _FinalStage applyToExisting(Boolean applyToExisting); - - _FinalStage expiryType(Optional expiryType); - - _FinalStage expiryType(CreateBillingPlanCreditGrantRequestBodyExpiryType expiryType); - - _FinalStage expiryUnit(Optional expiryUnit); - - _FinalStage expiryUnit(CreateBillingPlanCreditGrantRequestBodyExpiryUnit expiryUnit); - - _FinalStage expiryUnitCount(Optional expiryUnitCount); - - _FinalStage expiryUnitCount(Integer expiryUnitCount); - - _FinalStage resetType(Optional resetType); - - _FinalStage resetType(CreateBillingPlanCreditGrantRequestBodyResetType resetType); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements CreditAmountStage, CreditIdStage, PlanIdStage, ResetCadenceStage, ResetStartStage, _FinalStage { - private int creditAmount; - - private String creditId; - - private String planId; - - private CreateBillingPlanCreditGrantRequestBodyResetCadence resetCadence; - - private CreateBillingPlanCreditGrantRequestBodyResetStart resetStart; - - private Optional resetType = Optional.empty(); - - private Optional expiryUnitCount = Optional.empty(); - - private Optional expiryUnit = Optional.empty(); - - private Optional expiryType = Optional.empty(); - - private Optional applyToExisting = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateBillingPlanCreditGrantRequestBody other) { - applyToExisting(other.getApplyToExisting()); - creditAmount(other.getCreditAmount()); - creditId(other.getCreditId()); - expiryType(other.getExpiryType()); - expiryUnit(other.getExpiryUnit()); - expiryUnitCount(other.getExpiryUnitCount()); - planId(other.getPlanId()); - resetCadence(other.getResetCadence()); - resetStart(other.getResetStart()); - resetType(other.getResetType()); - return this; - } - - @java.lang.Override - @JsonSetter("credit_amount") - public CreditIdStage creditAmount(int creditAmount) { - this.creditAmount = creditAmount; - return this; - } - - @java.lang.Override - @JsonSetter("credit_id") - public PlanIdStage creditId(@NotNull String creditId) { - this.creditId = Objects.requireNonNull(creditId, "creditId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("plan_id") - public ResetCadenceStage planId(@NotNull String planId) { - this.planId = Objects.requireNonNull(planId, "planId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("reset_cadence") - public ResetStartStage resetCadence(@NotNull CreateBillingPlanCreditGrantRequestBodyResetCadence resetCadence) { - this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("reset_start") - public _FinalStage resetStart(@NotNull CreateBillingPlanCreditGrantRequestBodyResetStart resetStart) { - this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage resetType(CreateBillingPlanCreditGrantRequestBodyResetType resetType) { - this.resetType = Optional.ofNullable(resetType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) - public _FinalStage resetType(Optional resetType) { - this.resetType = resetType; - return this; - } - - @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { - this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); - return this; - } - - @java.lang.Override - @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { - this.expiryUnitCount = expiryUnitCount; - return this; - } - - @java.lang.Override - public _FinalStage expiryUnit(CreateBillingPlanCreditGrantRequestBodyExpiryUnit expiryUnit) { - this.expiryUnit = Optional.ofNullable(expiryUnit); - return this; - } - - @java.lang.Override - @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { - this.expiryUnit = expiryUnit; - return this; - } - - @java.lang.Override - public _FinalStage expiryType(CreateBillingPlanCreditGrantRequestBodyExpiryType expiryType) { - this.expiryType = Optional.ofNullable(expiryType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { - this.expiryType = expiryType; - return this; - } - - @java.lang.Override - public _FinalStage applyToExisting(Boolean applyToExisting) { - this.applyToExisting = Optional.ofNullable(applyToExisting); - return this; - } - - @java.lang.Override - @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) - public _FinalStage applyToExisting(Optional applyToExisting) { - this.applyToExisting = applyToExisting; - return this; - } - - @java.lang.Override - public CreateBillingPlanCreditGrantRequestBody build() { - return new CreateBillingPlanCreditGrantRequestBody( - applyToExisting, - creditAmount, - creditId, - expiryType, - expiryUnit, - expiryUnitCount, - planId, - resetCadence, - resetStart, - resetType, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateCompanyCreditGrant.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateCompanyCreditGrant.java index 9307cdc..d675397 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateCompanyCreditGrant.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CreateCompanyCreditGrant.java @@ -12,8 +12,10 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.CreateCompanyCreditGrantExpiryType; -import com.schematic.api.resources.credits.types.CreateCompanyCreditGrantExpiryUnit; +import com.schematic.api.types.BillingCreditExpiryType; +import com.schematic.api.types.BillingCreditExpiryUnit; +import com.schematic.api.types.BillingCreditGrantReason; +import com.schematic.api.types.BillingPlanCreditGrantResetStart; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -32,15 +34,19 @@ public final class CreateCompanyCreditGrant { private final Optional expiresAt; - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; private final int quantity; - private final String reason; + private final BillingCreditGrantReason reason; + + private final Optional renewalEnabled; + + private final Optional renewalPeriod; private final Map additionalProperties; @@ -49,11 +55,13 @@ private CreateCompanyCreditGrant( String companyId, String creditId, Optional expiresAt, - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, int quantity, - String reason, + BillingCreditGrantReason reason, + Optional renewalEnabled, + Optional renewalPeriod, Map additionalProperties) { this.billingPeriodsCount = billingPeriodsCount; this.companyId = companyId; @@ -64,6 +72,8 @@ private CreateCompanyCreditGrant( this.expiryUnitCount = expiryUnitCount; this.quantity = quantity; this.reason = reason; + this.renewalEnabled = renewalEnabled; + this.renewalPeriod = renewalPeriod; this.additionalProperties = additionalProperties; } @@ -88,12 +98,12 @@ public Optional getExpiresAt() { } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -108,10 +118,20 @@ public int getQuantity() { } @JsonProperty("reason") - public String getReason() { + public BillingCreditGrantReason getReason() { return reason; } + @JsonProperty("renewal_enabled") + public Optional getRenewalEnabled() { + return renewalEnabled; + } + + @JsonProperty("renewal_period") + public Optional getRenewalPeriod() { + return renewalPeriod; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -132,7 +152,9 @@ private boolean equalTo(CreateCompanyCreditGrant other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && quantity == other.quantity - && reason.equals(other.reason); + && reason.equals(other.reason) + && renewalEnabled.equals(other.renewalEnabled) + && renewalPeriod.equals(other.renewalPeriod); } @java.lang.Override @@ -146,7 +168,9 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.quantity, - this.reason); + this.reason, + this.renewalEnabled, + this.renewalPeriod); } @java.lang.Override @@ -173,7 +197,7 @@ public interface QuantityStage { } public interface ReasonStage { - _FinalStage reason(@NotNull String reason); + _FinalStage reason(@NotNull BillingCreditGrantReason reason); } public interface _FinalStage { @@ -187,17 +211,25 @@ public interface _FinalStage { _FinalStage expiresAt(OffsetDateTime expiresAt); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(CreateCompanyCreditGrantExpiryType expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(CreateCompanyCreditGrantExpiryUnit expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); _FinalStage expiryUnitCount(Integer expiryUnitCount); + + _FinalStage renewalEnabled(Optional renewalEnabled); + + _FinalStage renewalEnabled(Boolean renewalEnabled); + + _FinalStage renewalPeriod(Optional renewalPeriod); + + _FinalStage renewalPeriod(BillingPlanCreditGrantResetStart renewalPeriod); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -209,13 +241,17 @@ public static final class Builder private int quantity; - private String reason; + private BillingCreditGrantReason reason; + + private Optional renewalPeriod = Optional.empty(); + + private Optional renewalEnabled = Optional.empty(); private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); private Optional expiresAt = Optional.empty(); @@ -237,6 +273,8 @@ public Builder from(CreateCompanyCreditGrant other) { expiryUnitCount(other.getExpiryUnitCount()); quantity(other.getQuantity()); reason(other.getReason()); + renewalEnabled(other.getRenewalEnabled()); + renewalPeriod(other.getRenewalPeriod()); return this; } @@ -263,11 +301,37 @@ public ReasonStage quantity(int quantity) { @java.lang.Override @JsonSetter("reason") - public _FinalStage reason(@NotNull String reason) { + public _FinalStage reason(@NotNull BillingCreditGrantReason reason) { this.reason = Objects.requireNonNull(reason, "reason must not be null"); return this; } + @java.lang.Override + public _FinalStage renewalPeriod(BillingPlanCreditGrantResetStart renewalPeriod) { + this.renewalPeriod = Optional.ofNullable(renewalPeriod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_period", nulls = Nulls.SKIP) + public _FinalStage renewalPeriod(Optional renewalPeriod) { + this.renewalPeriod = renewalPeriod; + return this; + } + + @java.lang.Override + public _FinalStage renewalEnabled(Boolean renewalEnabled) { + this.renewalEnabled = Optional.ofNullable(renewalEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_enabled", nulls = Nulls.SKIP) + public _FinalStage renewalEnabled(Optional renewalEnabled) { + this.renewalEnabled = renewalEnabled; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Integer expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -282,27 +346,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(CreateCompanyCreditGrantExpiryUnit expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(CreateCompanyCreditGrantExpiryType expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } @@ -345,6 +409,8 @@ public CreateCompanyCreditGrant build() { expiryUnitCount, quantity, reason, + renewalEnabled, + renewalPeriod, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java index cf6be9f..d2e5dde 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java @@ -12,9 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.CreateCreditBundleRequestBodyExpiryType; -import com.schematic.api.resources.credits.types.CreateCreditBundleRequestBodyExpiryUnit; -import com.schematic.api.resources.credits.types.CreateCreditBundleRequestBodyStatus; +import com.schematic.api.types.BillingCreditBundleStatus; +import com.schematic.api.types.BillingCreditExpiryType; +import com.schematic.api.types.BillingCreditExpiryUnit; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -32,9 +32,9 @@ public final class CreateCreditBundleRequestBody { private final String currency; - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; @@ -44,7 +44,7 @@ public final class CreateCreditBundleRequestBody { private final Optional quantity; - private final Optional status; + private final Optional status; private final Map additionalProperties; @@ -53,13 +53,13 @@ private CreateCreditBundleRequestBody( Optional bundleType, String creditId, String currency, - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, int pricePerUnit, Optional pricePerUnitDecimal, Optional quantity, - Optional status, + Optional status, Map additionalProperties) { this.bundleName = bundleName; this.bundleType = bundleType; @@ -96,12 +96,12 @@ public String getCurrency() { } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -126,7 +126,7 @@ public Optional getQuantity() { } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -205,13 +205,13 @@ public interface _FinalStage { _FinalStage bundleType(String bundleType); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(CreateCreditBundleRequestBodyExpiryType expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(CreateCreditBundleRequestBodyExpiryUnit expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); @@ -225,9 +225,9 @@ public interface _FinalStage { _FinalStage quantity(Integer quantity); - _FinalStage status(Optional status); + _FinalStage status(Optional status); - _FinalStage status(CreateCreditBundleRequestBodyStatus status); + _FinalStage status(BillingCreditBundleStatus status); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -241,7 +241,7 @@ public static final class Builder private int pricePerUnit; - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); private Optional quantity = Optional.empty(); @@ -249,9 +249,9 @@ public static final class Builder private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); private Optional bundleType = Optional.empty(); @@ -305,14 +305,14 @@ public _FinalStage pricePerUnit(int pricePerUnit) { } @java.lang.Override - public _FinalStage status(CreateCreditBundleRequestBodyStatus status) { + public _FinalStage status(BillingCreditBundleStatus status) { this.status = Optional.ofNullable(status); return this; } @java.lang.Override @JsonSetter(value = "status", nulls = Nulls.SKIP) - public _FinalStage status(Optional status) { + public _FinalStage status(Optional status) { this.status = status; return this; } @@ -357,27 +357,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(CreateCreditBundleRequestBodyExpiryUnit expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(CreateCreditBundleRequestBodyExpiryType expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/GetEnrichedCreditLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/GetEnrichedCreditLedgerRequest.java index 5c87973..f153410 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/GetEnrichedCreditLedgerRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/GetEnrichedCreditLedgerRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.GetEnrichedCreditLedgerRequestPeriod; +import com.schematic.api.types.CreditLedgerPeriod; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -28,7 +28,7 @@ public final class GetEnrichedCreditLedgerRequest { private final Optional featureId; - private final GetEnrichedCreditLedgerRequestPeriod period; + private final CreditLedgerPeriod period; private final Optional startTime; @@ -44,7 +44,7 @@ private GetEnrichedCreditLedgerRequest( String companyId, Optional billingCreditId, Optional featureId, - GetEnrichedCreditLedgerRequestPeriod period, + CreditLedgerPeriod period, Optional startTime, Optional endTime, Optional limit, @@ -77,7 +77,7 @@ public Optional getFeatureId() { } @JsonProperty("period") - public GetEnrichedCreditLedgerRequestPeriod getPeriod() { + public CreditLedgerPeriod getPeriod() { return period; } @@ -158,7 +158,7 @@ public interface CompanyIdStage { } public interface PeriodStage { - _FinalStage period(@NotNull GetEnrichedCreditLedgerRequestPeriod period); + _FinalStage period(@NotNull CreditLedgerPeriod period); } public interface _FinalStage { @@ -199,7 +199,7 @@ public interface _FinalStage { public static final class Builder implements CompanyIdStage, PeriodStage, _FinalStage { private String companyId; - private GetEnrichedCreditLedgerRequestPeriod period; + private CreditLedgerPeriod period; private Optional offset = Optional.empty(); @@ -240,7 +240,7 @@ public PeriodStage companyId(@NotNull String companyId) { @java.lang.Override @JsonSetter("period") - public _FinalStage period(@NotNull GetEnrichedCreditLedgerRequestPeriod period) { + public _FinalStage period(@NotNull CreditLedgerPeriod period) { this.period = Objects.requireNonNull(period, "period must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java index fd1849b..d84e693 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java @@ -12,8 +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.resources.credits.types.ListCompanyGrantsRequestDir; -import com.schematic.api.resources.credits.types.ListCompanyGrantsRequestOrder; +import com.schematic.api.types.CreditGrantSortOrder; +import com.schematic.api.types.SortDirection; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -24,9 +24,9 @@ public final class ListCompanyGrantsRequest { private final Optional companyId; - private final Optional order; + private final Optional order; - private final Optional dir; + private final Optional dir; private final Optional limit; @@ -36,8 +36,8 @@ public final class ListCompanyGrantsRequest { private ListCompanyGrantsRequest( Optional companyId, - Optional order, - Optional dir, + Optional order, + Optional dir, Optional limit, Optional offset, Map additionalProperties) { @@ -55,12 +55,12 @@ public Optional getCompanyId() { } @JsonProperty("order") - public Optional getOrder() { + public Optional getOrder() { return order; } @JsonProperty("dir") - public Optional getDir() { + public Optional getDir() { return dir; } @@ -117,9 +117,9 @@ public static Builder builder() { public static final class Builder { private Optional companyId = Optional.empty(); - private Optional order = Optional.empty(); + private Optional order = Optional.empty(); - private Optional dir = Optional.empty(); + private Optional dir = Optional.empty(); private Optional limit = Optional.empty(); @@ -151,23 +151,23 @@ public Builder companyId(String companyId) { } @JsonSetter(value = "order", nulls = Nulls.SKIP) - public Builder order(Optional order) { + public Builder order(Optional order) { this.order = order; return this; } - public Builder order(ListCompanyGrantsRequestOrder order) { + public Builder order(CreditGrantSortOrder order) { this.order = Optional.ofNullable(order); return this; } @JsonSetter(value = "dir", nulls = Nulls.SKIP) - public Builder dir(Optional dir) { + public Builder dir(Optional dir) { this.dir = dir; return this; } - public Builder dir(ListCompanyGrantsRequestDir dir) { + public Builder dir(SortDirection dir) { this.dir = Optional.ofNullable(dir); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListCreditBundlesRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditBundlesRequest.java index 150f735..1e281c7 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListCreditBundlesRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditBundlesRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.ListCreditBundlesRequestStatus; +import com.schematic.api.types.BillingCreditBundleStatus; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -27,7 +27,7 @@ public final class ListCreditBundlesRequest { private final Optional creditId; - private final Optional status; + private final Optional status; private final Optional bundleType; @@ -40,7 +40,7 @@ public final class ListCreditBundlesRequest { private ListCreditBundlesRequest( Optional> ids, Optional creditId, - Optional status, + Optional status, Optional bundleType, Optional limit, Optional offset, @@ -65,7 +65,7 @@ public Optional getCreditId() { } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -130,7 +130,7 @@ public static final class Builder { private Optional creditId = Optional.empty(); - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); private Optional bundleType = Optional.empty(); @@ -181,12 +181,12 @@ public Builder creditId(String creditId) { } @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { + public Builder status(Optional status) { this.status = status; return this; } - public Builder status(ListCreditBundlesRequestStatus status) { + public Builder status(BillingCreditBundleStatus status) { this.status = Optional.ofNullable(status); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingCreditRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingCreditRequestBody.java index cb7fea2..35b8c5b 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingCreditRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingCreditRequestBody.java @@ -12,8 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.UpdateBillingCreditRequestBodyBurnStrategy; -import com.schematic.api.resources.credits.types.UpdateBillingCreditRequestBodyDefaultRolloverPolicy; +import com.schematic.api.types.BillingCreditBurnStrategy; +import com.schematic.api.types.BillingCreditExpiryUnit; +import com.schematic.api.types.BillingCreditRolloverPolicy; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,13 +24,13 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpdateBillingCreditRequestBody.Builder.class) public final class UpdateBillingCreditRequestBody { - private final Optional burnStrategy; + private final Optional burnStrategy; - private final Optional defaultExpiryUnit; + private final Optional defaultExpiryUnit; private final Optional defaultExpiryUnitCount; - private final Optional defaultRolloverPolicy; + private final Optional defaultRolloverPolicy; private final String description; @@ -48,10 +49,10 @@ public final class UpdateBillingCreditRequestBody { private final Map additionalProperties; private UpdateBillingCreditRequestBody( - Optional burnStrategy, - Optional defaultExpiryUnit, + Optional burnStrategy, + Optional defaultExpiryUnit, Optional defaultExpiryUnitCount, - Optional defaultRolloverPolicy, + Optional defaultRolloverPolicy, String description, Optional icon, String name, @@ -75,12 +76,12 @@ private UpdateBillingCreditRequestBody( } @JsonProperty("burn_strategy") - public Optional getBurnStrategy() { + public Optional getBurnStrategy() { return burnStrategy; } @JsonProperty("default_expiry_unit") - public Optional getDefaultExpiryUnit() { + public Optional getDefaultExpiryUnit() { return defaultExpiryUnit; } @@ -90,7 +91,7 @@ public Optional getDefaultExpiryUnitCount() { } @JsonProperty("default_rollover_policy") - public Optional getDefaultRolloverPolicy() { + public Optional getDefaultRolloverPolicy() { return defaultRolloverPolicy; } @@ -192,22 +193,21 @@ public interface NameStage { public interface _FinalStage { UpdateBillingCreditRequestBody build(); - _FinalStage burnStrategy(Optional burnStrategy); + _FinalStage burnStrategy(Optional burnStrategy); - _FinalStage burnStrategy(UpdateBillingCreditRequestBodyBurnStrategy burnStrategy); + _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy); - _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit); + _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit); - _FinalStage defaultExpiryUnit(String defaultExpiryUnit); + _FinalStage defaultExpiryUnit(BillingCreditExpiryUnit defaultExpiryUnit); _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount); - _FinalStage defaultRolloverPolicy( - Optional defaultRolloverPolicy); + _FinalStage defaultRolloverPolicy(Optional defaultRolloverPolicy); - _FinalStage defaultRolloverPolicy(UpdateBillingCreditRequestBodyDefaultRolloverPolicy defaultRolloverPolicy); + _FinalStage defaultRolloverPolicy(BillingCreditRolloverPolicy defaultRolloverPolicy); _FinalStage icon(Optional icon); @@ -246,13 +246,13 @@ public static final class Builder implements DescriptionStage, NameStage, _Final private Optional icon = Optional.empty(); - private Optional defaultRolloverPolicy = Optional.empty(); + private Optional defaultRolloverPolicy = Optional.empty(); private Optional defaultExpiryUnitCount = Optional.empty(); - private Optional defaultExpiryUnit = Optional.empty(); + private Optional defaultExpiryUnit = Optional.empty(); - private Optional burnStrategy = Optional.empty(); + private Optional burnStrategy = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -355,16 +355,14 @@ public _FinalStage icon(Optional icon) { } @java.lang.Override - public _FinalStage defaultRolloverPolicy( - UpdateBillingCreditRequestBodyDefaultRolloverPolicy defaultRolloverPolicy) { + public _FinalStage defaultRolloverPolicy(BillingCreditRolloverPolicy defaultRolloverPolicy) { this.defaultRolloverPolicy = Optional.ofNullable(defaultRolloverPolicy); return this; } @java.lang.Override @JsonSetter(value = "default_rollover_policy", nulls = Nulls.SKIP) - public _FinalStage defaultRolloverPolicy( - Optional defaultRolloverPolicy) { + public _FinalStage defaultRolloverPolicy(Optional defaultRolloverPolicy) { this.defaultRolloverPolicy = defaultRolloverPolicy; return this; } @@ -383,27 +381,27 @@ public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCou } @java.lang.Override - public _FinalStage defaultExpiryUnit(String defaultExpiryUnit) { + public _FinalStage defaultExpiryUnit(BillingCreditExpiryUnit defaultExpiryUnit) { this.defaultExpiryUnit = Optional.ofNullable(defaultExpiryUnit); return this; } @java.lang.Override @JsonSetter(value = "default_expiry_unit", nulls = Nulls.SKIP) - public _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit) { + public _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit) { this.defaultExpiryUnit = defaultExpiryUnit; return this; } @java.lang.Override - public _FinalStage burnStrategy(UpdateBillingCreditRequestBodyBurnStrategy burnStrategy) { + public _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy) { this.burnStrategy = Optional.ofNullable(burnStrategy); return this; } @java.lang.Override @JsonSetter(value = "burn_strategy", nulls = Nulls.SKIP) - public _FinalStage burnStrategy(Optional burnStrategy) { + public _FinalStage burnStrategy(Optional burnStrategy) { this.burnStrategy = burnStrategy; return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingPlanCreditGrantRequestBody.java deleted file mode 100644 index 9c4eb31..0000000 --- a/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingPlanCreditGrantRequestBody.java +++ /dev/null @@ -1,333 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyExpiryType; -import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyExpiryUnit; -import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyResetCadence; -import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyResetStart; -import com.schematic.api.resources.credits.types.UpdateBillingPlanCreditGrantRequestBodyResetType; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpdateBillingPlanCreditGrantRequestBody.Builder.class) -public final class UpdateBillingPlanCreditGrantRequestBody { - private final Optional applyToExisting; - - private final Optional creditAmount; - - private final Optional expiryType; - - private final Optional expiryUnit; - - private final Optional expiryUnitCount; - - private final UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence; - - private final UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart; - - private final Optional resetType; - - private final Map additionalProperties; - - private UpdateBillingPlanCreditGrantRequestBody( - Optional applyToExisting, - Optional creditAmount, - Optional expiryType, - Optional expiryUnit, - Optional expiryUnitCount, - UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence, - UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart, - Optional resetType, - Map additionalProperties) { - this.applyToExisting = applyToExisting; - this.creditAmount = creditAmount; - this.expiryType = expiryType; - this.expiryUnit = expiryUnit; - this.expiryUnitCount = expiryUnitCount; - this.resetCadence = resetCadence; - this.resetStart = resetStart; - this.resetType = resetType; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("apply_to_existing") - public Optional getApplyToExisting() { - return applyToExisting; - } - - @JsonProperty("credit_amount") - public Optional getCreditAmount() { - return creditAmount; - } - - @JsonProperty("expiry_type") - public Optional getExpiryType() { - return expiryType; - } - - @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { - return expiryUnit; - } - - @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { - return expiryUnitCount; - } - - @JsonProperty("reset_cadence") - public UpdateBillingPlanCreditGrantRequestBodyResetCadence getResetCadence() { - return resetCadence; - } - - @JsonProperty("reset_start") - public UpdateBillingPlanCreditGrantRequestBodyResetStart getResetStart() { - return resetStart; - } - - @JsonProperty("reset_type") - public Optional getResetType() { - return resetType; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateBillingPlanCreditGrantRequestBody - && equalTo((UpdateBillingPlanCreditGrantRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { - return applyToExisting.equals(other.applyToExisting) - && creditAmount.equals(other.creditAmount) - && expiryType.equals(other.expiryType) - && expiryUnit.equals(other.expiryUnit) - && expiryUnitCount.equals(other.expiryUnitCount) - && resetCadence.equals(other.resetCadence) - && resetStart.equals(other.resetStart) - && resetType.equals(other.resetType); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.applyToExisting, - this.creditAmount, - this.expiryType, - this.expiryUnit, - this.expiryUnitCount, - this.resetCadence, - this.resetStart, - this.resetType); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ResetCadenceStage builder() { - return new Builder(); - } - - public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence); - - Builder from(UpdateBillingPlanCreditGrantRequestBody other); - } - - public interface ResetStartStage { - _FinalStage resetStart(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart); - } - - public interface _FinalStage { - UpdateBillingPlanCreditGrantRequestBody build(); - - _FinalStage applyToExisting(Optional applyToExisting); - - _FinalStage applyToExisting(Boolean applyToExisting); - - _FinalStage creditAmount(Optional creditAmount); - - _FinalStage creditAmount(Integer creditAmount); - - _FinalStage expiryType(Optional expiryType); - - _FinalStage expiryType(UpdateBillingPlanCreditGrantRequestBodyExpiryType expiryType); - - _FinalStage expiryUnit(Optional expiryUnit); - - _FinalStage expiryUnit(UpdateBillingPlanCreditGrantRequestBodyExpiryUnit expiryUnit); - - _FinalStage expiryUnitCount(Optional expiryUnitCount); - - _FinalStage expiryUnitCount(Integer expiryUnitCount); - - _FinalStage resetType(Optional resetType); - - _FinalStage resetType(UpdateBillingPlanCreditGrantRequestBodyResetType resetType); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ResetCadenceStage, ResetStartStage, _FinalStage { - private UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence; - - private UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart; - - private Optional resetType = Optional.empty(); - - private Optional expiryUnitCount = Optional.empty(); - - private Optional expiryUnit = Optional.empty(); - - private Optional expiryType = Optional.empty(); - - private Optional creditAmount = Optional.empty(); - - private Optional applyToExisting = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { - applyToExisting(other.getApplyToExisting()); - creditAmount(other.getCreditAmount()); - expiryType(other.getExpiryType()); - expiryUnit(other.getExpiryUnit()); - expiryUnitCount(other.getExpiryUnitCount()); - resetCadence(other.getResetCadence()); - resetStart(other.getResetStart()); - resetType(other.getResetType()); - return this; - } - - @java.lang.Override - @JsonSetter("reset_cadence") - public ResetStartStage resetCadence(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetCadence resetCadence) { - this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("reset_start") - public _FinalStage resetStart(@NotNull UpdateBillingPlanCreditGrantRequestBodyResetStart resetStart) { - this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage resetType(UpdateBillingPlanCreditGrantRequestBodyResetType resetType) { - this.resetType = Optional.ofNullable(resetType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) - public _FinalStage resetType(Optional resetType) { - this.resetType = resetType; - return this; - } - - @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { - this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); - return this; - } - - @java.lang.Override - @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { - this.expiryUnitCount = expiryUnitCount; - return this; - } - - @java.lang.Override - public _FinalStage expiryUnit(UpdateBillingPlanCreditGrantRequestBodyExpiryUnit expiryUnit) { - this.expiryUnit = Optional.ofNullable(expiryUnit); - return this; - } - - @java.lang.Override - @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { - this.expiryUnit = expiryUnit; - return this; - } - - @java.lang.Override - public _FinalStage expiryType(UpdateBillingPlanCreditGrantRequestBodyExpiryType expiryType) { - this.expiryType = Optional.ofNullable(expiryType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { - this.expiryType = expiryType; - return this; - } - - @java.lang.Override - public _FinalStage creditAmount(Integer creditAmount) { - this.creditAmount = Optional.ofNullable(creditAmount); - return this; - } - - @java.lang.Override - @JsonSetter(value = "credit_amount", nulls = Nulls.SKIP) - public _FinalStage creditAmount(Optional creditAmount) { - this.creditAmount = creditAmount; - return this; - } - - @java.lang.Override - public _FinalStage applyToExisting(Boolean applyToExisting) { - this.applyToExisting = Optional.ofNullable(applyToExisting); - return this; - } - - @java.lang.Override - @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) - public _FinalStage applyToExisting(Optional applyToExisting) { - this.applyToExisting = applyToExisting; - return this; - } - - @java.lang.Override - public UpdateBillingPlanCreditGrantRequestBody build() { - return new UpdateBillingPlanCreditGrantRequestBody( - applyToExisting, - creditAmount, - expiryType, - expiryUnit, - expiryUnitCount, - resetCadence, - resetStart, - resetType, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java index 1007ae7..ac3d40d 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java @@ -12,9 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsRequestBodyExpiryType; -import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsRequestBodyExpiryUnit; -import com.schematic.api.resources.credits.types.UpdateCreditBundleDetailsRequestBodyStatus; +import com.schematic.api.types.BillingCreditBundleStatus; +import com.schematic.api.types.BillingCreditExpiryType; +import com.schematic.api.types.BillingCreditExpiryUnit; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -26,9 +26,9 @@ public final class UpdateCreditBundleDetailsRequestBody { private final String bundleName; - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; @@ -38,19 +38,19 @@ public final class UpdateCreditBundleDetailsRequestBody { private final Optional quantity; - private final Optional status; + private final Optional status; private final Map additionalProperties; private UpdateCreditBundleDetailsRequestBody( String bundleName, - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, int pricePerUnit, Optional pricePerUnitDecimal, Optional quantity, - Optional status, + Optional status, Map additionalProperties) { this.bundleName = bundleName; this.expiryType = expiryType; @@ -69,12 +69,12 @@ public String getBundleName() { } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -99,7 +99,7 @@ public Optional getQuantity() { } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -161,13 +161,13 @@ public interface PricePerUnitStage { public interface _FinalStage { UpdateCreditBundleDetailsRequestBody build(); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(UpdateCreditBundleDetailsRequestBodyExpiryType expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(UpdateCreditBundleDetailsRequestBodyExpiryUnit expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); @@ -181,9 +181,9 @@ public interface _FinalStage { _FinalStage quantity(Integer quantity); - _FinalStage status(Optional status); + _FinalStage status(Optional status); - _FinalStage status(UpdateCreditBundleDetailsRequestBodyStatus status); + _FinalStage status(BillingCreditBundleStatus status); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -192,7 +192,7 @@ public static final class Builder implements BundleNameStage, PricePerUnitStage, private int pricePerUnit; - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); private Optional quantity = Optional.empty(); @@ -200,9 +200,9 @@ public static final class Builder implements BundleNameStage, PricePerUnitStage, private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -237,14 +237,14 @@ public _FinalStage pricePerUnit(int pricePerUnit) { } @java.lang.Override - public _FinalStage status(UpdateCreditBundleDetailsRequestBodyStatus status) { + public _FinalStage status(BillingCreditBundleStatus status) { this.status = Optional.ofNullable(status); return this; } @java.lang.Override @JsonSetter(value = "status", nulls = Nulls.SKIP) - public _FinalStage status(Optional status) { + public _FinalStage status(Optional status) { this.status = status; return this; } @@ -289,27 +289,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(UpdateCreditBundleDetailsRequestBodyExpiryUnit expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(UpdateCreditBundleDetailsRequestBodyExpiryType expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ZeroOutGrantRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/ZeroOutGrantRequestBody.java index 81ede75..8ce5ebd 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ZeroOutGrantRequestBody.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ZeroOutGrantRequestBody.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.credits.types.ZeroOutGrantRequestBodyReason; +import com.schematic.api.types.BillingCreditGrantZeroedOutReason; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -21,18 +21,18 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ZeroOutGrantRequestBody.Builder.class) public final class ZeroOutGrantRequestBody { - private final Optional reason; + private final Optional reason; private final Map additionalProperties; private ZeroOutGrantRequestBody( - Optional reason, Map additionalProperties) { + Optional reason, Map additionalProperties) { this.reason = reason; this.additionalProperties = additionalProperties; } @JsonProperty("reason") - public Optional getReason() { + public Optional getReason() { return reason; } @@ -67,7 +67,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional reason = Optional.empty(); + private Optional reason = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -80,12 +80,12 @@ public Builder from(ZeroOutGrantRequestBody other) { } @JsonSetter(value = "reason", nulls = Nulls.SKIP) - public Builder reason(Optional reason) { + public Builder reason(Optional reason) { this.reason = reason; return this; } - public Builder reason(ZeroOutGrantRequestBodyReason reason) { + public Builder reason(BillingCreditGrantZeroedOutReason reason) { this.reason = Optional.ofNullable(reason); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/GetActiveDealsRequest.java b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java similarity index 50% rename from src/main/java/com/schematic/api/resources/companies/requests/GetActiveDealsRequest.java rename to src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java index 3a57b57..945c7cf 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/GetActiveDealsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.companies.requests; +package com.schematic.api.resources.credits.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,46 +12,51 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CreditGrantSortOrder; +import com.schematic.api.types.SortDirection; 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 = GetActiveDealsRequest.Builder.class) -public final class GetActiveDealsRequest { - private final String companyId; +@JsonDeserialize(builder = CountCompanyGrantsParams.Builder.class) +public final class CountCompanyGrantsParams { + private final Optional companyId; - private final String dealStage; + private final Optional dir; private final Optional limit; private final Optional offset; + private final Optional order; + private final Map additionalProperties; - private GetActiveDealsRequest( - String companyId, - String dealStage, + private CountCompanyGrantsParams( + Optional companyId, + Optional dir, Optional limit, Optional offset, + Optional order, Map additionalProperties) { this.companyId = companyId; - this.dealStage = dealStage; + this.dir = dir; this.limit = limit; this.offset = offset; + this.order = order; this.additionalProperties = additionalProperties; } @JsonProperty("company_id") - public String getCompanyId() { + public Optional getCompanyId() { return companyId; } - @JsonProperty("deal_stage") - public String getDealStage() { - return dealStage; + @JsonProperty("dir") + public Optional getDir() { + return dir; } /** @@ -70,10 +75,15 @@ public Optional getOffset() { return offset; } + @JsonProperty("order") + public Optional getOrder() { + return order; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof GetActiveDealsRequest && equalTo((GetActiveDealsRequest) other); + return other instanceof CountCompanyGrantsParams && equalTo((CountCompanyGrantsParams) other); } @JsonAnyGetter @@ -81,16 +91,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(GetActiveDealsRequest other) { + private boolean equalTo(CountCompanyGrantsParams other) { return companyId.equals(other.companyId) - && dealStage.equals(other.dealStage) + && dir.equals(other.dir) && limit.equals(other.limit) - && offset.equals(other.offset); + && offset.equals(other.offset) + && order.equals(other.order); } @java.lang.Override public int hashCode() { - return Objects.hash(this.companyId, this.dealStage, this.limit, this.offset); + return Objects.hash(this.companyId, this.dir, this.limit, this.offset, this.order); } @java.lang.Override @@ -98,119 +109,99 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CompanyIdStage builder() { + public static Builder builder() { return new Builder(); } - public interface CompanyIdStage { - DealStageStage companyId(@NotNull String companyId); - - Builder from(GetActiveDealsRequest other); - } - - public interface DealStageStage { - _FinalStage dealStage(@NotNull String dealStage); - } - - public interface _FinalStage { - GetActiveDealsRequest build(); - - /** - *

Page limit (default 100)

- */ - _FinalStage limit(Optional limit); - - _FinalStage limit(Integer limit); - - /** - *

Page offset (default 0)

- */ - _FinalStage offset(Optional offset); - - _FinalStage offset(Integer offset); - } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CompanyIdStage, DealStageStage, _FinalStage { - private String companyId; + public static final class Builder { + private Optional companyId = Optional.empty(); - private String dealStage; + private Optional dir = Optional.empty(); + + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional order = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} - @java.lang.Override - public Builder from(GetActiveDealsRequest other) { + public Builder from(CountCompanyGrantsParams other) { companyId(other.getCompanyId()); - dealStage(other.getDealStage()); + dir(other.getDir()); limit(other.getLimit()); offset(other.getOffset()); + order(other.getOrder()); + return this; + } + + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; return this; } - @java.lang.Override - @JsonSetter("company_id") - public DealStageStage companyId(@NotNull String companyId) { - this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); return this; } - @java.lang.Override - @JsonSetter("deal_stage") - public _FinalStage dealStage(@NotNull String dealStage) { - this.dealStage = Objects.requireNonNull(dealStage, "dealStage must not be null"); + @JsonSetter(value = "dir", nulls = Nulls.SKIP) + public Builder dir(Optional dir) { + this.dir = dir; + return this; + } + + public Builder dir(SortDirection dir) { + this.dir = Optional.ofNullable(dir); return this; } /** - *

Page offset (default 0)

- * @return Reference to {@code this} so that method calls can be chained together. + *

Page limit (default 100)

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

Page offset (default 0)

*/ - @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public Builder 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(Integer limit) { - this.limit = Optional.ofNullable(limit); + public Builder offset(Integer offset) { + this.offset = Optional.ofNullable(offset); return this; } - /** - *

Page limit (default 100)

- */ - @java.lang.Override - @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { - this.limit = limit; + @JsonSetter(value = "order", nulls = Nulls.SKIP) + public Builder order(Optional order) { + this.order = order; + return this; + } + + public Builder order(CreditGrantSortOrder order) { + this.order = Optional.ofNullable(order); return this; } - @java.lang.Override - public GetActiveDealsRequest build() { - return new GetActiveDealsRequest(companyId, dealStage, limit, offset, additionalProperties); + public CountCompanyGrantsParams build() { + return new CountCompanyGrantsParams(companyId, dir, limit, offset, order, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java new file mode 100644 index 0000000..3b4da2f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java @@ -0,0 +1,137 @@ +/** + * 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.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 = CountCompanyGrantsResponse.Builder.class) +public final class CountCompanyGrantsResponse { + private final CountResponse data; + + private final CountCompanyGrantsParams params; + + private final Map additionalProperties; + + private CountCompanyGrantsResponse( + CountResponse data, CountCompanyGrantsParams 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 CountCompanyGrantsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountCompanyGrantsResponse && equalTo((CountCompanyGrantsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountCompanyGrantsResponse 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(CountCompanyGrantsResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull CountCompanyGrantsParams params); + } + + public interface _FinalStage { + CountCompanyGrantsResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private CountResponse data; + + private CountCompanyGrantsParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountCompanyGrantsResponse 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 CountCompanyGrantsParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public CountCompanyGrantsResponse build() { + return new CountCompanyGrantsResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesParams.java index 51dc60c..1b39a73 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingCreditBundleStatus; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,7 +32,7 @@ public final class CountCreditBundlesParams { private final Optional offset; - private final Optional status; + private final Optional status; private final Map additionalProperties; @@ -41,7 +42,7 @@ private CountCreditBundlesParams( Optional> ids, Optional limit, Optional offset, - Optional status, + Optional status, Map additionalProperties) { this.bundleType = bundleType; this.creditId = creditId; @@ -84,7 +85,7 @@ public Optional getOffset() { } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -134,7 +135,7 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -213,12 +214,12 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { + public Builder status(Optional status) { this.status = status; return this; } - public Builder status(CountCreditBundlesResponseParamsStatus status) { + public Builder status(BillingCreditBundleStatus status) { this.status = Optional.ofNullable(status); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesRequestStatus.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesRequestStatus.java deleted file mode 100644 index ebf8744..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesRequestStatus.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountCreditBundlesRequestStatus { - public static final CountCreditBundlesRequestStatus INACTIVE = - new CountCreditBundlesRequestStatus(Value.INACTIVE, "inactive"); - - public static final CountCreditBundlesRequestStatus ACTIVE = - new CountCreditBundlesRequestStatus(Value.ACTIVE, "active"); - - private final Value value; - - private final String string; - - CountCreditBundlesRequestStatus(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 CountCreditBundlesRequestStatus - && this.string.equals(((CountCreditBundlesRequestStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case INACTIVE: - return visitor.visitInactive(); - case ACTIVE: - return visitor.visitActive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountCreditBundlesRequestStatus valueOf(String value) { - switch (value) { - case "inactive": - return INACTIVE; - case "active": - return ACTIVE; - default: - return new CountCreditBundlesRequestStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - ACTIVE, - - INACTIVE, - - UNKNOWN - } - - public interface Visitor { - T visitActive(); - - T visitInactive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponseParamsStatus.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponseParamsStatus.java deleted file mode 100644 index e63ca3a..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponseParamsStatus.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountCreditBundlesResponseParamsStatus { - public static final CountCreditBundlesResponseParamsStatus INACTIVE = - new CountCreditBundlesResponseParamsStatus(Value.INACTIVE, "inactive"); - - public static final CountCreditBundlesResponseParamsStatus ACTIVE = - new CountCreditBundlesResponseParamsStatus(Value.ACTIVE, "active"); - - private final Value value; - - private final String string; - - CountCreditBundlesResponseParamsStatus(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 CountCreditBundlesResponseParamsStatus - && this.string.equals(((CountCreditBundlesResponseParamsStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case INACTIVE: - return visitor.visitInactive(); - case ACTIVE: - return visitor.visitActive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountCreditBundlesResponseParamsStatus valueOf(String value) { - switch (value) { - case "inactive": - return INACTIVE; - case "active": - return ACTIVE; - default: - return new CountCreditBundlesResponseParamsStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - ACTIVE, - - INACTIVE, - - UNKNOWN - } - - public interface Visitor { - T visitActive(); - - T visitInactive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerParams.java index 9f9e139..c2f6b64 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CreditLedgerPeriod; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -32,7 +33,7 @@ public final class CountCreditLedgerParams { private final Optional offset; - private final Optional period; + private final Optional period; private final Optional startTime; @@ -45,7 +46,7 @@ private CountCreditLedgerParams( Optional featureId, Optional limit, Optional offset, - Optional period, + Optional period, Optional startTime, Map additionalProperties) { this.billingCreditId = billingCreditId; @@ -96,7 +97,7 @@ public Optional getOffset() { } @JsonProperty("period") - public Optional getPeriod() { + public Optional getPeriod() { return period; } @@ -163,7 +164,7 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional period = Optional.empty(); + private Optional period = Optional.empty(); private Optional startTime = Optional.empty(); @@ -257,12 +258,12 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "period", nulls = Nulls.SKIP) - public Builder period(Optional period) { + public Builder period(Optional period) { this.period = period; return this; } - public Builder period(CountCreditLedgerResponseParamsPeriod period) { + public Builder period(CreditLedgerPeriod period) { this.period = Optional.ofNullable(period); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponseParamsPeriod.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponseParamsPeriod.java deleted file mode 100644 index ec448b4..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponseParamsPeriod.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountCreditLedgerResponseParamsPeriod { - public static final CountCreditLedgerResponseParamsPeriod RAW = - new CountCreditLedgerResponseParamsPeriod(Value.RAW, "raw"); - - public static final CountCreditLedgerResponseParamsPeriod MONTHLY = - new CountCreditLedgerResponseParamsPeriod(Value.MONTHLY, "monthly"); - - public static final CountCreditLedgerResponseParamsPeriod DAILY = - new CountCreditLedgerResponseParamsPeriod(Value.DAILY, "daily"); - - public static final CountCreditLedgerResponseParamsPeriod WEEKLY = - new CountCreditLedgerResponseParamsPeriod(Value.WEEKLY, "weekly"); - - private final Value value; - - private final String string; - - CountCreditLedgerResponseParamsPeriod(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 CountCreditLedgerResponseParamsPeriod - && this.string.equals(((CountCreditLedgerResponseParamsPeriod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case RAW: - return visitor.visitRaw(); - case MONTHLY: - return visitor.visitMonthly(); - case DAILY: - return visitor.visitDaily(); - case WEEKLY: - return visitor.visitWeekly(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountCreditLedgerResponseParamsPeriod valueOf(String value) { - switch (value) { - case "raw": - return RAW; - case "monthly": - return MONTHLY; - case "daily": - return DAILY; - case "weekly": - return WEEKLY; - default: - return new CountCreditLedgerResponseParamsPeriod(Value.UNKNOWN, value); - } - } - - public enum Value { - DAILY, - - WEEKLY, - - MONTHLY, - - RAW, - - UNKNOWN - } - - public interface Visitor { - T visitDaily(); - - T visitWeekly(); - - T visitMonthly(); - - T visitRaw(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditRequestBodyBurnStrategy.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditRequestBodyBurnStrategy.java deleted file mode 100644 index 9d93ad1..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditRequestBodyBurnStrategy.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingCreditRequestBodyBurnStrategy { - public static final CreateBillingCreditRequestBodyBurnStrategy PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT = - new CreateBillingCreditRequestBodyBurnStrategy( - Value.PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT, - "plan_first_then_credit_bundles_first_in_first_out"); - - public static final CreateBillingCreditRequestBodyBurnStrategy FIRST_IN_FIRST_OUT = - new CreateBillingCreditRequestBodyBurnStrategy(Value.FIRST_IN_FIRST_OUT, "first_in_first_out"); - - public static final CreateBillingCreditRequestBodyBurnStrategy LAST_IN_FIRST_OUT = - new CreateBillingCreditRequestBodyBurnStrategy(Value.LAST_IN_FIRST_OUT, "last_in_first_out"); - - public static final CreateBillingCreditRequestBodyBurnStrategy EXPIRATION_PRIORITY = - new CreateBillingCreditRequestBodyBurnStrategy(Value.EXPIRATION_PRIORITY, "expiration_priority"); - - private final Value value; - - private final String string; - - CreateBillingCreditRequestBodyBurnStrategy(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 CreateBillingCreditRequestBodyBurnStrategy - && this.string.equals(((CreateBillingCreditRequestBodyBurnStrategy) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT: - return visitor.visitPlanFirstThenCreditBundlesFirstInFirstOut(); - case FIRST_IN_FIRST_OUT: - return visitor.visitFirstInFirstOut(); - case LAST_IN_FIRST_OUT: - return visitor.visitLastInFirstOut(); - case EXPIRATION_PRIORITY: - return visitor.visitExpirationPriority(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingCreditRequestBodyBurnStrategy valueOf(String value) { - switch (value) { - case "plan_first_then_credit_bundles_first_in_first_out": - return PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT; - case "first_in_first_out": - return FIRST_IN_FIRST_OUT; - case "last_in_first_out": - return LAST_IN_FIRST_OUT; - case "expiration_priority": - return EXPIRATION_PRIORITY; - default: - return new CreateBillingCreditRequestBodyBurnStrategy(Value.UNKNOWN, value); - } - } - - public enum Value { - PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT, - - FIRST_IN_FIRST_OUT, - - LAST_IN_FIRST_OUT, - - EXPIRATION_PRIORITY, - - UNKNOWN - } - - public interface Visitor { - T visitPlanFirstThenCreditBundlesFirstInFirstOut(); - - T visitFirstInFirstOut(); - - T visitLastInFirstOut(); - - T visitExpirationPriority(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditRequestBodyDefaultRolloverPolicy.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditRequestBodyDefaultRolloverPolicy.java deleted file mode 100644 index 843a6e1..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditRequestBodyDefaultRolloverPolicy.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingCreditRequestBodyDefaultRolloverPolicy { - public static final CreateBillingCreditRequestBodyDefaultRolloverPolicy EXPIRE = - new CreateBillingCreditRequestBodyDefaultRolloverPolicy(Value.EXPIRE, "expire"); - - public static final CreateBillingCreditRequestBodyDefaultRolloverPolicy ROLLOVER = - new CreateBillingCreditRequestBodyDefaultRolloverPolicy(Value.ROLLOVER, "rollover"); - - public static final CreateBillingCreditRequestBodyDefaultRolloverPolicy NONE = - new CreateBillingCreditRequestBodyDefaultRolloverPolicy(Value.NONE, "none"); - - private final Value value; - - private final String string; - - CreateBillingCreditRequestBodyDefaultRolloverPolicy(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 CreateBillingCreditRequestBodyDefaultRolloverPolicy - && this.string.equals(((CreateBillingCreditRequestBodyDefaultRolloverPolicy) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case EXPIRE: - return visitor.visitExpire(); - case ROLLOVER: - return visitor.visitRollover(); - case NONE: - return visitor.visitNone(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingCreditRequestBodyDefaultRolloverPolicy valueOf(String value) { - switch (value) { - case "expire": - return EXPIRE; - case "rollover": - return ROLLOVER; - case "none": - return NONE; - default: - return new CreateBillingCreditRequestBodyDefaultRolloverPolicy(Value.UNKNOWN, value); - } - } - - public enum Value { - NONE, - - ROLLOVER, - - EXPIRE, - - UNKNOWN - } - - public interface Visitor { - T visitNone(); - - T visitRollover(); - - T visitExpire(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryType.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryType.java deleted file mode 100644 index 90b9c6e..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryType.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingPlanCreditGrantRequestBodyExpiryType { - public static final CreateBillingPlanCreditGrantRequestBodyExpiryType END_OF_BILLING_PERIOD = - new CreateBillingPlanCreditGrantRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); - - public static final CreateBillingPlanCreditGrantRequestBodyExpiryType DURATION = - new CreateBillingPlanCreditGrantRequestBodyExpiryType(Value.DURATION, "duration"); - - public static final CreateBillingPlanCreditGrantRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = - new CreateBillingPlanCreditGrantRequestBodyExpiryType( - Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); - - public static final CreateBillingPlanCreditGrantRequestBodyExpiryType NO_EXPIRY = - new CreateBillingPlanCreditGrantRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); - - public static final CreateBillingPlanCreditGrantRequestBodyExpiryType END_OF_TRIAL = - new CreateBillingPlanCreditGrantRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); - - private final Value value; - - private final String string; - - CreateBillingPlanCreditGrantRequestBodyExpiryType(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 CreateBillingPlanCreditGrantRequestBodyExpiryType - && this.string.equals(((CreateBillingPlanCreditGrantRequestBodyExpiryType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case END_OF_BILLING_PERIOD: - return visitor.visitEndOfBillingPeriod(); - case DURATION: - return visitor.visitDuration(); - case END_OF_NEXT_BILLING_PERIOD: - return visitor.visitEndOfNextBillingPeriod(); - case NO_EXPIRY: - return visitor.visitNoExpiry(); - case END_OF_TRIAL: - return visitor.visitEndOfTrial(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPlanCreditGrantRequestBodyExpiryType valueOf(String value) { - switch (value) { - case "end_of_billing_period": - return END_OF_BILLING_PERIOD; - case "duration": - return DURATION; - case "end_of_next_billing_period": - return END_OF_NEXT_BILLING_PERIOD; - case "no_expiry": - return NO_EXPIRY; - case "end_of_trial": - return END_OF_TRIAL; - default: - return new CreateBillingPlanCreditGrantRequestBodyExpiryType(Value.UNKNOWN, value); - } - } - - public enum Value { - DURATION, - - NO_EXPIRY, - - END_OF_TRIAL, - - END_OF_BILLING_PERIOD, - - END_OF_NEXT_BILLING_PERIOD, - - UNKNOWN - } - - public interface Visitor { - T visitDuration(); - - T visitNoExpiry(); - - T visitEndOfTrial(); - - T visitEndOfBillingPeriod(); - - T visitEndOfNextBillingPeriod(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryUnit.java deleted file mode 100644 index ba3341c..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyExpiryUnit.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingPlanCreditGrantRequestBodyExpiryUnit { - public static final CreateBillingPlanCreditGrantRequestBodyExpiryUnit BILLING_PERIODS = - new CreateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); - - public static final CreateBillingPlanCreditGrantRequestBodyExpiryUnit DAYS = - new CreateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.DAYS, "days"); - - private final Value value; - - private final String string; - - CreateBillingPlanCreditGrantRequestBodyExpiryUnit(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 CreateBillingPlanCreditGrantRequestBodyExpiryUnit - && this.string.equals(((CreateBillingPlanCreditGrantRequestBodyExpiryUnit) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case BILLING_PERIODS: - return visitor.visitBillingPeriods(); - case DAYS: - return visitor.visitDays(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPlanCreditGrantRequestBodyExpiryUnit valueOf(String value) { - switch (value) { - case "billing_periods": - return BILLING_PERIODS; - case "days": - return DAYS; - default: - return new CreateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.UNKNOWN, value); - } - } - - public enum Value { - DAYS, - - BILLING_PERIODS, - - UNKNOWN - } - - public interface Visitor { - T visitDays(); - - T visitBillingPeriods(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetCadence.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetCadence.java deleted file mode 100644 index 6f3d3a0..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetCadence.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingPlanCreditGrantRequestBodyResetCadence { - public static final CreateBillingPlanCreditGrantRequestBodyResetCadence YEARLY = - new CreateBillingPlanCreditGrantRequestBodyResetCadence(Value.YEARLY, "yearly"); - - public static final CreateBillingPlanCreditGrantRequestBodyResetCadence MONTHLY = - new CreateBillingPlanCreditGrantRequestBodyResetCadence(Value.MONTHLY, "monthly"); - - public static final CreateBillingPlanCreditGrantRequestBodyResetCadence DAILY = - new CreateBillingPlanCreditGrantRequestBodyResetCadence(Value.DAILY, "daily"); - - public static final CreateBillingPlanCreditGrantRequestBodyResetCadence WEEKLY = - new CreateBillingPlanCreditGrantRequestBodyResetCadence(Value.WEEKLY, "weekly"); - - private final Value value; - - private final String string; - - CreateBillingPlanCreditGrantRequestBodyResetCadence(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 CreateBillingPlanCreditGrantRequestBodyResetCadence - && this.string.equals(((CreateBillingPlanCreditGrantRequestBodyResetCadence) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case YEARLY: - return visitor.visitYearly(); - case MONTHLY: - return visitor.visitMonthly(); - case DAILY: - return visitor.visitDaily(); - case WEEKLY: - return visitor.visitWeekly(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPlanCreditGrantRequestBodyResetCadence valueOf(String value) { - switch (value) { - case "yearly": - return YEARLY; - case "monthly": - return MONTHLY; - case "daily": - return DAILY; - case "weekly": - return WEEKLY; - default: - return new CreateBillingPlanCreditGrantRequestBodyResetCadence(Value.UNKNOWN, value); - } - } - - public enum Value { - MONTHLY, - - YEARLY, - - DAILY, - - WEEKLY, - - UNKNOWN - } - - public interface Visitor { - T visitMonthly(); - - T visitYearly(); - - T visitDaily(); - - T visitWeekly(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetType.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetType.java deleted file mode 100644 index a16da60..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateBillingPlanCreditGrantRequestBodyResetType { - public static final CreateBillingPlanCreditGrantRequestBodyResetType NO_RESET = - new CreateBillingPlanCreditGrantRequestBodyResetType(Value.NO_RESET, "no_reset"); - - public static final CreateBillingPlanCreditGrantRequestBodyResetType PLAN_PERIOD = - new CreateBillingPlanCreditGrantRequestBodyResetType(Value.PLAN_PERIOD, "plan_period"); - - private final Value value; - - private final String string; - - CreateBillingPlanCreditGrantRequestBodyResetType(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 CreateBillingPlanCreditGrantRequestBodyResetType - && this.string.equals(((CreateBillingPlanCreditGrantRequestBodyResetType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NO_RESET: - return visitor.visitNoReset(); - case PLAN_PERIOD: - return visitor.visitPlanPeriod(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPlanCreditGrantRequestBodyResetType valueOf(String value) { - switch (value) { - case "no_reset": - return NO_RESET; - case "plan_period": - return PLAN_PERIOD; - default: - return new CreateBillingPlanCreditGrantRequestBodyResetType(Value.UNKNOWN, value); - } - } - - public enum Value { - PLAN_PERIOD, - - NO_RESET, - - UNKNOWN - } - - public interface Visitor { - T visitPlanPeriod(); - - T visitNoReset(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateCompanyCreditGrantExpiryType.java b/src/main/java/com/schematic/api/resources/credits/types/CreateCompanyCreditGrantExpiryType.java deleted file mode 100644 index 95ae51b..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateCompanyCreditGrantExpiryType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateCompanyCreditGrantExpiryType { - public static final CreateCompanyCreditGrantExpiryType END_OF_BILLING_PERIOD = - new CreateCompanyCreditGrantExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); - - public static final CreateCompanyCreditGrantExpiryType DURATION = - new CreateCompanyCreditGrantExpiryType(Value.DURATION, "duration"); - - public static final CreateCompanyCreditGrantExpiryType END_OF_NEXT_BILLING_PERIOD = - new CreateCompanyCreditGrantExpiryType(Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); - - public static final CreateCompanyCreditGrantExpiryType NO_EXPIRY = - new CreateCompanyCreditGrantExpiryType(Value.NO_EXPIRY, "no_expiry"); - - public static final CreateCompanyCreditGrantExpiryType END_OF_TRIAL = - new CreateCompanyCreditGrantExpiryType(Value.END_OF_TRIAL, "end_of_trial"); - - private final Value value; - - private final String string; - - CreateCompanyCreditGrantExpiryType(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 CreateCompanyCreditGrantExpiryType - && this.string.equals(((CreateCompanyCreditGrantExpiryType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case END_OF_BILLING_PERIOD: - return visitor.visitEndOfBillingPeriod(); - case DURATION: - return visitor.visitDuration(); - case END_OF_NEXT_BILLING_PERIOD: - return visitor.visitEndOfNextBillingPeriod(); - case NO_EXPIRY: - return visitor.visitNoExpiry(); - case END_OF_TRIAL: - return visitor.visitEndOfTrial(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateCompanyCreditGrantExpiryType valueOf(String value) { - switch (value) { - case "end_of_billing_period": - return END_OF_BILLING_PERIOD; - case "duration": - return DURATION; - case "end_of_next_billing_period": - return END_OF_NEXT_BILLING_PERIOD; - case "no_expiry": - return NO_EXPIRY; - case "end_of_trial": - return END_OF_TRIAL; - default: - return new CreateCompanyCreditGrantExpiryType(Value.UNKNOWN, value); - } - } - - public enum Value { - DURATION, - - NO_EXPIRY, - - END_OF_TRIAL, - - END_OF_BILLING_PERIOD, - - END_OF_NEXT_BILLING_PERIOD, - - UNKNOWN - } - - public interface Visitor { - T visitDuration(); - - T visitNoExpiry(); - - T visitEndOfTrial(); - - T visitEndOfBillingPeriod(); - - T visitEndOfNextBillingPeriod(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateCompanyCreditGrantExpiryUnit.java b/src/main/java/com/schematic/api/resources/credits/types/CreateCompanyCreditGrantExpiryUnit.java deleted file mode 100644 index 4c8e44e..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateCompanyCreditGrantExpiryUnit.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateCompanyCreditGrantExpiryUnit { - public static final CreateCompanyCreditGrantExpiryUnit BILLING_PERIODS = - new CreateCompanyCreditGrantExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); - - public static final CreateCompanyCreditGrantExpiryUnit DAYS = - new CreateCompanyCreditGrantExpiryUnit(Value.DAYS, "days"); - - private final Value value; - - private final String string; - - CreateCompanyCreditGrantExpiryUnit(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 CreateCompanyCreditGrantExpiryUnit - && this.string.equals(((CreateCompanyCreditGrantExpiryUnit) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case BILLING_PERIODS: - return visitor.visitBillingPeriods(); - case DAYS: - return visitor.visitDays(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateCompanyCreditGrantExpiryUnit valueOf(String value) { - switch (value) { - case "billing_periods": - return BILLING_PERIODS; - case "days": - return DAYS; - default: - return new CreateCompanyCreditGrantExpiryUnit(Value.UNKNOWN, value); - } - } - - public enum Value { - DAYS, - - BILLING_PERIODS, - - UNKNOWN - } - - public interface Visitor { - T visitDays(); - - T visitBillingPeriods(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryType.java b/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryType.java deleted file mode 100644 index 0afb674..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateCreditBundleRequestBodyExpiryType { - public static final CreateCreditBundleRequestBodyExpiryType END_OF_BILLING_PERIOD = - new CreateCreditBundleRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); - - public static final CreateCreditBundleRequestBodyExpiryType DURATION = - new CreateCreditBundleRequestBodyExpiryType(Value.DURATION, "duration"); - - public static final CreateCreditBundleRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = - new CreateCreditBundleRequestBodyExpiryType(Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); - - public static final CreateCreditBundleRequestBodyExpiryType NO_EXPIRY = - new CreateCreditBundleRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); - - public static final CreateCreditBundleRequestBodyExpiryType END_OF_TRIAL = - new CreateCreditBundleRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); - - private final Value value; - - private final String string; - - CreateCreditBundleRequestBodyExpiryType(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 CreateCreditBundleRequestBodyExpiryType - && this.string.equals(((CreateCreditBundleRequestBodyExpiryType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case END_OF_BILLING_PERIOD: - return visitor.visitEndOfBillingPeriod(); - case DURATION: - return visitor.visitDuration(); - case END_OF_NEXT_BILLING_PERIOD: - return visitor.visitEndOfNextBillingPeriod(); - case NO_EXPIRY: - return visitor.visitNoExpiry(); - case END_OF_TRIAL: - return visitor.visitEndOfTrial(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateCreditBundleRequestBodyExpiryType valueOf(String value) { - switch (value) { - case "end_of_billing_period": - return END_OF_BILLING_PERIOD; - case "duration": - return DURATION; - case "end_of_next_billing_period": - return END_OF_NEXT_BILLING_PERIOD; - case "no_expiry": - return NO_EXPIRY; - case "end_of_trial": - return END_OF_TRIAL; - default: - return new CreateCreditBundleRequestBodyExpiryType(Value.UNKNOWN, value); - } - } - - public enum Value { - DURATION, - - NO_EXPIRY, - - END_OF_TRIAL, - - END_OF_BILLING_PERIOD, - - END_OF_NEXT_BILLING_PERIOD, - - UNKNOWN - } - - public interface Visitor { - T visitDuration(); - - T visitNoExpiry(); - - T visitEndOfTrial(); - - T visitEndOfBillingPeriod(); - - T visitEndOfNextBillingPeriod(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryUnit.java deleted file mode 100644 index ea7dd22..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyExpiryUnit.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateCreditBundleRequestBodyExpiryUnit { - public static final CreateCreditBundleRequestBodyExpiryUnit BILLING_PERIODS = - new CreateCreditBundleRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); - - public static final CreateCreditBundleRequestBodyExpiryUnit DAYS = - new CreateCreditBundleRequestBodyExpiryUnit(Value.DAYS, "days"); - - private final Value value; - - private final String string; - - CreateCreditBundleRequestBodyExpiryUnit(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 CreateCreditBundleRequestBodyExpiryUnit - && this.string.equals(((CreateCreditBundleRequestBodyExpiryUnit) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case BILLING_PERIODS: - return visitor.visitBillingPeriods(); - case DAYS: - return visitor.visitDays(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateCreditBundleRequestBodyExpiryUnit valueOf(String value) { - switch (value) { - case "billing_periods": - return BILLING_PERIODS; - case "days": - return DAYS; - default: - return new CreateCreditBundleRequestBodyExpiryUnit(Value.UNKNOWN, value); - } - } - - public enum Value { - DAYS, - - BILLING_PERIODS, - - UNKNOWN - } - - public interface Visitor { - T visitDays(); - - T visitBillingPeriods(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyStatus.java b/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyStatus.java deleted file mode 100644 index 0bae58f..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleRequestBodyStatus.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateCreditBundleRequestBodyStatus { - public static final CreateCreditBundleRequestBodyStatus INACTIVE = - new CreateCreditBundleRequestBodyStatus(Value.INACTIVE, "inactive"); - - public static final CreateCreditBundleRequestBodyStatus ACTIVE = - new CreateCreditBundleRequestBodyStatus(Value.ACTIVE, "active"); - - private final Value value; - - private final String string; - - CreateCreditBundleRequestBodyStatus(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 CreateCreditBundleRequestBodyStatus - && this.string.equals(((CreateCreditBundleRequestBodyStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case INACTIVE: - return visitor.visitInactive(); - case ACTIVE: - return visitor.visitActive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateCreditBundleRequestBodyStatus valueOf(String value) { - switch (value) { - case "inactive": - return INACTIVE; - case "active": - return ACTIVE; - default: - return new CreateCreditBundleRequestBodyStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - ACTIVE, - - INACTIVE, - - UNKNOWN - } - - public interface Visitor { - T visitActive(); - - T visitInactive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerParams.java index ecd6acf..8918124 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CreditLedgerPeriod; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -32,7 +33,7 @@ public final class GetEnrichedCreditLedgerParams { private final Optional offset; - private final Optional period; + private final Optional period; private final Optional startTime; @@ -45,7 +46,7 @@ private GetEnrichedCreditLedgerParams( Optional featureId, Optional limit, Optional offset, - Optional period, + Optional period, Optional startTime, Map additionalProperties) { this.billingCreditId = billingCreditId; @@ -96,7 +97,7 @@ public Optional getOffset() { } @JsonProperty("period") - public Optional getPeriod() { + public Optional getPeriod() { return period; } @@ -163,7 +164,7 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional period = Optional.empty(); + private Optional period = Optional.empty(); private Optional startTime = Optional.empty(); @@ -257,12 +258,12 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "period", nulls = Nulls.SKIP) - public Builder period(Optional period) { + public Builder period(Optional period) { this.period = period; return this; } - public Builder period(GetEnrichedCreditLedgerResponseParamsPeriod period) { + public Builder period(CreditLedgerPeriod period) { this.period = Optional.ofNullable(period); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponseParamsPeriod.java b/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponseParamsPeriod.java deleted file mode 100644 index 3e12b78..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponseParamsPeriod.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class GetEnrichedCreditLedgerResponseParamsPeriod { - public static final GetEnrichedCreditLedgerResponseParamsPeriod RAW = - new GetEnrichedCreditLedgerResponseParamsPeriod(Value.RAW, "raw"); - - public static final GetEnrichedCreditLedgerResponseParamsPeriod MONTHLY = - new GetEnrichedCreditLedgerResponseParamsPeriod(Value.MONTHLY, "monthly"); - - public static final GetEnrichedCreditLedgerResponseParamsPeriod DAILY = - new GetEnrichedCreditLedgerResponseParamsPeriod(Value.DAILY, "daily"); - - public static final GetEnrichedCreditLedgerResponseParamsPeriod WEEKLY = - new GetEnrichedCreditLedgerResponseParamsPeriod(Value.WEEKLY, "weekly"); - - private final Value value; - - private final String string; - - GetEnrichedCreditLedgerResponseParamsPeriod(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 GetEnrichedCreditLedgerResponseParamsPeriod - && this.string.equals(((GetEnrichedCreditLedgerResponseParamsPeriod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case RAW: - return visitor.visitRaw(); - case MONTHLY: - return visitor.visitMonthly(); - case DAILY: - return visitor.visitDaily(); - case WEEKLY: - return visitor.visitWeekly(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static GetEnrichedCreditLedgerResponseParamsPeriod valueOf(String value) { - switch (value) { - case "raw": - return RAW; - case "monthly": - return MONTHLY; - case "daily": - return DAILY; - case "weekly": - return WEEKLY; - default: - return new GetEnrichedCreditLedgerResponseParamsPeriod(Value.UNKNOWN, value); - } - } - - public enum Value { - DAILY, - - WEEKLY, - - MONTHLY, - - RAW, - - UNKNOWN - } - - public interface Visitor { - T visitDaily(); - - T visitWeekly(); - - T visitMonthly(); - - T visitRaw(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsParams.java index 8cc9357..30b4032 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsParams.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.CreditGrantSortOrder; +import com.schematic.api.types.SortDirection; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -22,22 +24,22 @@ public final class ListCompanyGrantsParams { private final Optional companyId; - private final Optional dir; + private final Optional dir; private final Optional limit; private final Optional offset; - private final Optional order; + private final Optional order; private final Map additionalProperties; private ListCompanyGrantsParams( Optional companyId, - Optional dir, + Optional dir, Optional limit, Optional offset, - Optional order, + Optional order, Map additionalProperties) { this.companyId = companyId; this.dir = dir; @@ -53,7 +55,7 @@ public Optional getCompanyId() { } @JsonProperty("dir") - public Optional getDir() { + public Optional getDir() { return dir; } @@ -74,7 +76,7 @@ public Optional getOffset() { } @JsonProperty("order") - public Optional getOrder() { + public Optional getOrder() { return order; } @@ -115,13 +117,13 @@ public static Builder builder() { public static final class Builder { private Optional companyId = Optional.empty(); - private Optional dir = Optional.empty(); + private Optional dir = Optional.empty(); private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); - private Optional order = Optional.empty(); + private Optional order = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -149,12 +151,12 @@ public Builder companyId(String companyId) { } @JsonSetter(value = "dir", nulls = Nulls.SKIP) - public Builder dir(Optional dir) { + public Builder dir(Optional dir) { this.dir = dir; return this; } - public Builder dir(ListCompanyGrantsResponseParamsDir dir) { + public Builder dir(SortDirection dir) { this.dir = Optional.ofNullable(dir); return this; } @@ -188,12 +190,12 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "order", nulls = Nulls.SKIP) - public Builder order(Optional order) { + public Builder order(Optional order) { this.order = order; return this; } - public Builder order(ListCompanyGrantsResponseParamsOrder order) { + public Builder order(CreditGrantSortOrder order) { this.order = Optional.ofNullable(order); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponseParamsDir.java b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponseParamsDir.java deleted file mode 100644 index 29b2867..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponseParamsDir.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListCompanyGrantsResponseParamsDir { - public static final ListCompanyGrantsResponseParamsDir ASC = - new ListCompanyGrantsResponseParamsDir(Value.ASC, "asc"); - - public static final ListCompanyGrantsResponseParamsDir DESC = - new ListCompanyGrantsResponseParamsDir(Value.DESC, "desc"); - - private final Value value; - - private final String string; - - ListCompanyGrantsResponseParamsDir(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 ListCompanyGrantsResponseParamsDir - && this.string.equals(((ListCompanyGrantsResponseParamsDir) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASC: - return visitor.visitAsc(); - case DESC: - return visitor.visitDesc(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCompanyGrantsResponseParamsDir valueOf(String value) { - switch (value) { - case "asc": - return ASC; - case "desc": - return DESC; - default: - return new ListCompanyGrantsResponseParamsDir(Value.UNKNOWN, value); - } - } - - public enum Value { - ASC, - - DESC, - - UNKNOWN - } - - public interface Visitor { - T visitAsc(); - - T visitDesc(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponseParamsOrder.java b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponseParamsOrder.java deleted file mode 100644 index db42abd..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponseParamsOrder.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListCompanyGrantsResponseParamsOrder { - public static final ListCompanyGrantsResponseParamsOrder QUANTITY = - new ListCompanyGrantsResponseParamsOrder(Value.QUANTITY, "quantity"); - - public static final ListCompanyGrantsResponseParamsOrder EXPIRES_AT = - new ListCompanyGrantsResponseParamsOrder(Value.EXPIRES_AT, "expires_at"); - - public static final ListCompanyGrantsResponseParamsOrder CREATED_AT = - new ListCompanyGrantsResponseParamsOrder(Value.CREATED_AT, "created_at"); - - public static final ListCompanyGrantsResponseParamsOrder QUANTITY_REMAINING = - new ListCompanyGrantsResponseParamsOrder(Value.QUANTITY_REMAINING, "quantity_remaining"); - - private final Value value; - - private final String string; - - ListCompanyGrantsResponseParamsOrder(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 ListCompanyGrantsResponseParamsOrder - && this.string.equals(((ListCompanyGrantsResponseParamsOrder) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case QUANTITY: - return visitor.visitQuantity(); - case EXPIRES_AT: - return visitor.visitExpiresAt(); - case CREATED_AT: - return visitor.visitCreatedAt(); - case QUANTITY_REMAINING: - return visitor.visitQuantityRemaining(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCompanyGrantsResponseParamsOrder valueOf(String value) { - switch (value) { - case "quantity": - return QUANTITY; - case "expires_at": - return EXPIRES_AT; - case "created_at": - return CREATED_AT; - case "quantity_remaining": - return QUANTITY_REMAINING; - default: - return new ListCompanyGrantsResponseParamsOrder(Value.UNKNOWN, value); - } - } - - public enum Value { - CREATED_AT, - - EXPIRES_AT, - - QUANTITY, - - QUANTITY_REMAINING, - - UNKNOWN - } - - public interface Visitor { - T visitCreatedAt(); - - T visitExpiresAt(); - - T visitQuantity(); - - T visitQuantityRemaining(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesParams.java index 5cab593..4459a60 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.BillingCreditBundleStatus; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,7 +32,7 @@ public final class ListCreditBundlesParams { private final Optional offset; - private final Optional status; + private final Optional status; private final Map additionalProperties; @@ -41,7 +42,7 @@ private ListCreditBundlesParams( Optional> ids, Optional limit, Optional offset, - Optional status, + Optional status, Map additionalProperties) { this.bundleType = bundleType; this.creditId = creditId; @@ -84,7 +85,7 @@ public Optional getOffset() { } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -134,7 +135,7 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -213,12 +214,12 @@ public Builder offset(Integer offset) { } @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { + public Builder status(Optional status) { this.status = status; return this; } - public Builder status(ListCreditBundlesResponseParamsStatus status) { + public Builder status(BillingCreditBundleStatus status) { this.status = Optional.ofNullable(status); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponseParamsStatus.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponseParamsStatus.java deleted file mode 100644 index 71590fc..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponseParamsStatus.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListCreditBundlesResponseParamsStatus { - public static final ListCreditBundlesResponseParamsStatus INACTIVE = - new ListCreditBundlesResponseParamsStatus(Value.INACTIVE, "inactive"); - - public static final ListCreditBundlesResponseParamsStatus ACTIVE = - new ListCreditBundlesResponseParamsStatus(Value.ACTIVE, "active"); - - private final Value value; - - private final String string; - - ListCreditBundlesResponseParamsStatus(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 ListCreditBundlesResponseParamsStatus - && this.string.equals(((ListCreditBundlesResponseParamsStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case INACTIVE: - return visitor.visitInactive(); - case ACTIVE: - return visitor.visitActive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCreditBundlesResponseParamsStatus valueOf(String value) { - switch (value) { - case "inactive": - return INACTIVE; - case "active": - return ACTIVE; - default: - return new ListCreditBundlesResponseParamsStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - ACTIVE, - - INACTIVE, - - UNKNOWN - } - - public interface Visitor { - T visitActive(); - - T visitInactive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.java deleted file mode 100644 index 137553e..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryType.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateBillingPlanCreditGrantRequestBodyExpiryType { - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType END_OF_BILLING_PERIOD = - new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); - - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType DURATION = - new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.DURATION, "duration"); - - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = - new UpdateBillingPlanCreditGrantRequestBodyExpiryType( - Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); - - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType NO_EXPIRY = - new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); - - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryType END_OF_TRIAL = - new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); - - private final Value value; - - private final String string; - - UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UpdateBillingPlanCreditGrantRequestBodyExpiryType - && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyExpiryType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case END_OF_BILLING_PERIOD: - return visitor.visitEndOfBillingPeriod(); - case DURATION: - return visitor.visitDuration(); - case END_OF_NEXT_BILLING_PERIOD: - return visitor.visitEndOfNextBillingPeriod(); - case NO_EXPIRY: - return visitor.visitNoExpiry(); - case END_OF_TRIAL: - return visitor.visitEndOfTrial(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingPlanCreditGrantRequestBodyExpiryType valueOf(String value) { - switch (value) { - case "end_of_billing_period": - return END_OF_BILLING_PERIOD; - case "duration": - return DURATION; - case "end_of_next_billing_period": - return END_OF_NEXT_BILLING_PERIOD; - case "no_expiry": - return NO_EXPIRY; - case "end_of_trial": - return END_OF_TRIAL; - default: - return new UpdateBillingPlanCreditGrantRequestBodyExpiryType(Value.UNKNOWN, value); - } - } - - public enum Value { - DURATION, - - NO_EXPIRY, - - END_OF_TRIAL, - - END_OF_BILLING_PERIOD, - - END_OF_NEXT_BILLING_PERIOD, - - UNKNOWN - } - - public interface Visitor { - T visitDuration(); - - T visitNoExpiry(); - - T visitEndOfTrial(); - - T visitEndOfBillingPeriod(); - - T visitEndOfNextBillingPeriod(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.java deleted file mode 100644 index 4fc45aa..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyExpiryUnit.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateBillingPlanCreditGrantRequestBodyExpiryUnit { - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryUnit BILLING_PERIODS = - new UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); - - public static final UpdateBillingPlanCreditGrantRequestBodyExpiryUnit DAYS = - new UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.DAYS, "days"); - - private final Value value; - - private final String string; - - UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UpdateBillingPlanCreditGrantRequestBodyExpiryUnit - && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyExpiryUnit) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case BILLING_PERIODS: - return visitor.visitBillingPeriods(); - case DAYS: - return visitor.visitDays(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingPlanCreditGrantRequestBodyExpiryUnit valueOf(String value) { - switch (value) { - case "billing_periods": - return BILLING_PERIODS; - case "days": - return DAYS; - default: - return new UpdateBillingPlanCreditGrantRequestBodyExpiryUnit(Value.UNKNOWN, value); - } - } - - public enum Value { - DAYS, - - BILLING_PERIODS, - - UNKNOWN - } - - public interface Visitor { - T visitDays(); - - T visitBillingPeriods(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.java deleted file mode 100644 index e8740c9..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetCadence.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateBillingPlanCreditGrantRequestBodyResetCadence { - public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence YEARLY = - new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.YEARLY, "yearly"); - - public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence MONTHLY = - new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.MONTHLY, "monthly"); - - public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence DAILY = - new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.DAILY, "daily"); - - public static final UpdateBillingPlanCreditGrantRequestBodyResetCadence WEEKLY = - new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.WEEKLY, "weekly"); - - private final Value value; - - private final String string; - - UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UpdateBillingPlanCreditGrantRequestBodyResetCadence - && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyResetCadence) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case YEARLY: - return visitor.visitYearly(); - case MONTHLY: - return visitor.visitMonthly(); - case DAILY: - return visitor.visitDaily(); - case WEEKLY: - return visitor.visitWeekly(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingPlanCreditGrantRequestBodyResetCadence valueOf(String value) { - switch (value) { - case "yearly": - return YEARLY; - case "monthly": - return MONTHLY; - case "daily": - return DAILY; - case "weekly": - return WEEKLY; - default: - return new UpdateBillingPlanCreditGrantRequestBodyResetCadence(Value.UNKNOWN, value); - } - } - - public enum Value { - MONTHLY, - - YEARLY, - - DAILY, - - WEEKLY, - - UNKNOWN - } - - public interface Visitor { - T visitMonthly(); - - T visitYearly(); - - T visitDaily(); - - T visitWeekly(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.java deleted file mode 100644 index 3277aa2..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateBillingPlanCreditGrantRequestBodyResetType { - public static final UpdateBillingPlanCreditGrantRequestBodyResetType NO_RESET = - new UpdateBillingPlanCreditGrantRequestBodyResetType(Value.NO_RESET, "no_reset"); - - public static final UpdateBillingPlanCreditGrantRequestBodyResetType PLAN_PERIOD = - new UpdateBillingPlanCreditGrantRequestBodyResetType(Value.PLAN_PERIOD, "plan_period"); - - private final Value value; - - private final String string; - - UpdateBillingPlanCreditGrantRequestBodyResetType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UpdateBillingPlanCreditGrantRequestBodyResetType - && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyResetType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NO_RESET: - return visitor.visitNoReset(); - case PLAN_PERIOD: - return visitor.visitPlanPeriod(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingPlanCreditGrantRequestBodyResetType valueOf(String value) { - switch (value) { - case "no_reset": - return NO_RESET; - case "plan_period": - return PLAN_PERIOD; - default: - return new UpdateBillingPlanCreditGrantRequestBodyResetType(Value.UNKNOWN, value); - } - } - - public enum Value { - PLAN_PERIOD, - - NO_RESET, - - UNKNOWN - } - - public interface Visitor { - T visitPlanPeriod(); - - T visitNoReset(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryType.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryType.java deleted file mode 100644 index 91ca2fe..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryType.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateCreditBundleDetailsRequestBodyExpiryType { - public static final UpdateCreditBundleDetailsRequestBodyExpiryType END_OF_BILLING_PERIOD = - new UpdateCreditBundleDetailsRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); - - public static final UpdateCreditBundleDetailsRequestBodyExpiryType DURATION = - new UpdateCreditBundleDetailsRequestBodyExpiryType(Value.DURATION, "duration"); - - public static final UpdateCreditBundleDetailsRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = - new UpdateCreditBundleDetailsRequestBodyExpiryType( - Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); - - public static final UpdateCreditBundleDetailsRequestBodyExpiryType NO_EXPIRY = - new UpdateCreditBundleDetailsRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); - - public static final UpdateCreditBundleDetailsRequestBodyExpiryType END_OF_TRIAL = - new UpdateCreditBundleDetailsRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); - - private final Value value; - - private final String string; - - UpdateCreditBundleDetailsRequestBodyExpiryType(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 UpdateCreditBundleDetailsRequestBodyExpiryType - && this.string.equals(((UpdateCreditBundleDetailsRequestBodyExpiryType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case END_OF_BILLING_PERIOD: - return visitor.visitEndOfBillingPeriod(); - case DURATION: - return visitor.visitDuration(); - case END_OF_NEXT_BILLING_PERIOD: - return visitor.visitEndOfNextBillingPeriod(); - case NO_EXPIRY: - return visitor.visitNoExpiry(); - case END_OF_TRIAL: - return visitor.visitEndOfTrial(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateCreditBundleDetailsRequestBodyExpiryType valueOf(String value) { - switch (value) { - case "end_of_billing_period": - return END_OF_BILLING_PERIOD; - case "duration": - return DURATION; - case "end_of_next_billing_period": - return END_OF_NEXT_BILLING_PERIOD; - case "no_expiry": - return NO_EXPIRY; - case "end_of_trial": - return END_OF_TRIAL; - default: - return new UpdateCreditBundleDetailsRequestBodyExpiryType(Value.UNKNOWN, value); - } - } - - public enum Value { - DURATION, - - NO_EXPIRY, - - END_OF_TRIAL, - - END_OF_BILLING_PERIOD, - - END_OF_NEXT_BILLING_PERIOD, - - UNKNOWN - } - - public interface Visitor { - T visitDuration(); - - T visitNoExpiry(); - - T visitEndOfTrial(); - - T visitEndOfBillingPeriod(); - - T visitEndOfNextBillingPeriod(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryUnit.java deleted file mode 100644 index cd1e392..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyExpiryUnit.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateCreditBundleDetailsRequestBodyExpiryUnit { - public static final UpdateCreditBundleDetailsRequestBodyExpiryUnit BILLING_PERIODS = - new UpdateCreditBundleDetailsRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); - - public static final UpdateCreditBundleDetailsRequestBodyExpiryUnit DAYS = - new UpdateCreditBundleDetailsRequestBodyExpiryUnit(Value.DAYS, "days"); - - private final Value value; - - private final String string; - - UpdateCreditBundleDetailsRequestBodyExpiryUnit(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 UpdateCreditBundleDetailsRequestBodyExpiryUnit - && this.string.equals(((UpdateCreditBundleDetailsRequestBodyExpiryUnit) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case BILLING_PERIODS: - return visitor.visitBillingPeriods(); - case DAYS: - return visitor.visitDays(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateCreditBundleDetailsRequestBodyExpiryUnit valueOf(String value) { - switch (value) { - case "billing_periods": - return BILLING_PERIODS; - case "days": - return DAYS; - default: - return new UpdateCreditBundleDetailsRequestBodyExpiryUnit(Value.UNKNOWN, value); - } - } - - public enum Value { - DAYS, - - BILLING_PERIODS, - - UNKNOWN - } - - public interface Visitor { - T visitDays(); - - T visitBillingPeriods(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyStatus.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyStatus.java deleted file mode 100644 index df685dc..0000000 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsRequestBodyStatus.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.credits.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateCreditBundleDetailsRequestBodyStatus { - public static final UpdateCreditBundleDetailsRequestBodyStatus INACTIVE = - new UpdateCreditBundleDetailsRequestBodyStatus(Value.INACTIVE, "inactive"); - - public static final UpdateCreditBundleDetailsRequestBodyStatus ACTIVE = - new UpdateCreditBundleDetailsRequestBodyStatus(Value.ACTIVE, "active"); - - private final Value value; - - private final String string; - - UpdateCreditBundleDetailsRequestBodyStatus(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 UpdateCreditBundleDetailsRequestBodyStatus - && this.string.equals(((UpdateCreditBundleDetailsRequestBodyStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case INACTIVE: - return visitor.visitInactive(); - case ACTIVE: - return visitor.visitActive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateCreditBundleDetailsRequestBodyStatus valueOf(String value) { - switch (value) { - case "inactive": - return INACTIVE; - case "active": - return ACTIVE; - default: - return new UpdateCreditBundleDetailsRequestBodyStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - ACTIVE, - - INACTIVE, - - UNKNOWN - } - - public interface Visitor { - T visitActive(); - - T visitInactive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/AsyncCrmClient.java b/src/main/java/com/schematic/api/resources/crm/AsyncCrmClient.java deleted file mode 100644 index f8c6ff9..0000000 --- a/src/main/java/com/schematic/api/resources/crm/AsyncCrmClient.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm; - -import com.schematic.api.core.ClientOptions; -import com.schematic.api.core.RequestOptions; -import com.schematic.api.resources.crm.requests.CreateCrmDealLineItemAssociationRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmDealRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmLineItemRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmProductRequestBody; -import com.schematic.api.resources.crm.requests.ListCrmProductsRequest; -import com.schematic.api.resources.crm.types.ListCrmProductsResponse; -import com.schematic.api.resources.crm.types.UpsertCrmDealResponse; -import com.schematic.api.resources.crm.types.UpsertCrmProductResponse; -import com.schematic.api.resources.crm.types.UpsertDealLineItemAssociationResponse; -import com.schematic.api.resources.crm.types.UpsertLineItemResponse; -import java.util.concurrent.CompletableFuture; - -public class AsyncCrmClient { - protected final ClientOptions clientOptions; - - private final AsyncRawCrmClient rawClient; - - public AsyncCrmClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawCrmClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawCrmClient withRawResponse() { - return this.rawClient; - } - - public CompletableFuture upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request) { - return this.rawClient.upsertDealLineItemAssociation(request).thenApply(response -> response.body()); - } - - public CompletableFuture upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request, RequestOptions requestOptions) { - return this.rawClient - .upsertDealLineItemAssociation(request, requestOptions) - .thenApply(response -> response.body()); - } - - public CompletableFuture upsertLineItem(CreateCrmLineItemRequestBody request) { - return this.rawClient.upsertLineItem(request).thenApply(response -> response.body()); - } - - public CompletableFuture upsertLineItem( - CreateCrmLineItemRequestBody request, RequestOptions requestOptions) { - return this.rawClient.upsertLineItem(request, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture upsertCrmDeal(CreateCrmDealRequestBody request) { - return this.rawClient.upsertCrmDeal(request).thenApply(response -> response.body()); - } - - public CompletableFuture upsertCrmDeal( - CreateCrmDealRequestBody request, RequestOptions requestOptions) { - return this.rawClient.upsertCrmDeal(request, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture listCrmProducts() { - return this.rawClient.listCrmProducts().thenApply(response -> response.body()); - } - - public CompletableFuture listCrmProducts(ListCrmProductsRequest request) { - return this.rawClient.listCrmProducts(request).thenApply(response -> response.body()); - } - - public CompletableFuture listCrmProducts( - ListCrmProductsRequest request, RequestOptions requestOptions) { - return this.rawClient.listCrmProducts(request, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture upsertCrmProduct(CreateCrmProductRequestBody request) { - return this.rawClient.upsertCrmProduct(request).thenApply(response -> response.body()); - } - - public CompletableFuture upsertCrmProduct( - CreateCrmProductRequestBody request, RequestOptions requestOptions) { - return this.rawClient.upsertCrmProduct(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/AsyncRawCrmClient.java b/src/main/java/com/schematic/api/resources/crm/AsyncRawCrmClient.java deleted file mode 100644 index e8ba567..0000000 --- a/src/main/java/com/schematic/api/resources/crm/AsyncRawCrmClient.java +++ /dev/null @@ -1,521 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm; - -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.MediaTypes; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.core.QueryStringMapper; -import com.schematic.api.core.RequestOptions; -import com.schematic.api.errors.BadRequestError; -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.crm.requests.CreateCrmDealLineItemAssociationRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmDealRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmLineItemRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmProductRequestBody; -import com.schematic.api.resources.crm.requests.ListCrmProductsRequest; -import com.schematic.api.resources.crm.types.ListCrmProductsResponse; -import com.schematic.api.resources.crm.types.UpsertCrmDealResponse; -import com.schematic.api.resources.crm.types.UpsertCrmProductResponse; -import com.schematic.api.resources.crm.types.UpsertDealLineItemAssociationResponse; -import com.schematic.api.resources.crm.types.UpsertLineItemResponse; -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.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -public class AsyncRawCrmClient { - protected final ClientOptions clientOptions; - - public AsyncRawCrmClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public CompletableFuture> - upsertDealLineItemAssociation(CreateCrmDealLineItemAssociationRequestBody request) { - return upsertDealLineItemAssociation(request, null); - } - - public CompletableFuture> - upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/associations/deal-line-item") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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()) { - if (response.isSuccessful()) { - future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertDealLineItemAssociationResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - return future; - } - - public CompletableFuture> upsertLineItem( - CreateCrmLineItemRequestBody request) { - return upsertLineItem(request, null); - } - - public CompletableFuture> upsertLineItem( - CreateCrmLineItemRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/deal-line-item/upsert") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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()) { - if (response.isSuccessful()) { - future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertLineItemResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - return future; - } - - public CompletableFuture> upsertCrmDeal( - CreateCrmDealRequestBody request) { - return upsertCrmDeal(request, null); - } - - public CompletableFuture> upsertCrmDeal( - CreateCrmDealRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/deals/upsert") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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()) { - if (response.isSuccessful()) { - future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertCrmDealResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - return future; - } - - public CompletableFuture> listCrmProducts() { - return listCrmProducts(ListCrmProductsRequest.builder().build()); - } - - public CompletableFuture> listCrmProducts( - ListCrmProductsRequest request) { - return listCrmProducts(request, null); - } - - public CompletableFuture> listCrmProducts( - ListCrmProductsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/products"); - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "name", request.getName().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); - } - 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()) { - if (response.isSuccessful()) { - future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCrmProductsResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - return future; - } - - public CompletableFuture> upsertCrmProduct( - CreateCrmProductRequestBody request) { - return upsertCrmProduct(request, null); - } - - public CompletableFuture> upsertCrmProduct( - CreateCrmProductRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/products/upsert") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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()) { - if (response.isSuccessful()) { - future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertCrmProductResponse.class), - response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - future.completeExceptionally(new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 401: - future.completeExceptionally(new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 403: - future.completeExceptionally(new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 404: - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - case 500: - future.completeExceptionally(new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } catch (IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/CrmClient.java b/src/main/java/com/schematic/api/resources/crm/CrmClient.java deleted file mode 100644 index f6a87b3..0000000 --- a/src/main/java/com/schematic/api/resources/crm/CrmClient.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm; - -import com.schematic.api.core.ClientOptions; -import com.schematic.api.core.RequestOptions; -import com.schematic.api.resources.crm.requests.CreateCrmDealLineItemAssociationRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmDealRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmLineItemRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmProductRequestBody; -import com.schematic.api.resources.crm.requests.ListCrmProductsRequest; -import com.schematic.api.resources.crm.types.ListCrmProductsResponse; -import com.schematic.api.resources.crm.types.UpsertCrmDealResponse; -import com.schematic.api.resources.crm.types.UpsertCrmProductResponse; -import com.schematic.api.resources.crm.types.UpsertDealLineItemAssociationResponse; -import com.schematic.api.resources.crm.types.UpsertLineItemResponse; - -public class CrmClient { - protected final ClientOptions clientOptions; - - private final RawCrmClient rawClient; - - public CrmClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawCrmClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawCrmClient withRawResponse() { - return this.rawClient; - } - - public UpsertDealLineItemAssociationResponse upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request) { - return this.rawClient.upsertDealLineItemAssociation(request).body(); - } - - public UpsertDealLineItemAssociationResponse upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request, RequestOptions requestOptions) { - return this.rawClient - .upsertDealLineItemAssociation(request, requestOptions) - .body(); - } - - public UpsertLineItemResponse upsertLineItem(CreateCrmLineItemRequestBody request) { - return this.rawClient.upsertLineItem(request).body(); - } - - public UpsertLineItemResponse upsertLineItem(CreateCrmLineItemRequestBody request, RequestOptions requestOptions) { - return this.rawClient.upsertLineItem(request, requestOptions).body(); - } - - public UpsertCrmDealResponse upsertCrmDeal(CreateCrmDealRequestBody request) { - return this.rawClient.upsertCrmDeal(request).body(); - } - - public UpsertCrmDealResponse upsertCrmDeal(CreateCrmDealRequestBody request, RequestOptions requestOptions) { - return this.rawClient.upsertCrmDeal(request, requestOptions).body(); - } - - public ListCrmProductsResponse listCrmProducts() { - return this.rawClient.listCrmProducts().body(); - } - - public ListCrmProductsResponse listCrmProducts(ListCrmProductsRequest request) { - return this.rawClient.listCrmProducts(request).body(); - } - - public ListCrmProductsResponse listCrmProducts(ListCrmProductsRequest request, RequestOptions requestOptions) { - return this.rawClient.listCrmProducts(request, requestOptions).body(); - } - - public UpsertCrmProductResponse upsertCrmProduct(CreateCrmProductRequestBody request) { - return this.rawClient.upsertCrmProduct(request).body(); - } - - public UpsertCrmProductResponse upsertCrmProduct( - CreateCrmProductRequestBody request, RequestOptions requestOptions) { - return this.rawClient.upsertCrmProduct(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/RawCrmClient.java b/src/main/java/com/schematic/api/resources/crm/RawCrmClient.java deleted file mode 100644 index dea3d02..0000000 --- a/src/main/java/com/schematic/api/resources/crm/RawCrmClient.java +++ /dev/null @@ -1,393 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm; - -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.MediaTypes; -import com.schematic.api.core.ObjectMappers; -import com.schematic.api.core.QueryStringMapper; -import com.schematic.api.core.RequestOptions; -import com.schematic.api.errors.BadRequestError; -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.crm.requests.CreateCrmDealLineItemAssociationRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmDealRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmLineItemRequestBody; -import com.schematic.api.resources.crm.requests.CreateCrmProductRequestBody; -import com.schematic.api.resources.crm.requests.ListCrmProductsRequest; -import com.schematic.api.resources.crm.types.ListCrmProductsResponse; -import com.schematic.api.resources.crm.types.UpsertCrmDealResponse; -import com.schematic.api.resources.crm.types.UpsertCrmProductResponse; -import com.schematic.api.resources.crm.types.UpsertDealLineItemAssociationResponse; -import com.schematic.api.resources.crm.types.UpsertLineItemResponse; -import com.schematic.api.types.ApiError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; - -public class RawCrmClient { - protected final ClientOptions clientOptions; - - public RawCrmClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public BaseSchematicHttpResponse upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request) { - return upsertDealLineItemAssociation(request, null); - } - - public BaseSchematicHttpResponse upsertDealLineItemAssociation( - CreateCrmDealLineItemAssociationRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/associations/deal-line-item") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertDealLineItemAssociationResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - - public BaseSchematicHttpResponse upsertLineItem(CreateCrmLineItemRequestBody request) { - return upsertLineItem(request, null); - } - - public BaseSchematicHttpResponse upsertLineItem( - CreateCrmLineItemRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/deal-line-item/upsert") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertLineItemResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - - public BaseSchematicHttpResponse upsertCrmDeal(CreateCrmDealRequestBody request) { - return upsertCrmDeal(request, null); - } - - public BaseSchematicHttpResponse upsertCrmDeal( - CreateCrmDealRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/deals/upsert") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertCrmDealResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - - public BaseSchematicHttpResponse listCrmProducts() { - return listCrmProducts(ListCrmProductsRequest.builder().build()); - } - - public BaseSchematicHttpResponse listCrmProducts(ListCrmProductsRequest request) { - return listCrmProducts(request, null); - } - - public BaseSchematicHttpResponse listCrmProducts( - ListCrmProductsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/products"); - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "name", request.getName().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); - } - 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(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCrmProductsResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } - - public BaseSchematicHttpResponse upsertCrmProduct(CreateCrmProductRequestBody request) { - return upsertCrmProduct(request, null); - } - - public BaseSchematicHttpResponse upsertCrmProduct( - CreateCrmProductRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("crm/products/upsert") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new BaseSchematicException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("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(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertCrmProductResponse.class), - response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - switch (response.code()) { - case 400: - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 401: - throw new UnauthorizedError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 403: - throw new ForbiddenError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 404: - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - case 500: - throw new InternalServerError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); - } catch (IOException e) { - throw new BaseSchematicException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmDealLineItemAssociationRequestBody.java b/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmDealLineItemAssociationRequestBody.java deleted file mode 100644 index 91ac62e..0000000 --- a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmDealLineItemAssociationRequestBody.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm.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.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 = CreateCrmDealLineItemAssociationRequestBody.Builder.class) -public final class CreateCrmDealLineItemAssociationRequestBody { - private final String dealExternalId; - - private final String lineItemExternalId; - - private final Map additionalProperties; - - private CreateCrmDealLineItemAssociationRequestBody( - String dealExternalId, String lineItemExternalId, Map additionalProperties) { - this.dealExternalId = dealExternalId; - this.lineItemExternalId = lineItemExternalId; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("deal_external_id") - public String getDealExternalId() { - return dealExternalId; - } - - @JsonProperty("line_item_external_id") - public String getLineItemExternalId() { - return lineItemExternalId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateCrmDealLineItemAssociationRequestBody - && equalTo((CreateCrmDealLineItemAssociationRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateCrmDealLineItemAssociationRequestBody other) { - return dealExternalId.equals(other.dealExternalId) && lineItemExternalId.equals(other.lineItemExternalId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.dealExternalId, this.lineItemExternalId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DealExternalIdStage builder() { - return new Builder(); - } - - public interface DealExternalIdStage { - LineItemExternalIdStage dealExternalId(@NotNull String dealExternalId); - - Builder from(CreateCrmDealLineItemAssociationRequestBody other); - } - - public interface LineItemExternalIdStage { - _FinalStage lineItemExternalId(@NotNull String lineItemExternalId); - } - - public interface _FinalStage { - CreateCrmDealLineItemAssociationRequestBody build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DealExternalIdStage, LineItemExternalIdStage, _FinalStage { - private String dealExternalId; - - private String lineItemExternalId; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateCrmDealLineItemAssociationRequestBody other) { - dealExternalId(other.getDealExternalId()); - lineItemExternalId(other.getLineItemExternalId()); - return this; - } - - @java.lang.Override - @JsonSetter("deal_external_id") - public LineItemExternalIdStage dealExternalId(@NotNull String dealExternalId) { - this.dealExternalId = Objects.requireNonNull(dealExternalId, "dealExternalId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("line_item_external_id") - public _FinalStage lineItemExternalId(@NotNull String lineItemExternalId) { - this.lineItemExternalId = Objects.requireNonNull(lineItemExternalId, "lineItemExternalId must not be null"); - return this; - } - - @java.lang.Override - public CreateCrmDealLineItemAssociationRequestBody build() { - return new CreateCrmDealLineItemAssociationRequestBody( - dealExternalId, lineItemExternalId, additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmDealRequestBody.java b/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmDealRequestBody.java deleted file mode 100644 index cfbb64c..0000000 --- a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmDealRequestBody.java +++ /dev/null @@ -1,353 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm.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 = CreateCrmDealRequestBody.Builder.class) -public final class CreateCrmDealRequestBody { - private final Optional arr; - - private final Optional crmCompanyId; - - private final String crmCompanyKey; - - private final Optional crmProductId; - - private final String crmType; - - private final String dealExternalId; - - private final Optional dealName; - - private final Optional dealStage; - - private final Optional mrr; - - private final Map additionalProperties; - - private CreateCrmDealRequestBody( - Optional arr, - Optional crmCompanyId, - String crmCompanyKey, - Optional crmProductId, - String crmType, - String dealExternalId, - Optional dealName, - Optional dealStage, - Optional mrr, - Map additionalProperties) { - this.arr = arr; - this.crmCompanyId = crmCompanyId; - this.crmCompanyKey = crmCompanyKey; - this.crmProductId = crmProductId; - this.crmType = crmType; - this.dealExternalId = dealExternalId; - this.dealName = dealName; - this.dealStage = dealStage; - this.mrr = mrr; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("arr") - public Optional getArr() { - return arr; - } - - @JsonProperty("crm_company_id") - public Optional getCrmCompanyId() { - return crmCompanyId; - } - - @JsonProperty("crm_company_key") - public String getCrmCompanyKey() { - return crmCompanyKey; - } - - @JsonProperty("crm_product_id") - public Optional getCrmProductId() { - return crmProductId; - } - - @JsonProperty("crm_type") - public String getCrmType() { - return crmType; - } - - @JsonProperty("deal_external_id") - public String getDealExternalId() { - return dealExternalId; - } - - @JsonProperty("deal_name") - public Optional getDealName() { - return dealName; - } - - @JsonProperty("deal_stage") - public Optional getDealStage() { - return dealStage; - } - - @JsonProperty("mrr") - public Optional getMrr() { - return mrr; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateCrmDealRequestBody && equalTo((CreateCrmDealRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateCrmDealRequestBody other) { - return arr.equals(other.arr) - && crmCompanyId.equals(other.crmCompanyId) - && crmCompanyKey.equals(other.crmCompanyKey) - && crmProductId.equals(other.crmProductId) - && crmType.equals(other.crmType) - && dealExternalId.equals(other.dealExternalId) - && dealName.equals(other.dealName) - && dealStage.equals(other.dealStage) - && mrr.equals(other.mrr); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.arr, - this.crmCompanyId, - this.crmCompanyKey, - this.crmProductId, - this.crmType, - this.dealExternalId, - this.dealName, - this.dealStage, - this.mrr); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static CrmCompanyKeyStage builder() { - return new Builder(); - } - - public interface CrmCompanyKeyStage { - CrmTypeStage crmCompanyKey(@NotNull String crmCompanyKey); - - Builder from(CreateCrmDealRequestBody other); - } - - public interface CrmTypeStage { - DealExternalIdStage crmType(@NotNull String crmType); - } - - public interface DealExternalIdStage { - _FinalStage dealExternalId(@NotNull String dealExternalId); - } - - public interface _FinalStage { - CreateCrmDealRequestBody build(); - - _FinalStage arr(Optional arr); - - _FinalStage arr(String arr); - - _FinalStage crmCompanyId(Optional crmCompanyId); - - _FinalStage crmCompanyId(String crmCompanyId); - - _FinalStage crmProductId(Optional crmProductId); - - _FinalStage crmProductId(String crmProductId); - - _FinalStage dealName(Optional dealName); - - _FinalStage dealName(String dealName); - - _FinalStage dealStage(Optional dealStage); - - _FinalStage dealStage(String dealStage); - - _FinalStage mrr(Optional mrr); - - _FinalStage mrr(String mrr); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CrmCompanyKeyStage, CrmTypeStage, DealExternalIdStage, _FinalStage { - private String crmCompanyKey; - - private String crmType; - - private String dealExternalId; - - private Optional mrr = Optional.empty(); - - private Optional dealStage = Optional.empty(); - - private Optional dealName = Optional.empty(); - - private Optional crmProductId = Optional.empty(); - - private Optional crmCompanyId = Optional.empty(); - - private Optional arr = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateCrmDealRequestBody other) { - arr(other.getArr()); - crmCompanyId(other.getCrmCompanyId()); - crmCompanyKey(other.getCrmCompanyKey()); - crmProductId(other.getCrmProductId()); - crmType(other.getCrmType()); - dealExternalId(other.getDealExternalId()); - dealName(other.getDealName()); - dealStage(other.getDealStage()); - mrr(other.getMrr()); - return this; - } - - @java.lang.Override - @JsonSetter("crm_company_key") - public CrmTypeStage crmCompanyKey(@NotNull String crmCompanyKey) { - this.crmCompanyKey = Objects.requireNonNull(crmCompanyKey, "crmCompanyKey must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("crm_type") - public DealExternalIdStage crmType(@NotNull String crmType) { - this.crmType = Objects.requireNonNull(crmType, "crmType must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("deal_external_id") - public _FinalStage dealExternalId(@NotNull String dealExternalId) { - this.dealExternalId = Objects.requireNonNull(dealExternalId, "dealExternalId must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage mrr(String mrr) { - this.mrr = Optional.ofNullable(mrr); - return this; - } - - @java.lang.Override - @JsonSetter(value = "mrr", nulls = Nulls.SKIP) - public _FinalStage mrr(Optional mrr) { - this.mrr = mrr; - return this; - } - - @java.lang.Override - public _FinalStage dealStage(String dealStage) { - this.dealStage = Optional.ofNullable(dealStage); - return this; - } - - @java.lang.Override - @JsonSetter(value = "deal_stage", nulls = Nulls.SKIP) - public _FinalStage dealStage(Optional dealStage) { - this.dealStage = dealStage; - return this; - } - - @java.lang.Override - public _FinalStage dealName(String dealName) { - this.dealName = Optional.ofNullable(dealName); - return this; - } - - @java.lang.Override - @JsonSetter(value = "deal_name", nulls = Nulls.SKIP) - public _FinalStage dealName(Optional dealName) { - this.dealName = dealName; - return this; - } - - @java.lang.Override - public _FinalStage crmProductId(String crmProductId) { - this.crmProductId = Optional.ofNullable(crmProductId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "crm_product_id", nulls = Nulls.SKIP) - public _FinalStage crmProductId(Optional crmProductId) { - this.crmProductId = crmProductId; - return this; - } - - @java.lang.Override - public _FinalStage crmCompanyId(String crmCompanyId) { - this.crmCompanyId = Optional.ofNullable(crmCompanyId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "crm_company_id", nulls = Nulls.SKIP) - public _FinalStage crmCompanyId(Optional crmCompanyId) { - this.crmCompanyId = crmCompanyId; - return this; - } - - @java.lang.Override - public _FinalStage arr(String arr) { - this.arr = Optional.ofNullable(arr); - return this; - } - - @java.lang.Override - @JsonSetter(value = "arr", nulls = Nulls.SKIP) - public _FinalStage arr(Optional arr) { - this.arr = arr; - return this; - } - - @java.lang.Override - public CreateCrmDealRequestBody build() { - return new CreateCrmDealRequestBody( - arr, - crmCompanyId, - crmCompanyKey, - crmProductId, - crmType, - dealExternalId, - dealName, - dealStage, - mrr, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmLineItemRequestBody.java b/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmLineItemRequestBody.java deleted file mode 100644 index 662085f..0000000 --- a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmLineItemRequestBody.java +++ /dev/null @@ -1,315 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm.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 = CreateCrmLineItemRequestBody.Builder.class) -public final class CreateCrmLineItemRequestBody { - private final String amount; - - private final Optional discountPercentage; - - private final String interval; - - private final String lineItemExternalId; - - private final String productExternalId; - - private final int quantity; - - private final Optional termMonth; - - private final Optional totalDiscount; - - private final Map additionalProperties; - - private CreateCrmLineItemRequestBody( - String amount, - Optional discountPercentage, - String interval, - String lineItemExternalId, - String productExternalId, - int quantity, - Optional termMonth, - Optional totalDiscount, - Map additionalProperties) { - this.amount = amount; - this.discountPercentage = discountPercentage; - this.interval = interval; - this.lineItemExternalId = lineItemExternalId; - this.productExternalId = productExternalId; - this.quantity = quantity; - this.termMonth = termMonth; - this.totalDiscount = totalDiscount; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("amount") - public String getAmount() { - return amount; - } - - @JsonProperty("discount_percentage") - public Optional getDiscountPercentage() { - return discountPercentage; - } - - @JsonProperty("interval") - public String getInterval() { - return interval; - } - - @JsonProperty("line_item_external_id") - public String getLineItemExternalId() { - return lineItemExternalId; - } - - @JsonProperty("product_external_id") - public String getProductExternalId() { - return productExternalId; - } - - @JsonProperty("quantity") - public int getQuantity() { - return quantity; - } - - @JsonProperty("term_month") - public Optional getTermMonth() { - return termMonth; - } - - @JsonProperty("total_discount") - public Optional getTotalDiscount() { - return totalDiscount; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateCrmLineItemRequestBody && equalTo((CreateCrmLineItemRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateCrmLineItemRequestBody other) { - return amount.equals(other.amount) - && discountPercentage.equals(other.discountPercentage) - && interval.equals(other.interval) - && lineItemExternalId.equals(other.lineItemExternalId) - && productExternalId.equals(other.productExternalId) - && quantity == other.quantity - && termMonth.equals(other.termMonth) - && totalDiscount.equals(other.totalDiscount); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.amount, - this.discountPercentage, - this.interval, - this.lineItemExternalId, - this.productExternalId, - this.quantity, - this.termMonth, - this.totalDiscount); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static AmountStage builder() { - return new Builder(); - } - - public interface AmountStage { - IntervalStage amount(@NotNull String amount); - - Builder from(CreateCrmLineItemRequestBody other); - } - - public interface IntervalStage { - LineItemExternalIdStage interval(@NotNull String interval); - } - - public interface LineItemExternalIdStage { - ProductExternalIdStage lineItemExternalId(@NotNull String lineItemExternalId); - } - - public interface ProductExternalIdStage { - QuantityStage productExternalId(@NotNull String productExternalId); - } - - public interface QuantityStage { - _FinalStage quantity(int quantity); - } - - public interface _FinalStage { - CreateCrmLineItemRequestBody build(); - - _FinalStage discountPercentage(Optional discountPercentage); - - _FinalStage discountPercentage(String discountPercentage); - - _FinalStage termMonth(Optional termMonth); - - _FinalStage termMonth(Integer termMonth); - - _FinalStage totalDiscount(Optional totalDiscount); - - _FinalStage totalDiscount(String totalDiscount); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements AmountStage, - IntervalStage, - LineItemExternalIdStage, - ProductExternalIdStage, - QuantityStage, - _FinalStage { - private String amount; - - private String interval; - - private String lineItemExternalId; - - private String productExternalId; - - private int quantity; - - private Optional totalDiscount = Optional.empty(); - - private Optional termMonth = Optional.empty(); - - private Optional discountPercentage = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateCrmLineItemRequestBody other) { - amount(other.getAmount()); - discountPercentage(other.getDiscountPercentage()); - interval(other.getInterval()); - lineItemExternalId(other.getLineItemExternalId()); - productExternalId(other.getProductExternalId()); - quantity(other.getQuantity()); - termMonth(other.getTermMonth()); - totalDiscount(other.getTotalDiscount()); - return this; - } - - @java.lang.Override - @JsonSetter("amount") - public IntervalStage amount(@NotNull String amount) { - this.amount = Objects.requireNonNull(amount, "amount must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("interval") - public LineItemExternalIdStage interval(@NotNull String interval) { - this.interval = Objects.requireNonNull(interval, "interval must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("line_item_external_id") - public ProductExternalIdStage lineItemExternalId(@NotNull String lineItemExternalId) { - this.lineItemExternalId = Objects.requireNonNull(lineItemExternalId, "lineItemExternalId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("product_external_id") - public QuantityStage productExternalId(@NotNull String productExternalId) { - this.productExternalId = Objects.requireNonNull(productExternalId, "productExternalId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("quantity") - public _FinalStage quantity(int quantity) { - this.quantity = quantity; - return this; - } - - @java.lang.Override - public _FinalStage totalDiscount(String totalDiscount) { - this.totalDiscount = Optional.ofNullable(totalDiscount); - return this; - } - - @java.lang.Override - @JsonSetter(value = "total_discount", nulls = Nulls.SKIP) - public _FinalStage totalDiscount(Optional totalDiscount) { - this.totalDiscount = totalDiscount; - return this; - } - - @java.lang.Override - public _FinalStage termMonth(Integer termMonth) { - this.termMonth = Optional.ofNullable(termMonth); - return this; - } - - @java.lang.Override - @JsonSetter(value = "term_month", nulls = Nulls.SKIP) - public _FinalStage termMonth(Optional termMonth) { - this.termMonth = termMonth; - return this; - } - - @java.lang.Override - public _FinalStage discountPercentage(String discountPercentage) { - this.discountPercentage = Optional.ofNullable(discountPercentage); - return this; - } - - @java.lang.Override - @JsonSetter(value = "discount_percentage", nulls = Nulls.SKIP) - public _FinalStage discountPercentage(Optional discountPercentage) { - this.discountPercentage = discountPercentage; - return this; - } - - @java.lang.Override - public CreateCrmLineItemRequestBody build() { - return new CreateCrmLineItemRequestBody( - amount, - discountPercentage, - interval, - lineItemExternalId, - productExternalId, - quantity, - termMonth, - totalDiscount, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmProductRequestBody.java b/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmProductRequestBody.java deleted file mode 100644 index 0b47183..0000000 --- a/src/main/java/com/schematic/api/resources/crm/requests/CreateCrmProductRequestBody.java +++ /dev/null @@ -1,290 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.crm.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.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 = CreateCrmProductRequestBody.Builder.class) -public final class CreateCrmProductRequestBody { - private final String currency; - - private final String description; - - private final String externalId; - - private final String interval; - - private final String name; - - private final String price; - - private final int quantity; - - private final String sku; - - private final Map additionalProperties; - - private CreateCrmProductRequestBody( - String currency, - String description, - String externalId, - String interval, - String name, - String price, - int quantity, - String sku, - Map additionalProperties) { - this.currency = currency; - this.description = description; - this.externalId = externalId; - this.interval = interval; - this.name = name; - this.price = price; - this.quantity = quantity; - this.sku = sku; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("currency") - public String getCurrency() { - return currency; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("external_id") - public String getExternalId() { - return externalId; - } - - @JsonProperty("interval") - public String getInterval() { - return interval; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("price") - public String getPrice() { - return price; - } - - @JsonProperty("quantity") - public int getQuantity() { - return quantity; - } - - @JsonProperty("sku") - public String getSku() { - return sku; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateCrmProductRequestBody && equalTo((CreateCrmProductRequestBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateCrmProductRequestBody other) { - return currency.equals(other.currency) - && description.equals(other.description) - && externalId.equals(other.externalId) - && interval.equals(other.interval) - && name.equals(other.name) - && price.equals(other.price) - && quantity == other.quantity - && sku.equals(other.sku); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.currency, - this.description, - this.externalId, - this.interval, - this.name, - this.price, - this.quantity, - this.sku); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static CurrencyStage builder() { - return new Builder(); - } - - public interface CurrencyStage { - DescriptionStage currency(@NotNull String currency); - - Builder from(CreateCrmProductRequestBody other); - } - - public interface DescriptionStage { - ExternalIdStage description(@NotNull String description); - } - - public interface ExternalIdStage { - IntervalStage externalId(@NotNull String externalId); - } - - public interface IntervalStage { - NameStage interval(@NotNull String interval); - } - - public interface NameStage { - PriceStage name(@NotNull String name); - } - - public interface PriceStage { - QuantityStage price(@NotNull String price); - } - - public interface QuantityStage { - SkuStage quantity(int quantity); - } - - public interface SkuStage { - _FinalStage sku(@NotNull String sku); - } - - public interface _FinalStage { - CreateCrmProductRequestBody build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements CurrencyStage, - DescriptionStage, - ExternalIdStage, - IntervalStage, - NameStage, - PriceStage, - QuantityStage, - SkuStage, - _FinalStage { - private String currency; - - private String description; - - private String externalId; - - private String interval; - - private String name; - - private String price; - - private int quantity; - - private String sku; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateCrmProductRequestBody other) { - currency(other.getCurrency()); - description(other.getDescription()); - externalId(other.getExternalId()); - interval(other.getInterval()); - name(other.getName()); - price(other.getPrice()); - quantity(other.getQuantity()); - sku(other.getSku()); - return this; - } - - @java.lang.Override - @JsonSetter("currency") - public DescriptionStage currency(@NotNull String currency) { - this.currency = Objects.requireNonNull(currency, "currency must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("description") - public ExternalIdStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("external_id") - public IntervalStage externalId(@NotNull String externalId) { - this.externalId = Objects.requireNonNull(externalId, "externalId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("interval") - public NameStage interval(@NotNull String interval) { - this.interval = Objects.requireNonNull(interval, "interval must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public PriceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("price") - public QuantityStage price(@NotNull String price) { - this.price = Objects.requireNonNull(price, "price must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("quantity") - public SkuStage quantity(int quantity) { - this.quantity = quantity; - return this; - } - - @java.lang.Override - @JsonSetter("sku") - public _FinalStage sku(@NotNull String sku) { - this.sku = Objects.requireNonNull(sku, "sku must not be null"); - return this; - } - - @java.lang.Override - public CreateCrmProductRequestBody build() { - return new CreateCrmProductRequestBody( - currency, description, externalId, interval, name, price, quantity, sku, additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java b/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java index 42bb3ab..34c8b3b 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java +++ b/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java @@ -19,18 +19,25 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateDataExportRequestBody.Builder.class) public final class CreateDataExportRequestBody { + private final String exportType; + private final String metadata; + private final String outputFileType; + private final Map additionalProperties; - private CreateDataExportRequestBody(String metadata, Map additionalProperties) { + private CreateDataExportRequestBody( + String exportType, String metadata, String outputFileType, Map additionalProperties) { + this.exportType = exportType; this.metadata = metadata; + this.outputFileType = outputFileType; this.additionalProperties = additionalProperties; } @JsonProperty("export_type") public String getExportType() { - return "company-feature-usage"; + return exportType; } @JsonProperty("metadata") @@ -40,7 +47,7 @@ public String getMetadata() { @JsonProperty("output_file_type") public String getOutputFileType() { - return "csv"; + return outputFileType; } @java.lang.Override @@ -55,12 +62,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(CreateDataExportRequestBody other) { - return metadata.equals(other.metadata); + return exportType.equals(other.exportType) + && metadata.equals(other.metadata) + && outputFileType.equals(other.outputFileType); } @java.lang.Override public int hashCode() { - return Objects.hash(this.metadata); + return Objects.hash(this.exportType, this.metadata, this.outputFileType); } @java.lang.Override @@ -68,24 +77,36 @@ public String toString() { return ObjectMappers.stringify(this); } - public static MetadataStage builder() { + public static ExportTypeStage builder() { return new Builder(); } - public interface MetadataStage { - _FinalStage metadata(@NotNull String metadata); + public interface ExportTypeStage { + MetadataStage exportType(@NotNull String exportType); Builder from(CreateDataExportRequestBody other); } + public interface MetadataStage { + OutputFileTypeStage metadata(@NotNull String metadata); + } + + public interface OutputFileTypeStage { + _FinalStage outputFileType(@NotNull String outputFileType); + } + public interface _FinalStage { CreateDataExportRequestBody build(); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MetadataStage, _FinalStage { + public static final class Builder implements ExportTypeStage, MetadataStage, OutputFileTypeStage, _FinalStage { + private String exportType; + private String metadata; + private String outputFileType; + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -93,20 +114,36 @@ private Builder() {} @java.lang.Override public Builder from(CreateDataExportRequestBody other) { + exportType(other.getExportType()); metadata(other.getMetadata()); + outputFileType(other.getOutputFileType()); + return this; + } + + @java.lang.Override + @JsonSetter("export_type") + public MetadataStage exportType(@NotNull String exportType) { + this.exportType = Objects.requireNonNull(exportType, "exportType must not be null"); return this; } @java.lang.Override @JsonSetter("metadata") - public _FinalStage metadata(@NotNull String metadata) { + public OutputFileTypeStage metadata(@NotNull String metadata) { this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); return this; } + @java.lang.Override + @JsonSetter("output_file_type") + public _FinalStage outputFileType(@NotNull String outputFileType) { + this.outputFileType = Objects.requireNonNull(outputFileType, "outputFileType must not be null"); + return this; + } + @java.lang.Override public CreateDataExportRequestBody build() { - return new CreateDataExportRequestBody(metadata, additionalProperties); + return new CreateDataExportRequestBody(exportType, metadata, outputFileType, additionalProperties); } } } 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 cbc8adf..3e2b0a6 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java @@ -12,7 +12,9 @@ import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; +import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -29,8 +31,10 @@ import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.DeleteCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.DeletePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.DuplicatePlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.GetCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; @@ -161,6 +165,16 @@ public CompletableFuture listFeatureUsage( return this.rawClient.listFeatureUsage(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request) { + return this.rawClient.getFeatureUsageTimeSeries(request).thenApply(response -> response.body()); + } + + public CompletableFuture getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request, RequestOptions requestOptions) { + return this.rawClient.getFeatureUsageTimeSeries(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countFeatureUsage() { return this.rawClient.countFeatureUsage().thenApply(response -> response.body()); } @@ -263,6 +277,16 @@ public CompletableFuture countPlanEntitlements( return this.rawClient.countPlanEntitlements(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request) { + return this.rawClient.duplicatePlanEntitlements(request).thenApply(response -> response.body()); + } + + public CompletableFuture duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request, RequestOptions requestOptions) { + return this.rawClient.duplicatePlanEntitlements(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture getFeatureUsageByCompany( GetFeatureUsageByCompanyRequest request) { return this.rawClient.getFeatureUsageByCompany(request).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 f35526a..e19175a 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java @@ -24,7 +24,9 @@ import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; +import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -41,8 +43,10 @@ import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.DeleteCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.DeletePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.DuplicatePlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.GetCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; @@ -876,6 +880,13 @@ public CompletableFuture> li QueryStringMapper.addQueryParameter( httpUrl, "company_keys", request.getCompanyKeys().get(), false); } + if (request.getIncludeUsageAggregation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_usage_aggregation", + request.getIncludeUsageAggregation().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -971,6 +982,93 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request) { + return getFeatureUsageTimeSeries(request, null); + } + + public CompletableFuture> getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("feature-usage-timeseries"); + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "end_time", request.getEndTime(), false); + QueryStringMapper.addQueryParameter(httpUrl, "feature_id", request.getFeatureId(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "start_time", request.getStartTime(), false); + 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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetFeatureUsageTimeSeriesResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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 + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> countFeatureUsage() { return countFeatureUsage(CountFeatureUsageRequest.builder().build()); } @@ -993,6 +1091,13 @@ public CompletableFuture> c QueryStringMapper.addQueryParameter( httpUrl, "company_keys", request.getCompanyKeys().get(), false); } + if (request.getIncludeUsageAggregation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_usage_aggregation", + request.getIncludeUsageAggregation().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -1300,6 +1405,10 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().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); } @@ -1329,6 +1438,10 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1774,6 +1887,10 @@ public CompletableFuture> duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request) { + return duplicatePlanEntitlements(request, null); + } + + public CompletableFuture> duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-entitlements/duplicate") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), DuplicatePlanEntitlementsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> getFeatureUsageByCompany( GetFeatureUsageByCompanyRequest request) { return getFeatureUsageByCompany(request, null); 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 ff1f685..14c39bb 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java @@ -12,7 +12,9 @@ import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; +import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -29,8 +31,10 @@ import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.DeleteCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.DeletePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.DuplicatePlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.GetCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; @@ -155,6 +159,15 @@ public ListFeatureUsageResponse listFeatureUsage(ListFeatureUsageRequest request return this.rawClient.listFeatureUsage(request, requestOptions).body(); } + public GetFeatureUsageTimeSeriesResponse getFeatureUsageTimeSeries(GetFeatureUsageTimeSeriesRequest request) { + return this.rawClient.getFeatureUsageTimeSeries(request).body(); + } + + public GetFeatureUsageTimeSeriesResponse getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request, RequestOptions requestOptions) { + return this.rawClient.getFeatureUsageTimeSeries(request, requestOptions).body(); + } + public CountFeatureUsageResponse countFeatureUsage() { return this.rawClient.countFeatureUsage().body(); } @@ -253,6 +266,15 @@ public CountPlanEntitlementsResponse countPlanEntitlements( return this.rawClient.countPlanEntitlements(request, requestOptions).body(); } + public DuplicatePlanEntitlementsResponse duplicatePlanEntitlements(DuplicatePlanEntitlementsRequestBody request) { + return this.rawClient.duplicatePlanEntitlements(request).body(); + } + + public DuplicatePlanEntitlementsResponse duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request, RequestOptions requestOptions) { + return this.rawClient.duplicatePlanEntitlements(request, requestOptions).body(); + } + public GetFeatureUsageByCompanyResponse getFeatureUsageByCompany(GetFeatureUsageByCompanyRequest request) { return this.rawClient.getFeatureUsageByCompany(request).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 30d0a2e..b3db447 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java @@ -24,7 +24,9 @@ import com.schematic.api.resources.entitlements.requests.CountPlanEntitlementsRequest; import com.schematic.api.resources.entitlements.requests.CreateCompanyOverrideRequestBody; import com.schematic.api.resources.entitlements.requests.CreatePlanEntitlementRequestBody; +import com.schematic.api.resources.entitlements.requests.DuplicatePlanEntitlementsRequestBody; import com.schematic.api.resources.entitlements.requests.GetFeatureUsageByCompanyRequest; +import com.schematic.api.resources.entitlements.requests.GetFeatureUsageTimeSeriesRequest; import com.schematic.api.resources.entitlements.requests.ListCompanyOverridesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureCompaniesRequest; import com.schematic.api.resources.entitlements.requests.ListFeatureUsageRequest; @@ -41,8 +43,10 @@ import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.DeleteCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.DeletePlanEntitlementResponse; +import com.schematic.api.resources.entitlements.types.DuplicatePlanEntitlementsResponse; import com.schematic.api.resources.entitlements.types.GetCompanyOverrideResponse; import com.schematic.api.resources.entitlements.types.GetFeatureUsageByCompanyResponse; +import com.schematic.api.resources.entitlements.types.GetFeatureUsageTimeSeriesResponse; import com.schematic.api.resources.entitlements.types.GetPlanEntitlementResponse; import com.schematic.api.resources.entitlements.types.ListCompanyOverridesResponse; import com.schematic.api.resources.entitlements.types.ListFeatureCompaniesResponse; @@ -679,6 +683,13 @@ public BaseSchematicHttpResponse listFeatureUsage( QueryStringMapper.addQueryParameter( httpUrl, "company_keys", request.getCompanyKeys().get(), false); } + if (request.getIncludeUsageAggregation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_usage_aggregation", + request.getIncludeUsageAggregation().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -750,6 +761,71 @@ public BaseSchematicHttpResponse listFeatureUsage( } } + public BaseSchematicHttpResponse getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request) { + return getFeatureUsageTimeSeries(request, null); + } + + public BaseSchematicHttpResponse getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("feature-usage-timeseries"); + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "end_time", request.getEndTime(), false); + QueryStringMapper.addQueryParameter(httpUrl, "feature_id", request.getFeatureId(), false); + if (request.getGranularity().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "granularity", request.getGranularity().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "start_time", request.getStartTime(), false); + 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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetFeatureUsageTimeSeriesResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + 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 + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countFeatureUsage() { return countFeatureUsage(CountFeatureUsageRequest.builder().build()); } @@ -771,6 +847,13 @@ public BaseSchematicHttpResponse countFeatureUsage( QueryStringMapper.addQueryParameter( httpUrl, "company_keys", request.getCompanyKeys().get(), false); } + if (request.getIncludeUsageAggregation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_usage_aggregation", + request.getIncludeUsageAggregation().get(), + false); + } if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } @@ -1004,6 +1087,10 @@ public BaseSchematicHttpResponse listPlanEntitleme QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().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); } @@ -1033,6 +1120,10 @@ public BaseSchematicHttpResponse listPlanEntitleme QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1358,6 +1449,10 @@ public BaseSchematicHttpResponse countPlanEntitle QueryStringMapper.addQueryParameter( httpUrl, "plan_id", request.getPlanId().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); } @@ -1387,6 +1482,10 @@ public BaseSchematicHttpResponse countPlanEntitle QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (request.getPlanVersionIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1436,6 +1535,75 @@ public BaseSchematicHttpResponse countPlanEntitle } } + public BaseSchematicHttpResponse duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request) { + return duplicatePlanEntitlements(request, null); + } + + public BaseSchematicHttpResponse duplicatePlanEntitlements( + DuplicatePlanEntitlementsRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-entitlements/duplicate") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), DuplicatePlanEntitlementsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse getFeatureUsageByCompany( GetFeatureUsageByCompanyRequest request) { return getFeatureUsageByCompany(request, null); diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsageRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsageRequest.java index f834392..494b8aa 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsageRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsageRequest.java @@ -28,6 +28,8 @@ public final class CountFeatureUsageRequest { private final Optional> companyKeys; + private final Optional includeUsageAggregation; + private final Optional q; private final Optional withoutNegativeEntitlements; @@ -42,6 +44,7 @@ private CountFeatureUsageRequest( Optional> featureIds, Optional companyId, Optional> companyKeys, + Optional includeUsageAggregation, Optional q, Optional withoutNegativeEntitlements, Optional limit, @@ -50,6 +53,7 @@ private CountFeatureUsageRequest( this.featureIds = featureIds; this.companyId = companyId; this.companyKeys = companyKeys; + this.includeUsageAggregation = includeUsageAggregation; this.q = q; this.withoutNegativeEntitlements = withoutNegativeEntitlements; this.limit = limit; @@ -72,6 +76,14 @@ public Optional> getCompanyKeys() { return companyKeys; } + /** + * @return Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + */ + @JsonProperty("include_usage_aggregation") + public Optional getIncludeUsageAggregation() { + return includeUsageAggregation; + } + @JsonProperty("q") public Optional getQ() { return q; @@ -113,6 +125,7 @@ private boolean equalTo(CountFeatureUsageRequest other) { return featureIds.equals(other.featureIds) && companyId.equals(other.companyId) && companyKeys.equals(other.companyKeys) + && includeUsageAggregation.equals(other.includeUsageAggregation) && q.equals(other.q) && withoutNegativeEntitlements.equals(other.withoutNegativeEntitlements) && limit.equals(other.limit) @@ -125,6 +138,7 @@ public int hashCode() { this.featureIds, this.companyId, this.companyKeys, + this.includeUsageAggregation, this.q, this.withoutNegativeEntitlements, this.limit, @@ -148,6 +162,8 @@ public static final class Builder { private Optional> companyKeys = Optional.empty(); + private Optional includeUsageAggregation = Optional.empty(); + private Optional q = Optional.empty(); private Optional withoutNegativeEntitlements = Optional.empty(); @@ -165,6 +181,7 @@ public Builder from(CountFeatureUsageRequest other) { featureIds(other.getFeatureIds()); companyId(other.getCompanyId()); companyKeys(other.getCompanyKeys()); + includeUsageAggregation(other.getIncludeUsageAggregation()); q(other.getQ()); withoutNegativeEntitlements(other.getWithoutNegativeEntitlements()); limit(other.getLimit()); @@ -210,6 +227,20 @@ public Builder companyKeys(Map companyKeys) { return this; } + /** + *

Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.

+ */ + @JsonSetter(value = "include_usage_aggregation", nulls = Nulls.SKIP) + public Builder includeUsageAggregation(Optional includeUsageAggregation) { + this.includeUsageAggregation = includeUsageAggregation; + return this; + } + + public Builder includeUsageAggregation(Boolean includeUsageAggregation) { + this.includeUsageAggregation = Optional.ofNullable(includeUsageAggregation); + return this; + } + @JsonSetter(value = "q", nulls = Nulls.SKIP) public Builder q(Optional q) { this.q = q; @@ -265,6 +296,7 @@ public CountFeatureUsageRequest build() { featureIds, companyId, companyKeys, + includeUsageAggregation, q, withoutNegativeEntitlements, limit, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountPlanEntitlementsRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountPlanEntitlementsRequest.java index abbf0a0..319d59d 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CountPlanEntitlementsRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CountPlanEntitlementsRequest.java @@ -28,10 +28,14 @@ public final class CountPlanEntitlementsRequest { private final Optional> planIds; + private final Optional> planVersionIds; + private final Optional featureId; private final Optional planId; + private final Optional planVersionId; + private final Optional q; private final Optional withMeteredProducts; @@ -46,8 +50,10 @@ private CountPlanEntitlementsRequest( Optional> featureIds, Optional> ids, Optional> planIds, + Optional> planVersionIds, Optional featureId, Optional planId, + Optional planVersionId, Optional q, Optional withMeteredProducts, Optional limit, @@ -56,8 +62,10 @@ private CountPlanEntitlementsRequest( this.featureIds = featureIds; this.ids = ids; this.planIds = planIds; + this.planVersionIds = planVersionIds; this.featureId = featureId; this.planId = planId; + this.planVersionId = planVersionId; this.q = q; this.withMeteredProducts = withMeteredProducts; this.limit = limit; @@ -89,6 +97,14 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter plan entitlements by multiple plan version IDs (starting with plvr_) + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Filter plan entitlements by a single feature ID (starting with feat_) */ @@ -105,6 +121,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter plan entitlements by a single plan version ID (starting with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search for plan entitlements by feature or company name */ @@ -152,8 +176,10 @@ private boolean equalTo(CountPlanEntitlementsRequest other) { return featureIds.equals(other.featureIds) && ids.equals(other.ids) && planIds.equals(other.planIds) + && planVersionIds.equals(other.planVersionIds) && featureId.equals(other.featureId) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && withMeteredProducts.equals(other.withMeteredProducts) && limit.equals(other.limit) @@ -166,8 +192,10 @@ public int hashCode() { this.featureIds, this.ids, this.planIds, + this.planVersionIds, this.featureId, this.planId, + this.planVersionId, this.q, this.withMeteredProducts, this.limit, @@ -191,10 +219,14 @@ public static final class Builder { private Optional> planIds = Optional.empty(); + private Optional> planVersionIds = Optional.empty(); + private Optional featureId = Optional.empty(); private Optional planId = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional q = Optional.empty(); private Optional withMeteredProducts = Optional.empty(); @@ -212,8 +244,10 @@ public Builder from(CountPlanEntitlementsRequest other) { featureIds(other.getFeatureIds()); ids(other.getIds()); planIds(other.getPlanIds()); + planVersionIds(other.getPlanVersionIds()); featureId(other.getFeatureId()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); withMeteredProducts(other.getWithMeteredProducts()); limit(other.getLimit()); @@ -278,6 +312,25 @@ public Builder planIds(String planIds) { return this; } + /** + *

Filter plan entitlements by multiple plan version IDs (starting with plvr_)

+ */ + @JsonSetter(value = "plan_version_ids", nulls = Nulls.SKIP) + public Builder planVersionIds(Optional> planVersionIds) { + this.planVersionIds = planVersionIds; + return this; + } + + public Builder planVersionIds(List planVersionIds) { + this.planVersionIds = Optional.ofNullable(planVersionIds); + return this; + } + + public Builder planVersionIds(String planVersionIds) { + this.planVersionIds = Optional.of(Collections.singletonList(planVersionIds)); + return this; + } + /** *

Filter plan entitlements by a single feature ID (starting with feat_)

*/ @@ -306,6 +359,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter plan entitlements by a single plan version ID (starting with plvr_)

+ */ + @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; + } + /** *

Search for plan entitlements by feature or company name

*/ @@ -367,8 +434,10 @@ public CountPlanEntitlementsRequest build() { featureIds, ids, planIds, + planVersionIds, featureId, planId, + planVersionId, q, withMeteredProducts, limit, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreateCompanyOverrideRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateCompanyOverrideRequestBody.java index a469c39..e082dd1 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CreateCompanyOverrideRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateCompanyOverrideRequestBody.java @@ -14,7 +14,7 @@ import com.schematic.api.core.ObjectMappers; import com.schematic.api.resources.entitlements.types.CreateCompanyOverrideRequestBodyMetricPeriod; import com.schematic.api.resources.entitlements.types.CreateCompanyOverrideRequestBodyMetricPeriodMonthReset; -import com.schematic.api.resources.entitlements.types.CreateCompanyOverrideRequestBodyValueType; +import com.schematic.api.types.EntitlementValueType; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -47,7 +47,7 @@ public final class CreateCompanyOverrideRequestBody { private final Optional valueTraitId; - private final CreateCompanyOverrideRequestBodyValueType valueType; + private final EntitlementValueType valueType; private final Map additionalProperties; @@ -63,7 +63,7 @@ private CreateCompanyOverrideRequestBody( Optional valueCreditId, Optional valueNumeric, Optional valueTraitId, - CreateCompanyOverrideRequestBodyValueType valueType, + EntitlementValueType valueType, Map additionalProperties) { this.companyId = companyId; this.creditConsumptionRate = creditConsumptionRate; @@ -136,7 +136,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public CreateCompanyOverrideRequestBodyValueType getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -203,7 +203,7 @@ public interface FeatureIdStage { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull CreateCompanyOverrideRequestBodyValueType valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { @@ -254,7 +254,7 @@ public static final class Builder implements CompanyIdStage, FeatureIdStage, Val private String featureId; - private CreateCompanyOverrideRequestBodyValueType valueType; + private EntitlementValueType valueType; private Optional valueTraitId = Optional.empty(); @@ -313,7 +313,7 @@ public ValueTypeStage featureId(@NotNull String featureId) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull CreateCompanyOverrideRequestBodyValueType valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); 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 ce627d9..e9629c1 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 @@ -14,9 +14,10 @@ import com.schematic.api.core.ObjectMappers; import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementRequestBodyMetricPeriod; import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementRequestBodyMetricPeriodMonthReset; -import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementRequestBodyPriceBehavior; -import com.schematic.api.resources.entitlements.types.CreatePlanEntitlementRequestBodyValueType; +import com.schematic.api.types.BillingTiersMode; import com.schematic.api.types.CreatePriceTierRequestBody; +import com.schematic.api.types.EntitlementPriceBehavior; +import com.schematic.api.types.EntitlementValueType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -53,13 +54,13 @@ public final class CreatePlanEntitlementRequestBody { private final String planId; - private final Optional priceBehavior; + private final Optional priceBehavior; private final Optional> priceTiers; private final Optional softLimit; - private final Optional tierMode; + private final Optional tierMode; private final Optional valueBool; @@ -69,7 +70,7 @@ public final class CreatePlanEntitlementRequestBody { private final Optional valueTraitId; - private final CreatePlanEntitlementRequestBodyValueType valueType; + private final EntitlementValueType valueType; private final Optional yearlyMeteredPriceId; @@ -95,15 +96,15 @@ private CreatePlanEntitlementRequestBody( Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, String planId, - Optional priceBehavior, + Optional priceBehavior, Optional> priceTiers, Optional softLimit, - Optional tierMode, + Optional tierMode, Optional valueBool, Optional valueCreditId, Optional valueNumeric, Optional valueTraitId, - CreatePlanEntitlementRequestBodyValueType valueType, + EntitlementValueType valueType, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, Optional yearlyUnitPrice, @@ -204,7 +205,7 @@ public String getPlanId() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -222,7 +223,7 @@ public Optional getSoftLimit() { } @JsonProperty("tier_mode") - public Optional getTierMode() { + public Optional getTierMode() { return tierMode; } @@ -247,7 +248,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public CreatePlanEntitlementRequestBodyValueType getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -362,7 +363,7 @@ public interface PlanIdStage { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull CreatePlanEntitlementRequestBodyValueType valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { @@ -414,9 +415,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage overageBillingProductId(String overageBillingProductId); - _FinalStage priceBehavior(Optional priceBehavior); + _FinalStage priceBehavior(Optional priceBehavior); - _FinalStage priceBehavior(CreatePlanEntitlementRequestBodyPriceBehavior priceBehavior); + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); /** *

Use MonthlyPriceTiers or YearlyPriceTiers instead

@@ -429,9 +430,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage softLimit(Integer softLimit); - _FinalStage tierMode(Optional tierMode); + _FinalStage tierMode(Optional tierMode); - _FinalStage tierMode(String tierMode); + _FinalStage tierMode(BillingTiersMode tierMode); _FinalStage valueBool(Optional valueBool); @@ -472,7 +473,7 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private String planId; - private CreatePlanEntitlementRequestBodyValueType valueType; + private EntitlementValueType valueType; private Optional yearlyUnitPriceDecimal = Optional.empty(); @@ -490,13 +491,13 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional valueBool = Optional.empty(); - private Optional tierMode = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional softLimit = Optional.empty(); private Optional> priceTiers = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional overageBillingProductId = Optional.empty(); @@ -573,7 +574,7 @@ public ValueTypeStage planId(@NotNull String planId) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull CreatePlanEntitlementRequestBodyValueType valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } @@ -683,14 +684,14 @@ public _FinalStage valueBool(Optional valueBool) { } @java.lang.Override - public _FinalStage tierMode(String tierMode) { + 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) { + public _FinalStage tierMode(Optional tierMode) { this.tierMode = tierMode; return this; } @@ -729,14 +730,14 @@ public _FinalStage priceTiers(Optional> priceTi } @java.lang.Override - public _FinalStage priceBehavior(CreatePlanEntitlementRequestBodyPriceBehavior priceBehavior) { + 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) { + public _FinalStage priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java new file mode 100644 index 0000000..8e5806d --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java @@ -0,0 +1,126 @@ +/** + * 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.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 = DuplicatePlanEntitlementsRequestBody.Builder.class) +public final class DuplicatePlanEntitlementsRequestBody { + private final String sourcePlanId; + + private final String targetPlanId; + + private final Map additionalProperties; + + private DuplicatePlanEntitlementsRequestBody( + String sourcePlanId, String targetPlanId, Map additionalProperties) { + this.sourcePlanId = sourcePlanId; + this.targetPlanId = targetPlanId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("source_plan_id") + public String getSourcePlanId() { + return sourcePlanId; + } + + @JsonProperty("target_plan_id") + public String getTargetPlanId() { + return targetPlanId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicatePlanEntitlementsRequestBody + && equalTo((DuplicatePlanEntitlementsRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicatePlanEntitlementsRequestBody other) { + return sourcePlanId.equals(other.sourcePlanId) && targetPlanId.equals(other.targetPlanId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.sourcePlanId, this.targetPlanId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SourcePlanIdStage builder() { + return new Builder(); + } + + public interface SourcePlanIdStage { + TargetPlanIdStage sourcePlanId(@NotNull String sourcePlanId); + + Builder from(DuplicatePlanEntitlementsRequestBody other); + } + + public interface TargetPlanIdStage { + _FinalStage targetPlanId(@NotNull String targetPlanId); + } + + public interface _FinalStage { + DuplicatePlanEntitlementsRequestBody build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SourcePlanIdStage, TargetPlanIdStage, _FinalStage { + private String sourcePlanId; + + private String targetPlanId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DuplicatePlanEntitlementsRequestBody other) { + sourcePlanId(other.getSourcePlanId()); + targetPlanId(other.getTargetPlanId()); + return this; + } + + @java.lang.Override + @JsonSetter("source_plan_id") + public TargetPlanIdStage sourcePlanId(@NotNull String sourcePlanId) { + this.sourcePlanId = Objects.requireNonNull(sourcePlanId, "sourcePlanId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("target_plan_id") + public _FinalStage targetPlanId(@NotNull String targetPlanId) { + this.targetPlanId = Objects.requireNonNull(targetPlanId, "targetPlanId must not be null"); + return this; + } + + @java.lang.Override + public DuplicatePlanEntitlementsRequestBody build() { + return new DuplicatePlanEntitlementsRequestBody(sourcePlanId, targetPlanId, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java new file mode 100644 index 0000000..1ddd7f0 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java @@ -0,0 +1,212 @@ +/** + * 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.types.TimeSeriesGranularity; +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 = GetFeatureUsageTimeSeriesRequest.Builder.class) +public final class GetFeatureUsageTimeSeriesRequest { + private final String companyId; + + private final OffsetDateTime endTime; + + private final String featureId; + + private final Optional granularity; + + private final OffsetDateTime startTime; + + private final Map additionalProperties; + + private GetFeatureUsageTimeSeriesRequest( + String companyId, + OffsetDateTime endTime, + String featureId, + Optional granularity, + OffsetDateTime startTime, + Map additionalProperties) { + this.companyId = companyId; + this.endTime = endTime; + this.featureId = featureId; + this.granularity = granularity; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("end_time") + public OffsetDateTime getEndTime() { + return endTime; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + @JsonProperty("granularity") + public Optional getGranularity() { + return granularity; + } + + @JsonProperty("start_time") + public OffsetDateTime getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetFeatureUsageTimeSeriesRequest && equalTo((GetFeatureUsageTimeSeriesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetFeatureUsageTimeSeriesRequest other) { + return companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && featureId.equals(other.featureId) + && granularity.equals(other.granularity) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.endTime, this.featureId, this.granularity, this.startTime); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + EndTimeStage companyId(@NotNull String companyId); + + Builder from(GetFeatureUsageTimeSeriesRequest other); + } + + public interface EndTimeStage { + FeatureIdStage endTime(@NotNull OffsetDateTime endTime); + } + + public interface FeatureIdStage { + StartTimeStage featureId(@NotNull String featureId); + } + + public interface StartTimeStage { + _FinalStage startTime(@NotNull OffsetDateTime startTime); + } + + public interface _FinalStage { + GetFeatureUsageTimeSeriesRequest build(); + + _FinalStage granularity(Optional granularity); + + _FinalStage granularity(TimeSeriesGranularity granularity); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyIdStage, EndTimeStage, FeatureIdStage, StartTimeStage, _FinalStage { + private String companyId; + + private OffsetDateTime endTime; + + private String featureId; + + private OffsetDateTime startTime; + + private Optional granularity = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetFeatureUsageTimeSeriesRequest other) { + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + featureId(other.getFeatureId()); + granularity(other.getGranularity()); + startTime(other.getStartTime()); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public EndTimeStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("end_time") + public FeatureIdStage endTime(@NotNull OffsetDateTime endTime) { + this.endTime = Objects.requireNonNull(endTime, "endTime must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_id") + public StartTimeStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("start_time") + public _FinalStage startTime(@NotNull OffsetDateTime startTime) { + this.startTime = Objects.requireNonNull(startTime, "startTime must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage granularity(TimeSeriesGranularity granularity) { + this.granularity = Optional.ofNullable(granularity); + return this; + } + + @java.lang.Override + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public _FinalStage granularity(Optional granularity) { + this.granularity = granularity; + return this; + } + + @java.lang.Override + public GetFeatureUsageTimeSeriesRequest build() { + return new GetFeatureUsageTimeSeriesRequest( + companyId, endTime, featureId, granularity, startTime, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageRequest.java index ff297b9..f0ad688 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageRequest.java @@ -28,6 +28,8 @@ public final class ListFeatureUsageRequest { private final Optional> companyKeys; + private final Optional includeUsageAggregation; + private final Optional q; private final Optional withoutNegativeEntitlements; @@ -42,6 +44,7 @@ private ListFeatureUsageRequest( Optional> featureIds, Optional companyId, Optional> companyKeys, + Optional includeUsageAggregation, Optional q, Optional withoutNegativeEntitlements, Optional limit, @@ -50,6 +53,7 @@ private ListFeatureUsageRequest( this.featureIds = featureIds; this.companyId = companyId; this.companyKeys = companyKeys; + this.includeUsageAggregation = includeUsageAggregation; this.q = q; this.withoutNegativeEntitlements = withoutNegativeEntitlements; this.limit = limit; @@ -72,6 +76,14 @@ public Optional> getCompanyKeys() { return companyKeys; } + /** + * @return Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + */ + @JsonProperty("include_usage_aggregation") + public Optional getIncludeUsageAggregation() { + return includeUsageAggregation; + } + @JsonProperty("q") public Optional getQ() { return q; @@ -113,6 +125,7 @@ private boolean equalTo(ListFeatureUsageRequest other) { return featureIds.equals(other.featureIds) && companyId.equals(other.companyId) && companyKeys.equals(other.companyKeys) + && includeUsageAggregation.equals(other.includeUsageAggregation) && q.equals(other.q) && withoutNegativeEntitlements.equals(other.withoutNegativeEntitlements) && limit.equals(other.limit) @@ -125,6 +138,7 @@ public int hashCode() { this.featureIds, this.companyId, this.companyKeys, + this.includeUsageAggregation, this.q, this.withoutNegativeEntitlements, this.limit, @@ -148,6 +162,8 @@ public static final class Builder { private Optional> companyKeys = Optional.empty(); + private Optional includeUsageAggregation = Optional.empty(); + private Optional q = Optional.empty(); private Optional withoutNegativeEntitlements = Optional.empty(); @@ -165,6 +181,7 @@ public Builder from(ListFeatureUsageRequest other) { featureIds(other.getFeatureIds()); companyId(other.getCompanyId()); companyKeys(other.getCompanyKeys()); + includeUsageAggregation(other.getIncludeUsageAggregation()); q(other.getQ()); withoutNegativeEntitlements(other.getWithoutNegativeEntitlements()); limit(other.getLimit()); @@ -210,6 +227,20 @@ public Builder companyKeys(Map companyKeys) { return this; } + /** + *

Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.

+ */ + @JsonSetter(value = "include_usage_aggregation", nulls = Nulls.SKIP) + public Builder includeUsageAggregation(Optional includeUsageAggregation) { + this.includeUsageAggregation = includeUsageAggregation; + return this; + } + + public Builder includeUsageAggregation(Boolean includeUsageAggregation) { + this.includeUsageAggregation = Optional.ofNullable(includeUsageAggregation); + return this; + } + @JsonSetter(value = "q", nulls = Nulls.SKIP) public Builder q(Optional q) { this.q = q; @@ -265,6 +296,7 @@ public ListFeatureUsageRequest build() { featureIds, companyId, companyKeys, + includeUsageAggregation, q, withoutNegativeEntitlements, limit, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListPlanEntitlementsRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListPlanEntitlementsRequest.java index c7588c8..2d7f768 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/ListPlanEntitlementsRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/ListPlanEntitlementsRequest.java @@ -28,10 +28,14 @@ public final class ListPlanEntitlementsRequest { private final Optional> planIds; + private final Optional> planVersionIds; + private final Optional featureId; private final Optional planId; + private final Optional planVersionId; + private final Optional q; private final Optional withMeteredProducts; @@ -46,8 +50,10 @@ private ListPlanEntitlementsRequest( Optional> featureIds, Optional> ids, Optional> planIds, + Optional> planVersionIds, Optional featureId, Optional planId, + Optional planVersionId, Optional q, Optional withMeteredProducts, Optional limit, @@ -56,8 +62,10 @@ private ListPlanEntitlementsRequest( this.featureIds = featureIds; this.ids = ids; this.planIds = planIds; + this.planVersionIds = planVersionIds; this.featureId = featureId; this.planId = planId; + this.planVersionId = planVersionId; this.q = q; this.withMeteredProducts = withMeteredProducts; this.limit = limit; @@ -89,6 +97,14 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter plan entitlements by multiple plan version IDs (starting with plvr_) + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Filter plan entitlements by a single feature ID (starting with feat_) */ @@ -105,6 +121,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter plan entitlements by a single plan version ID (starting with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search for plan entitlements by feature or company name */ @@ -152,8 +176,10 @@ private boolean equalTo(ListPlanEntitlementsRequest other) { return featureIds.equals(other.featureIds) && ids.equals(other.ids) && planIds.equals(other.planIds) + && planVersionIds.equals(other.planVersionIds) && featureId.equals(other.featureId) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && withMeteredProducts.equals(other.withMeteredProducts) && limit.equals(other.limit) @@ -166,8 +192,10 @@ public int hashCode() { this.featureIds, this.ids, this.planIds, + this.planVersionIds, this.featureId, this.planId, + this.planVersionId, this.q, this.withMeteredProducts, this.limit, @@ -191,10 +219,14 @@ public static final class Builder { private Optional> planIds = Optional.empty(); + private Optional> planVersionIds = Optional.empty(); + private Optional featureId = Optional.empty(); private Optional planId = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional q = Optional.empty(); private Optional withMeteredProducts = Optional.empty(); @@ -212,8 +244,10 @@ public Builder from(ListPlanEntitlementsRequest other) { featureIds(other.getFeatureIds()); ids(other.getIds()); planIds(other.getPlanIds()); + planVersionIds(other.getPlanVersionIds()); featureId(other.getFeatureId()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); withMeteredProducts(other.getWithMeteredProducts()); limit(other.getLimit()); @@ -278,6 +312,25 @@ public Builder planIds(String planIds) { return this; } + /** + *

Filter plan entitlements by multiple plan version IDs (starting with plvr_)

+ */ + @JsonSetter(value = "plan_version_ids", nulls = Nulls.SKIP) + public Builder planVersionIds(Optional> planVersionIds) { + this.planVersionIds = planVersionIds; + return this; + } + + public Builder planVersionIds(List planVersionIds) { + this.planVersionIds = Optional.ofNullable(planVersionIds); + return this; + } + + public Builder planVersionIds(String planVersionIds) { + this.planVersionIds = Optional.of(Collections.singletonList(planVersionIds)); + return this; + } + /** *

Filter plan entitlements by a single feature ID (starting with feat_)

*/ @@ -306,6 +359,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter plan entitlements by a single plan version ID (starting with plvr_)

+ */ + @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; + } + /** *

Search for plan entitlements by feature or company name

*/ @@ -367,8 +434,10 @@ public ListPlanEntitlementsRequest build() { featureIds, ids, planIds, + planVersionIds, featureId, planId, + planVersionId, q, withMeteredProducts, limit, diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdateCompanyOverrideRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdateCompanyOverrideRequestBody.java index 7379c93..a50acfa 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdateCompanyOverrideRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdateCompanyOverrideRequestBody.java @@ -14,7 +14,7 @@ import com.schematic.api.core.ObjectMappers; import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideRequestBodyMetricPeriod; import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideRequestBodyMetricPeriodMonthReset; -import com.schematic.api.resources.entitlements.types.UpdateCompanyOverrideRequestBodyValueType; +import com.schematic.api.types.EntitlementValueType; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -43,7 +43,7 @@ public final class UpdateCompanyOverrideRequestBody { private final Optional valueTraitId; - private final UpdateCompanyOverrideRequestBodyValueType valueType; + private final EntitlementValueType valueType; private final Map additionalProperties; @@ -57,7 +57,7 @@ private UpdateCompanyOverrideRequestBody( Optional valueCreditId, Optional valueNumeric, Optional valueTraitId, - UpdateCompanyOverrideRequestBodyValueType valueType, + EntitlementValueType valueType, Map additionalProperties) { this.creditConsumptionRate = creditConsumptionRate; this.expirationDate = expirationDate; @@ -118,7 +118,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public UpdateCompanyOverrideRequestBodyValueType getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -171,7 +171,7 @@ public static ValueTypeStage builder() { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull UpdateCompanyOverrideRequestBodyValueType valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); Builder from(UpdateCompanyOverrideRequestBody other); } @@ -220,7 +220,7 @@ _FinalStage metricPeriodMonthReset( @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ValueTypeStage, _FinalStage { - private UpdateCompanyOverrideRequestBodyValueType valueType; + private EntitlementValueType valueType; private Optional valueTraitId = Optional.empty(); @@ -263,7 +263,7 @@ public Builder from(UpdateCompanyOverrideRequestBody other) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull UpdateCompanyOverrideRequestBodyValueType valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } 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 ac2fa6a..537da09 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 @@ -14,9 +14,10 @@ import com.schematic.api.core.ObjectMappers; import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementRequestBodyMetricPeriod; import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementRequestBodyMetricPeriodMonthReset; -import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementRequestBodyPriceBehavior; -import com.schematic.api.resources.entitlements.types.UpdatePlanEntitlementRequestBodyValueType; +import com.schematic.api.types.BillingTiersMode; import com.schematic.api.types.CreatePriceTierRequestBody; +import com.schematic.api.types.EntitlementPriceBehavior; +import com.schematic.api.types.EntitlementValueType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -49,13 +50,13 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional overageBillingProductId; - private final Optional priceBehavior; + private final Optional priceBehavior; private final Optional> priceTiers; private final Optional softLimit; - private final Optional tierMode; + private final Optional tierMode; private final Optional valueBool; @@ -65,7 +66,7 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional valueTraitId; - private final UpdatePlanEntitlementRequestBodyValueType valueType; + private final EntitlementValueType valueType; private final Optional yearlyMeteredPriceId; @@ -89,15 +90,15 @@ private UpdatePlanEntitlementRequestBody( Optional monthlyUnitPrice, Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, - Optional priceBehavior, + Optional priceBehavior, Optional> priceTiers, Optional softLimit, - Optional tierMode, + Optional tierMode, Optional valueBool, Optional valueCreditId, Optional valueNumeric, Optional valueTraitId, - UpdatePlanEntitlementRequestBodyValueType valueType, + EntitlementValueType valueType, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, Optional yearlyUnitPrice, @@ -186,7 +187,7 @@ public Optional getOverageBillingProductId() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -204,7 +205,7 @@ public Optional getSoftLimit() { } @JsonProperty("tier_mode") - public Optional getTierMode() { + public Optional getTierMode() { return tierMode; } @@ -229,7 +230,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public UpdatePlanEntitlementRequestBodyValueType getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -330,7 +331,7 @@ public static ValueTypeStage builder() { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull UpdatePlanEntitlementRequestBodyValueType valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); Builder from(UpdatePlanEntitlementRequestBody other); } @@ -384,9 +385,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage overageBillingProductId(String overageBillingProductId); - _FinalStage priceBehavior(Optional priceBehavior); + _FinalStage priceBehavior(Optional priceBehavior); - _FinalStage priceBehavior(UpdatePlanEntitlementRequestBodyPriceBehavior priceBehavior); + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); /** *

Use MonthlyPriceTiers or YearlyPriceTiers instead

@@ -399,9 +400,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage softLimit(Integer softLimit); - _FinalStage tierMode(Optional tierMode); + _FinalStage tierMode(Optional tierMode); - _FinalStage tierMode(String tierMode); + _FinalStage tierMode(BillingTiersMode tierMode); _FinalStage valueBool(Optional valueBool); @@ -438,7 +439,7 @@ _FinalStage metricPeriodMonthReset( @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ValueTypeStage, _FinalStage { - private UpdatePlanEntitlementRequestBodyValueType valueType; + private EntitlementValueType valueType; private Optional yearlyUnitPriceDecimal = Optional.empty(); @@ -456,13 +457,13 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional valueBool = Optional.empty(); - private Optional tierMode = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional softLimit = Optional.empty(); private Optional> priceTiers = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional overageBillingProductId = Optional.empty(); @@ -523,7 +524,7 @@ public Builder from(UpdatePlanEntitlementRequestBody other) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull UpdatePlanEntitlementRequestBodyValueType valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } @@ -633,14 +634,14 @@ public _FinalStage valueBool(Optional valueBool) { } @java.lang.Override - public _FinalStage tierMode(String tierMode) { + 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) { + public _FinalStage tierMode(Optional tierMode) { this.tierMode = tierMode; return this; } @@ -679,14 +680,14 @@ public _FinalStage priceTiers(Optional> priceTi } @java.lang.Override - public _FinalStage priceBehavior(UpdatePlanEntitlementRequestBodyPriceBehavior priceBehavior) { + 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) { + public _FinalStage priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageParams.java index 5826be6..aeee0db 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageParams.java @@ -27,6 +27,8 @@ public final class CountFeatureUsageParams { private final Optional> featureIds; + private final Optional includeUsageAggregation; + private final Optional limit; private final Optional offset; @@ -41,6 +43,7 @@ private CountFeatureUsageParams( Optional companyId, Optional> companyKeys, Optional> featureIds, + Optional includeUsageAggregation, Optional limit, Optional offset, Optional q, @@ -49,6 +52,7 @@ private CountFeatureUsageParams( this.companyId = companyId; this.companyKeys = companyKeys; this.featureIds = featureIds; + this.includeUsageAggregation = includeUsageAggregation; this.limit = limit; this.offset = offset; this.q = q; @@ -71,6 +75,14 @@ public Optional> getFeatureIds() { return featureIds; } + /** + * @return Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + */ + @JsonProperty("include_usage_aggregation") + public Optional getIncludeUsageAggregation() { + return includeUsageAggregation; + } + /** * @return Page limit (default 100) */ @@ -112,6 +124,7 @@ private boolean equalTo(CountFeatureUsageParams other) { return companyId.equals(other.companyId) && companyKeys.equals(other.companyKeys) && featureIds.equals(other.featureIds) + && includeUsageAggregation.equals(other.includeUsageAggregation) && limit.equals(other.limit) && offset.equals(other.offset) && q.equals(other.q) @@ -124,6 +137,7 @@ public int hashCode() { this.companyId, this.companyKeys, this.featureIds, + this.includeUsageAggregation, this.limit, this.offset, this.q, @@ -147,6 +161,8 @@ public static final class Builder { private Optional> featureIds = Optional.empty(); + private Optional includeUsageAggregation = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -164,6 +180,7 @@ public Builder from(CountFeatureUsageParams other) { companyId(other.getCompanyId()); companyKeys(other.getCompanyKeys()); featureIds(other.getFeatureIds()); + includeUsageAggregation(other.getIncludeUsageAggregation()); limit(other.getLimit()); offset(other.getOffset()); q(other.getQ()); @@ -204,6 +221,20 @@ public Builder featureIds(List featureIds) { return this; } + /** + *

Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.

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

Page limit (default 100)

*/ @@ -259,6 +290,7 @@ public CountFeatureUsageParams build() { companyId, companyKeys, featureIds, + includeUsageAggregation, limit, offset, q, diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsParams.java index 784ce4a..cca227b 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsParams.java @@ -35,6 +35,10 @@ public final class CountPlanEntitlementsParams { private final Optional> planIds; + private final Optional planVersionId; + + private final Optional> planVersionIds; + private final Optional q; private final Optional withMeteredProducts; @@ -49,6 +53,8 @@ private CountPlanEntitlementsParams( Optional offset, Optional planId, Optional> planIds, + Optional planVersionId, + Optional> planVersionIds, Optional q, Optional withMeteredProducts, Map additionalProperties) { @@ -59,6 +65,8 @@ private CountPlanEntitlementsParams( this.offset = offset; this.planId = planId; this.planIds = planIds; + this.planVersionId = planVersionId; + this.planVersionIds = planVersionIds; this.q = q; this.withMeteredProducts = withMeteredProducts; this.additionalProperties = additionalProperties; @@ -120,6 +128,22 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter plan entitlements by a single plan version ID (starting with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + /** + * @return Filter plan entitlements by multiple plan version IDs (starting with plvr_) + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Search for plan entitlements by feature or company name */ @@ -155,6 +179,8 @@ private boolean equalTo(CountPlanEntitlementsParams other) { && offset.equals(other.offset) && planId.equals(other.planId) && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId) + && planVersionIds.equals(other.planVersionIds) && q.equals(other.q) && withMeteredProducts.equals(other.withMeteredProducts); } @@ -169,6 +195,8 @@ public int hashCode() { this.offset, this.planId, this.planIds, + this.planVersionId, + this.planVersionIds, this.q, this.withMeteredProducts); } @@ -198,6 +226,10 @@ public static final class Builder { private Optional> planIds = Optional.empty(); + private Optional planVersionId = Optional.empty(); + + private Optional> planVersionIds = Optional.empty(); + private Optional q = Optional.empty(); private Optional withMeteredProducts = Optional.empty(); @@ -215,6 +247,8 @@ public Builder from(CountPlanEntitlementsParams other) { offset(other.getOffset()); planId(other.getPlanId()); planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); + planVersionIds(other.getPlanVersionIds()); q(other.getQ()); withMeteredProducts(other.getWithMeteredProducts()); return this; @@ -318,6 +352,34 @@ public Builder planIds(List planIds) { return this; } + /** + *

Filter plan entitlements by a single plan version ID (starting with plvr_)

+ */ + @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 plan entitlements by multiple plan version IDs (starting with plvr_)

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

Search for plan entitlements by feature or company name

*/ @@ -355,6 +417,8 @@ public CountPlanEntitlementsParams build() { offset, planId, planIds, + planVersionId, + planVersionIds, q, withMeteredProducts, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyValueType.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyValueType.java deleted file mode 100644 index 74374e5..0000000 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideRequestBodyValueType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 CreateCompanyOverrideRequestBodyValueType { - public static final CreateCompanyOverrideRequestBodyValueType NUMERIC = - new CreateCompanyOverrideRequestBodyValueType(Value.NUMERIC, "numeric"); - - public static final CreateCompanyOverrideRequestBodyValueType TRAIT = - new CreateCompanyOverrideRequestBodyValueType(Value.TRAIT, "trait"); - - public static final CreateCompanyOverrideRequestBodyValueType BOOLEAN = - new CreateCompanyOverrideRequestBodyValueType(Value.BOOLEAN, "boolean"); - - public static final CreateCompanyOverrideRequestBodyValueType CREDIT = - new CreateCompanyOverrideRequestBodyValueType(Value.CREDIT, "credit"); - - public static final CreateCompanyOverrideRequestBodyValueType UNLIMITED = - new CreateCompanyOverrideRequestBodyValueType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - CreateCompanyOverrideRequestBodyValueType(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 CreateCompanyOverrideRequestBodyValueType - && this.string.equals(((CreateCompanyOverrideRequestBodyValueType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case CREDIT: - return visitor.visitCredit(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateCompanyOverrideRequestBodyValueType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "credit": - return CREDIT; - case "unlimited": - return UNLIMITED; - default: - return new CreateCompanyOverrideRequestBodyValueType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CREDIT, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCredit(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyPriceBehavior.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyPriceBehavior.java deleted file mode 100644 index b83218c0..0000000 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyPriceBehavior.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 CreatePlanEntitlementRequestBodyPriceBehavior { - public static final CreatePlanEntitlementRequestBodyPriceBehavior TIER = - new CreatePlanEntitlementRequestBodyPriceBehavior(Value.TIER, "tier"); - - public static final CreatePlanEntitlementRequestBodyPriceBehavior CREDIT_BURNDOWN = - new CreatePlanEntitlementRequestBodyPriceBehavior(Value.CREDIT_BURNDOWN, "credit_burndown"); - - public static final CreatePlanEntitlementRequestBodyPriceBehavior OVERAGE = - new CreatePlanEntitlementRequestBodyPriceBehavior(Value.OVERAGE, "overage"); - - public static final CreatePlanEntitlementRequestBodyPriceBehavior PAY_AS_YOU_GO = - new CreatePlanEntitlementRequestBodyPriceBehavior(Value.PAY_AS_YOU_GO, "pay_as_you_go"); - - public static final CreatePlanEntitlementRequestBodyPriceBehavior PAY_IN_ADVANCE = - new CreatePlanEntitlementRequestBodyPriceBehavior(Value.PAY_IN_ADVANCE, "pay_in_advance"); - - private final Value value; - - private final String string; - - CreatePlanEntitlementRequestBodyPriceBehavior(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 CreatePlanEntitlementRequestBodyPriceBehavior - && this.string.equals(((CreatePlanEntitlementRequestBodyPriceBehavior) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case TIER: - return visitor.visitTier(); - case CREDIT_BURNDOWN: - return visitor.visitCreditBurndown(); - case OVERAGE: - return visitor.visitOverage(); - case PAY_AS_YOU_GO: - return visitor.visitPayAsYouGo(); - case PAY_IN_ADVANCE: - return visitor.visitPayInAdvance(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreatePlanEntitlementRequestBodyPriceBehavior valueOf(String value) { - switch (value) { - case "tier": - return TIER; - case "credit_burndown": - return CREDIT_BURNDOWN; - case "overage": - return OVERAGE; - case "pay_as_you_go": - return PAY_AS_YOU_GO; - case "pay_in_advance": - return PAY_IN_ADVANCE; - default: - return new CreatePlanEntitlementRequestBodyPriceBehavior(Value.UNKNOWN, value); - } - } - - public enum Value { - PAY_AS_YOU_GO, - - PAY_IN_ADVANCE, - - OVERAGE, - - CREDIT_BURNDOWN, - - TIER, - - UNKNOWN - } - - public interface Visitor { - T visitPayAsYouGo(); - - T visitPayInAdvance(); - - T visitOverage(); - - T visitCreditBurndown(); - - T visitTier(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyValueType.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyValueType.java deleted file mode 100644 index 2eef31b..0000000 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementRequestBodyValueType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 CreatePlanEntitlementRequestBodyValueType { - public static final CreatePlanEntitlementRequestBodyValueType NUMERIC = - new CreatePlanEntitlementRequestBodyValueType(Value.NUMERIC, "numeric"); - - public static final CreatePlanEntitlementRequestBodyValueType TRAIT = - new CreatePlanEntitlementRequestBodyValueType(Value.TRAIT, "trait"); - - public static final CreatePlanEntitlementRequestBodyValueType BOOLEAN = - new CreatePlanEntitlementRequestBodyValueType(Value.BOOLEAN, "boolean"); - - public static final CreatePlanEntitlementRequestBodyValueType CREDIT = - new CreatePlanEntitlementRequestBodyValueType(Value.CREDIT, "credit"); - - public static final CreatePlanEntitlementRequestBodyValueType UNLIMITED = - new CreatePlanEntitlementRequestBodyValueType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - CreatePlanEntitlementRequestBodyValueType(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 CreatePlanEntitlementRequestBodyValueType - && this.string.equals(((CreatePlanEntitlementRequestBodyValueType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case CREDIT: - return visitor.visitCredit(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreatePlanEntitlementRequestBodyValueType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "credit": - return CREDIT; - case "unlimited": - return UNLIMITED; - default: - return new CreatePlanEntitlementRequestBodyValueType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CREDIT, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCredit(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java new file mode 100644 index 0000000..407a5b6 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java @@ -0,0 +1,167 @@ +/** + * 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.DuplicatePlanEntitlementsResponseResponseData; +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 = DuplicatePlanEntitlementsResponse.Builder.class) +public final class DuplicatePlanEntitlementsResponse { + private final DuplicatePlanEntitlementsResponseResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private DuplicatePlanEntitlementsResponse( + DuplicatePlanEntitlementsResponseResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DuplicatePlanEntitlementsResponseResponseData 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 DuplicatePlanEntitlementsResponse && equalTo((DuplicatePlanEntitlementsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicatePlanEntitlementsResponse 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 DuplicatePlanEntitlementsResponseResponseData data); + + Builder from(DuplicatePlanEntitlementsResponse other); + } + + public interface _FinalStage { + DuplicatePlanEntitlementsResponse build(); + + /** + *

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DuplicatePlanEntitlementsResponseResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DuplicatePlanEntitlementsResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DuplicatePlanEntitlementsResponseResponseData 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 DuplicatePlanEntitlementsResponse build() { + return new DuplicatePlanEntitlementsResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java new file mode 100644 index 0000000..e134a28 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java @@ -0,0 +1,196 @@ +/** + * 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.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.TimeSeriesGranularity; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetFeatureUsageTimeSeriesParams.Builder.class) +public final class GetFeatureUsageTimeSeriesParams { + private final Optional companyId; + + private final Optional endTime; + + private final Optional featureId; + + private final Optional granularity; + + private final Optional startTime; + + private final Map additionalProperties; + + private GetFeatureUsageTimeSeriesParams( + Optional companyId, + Optional endTime, + Optional featureId, + Optional granularity, + Optional startTime, + Map additionalProperties) { + this.companyId = companyId; + this.endTime = endTime; + this.featureId = featureId; + this.granularity = granularity; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + @JsonProperty("granularity") + public Optional getGranularity() { + return granularity; + } + + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetFeatureUsageTimeSeriesParams && equalTo((GetFeatureUsageTimeSeriesParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetFeatureUsageTimeSeriesParams other) { + return companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && featureId.equals(other.featureId) + && granularity.equals(other.granularity) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.endTime, this.featureId, this.granularity, this.startTime); + } + + @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 companyId = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional granularity = Optional.empty(); + + private Optional startTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetFeatureUsageTimeSeriesParams other) { + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + featureId(other.getFeatureId()); + granularity(other.getGranularity()); + startTime(other.getStartTime()); + return this; + } + + @JsonSetter(value = "company_id", nulls = Nulls.SKIP) + public Builder companyId(Optional companyId) { + this.companyId = companyId; + return this; + } + + public Builder companyId(String companyId) { + this.companyId = Optional.ofNullable(companyId); + return this; + } + + @JsonSetter(value = "end_time", nulls = Nulls.SKIP) + public Builder endTime(Optional endTime) { + this.endTime = endTime; + return this; + } + + public Builder endTime(OffsetDateTime endTime) { + this.endTime = Optional.ofNullable(endTime); + return this; + } + + @JsonSetter(value = "feature_id", nulls = Nulls.SKIP) + public Builder featureId(Optional featureId) { + this.featureId = featureId; + return this; + } + + public Builder featureId(String featureId) { + this.featureId = Optional.ofNullable(featureId); + return this; + } + + @JsonSetter(value = "granularity", nulls = Nulls.SKIP) + public Builder granularity(Optional granularity) { + this.granularity = granularity; + return this; + } + + public Builder granularity(TimeSeriesGranularity granularity) { + this.granularity = Optional.ofNullable(granularity); + return this; + } + + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public Builder startTime(Optional startTime) { + this.startTime = startTime; + return this; + } + + public Builder startTime(OffsetDateTime startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + public GetFeatureUsageTimeSeriesParams build() { + return new GetFeatureUsageTimeSeriesParams( + companyId, endTime, featureId, granularity, startTime, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetActiveDealsResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java similarity index 52% rename from src/main/java/com/schematic/api/resources/companies/types/GetActiveDealsResponse.java rename to src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java index 14b4306..e2be4b7 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetActiveDealsResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.companies.types; +package com.schematic.api.resources.entitlements.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -9,29 +9,26 @@ 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.CompanyCrmDealsResponseData; -import java.util.ArrayList; +import com.schematic.api.types.FeatureUsageTimeSeriesResponseData; 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 = GetActiveDealsResponse.Builder.class) -public final class GetActiveDealsResponse { - private final List data; +@JsonDeserialize(builder = GetFeatureUsageTimeSeriesResponse.Builder.class) +public final class GetFeatureUsageTimeSeriesResponse { + private final FeatureUsageTimeSeriesResponseData data; - private final GetActiveDealsParams params; + private final GetFeatureUsageTimeSeriesParams params; private final Map additionalProperties; - private GetActiveDealsResponse( - List data, - GetActiveDealsParams params, + private GetFeatureUsageTimeSeriesResponse( + FeatureUsageTimeSeriesResponseData data, + GetFeatureUsageTimeSeriesParams params, Map additionalProperties) { this.data = data; this.params = params; @@ -39,7 +36,7 @@ private GetActiveDealsResponse( } @JsonProperty("data") - public List getData() { + public FeatureUsageTimeSeriesResponseData getData() { return data; } @@ -47,14 +44,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public GetActiveDealsParams getParams() { + public GetFeatureUsageTimeSeriesParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof GetActiveDealsResponse && equalTo((GetActiveDealsResponse) other); + return other instanceof GetFeatureUsageTimeSeriesResponse && equalTo((GetFeatureUsageTimeSeriesResponse) other); } @JsonAnyGetter @@ -62,7 +59,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(GetActiveDealsResponse other) { + private boolean equalTo(GetFeatureUsageTimeSeriesResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -76,34 +73,32 @@ public String toString() { return ObjectMappers.stringify(this); } - public static ParamsStage builder() { + public static DataStage builder() { return new Builder(); } + public interface DataStage { + ParamsStage data(@NotNull FeatureUsageTimeSeriesResponseData data); + + Builder from(GetFeatureUsageTimeSeriesResponse other); + } + public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull GetActiveDealsParams params); - - Builder from(GetActiveDealsResponse other); + _FinalStage params(@NotNull GetFeatureUsageTimeSeriesParams params); } public interface _FinalStage { - GetActiveDealsResponse build(); - - _FinalStage data(List data); - - _FinalStage addData(CompanyCrmDealsResponseData data); - - _FinalStage addAllData(List data); + GetFeatureUsageTimeSeriesResponse build(); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ParamsStage, _FinalStage { - private GetActiveDealsParams params; + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private FeatureUsageTimeSeriesResponseData data; - private List data = new ArrayList<>(); + private GetFeatureUsageTimeSeriesParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -111,12 +106,19 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(GetActiveDealsResponse other) { + public Builder from(GetFeatureUsageTimeSeriesResponse other) { data(other.getData()); params(other.getParams()); return this; } + @java.lang.Override + @JsonSetter("data") + public ParamsStage data(@NotNull FeatureUsageTimeSeriesResponseData data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + /** *

Input parameters

*

Input parameters

@@ -124,38 +126,14 @@ public Builder from(GetActiveDealsResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull GetActiveDealsParams params) { + public _FinalStage params(@NotNull GetFeatureUsageTimeSeriesParams 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(CompanyCrmDealsResponseData 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 GetActiveDealsResponse build() { - return new GetActiveDealsResponse(data, params, additionalProperties); + public GetFeatureUsageTimeSeriesResponse build() { + return new GetFeatureUsageTimeSeriesResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageParams.java index b995609..2823bb3 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageParams.java @@ -27,6 +27,8 @@ public final class ListFeatureUsageParams { private final Optional> featureIds; + private final Optional includeUsageAggregation; + private final Optional limit; private final Optional offset; @@ -41,6 +43,7 @@ private ListFeatureUsageParams( Optional companyId, Optional> companyKeys, Optional> featureIds, + Optional includeUsageAggregation, Optional limit, Optional offset, Optional q, @@ -49,6 +52,7 @@ private ListFeatureUsageParams( this.companyId = companyId; this.companyKeys = companyKeys; this.featureIds = featureIds; + this.includeUsageAggregation = includeUsageAggregation; this.limit = limit; this.offset = offset; this.q = q; @@ -71,6 +75,14 @@ public Optional> getFeatureIds() { return featureIds; } + /** + * @return Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance. + */ + @JsonProperty("include_usage_aggregation") + public Optional getIncludeUsageAggregation() { + return includeUsageAggregation; + } + /** * @return Page limit (default 100) */ @@ -112,6 +124,7 @@ private boolean equalTo(ListFeatureUsageParams other) { return companyId.equals(other.companyId) && companyKeys.equals(other.companyKeys) && featureIds.equals(other.featureIds) + && includeUsageAggregation.equals(other.includeUsageAggregation) && limit.equals(other.limit) && offset.equals(other.offset) && q.equals(other.q) @@ -124,6 +137,7 @@ public int hashCode() { this.companyId, this.companyKeys, this.featureIds, + this.includeUsageAggregation, this.limit, this.offset, this.q, @@ -147,6 +161,8 @@ public static final class Builder { private Optional> featureIds = Optional.empty(); + private Optional includeUsageAggregation = Optional.empty(); + private Optional limit = Optional.empty(); private Optional offset = Optional.empty(); @@ -164,6 +180,7 @@ public Builder from(ListFeatureUsageParams other) { companyId(other.getCompanyId()); companyKeys(other.getCompanyKeys()); featureIds(other.getFeatureIds()); + includeUsageAggregation(other.getIncludeUsageAggregation()); limit(other.getLimit()); offset(other.getOffset()); q(other.getQ()); @@ -204,6 +221,20 @@ public Builder featureIds(List featureIds) { return this; } + /** + *

Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.

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

Page limit (default 100)

*/ @@ -259,6 +290,7 @@ public ListFeatureUsageParams build() { companyId, companyKeys, featureIds, + includeUsageAggregation, limit, offset, q, diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsParams.java index 37f35c1..f3163e5 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsParams.java @@ -35,6 +35,10 @@ public final class ListPlanEntitlementsParams { private final Optional> planIds; + private final Optional planVersionId; + + private final Optional> planVersionIds; + private final Optional q; private final Optional withMeteredProducts; @@ -49,6 +53,8 @@ private ListPlanEntitlementsParams( Optional offset, Optional planId, Optional> planIds, + Optional planVersionId, + Optional> planVersionIds, Optional q, Optional withMeteredProducts, Map additionalProperties) { @@ -59,6 +65,8 @@ private ListPlanEntitlementsParams( this.offset = offset; this.planId = planId; this.planIds = planIds; + this.planVersionId = planVersionId; + this.planVersionIds = planVersionIds; this.q = q; this.withMeteredProducts = withMeteredProducts; this.additionalProperties = additionalProperties; @@ -120,6 +128,22 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter plan entitlements by a single plan version ID (starting with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + /** + * @return Filter plan entitlements by multiple plan version IDs (starting with plvr_) + */ + @JsonProperty("plan_version_ids") + public Optional> getPlanVersionIds() { + return planVersionIds; + } + /** * @return Search for plan entitlements by feature or company name */ @@ -155,6 +179,8 @@ private boolean equalTo(ListPlanEntitlementsParams other) { && offset.equals(other.offset) && planId.equals(other.planId) && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId) + && planVersionIds.equals(other.planVersionIds) && q.equals(other.q) && withMeteredProducts.equals(other.withMeteredProducts); } @@ -169,6 +195,8 @@ public int hashCode() { this.offset, this.planId, this.planIds, + this.planVersionId, + this.planVersionIds, this.q, this.withMeteredProducts); } @@ -198,6 +226,10 @@ public static final class Builder { private Optional> planIds = Optional.empty(); + private Optional planVersionId = Optional.empty(); + + private Optional> planVersionIds = Optional.empty(); + private Optional q = Optional.empty(); private Optional withMeteredProducts = Optional.empty(); @@ -215,6 +247,8 @@ public Builder from(ListPlanEntitlementsParams other) { offset(other.getOffset()); planId(other.getPlanId()); planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); + planVersionIds(other.getPlanVersionIds()); q(other.getQ()); withMeteredProducts(other.getWithMeteredProducts()); return this; @@ -318,6 +352,34 @@ public Builder planIds(List planIds) { return this; } + /** + *

Filter plan entitlements by a single plan version ID (starting with plvr_)

+ */ + @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 plan entitlements by multiple plan version IDs (starting with plvr_)

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

Search for plan entitlements by feature or company name

*/ @@ -355,6 +417,8 @@ public ListPlanEntitlementsParams build() { offset, planId, planIds, + planVersionId, + planVersionIds, q, withMeteredProducts, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyValueType.java b/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyValueType.java deleted file mode 100644 index 20d5945..0000000 --- a/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideRequestBodyValueType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 UpdateCompanyOverrideRequestBodyValueType { - public static final UpdateCompanyOverrideRequestBodyValueType NUMERIC = - new UpdateCompanyOverrideRequestBodyValueType(Value.NUMERIC, "numeric"); - - public static final UpdateCompanyOverrideRequestBodyValueType TRAIT = - new UpdateCompanyOverrideRequestBodyValueType(Value.TRAIT, "trait"); - - public static final UpdateCompanyOverrideRequestBodyValueType BOOLEAN = - new UpdateCompanyOverrideRequestBodyValueType(Value.BOOLEAN, "boolean"); - - public static final UpdateCompanyOverrideRequestBodyValueType CREDIT = - new UpdateCompanyOverrideRequestBodyValueType(Value.CREDIT, "credit"); - - public static final UpdateCompanyOverrideRequestBodyValueType UNLIMITED = - new UpdateCompanyOverrideRequestBodyValueType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - UpdateCompanyOverrideRequestBodyValueType(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 UpdateCompanyOverrideRequestBodyValueType - && this.string.equals(((UpdateCompanyOverrideRequestBodyValueType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case CREDIT: - return visitor.visitCredit(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateCompanyOverrideRequestBodyValueType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "credit": - return CREDIT; - case "unlimited": - return UNLIMITED; - default: - return new UpdateCompanyOverrideRequestBodyValueType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CREDIT, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCredit(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyPriceBehavior.java b/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyPriceBehavior.java deleted file mode 100644 index d1fa89b..0000000 --- a/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyPriceBehavior.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 UpdatePlanEntitlementRequestBodyPriceBehavior { - public static final UpdatePlanEntitlementRequestBodyPriceBehavior TIER = - new UpdatePlanEntitlementRequestBodyPriceBehavior(Value.TIER, "tier"); - - public static final UpdatePlanEntitlementRequestBodyPriceBehavior CREDIT_BURNDOWN = - new UpdatePlanEntitlementRequestBodyPriceBehavior(Value.CREDIT_BURNDOWN, "credit_burndown"); - - public static final UpdatePlanEntitlementRequestBodyPriceBehavior OVERAGE = - new UpdatePlanEntitlementRequestBodyPriceBehavior(Value.OVERAGE, "overage"); - - public static final UpdatePlanEntitlementRequestBodyPriceBehavior PAY_AS_YOU_GO = - new UpdatePlanEntitlementRequestBodyPriceBehavior(Value.PAY_AS_YOU_GO, "pay_as_you_go"); - - public static final UpdatePlanEntitlementRequestBodyPriceBehavior PAY_IN_ADVANCE = - new UpdatePlanEntitlementRequestBodyPriceBehavior(Value.PAY_IN_ADVANCE, "pay_in_advance"); - - private final Value value; - - private final String string; - - UpdatePlanEntitlementRequestBodyPriceBehavior(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 UpdatePlanEntitlementRequestBodyPriceBehavior - && this.string.equals(((UpdatePlanEntitlementRequestBodyPriceBehavior) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case TIER: - return visitor.visitTier(); - case CREDIT_BURNDOWN: - return visitor.visitCreditBurndown(); - case OVERAGE: - return visitor.visitOverage(); - case PAY_AS_YOU_GO: - return visitor.visitPayAsYouGo(); - case PAY_IN_ADVANCE: - return visitor.visitPayInAdvance(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdatePlanEntitlementRequestBodyPriceBehavior valueOf(String value) { - switch (value) { - case "tier": - return TIER; - case "credit_burndown": - return CREDIT_BURNDOWN; - case "overage": - return OVERAGE; - case "pay_as_you_go": - return PAY_AS_YOU_GO; - case "pay_in_advance": - return PAY_IN_ADVANCE; - default: - return new UpdatePlanEntitlementRequestBodyPriceBehavior(Value.UNKNOWN, value); - } - } - - public enum Value { - PAY_AS_YOU_GO, - - PAY_IN_ADVANCE, - - OVERAGE, - - CREDIT_BURNDOWN, - - TIER, - - UNKNOWN - } - - public interface Visitor { - T visitPayAsYouGo(); - - T visitPayInAdvance(); - - T visitOverage(); - - T visitCreditBurndown(); - - T visitTier(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyValueType.java b/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyValueType.java deleted file mode 100644 index a50be7c..0000000 --- a/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementRequestBodyValueType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 UpdatePlanEntitlementRequestBodyValueType { - public static final UpdatePlanEntitlementRequestBodyValueType NUMERIC = - new UpdatePlanEntitlementRequestBodyValueType(Value.NUMERIC, "numeric"); - - public static final UpdatePlanEntitlementRequestBodyValueType TRAIT = - new UpdatePlanEntitlementRequestBodyValueType(Value.TRAIT, "trait"); - - public static final UpdatePlanEntitlementRequestBodyValueType BOOLEAN = - new UpdatePlanEntitlementRequestBodyValueType(Value.BOOLEAN, "boolean"); - - public static final UpdatePlanEntitlementRequestBodyValueType CREDIT = - new UpdatePlanEntitlementRequestBodyValueType(Value.CREDIT, "credit"); - - public static final UpdatePlanEntitlementRequestBodyValueType UNLIMITED = - new UpdatePlanEntitlementRequestBodyValueType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - UpdatePlanEntitlementRequestBodyValueType(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 UpdatePlanEntitlementRequestBodyValueType - && this.string.equals(((UpdatePlanEntitlementRequestBodyValueType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case CREDIT: - return visitor.visitCredit(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdatePlanEntitlementRequestBodyValueType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "credit": - return CREDIT; - case "unlimited": - return UNLIMITED; - default: - return new UpdatePlanEntitlementRequestBodyValueType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CREDIT, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCredit(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/events/requests/ListEventsRequest.java b/src/main/java/com/schematic/api/resources/events/requests/ListEventsRequest.java index e666f03..0ee93e5 100644 --- a/src/main/java/com/schematic/api/resources/events/requests/ListEventsRequest.java +++ b/src/main/java/com/schematic/api/resources/events/requests/ListEventsRequest.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.events.types.ListEventsRequestEventTypesItem; +import com.schematic.api.types.EventType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -23,7 +23,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListEventsRequest.Builder.class) public final class ListEventsRequest { - private final Optional> eventTypes; + private final Optional> eventTypes; private final Optional companyId; @@ -40,7 +40,7 @@ public final class ListEventsRequest { private final Map additionalProperties; private ListEventsRequest( - Optional> eventTypes, + Optional> eventTypes, Optional companyId, Optional eventSubtype, Optional flagId, @@ -59,7 +59,7 @@ private ListEventsRequest( } @JsonProperty("event_types") - public Optional> getEventTypes() { + public Optional> getEventTypes() { return eventTypes; } @@ -137,7 +137,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> eventTypes = Optional.empty(); + private Optional> eventTypes = Optional.empty(); private Optional companyId = Optional.empty(); @@ -168,17 +168,17 @@ public Builder from(ListEventsRequest other) { } @JsonSetter(value = "event_types", nulls = Nulls.SKIP) - public Builder eventTypes(Optional> eventTypes) { + public Builder eventTypes(Optional> eventTypes) { this.eventTypes = eventTypes; return this; } - public Builder eventTypes(List eventTypes) { + public Builder eventTypes(List eventTypes) { this.eventTypes = Optional.ofNullable(eventTypes); return this; } - public Builder eventTypes(ListEventsRequestEventTypesItem eventTypes) { + public Builder eventTypes(EventType eventTypes) { this.eventTypes = Optional.of(Collections.singletonList(eventTypes)); return this; } diff --git a/src/main/java/com/schematic/api/resources/events/types/ListEventsParams.java b/src/main/java/com/schematic/api/resources/events/types/ListEventsParams.java index be694cd..eb069f3 100644 --- a/src/main/java/com/schematic/api/resources/events/types/ListEventsParams.java +++ b/src/main/java/com/schematic/api/resources/events/types/ListEventsParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.EventType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +26,7 @@ public final class ListEventsParams { private final Optional eventSubtype; - private final Optional> eventTypes; + private final Optional> eventTypes; private final Optional flagId; @@ -40,7 +41,7 @@ public final class ListEventsParams { private ListEventsParams( Optional companyId, Optional eventSubtype, - Optional> eventTypes, + Optional> eventTypes, Optional flagId, Optional limit, Optional offset, @@ -67,7 +68,7 @@ public Optional getEventSubtype() { } @JsonProperty("event_types") - public Optional> getEventTypes() { + public Optional> getEventTypes() { return eventTypes; } @@ -139,7 +140,7 @@ public static final class Builder { private Optional eventSubtype = Optional.empty(); - private Optional> eventTypes = Optional.empty(); + private Optional> eventTypes = Optional.empty(); private Optional flagId = Optional.empty(); @@ -188,12 +189,12 @@ public Builder eventSubtype(String eventSubtype) { } @JsonSetter(value = "event_types", nulls = Nulls.SKIP) - public Builder eventTypes(Optional> eventTypes) { + public Builder eventTypes(Optional> eventTypes) { this.eventTypes = eventTypes; return this; } - public Builder eventTypes(List eventTypes) { + public Builder eventTypes(List eventTypes) { this.eventTypes = Optional.ofNullable(eventTypes); return this; } diff --git a/src/main/java/com/schematic/api/resources/events/types/ListEventsRequestEventTypesItem.java b/src/main/java/com/schematic/api/resources/events/types/ListEventsRequestEventTypesItem.java deleted file mode 100644 index f4a67b0..0000000 --- a/src/main/java/com/schematic/api/resources/events/types/ListEventsRequestEventTypesItem.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.events.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListEventsRequestEventTypesItem { - public static final ListEventsRequestEventTypesItem FLAG_CHECK = - new ListEventsRequestEventTypesItem(Value.FLAG_CHECK, "flag_check"); - - public static final ListEventsRequestEventTypesItem TRACK = - new ListEventsRequestEventTypesItem(Value.TRACK, "track"); - - public static final ListEventsRequestEventTypesItem IDENTIFY = - new ListEventsRequestEventTypesItem(Value.IDENTIFY, "identify"); - - private final Value value; - - private final String string; - - ListEventsRequestEventTypesItem(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 ListEventsRequestEventTypesItem - && this.string.equals(((ListEventsRequestEventTypesItem) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FLAG_CHECK: - return visitor.visitFlagCheck(); - case TRACK: - return visitor.visitTrack(); - case IDENTIFY: - return visitor.visitIdentify(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEventsRequestEventTypesItem valueOf(String value) { - switch (value) { - case "flag_check": - return FLAG_CHECK; - case "track": - return TRACK; - case "identify": - return IDENTIFY; - default: - return new ListEventsRequestEventTypesItem(Value.UNKNOWN, value); - } - } - - public enum Value { - IDENTIFY, - - TRACK, - - FLAG_CHECK, - - UNKNOWN - } - - public interface Visitor { - T visitIdentify(); - - T visitTrack(); - - T visitFlagCheck(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/events/types/ListEventsResponseParamsEventTypesItem.java b/src/main/java/com/schematic/api/resources/events/types/ListEventsResponseParamsEventTypesItem.java deleted file mode 100644 index d9602f1..0000000 --- a/src/main/java/com/schematic/api/resources/events/types/ListEventsResponseParamsEventTypesItem.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.events.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListEventsResponseParamsEventTypesItem { - public static final ListEventsResponseParamsEventTypesItem FLAG_CHECK = - new ListEventsResponseParamsEventTypesItem(Value.FLAG_CHECK, "flag_check"); - - public static final ListEventsResponseParamsEventTypesItem TRACK = - new ListEventsResponseParamsEventTypesItem(Value.TRACK, "track"); - - public static final ListEventsResponseParamsEventTypesItem IDENTIFY = - new ListEventsResponseParamsEventTypesItem(Value.IDENTIFY, "identify"); - - private final Value value; - - private final String string; - - ListEventsResponseParamsEventTypesItem(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 ListEventsResponseParamsEventTypesItem - && this.string.equals(((ListEventsResponseParamsEventTypesItem) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FLAG_CHECK: - return visitor.visitFlagCheck(); - case TRACK: - return visitor.visitTrack(); - case IDENTIFY: - return visitor.visitIdentify(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEventsResponseParamsEventTypesItem valueOf(String value) { - switch (value) { - case "flag_check": - return FLAG_CHECK; - case "track": - return TRACK; - case "identify": - return IDENTIFY; - default: - return new ListEventsResponseParamsEventTypesItem(Value.UNKNOWN, value); - } - } - - public enum Value { - IDENTIFY, - - TRACK, - - FLAG_CHECK, - - UNKNOWN - } - - public interface Visitor { - T visitIdentify(); - - T visitTrack(); - - T visitFlagCheck(); - - T visitUnknown(String unknownType); - } -} 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 3eb9b96..cf63690 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +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.CreateFeatureRequestBody; @@ -13,6 +14,7 @@ import com.schematic.api.resources.features.requests.UpdateFeatureRequestBody; import com.schematic.api.resources.features.requests.UpdateFlagRulesRequestBody; import com.schematic.api.resources.features.types.CheckFlagResponse; +import com.schematic.api.resources.features.types.CheckFlagsBulkResponse; import com.schematic.api.resources.features.types.CheckFlagsResponse; import com.schematic.api.resources.features.types.CountFeaturesResponse; import com.schematic.api.resources.features.types.CountFlagsResponse; @@ -194,6 +196,15 @@ public CompletableFuture checkFlags( return this.rawClient.checkFlags(request, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture checkFlagsBulk(CheckFlagsBulkRequestBody request) { + return this.rawClient.checkFlagsBulk(request).thenApply(response -> response.body()); + } + + public CompletableFuture checkFlagsBulk( + CheckFlagsBulkRequestBody request, RequestOptions requestOptions) { + return this.rawClient.checkFlagsBulk(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countFlags() { return this.rawClient.countFlags().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 61b7092..9b00287 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java @@ -17,6 +17,7 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.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.CreateFeatureRequestBody; @@ -25,6 +26,7 @@ import com.schematic.api.resources.features.requests.UpdateFeatureRequestBody; import com.schematic.api.resources.features.requests.UpdateFlagRulesRequestBody; import com.schematic.api.resources.features.types.CheckFlagResponse; +import com.schematic.api.resources.features.types.CheckFlagsBulkResponse; import com.schematic.api.resources.features.types.CheckFlagsResponse; import com.schematic.api.resources.features.types.CountFeaturesResponse; import com.schematic.api.resources.features.types.CountFlagsResponse; @@ -1391,6 +1393,98 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + public CompletableFuture> checkFlagsBulk( + CheckFlagsBulkRequestBody request) { + return checkFlagsBulk(request, null); + } + + public CompletableFuture> checkFlagsBulk( + CheckFlagsBulkRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("flags/check-bulk") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CheckFlagsBulkResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + public CompletableFuture> countFlags() { return countFlags(CountFlagsRequest.builder().build()); } 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 f9352c9..13a2757 100644 --- a/src/main/java/com/schematic/api/resources/features/FeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/FeaturesClient.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; +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.CreateFeatureRequestBody; @@ -13,6 +14,7 @@ import com.schematic.api.resources.features.requests.UpdateFeatureRequestBody; import com.schematic.api.resources.features.requests.UpdateFlagRulesRequestBody; import com.schematic.api.resources.features.types.CheckFlagResponse; +import com.schematic.api.resources.features.types.CheckFlagsBulkResponse; import com.schematic.api.resources.features.types.CheckFlagsResponse; import com.schematic.api.resources.features.types.CountFeaturesResponse; import com.schematic.api.resources.features.types.CountFlagsResponse; @@ -185,6 +187,14 @@ public CheckFlagsResponse checkFlags(CheckFlagRequestBody request, RequestOption return this.rawClient.checkFlags(request, requestOptions).body(); } + public CheckFlagsBulkResponse checkFlagsBulk(CheckFlagsBulkRequestBody request) { + return this.rawClient.checkFlagsBulk(request).body(); + } + + public CheckFlagsBulkResponse checkFlagsBulk(CheckFlagsBulkRequestBody request, RequestOptions requestOptions) { + return this.rawClient.checkFlagsBulk(request, requestOptions).body(); + } + public CountFlagsResponse countFlags() { return this.rawClient.countFlags().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 2c34e5e..9386f66 100644 --- a/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java @@ -17,6 +17,7 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.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.CreateFeatureRequestBody; @@ -25,6 +26,7 @@ import com.schematic.api.resources.features.requests.UpdateFeatureRequestBody; import com.schematic.api.resources.features.requests.UpdateFlagRulesRequestBody; import com.schematic.api.resources.features.types.CheckFlagResponse; +import com.schematic.api.resources.features.types.CheckFlagsBulkResponse; import com.schematic.api.resources.features.types.CheckFlagsResponse; import com.schematic.api.resources.features.types.CountFeaturesResponse; import com.schematic.api.resources.features.types.CountFlagsResponse; @@ -1052,6 +1054,73 @@ public BaseSchematicHttpResponse checkFlags( } } + public BaseSchematicHttpResponse checkFlagsBulk(CheckFlagsBulkRequestBody request) { + return checkFlagsBulk(request, null); + } + + public BaseSchematicHttpResponse checkFlagsBulk( + CheckFlagsBulkRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("flags/check-bulk") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckFlagsBulkResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + public BaseSchematicHttpResponse countFlags() { return countFlags(CountFlagsRequest.builder().build()); } diff --git a/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java new file mode 100644 index 0000000..efe31b7 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java @@ -0,0 +1,107 @@ +/** + * 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.CheckFlagRequestBody; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckFlagsBulkRequestBody.Builder.class) +public final class CheckFlagsBulkRequestBody { + private final List contexts; + + private final Map additionalProperties; + + private CheckFlagsBulkRequestBody(List contexts, Map additionalProperties) { + this.contexts = contexts; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("contexts") + public List getContexts() { + return contexts; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckFlagsBulkRequestBody && equalTo((CheckFlagsBulkRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckFlagsBulkRequestBody other) { + return contexts.equals(other.contexts); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contexts); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List contexts = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CheckFlagsBulkRequestBody other) { + contexts(other.getContexts()); + return this; + } + + @JsonSetter(value = "contexts", nulls = Nulls.SKIP) + public Builder contexts(List contexts) { + this.contexts.clear(); + if (contexts != null) { + this.contexts.addAll(contexts); + } + return this; + } + + public Builder addContexts(CheckFlagRequestBody contexts) { + this.contexts.add(contexts); + return this; + } + + public Builder addAllContexts(List contexts) { + if (contexts != null) { + this.contexts.addAll(contexts); + } + return this; + } + + public CheckFlagsBulkRequestBody build() { + return new CheckFlagsBulkRequestBody(contexts, additionalProperties); + } + } +} 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 2e5e165..c80fcaa 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 @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.FeatureType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -24,7 +25,7 @@ public final class CountFeaturesRequest { private final Optional> ids; - private final Optional> featureType; + private final Optional> featureType; private final Optional q; @@ -42,7 +43,7 @@ public final class CountFeaturesRequest { private CountFeaturesRequest( Optional> ids, - Optional> featureType, + Optional> featureType, Optional q, Optional withoutCompanyOverrideFor, Optional withoutPlanEntitlementFor, @@ -70,7 +71,7 @@ public Optional> getIds() { * @return Filter by one or more feature types (boolean, event, trait) */ @JsonProperty("feature_type") - public Optional> getFeatureType() { + public Optional> getFeatureType() { return featureType; } @@ -170,7 +171,7 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional> featureType = Optional.empty(); + private Optional> featureType = Optional.empty(); private Optional q = Optional.empty(); @@ -221,17 +222,17 @@ public Builder ids(String ids) { *

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

*/ @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional> featureType) { + public Builder featureType(Optional> featureType) { this.featureType = featureType; return this; } - public Builder featureType(List featureType) { + public Builder featureType(List featureType) { this.featureType = Optional.ofNullable(featureType); return this; } - public Builder featureType(String featureType) { + public Builder featureType(FeatureType featureType) { this.featureType = Optional.of(Collections.singletonList(featureType)); return this; } diff --git a/src/main/java/com/schematic/api/resources/features/requests/CreateFeatureRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/CreateFeatureRequestBody.java index e857de2..a4ab28d 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/CreateFeatureRequestBody.java +++ b/src/main/java/com/schematic/api/resources/features/requests/CreateFeatureRequestBody.java @@ -12,9 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.features.types.CreateFeatureRequestBodyFeatureType; -import com.schematic.api.resources.features.types.CreateFeatureRequestBodyLifecyclePhase; 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; @@ -28,13 +28,13 @@ public final class CreateFeatureRequestBody { private final Optional eventSubtype; - private final CreateFeatureRequestBodyFeatureType featureType; + private final FeatureType featureType; private final Optional flag; private final Optional icon; - private final Optional lifecyclePhase; + private final Optional lifecyclePhase; private final Optional maintainerId; @@ -51,10 +51,10 @@ public final class CreateFeatureRequestBody { private CreateFeatureRequestBody( String description, Optional eventSubtype, - CreateFeatureRequestBodyFeatureType featureType, + FeatureType featureType, Optional flag, Optional icon, - Optional lifecyclePhase, + Optional lifecyclePhase, Optional maintainerId, String name, Optional pluralName, @@ -86,7 +86,7 @@ public Optional getEventSubtype() { } @JsonProperty("feature_type") - public CreateFeatureRequestBodyFeatureType getFeatureType() { + public FeatureType getFeatureType() { return featureType; } @@ -101,7 +101,7 @@ public Optional getIcon() { } @JsonProperty("lifecycle_phase") - public Optional getLifecyclePhase() { + public Optional getLifecyclePhase() { return lifecyclePhase; } @@ -187,7 +187,7 @@ public interface DescriptionStage { } public interface FeatureTypeStage { - NameStage featureType(@NotNull CreateFeatureRequestBodyFeatureType featureType); + NameStage featureType(@NotNull FeatureType featureType); } public interface NameStage { @@ -209,9 +209,9 @@ public interface _FinalStage { _FinalStage icon(String icon); - _FinalStage lifecyclePhase(Optional lifecyclePhase); + _FinalStage lifecyclePhase(Optional lifecyclePhase); - _FinalStage lifecyclePhase(CreateFeatureRequestBodyLifecyclePhase lifecyclePhase); + _FinalStage lifecyclePhase(FeatureLifecyclePhase lifecyclePhase); _FinalStage maintainerId(Optional maintainerId); @@ -234,7 +234,7 @@ public interface _FinalStage { public static final class Builder implements DescriptionStage, FeatureTypeStage, NameStage, _FinalStage { private String description; - private CreateFeatureRequestBodyFeatureType featureType; + private FeatureType featureType; private String name; @@ -246,7 +246,7 @@ public static final class Builder implements DescriptionStage, FeatureTypeStage, private Optional maintainerId = Optional.empty(); - private Optional lifecyclePhase = Optional.empty(); + private Optional lifecyclePhase = Optional.empty(); private Optional icon = Optional.empty(); @@ -284,7 +284,7 @@ public FeatureTypeStage description(@NotNull String description) { @java.lang.Override @JsonSetter("feature_type") - public NameStage featureType(@NotNull CreateFeatureRequestBodyFeatureType featureType) { + public NameStage featureType(@NotNull FeatureType featureType) { this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); return this; } @@ -349,14 +349,14 @@ public _FinalStage maintainerId(Optional maintainerId) { } @java.lang.Override - public _FinalStage lifecyclePhase(CreateFeatureRequestBodyLifecyclePhase lifecyclePhase) { + 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) { + public _FinalStage lifecyclePhase(Optional lifecyclePhase) { this.lifecyclePhase = lifecyclePhase; 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 ba98452..d636c76 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 @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.FeatureType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -24,7 +25,7 @@ public final class ListFeaturesRequest { private final Optional> ids; - private final Optional> featureType; + private final Optional> featureType; private final Optional q; @@ -42,7 +43,7 @@ public final class ListFeaturesRequest { private ListFeaturesRequest( Optional> ids, - Optional> featureType, + Optional> featureType, Optional q, Optional withoutCompanyOverrideFor, Optional withoutPlanEntitlementFor, @@ -70,7 +71,7 @@ public Optional> getIds() { * @return Filter by one or more feature types (boolean, event, trait) */ @JsonProperty("feature_type") - public Optional> getFeatureType() { + public Optional> getFeatureType() { return featureType; } @@ -170,7 +171,7 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional> featureType = Optional.empty(); + private Optional> featureType = Optional.empty(); private Optional q = Optional.empty(); @@ -221,17 +222,17 @@ public Builder ids(String ids) { *

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

*/ @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional> featureType) { + public Builder featureType(Optional> featureType) { this.featureType = featureType; return this; } - public Builder featureType(List featureType) { + public Builder featureType(List featureType) { this.featureType = Optional.ofNullable(featureType); return this; } - public Builder featureType(String featureType) { + public Builder featureType(FeatureType featureType) { this.featureType = Optional.of(Collections.singletonList(featureType)); return this; } diff --git a/src/main/java/com/schematic/api/resources/features/requests/UpdateFeatureRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/UpdateFeatureRequestBody.java index 34e65b0..b8686a6 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/UpdateFeatureRequestBody.java +++ b/src/main/java/com/schematic/api/resources/features/requests/UpdateFeatureRequestBody.java @@ -12,9 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.features.types.UpdateFeatureRequestBodyFeatureType; -import com.schematic.api.resources.features.types.UpdateFeatureRequestBodyLifecyclePhase; 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; @@ -27,13 +27,13 @@ public final class UpdateFeatureRequestBody { private final Optional eventSubtype; - private final Optional featureType; + private final Optional featureType; private final Optional flag; private final Optional icon; - private final Optional lifecyclePhase; + private final Optional lifecyclePhase; private final Optional maintainerId; @@ -50,10 +50,10 @@ public final class UpdateFeatureRequestBody { private UpdateFeatureRequestBody( Optional description, Optional eventSubtype, - Optional featureType, + Optional featureType, Optional flag, Optional icon, - Optional lifecyclePhase, + Optional lifecyclePhase, Optional maintainerId, Optional name, Optional pluralName, @@ -85,7 +85,7 @@ public Optional getEventSubtype() { } @JsonProperty("feature_type") - public Optional getFeatureType() { + public Optional getFeatureType() { return featureType; } @@ -100,7 +100,7 @@ public Optional getIcon() { } @JsonProperty("lifecycle_phase") - public Optional getLifecyclePhase() { + public Optional getLifecyclePhase() { return lifecyclePhase; } @@ -185,13 +185,13 @@ public static final class Builder { private Optional eventSubtype = Optional.empty(); - private Optional featureType = Optional.empty(); + private Optional featureType = Optional.empty(); private Optional flag = Optional.empty(); private Optional icon = Optional.empty(); - private Optional lifecyclePhase = Optional.empty(); + private Optional lifecyclePhase = Optional.empty(); private Optional maintainerId = Optional.empty(); @@ -246,12 +246,12 @@ public Builder eventSubtype(String eventSubtype) { } @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional featureType) { + public Builder featureType(Optional featureType) { this.featureType = featureType; return this; } - public Builder featureType(UpdateFeatureRequestBodyFeatureType featureType) { + public Builder featureType(FeatureType featureType) { this.featureType = Optional.ofNullable(featureType); return this; } @@ -279,12 +279,12 @@ public Builder icon(String icon) { } @JsonSetter(value = "lifecycle_phase", nulls = Nulls.SKIP) - public Builder lifecyclePhase(Optional lifecyclePhase) { + public Builder lifecyclePhase(Optional lifecyclePhase) { this.lifecyclePhase = lifecyclePhase; return this; } - public Builder lifecyclePhase(UpdateFeatureRequestBodyLifecyclePhase lifecyclePhase) { + public Builder lifecyclePhase(FeatureLifecyclePhase lifecyclePhase) { this.lifecyclePhase = Optional.ofNullable(lifecyclePhase); return this; } diff --git a/src/main/java/com/schematic/api/resources/crm/types/UpsertLineItemResponse.java b/src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java similarity index 78% rename from src/main/java/com/schematic/api/resources/crm/types/UpsertLineItemResponse.java rename to src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java index cc47d4e..74db7f8 100644 --- a/src/main/java/com/schematic/api/resources/crm/types/UpsertLineItemResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.types; +package com.schematic.api.resources.features.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.CrmLineItemResponseData; +import com.schematic.api.types.CheckFlagsBulkResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,23 +21,23 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpsertLineItemResponse.Builder.class) -public final class UpsertLineItemResponse { - private final CrmLineItemResponseData data; +@JsonDeserialize(builder = CheckFlagsBulkResponse.Builder.class) +public final class CheckFlagsBulkResponse { + private final CheckFlagsBulkResponseData data; private final Map params; private final Map additionalProperties; - private UpsertLineItemResponse( - CrmLineItemResponseData data, Map params, Map additionalProperties) { + private CheckFlagsBulkResponse( + CheckFlagsBulkResponseData data, Map params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public CrmLineItemResponseData getData() { + public CheckFlagsBulkResponseData getData() { return data; } @@ -52,7 +52,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof UpsertLineItemResponse && equalTo((UpsertLineItemResponse) other); + return other instanceof CheckFlagsBulkResponse && equalTo((CheckFlagsBulkResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(UpsertLineItemResponse other) { + private boolean equalTo(CheckFlagsBulkResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -79,13 +79,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull CrmLineItemResponseData data); + _FinalStage data(@NotNull CheckFlagsBulkResponseData data); - Builder from(UpsertLineItemResponse other); + Builder from(CheckFlagsBulkResponse other); } public interface _FinalStage { - UpsertLineItemResponse build(); + CheckFlagsBulkResponse build(); /** *

Input parameters

@@ -99,7 +99,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private CrmLineItemResponseData data; + private CheckFlagsBulkResponseData data; private Map params = new LinkedHashMap<>(); @@ -109,7 +109,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(UpsertLineItemResponse other) { + public Builder from(CheckFlagsBulkResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -117,7 +117,7 @@ public Builder from(UpsertLineItemResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull CrmLineItemResponseData data) { + public _FinalStage data(@NotNull CheckFlagsBulkResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -158,8 +158,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public UpsertLineItemResponse build() { - return new UpsertLineItemResponse(data, params, additionalProperties); + public CheckFlagsBulkResponse build() { + return new CheckFlagsBulkResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CountFeaturesParams.java b/src/main/java/com/schematic/api/resources/features/types/CountFeaturesParams.java index 9923b76..08d3aa1 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CountFeaturesParams.java +++ b/src/main/java/com/schematic/api/resources/features/types/CountFeaturesParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.FeatureType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,7 +24,7 @@ public final class CountFeaturesParams { private final Optional booleanRequireEvent; - private final Optional> featureType; + private final Optional> featureType; private final Optional> ids; @@ -41,7 +42,7 @@ public final class CountFeaturesParams { private CountFeaturesParams( Optional booleanRequireEvent, - Optional> featureType, + Optional> featureType, Optional> ids, Optional limit, Optional offset, @@ -72,7 +73,7 @@ public Optional getBooleanRequireEvent() { * @return Filter by one or more feature types (boolean, event, trait) */ @JsonProperty("feature_type") - public Optional> getFeatureType() { + public Optional> getFeatureType() { return featureType; } @@ -169,7 +170,7 @@ public static Builder builder() { public static final class Builder { private Optional booleanRequireEvent = Optional.empty(); - private Optional> featureType = Optional.empty(); + private Optional> featureType = Optional.empty(); private Optional> ids = Optional.empty(); @@ -218,12 +219,12 @@ public Builder booleanRequireEvent(Boolean booleanRequireEvent) { *

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

*/ @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional> featureType) { + public Builder featureType(Optional> featureType) { this.featureType = featureType; return this; } - public Builder featureType(List featureType) { + public Builder featureType(List featureType) { this.featureType = Optional.ofNullable(featureType); return this; } diff --git a/src/main/java/com/schematic/api/resources/features/types/CreateFeatureRequestBodyFeatureType.java b/src/main/java/com/schematic/api/resources/features/types/CreateFeatureRequestBodyFeatureType.java deleted file mode 100644 index c63763d..0000000 --- a/src/main/java/com/schematic/api/resources/features/types/CreateFeatureRequestBodyFeatureType.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.features.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreateFeatureRequestBodyFeatureType { - public static final CreateFeatureRequestBodyFeatureType TRAIT = - new CreateFeatureRequestBodyFeatureType(Value.TRAIT, "trait"); - - public static final CreateFeatureRequestBodyFeatureType BOOLEAN = - new CreateFeatureRequestBodyFeatureType(Value.BOOLEAN, "boolean"); - - public static final CreateFeatureRequestBodyFeatureType EVENT = - new CreateFeatureRequestBodyFeatureType(Value.EVENT, "event"); - - private final Value value; - - private final String string; - - CreateFeatureRequestBodyFeatureType(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 CreateFeatureRequestBodyFeatureType - && this.string.equals(((CreateFeatureRequestBodyFeatureType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case EVENT: - return visitor.visitEvent(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateFeatureRequestBodyFeatureType valueOf(String value) { - switch (value) { - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "event": - return EVENT; - default: - return new CreateFeatureRequestBodyFeatureType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - EVENT, - - TRAIT, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitEvent(); - - T visitTrait(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/features/types/ListFeaturesParams.java b/src/main/java/com/schematic/api/resources/features/types/ListFeaturesParams.java index 9dcbd3a..aa761c8 100644 --- a/src/main/java/com/schematic/api/resources/features/types/ListFeaturesParams.java +++ b/src/main/java/com/schematic/api/resources/features/types/ListFeaturesParams.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.FeatureType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,7 +24,7 @@ public final class ListFeaturesParams { private final Optional booleanRequireEvent; - private final Optional> featureType; + private final Optional> featureType; private final Optional> ids; @@ -41,7 +42,7 @@ public final class ListFeaturesParams { private ListFeaturesParams( Optional booleanRequireEvent, - Optional> featureType, + Optional> featureType, Optional> ids, Optional limit, Optional offset, @@ -72,7 +73,7 @@ public Optional getBooleanRequireEvent() { * @return Filter by one or more feature types (boolean, event, trait) */ @JsonProperty("feature_type") - public Optional> getFeatureType() { + public Optional> getFeatureType() { return featureType; } @@ -169,7 +170,7 @@ public static Builder builder() { public static final class Builder { private Optional booleanRequireEvent = Optional.empty(); - private Optional> featureType = Optional.empty(); + private Optional> featureType = Optional.empty(); private Optional> ids = Optional.empty(); @@ -218,12 +219,12 @@ public Builder booleanRequireEvent(Boolean booleanRequireEvent) { *

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

*/ @JsonSetter(value = "feature_type", nulls = Nulls.SKIP) - public Builder featureType(Optional> featureType) { + public Builder featureType(Optional> featureType) { this.featureType = featureType; return this; } - public Builder featureType(List featureType) { + public Builder featureType(List featureType) { this.featureType = Optional.ofNullable(featureType); return this; } diff --git a/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureRequestBodyLifecyclePhase.java b/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureRequestBodyLifecyclePhase.java deleted file mode 100644 index 255d0d5..0000000 --- a/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureRequestBodyLifecyclePhase.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.features.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateFeatureRequestBodyLifecyclePhase { - public static final UpdateFeatureRequestBodyLifecyclePhase GA = - new UpdateFeatureRequestBodyLifecyclePhase(Value.GA, "ga"); - - public static final UpdateFeatureRequestBodyLifecyclePhase ALPHA = - new UpdateFeatureRequestBodyLifecyclePhase(Value.ALPHA, "alpha"); - - public static final UpdateFeatureRequestBodyLifecyclePhase BETA = - new UpdateFeatureRequestBodyLifecyclePhase(Value.BETA, "beta"); - - public static final UpdateFeatureRequestBodyLifecyclePhase INACTIVE = - new UpdateFeatureRequestBodyLifecyclePhase(Value.INACTIVE, "inactive"); - - public static final UpdateFeatureRequestBodyLifecyclePhase ADD_ON = - new UpdateFeatureRequestBodyLifecyclePhase(Value.ADD_ON, "add_on"); - - public static final UpdateFeatureRequestBodyLifecyclePhase DEPRECATED = - new UpdateFeatureRequestBodyLifecyclePhase(Value.DEPRECATED, "deprecated"); - - public static final UpdateFeatureRequestBodyLifecyclePhase LEGACY = - new UpdateFeatureRequestBodyLifecyclePhase(Value.LEGACY, "legacy"); - - public static final UpdateFeatureRequestBodyLifecyclePhase INTERNAL_TESTING = - new UpdateFeatureRequestBodyLifecyclePhase(Value.INTERNAL_TESTING, "internal_testing"); - - public static final UpdateFeatureRequestBodyLifecyclePhase IN_PLAN = - new UpdateFeatureRequestBodyLifecyclePhase(Value.IN_PLAN, "in_plan"); - - private final Value value; - - private final String string; - - UpdateFeatureRequestBodyLifecyclePhase(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 UpdateFeatureRequestBodyLifecyclePhase - && this.string.equals(((UpdateFeatureRequestBodyLifecyclePhase) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GA: - return visitor.visitGa(); - case ALPHA: - return visitor.visitAlpha(); - case BETA: - return visitor.visitBeta(); - case INACTIVE: - return visitor.visitInactive(); - case ADD_ON: - return visitor.visitAddOn(); - case DEPRECATED: - return visitor.visitDeprecated(); - case LEGACY: - return visitor.visitLegacy(); - case INTERNAL_TESTING: - return visitor.visitInternalTesting(); - case IN_PLAN: - return visitor.visitInPlan(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateFeatureRequestBodyLifecyclePhase valueOf(String value) { - switch (value) { - case "ga": - return GA; - case "alpha": - return ALPHA; - case "beta": - return BETA; - case "inactive": - return INACTIVE; - case "add_on": - return ADD_ON; - case "deprecated": - return DEPRECATED; - case "legacy": - return LEGACY; - case "internal_testing": - return INTERNAL_TESTING; - case "in_plan": - return IN_PLAN; - default: - return new UpdateFeatureRequestBodyLifecyclePhase(Value.UNKNOWN, value); - } - } - - public enum Value { - ADD_ON, - - ALPHA, - - BETA, - - DEPRECATED, - - GA, - - IN_PLAN, - - INACTIVE, - - INTERNAL_TESTING, - - LEGACY, - - UNKNOWN - } - - public interface Visitor { - T visitAddOn(); - - T visitAlpha(); - - T visitBeta(); - - T visitDeprecated(); - - T visitGa(); - - T visitInPlan(); - - T visitInactive(); - - T visitInternalTesting(); - - T visitLegacy(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java new file mode 100644 index 0000000..c21a831 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/AsyncPlanbundleClient.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.planbundle.requests.CreatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.requests.UpdatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.types.CreatePlanBundleResponse; +import com.schematic.api.resources.planbundle.types.UpdatePlanBundleResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncPlanbundleClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPlanbundleClient rawClient; + + public AsyncPlanbundleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPlanbundleClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPlanbundleClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture createPlanBundle(CreatePlanBundleRequestBody request) { + return this.rawClient.createPlanBundle(request).thenApply(response -> response.body()); + } + + public CompletableFuture createPlanBundle( + CreatePlanBundleRequestBody request, RequestOptions requestOptions) { + return this.rawClient.createPlanBundle(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request) { + return this.rawClient.updatePlanBundle(planBundleId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .updatePlanBundle(planBundleId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java new file mode 100644 index 0000000..90b9775 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle; + +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.MediaTypes; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.errors.BadRequestError; +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.planbundle.requests.CreatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.requests.UpdatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.types.CreatePlanBundleResponse; +import com.schematic.api.resources.planbundle.types.UpdatePlanBundleResponse; +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.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPlanbundleClient { + protected final ClientOptions clientOptions; + + public AsyncRawPlanbundleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> createPlanBundle( + CreatePlanBundleRequestBody request) { + return createPlanBundle(request, null); + } + + public CompletableFuture> createPlanBundle( + CreatePlanBundleRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-bundles") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CreatePlanBundleResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request) { + return updatePlanBundle(planBundleId, request, null); + } + + public CompletableFuture> updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-bundles") + .addPathSegment(planBundleId) + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), UpdatePlanBundleResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java new file mode 100644 index 0000000..ff6d028 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/PlanbundleClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.planbundle.requests.CreatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.requests.UpdatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.types.CreatePlanBundleResponse; +import com.schematic.api.resources.planbundle.types.UpdatePlanBundleResponse; + +public class PlanbundleClient { + protected final ClientOptions clientOptions; + + private final RawPlanbundleClient rawClient; + + public PlanbundleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPlanbundleClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPlanbundleClient withRawResponse() { + return this.rawClient; + } + + public CreatePlanBundleResponse createPlanBundle(CreatePlanBundleRequestBody request) { + return this.rawClient.createPlanBundle(request).body(); + } + + public CreatePlanBundleResponse createPlanBundle( + CreatePlanBundleRequestBody request, RequestOptions requestOptions) { + return this.rawClient.createPlanBundle(request, requestOptions).body(); + } + + public UpdatePlanBundleResponse updatePlanBundle(String planBundleId, UpdatePlanBundleRequestBody request) { + return this.rawClient.updatePlanBundle(planBundleId, request).body(); + } + + public UpdatePlanBundleResponse updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .updatePlanBundle(planBundleId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java new file mode 100644 index 0000000..62372e9 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle; + +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.MediaTypes; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.errors.BadRequestError; +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.planbundle.requests.CreatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.requests.UpdatePlanBundleRequestBody; +import com.schematic.api.resources.planbundle.types.CreatePlanBundleResponse; +import com.schematic.api.resources.planbundle.types.UpdatePlanBundleResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPlanbundleClient { + protected final ClientOptions clientOptions; + + public RawPlanbundleClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public BaseSchematicHttpResponse createPlanBundle(CreatePlanBundleRequestBody request) { + return createPlanBundle(request, null); + } + + public BaseSchematicHttpResponse createPlanBundle( + CreatePlanBundleRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-bundles") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("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(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanBundleResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request) { + return updatePlanBundle(planBundleId, request, null); + } + + public BaseSchematicHttpResponse updatePlanBundle( + String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-bundles") + .addPathSegment(planBundleId) + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanBundleResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new BaseSchematicApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java new file mode 100644 index 0000000..6b61d93 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle.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.CreatePlanRequestBody; +import com.schematic.api.types.PlanBundleCreditGrantRequestBody; +import com.schematic.api.types.PlanBundleEntitlementRequestBody; +import com.schematic.api.types.UpdatePlanTraitTraitRequestBody; +import com.schematic.api.types.UpsertBillingProductRequestBody; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePlanBundleRequestBody.Builder.class) +public final class CreatePlanBundleRequestBody { + private final Optional billingProduct; + + private final Optional> creditGrants; + + private final List entitlements; + + private final Optional plan; + + private final Optional> traits; + + private final Map additionalProperties; + + private CreatePlanBundleRequestBody( + Optional billingProduct, + Optional> creditGrants, + List entitlements, + Optional plan, + Optional> traits, + Map additionalProperties) { + this.billingProduct = billingProduct; + this.creditGrants = creditGrants; + this.entitlements = entitlements; + this.plan = plan; + this.traits = traits; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_product") + public Optional getBillingProduct() { + return billingProduct; + } + + @JsonProperty("credit_grants") + public Optional> getCreditGrants() { + return creditGrants; + } + + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + + @JsonProperty("traits") + public Optional> getTraits() { + return traits; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePlanBundleRequestBody && equalTo((CreatePlanBundleRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePlanBundleRequestBody other) { + return billingProduct.equals(other.billingProduct) + && creditGrants.equals(other.creditGrants) + && entitlements.equals(other.entitlements) + && plan.equals(other.plan) + && traits.equals(other.traits); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.traits); + } + + @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 billingProduct = Optional.empty(); + + private Optional> creditGrants = Optional.empty(); + + private List entitlements = new ArrayList<>(); + + private Optional plan = Optional.empty(); + + private Optional> traits = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreatePlanBundleRequestBody other) { + billingProduct(other.getBillingProduct()); + creditGrants(other.getCreditGrants()); + entitlements(other.getEntitlements()); + plan(other.getPlan()); + traits(other.getTraits()); + return this; + } + + @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) + public Builder billingProduct(Optional billingProduct) { + this.billingProduct = billingProduct; + return this; + } + + public Builder billingProduct(UpsertBillingProductRequestBody billingProduct) { + this.billingProduct = Optional.ofNullable(billingProduct); + return this; + } + + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public Builder creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; + return this; + } + + public Builder creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); + return this; + } + + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public Builder entitlements(List entitlements) { + this.entitlements.clear(); + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + public Builder addEntitlements(PlanBundleEntitlementRequestBody entitlements) { + this.entitlements.add(entitlements); + return this; + } + + public Builder addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(CreatePlanRequestBody plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + @JsonSetter(value = "traits", nulls = Nulls.SKIP) + public Builder traits(Optional> traits) { + this.traits = traits; + return this; + } + + public Builder traits(List traits) { + this.traits = Optional.ofNullable(traits); + return this; + } + + public CreatePlanBundleRequestBody build() { + return new CreatePlanBundleRequestBody( + billingProduct, creditGrants, entitlements, plan, traits, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java new file mode 100644 index 0000000..dd8eebd --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle.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.PlanBundleCreditGrantRequestBody; +import com.schematic.api.types.PlanBundleEntitlementRequestBody; +import com.schematic.api.types.UpdatePlanRequestBody; +import com.schematic.api.types.UpdatePlanTraitTraitRequestBody; +import com.schematic.api.types.UpsertBillingProductRequestBody; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePlanBundleRequestBody.Builder.class) +public final class UpdatePlanBundleRequestBody { + private final Optional billingProduct; + + private final Optional> creditGrants; + + private final List entitlements; + + private final Optional plan; + + private final Optional> traits; + + private final Map additionalProperties; + + private UpdatePlanBundleRequestBody( + Optional billingProduct, + Optional> creditGrants, + List entitlements, + Optional plan, + Optional> traits, + Map additionalProperties) { + this.billingProduct = billingProduct; + this.creditGrants = creditGrants; + this.entitlements = entitlements; + this.plan = plan; + this.traits = traits; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_product") + public Optional getBillingProduct() { + return billingProduct; + } + + @JsonProperty("credit_grants") + public Optional> getCreditGrants() { + return creditGrants; + } + + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + + @JsonProperty("traits") + public Optional> getTraits() { + return traits; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePlanBundleRequestBody && equalTo((UpdatePlanBundleRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlanBundleRequestBody other) { + return billingProduct.equals(other.billingProduct) + && creditGrants.equals(other.creditGrants) + && entitlements.equals(other.entitlements) + && plan.equals(other.plan) + && traits.equals(other.traits); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.traits); + } + + @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 billingProduct = Optional.empty(); + + private Optional> creditGrants = Optional.empty(); + + private List entitlements = new ArrayList<>(); + + private Optional plan = Optional.empty(); + + private Optional> traits = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePlanBundleRequestBody other) { + billingProduct(other.getBillingProduct()); + creditGrants(other.getCreditGrants()); + entitlements(other.getEntitlements()); + plan(other.getPlan()); + traits(other.getTraits()); + return this; + } + + @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) + public Builder billingProduct(Optional billingProduct) { + this.billingProduct = billingProduct; + return this; + } + + public Builder billingProduct(UpsertBillingProductRequestBody billingProduct) { + this.billingProduct = Optional.ofNullable(billingProduct); + return this; + } + + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public Builder creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; + return this; + } + + public Builder creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); + return this; + } + + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public Builder entitlements(List entitlements) { + this.entitlements.clear(); + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + public Builder addEntitlements(PlanBundleEntitlementRequestBody entitlements) { + this.entitlements.add(entitlements); + return this; + } + + public Builder addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(UpdatePlanRequestBody plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + @JsonSetter(value = "traits", nulls = Nulls.SKIP) + public Builder traits(Optional> traits) { + this.traits = traits; + return this; + } + + public Builder traits(List traits) { + this.traits = Optional.ofNullable(traits); + return this; + } + + public UpdatePlanBundleRequestBody build() { + return new UpdatePlanBundleRequestBody( + billingProduct, creditGrants, entitlements, plan, traits, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/crm/types/UpsertCrmProductResponse.java b/src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java similarity index 79% rename from src/main/java/com/schematic/api/resources/crm/types/UpsertCrmProductResponse.java rename to src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java index 56a2ac7..8994e17 100644 --- a/src/main/java/com/schematic/api/resources/crm/types/UpsertCrmProductResponse.java +++ b/src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.crm.types; +package com.schematic.api.resources.planbundle.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.types.CrmProductResponseData; +import com.schematic.api.types.PlanBundleResponseData; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -21,23 +21,23 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UpsertCrmProductResponse.Builder.class) -public final class UpsertCrmProductResponse { - private final CrmProductResponseData data; +@JsonDeserialize(builder = CreatePlanBundleResponse.Builder.class) +public final class CreatePlanBundleResponse { + private final PlanBundleResponseData data; private final Map params; private final Map additionalProperties; - private UpsertCrmProductResponse( - CrmProductResponseData data, Map params, Map additionalProperties) { + private CreatePlanBundleResponse( + PlanBundleResponseData data, Map params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public CrmProductResponseData getData() { + public PlanBundleResponseData getData() { return data; } @@ -52,7 +52,7 @@ public Map getParams() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof UpsertCrmProductResponse && equalTo((UpsertCrmProductResponse) other); + return other instanceof CreatePlanBundleResponse && equalTo((CreatePlanBundleResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(UpsertCrmProductResponse other) { + private boolean equalTo(CreatePlanBundleResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -79,13 +79,13 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull CrmProductResponseData data); + _FinalStage data(@NotNull PlanBundleResponseData data); - Builder from(UpsertCrmProductResponse other); + Builder from(CreatePlanBundleResponse other); } public interface _FinalStage { - UpsertCrmProductResponse build(); + CreatePlanBundleResponse build(); /** *

Input parameters

@@ -99,7 +99,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private CrmProductResponseData data; + private PlanBundleResponseData data; private Map params = new LinkedHashMap<>(); @@ -109,7 +109,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(UpsertCrmProductResponse other) { + public Builder from(CreatePlanBundleResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -117,7 +117,7 @@ public Builder from(UpsertCrmProductResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull CrmProductResponseData data) { + public _FinalStage data(@NotNull PlanBundleResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -158,8 +158,8 @@ public _FinalStage params(Map params) { } @java.lang.Override - public UpsertCrmProductResponse build() { - return new UpsertCrmProductResponse(data, params, additionalProperties); + public CreatePlanBundleResponse build() { + return new CreatePlanBundleResponse(data, params, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java b/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java new file mode 100644 index 0000000..ed3b008 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planbundle.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.PlanBundleResponseData; +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 = UpdatePlanBundleResponse.Builder.class) +public final class UpdatePlanBundleResponse { + private final PlanBundleResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdatePlanBundleResponse( + PlanBundleResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanBundleResponseData 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 UpdatePlanBundleResponse && equalTo((UpdatePlanBundleResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlanBundleResponse 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 PlanBundleResponseData data); + + Builder from(UpdatePlanBundleResponse other); + } + + public interface _FinalStage { + UpdatePlanBundleResponse build(); + + /** + *

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PlanBundleResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePlanBundleResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanBundleResponseData 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 UpdatePlanBundleResponse build() { + return new UpdatePlanBundleResponse(data, params, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java index 8f9274c..e7eda28 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java @@ -16,12 +16,15 @@ import com.schematic.api.types.CustomPlanConfig; import com.schematic.api.types.OrderedPlansInGroup; import com.schematic.api.types.PlanGroupBundleOrder; +import com.schematic.api.types.ProrationBehavior; +import com.schematic.api.types.ScheduledDowngradeConfigBehavior; 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 = CreatePlanGroupRequestBody.Builder.class) @@ -56,13 +59,29 @@ public final class CreatePlanGroupRequestBody { private final boolean preventDowngradesWhenOverLimit; + private final boolean preventSelfServiceDowngrade; + + private final Optional preventSelfServiceDowngradeButtonText; + + private final Optional preventSelfServiceDowngradeUrl; + + private final ProrationBehavior prorationBehavior; + + private final Optional scheduledDowngradeBehavior; + + private final Optional scheduledDowngradePreventWhenOverLimit; + + private final boolean showAsMonthlyPrices; + private final boolean showCredits; + private final boolean showFeatureDescription; + private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; - private final boolean syncCustomerBillingDetailsForTax; + private final boolean syncCustomerBillingDetails; private final Optional trialDays; @@ -90,10 +109,18 @@ private CreatePlanGroupRequestBody( List orderedBundleList, List orderedPlans, boolean preventDowngradesWhenOverLimit, + boolean preventSelfServiceDowngrade, + Optional preventSelfServiceDowngradeButtonText, + Optional preventSelfServiceDowngradeUrl, + ProrationBehavior prorationBehavior, + Optional scheduledDowngradeBehavior, + Optional scheduledDowngradePreventWhenOverLimit, + boolean showAsMonthlyPrices, boolean showCredits, + boolean showFeatureDescription, boolean showPeriodToggle, boolean showZeroPriceAsFree, - boolean syncCustomerBillingDetailsForTax, + boolean syncCustomerBillingDetails, Optional trialDays, Optional trialExpiryPlanId, Optional trialExpiryPlanPriceId, @@ -114,10 +141,18 @@ private CreatePlanGroupRequestBody( this.orderedBundleList = orderedBundleList; this.orderedPlans = orderedPlans; this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.prorationBehavior = prorationBehavior; + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; + this.showFeatureDescription = showFeatureDescription; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + this.syncCustomerBillingDetails = syncCustomerBillingDetails; this.trialDays = trialDays; this.trialExpiryPlanId = trialExpiryPlanId; this.trialExpiryPlanPriceId = trialExpiryPlanPriceId; @@ -203,11 +238,51 @@ public boolean getPreventDowngradesWhenOverLimit() { return preventDowngradesWhenOverLimit; } + @JsonProperty("prevent_self_service_downgrade") + public boolean getPreventSelfServiceDowngrade() { + return preventSelfServiceDowngrade; + } + + @JsonProperty("prevent_self_service_downgrade_button_text") + public Optional getPreventSelfServiceDowngradeButtonText() { + return preventSelfServiceDowngradeButtonText; + } + + @JsonProperty("prevent_self_service_downgrade_url") + public Optional getPreventSelfServiceDowngradeUrl() { + return preventSelfServiceDowngradeUrl; + } + + @JsonProperty("proration_behavior") + public ProrationBehavior getProrationBehavior() { + return prorationBehavior; + } + + @JsonProperty("scheduled_downgrade_behavior") + public Optional getScheduledDowngradeBehavior() { + return scheduledDowngradeBehavior; + } + + @JsonProperty("scheduled_downgrade_prevent_when_over_limit") + public Optional getScheduledDowngradePreventWhenOverLimit() { + return scheduledDowngradePreventWhenOverLimit; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + @JsonProperty("show_credits") public boolean getShowCredits() { return showCredits; } + @JsonProperty("show_feature_description") + public boolean getShowFeatureDescription() { + return showFeatureDescription; + } + @JsonProperty("show_period_toggle") public boolean getShowPeriodToggle() { return showPeriodToggle; @@ -218,9 +293,9 @@ public boolean getShowZeroPriceAsFree() { return showZeroPriceAsFree; } - @JsonProperty("sync_customer_billing_details_for_tax") - public boolean getSyncCustomerBillingDetailsForTax() { - return syncCustomerBillingDetailsForTax; + @JsonProperty("sync_customer_billing_details") + public boolean getSyncCustomerBillingDetails() { + return syncCustomerBillingDetails; } @JsonProperty("trial_days") @@ -270,10 +345,18 @@ private boolean equalTo(CreatePlanGroupRequestBody other) { && orderedBundleList.equals(other.orderedBundleList) && orderedPlans.equals(other.orderedPlans) && preventDowngradesWhenOverLimit == other.preventDowngradesWhenOverLimit + && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade + && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) + && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && prorationBehavior.equals(other.prorationBehavior) + && scheduledDowngradeBehavior.equals(other.scheduledDowngradeBehavior) + && scheduledDowngradePreventWhenOverLimit.equals(other.scheduledDowngradePreventWhenOverLimit) + && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits + && showFeatureDescription == other.showFeatureDescription && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree - && syncCustomerBillingDetailsForTax == other.syncCustomerBillingDetailsForTax + && syncCustomerBillingDetails == other.syncCustomerBillingDetails && trialDays.equals(other.trialDays) && trialExpiryPlanId.equals(other.trialExpiryPlanId) && trialExpiryPlanPriceId.equals(other.trialExpiryPlanPriceId) @@ -298,10 +381,18 @@ public int hashCode() { this.orderedBundleList, this.orderedPlans, this.preventDowngradesWhenOverLimit, + this.preventSelfServiceDowngrade, + this.preventSelfServiceDowngradeButtonText, + this.preventSelfServiceDowngradeUrl, + this.prorationBehavior, + this.scheduledDowngradeBehavior, + this.scheduledDowngradePreventWhenOverLimit, + this.showAsMonthlyPrices, this.showCredits, + this.showFeatureDescription, this.showPeriodToggle, this.showZeroPriceAsFree, - this.syncCustomerBillingDetailsForTax, + this.syncCustomerBillingDetails, this.trialDays, this.trialExpiryPlanId, this.trialExpiryPlanPriceId, @@ -336,11 +427,27 @@ public interface EnableTaxCollectionStage { } public interface PreventDowngradesWhenOverLimitStage { - ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + } + + public interface PreventSelfServiceDowngradeStage { + ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade); + } + + public interface ProrationBehaviorStage { + ShowAsMonthlyPricesStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); } public interface ShowCreditsStage { - ShowPeriodToggleStage showCredits(boolean showCredits); + ShowFeatureDescriptionStage showCredits(boolean showCredits); + } + + public interface ShowFeatureDescriptionStage { + ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); } public interface ShowPeriodToggleStage { @@ -348,11 +455,11 @@ public interface ShowPeriodToggleStage { } public interface ShowZeroPriceAsFreeStage { - SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree); } - public interface SyncCustomerBillingDetailsForTaxStage { - _FinalStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax); + public interface SyncCustomerBillingDetailsStage { + _FinalStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails); } public interface _FinalStage { @@ -409,6 +516,22 @@ public interface _FinalStage { _FinalStage addAllOrderedPlans(List orderedPlans); + _FinalStage preventSelfServiceDowngradeButtonText(Optional preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl); + + _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + + _FinalStage scheduledDowngradeBehavior(Optional scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradeBehavior(ScheduledDowngradeConfigBehavior scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Optional scheduledDowngradePreventWhenOverLimit); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); + _FinalStage trialDays(Optional trialDays); _FinalStage trialDays(Integer trialDays); @@ -433,10 +556,14 @@ public static final class Builder CheckoutCollectPhoneStage, EnableTaxCollectionStage, PreventDowngradesWhenOverLimitStage, + PreventSelfServiceDowngradeStage, + ProrationBehaviorStage, + ShowAsMonthlyPricesStage, ShowCreditsStage, + ShowFeatureDescriptionStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, - SyncCustomerBillingDetailsForTaxStage, + SyncCustomerBillingDetailsStage, _FinalStage { private boolean checkoutCollectAddress; @@ -448,13 +575,21 @@ public static final class Builder private boolean preventDowngradesWhenOverLimit; + private boolean preventSelfServiceDowngrade; + + private ProrationBehavior prorationBehavior; + + private boolean showAsMonthlyPrices; + private boolean showCredits; + private boolean showFeatureDescription; + private boolean showPeriodToggle; private boolean showZeroPriceAsFree; - private boolean syncCustomerBillingDetailsForTax; + private boolean syncCustomerBillingDetails; private Optional trialPaymentMethodRequired = Optional.empty(); @@ -464,6 +599,14 @@ public static final class Builder private Optional trialDays = Optional.empty(); + private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); + + private Optional scheduledDowngradeBehavior = Optional.empty(); + + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); + + private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); + private List orderedPlans = new ArrayList<>(); private List orderedBundleList = new ArrayList<>(); @@ -506,10 +649,18 @@ public Builder from(CreatePlanGroupRequestBody other) { orderedBundleList(other.getOrderedBundleList()); orderedPlans(other.getOrderedPlans()); preventDowngradesWhenOverLimit(other.getPreventDowngradesWhenOverLimit()); + preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); + preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); + preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + prorationBehavior(other.getProrationBehavior()); + scheduledDowngradeBehavior(other.getScheduledDowngradeBehavior()); + scheduledDowngradePreventWhenOverLimit(other.getScheduledDowngradePreventWhenOverLimit()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); + showFeatureDescription(other.getShowFeatureDescription()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); - syncCustomerBillingDetailsForTax(other.getSyncCustomerBillingDetailsForTax()); + syncCustomerBillingDetails(other.getSyncCustomerBillingDetails()); trialDays(other.getTrialDays()); trialExpiryPlanId(other.getTrialExpiryPlanId()); trialExpiryPlanPriceId(other.getTrialExpiryPlanPriceId()); @@ -547,18 +698,46 @@ public PreventDowngradesWhenOverLimitStage enableTaxCollection(boolean enableTax @java.lang.Override @JsonSetter("prevent_downgrades_when_over_limit") - public ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { + public PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; return this; } + @java.lang.Override + @JsonSetter("prevent_self_service_downgrade") + public ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade) { + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + return this; + } + + @java.lang.Override + @JsonSetter("proration_behavior") + public ShowAsMonthlyPricesStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior) { + this.prorationBehavior = Objects.requireNonNull(prorationBehavior, "prorationBehavior must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + @java.lang.Override @JsonSetter("show_credits") - public ShowPeriodToggleStage showCredits(boolean showCredits) { + public ShowFeatureDescriptionStage showCredits(boolean showCredits) { this.showCredits = showCredits; return this; } + @java.lang.Override + @JsonSetter("show_feature_description") + public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + this.showFeatureDescription = showFeatureDescription; + return this; + } + @java.lang.Override @JsonSetter("show_period_toggle") public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @@ -568,15 +747,15 @@ public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @java.lang.Override @JsonSetter("show_zero_price_as_free") - public SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { + public SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { this.showZeroPriceAsFree = showZeroPriceAsFree; return this; } @java.lang.Override - @JsonSetter("sync_customer_billing_details_for_tax") - public _FinalStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax) { - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + @JsonSetter("sync_customer_billing_details") + public _FinalStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails) { + this.syncCustomerBillingDetails = syncCustomerBillingDetails; return this; } @@ -632,6 +811,61 @@ public _FinalStage trialDays(Optional trialDays) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = Optional.ofNullable(scheduledDowngradePreventWhenOverLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_prevent_when_over_limit", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradePreventWhenOverLimit( + Optional scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + return this; + } + + @java.lang.Override + public _FinalStage scheduledDowngradeBehavior(ScheduledDowngradeConfigBehavior scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = Optional.ofNullable(scheduledDowngradeBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_behavior", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradeBehavior( + Optional scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_url", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = Optional.ofNullable(preventSelfServiceDowngradeButtonText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_button_text", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeButtonText( + Optional preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + return this; + } + @java.lang.Override public _FinalStage addAllOrderedPlans(List orderedPlans) { if (orderedPlans != null) { @@ -835,10 +1069,18 @@ public CreatePlanGroupRequestBody build() { orderedBundleList, orderedPlans, preventDowngradesWhenOverLimit, + preventSelfServiceDowngrade, + preventSelfServiceDowngradeButtonText, + preventSelfServiceDowngradeUrl, + prorationBehavior, + scheduledDowngradeBehavior, + scheduledDowngradePreventWhenOverLimit, + showAsMonthlyPrices, showCredits, + showFeatureDescription, showPeriodToggle, showZeroPriceAsFree, - syncCustomerBillingDetailsForTax, + syncCustomerBillingDetails, trialDays, trialExpiryPlanId, trialExpiryPlanPriceId, diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java index f12c5d4..e698da9 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java @@ -16,12 +16,15 @@ import com.schematic.api.types.CustomPlanConfig; import com.schematic.api.types.OrderedPlansInGroup; import com.schematic.api.types.PlanGroupBundleOrder; +import com.schematic.api.types.ProrationBehavior; +import com.schematic.api.types.ScheduledDowngradeConfigBehavior; 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 = UpdatePlanGroupRequestBody.Builder.class) @@ -56,13 +59,29 @@ public final class UpdatePlanGroupRequestBody { private final boolean preventDowngradesWhenOverLimit; + private final boolean preventSelfServiceDowngrade; + + private final Optional preventSelfServiceDowngradeButtonText; + + private final Optional preventSelfServiceDowngradeUrl; + + private final ProrationBehavior prorationBehavior; + + private final Optional scheduledDowngradeBehavior; + + private final Optional scheduledDowngradePreventWhenOverLimit; + + private final boolean showAsMonthlyPrices; + private final boolean showCredits; + private final boolean showFeatureDescription; + private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; - private final boolean syncCustomerBillingDetailsForTax; + private final boolean syncCustomerBillingDetails; private final Optional trialDays; @@ -90,10 +109,18 @@ private UpdatePlanGroupRequestBody( List orderedBundleList, List orderedPlans, boolean preventDowngradesWhenOverLimit, + boolean preventSelfServiceDowngrade, + Optional preventSelfServiceDowngradeButtonText, + Optional preventSelfServiceDowngradeUrl, + ProrationBehavior prorationBehavior, + Optional scheduledDowngradeBehavior, + Optional scheduledDowngradePreventWhenOverLimit, + boolean showAsMonthlyPrices, boolean showCredits, + boolean showFeatureDescription, boolean showPeriodToggle, boolean showZeroPriceAsFree, - boolean syncCustomerBillingDetailsForTax, + boolean syncCustomerBillingDetails, Optional trialDays, Optional trialExpiryPlanId, Optional trialExpiryPlanPriceId, @@ -114,10 +141,18 @@ private UpdatePlanGroupRequestBody( this.orderedBundleList = orderedBundleList; this.orderedPlans = orderedPlans; this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.prorationBehavior = prorationBehavior; + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; + this.showFeatureDescription = showFeatureDescription; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + this.syncCustomerBillingDetails = syncCustomerBillingDetails; this.trialDays = trialDays; this.trialExpiryPlanId = trialExpiryPlanId; this.trialExpiryPlanPriceId = trialExpiryPlanPriceId; @@ -203,11 +238,51 @@ public boolean getPreventDowngradesWhenOverLimit() { return preventDowngradesWhenOverLimit; } + @JsonProperty("prevent_self_service_downgrade") + public boolean getPreventSelfServiceDowngrade() { + return preventSelfServiceDowngrade; + } + + @JsonProperty("prevent_self_service_downgrade_button_text") + public Optional getPreventSelfServiceDowngradeButtonText() { + return preventSelfServiceDowngradeButtonText; + } + + @JsonProperty("prevent_self_service_downgrade_url") + public Optional getPreventSelfServiceDowngradeUrl() { + return preventSelfServiceDowngradeUrl; + } + + @JsonProperty("proration_behavior") + public ProrationBehavior getProrationBehavior() { + return prorationBehavior; + } + + @JsonProperty("scheduled_downgrade_behavior") + public Optional getScheduledDowngradeBehavior() { + return scheduledDowngradeBehavior; + } + + @JsonProperty("scheduled_downgrade_prevent_when_over_limit") + public Optional getScheduledDowngradePreventWhenOverLimit() { + return scheduledDowngradePreventWhenOverLimit; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + @JsonProperty("show_credits") public boolean getShowCredits() { return showCredits; } + @JsonProperty("show_feature_description") + public boolean getShowFeatureDescription() { + return showFeatureDescription; + } + @JsonProperty("show_period_toggle") public boolean getShowPeriodToggle() { return showPeriodToggle; @@ -218,9 +293,9 @@ public boolean getShowZeroPriceAsFree() { return showZeroPriceAsFree; } - @JsonProperty("sync_customer_billing_details_for_tax") - public boolean getSyncCustomerBillingDetailsForTax() { - return syncCustomerBillingDetailsForTax; + @JsonProperty("sync_customer_billing_details") + public boolean getSyncCustomerBillingDetails() { + return syncCustomerBillingDetails; } @JsonProperty("trial_days") @@ -270,10 +345,18 @@ private boolean equalTo(UpdatePlanGroupRequestBody other) { && orderedBundleList.equals(other.orderedBundleList) && orderedPlans.equals(other.orderedPlans) && preventDowngradesWhenOverLimit == other.preventDowngradesWhenOverLimit + && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade + && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) + && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && prorationBehavior.equals(other.prorationBehavior) + && scheduledDowngradeBehavior.equals(other.scheduledDowngradeBehavior) + && scheduledDowngradePreventWhenOverLimit.equals(other.scheduledDowngradePreventWhenOverLimit) + && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits + && showFeatureDescription == other.showFeatureDescription && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree - && syncCustomerBillingDetailsForTax == other.syncCustomerBillingDetailsForTax + && syncCustomerBillingDetails == other.syncCustomerBillingDetails && trialDays.equals(other.trialDays) && trialExpiryPlanId.equals(other.trialExpiryPlanId) && trialExpiryPlanPriceId.equals(other.trialExpiryPlanPriceId) @@ -298,10 +381,18 @@ public int hashCode() { this.orderedBundleList, this.orderedPlans, this.preventDowngradesWhenOverLimit, + this.preventSelfServiceDowngrade, + this.preventSelfServiceDowngradeButtonText, + this.preventSelfServiceDowngradeUrl, + this.prorationBehavior, + this.scheduledDowngradeBehavior, + this.scheduledDowngradePreventWhenOverLimit, + this.showAsMonthlyPrices, this.showCredits, + this.showFeatureDescription, this.showPeriodToggle, this.showZeroPriceAsFree, - this.syncCustomerBillingDetailsForTax, + this.syncCustomerBillingDetails, this.trialDays, this.trialExpiryPlanId, this.trialExpiryPlanPriceId, @@ -336,11 +427,27 @@ public interface EnableTaxCollectionStage { } public interface PreventDowngradesWhenOverLimitStage { - ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + } + + public interface PreventSelfServiceDowngradeStage { + ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade); + } + + public interface ProrationBehaviorStage { + ShowAsMonthlyPricesStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); } public interface ShowCreditsStage { - ShowPeriodToggleStage showCredits(boolean showCredits); + ShowFeatureDescriptionStage showCredits(boolean showCredits); + } + + public interface ShowFeatureDescriptionStage { + ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); } public interface ShowPeriodToggleStage { @@ -348,11 +455,11 @@ public interface ShowPeriodToggleStage { } public interface ShowZeroPriceAsFreeStage { - SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree); } - public interface SyncCustomerBillingDetailsForTaxStage { - _FinalStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax); + public interface SyncCustomerBillingDetailsStage { + _FinalStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails); } public interface _FinalStage { @@ -409,6 +516,22 @@ public interface _FinalStage { _FinalStage addAllOrderedPlans(List orderedPlans); + _FinalStage preventSelfServiceDowngradeButtonText(Optional preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl); + + _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + + _FinalStage scheduledDowngradeBehavior(Optional scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradeBehavior(ScheduledDowngradeConfigBehavior scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Optional scheduledDowngradePreventWhenOverLimit); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); + _FinalStage trialDays(Optional trialDays); _FinalStage trialDays(Integer trialDays); @@ -433,10 +556,14 @@ public static final class Builder CheckoutCollectPhoneStage, EnableTaxCollectionStage, PreventDowngradesWhenOverLimitStage, + PreventSelfServiceDowngradeStage, + ProrationBehaviorStage, + ShowAsMonthlyPricesStage, ShowCreditsStage, + ShowFeatureDescriptionStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, - SyncCustomerBillingDetailsForTaxStage, + SyncCustomerBillingDetailsStage, _FinalStage { private boolean checkoutCollectAddress; @@ -448,13 +575,21 @@ public static final class Builder private boolean preventDowngradesWhenOverLimit; + private boolean preventSelfServiceDowngrade; + + private ProrationBehavior prorationBehavior; + + private boolean showAsMonthlyPrices; + private boolean showCredits; + private boolean showFeatureDescription; + private boolean showPeriodToggle; private boolean showZeroPriceAsFree; - private boolean syncCustomerBillingDetailsForTax; + private boolean syncCustomerBillingDetails; private Optional trialPaymentMethodRequired = Optional.empty(); @@ -464,6 +599,14 @@ public static final class Builder private Optional trialDays = Optional.empty(); + private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); + + private Optional scheduledDowngradeBehavior = Optional.empty(); + + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); + + private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); + private List orderedPlans = new ArrayList<>(); private List orderedBundleList = new ArrayList<>(); @@ -506,10 +649,18 @@ public Builder from(UpdatePlanGroupRequestBody other) { orderedBundleList(other.getOrderedBundleList()); orderedPlans(other.getOrderedPlans()); preventDowngradesWhenOverLimit(other.getPreventDowngradesWhenOverLimit()); + preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); + preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); + preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + prorationBehavior(other.getProrationBehavior()); + scheduledDowngradeBehavior(other.getScheduledDowngradeBehavior()); + scheduledDowngradePreventWhenOverLimit(other.getScheduledDowngradePreventWhenOverLimit()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); + showFeatureDescription(other.getShowFeatureDescription()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); - syncCustomerBillingDetailsForTax(other.getSyncCustomerBillingDetailsForTax()); + syncCustomerBillingDetails(other.getSyncCustomerBillingDetails()); trialDays(other.getTrialDays()); trialExpiryPlanId(other.getTrialExpiryPlanId()); trialExpiryPlanPriceId(other.getTrialExpiryPlanPriceId()); @@ -547,18 +698,46 @@ public PreventDowngradesWhenOverLimitStage enableTaxCollection(boolean enableTax @java.lang.Override @JsonSetter("prevent_downgrades_when_over_limit") - public ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { + public PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; return this; } + @java.lang.Override + @JsonSetter("prevent_self_service_downgrade") + public ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade) { + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + return this; + } + + @java.lang.Override + @JsonSetter("proration_behavior") + public ShowAsMonthlyPricesStage prorationBehavior(@NotNull ProrationBehavior prorationBehavior) { + this.prorationBehavior = Objects.requireNonNull(prorationBehavior, "prorationBehavior must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + @java.lang.Override @JsonSetter("show_credits") - public ShowPeriodToggleStage showCredits(boolean showCredits) { + public ShowFeatureDescriptionStage showCredits(boolean showCredits) { this.showCredits = showCredits; return this; } + @java.lang.Override + @JsonSetter("show_feature_description") + public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + this.showFeatureDescription = showFeatureDescription; + return this; + } + @java.lang.Override @JsonSetter("show_period_toggle") public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @@ -568,15 +747,15 @@ public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @java.lang.Override @JsonSetter("show_zero_price_as_free") - public SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { + public SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { this.showZeroPriceAsFree = showZeroPriceAsFree; return this; } @java.lang.Override - @JsonSetter("sync_customer_billing_details_for_tax") - public _FinalStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax) { - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + @JsonSetter("sync_customer_billing_details") + public _FinalStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails) { + this.syncCustomerBillingDetails = syncCustomerBillingDetails; return this; } @@ -632,6 +811,61 @@ public _FinalStage trialDays(Optional trialDays) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = Optional.ofNullable(scheduledDowngradePreventWhenOverLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_prevent_when_over_limit", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradePreventWhenOverLimit( + Optional scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + return this; + } + + @java.lang.Override + public _FinalStage scheduledDowngradeBehavior(ScheduledDowngradeConfigBehavior scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = Optional.ofNullable(scheduledDowngradeBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_behavior", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradeBehavior( + Optional scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_url", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = Optional.ofNullable(preventSelfServiceDowngradeButtonText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_button_text", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeButtonText( + Optional preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + return this; + } + @java.lang.Override public _FinalStage addAllOrderedPlans(List orderedPlans) { if (orderedPlans != null) { @@ -835,10 +1069,18 @@ public UpdatePlanGroupRequestBody build() { orderedBundleList, orderedPlans, preventDowngradesWhenOverLimit, + preventSelfServiceDowngrade, + preventSelfServiceDowngradeButtonText, + preventSelfServiceDowngradeUrl, + prorationBehavior, + scheduledDowngradeBehavior, + scheduledDowngradePreventWhenOverLimit, + showAsMonthlyPrices, showCredits, + showFeatureDescription, showPeriodToggle, showZeroPriceAsFree, - syncCustomerBillingDetailsForTax, + syncCustomerBillingDetails, trialDays, trialExpiryPlanId, trialExpiryPlanPriceId, 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 ec163a0..b887d3f 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java @@ -6,12 +6,9 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.plans.requests.CountPlansRequest; -import com.schematic.api.resources.plans.requests.CreatePlanRequestBody; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; -import com.schematic.api.resources.plans.requests.UpdatePlanRequestBody; -import com.schematic.api.resources.plans.requests.UpsertBillingProductRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; @@ -21,6 +18,9 @@ import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; +import com.schematic.api.types.CreatePlanRequestBody; +import com.schematic.api.types.UpdatePlanRequestBody; +import com.schematic.api.types.UpsertBillingProductRequestBody; import java.util.concurrent.CompletableFuture; public class AsyncPlansClient { 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 f5b363d..b666d4a 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java @@ -18,12 +18,9 @@ import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.plans.requests.CountPlansRequest; -import com.schematic.api.resources.plans.requests.CreatePlanRequestBody; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; -import com.schematic.api.resources.plans.requests.UpdatePlanRequestBody; -import com.schematic.api.resources.plans.requests.UpsertBillingProductRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; @@ -34,6 +31,9 @@ import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; import com.schematic.api.types.ApiError; +import com.schematic.api.types.CreatePlanRequestBody; +import com.schematic.api.types.UpdatePlanRequestBody; +import com.schematic.api.types.UpsertBillingProductRequestBody; import java.io.IOException; import java.util.concurrent.CompletableFuture; import okhttp3.Call; @@ -190,13 +190,6 @@ public CompletableFuture> listPlans if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } - if (request.getRequiresPaymentMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "requires_payment_method", - request.getRequiresPaymentMethod().get(), - false); - } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -204,10 +197,6 @@ public CompletableFuture> listPlans request.getWithoutEntitlementFor().get(), false); } - if (request.getWithoutProductId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_product_id", request.getWithoutProductId().get(), false); - } if (request.getWithoutPaidProductId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -779,13 +768,6 @@ public CompletableFuture> countPla if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } - if (request.getRequiresPaymentMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "requires_payment_method", - request.getRequiresPaymentMethod().get(), - false); - } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -793,10 +775,6 @@ public CompletableFuture> countPla request.getWithoutEntitlementFor().get(), false); } - if (request.getWithoutProductId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_product_id", request.getWithoutProductId().get(), false); - } if (request.getWithoutPaidProductId().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 7754c68..b655e81 100644 --- a/src/main/java/com/schematic/api/resources/plans/PlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/PlansClient.java @@ -6,12 +6,9 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.plans.requests.CountPlansRequest; -import com.schematic.api.resources.plans.requests.CreatePlanRequestBody; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; -import com.schematic.api.resources.plans.requests.UpdatePlanRequestBody; -import com.schematic.api.resources.plans.requests.UpsertBillingProductRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; @@ -21,6 +18,9 @@ import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; +import com.schematic.api.types.CreatePlanRequestBody; +import com.schematic.api.types.UpdatePlanRequestBody; +import com.schematic.api.types.UpsertBillingProductRequestBody; public class PlansClient { protected final ClientOptions clientOptions; 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 a9aee7a..e4c99cd 100644 --- a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java @@ -18,12 +18,9 @@ import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.plans.requests.CountPlansRequest; -import com.schematic.api.resources.plans.requests.CreatePlanRequestBody; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; -import com.schematic.api.resources.plans.requests.UpdatePlanRequestBody; -import com.schematic.api.resources.plans.requests.UpsertBillingProductRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; @@ -34,6 +31,9 @@ import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; import com.schematic.api.types.ApiError; +import com.schematic.api.types.CreatePlanRequestBody; +import com.schematic.api.types.UpdatePlanRequestBody; +import com.schematic.api.types.UpsertBillingProductRequestBody; import java.io.IOException; import okhttp3.Headers; import okhttp3.HttpUrl; @@ -162,13 +162,6 @@ public BaseSchematicHttpResponse listPlans( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } - if (request.getRequiresPaymentMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "requires_payment_method", - request.getRequiresPaymentMethod().get(), - false); - } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -176,10 +169,6 @@ public BaseSchematicHttpResponse listPlans( request.getWithoutEntitlementFor().get(), false); } - if (request.getWithoutProductId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_product_id", request.getWithoutProductId().get(), false); - } if (request.getWithoutPaidProductId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -606,13 +595,6 @@ public BaseSchematicHttpResponse countPlans( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } - if (request.getRequiresPaymentMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "requires_payment_method", - request.getRequiresPaymentMethod().get(), - false); - } if (request.getWithoutEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -620,10 +602,6 @@ public BaseSchematicHttpResponse countPlans( request.getWithoutEntitlementFor().get(), false); } - if (request.getWithoutProductId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_product_id", request.getWithoutProductId().get(), false); - } if (request.getWithoutPaidProductId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, 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 0700ace..2b89290 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 @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.plans.types.CountPlansRequestPlanType; +import com.schematic.api.types.PlanType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,16 +35,12 @@ public final class CountPlansRequest { private final Optional hasProductId; - private final Optional planType; + private final Optional planType; private final Optional q; - private final Optional requiresPaymentMethod; - private final Optional withoutEntitlementFor; - private final Optional withoutProductId; - private final Optional withoutPaidProductId; private final Optional limit; @@ -60,11 +56,9 @@ private CountPlansRequest( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional hasProductId, - Optional planType, + Optional planType, Optional q, - Optional requiresPaymentMethod, Optional withoutEntitlementFor, - Optional withoutProductId, Optional withoutPaidProductId, Optional limit, Optional offset, @@ -77,9 +71,7 @@ private CountPlansRequest( this.hasProductId = hasProductId; this.planType = planType; this.q = q; - this.requiresPaymentMethod = requiresPaymentMethod; this.withoutEntitlementFor = withoutEntitlementFor; - this.withoutProductId = withoutProductId; this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; this.offset = offset; @@ -132,7 +124,7 @@ public Optional getHasProductId() { * @return Filter by plan type */ @JsonProperty("plan_type") - public Optional getPlanType() { + public Optional getPlanType() { return planType; } @@ -141,14 +133,6 @@ public Optional getQ() { return q; } - /** - * @return Filter for plans that require a payment method (inverse of ForInitialPlan) - */ - @JsonProperty("requires_payment_method") - public Optional getRequiresPaymentMethod() { - return requiresPaymentMethod; - } - /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -157,14 +141,6 @@ public Optional getWithoutEntitlementFor() { return withoutEntitlementFor; } - /** - * @return Filter out plans that have a billing product ID - */ - @JsonProperty("without_product_id") - public Optional getWithoutProductId() { - return withoutProductId; - } - /** * @return Filter out plans that have a paid billing product ID */ @@ -209,9 +185,7 @@ private boolean equalTo(CountPlansRequest other) { && hasProductId.equals(other.hasProductId) && planType.equals(other.planType) && q.equals(other.q) - && requiresPaymentMethod.equals(other.requiresPaymentMethod) && withoutEntitlementFor.equals(other.withoutEntitlementFor) - && withoutProductId.equals(other.withoutProductId) && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) && offset.equals(other.offset); @@ -228,9 +202,7 @@ public int hashCode() { this.hasProductId, this.planType, this.q, - this.requiresPaymentMethod, this.withoutEntitlementFor, - this.withoutProductId, this.withoutPaidProductId, this.limit, this.offset); @@ -259,16 +231,12 @@ public static final class Builder { private Optional hasProductId = Optional.empty(); - private Optional planType = Optional.empty(); + private Optional planType = Optional.empty(); private Optional q = Optional.empty(); - private Optional requiresPaymentMethod = Optional.empty(); - private Optional withoutEntitlementFor = Optional.empty(); - private Optional withoutProductId = Optional.empty(); - private Optional withoutPaidProductId = Optional.empty(); private Optional limit = Optional.empty(); @@ -289,9 +257,7 @@ public Builder from(CountPlansRequest other) { hasProductId(other.getHasProductId()); planType(other.getPlanType()); q(other.getQ()); - requiresPaymentMethod(other.getRequiresPaymentMethod()); withoutEntitlementFor(other.getWithoutEntitlementFor()); - withoutProductId(other.getWithoutProductId()); withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); offset(other.getOffset()); @@ -385,12 +351,12 @@ public Builder hasProductId(Boolean hasProductId) { *

Filter by plan type

*/ @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) - public Builder planType(Optional planType) { + public Builder planType(Optional planType) { this.planType = planType; return this; } - public Builder planType(CountPlansRequestPlanType planType) { + public Builder planType(PlanType planType) { this.planType = Optional.ofNullable(planType); return this; } @@ -406,20 +372,6 @@ public Builder q(String q) { return this; } - /** - *

Filter for plans that require a payment method (inverse of ForInitialPlan)

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

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

*/ @@ -434,20 +386,6 @@ public Builder withoutEntitlementFor(String withoutEntitlementFor) { return this; } - /** - *

Filter out plans that have a billing product ID

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

Filter out plans that have a paid billing product ID

*/ @@ -500,9 +438,7 @@ public CountPlansRequest build() { hasProductId, planType, q, - requiresPaymentMethod, withoutEntitlementFor, - withoutProductId, withoutPaidProductId, limit, offset, 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 59b1d53..3844b38 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 @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.plans.types.ListPlansRequestPlanType; +import com.schematic.api.types.PlanType; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,16 +35,12 @@ public final class ListPlansRequest { private final Optional hasProductId; - private final Optional planType; + private final Optional planType; private final Optional q; - private final Optional requiresPaymentMethod; - private final Optional withoutEntitlementFor; - private final Optional withoutProductId; - private final Optional withoutPaidProductId; private final Optional limit; @@ -60,11 +56,9 @@ private ListPlansRequest( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional hasProductId, - Optional planType, + Optional planType, Optional q, - Optional requiresPaymentMethod, Optional withoutEntitlementFor, - Optional withoutProductId, Optional withoutPaidProductId, Optional limit, Optional offset, @@ -77,9 +71,7 @@ private ListPlansRequest( this.hasProductId = hasProductId; this.planType = planType; this.q = q; - this.requiresPaymentMethod = requiresPaymentMethod; this.withoutEntitlementFor = withoutEntitlementFor; - this.withoutProductId = withoutProductId; this.withoutPaidProductId = withoutPaidProductId; this.limit = limit; this.offset = offset; @@ -132,7 +124,7 @@ public Optional getHasProductId() { * @return Filter by plan type */ @JsonProperty("plan_type") - public Optional getPlanType() { + public Optional getPlanType() { return planType; } @@ -141,14 +133,6 @@ public Optional getQ() { return q; } - /** - * @return Filter for plans that require a payment method (inverse of ForInitialPlan) - */ - @JsonProperty("requires_payment_method") - public Optional getRequiresPaymentMethod() { - return requiresPaymentMethod; - } - /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -157,14 +141,6 @@ public Optional getWithoutEntitlementFor() { return withoutEntitlementFor; } - /** - * @return Filter out plans that have a billing product ID - */ - @JsonProperty("without_product_id") - public Optional getWithoutProductId() { - return withoutProductId; - } - /** * @return Filter out plans that have a paid billing product ID */ @@ -209,9 +185,7 @@ private boolean equalTo(ListPlansRequest other) { && hasProductId.equals(other.hasProductId) && planType.equals(other.planType) && q.equals(other.q) - && requiresPaymentMethod.equals(other.requiresPaymentMethod) && withoutEntitlementFor.equals(other.withoutEntitlementFor) - && withoutProductId.equals(other.withoutProductId) && withoutPaidProductId.equals(other.withoutPaidProductId) && limit.equals(other.limit) && offset.equals(other.offset); @@ -228,9 +202,7 @@ public int hashCode() { this.hasProductId, this.planType, this.q, - this.requiresPaymentMethod, this.withoutEntitlementFor, - this.withoutProductId, this.withoutPaidProductId, this.limit, this.offset); @@ -259,16 +231,12 @@ public static final class Builder { private Optional hasProductId = Optional.empty(); - private Optional planType = Optional.empty(); + private Optional planType = Optional.empty(); private Optional q = Optional.empty(); - private Optional requiresPaymentMethod = Optional.empty(); - private Optional withoutEntitlementFor = Optional.empty(); - private Optional withoutProductId = Optional.empty(); - private Optional withoutPaidProductId = Optional.empty(); private Optional limit = Optional.empty(); @@ -289,9 +257,7 @@ public Builder from(ListPlansRequest other) { hasProductId(other.getHasProductId()); planType(other.getPlanType()); q(other.getQ()); - requiresPaymentMethod(other.getRequiresPaymentMethod()); withoutEntitlementFor(other.getWithoutEntitlementFor()); - withoutProductId(other.getWithoutProductId()); withoutPaidProductId(other.getWithoutPaidProductId()); limit(other.getLimit()); offset(other.getOffset()); @@ -385,12 +351,12 @@ public Builder hasProductId(Boolean hasProductId) { *

Filter by plan type

*/ @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) - public Builder planType(Optional planType) { + public Builder planType(Optional planType) { this.planType = planType; return this; } - public Builder planType(ListPlansRequestPlanType planType) { + public Builder planType(PlanType planType) { this.planType = Optional.ofNullable(planType); return this; } @@ -406,20 +372,6 @@ public Builder q(String q) { return this; } - /** - *

Filter for plans that require a payment method (inverse of ForInitialPlan)

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

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

*/ @@ -434,20 +386,6 @@ public Builder withoutEntitlementFor(String withoutEntitlementFor) { return this; } - /** - *

Filter out plans that have a billing product ID

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

Filter out plans that have a paid billing product ID

*/ @@ -500,9 +438,7 @@ public ListPlansRequest build() { hasProductId, planType, q, - requiresPaymentMethod, withoutEntitlementFor, - withoutProductId, withoutPaidProductId, limit, offset, 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 2995339..d5dc4dc 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 @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,18 +38,14 @@ public final class CountPlansParams { private final Optional offset; - private final Optional planType; + private final Optional planType; private final Optional q; - private final Optional requiresPaymentMethod; - private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; - private final Optional withoutProductId; - private final Map additionalProperties; private CountPlansParams( @@ -60,12 +57,10 @@ private CountPlansParams( Optional> ids, Optional limit, Optional offset, - Optional planType, + Optional planType, Optional q, - Optional requiresPaymentMethod, Optional withoutEntitlementFor, Optional withoutPaidProductId, - Optional withoutProductId, Map additionalProperties) { this.companyId = companyId; this.forFallbackPlan = forFallbackPlan; @@ -77,10 +72,8 @@ private CountPlansParams( this.offset = offset; this.planType = planType; this.q = q; - this.requiresPaymentMethod = requiresPaymentMethod; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; - this.withoutProductId = withoutProductId; this.additionalProperties = additionalProperties; } @@ -142,11 +135,8 @@ public Optional getOffset() { return offset; } - /** - * @return Filter by plan type - */ @JsonProperty("plan_type") - public Optional getPlanType() { + public Optional getPlanType() { return planType; } @@ -155,14 +145,6 @@ public Optional getQ() { return q; } - /** - * @return Filter for plans that require a payment method (inverse of ForInitialPlan) - */ - @JsonProperty("requires_payment_method") - public Optional getRequiresPaymentMethod() { - return requiresPaymentMethod; - } - /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -179,14 +161,6 @@ public Optional getWithoutPaidProductId() { return withoutPaidProductId; } - /** - * @return Filter out plans that have a billing product ID - */ - @JsonProperty("without_product_id") - public Optional getWithoutProductId() { - return withoutProductId; - } - @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -209,10 +183,8 @@ private boolean equalTo(CountPlansParams other) { && offset.equals(other.offset) && planType.equals(other.planType) && q.equals(other.q) - && requiresPaymentMethod.equals(other.requiresPaymentMethod) && withoutEntitlementFor.equals(other.withoutEntitlementFor) - && withoutPaidProductId.equals(other.withoutPaidProductId) - && withoutProductId.equals(other.withoutProductId); + && withoutPaidProductId.equals(other.withoutPaidProductId); } @java.lang.Override @@ -228,10 +200,8 @@ public int hashCode() { this.offset, this.planType, this.q, - this.requiresPaymentMethod, this.withoutEntitlementFor, - this.withoutPaidProductId, - this.withoutProductId); + this.withoutPaidProductId); } @java.lang.Override @@ -261,18 +231,14 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional planType = Optional.empty(); + private Optional planType = Optional.empty(); private Optional q = Optional.empty(); - private Optional requiresPaymentMethod = Optional.empty(); - private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); - private Optional withoutProductId = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -289,10 +255,8 @@ public Builder from(CountPlansParams other) { offset(other.getOffset()); planType(other.getPlanType()); q(other.getQ()); - requiresPaymentMethod(other.getRequiresPaymentMethod()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); - withoutProductId(other.getWithoutProductId()); return this; } @@ -402,16 +366,13 @@ public Builder offset(Integer offset) { return this; } - /** - *

Filter by plan type

- */ @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) - public Builder planType(Optional planType) { + public Builder planType(Optional planType) { this.planType = planType; return this; } - public Builder planType(CountPlansResponseParamsPlanType planType) { + public Builder planType(PlanType planType) { this.planType = Optional.ofNullable(planType); return this; } @@ -427,20 +388,6 @@ public Builder q(String q) { return this; } - /** - *

Filter for plans that require a payment method (inverse of ForInitialPlan)

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

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

*/ @@ -469,20 +416,6 @@ public Builder withoutPaidProductId(Boolean withoutPaidProductId) { return this; } - /** - *

Filter out plans that have a billing product ID

- */ - @JsonSetter(value = "without_product_id", nulls = Nulls.SKIP) - public Builder withoutProductId(Optional withoutProductId) { - this.withoutProductId = withoutProductId; - return this; - } - - public Builder withoutProductId(Boolean withoutProductId) { - this.withoutProductId = Optional.ofNullable(withoutProductId); - return this; - } - public CountPlansParams build() { return new CountPlansParams( companyId, @@ -495,10 +428,8 @@ public CountPlansParams build() { offset, planType, q, - requiresPaymentMethod, withoutEntitlementFor, withoutPaidProductId, - withoutProductId, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponseParamsPlanType.java b/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponseParamsPlanType.java deleted file mode 100644 index a5b4212..0000000 --- a/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponseParamsPlanType.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.plans.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CountPlansResponseParamsPlanType { - public static final CountPlansResponseParamsPlanType PLAN = - new CountPlansResponseParamsPlanType(Value.PLAN, "plan"); - - public static final CountPlansResponseParamsPlanType ADD_ON = - new CountPlansResponseParamsPlanType(Value.ADD_ON, "add_on"); - - private final Value value; - - private final String string; - - CountPlansResponseParamsPlanType(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 CountPlansResponseParamsPlanType - && this.string.equals(((CountPlansResponseParamsPlanType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PLAN: - return visitor.visitPlan(); - case ADD_ON: - return visitor.visitAddOn(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountPlansResponseParamsPlanType valueOf(String value) { - switch (value) { - case "plan": - return PLAN; - case "add_on": - return ADD_ON; - default: - return new CountPlansResponseParamsPlanType(Value.UNKNOWN, value); - } - } - - public enum Value { - PLAN, - - ADD_ON, - - UNKNOWN - } - - public interface Visitor { - T visitPlan(); - - T visitAddOn(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/plans/types/CreatePlanRequestBodyPlanType.java b/src/main/java/com/schematic/api/resources/plans/types/CreatePlanRequestBodyPlanType.java deleted file mode 100644 index 3381e61..0000000 --- a/src/main/java/com/schematic/api/resources/plans/types/CreatePlanRequestBodyPlanType.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.plans.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CreatePlanRequestBodyPlanType { - public static final CreatePlanRequestBodyPlanType PLAN = new CreatePlanRequestBodyPlanType(Value.PLAN, "plan"); - - public static final CreatePlanRequestBodyPlanType ADD_ON = - new CreatePlanRequestBodyPlanType(Value.ADD_ON, "add_on"); - - private final Value value; - - private final String string; - - CreatePlanRequestBodyPlanType(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 CreatePlanRequestBodyPlanType - && this.string.equals(((CreatePlanRequestBodyPlanType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PLAN: - return visitor.visitPlan(); - case ADD_ON: - return visitor.visitAddOn(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreatePlanRequestBodyPlanType valueOf(String value) { - switch (value) { - case "plan": - return PLAN; - case "add_on": - return ADD_ON; - default: - return new CreatePlanRequestBodyPlanType(Value.UNKNOWN, value); - } - } - - public enum Value { - PLAN, - - ADD_ON, - - UNKNOWN - } - - public interface Visitor { - T visitPlan(); - - T visitAddOn(); - - T visitUnknown(String unknownType); - } -} 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 37a3c82..935f4a1 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 @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanType; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,18 +38,14 @@ public final class ListPlansParams { private final Optional offset; - private final Optional planType; + private final Optional planType; private final Optional q; - private final Optional requiresPaymentMethod; - private final Optional withoutEntitlementFor; private final Optional withoutPaidProductId; - private final Optional withoutProductId; - private final Map additionalProperties; private ListPlansParams( @@ -60,12 +57,10 @@ private ListPlansParams( Optional> ids, Optional limit, Optional offset, - Optional planType, + Optional planType, Optional q, - Optional requiresPaymentMethod, Optional withoutEntitlementFor, Optional withoutPaidProductId, - Optional withoutProductId, Map additionalProperties) { this.companyId = companyId; this.forFallbackPlan = forFallbackPlan; @@ -77,10 +72,8 @@ private ListPlansParams( this.offset = offset; this.planType = planType; this.q = q; - this.requiresPaymentMethod = requiresPaymentMethod; this.withoutEntitlementFor = withoutEntitlementFor; this.withoutPaidProductId = withoutPaidProductId; - this.withoutProductId = withoutProductId; this.additionalProperties = additionalProperties; } @@ -142,11 +135,8 @@ public Optional getOffset() { return offset; } - /** - * @return Filter by plan type - */ @JsonProperty("plan_type") - public Optional getPlanType() { + public Optional getPlanType() { return planType; } @@ -155,14 +145,6 @@ public Optional getQ() { return q; } - /** - * @return Filter for plans that require a payment method (inverse of ForInitialPlan) - */ - @JsonProperty("requires_payment_method") - public Optional getRequiresPaymentMethod() { - return requiresPaymentMethod; - } - /** * @return Filter out plans that already have a plan entitlement for the specified feature ID */ @@ -179,14 +161,6 @@ public Optional getWithoutPaidProductId() { return withoutPaidProductId; } - /** - * @return Filter out plans that have a billing product ID - */ - @JsonProperty("without_product_id") - public Optional getWithoutProductId() { - return withoutProductId; - } - @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -209,10 +183,8 @@ private boolean equalTo(ListPlansParams other) { && offset.equals(other.offset) && planType.equals(other.planType) && q.equals(other.q) - && requiresPaymentMethod.equals(other.requiresPaymentMethod) && withoutEntitlementFor.equals(other.withoutEntitlementFor) - && withoutPaidProductId.equals(other.withoutPaidProductId) - && withoutProductId.equals(other.withoutProductId); + && withoutPaidProductId.equals(other.withoutPaidProductId); } @java.lang.Override @@ -228,10 +200,8 @@ public int hashCode() { this.offset, this.planType, this.q, - this.requiresPaymentMethod, this.withoutEntitlementFor, - this.withoutPaidProductId, - this.withoutProductId); + this.withoutPaidProductId); } @java.lang.Override @@ -261,18 +231,14 @@ public static final class Builder { private Optional offset = Optional.empty(); - private Optional planType = Optional.empty(); + private Optional planType = Optional.empty(); private Optional q = Optional.empty(); - private Optional requiresPaymentMethod = Optional.empty(); - private Optional withoutEntitlementFor = Optional.empty(); private Optional withoutPaidProductId = Optional.empty(); - private Optional withoutProductId = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -289,10 +255,8 @@ public Builder from(ListPlansParams other) { offset(other.getOffset()); planType(other.getPlanType()); q(other.getQ()); - requiresPaymentMethod(other.getRequiresPaymentMethod()); withoutEntitlementFor(other.getWithoutEntitlementFor()); withoutPaidProductId(other.getWithoutPaidProductId()); - withoutProductId(other.getWithoutProductId()); return this; } @@ -402,16 +366,13 @@ public Builder offset(Integer offset) { return this; } - /** - *

Filter by plan type

- */ @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) - public Builder planType(Optional planType) { + public Builder planType(Optional planType) { this.planType = planType; return this; } - public Builder planType(ListPlansResponseParamsPlanType planType) { + public Builder planType(PlanType planType) { this.planType = Optional.ofNullable(planType); return this; } @@ -427,20 +388,6 @@ public Builder q(String q) { return this; } - /** - *

Filter for plans that require a payment method (inverse of ForInitialPlan)

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

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

*/ @@ -469,20 +416,6 @@ public Builder withoutPaidProductId(Boolean withoutPaidProductId) { return this; } - /** - *

Filter out plans that have a billing product ID

- */ - @JsonSetter(value = "without_product_id", nulls = Nulls.SKIP) - public Builder withoutProductId(Optional withoutProductId) { - this.withoutProductId = withoutProductId; - return this; - } - - public Builder withoutProductId(Boolean withoutProductId) { - this.withoutProductId = Optional.ofNullable(withoutProductId); - return this; - } - public ListPlansParams build() { return new ListPlansParams( companyId, @@ -495,10 +428,8 @@ public ListPlansParams build() { offset, planType, q, - requiresPaymentMethod, withoutEntitlementFor, withoutPaidProductId, - withoutProductId, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponseParamsPlanType.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponseParamsPlanType.java deleted file mode 100644 index 04b4065..0000000 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponseParamsPlanType.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.plans.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListPlansResponseParamsPlanType { - public static final ListPlansResponseParamsPlanType PLAN = new ListPlansResponseParamsPlanType(Value.PLAN, "plan"); - - public static final ListPlansResponseParamsPlanType ADD_ON = - new ListPlansResponseParamsPlanType(Value.ADD_ON, "add_on"); - - private final Value value; - - private final String string; - - ListPlansResponseParamsPlanType(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 ListPlansResponseParamsPlanType - && this.string.equals(((ListPlansResponseParamsPlanType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PLAN: - return visitor.visitPlan(); - case ADD_ON: - return visitor.visitAddOn(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListPlansResponseParamsPlanType valueOf(String value) { - switch (value) { - case "plan": - return PLAN; - case "add_on": - return ADD_ON; - default: - return new ListPlansResponseParamsPlanType(Value.UNKNOWN, value); - } - } - - public enum Value { - PLAN, - - ADD_ON, - - UNKNOWN - } - - public interface Visitor { - T visitPlan(); - - T visitAddOn(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/CreateWebhookRequestBody.java b/src/main/java/com/schematic/api/resources/webhooks/requests/CreateWebhookRequestBody.java index 3135da0..88339c1 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/requests/CreateWebhookRequestBody.java +++ b/src/main/java/com/schematic/api/resources/webhooks/requests/CreateWebhookRequestBody.java @@ -12,9 +12,9 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.webhooks.types.CreateWebhookRequestBodyRequestTypesItem; import com.schematic.api.types.CreditTriggerConfig; import com.schematic.api.types.EntitlementTriggerConfig; +import com.schematic.api.types.WebhookRequestType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -32,7 +32,7 @@ public final class CreateWebhookRequestBody { private final String name; - private final List requestTypes; + private final List requestTypes; private final String url; @@ -42,7 +42,7 @@ private CreateWebhookRequestBody( Optional> creditTriggerConfigs, Optional> entitlementTriggerConfigs, String name, - List requestTypes, + List requestTypes, String url, Map additionalProperties) { this.creditTriggerConfigs = creditTriggerConfigs; @@ -69,7 +69,7 @@ public String getName() { } @JsonProperty("request_types") - public List getRequestTypes() { + public List getRequestTypes() { return requestTypes; } @@ -133,11 +133,11 @@ public interface _FinalStage { _FinalStage entitlementTriggerConfigs(List entitlementTriggerConfigs); - _FinalStage requestTypes(List requestTypes); + _FinalStage requestTypes(List requestTypes); - _FinalStage addRequestTypes(CreateWebhookRequestBodyRequestTypesItem requestTypes); + _FinalStage addRequestTypes(WebhookRequestType requestTypes); - _FinalStage addAllRequestTypes(List requestTypes); + _FinalStage addAllRequestTypes(List requestTypes); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -146,7 +146,7 @@ public static final class Builder implements NameStage, UrlStage, _FinalStage { private String url; - private List requestTypes = new ArrayList<>(); + private List requestTypes = new ArrayList<>(); private Optional> entitlementTriggerConfigs = Optional.empty(); @@ -182,7 +182,7 @@ public _FinalStage url(@NotNull String url) { } @java.lang.Override - public _FinalStage addAllRequestTypes(List requestTypes) { + public _FinalStage addAllRequestTypes(List requestTypes) { if (requestTypes != null) { this.requestTypes.addAll(requestTypes); } @@ -190,14 +190,14 @@ public _FinalStage addAllRequestTypes(List requestTypes) { + public _FinalStage requestTypes(List requestTypes) { this.requestTypes.clear(); if (requestTypes != null) { this.requestTypes.addAll(requestTypes); diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/UpdateWebhookRequestBody.java b/src/main/java/com/schematic/api/resources/webhooks/requests/UpdateWebhookRequestBody.java index 4c4d797..5d7fe07 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/requests/UpdateWebhookRequestBody.java +++ b/src/main/java/com/schematic/api/resources/webhooks/requests/UpdateWebhookRequestBody.java @@ -12,10 +12,10 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.webhooks.types.UpdateWebhookRequestBodyRequestTypesItem; -import com.schematic.api.resources.webhooks.types.UpdateWebhookRequestBodyStatus; import com.schematic.api.types.CreditTriggerConfig; import com.schematic.api.types.EntitlementTriggerConfig; +import com.schematic.api.types.WebhookRequestType; +import com.schematic.api.types.WebhookStatus; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -31,9 +31,9 @@ public final class UpdateWebhookRequestBody { private final Optional name; - private final Optional> requestTypes; + private final Optional> requestTypes; - private final Optional status; + private final Optional status; private final Optional url; @@ -43,8 +43,8 @@ private UpdateWebhookRequestBody( Optional> creditTriggerConfigs, Optional> entitlementTriggerConfigs, Optional name, - Optional> requestTypes, - Optional status, + Optional> requestTypes, + Optional status, Optional url, Map additionalProperties) { this.creditTriggerConfigs = creditTriggerConfigs; @@ -72,12 +72,12 @@ public Optional getName() { } @JsonProperty("request_types") - public Optional> getRequestTypes() { + public Optional> getRequestTypes() { return requestTypes; } @JsonProperty("status") - public Optional getStatus() { + public Optional getStatus() { return status; } @@ -134,9 +134,9 @@ public static final class Builder { private Optional name = Optional.empty(); - private Optional> requestTypes = Optional.empty(); + private Optional> requestTypes = Optional.empty(); - private Optional status = Optional.empty(); + private Optional status = Optional.empty(); private Optional url = Optional.empty(); @@ -189,23 +189,23 @@ public Builder name(String name) { } @JsonSetter(value = "request_types", nulls = Nulls.SKIP) - public Builder requestTypes(Optional> requestTypes) { + public Builder requestTypes(Optional> requestTypes) { this.requestTypes = requestTypes; return this; } - public Builder requestTypes(List requestTypes) { + public Builder requestTypes(List requestTypes) { this.requestTypes = Optional.ofNullable(requestTypes); return this; } @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { + public Builder status(Optional status) { this.status = status; return this; } - public Builder status(UpdateWebhookRequestBodyStatus status) { + public Builder status(WebhookStatus status) { this.status = Optional.ofNullable(status); return this; } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java b/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java deleted file mode 100644 index 8209bff..0000000 --- a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyRequestTypesItem.java +++ /dev/null @@ -1,431 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.resources.webhooks.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UpdateWebhookRequestBodyRequestTypesItem { - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_DELETED, "company.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_OVERRIDE_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_OVERRIDE_UPDATED, "company.override.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FLAG_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FLAG_UPDATED, "flag.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FEATURE_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FEATURE_UPDATED, "feature.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FLAG_RULES_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FLAG_RULES_UPDATED, "flag_rules.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem USER_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.USER_UPDATED, "user.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem PLAN_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.PLAN_DELETED, "plan.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem PLAN_ENTITLEMENT_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.PLAN_ENTITLEMENT_UPDATED, "plan.entitlement.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_OVERRIDE_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_OVERRIDE_DELETED, "company.override.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem USER_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.USER_CREATED, "user.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FEATURE_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FEATURE_DELETED, "feature.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem CREDIT_LIMIT_REACHED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.CREDIT_LIMIT_REACHED, "credit.limit.reached"); - - public static final UpdateWebhookRequestBodyRequestTypesItem ENTITLEMENT_SOFT_LIMIT_REACHED = - new UpdateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_SOFT_LIMIT_REACHED, "entitlement.soft_limit.reached"); - - public static final UpdateWebhookRequestBodyRequestTypesItem SUBSCRIPTION_TRIAL_ENDED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.SUBSCRIPTION_TRIAL_ENDED, "subscription.trial.ended"); - - public static final UpdateWebhookRequestBodyRequestTypesItem ENTITLEMENT_LIMIT_REACHED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.ENTITLEMENT_LIMIT_REACHED, "entitlement.limit.reached"); - - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_OVERRIDE_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_OVERRIDE_CREATED, "company.override.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FLAG_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FLAG_CREATED, "flag.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem PLAN_ENTITLEMENT_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.PLAN_ENTITLEMENT_DELETED, "plan.entitlement.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem USER_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.USER_DELETED, "user.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem PLAN_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.PLAN_UPDATED, "plan.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem ENTITLEMENT_LIMIT_WARNING = - new UpdateWebhookRequestBodyRequestTypesItem(Value.ENTITLEMENT_LIMIT_WARNING, "entitlement.limit.warning"); - - public static final UpdateWebhookRequestBodyRequestTypesItem CREDIT_LIMIT_WARNING = - new UpdateWebhookRequestBodyRequestTypesItem(Value.CREDIT_LIMIT_WARNING, "credit.limit.warning"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FEATURE_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FEATURE_CREATED, "feature.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem ENTITLEMENT_SOFT_LIMIT_WARNING = - new UpdateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_SOFT_LIMIT_WARNING, "entitlement.soft_limit.warning"); - - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_UPDATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_UPDATED, "company.updated"); - - public static final UpdateWebhookRequestBodyRequestTypesItem ENTITLEMENT_TIER_LIMIT_REACHED = - new UpdateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_TIER_LIMIT_REACHED, "entitlement.tier_limit.reached"); - - public static final UpdateWebhookRequestBodyRequestTypesItem FLAG_DELETED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.FLAG_DELETED, "flag.deleted"); - - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_CREATED, "company.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem PLAN_ENTITLEMENT_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.PLAN_ENTITLEMENT_CREATED, "plan.entitlement.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem ENTITLEMENT_TIER_LIMIT_WARNING = - new UpdateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_TIER_LIMIT_WARNING, "entitlement.tier_limit.warning"); - - public static final UpdateWebhookRequestBodyRequestTypesItem COMPANY_PLAN_CHANGE = - new UpdateWebhookRequestBodyRequestTypesItem(Value.COMPANY_PLAN_CHANGE, "company.plan_change"); - - public static final UpdateWebhookRequestBodyRequestTypesItem PLAN_CREATED = - new UpdateWebhookRequestBodyRequestTypesItem(Value.PLAN_CREATED, "plan.created"); - - public static final UpdateWebhookRequestBodyRequestTypesItem TEST_SEND = - new UpdateWebhookRequestBodyRequestTypesItem(Value.TEST_SEND, "test.send"); - - private final Value value; - - private final String string; - - UpdateWebhookRequestBodyRequestTypesItem(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 UpdateWebhookRequestBodyRequestTypesItem - && this.string.equals(((UpdateWebhookRequestBodyRequestTypesItem) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case COMPANY_DELETED: - return visitor.visitCompanyDeleted(); - case COMPANY_OVERRIDE_UPDATED: - return visitor.visitCompanyOverrideUpdated(); - case FLAG_UPDATED: - return visitor.visitFlagUpdated(); - case FEATURE_UPDATED: - return visitor.visitFeatureUpdated(); - case FLAG_RULES_UPDATED: - return visitor.visitFlagRulesUpdated(); - case USER_UPDATED: - return visitor.visitUserUpdated(); - case PLAN_DELETED: - return visitor.visitPlanDeleted(); - case PLAN_ENTITLEMENT_UPDATED: - return visitor.visitPlanEntitlementUpdated(); - case COMPANY_OVERRIDE_DELETED: - return visitor.visitCompanyOverrideDeleted(); - case USER_CREATED: - return visitor.visitUserCreated(); - case FEATURE_DELETED: - return visitor.visitFeatureDeleted(); - case CREDIT_LIMIT_REACHED: - return visitor.visitCreditLimitReached(); - case ENTITLEMENT_SOFT_LIMIT_REACHED: - return visitor.visitEntitlementSoftLimitReached(); - case SUBSCRIPTION_TRIAL_ENDED: - return visitor.visitSubscriptionTrialEnded(); - case ENTITLEMENT_LIMIT_REACHED: - return visitor.visitEntitlementLimitReached(); - case COMPANY_OVERRIDE_CREATED: - return visitor.visitCompanyOverrideCreated(); - case FLAG_CREATED: - return visitor.visitFlagCreated(); - case PLAN_ENTITLEMENT_DELETED: - return visitor.visitPlanEntitlementDeleted(); - case USER_DELETED: - return visitor.visitUserDeleted(); - case PLAN_UPDATED: - return visitor.visitPlanUpdated(); - case ENTITLEMENT_LIMIT_WARNING: - return visitor.visitEntitlementLimitWarning(); - case CREDIT_LIMIT_WARNING: - return visitor.visitCreditLimitWarning(); - case FEATURE_CREATED: - return visitor.visitFeatureCreated(); - case ENTITLEMENT_SOFT_LIMIT_WARNING: - return visitor.visitEntitlementSoftLimitWarning(); - case COMPANY_UPDATED: - return visitor.visitCompanyUpdated(); - case ENTITLEMENT_TIER_LIMIT_REACHED: - return visitor.visitEntitlementTierLimitReached(); - case FLAG_DELETED: - return visitor.visitFlagDeleted(); - case COMPANY_CREATED: - return visitor.visitCompanyCreated(); - case PLAN_ENTITLEMENT_CREATED: - return visitor.visitPlanEntitlementCreated(); - case ENTITLEMENT_TIER_LIMIT_WARNING: - return visitor.visitEntitlementTierLimitWarning(); - case COMPANY_PLAN_CHANGE: - return visitor.visitCompanyPlanChange(); - case PLAN_CREATED: - return visitor.visitPlanCreated(); - case TEST_SEND: - return visitor.visitTestSend(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateWebhookRequestBodyRequestTypesItem valueOf(String value) { - switch (value) { - case "company.deleted": - return COMPANY_DELETED; - case "company.override.updated": - return COMPANY_OVERRIDE_UPDATED; - case "flag.updated": - return FLAG_UPDATED; - case "feature.updated": - return FEATURE_UPDATED; - case "flag_rules.updated": - return FLAG_RULES_UPDATED; - case "user.updated": - return USER_UPDATED; - case "plan.deleted": - return PLAN_DELETED; - case "plan.entitlement.updated": - return PLAN_ENTITLEMENT_UPDATED; - case "company.override.deleted": - return COMPANY_OVERRIDE_DELETED; - case "user.created": - return USER_CREATED; - case "feature.deleted": - return FEATURE_DELETED; - case "credit.limit.reached": - return CREDIT_LIMIT_REACHED; - case "entitlement.soft_limit.reached": - return ENTITLEMENT_SOFT_LIMIT_REACHED; - case "subscription.trial.ended": - return SUBSCRIPTION_TRIAL_ENDED; - case "entitlement.limit.reached": - return ENTITLEMENT_LIMIT_REACHED; - case "company.override.created": - return COMPANY_OVERRIDE_CREATED; - case "flag.created": - return FLAG_CREATED; - case "plan.entitlement.deleted": - return PLAN_ENTITLEMENT_DELETED; - case "user.deleted": - return USER_DELETED; - case "plan.updated": - return PLAN_UPDATED; - case "entitlement.limit.warning": - return ENTITLEMENT_LIMIT_WARNING; - case "credit.limit.warning": - return CREDIT_LIMIT_WARNING; - case "feature.created": - return FEATURE_CREATED; - case "entitlement.soft_limit.warning": - return ENTITLEMENT_SOFT_LIMIT_WARNING; - case "company.updated": - return COMPANY_UPDATED; - case "entitlement.tier_limit.reached": - return ENTITLEMENT_TIER_LIMIT_REACHED; - case "flag.deleted": - return FLAG_DELETED; - case "company.created": - return COMPANY_CREATED; - case "plan.entitlement.created": - return PLAN_ENTITLEMENT_CREATED; - case "entitlement.tier_limit.warning": - return ENTITLEMENT_TIER_LIMIT_WARNING; - case "company.plan_change": - return COMPANY_PLAN_CHANGE; - case "plan.created": - return PLAN_CREATED; - case "test.send": - return TEST_SEND; - default: - return new UpdateWebhookRequestBodyRequestTypesItem(Value.UNKNOWN, value); - } - } - - public enum Value { - COMPANY_UPDATED, - - USER_UPDATED, - - PLAN_UPDATED, - - PLAN_ENTITLEMENT_UPDATED, - - COMPANY_OVERRIDE_UPDATED, - - FEATURE_UPDATED, - - FLAG_UPDATED, - - FLAG_RULES_UPDATED, - - COMPANY_CREATED, - - USER_CREATED, - - PLAN_CREATED, - - PLAN_ENTITLEMENT_CREATED, - - COMPANY_OVERRIDE_CREATED, - - FEATURE_CREATED, - - FLAG_CREATED, - - COMPANY_DELETED, - - USER_DELETED, - - PLAN_DELETED, - - PLAN_ENTITLEMENT_DELETED, - - COMPANY_OVERRIDE_DELETED, - - FEATURE_DELETED, - - FLAG_DELETED, - - TEST_SEND, - - SUBSCRIPTION_TRIAL_ENDED, - - ENTITLEMENT_LIMIT_WARNING, - - ENTITLEMENT_LIMIT_REACHED, - - ENTITLEMENT_SOFT_LIMIT_WARNING, - - ENTITLEMENT_SOFT_LIMIT_REACHED, - - ENTITLEMENT_TIER_LIMIT_WARNING, - - ENTITLEMENT_TIER_LIMIT_REACHED, - - CREDIT_LIMIT_WARNING, - - CREDIT_LIMIT_REACHED, - - COMPANY_PLAN_CHANGE, - - UNKNOWN - } - - public interface Visitor { - T visitCompanyUpdated(); - - T visitUserUpdated(); - - T visitPlanUpdated(); - - T visitPlanEntitlementUpdated(); - - T visitCompanyOverrideUpdated(); - - T visitFeatureUpdated(); - - T visitFlagUpdated(); - - T visitFlagRulesUpdated(); - - T visitCompanyCreated(); - - T visitUserCreated(); - - T visitPlanCreated(); - - T visitPlanEntitlementCreated(); - - T visitCompanyOverrideCreated(); - - T visitFeatureCreated(); - - T visitFlagCreated(); - - T visitCompanyDeleted(); - - T visitUserDeleted(); - - T visitPlanDeleted(); - - T visitPlanEntitlementDeleted(); - - T visitCompanyOverrideDeleted(); - - T visitFeatureDeleted(); - - T visitFlagDeleted(); - - T visitTestSend(); - - T visitSubscriptionTrialEnded(); - - T visitEntitlementLimitWarning(); - - T visitEntitlementLimitReached(); - - T visitEntitlementSoftLimitWarning(); - - T visitEntitlementSoftLimitReached(); - - T visitEntitlementTierLimitWarning(); - - T visitEntitlementTierLimitReached(); - - T visitCreditLimitWarning(); - - T visitCreditLimitReached(); - - T visitCompanyPlanChange(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseDataActorType.java b/src/main/java/com/schematic/api/types/ActorType.java similarity index 63% rename from src/main/java/com/schematic/api/types/PlanChangeResponseDataActorType.java rename to src/main/java/com/schematic/api/types/ActorType.java index dea36b1..13df57d 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseDataActorType.java +++ b/src/main/java/com/schematic/api/types/ActorType.java @@ -6,24 +6,21 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class PlanChangeResponseDataActorType { - public static final PlanChangeResponseDataActorType TEMPORARY_ACCESS_TOKEN = - new PlanChangeResponseDataActorType(Value.TEMPORARY_ACCESS_TOKEN, "temporary_access_token"); +public final class ActorType { + public static final ActorType TEMPORARY_ACCESS_TOKEN = + new ActorType(Value.TEMPORARY_ACCESS_TOKEN, "temporary_access_token"); - public static final PlanChangeResponseDataActorType APP_USER = - new PlanChangeResponseDataActorType(Value.APP_USER, "app_user"); + public static final ActorType APP_USER = new ActorType(Value.APP_USER, "app_user"); - public static final PlanChangeResponseDataActorType API_KEY = - new PlanChangeResponseDataActorType(Value.API_KEY, "api_key"); + public static final ActorType API_KEY = new ActorType(Value.API_KEY, "api_key"); - public static final PlanChangeResponseDataActorType SYSTEM = - new PlanChangeResponseDataActorType(Value.SYSTEM, "system"); + public static final ActorType SYSTEM = new ActorType(Value.SYSTEM, "system"); private final Value value; private final String string; - PlanChangeResponseDataActorType(Value value, String string) { + ActorType(Value value, String string) { this.value = value; this.string = string; } @@ -40,9 +37,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof PlanChangeResponseDataActorType - && this.string.equals(((PlanChangeResponseDataActorType) other).string)); + return (this == other) || (other instanceof ActorType && this.string.equals(((ActorType) other).string)); } @java.lang.Override @@ -67,7 +62,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static PlanChangeResponseDataActorType valueOf(String value) { + public static ActorType valueOf(String value) { switch (value) { case "temporary_access_token": return TEMPORARY_ACCESS_TOKEN; @@ -78,15 +73,15 @@ public static PlanChangeResponseDataActorType valueOf(String value) { case "system": return SYSTEM; default: - return new PlanChangeResponseDataActorType(Value.UNKNOWN, value); + return new ActorType(Value.UNKNOWN, value); } } public enum Value { - APP_USER, - API_KEY, + APP_USER, + SYSTEM, TEMPORARY_ACCESS_TOKEN, @@ -95,10 +90,10 @@ public enum Value { } public interface Visitor { - T visitAppUser(); - T visitApiKey(); + T visitAppUser(); + T visitSystem(); T visitTemporaryAccessToken(); diff --git a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java index fbc055f..b7df5a6 100644 --- a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java +++ b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java @@ -36,7 +36,7 @@ public final class ApiKeyCreateResponseData { private final String name; - private final List scopes; + private final List scopes; private final String secret; @@ -51,7 +51,7 @@ private ApiKeyCreateResponseData( String id, Optional lastUsedAt, String name, - List scopes, + List scopes, String secret, OffsetDateTime updatedAt, Map additionalProperties) { @@ -98,7 +98,7 @@ public String getName() { } @JsonProperty("scopes") - public List getScopes() { + public List getScopes() { return scopes; } @@ -195,11 +195,11 @@ public interface _FinalStage { _FinalStage lastUsedAt(OffsetDateTime lastUsedAt); - _FinalStage scopes(List scopes); + _FinalStage scopes(List scopes); - _FinalStage addScopes(String scopes); + _FinalStage addScopes(ApiKeyScope scopes); - _FinalStage addAllScopes(List scopes); + _FinalStage addAllScopes(List scopes); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -215,7 +215,7 @@ public static final class Builder private OffsetDateTime updatedAt; - private List scopes = new ArrayList<>(); + private List scopes = new ArrayList<>(); private Optional lastUsedAt = Optional.empty(); @@ -278,7 +278,7 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { } @java.lang.Override - public _FinalStage addAllScopes(List scopes) { + public _FinalStage addAllScopes(List scopes) { if (scopes != null) { this.scopes.addAll(scopes); } @@ -286,14 +286,14 @@ public _FinalStage addAllScopes(List scopes) { } @java.lang.Override - public _FinalStage addScopes(String scopes) { + public _FinalStage addScopes(ApiKeyScope scopes) { this.scopes.add(scopes); return this; } @java.lang.Override @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public _FinalStage scopes(List scopes) { + public _FinalStage scopes(List scopes) { this.scopes.clear(); if (scopes != null) { this.scopes.addAll(scopes); diff --git a/src/main/java/com/schematic/api/types/ApiKeyResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyResponseData.java index 292ef9f..f98026a 100644 --- a/src/main/java/com/schematic/api/types/ApiKeyResponseData.java +++ b/src/main/java/com/schematic/api/types/ApiKeyResponseData.java @@ -36,7 +36,7 @@ public final class ApiKeyResponseData { private final String name; - private final List scopes; + private final List scopes; private final OffsetDateTime updatedAt; @@ -49,7 +49,7 @@ private ApiKeyResponseData( String id, Optional lastUsedAt, String name, - List scopes, + List scopes, OffsetDateTime updatedAt, Map additionalProperties) { this.createdAt = createdAt; @@ -94,7 +94,7 @@ public String getName() { } @JsonProperty("scopes") - public List getScopes() { + public List getScopes() { return scopes; } @@ -180,11 +180,11 @@ public interface _FinalStage { _FinalStage lastUsedAt(OffsetDateTime lastUsedAt); - _FinalStage scopes(List scopes); + _FinalStage scopes(List scopes); - _FinalStage addScopes(String scopes); + _FinalStage addScopes(ApiKeyScope scopes); - _FinalStage addAllScopes(List scopes); + _FinalStage addAllScopes(List scopes); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -197,7 +197,7 @@ public static final class Builder implements CreatedAtStage, IdStage, NameStage, private OffsetDateTime updatedAt; - private List scopes = new ArrayList<>(); + private List scopes = new ArrayList<>(); private Optional lastUsedAt = Optional.empty(); @@ -252,7 +252,7 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { } @java.lang.Override - public _FinalStage addAllScopes(List scopes) { + public _FinalStage addAllScopes(List scopes) { if (scopes != null) { this.scopes.addAll(scopes); } @@ -260,14 +260,14 @@ public _FinalStage addAllScopes(List scopes) { } @java.lang.Override - public _FinalStage addScopes(String scopes) { + public _FinalStage addScopes(ApiKeyScope scopes) { this.scopes.add(scopes); return this; } @java.lang.Override @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public _FinalStage scopes(List scopes) { + public _FinalStage scopes(List scopes) { this.scopes.clear(); if (scopes != null) { this.scopes.addAll(scopes); diff --git a/src/main/java/com/schematic/api/types/ApiKeyScope.java b/src/main/java/com/schematic/api/types/ApiKeyScope.java new file mode 100644 index 0000000..a3e17ba --- /dev/null +++ b/src/main/java/com/schematic/api/types/ApiKeyScope.java @@ -0,0 +1,102 @@ +/** + * 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 ApiKeyScope { + public static final ApiKeyScope CAPTURE = new ApiKeyScope(Value.CAPTURE, "capture"); + + public static final ApiKeyScope WRITE = new ApiKeyScope(Value.WRITE, "write"); + + public static final ApiKeyScope ADMIN = new ApiKeyScope(Value.ADMIN, "admin"); + + public static final ApiKeyScope READ = new ApiKeyScope(Value.READ, "read"); + + private final Value value; + + private final String string; + + ApiKeyScope(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 ApiKeyScope && this.string.equals(((ApiKeyScope) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CAPTURE: + return visitor.visitCapture(); + case WRITE: + return visitor.visitWrite(); + case ADMIN: + return visitor.visitAdmin(); + case READ: + return visitor.visitRead(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ApiKeyScope valueOf(String value) { + switch (value) { + case "capture": + return CAPTURE; + case "write": + return WRITE; + case "admin": + return ADMIN; + case "read": + return READ; + default: + return new ApiKeyScope(Value.UNKNOWN, value); + } + } + + public enum Value { + ADMIN, + + CAPTURE, + + READ, + + WRITE, + + UNKNOWN + } + + public interface Visitor { + T visitAdmin(); + + T visitCapture(); + + T visitRead(); + + T visitWrite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/AuditLogListResponseData.java b/src/main/java/com/schematic/api/types/AuditLogListResponseData.java new file mode 100644 index 0000000..0651861 --- /dev/null +++ b/src/main/java/com/schematic/api/types/AuditLogListResponseData.java @@ -0,0 +1,535 @@ +/** + * 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 = AuditLogListResponseData.Builder.class) +public final class AuditLogListResponseData { + private final ActorType actorType; + + private final Optional apiKeyId; + + private final Optional endedAt; + + private final Optional environmentId; + + private final String id; + + private final String method; + + private final Optional resourceId; + + private final Optional resourceIdString; + + private final Optional resourceName; + + private final Optional resourceType; + + private final Optional respCode; + + private final Optional secondaryResource; + + private final OffsetDateTime startedAt; + + private final String url; + + private final Optional userName; + + private final Map additionalProperties; + + private AuditLogListResponseData( + ActorType actorType, + Optional apiKeyId, + Optional endedAt, + Optional environmentId, + String id, + String method, + Optional resourceId, + Optional resourceIdString, + Optional resourceName, + Optional resourceType, + Optional respCode, + Optional secondaryResource, + OffsetDateTime startedAt, + String url, + Optional userName, + Map additionalProperties) { + this.actorType = actorType; + this.apiKeyId = apiKeyId; + this.endedAt = endedAt; + this.environmentId = environmentId; + this.id = id; + this.method = method; + this.resourceId = resourceId; + this.resourceIdString = resourceIdString; + this.resourceName = resourceName; + this.resourceType = resourceType; + this.respCode = respCode; + this.secondaryResource = secondaryResource; + this.startedAt = startedAt; + this.url = url; + this.userName = userName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actor_type") + public ActorType getActorType() { + return actorType; + } + + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("method") + public String getMethod() { + return method; + } + + @JsonProperty("resource_id") + public Optional getResourceId() { + return resourceId; + } + + @JsonProperty("resource_id_string") + public Optional getResourceIdString() { + return resourceIdString; + } + + @JsonProperty("resource_name") + public Optional getResourceName() { + return resourceName; + } + + @JsonProperty("resource_type") + public Optional getResourceType() { + return resourceType; + } + + @JsonProperty("resp_code") + public Optional getRespCode() { + return respCode; + } + + @JsonProperty("secondary_resource") + public Optional getSecondaryResource() { + return secondaryResource; + } + + @JsonProperty("started_at") + public OffsetDateTime getStartedAt() { + return startedAt; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("user_name") + public Optional getUserName() { + return userName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditLogListResponseData && equalTo((AuditLogListResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditLogListResponseData other) { + return actorType.equals(other.actorType) + && apiKeyId.equals(other.apiKeyId) + && endedAt.equals(other.endedAt) + && environmentId.equals(other.environmentId) + && id.equals(other.id) + && method.equals(other.method) + && resourceId.equals(other.resourceId) + && resourceIdString.equals(other.resourceIdString) + && resourceName.equals(other.resourceName) + && resourceType.equals(other.resourceType) + && respCode.equals(other.respCode) + && secondaryResource.equals(other.secondaryResource) + && startedAt.equals(other.startedAt) + && url.equals(other.url) + && userName.equals(other.userName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.actorType, + this.apiKeyId, + this.endedAt, + this.environmentId, + this.id, + this.method, + this.resourceId, + this.resourceIdString, + this.resourceName, + this.resourceType, + this.respCode, + this.secondaryResource, + this.startedAt, + this.url, + this.userName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActorTypeStage builder() { + return new Builder(); + } + + public interface ActorTypeStage { + IdStage actorType(@NotNull ActorType actorType); + + Builder from(AuditLogListResponseData other); + } + + public interface IdStage { + MethodStage id(@NotNull String id); + } + + public interface MethodStage { + StartedAtStage method(@NotNull String method); + } + + public interface StartedAtStage { + UrlStage startedAt(@NotNull OffsetDateTime startedAt); + } + + public interface UrlStage { + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + AuditLogListResponseData build(); + + _FinalStage apiKeyId(Optional apiKeyId); + + _FinalStage apiKeyId(String apiKeyId); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + + _FinalStage environmentId(Optional environmentId); + + _FinalStage environmentId(String environmentId); + + _FinalStage resourceId(Optional resourceId); + + _FinalStage resourceId(Integer resourceId); + + _FinalStage resourceIdString(Optional resourceIdString); + + _FinalStage resourceIdString(String resourceIdString); + + _FinalStage resourceName(Optional resourceName); + + _FinalStage resourceName(String resourceName); + + _FinalStage resourceType(Optional resourceType); + + _FinalStage resourceType(String resourceType); + + _FinalStage respCode(Optional respCode); + + _FinalStage respCode(Integer respCode); + + _FinalStage secondaryResource(Optional secondaryResource); + + _FinalStage secondaryResource(String secondaryResource); + + _FinalStage userName(Optional userName); + + _FinalStage userName(String userName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActorTypeStage, IdStage, MethodStage, StartedAtStage, UrlStage, _FinalStage { + private ActorType actorType; + + private String id; + + private String method; + + private OffsetDateTime startedAt; + + private String url; + + private Optional userName = Optional.empty(); + + private Optional secondaryResource = Optional.empty(); + + private Optional respCode = Optional.empty(); + + private Optional resourceType = Optional.empty(); + + private Optional resourceName = Optional.empty(); + + private Optional resourceIdString = Optional.empty(); + + private Optional resourceId = Optional.empty(); + + private Optional environmentId = Optional.empty(); + + private Optional endedAt = Optional.empty(); + + private Optional apiKeyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuditLogListResponseData other) { + actorType(other.getActorType()); + apiKeyId(other.getApiKeyId()); + endedAt(other.getEndedAt()); + environmentId(other.getEnvironmentId()); + id(other.getId()); + method(other.getMethod()); + resourceId(other.getResourceId()); + resourceIdString(other.getResourceIdString()); + resourceName(other.getResourceName()); + resourceType(other.getResourceType()); + respCode(other.getRespCode()); + secondaryResource(other.getSecondaryResource()); + startedAt(other.getStartedAt()); + url(other.getUrl()); + userName(other.getUserName()); + return this; + } + + @java.lang.Override + @JsonSetter("actor_type") + public IdStage actorType(@NotNull ActorType actorType) { + this.actorType = Objects.requireNonNull(actorType, "actorType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public MethodStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("method") + public StartedAtStage method(@NotNull String method) { + this.method = Objects.requireNonNull(method, "method must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("started_at") + public UrlStage startedAt(@NotNull OffsetDateTime startedAt) { + this.startedAt = Objects.requireNonNull(startedAt, "startedAt 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 _FinalStage userName(String userName) { + this.userName = Optional.ofNullable(userName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user_name", nulls = Nulls.SKIP) + public _FinalStage userName(Optional userName) { + this.userName = userName; + return this; + } + + @java.lang.Override + public _FinalStage secondaryResource(String secondaryResource) { + this.secondaryResource = Optional.ofNullable(secondaryResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "secondary_resource", nulls = Nulls.SKIP) + public _FinalStage secondaryResource(Optional secondaryResource) { + this.secondaryResource = secondaryResource; + return this; + } + + @java.lang.Override + public _FinalStage respCode(Integer respCode) { + this.respCode = Optional.ofNullable(respCode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resp_code", nulls = Nulls.SKIP) + public _FinalStage respCode(Optional respCode) { + this.respCode = respCode; + return this; + } + + @java.lang.Override + public _FinalStage resourceType(String resourceType) { + this.resourceType = Optional.ofNullable(resourceType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_type", nulls = Nulls.SKIP) + public _FinalStage resourceType(Optional resourceType) { + this.resourceType = resourceType; + return this; + } + + @java.lang.Override + public _FinalStage resourceName(String resourceName) { + this.resourceName = Optional.ofNullable(resourceName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_name", nulls = Nulls.SKIP) + public _FinalStage resourceName(Optional resourceName) { + this.resourceName = resourceName; + return this; + } + + @java.lang.Override + public _FinalStage resourceIdString(String resourceIdString) { + this.resourceIdString = Optional.ofNullable(resourceIdString); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_id_string", nulls = Nulls.SKIP) + public _FinalStage resourceIdString(Optional resourceIdString) { + this.resourceIdString = resourceIdString; + return this; + } + + @java.lang.Override + public _FinalStage resourceId(Integer resourceId) { + this.resourceId = Optional.ofNullable(resourceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_id", nulls = Nulls.SKIP) + public _FinalStage resourceId(Optional resourceId) { + this.resourceId = resourceId; + return this; + } + + @java.lang.Override + public _FinalStage environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public _FinalStage environmentId(Optional environmentId) { + this.environmentId = environmentId; + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage apiKeyId(String apiKeyId) { + this.apiKeyId = Optional.ofNullable(apiKeyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) + public _FinalStage apiKeyId(Optional apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + @java.lang.Override + public AuditLogListResponseData build() { + return new AuditLogListResponseData( + actorType, + apiKeyId, + endedAt, + environmentId, + id, + method, + resourceId, + resourceIdString, + resourceName, + resourceType, + respCode, + secondaryResource, + startedAt, + url, + userName, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/AuditLogResponseData.java b/src/main/java/com/schematic/api/types/AuditLogResponseData.java new file mode 100644 index 0000000..f62a67d --- /dev/null +++ b/src/main/java/com/schematic/api/types/AuditLogResponseData.java @@ -0,0 +1,631 @@ +/** + * 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 = AuditLogResponseData.Builder.class) +public final class AuditLogResponseData { + private final ActorType actorType; + + private final Optional apiKeyId; + + private final Optional endedAt; + + private final Optional environmentId; + + private final String id; + + private final String method; + + private final Optional reqBody; + + private final Optional resourceId; + + private final Optional resourceIdString; + + private final Optional resourceName; + + private final Optional resourceType; + + private final Optional respBody; + + private final Optional respCode; + + private final Optional secondaryResource; + + private final OffsetDateTime startedAt; + + private final String url; + + private final Optional userId; + + private final Optional userName; + + private final Map additionalProperties; + + private AuditLogResponseData( + ActorType actorType, + Optional apiKeyId, + Optional endedAt, + Optional environmentId, + String id, + String method, + Optional reqBody, + Optional resourceId, + Optional resourceIdString, + Optional resourceName, + Optional resourceType, + Optional respBody, + Optional respCode, + Optional secondaryResource, + OffsetDateTime startedAt, + String url, + Optional userId, + Optional userName, + Map additionalProperties) { + this.actorType = actorType; + this.apiKeyId = apiKeyId; + this.endedAt = endedAt; + this.environmentId = environmentId; + this.id = id; + this.method = method; + this.reqBody = reqBody; + this.resourceId = resourceId; + this.resourceIdString = resourceIdString; + this.resourceName = resourceName; + this.resourceType = resourceType; + this.respBody = respBody; + this.respCode = respCode; + this.secondaryResource = secondaryResource; + this.startedAt = startedAt; + this.url = url; + this.userId = userId; + this.userName = userName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actor_type") + public ActorType getActorType() { + return actorType; + } + + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + @JsonProperty("ended_at") + public Optional getEndedAt() { + return endedAt; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("method") + public String getMethod() { + return method; + } + + @JsonProperty("req_body") + public Optional getReqBody() { + return reqBody; + } + + @JsonProperty("resource_id") + public Optional getResourceId() { + return resourceId; + } + + @JsonProperty("resource_id_string") + public Optional getResourceIdString() { + return resourceIdString; + } + + @JsonProperty("resource_name") + public Optional getResourceName() { + return resourceName; + } + + @JsonProperty("resource_type") + public Optional getResourceType() { + return resourceType; + } + + @JsonProperty("resp_body") + public Optional getRespBody() { + return respBody; + } + + @JsonProperty("resp_code") + public Optional getRespCode() { + return respCode; + } + + @JsonProperty("secondary_resource") + public Optional getSecondaryResource() { + return secondaryResource; + } + + @JsonProperty("started_at") + public OffsetDateTime getStartedAt() { + return startedAt; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @JsonProperty("user_name") + public Optional getUserName() { + return userName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AuditLogResponseData && equalTo((AuditLogResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AuditLogResponseData other) { + return actorType.equals(other.actorType) + && apiKeyId.equals(other.apiKeyId) + && endedAt.equals(other.endedAt) + && environmentId.equals(other.environmentId) + && id.equals(other.id) + && method.equals(other.method) + && reqBody.equals(other.reqBody) + && resourceId.equals(other.resourceId) + && resourceIdString.equals(other.resourceIdString) + && resourceName.equals(other.resourceName) + && resourceType.equals(other.resourceType) + && respBody.equals(other.respBody) + && respCode.equals(other.respCode) + && secondaryResource.equals(other.secondaryResource) + && startedAt.equals(other.startedAt) + && url.equals(other.url) + && userId.equals(other.userId) + && userName.equals(other.userName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.actorType, + this.apiKeyId, + this.endedAt, + this.environmentId, + this.id, + this.method, + this.reqBody, + this.resourceId, + this.resourceIdString, + this.resourceName, + this.resourceType, + this.respBody, + this.respCode, + this.secondaryResource, + this.startedAt, + this.url, + this.userId, + this.userName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActorTypeStage builder() { + return new Builder(); + } + + public interface ActorTypeStage { + IdStage actorType(@NotNull ActorType actorType); + + Builder from(AuditLogResponseData other); + } + + public interface IdStage { + MethodStage id(@NotNull String id); + } + + public interface MethodStage { + StartedAtStage method(@NotNull String method); + } + + public interface StartedAtStage { + UrlStage startedAt(@NotNull OffsetDateTime startedAt); + } + + public interface UrlStage { + _FinalStage url(@NotNull String url); + } + + public interface _FinalStage { + AuditLogResponseData build(); + + _FinalStage apiKeyId(Optional apiKeyId); + + _FinalStage apiKeyId(String apiKeyId); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + + _FinalStage environmentId(Optional environmentId); + + _FinalStage environmentId(String environmentId); + + _FinalStage reqBody(Optional reqBody); + + _FinalStage reqBody(String reqBody); + + _FinalStage resourceId(Optional resourceId); + + _FinalStage resourceId(Integer resourceId); + + _FinalStage resourceIdString(Optional resourceIdString); + + _FinalStage resourceIdString(String resourceIdString); + + _FinalStage resourceName(Optional resourceName); + + _FinalStage resourceName(String resourceName); + + _FinalStage resourceType(Optional resourceType); + + _FinalStage resourceType(String resourceType); + + _FinalStage respBody(Optional respBody); + + _FinalStage respBody(String respBody); + + _FinalStage respCode(Optional respCode); + + _FinalStage respCode(Integer respCode); + + _FinalStage secondaryResource(Optional secondaryResource); + + _FinalStage secondaryResource(String secondaryResource); + + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + + _FinalStage userName(Optional userName); + + _FinalStage userName(String userName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActorTypeStage, IdStage, MethodStage, StartedAtStage, UrlStage, _FinalStage { + private ActorType actorType; + + private String id; + + private String method; + + private OffsetDateTime startedAt; + + private String url; + + private Optional userName = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional secondaryResource = Optional.empty(); + + private Optional respCode = Optional.empty(); + + private Optional respBody = Optional.empty(); + + private Optional resourceType = Optional.empty(); + + private Optional resourceName = Optional.empty(); + + private Optional resourceIdString = Optional.empty(); + + private Optional resourceId = Optional.empty(); + + private Optional reqBody = Optional.empty(); + + private Optional environmentId = Optional.empty(); + + private Optional endedAt = Optional.empty(); + + private Optional apiKeyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AuditLogResponseData other) { + actorType(other.getActorType()); + apiKeyId(other.getApiKeyId()); + endedAt(other.getEndedAt()); + environmentId(other.getEnvironmentId()); + id(other.getId()); + method(other.getMethod()); + reqBody(other.getReqBody()); + resourceId(other.getResourceId()); + resourceIdString(other.getResourceIdString()); + resourceName(other.getResourceName()); + resourceType(other.getResourceType()); + respBody(other.getRespBody()); + respCode(other.getRespCode()); + secondaryResource(other.getSecondaryResource()); + startedAt(other.getStartedAt()); + url(other.getUrl()); + userId(other.getUserId()); + userName(other.getUserName()); + return this; + } + + @java.lang.Override + @JsonSetter("actor_type") + public IdStage actorType(@NotNull ActorType actorType) { + this.actorType = Objects.requireNonNull(actorType, "actorType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public MethodStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("method") + public StartedAtStage method(@NotNull String method) { + this.method = Objects.requireNonNull(method, "method must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("started_at") + public UrlStage startedAt(@NotNull OffsetDateTime startedAt) { + this.startedAt = Objects.requireNonNull(startedAt, "startedAt 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 _FinalStage userName(String userName) { + this.userName = Optional.ofNullable(userName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user_name", nulls = Nulls.SKIP) + public _FinalStage userName(Optional userName) { + this.userName = userName; + return this; + } + + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + @java.lang.Override + public _FinalStage secondaryResource(String secondaryResource) { + this.secondaryResource = Optional.ofNullable(secondaryResource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "secondary_resource", nulls = Nulls.SKIP) + public _FinalStage secondaryResource(Optional secondaryResource) { + this.secondaryResource = secondaryResource; + return this; + } + + @java.lang.Override + public _FinalStage respCode(Integer respCode) { + this.respCode = Optional.ofNullable(respCode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resp_code", nulls = Nulls.SKIP) + public _FinalStage respCode(Optional respCode) { + this.respCode = respCode; + return this; + } + + @java.lang.Override + public _FinalStage respBody(String respBody) { + this.respBody = Optional.ofNullable(respBody); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resp_body", nulls = Nulls.SKIP) + public _FinalStage respBody(Optional respBody) { + this.respBody = respBody; + return this; + } + + @java.lang.Override + public _FinalStage resourceType(String resourceType) { + this.resourceType = Optional.ofNullable(resourceType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_type", nulls = Nulls.SKIP) + public _FinalStage resourceType(Optional resourceType) { + this.resourceType = resourceType; + return this; + } + + @java.lang.Override + public _FinalStage resourceName(String resourceName) { + this.resourceName = Optional.ofNullable(resourceName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_name", nulls = Nulls.SKIP) + public _FinalStage resourceName(Optional resourceName) { + this.resourceName = resourceName; + return this; + } + + @java.lang.Override + public _FinalStage resourceIdString(String resourceIdString) { + this.resourceIdString = Optional.ofNullable(resourceIdString); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_id_string", nulls = Nulls.SKIP) + public _FinalStage resourceIdString(Optional resourceIdString) { + this.resourceIdString = resourceIdString; + return this; + } + + @java.lang.Override + public _FinalStage resourceId(Integer resourceId) { + this.resourceId = Optional.ofNullable(resourceId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_id", nulls = Nulls.SKIP) + public _FinalStage resourceId(Optional resourceId) { + this.resourceId = resourceId; + return this; + } + + @java.lang.Override + public _FinalStage reqBody(String reqBody) { + this.reqBody = Optional.ofNullable(reqBody); + return this; + } + + @java.lang.Override + @JsonSetter(value = "req_body", nulls = Nulls.SKIP) + public _FinalStage reqBody(Optional reqBody) { + this.reqBody = reqBody; + return this; + } + + @java.lang.Override + public _FinalStage environmentId(String environmentId) { + this.environmentId = Optional.ofNullable(environmentId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) + public _FinalStage environmentId(Optional environmentId) { + this.environmentId = environmentId; + return this; + } + + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "ended_at", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + @java.lang.Override + public _FinalStage apiKeyId(String apiKeyId) { + this.apiKeyId = Optional.ofNullable(apiKeyId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) + public _FinalStage apiKeyId(Optional apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + @java.lang.Override + public AuditLogResponseData build() { + return new AuditLogResponseData( + actorType, + apiKeyId, + endedAt, + environmentId, + id, + method, + reqBody, + resourceId, + resourceIdString, + resourceName, + resourceType, + respBody, + respCode, + secondaryResource, + startedAt, + url, + userId, + userName, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/BillingCouponResponseData.java b/src/main/java/com/schematic/api/types/BillingCouponResponseData.java index 0829f1f..73c9fdc 100644 --- a/src/main/java/com/schematic/api/types/BillingCouponResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCouponResponseData.java @@ -50,6 +50,8 @@ public final class BillingCouponResponseData { private final Optional percentOff; + private final BillingProviderType providerType; + private final int timesRedeemed; private final Optional validFrom; @@ -72,6 +74,7 @@ private BillingCouponResponseData( Map metadata, String name, Optional percentOff, + BillingProviderType providerType, int timesRedeemed, Optional validFrom, Optional validUntil, @@ -89,6 +92,7 @@ private BillingCouponResponseData( this.metadata = metadata; this.name = name; this.percentOff = percentOff; + this.providerType = providerType; this.timesRedeemed = timesRedeemed; this.validFrom = validFrom; this.validUntil = validUntil; @@ -160,6 +164,11 @@ public Optional getPercentOff() { return percentOff; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("times_redeemed") public int getTimesRedeemed() { return timesRedeemed; @@ -200,6 +209,7 @@ private boolean equalTo(BillingCouponResponseData other) { && metadata.equals(other.metadata) && name.equals(other.name) && percentOff.equals(other.percentOff) + && providerType.equals(other.providerType) && timesRedeemed == other.timesRedeemed && validFrom.equals(other.validFrom) && validUntil.equals(other.validUntil); @@ -221,6 +231,7 @@ public int hashCode() { this.metadata, this.name, this.percentOff, + this.providerType, this.timesRedeemed, this.validFrom, this.validUntil); @@ -258,7 +269,11 @@ public interface IsActiveStage { } public interface NameStage { - TimesRedeemedStage name(@NotNull String name); + ProviderTypeStage name(@NotNull String name); + } + + public interface ProviderTypeStage { + TimesRedeemedStage providerType(@NotNull BillingProviderType providerType); } public interface TimesRedeemedStage { @@ -315,6 +330,7 @@ public static final class Builder IdStage, IsActiveStage, NameStage, + ProviderTypeStage, TimesRedeemedStage, _FinalStage { private String accountId; @@ -329,6 +345,8 @@ public static final class Builder private String name; + private BillingProviderType providerType; + private int timesRedeemed; private Optional validUntil = Optional.empty(); @@ -369,6 +387,7 @@ public Builder from(BillingCouponResponseData other) { metadata(other.getMetadata()); name(other.getName()); percentOff(other.getPercentOff()); + providerType(other.getProviderType()); timesRedeemed(other.getTimesRedeemed()); validFrom(other.getValidFrom()); validUntil(other.getValidUntil()); @@ -412,11 +431,18 @@ public NameStage isActive(boolean isActive) { @java.lang.Override @JsonSetter("name") - public TimesRedeemedStage name(@NotNull String name) { + public ProviderTypeStage name(@NotNull String name) { this.name = Objects.requireNonNull(name, "name must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public TimesRedeemedStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("times_redeemed") public _FinalStage timesRedeemed(int timesRedeemed) { @@ -568,6 +594,7 @@ public BillingCouponResponseData build() { metadata, name, percentOff, + providerType, timesRedeemed, validFrom, validUntil, diff --git a/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java index 79d696e..11f0628 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java @@ -36,9 +36,9 @@ public final class BillingCreditBundleResponseData { private final String creditName; - private final String expiryType; + private final BillingCreditExpiryType expiryType; - private final String expiryUnit; + private final BillingCreditExpiryUnit expiryUnit; private final Optional expiryUnitCount; @@ -56,7 +56,7 @@ public final class BillingCreditBundleResponseData { private final Optional singularName; - private final String status; + private final BillingCreditBundleStatus status; private final Optional unitPrice; @@ -72,8 +72,8 @@ private BillingCreditBundleResponseData( Optional creditIcon, String creditId, String creditName, - String expiryType, - String expiryUnit, + BillingCreditExpiryType expiryType, + BillingCreditExpiryUnit expiryUnit, Optional expiryUnitCount, boolean hasGrants, String id, @@ -82,7 +82,7 @@ private BillingCreditBundleResponseData( Optional price, Optional quantity, Optional singularName, - String status, + BillingCreditBundleStatus status, Optional unitPrice, OffsetDateTime updatedAt, Map additionalProperties) { @@ -145,12 +145,12 @@ public String getCreditName() { } @JsonProperty("expiry_type") - public String getExpiryType() { + public BillingCreditExpiryType getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public String getExpiryUnit() { + public BillingCreditExpiryUnit getExpiryUnit() { return expiryUnit; } @@ -195,7 +195,7 @@ public Optional getSingularName() { } @JsonProperty("status") - public String getStatus() { + public BillingCreditBundleStatus getStatus() { return status; } @@ -296,11 +296,11 @@ public interface CreditNameStage { } public interface ExpiryTypeStage { - ExpiryUnitStage expiryType(@NotNull String expiryType); + ExpiryUnitStage expiryType(@NotNull BillingCreditExpiryType expiryType); } public interface ExpiryUnitStage { - HasGrantsStage expiryUnit(@NotNull String expiryUnit); + HasGrantsStage expiryUnit(@NotNull BillingCreditExpiryUnit expiryUnit); } public interface HasGrantsStage { @@ -316,7 +316,7 @@ public interface NameStage { } public interface StatusStage { - UpdatedAtStage status(@NotNull String status); + UpdatedAtStage status(@NotNull BillingCreditBundleStatus status); } public interface UpdatedAtStage { @@ -385,9 +385,9 @@ public static final class Builder private String creditName; - private String expiryType; + private BillingCreditExpiryType expiryType; - private String expiryUnit; + private BillingCreditExpiryUnit expiryUnit; private boolean hasGrants; @@ -395,7 +395,7 @@ public static final class Builder private String name; - private String status; + private BillingCreditBundleStatus status; private OffsetDateTime updatedAt; @@ -477,14 +477,14 @@ public ExpiryTypeStage creditName(@NotNull String creditName) { @java.lang.Override @JsonSetter("expiry_type") - public ExpiryUnitStage expiryType(@NotNull String expiryType) { + public ExpiryUnitStage expiryType(@NotNull BillingCreditExpiryType expiryType) { this.expiryType = Objects.requireNonNull(expiryType, "expiryType must not be null"); return this; } @java.lang.Override @JsonSetter("expiry_unit") - public HasGrantsStage expiryUnit(@NotNull String expiryUnit) { + public HasGrantsStage expiryUnit(@NotNull BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Objects.requireNonNull(expiryUnit, "expiryUnit must not be null"); return this; } @@ -512,7 +512,7 @@ public StatusStage name(@NotNull String name) { @java.lang.Override @JsonSetter("status") - public UpdatedAtStage status(@NotNull String status) { + public UpdatedAtStage status(@NotNull BillingCreditBundleStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesRequestStatus.java b/src/main/java/com/schematic/api/types/BillingCreditBundleStatus.java similarity index 65% rename from src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesRequestStatus.java rename to src/main/java/com/schematic/api/types/BillingCreditBundleStatus.java index b1afd89..84b3c9b 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesRequestStatus.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleStatus.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListCreditBundlesRequestStatus { - public static final ListCreditBundlesRequestStatus INACTIVE = - new ListCreditBundlesRequestStatus(Value.INACTIVE, "inactive"); +public final class BillingCreditBundleStatus { + public static final BillingCreditBundleStatus INACTIVE = new BillingCreditBundleStatus(Value.INACTIVE, "inactive"); - public static final ListCreditBundlesRequestStatus ACTIVE = - new ListCreditBundlesRequestStatus(Value.ACTIVE, "active"); + public static final BillingCreditBundleStatus ACTIVE = new BillingCreditBundleStatus(Value.ACTIVE, "active"); private final Value value; private final String string; - ListCreditBundlesRequestStatus(Value value, String string) { + BillingCreditBundleStatus(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof ListCreditBundlesRequestStatus - && this.string.equals(((ListCreditBundlesRequestStatus) other).string)); + || (other instanceof BillingCreditBundleStatus + && this.string.equals(((BillingCreditBundleStatus) other).string)); } @java.lang.Override @@ -57,14 +55,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCreditBundlesRequestStatus valueOf(String value) { + public static BillingCreditBundleStatus valueOf(String value) { switch (value) { case "inactive": return INACTIVE; case "active": return ACTIVE; default: - return new ListCreditBundlesRequestStatus(Value.UNKNOWN, value); + return new BillingCreditBundleStatus(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditBundleView.java b/src/main/java/com/schematic/api/types/BillingCreditBundleView.java index 401c6b5..0584084 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditBundleView.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleView.java @@ -36,9 +36,9 @@ public final class BillingCreditBundleView { private final String creditName; - private final String expiryType; + private final BillingCreditExpiryType expiryType; - private final String expiryUnit; + private final BillingCreditExpiryUnit expiryUnit; private final Optional expiryUnitCount; @@ -56,7 +56,7 @@ public final class BillingCreditBundleView { private final Optional singularName; - private final String status; + private final BillingCreditBundleStatus status; private final Optional unitPrice; @@ -72,8 +72,8 @@ private BillingCreditBundleView( Optional creditIcon, String creditId, String creditName, - String expiryType, - String expiryUnit, + BillingCreditExpiryType expiryType, + BillingCreditExpiryUnit expiryUnit, Optional expiryUnitCount, boolean hasGrants, String id, @@ -82,7 +82,7 @@ private BillingCreditBundleView( Optional price, Optional quantity, Optional singularName, - String status, + BillingCreditBundleStatus status, Optional unitPrice, OffsetDateTime updatedAt, Map additionalProperties) { @@ -145,12 +145,12 @@ public String getCreditName() { } @JsonProperty("expiry_type") - public String getExpiryType() { + public BillingCreditExpiryType getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public String getExpiryUnit() { + public BillingCreditExpiryUnit getExpiryUnit() { return expiryUnit; } @@ -195,7 +195,7 @@ public Optional getSingularName() { } @JsonProperty("status") - public String getStatus() { + public BillingCreditBundleStatus getStatus() { return status; } @@ -296,11 +296,11 @@ public interface CreditNameStage { } public interface ExpiryTypeStage { - ExpiryUnitStage expiryType(@NotNull String expiryType); + ExpiryUnitStage expiryType(@NotNull BillingCreditExpiryType expiryType); } public interface ExpiryUnitStage { - HasGrantsStage expiryUnit(@NotNull String expiryUnit); + HasGrantsStage expiryUnit(@NotNull BillingCreditExpiryUnit expiryUnit); } public interface HasGrantsStage { @@ -316,7 +316,7 @@ public interface NameStage { } public interface StatusStage { - UpdatedAtStage status(@NotNull String status); + UpdatedAtStage status(@NotNull BillingCreditBundleStatus status); } public interface UpdatedAtStage { @@ -385,9 +385,9 @@ public static final class Builder private String creditName; - private String expiryType; + private BillingCreditExpiryType expiryType; - private String expiryUnit; + private BillingCreditExpiryUnit expiryUnit; private boolean hasGrants; @@ -395,7 +395,7 @@ public static final class Builder private String name; - private String status; + private BillingCreditBundleStatus status; private OffsetDateTime updatedAt; @@ -477,14 +477,14 @@ public ExpiryTypeStage creditName(@NotNull String creditName) { @java.lang.Override @JsonSetter("expiry_type") - public ExpiryUnitStage expiryType(@NotNull String expiryType) { + public ExpiryUnitStage expiryType(@NotNull BillingCreditExpiryType expiryType) { this.expiryType = Objects.requireNonNull(expiryType, "expiryType must not be null"); return this; } @java.lang.Override @JsonSetter("expiry_unit") - public HasGrantsStage expiryUnit(@NotNull String expiryUnit) { + public HasGrantsStage expiryUnit(@NotNull BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Objects.requireNonNull(expiryUnit, "expiryUnit must not be null"); return this; } @@ -512,7 +512,7 @@ public StatusStage name(@NotNull String name) { @java.lang.Override @JsonSetter("status") - public UpdatedAtStage status(@NotNull String status) { + public UpdatedAtStage status(@NotNull BillingCreditBundleStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditRequestBodyBurnStrategy.java b/src/main/java/com/schematic/api/types/BillingCreditBurnStrategy.java similarity index 64% rename from src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditRequestBodyBurnStrategy.java rename to src/main/java/com/schematic/api/types/BillingCreditBurnStrategy.java index 9a482b3..b4fbd10 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditRequestBodyBurnStrategy.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBurnStrategy.java @@ -1,31 +1,31 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateBillingCreditRequestBodyBurnStrategy { - public static final UpdateBillingCreditRequestBodyBurnStrategy PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT = - new UpdateBillingCreditRequestBodyBurnStrategy( +public final class BillingCreditBurnStrategy { + public static final BillingCreditBurnStrategy PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT = + new BillingCreditBurnStrategy( Value.PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT, "plan_first_then_credit_bundles_first_in_first_out"); - public static final UpdateBillingCreditRequestBodyBurnStrategy FIRST_IN_FIRST_OUT = - new UpdateBillingCreditRequestBodyBurnStrategy(Value.FIRST_IN_FIRST_OUT, "first_in_first_out"); + public static final BillingCreditBurnStrategy FIRST_IN_FIRST_OUT = + new BillingCreditBurnStrategy(Value.FIRST_IN_FIRST_OUT, "first_in_first_out"); - public static final UpdateBillingCreditRequestBodyBurnStrategy LAST_IN_FIRST_OUT = - new UpdateBillingCreditRequestBodyBurnStrategy(Value.LAST_IN_FIRST_OUT, "last_in_first_out"); + public static final BillingCreditBurnStrategy LAST_IN_FIRST_OUT = + new BillingCreditBurnStrategy(Value.LAST_IN_FIRST_OUT, "last_in_first_out"); - public static final UpdateBillingCreditRequestBodyBurnStrategy EXPIRATION_PRIORITY = - new UpdateBillingCreditRequestBodyBurnStrategy(Value.EXPIRATION_PRIORITY, "expiration_priority"); + public static final BillingCreditBurnStrategy EXPIRATION_PRIORITY = + new BillingCreditBurnStrategy(Value.EXPIRATION_PRIORITY, "expiration_priority"); private final Value value; private final String string; - UpdateBillingCreditRequestBodyBurnStrategy(Value value, String string) { + BillingCreditBurnStrategy(Value value, String string) { this.value = value; this.string = string; } @@ -43,8 +43,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UpdateBillingCreditRequestBodyBurnStrategy - && this.string.equals(((UpdateBillingCreditRequestBodyBurnStrategy) other).string)); + || (other instanceof BillingCreditBurnStrategy + && this.string.equals(((BillingCreditBurnStrategy) other).string)); } @java.lang.Override @@ -69,7 +69,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingCreditRequestBodyBurnStrategy valueOf(String value) { + public static BillingCreditBurnStrategy valueOf(String value) { switch (value) { case "plan_first_then_credit_bundles_first_in_first_out": return PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT; @@ -80,30 +80,30 @@ public static UpdateBillingCreditRequestBodyBurnStrategy valueOf(String value) { case "expiration_priority": return EXPIRATION_PRIORITY; default: - return new UpdateBillingCreditRequestBodyBurnStrategy(Value.UNKNOWN, value); + return new BillingCreditBurnStrategy(Value.UNKNOWN, value); } } public enum Value { - PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT, + EXPIRATION_PRIORITY, FIRST_IN_FIRST_OUT, LAST_IN_FIRST_OUT, - EXPIRATION_PRIORITY, + PLAN_FIRST_THEN_CREDIT_BUNDLES_FIRST_IN_FIRST_OUT, UNKNOWN } public interface Visitor { - T visitPlanFirstThenCreditBundlesFirstInFirstOut(); + T visitExpirationPriority(); T visitFirstInFirstOut(); T visitLastInFirstOut(); - T visitExpirationPriority(); + T visitPlanFirstThenCreditBundlesFirstInFirstOut(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryType.java b/src/main/java/com/schematic/api/types/BillingCreditExpiryType.java similarity index 62% rename from src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryType.java rename to src/main/java/com/schematic/api/types/BillingCreditExpiryType.java index 7499c3b..ecac86d 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryType.java +++ b/src/main/java/com/schematic/api/types/BillingCreditExpiryType.java @@ -6,27 +6,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreditGrantExpiryRequestBodyExpiryType { - public static final CreditGrantExpiryRequestBodyExpiryType END_OF_BILLING_PERIOD = - new CreditGrantExpiryRequestBodyExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); +public final class BillingCreditExpiryType { + public static final BillingCreditExpiryType END_OF_BILLING_PERIOD = + new BillingCreditExpiryType(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); - public static final CreditGrantExpiryRequestBodyExpiryType DURATION = - new CreditGrantExpiryRequestBodyExpiryType(Value.DURATION, "duration"); + public static final BillingCreditExpiryType DURATION = new BillingCreditExpiryType(Value.DURATION, "duration"); - public static final CreditGrantExpiryRequestBodyExpiryType END_OF_NEXT_BILLING_PERIOD = - new CreditGrantExpiryRequestBodyExpiryType(Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); + public static final BillingCreditExpiryType END_OF_NEXT_BILLING_PERIOD = + new BillingCreditExpiryType(Value.END_OF_NEXT_BILLING_PERIOD, "end_of_next_billing_period"); - public static final CreditGrantExpiryRequestBodyExpiryType NO_EXPIRY = - new CreditGrantExpiryRequestBodyExpiryType(Value.NO_EXPIRY, "no_expiry"); + public static final BillingCreditExpiryType NO_EXPIRY = new BillingCreditExpiryType(Value.NO_EXPIRY, "no_expiry"); - public static final CreditGrantExpiryRequestBodyExpiryType END_OF_TRIAL = - new CreditGrantExpiryRequestBodyExpiryType(Value.END_OF_TRIAL, "end_of_trial"); + public static final BillingCreditExpiryType END_OF_TRIAL = + new BillingCreditExpiryType(Value.END_OF_TRIAL, "end_of_trial"); private final Value value; private final String string; - CreditGrantExpiryRequestBodyExpiryType(Value value, String string) { + BillingCreditExpiryType(Value value, String string) { this.value = value; this.string = string; } @@ -44,8 +42,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreditGrantExpiryRequestBodyExpiryType - && this.string.equals(((CreditGrantExpiryRequestBodyExpiryType) other).string)); + || (other instanceof BillingCreditExpiryType + && this.string.equals(((BillingCreditExpiryType) other).string)); } @java.lang.Override @@ -72,7 +70,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreditGrantExpiryRequestBodyExpiryType valueOf(String value) { + public static BillingCreditExpiryType valueOf(String value) { switch (value) { case "end_of_billing_period": return END_OF_BILLING_PERIOD; @@ -85,35 +83,35 @@ public static CreditGrantExpiryRequestBodyExpiryType valueOf(String value) { case "end_of_trial": return END_OF_TRIAL; default: - return new CreditGrantExpiryRequestBodyExpiryType(Value.UNKNOWN, value); + return new BillingCreditExpiryType(Value.UNKNOWN, value); } } public enum Value { DURATION, - NO_EXPIRY, - - END_OF_TRIAL, - END_OF_BILLING_PERIOD, END_OF_NEXT_BILLING_PERIOD, + END_OF_TRIAL, + + NO_EXPIRY, + UNKNOWN } public interface Visitor { T visitDuration(); - T visitNoExpiry(); - - T visitEndOfTrial(); - T visitEndOfBillingPeriod(); T visitEndOfNextBillingPeriod(); + T visitEndOfTrial(); + + T visitNoExpiry(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryUnit.java b/src/main/java/com/schematic/api/types/BillingCreditExpiryUnit.java similarity index 65% rename from src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryUnit.java rename to src/main/java/com/schematic/api/types/BillingCreditExpiryUnit.java index f76a711..894f2f0 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyExpiryUnit.java +++ b/src/main/java/com/schematic/api/types/BillingCreditExpiryUnit.java @@ -6,18 +6,17 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreditGrantExpiryRequestBodyExpiryUnit { - public static final CreditGrantExpiryRequestBodyExpiryUnit BILLING_PERIODS = - new CreditGrantExpiryRequestBodyExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); +public final class BillingCreditExpiryUnit { + public static final BillingCreditExpiryUnit BILLING_PERIODS = + new BillingCreditExpiryUnit(Value.BILLING_PERIODS, "billing_periods"); - public static final CreditGrantExpiryRequestBodyExpiryUnit DAYS = - new CreditGrantExpiryRequestBodyExpiryUnit(Value.DAYS, "days"); + public static final BillingCreditExpiryUnit DAYS = new BillingCreditExpiryUnit(Value.DAYS, "days"); private final Value value; private final String string; - CreditGrantExpiryRequestBodyExpiryUnit(Value value, String string) { + BillingCreditExpiryUnit(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +34,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreditGrantExpiryRequestBodyExpiryUnit - && this.string.equals(((CreditGrantExpiryRequestBodyExpiryUnit) other).string)); + || (other instanceof BillingCreditExpiryUnit + && this.string.equals(((BillingCreditExpiryUnit) other).string)); } @java.lang.Override @@ -57,30 +56,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreditGrantExpiryRequestBodyExpiryUnit valueOf(String value) { + public static BillingCreditExpiryUnit valueOf(String value) { switch (value) { case "billing_periods": return BILLING_PERIODS; case "days": return DAYS; default: - return new CreditGrantExpiryRequestBodyExpiryUnit(Value.UNKNOWN, value); + return new BillingCreditExpiryUnit(Value.UNKNOWN, value); } } public enum Value { - DAYS, - BILLING_PERIODS, + DAYS, + UNKNOWN } public interface Visitor { - T visitDays(); - T visitBillingPeriods(); + T visitDays(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/CreditGrantDetailGrantReason.java b/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java similarity index 58% rename from src/main/java/com/schematic/api/types/CreditGrantDetailGrantReason.java rename to src/main/java/com/schematic/api/types/BillingCreditGrantReason.java index 11c9906..b5d12a8 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantDetailGrantReason.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantReason.java @@ -6,19 +6,21 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreditGrantDetailGrantReason { - public static final CreditGrantDetailGrantReason PURCHASED = - new CreditGrantDetailGrantReason(Value.PURCHASED, "purchased"); +public final class BillingCreditGrantReason { + public static final BillingCreditGrantReason PURCHASED = new BillingCreditGrantReason(Value.PURCHASED, "purchased"); - public static final CreditGrantDetailGrantReason PLAN = new CreditGrantDetailGrantReason(Value.PLAN, "plan"); + public static final BillingCreditGrantReason PLAN = new BillingCreditGrantReason(Value.PLAN, "plan"); - public static final CreditGrantDetailGrantReason FREE = new CreditGrantDetailGrantReason(Value.FREE, "free"); + public static final BillingCreditGrantReason BILLING_CREDIT_AUTO_TOPUP = + new BillingCreditGrantReason(Value.BILLING_CREDIT_AUTO_TOPUP, "billing_credit_auto_topup"); + + public static final BillingCreditGrantReason FREE = new BillingCreditGrantReason(Value.FREE, "free"); private final Value value; private final String string; - CreditGrantDetailGrantReason(Value value, String string) { + BillingCreditGrantReason(Value value, String string) { this.value = value; this.string = string; } @@ -36,8 +38,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreditGrantDetailGrantReason - && this.string.equals(((CreditGrantDetailGrantReason) other).string)); + || (other instanceof BillingCreditGrantReason + && this.string.equals(((BillingCreditGrantReason) other).string)); } @java.lang.Override @@ -51,6 +53,8 @@ public T visit(Visitor visitor) { return visitor.visitPurchased(); case PLAN: return visitor.visitPlan(); + case BILLING_CREDIT_AUTO_TOPUP: + return visitor.visitBillingCreditAutoTopup(); case FREE: return visitor.visitFree(); case UNKNOWN: @@ -60,20 +64,24 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreditGrantDetailGrantReason valueOf(String value) { + public static BillingCreditGrantReason valueOf(String value) { switch (value) { case "purchased": return PURCHASED; case "plan": return PLAN; + case "billing_credit_auto_topup": + return BILLING_CREDIT_AUTO_TOPUP; case "free": return FREE; default: - return new CreditGrantDetailGrantReason(Value.UNKNOWN, value); + return new BillingCreditGrantReason(Value.UNKNOWN, value); } } public enum Value { + BILLING_CREDIT_AUTO_TOPUP, + FREE, PLAN, @@ -84,6 +92,8 @@ public enum Value { } public interface Visitor { + T visitBillingCreditAutoTopup(); + T visitFree(); T visitPlan(); diff --git a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java index 7d9975c..022c3d6 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java @@ -14,6 +14,7 @@ import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -36,7 +37,7 @@ public final class BillingCreditGrantResponseData { private final Optional expiresAt; - private final String grantReason; + private final BillingCreditGrantReason grantReason; private final String id; @@ -52,15 +53,21 @@ public final class BillingCreditGrantResponseData { private final double quantityUsed; + private final boolean renewalEnabled; + + private final Optional renewalPeriod; + private final String sourceLabel; + private final Optional> transfers; + private final OffsetDateTime updatedAt; private final Optional validFrom; private final Optional zeroedOutDate; - private final Optional zeroedOutReason; + private final Optional zeroedOutReason; private final Map additionalProperties; @@ -72,7 +79,7 @@ private BillingCreditGrantResponseData( String creditId, String creditName, Optional expiresAt, - String grantReason, + BillingCreditGrantReason grantReason, String id, Optional planId, Optional planName, @@ -80,11 +87,14 @@ private BillingCreditGrantResponseData( int quantity, double quantityRemaining, double quantityUsed, + boolean renewalEnabled, + Optional renewalPeriod, String sourceLabel, + Optional> transfers, OffsetDateTime updatedAt, Optional validFrom, Optional zeroedOutDate, - Optional zeroedOutReason, + Optional zeroedOutReason, Map additionalProperties) { this.companyId = companyId; this.companyName = companyName; @@ -101,7 +111,10 @@ private BillingCreditGrantResponseData( this.quantity = quantity; this.quantityRemaining = quantityRemaining; this.quantityUsed = quantityUsed; + this.renewalEnabled = renewalEnabled; + this.renewalPeriod = renewalPeriod; this.sourceLabel = sourceLabel; + this.transfers = transfers; this.updatedAt = updatedAt; this.validFrom = validFrom; this.zeroedOutDate = zeroedOutDate; @@ -145,7 +158,7 @@ public Optional getExpiresAt() { } @JsonProperty("grant_reason") - public String getGrantReason() { + public BillingCreditGrantReason getGrantReason() { return grantReason; } @@ -184,11 +197,26 @@ public double getQuantityUsed() { return quantityUsed; } + @JsonProperty("renewal_enabled") + public boolean getRenewalEnabled() { + return renewalEnabled; + } + + @JsonProperty("renewal_period") + public Optional getRenewalPeriod() { + return renewalPeriod; + } + @JsonProperty("source_label") public String getSourceLabel() { return sourceLabel; } + @JsonProperty("transfers") + public Optional> getTransfers() { + return transfers; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -205,7 +233,7 @@ public Optional getZeroedOutDate() { } @JsonProperty("zeroed_out_reason") - public Optional getZeroedOutReason() { + public Optional getZeroedOutReason() { return zeroedOutReason; } @@ -236,7 +264,10 @@ private boolean equalTo(BillingCreditGrantResponseData other) { && quantity == other.quantity && quantityRemaining == other.quantityRemaining && quantityUsed == other.quantityUsed + && renewalEnabled == other.renewalEnabled + && renewalPeriod.equals(other.renewalPeriod) && sourceLabel.equals(other.sourceLabel) + && transfers.equals(other.transfers) && updatedAt.equals(other.updatedAt) && validFrom.equals(other.validFrom) && zeroedOutDate.equals(other.zeroedOutDate) @@ -261,7 +292,10 @@ public int hashCode() { this.quantity, this.quantityRemaining, this.quantityUsed, + this.renewalEnabled, + this.renewalPeriod, this.sourceLabel, + this.transfers, this.updatedAt, this.validFrom, this.zeroedOutDate, @@ -300,7 +334,7 @@ public interface CreditNameStage { } public interface GrantReasonStage { - IdStage grantReason(@NotNull String grantReason); + IdStage grantReason(@NotNull BillingCreditGrantReason grantReason); } public interface IdStage { @@ -316,7 +350,11 @@ public interface QuantityRemainingStage { } public interface QuantityUsedStage { - SourceLabelStage quantityUsed(double quantityUsed); + RenewalEnabledStage quantityUsed(double quantityUsed); + } + + public interface RenewalEnabledStage { + SourceLabelStage renewalEnabled(boolean renewalEnabled); } public interface SourceLabelStage { @@ -350,6 +388,14 @@ public interface _FinalStage { _FinalStage price(BillingPriceResponseData price); + _FinalStage renewalPeriod(Optional renewalPeriod); + + _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod); + + _FinalStage transfers(Optional> transfers); + + _FinalStage transfers(List transfers); + _FinalStage validFrom(Optional validFrom); _FinalStage validFrom(OffsetDateTime validFrom); @@ -358,9 +404,9 @@ public interface _FinalStage { _FinalStage zeroedOutDate(OffsetDateTime zeroedOutDate); - _FinalStage zeroedOutReason(Optional zeroedOutReason); + _FinalStage zeroedOutReason(Optional zeroedOutReason); - _FinalStage zeroedOutReason(String zeroedOutReason); + _FinalStage zeroedOutReason(BillingCreditGrantZeroedOutReason zeroedOutReason); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -375,6 +421,7 @@ public static final class Builder QuantityStage, QuantityRemainingStage, QuantityUsedStage, + RenewalEnabledStage, SourceLabelStage, UpdatedAtStage, _FinalStage { @@ -388,7 +435,7 @@ public static final class Builder private String creditName; - private String grantReason; + private BillingCreditGrantReason grantReason; private String id; @@ -398,16 +445,22 @@ public static final class Builder private double quantityUsed; + private boolean renewalEnabled; + private String sourceLabel; private OffsetDateTime updatedAt; - private Optional zeroedOutReason = Optional.empty(); + private Optional zeroedOutReason = Optional.empty(); private Optional zeroedOutDate = Optional.empty(); private Optional validFrom = Optional.empty(); + private Optional> transfers = Optional.empty(); + + private Optional renewalPeriod = Optional.empty(); + private Optional price = Optional.empty(); private Optional planName = Optional.empty(); @@ -440,7 +493,10 @@ public Builder from(BillingCreditGrantResponseData other) { quantity(other.getQuantity()); quantityRemaining(other.getQuantityRemaining()); quantityUsed(other.getQuantityUsed()); + renewalEnabled(other.getRenewalEnabled()); + renewalPeriod(other.getRenewalPeriod()); sourceLabel(other.getSourceLabel()); + transfers(other.getTransfers()); updatedAt(other.getUpdatedAt()); validFrom(other.getValidFrom()); zeroedOutDate(other.getZeroedOutDate()); @@ -485,7 +541,7 @@ public GrantReasonStage creditName(@NotNull String creditName) { @java.lang.Override @JsonSetter("grant_reason") - public IdStage grantReason(@NotNull String grantReason) { + public IdStage grantReason(@NotNull BillingCreditGrantReason grantReason) { this.grantReason = Objects.requireNonNull(grantReason, "grantReason must not be null"); return this; } @@ -513,11 +569,18 @@ public QuantityUsedStage quantityRemaining(double quantityRemaining) { @java.lang.Override @JsonSetter("quantity_used") - public SourceLabelStage quantityUsed(double quantityUsed) { + public RenewalEnabledStage quantityUsed(double quantityUsed) { this.quantityUsed = quantityUsed; return this; } + @java.lang.Override + @JsonSetter("renewal_enabled") + public SourceLabelStage renewalEnabled(boolean renewalEnabled) { + this.renewalEnabled = renewalEnabled; + return this; + } + @java.lang.Override @JsonSetter("source_label") public UpdatedAtStage sourceLabel(@NotNull String sourceLabel) { @@ -533,14 +596,14 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { } @java.lang.Override - public _FinalStage zeroedOutReason(String zeroedOutReason) { + public _FinalStage zeroedOutReason(BillingCreditGrantZeroedOutReason zeroedOutReason) { this.zeroedOutReason = Optional.ofNullable(zeroedOutReason); return this; } @java.lang.Override @JsonSetter(value = "zeroed_out_reason", nulls = Nulls.SKIP) - public _FinalStage zeroedOutReason(Optional zeroedOutReason) { + public _FinalStage zeroedOutReason(Optional zeroedOutReason) { this.zeroedOutReason = zeroedOutReason; return this; } @@ -571,6 +634,32 @@ public _FinalStage validFrom(Optional validFrom) { return this; } + @java.lang.Override + public _FinalStage transfers(List transfers) { + this.transfers = Optional.ofNullable(transfers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transfers", nulls = Nulls.SKIP) + public _FinalStage transfers(Optional> transfers) { + this.transfers = transfers; + return this; + } + + @java.lang.Override + public _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod) { + this.renewalPeriod = Optional.ofNullable(renewalPeriod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_period", nulls = Nulls.SKIP) + public _FinalStage renewalPeriod(Optional renewalPeriod) { + this.renewalPeriod = renewalPeriod; + return this; + } + @java.lang.Override public _FinalStage price(BillingPriceResponseData price) { this.price = Optional.ofNullable(price); @@ -654,7 +743,10 @@ public BillingCreditGrantResponseData build() { quantity, quantityRemaining, quantityUsed, + renewalEnabled, + renewalPeriod, sourceLabel, + transfers, updatedAt, validFrom, zeroedOutDate, diff --git a/src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantRequestBodyReason.java b/src/main/java/com/schematic/api/types/BillingCreditGrantZeroedOutReason.java similarity index 63% rename from src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantRequestBodyReason.java rename to src/main/java/com/schematic/api/types/BillingCreditGrantZeroedOutReason.java index 74a047a..08ec797 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantRequestBodyReason.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantZeroedOutReason.java @@ -1,29 +1,29 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ZeroOutGrantRequestBodyReason { - public static final ZeroOutGrantRequestBodyReason PLAN_CHANGE = - new ZeroOutGrantRequestBodyReason(Value.PLAN_CHANGE, "plan_change"); +public final class BillingCreditGrantZeroedOutReason { + public static final BillingCreditGrantZeroedOutReason PLAN_CHANGE = + new BillingCreditGrantZeroedOutReason(Value.PLAN_CHANGE, "plan_change"); - public static final ZeroOutGrantRequestBodyReason PLAN_PERIOD_RESET = - new ZeroOutGrantRequestBodyReason(Value.PLAN_PERIOD_RESET, "plan_period_reset"); + public static final BillingCreditGrantZeroedOutReason EXPIRED = + new BillingCreditGrantZeroedOutReason(Value.EXPIRED, "expired"); - public static final ZeroOutGrantRequestBodyReason EXPIRED = - new ZeroOutGrantRequestBodyReason(Value.EXPIRED, "expired"); + public static final BillingCreditGrantZeroedOutReason PLAN_PERIOD_RESET = + new BillingCreditGrantZeroedOutReason(Value.PLAN_PERIOD_RESET, "plan_period_reset"); - public static final ZeroOutGrantRequestBodyReason MANUAL = - new ZeroOutGrantRequestBodyReason(Value.MANUAL, "manual"); + public static final BillingCreditGrantZeroedOutReason MANUAL = + new BillingCreditGrantZeroedOutReason(Value.MANUAL, "manual"); private final Value value; private final String string; - ZeroOutGrantRequestBodyReason(Value value, String string) { + BillingCreditGrantZeroedOutReason(Value value, String string) { this.value = value; this.string = string; } @@ -41,8 +41,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof ZeroOutGrantRequestBodyReason - && this.string.equals(((ZeroOutGrantRequestBodyReason) other).string)); + || (other instanceof BillingCreditGrantZeroedOutReason + && this.string.equals(((BillingCreditGrantZeroedOutReason) other).string)); } @java.lang.Override @@ -54,10 +54,10 @@ public T visit(Visitor visitor) { switch (value) { case PLAN_CHANGE: return visitor.visitPlanChange(); - case PLAN_PERIOD_RESET: - return visitor.visitPlanPeriodReset(); case EXPIRED: return visitor.visitExpired(); + case PLAN_PERIOD_RESET: + return visitor.visitPlanPeriodReset(); case MANUAL: return visitor.visitManual(); case UNKNOWN: @@ -67,41 +67,41 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ZeroOutGrantRequestBodyReason valueOf(String value) { + public static BillingCreditGrantZeroedOutReason valueOf(String value) { switch (value) { case "plan_change": return PLAN_CHANGE; - case "plan_period_reset": - return PLAN_PERIOD_RESET; case "expired": return EXPIRED; + case "plan_period_reset": + return PLAN_PERIOD_RESET; case "manual": return MANUAL; default: - return new ZeroOutGrantRequestBodyReason(Value.UNKNOWN, value); + return new BillingCreditGrantZeroedOutReason(Value.UNKNOWN, value); } } public enum Value { - PLAN_CHANGE, + EXPIRED, MANUAL, - PLAN_PERIOD_RESET, + PLAN_CHANGE, - EXPIRED, + PLAN_PERIOD_RESET, UNKNOWN } public interface Visitor { - T visitPlanChange(); + T visitExpired(); T visitManual(); - T visitPlanPeriodReset(); + T visitPlanChange(); - T visitExpired(); + T visitPlanPeriodReset(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/schematic/api/types/BillingCreditResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditResponseData.java index 5ae6253..f4a012d 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditResponseData.java @@ -22,15 +22,15 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingCreditResponseData.Builder.class) public final class BillingCreditResponseData { - private final String burnStrategy; + private final BillingCreditBurnStrategy burnStrategy; private final OffsetDateTime createdAt; - private final String defaultExpiryUnit; + private final BillingCreditExpiryUnit defaultExpiryUnit; private final Optional defaultExpiryUnitCount; - private final String defaultRolloverPolicy; + private final BillingCreditRolloverPolicy defaultRolloverPolicy; private final String description; @@ -53,11 +53,11 @@ public final class BillingCreditResponseData { private final Map additionalProperties; private BillingCreditResponseData( - String burnStrategy, + BillingCreditBurnStrategy burnStrategy, OffsetDateTime createdAt, - String defaultExpiryUnit, + BillingCreditExpiryUnit defaultExpiryUnit, Optional defaultExpiryUnitCount, - String defaultRolloverPolicy, + BillingCreditRolloverPolicy defaultRolloverPolicy, String description, Optional icon, String id, @@ -86,7 +86,7 @@ private BillingCreditResponseData( } @JsonProperty("burn_strategy") - public String getBurnStrategy() { + public BillingCreditBurnStrategy getBurnStrategy() { return burnStrategy; } @@ -96,7 +96,7 @@ public OffsetDateTime getCreatedAt() { } @JsonProperty("default_expiry_unit") - public String getDefaultExpiryUnit() { + public BillingCreditExpiryUnit getDefaultExpiryUnit() { return defaultExpiryUnit; } @@ -106,7 +106,7 @@ public Optional getDefaultExpiryUnitCount() { } @JsonProperty("default_rollover_policy") - public String getDefaultRolloverPolicy() { + public BillingCreditRolloverPolicy getDefaultRolloverPolicy() { return defaultRolloverPolicy; } @@ -212,7 +212,7 @@ public static BurnStrategyStage builder() { } public interface BurnStrategyStage { - CreatedAtStage burnStrategy(@NotNull String burnStrategy); + CreatedAtStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy); Builder from(BillingCreditResponseData other); } @@ -222,11 +222,11 @@ public interface CreatedAtStage { } public interface DefaultExpiryUnitStage { - DefaultRolloverPolicyStage defaultExpiryUnit(@NotNull String defaultExpiryUnit); + DefaultRolloverPolicyStage defaultExpiryUnit(@NotNull BillingCreditExpiryUnit defaultExpiryUnit); } public interface DefaultRolloverPolicyStage { - DescriptionStage defaultRolloverPolicy(@NotNull String defaultRolloverPolicy); + DescriptionStage defaultRolloverPolicy(@NotNull BillingCreditRolloverPolicy defaultRolloverPolicy); } public interface DescriptionStage { @@ -284,13 +284,13 @@ public static final class Builder NameStage, UpdatedAtStage, _FinalStage { - private String burnStrategy; + private BillingCreditBurnStrategy burnStrategy; private OffsetDateTime createdAt; - private String defaultExpiryUnit; + private BillingCreditExpiryUnit defaultExpiryUnit; - private String defaultRolloverPolicy; + private BillingCreditRolloverPolicy defaultRolloverPolicy; private String description; @@ -338,7 +338,7 @@ public Builder from(BillingCreditResponseData other) { @java.lang.Override @JsonSetter("burn_strategy") - public CreatedAtStage burnStrategy(@NotNull String burnStrategy) { + public CreatedAtStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy) { this.burnStrategy = Objects.requireNonNull(burnStrategy, "burnStrategy must not be null"); return this; } @@ -352,14 +352,14 @@ public DefaultExpiryUnitStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("default_expiry_unit") - public DefaultRolloverPolicyStage defaultExpiryUnit(@NotNull String defaultExpiryUnit) { + public DefaultRolloverPolicyStage defaultExpiryUnit(@NotNull BillingCreditExpiryUnit defaultExpiryUnit) { this.defaultExpiryUnit = Objects.requireNonNull(defaultExpiryUnit, "defaultExpiryUnit must not be null"); return this; } @java.lang.Override @JsonSetter("default_rollover_policy") - public DescriptionStage defaultRolloverPolicy(@NotNull String defaultRolloverPolicy) { + public DescriptionStage defaultRolloverPolicy(@NotNull BillingCreditRolloverPolicy defaultRolloverPolicy) { this.defaultRolloverPolicy = Objects.requireNonNull(defaultRolloverPolicy, "defaultRolloverPolicy must not be null"); return this; diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditRequestBodyDefaultRolloverPolicy.java b/src/main/java/com/schematic/api/types/BillingCreditRolloverPolicy.java similarity index 58% rename from src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditRequestBodyDefaultRolloverPolicy.java rename to src/main/java/com/schematic/api/types/BillingCreditRolloverPolicy.java index dab2b2e..9575bb1 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditRequestBodyDefaultRolloverPolicy.java +++ b/src/main/java/com/schematic/api/types/BillingCreditRolloverPolicy.java @@ -1,26 +1,24 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateBillingCreditRequestBodyDefaultRolloverPolicy { - public static final UpdateBillingCreditRequestBodyDefaultRolloverPolicy EXPIRE = - new UpdateBillingCreditRequestBodyDefaultRolloverPolicy(Value.EXPIRE, "expire"); +public final class BillingCreditRolloverPolicy { + public static final BillingCreditRolloverPolicy EXPIRE = new BillingCreditRolloverPolicy(Value.EXPIRE, "expire"); - public static final UpdateBillingCreditRequestBodyDefaultRolloverPolicy ROLLOVER = - new UpdateBillingCreditRequestBodyDefaultRolloverPolicy(Value.ROLLOVER, "rollover"); + public static final BillingCreditRolloverPolicy ROLLOVER = + new BillingCreditRolloverPolicy(Value.ROLLOVER, "rollover"); - public static final UpdateBillingCreditRequestBodyDefaultRolloverPolicy NONE = - new UpdateBillingCreditRequestBodyDefaultRolloverPolicy(Value.NONE, "none"); + public static final BillingCreditRolloverPolicy NONE = new BillingCreditRolloverPolicy(Value.NONE, "none"); private final Value value; private final String string; - UpdateBillingCreditRequestBodyDefaultRolloverPolicy(Value value, String string) { + BillingCreditRolloverPolicy(Value value, String string) { this.value = value; this.string = string; } @@ -38,8 +36,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UpdateBillingCreditRequestBodyDefaultRolloverPolicy - && this.string.equals(((UpdateBillingCreditRequestBodyDefaultRolloverPolicy) other).string)); + || (other instanceof BillingCreditRolloverPolicy + && this.string.equals(((BillingCreditRolloverPolicy) other).string)); } @java.lang.Override @@ -62,7 +60,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingCreditRequestBodyDefaultRolloverPolicy valueOf(String value) { + public static BillingCreditRolloverPolicy valueOf(String value) { switch (value) { case "expire": return EXPIRE; @@ -71,27 +69,27 @@ public static UpdateBillingCreditRequestBodyDefaultRolloverPolicy valueOf(String case "none": return NONE; default: - return new UpdateBillingCreditRequestBodyDefaultRolloverPolicy(Value.UNKNOWN, value); + return new BillingCreditRolloverPolicy(Value.UNKNOWN, value); } } public enum Value { + EXPIRE, + NONE, ROLLOVER, - EXPIRE, - UNKNOWN } public interface Visitor { + T visitExpire(); + T visitNone(); T visitRollover(); - T visitExpire(); - T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java b/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java index 7743261..cf4a6dd 100644 --- a/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java @@ -30,12 +30,12 @@ public final class BillingCustomerResponseData { private final String externalId; - private final boolean failedToImport; - private final String id; private final String name; + private final BillingProviderType providerType; + private final OffsetDateTime updatedAt; private final Map additionalProperties; @@ -45,18 +45,18 @@ private BillingCustomerResponseData( Optional deletedAt, String email, String externalId, - boolean failedToImport, String id, String name, + BillingProviderType providerType, OffsetDateTime updatedAt, Map additionalProperties) { this.companyId = companyId; this.deletedAt = deletedAt; this.email = email; this.externalId = externalId; - this.failedToImport = failedToImport; this.id = id; this.name = name; + this.providerType = providerType; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -81,11 +81,6 @@ public String getExternalId() { return externalId; } - @JsonProperty("failed_to_import") - public boolean getFailedToImport() { - return failedToImport; - } - @JsonProperty("id") public String getId() { return id; @@ -96,6 +91,11 @@ public String getName() { return name; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -117,9 +117,9 @@ private boolean equalTo(BillingCustomerResponseData other) { && deletedAt.equals(other.deletedAt) && email.equals(other.email) && externalId.equals(other.externalId) - && failedToImport == other.failedToImport && id.equals(other.id) && name.equals(other.name) + && providerType.equals(other.providerType) && updatedAt.equals(other.updatedAt); } @@ -130,9 +130,9 @@ public int hashCode() { this.deletedAt, this.email, this.externalId, - this.failedToImport, this.id, this.name, + this.providerType, this.updatedAt); } @@ -152,11 +152,7 @@ public interface EmailStage { } public interface ExternalIdStage { - FailedToImportStage externalId(@NotNull String externalId); - } - - public interface FailedToImportStage { - IdStage failedToImport(boolean failedToImport); + IdStage externalId(@NotNull String externalId); } public interface IdStage { @@ -164,7 +160,11 @@ public interface IdStage { } public interface NameStage { - UpdatedAtStage name(@NotNull String name); + ProviderTypeStage name(@NotNull String name); + } + + public interface ProviderTypeStage { + UpdatedAtStage providerType(@NotNull BillingProviderType providerType); } public interface UpdatedAtStage { @@ -185,23 +185,17 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements EmailStage, - ExternalIdStage, - FailedToImportStage, - IdStage, - NameStage, - UpdatedAtStage, - _FinalStage { + implements EmailStage, ExternalIdStage, IdStage, NameStage, ProviderTypeStage, UpdatedAtStage, _FinalStage { private String email; private String externalId; - private boolean failedToImport; - private String id; private String name; + private BillingProviderType providerType; + private OffsetDateTime updatedAt; private Optional deletedAt = Optional.empty(); @@ -219,9 +213,9 @@ public Builder from(BillingCustomerResponseData other) { deletedAt(other.getDeletedAt()); email(other.getEmail()); externalId(other.getExternalId()); - failedToImport(other.getFailedToImport()); id(other.getId()); name(other.getName()); + providerType(other.getProviderType()); updatedAt(other.getUpdatedAt()); return this; } @@ -235,18 +229,11 @@ public ExternalIdStage email(@NotNull String email) { @java.lang.Override @JsonSetter("external_id") - public FailedToImportStage externalId(@NotNull String externalId) { + public IdStage externalId(@NotNull String externalId) { this.externalId = Objects.requireNonNull(externalId, "externalId must not be null"); return this; } - @java.lang.Override - @JsonSetter("failed_to_import") - public IdStage failedToImport(boolean failedToImport) { - this.failedToImport = failedToImport; - return this; - } - @java.lang.Override @JsonSetter("id") public NameStage id(@NotNull String id) { @@ -256,11 +243,18 @@ public NameStage id(@NotNull String id) { @java.lang.Override @JsonSetter("name") - public UpdatedAtStage name(@NotNull String name) { + public ProviderTypeStage name(@NotNull String name) { this.name = Objects.requireNonNull(name, "name must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public UpdatedAtStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -297,7 +291,7 @@ public _FinalStage companyId(Optional companyId) { @java.lang.Override public BillingCustomerResponseData build() { return new BillingCustomerResponseData( - companyId, deletedAt, email, externalId, failedToImport, id, name, updatedAt, additionalProperties); + companyId, deletedAt, email, externalId, id, name, providerType, updatedAt, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java b/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java index f89fb4c..8461fdc 100644 --- a/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java @@ -32,12 +32,12 @@ public final class BillingCustomerWithSubscriptionsResponseData { private final String externalId; - private final boolean failedToImport; - private final String id; private final String name; + private final BillingProviderType providerType; + private final List subscriptions; private final OffsetDateTime updatedAt; @@ -49,9 +49,9 @@ private BillingCustomerWithSubscriptionsResponseData( Optional deletedAt, String email, String externalId, - boolean failedToImport, String id, String name, + BillingProviderType providerType, List subscriptions, OffsetDateTime updatedAt, Map additionalProperties) { @@ -59,9 +59,9 @@ private BillingCustomerWithSubscriptionsResponseData( this.deletedAt = deletedAt; this.email = email; this.externalId = externalId; - this.failedToImport = failedToImport; this.id = id; this.name = name; + this.providerType = providerType; this.subscriptions = subscriptions; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -87,11 +87,6 @@ public String getExternalId() { return externalId; } - @JsonProperty("failed_to_import") - public boolean getFailedToImport() { - return failedToImport; - } - @JsonProperty("id") public String getId() { return id; @@ -102,6 +97,11 @@ public String getName() { return name; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("subscriptions") public List getSubscriptions() { return subscriptions; @@ -129,9 +129,9 @@ private boolean equalTo(BillingCustomerWithSubscriptionsResponseData other) { && deletedAt.equals(other.deletedAt) && email.equals(other.email) && externalId.equals(other.externalId) - && failedToImport == other.failedToImport && id.equals(other.id) && name.equals(other.name) + && providerType.equals(other.providerType) && subscriptions.equals(other.subscriptions) && updatedAt.equals(other.updatedAt); } @@ -143,9 +143,9 @@ public int hashCode() { this.deletedAt, this.email, this.externalId, - this.failedToImport, this.id, this.name, + this.providerType, this.subscriptions, this.updatedAt); } @@ -166,11 +166,7 @@ public interface EmailStage { } public interface ExternalIdStage { - FailedToImportStage externalId(@NotNull String externalId); - } - - public interface FailedToImportStage { - IdStage failedToImport(boolean failedToImport); + IdStage externalId(@NotNull String externalId); } public interface IdStage { @@ -178,7 +174,11 @@ public interface IdStage { } public interface NameStage { - UpdatedAtStage name(@NotNull String name); + ProviderTypeStage name(@NotNull String name); + } + + public interface ProviderTypeStage { + UpdatedAtStage providerType(@NotNull BillingProviderType providerType); } public interface UpdatedAtStage { @@ -205,23 +205,17 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements EmailStage, - ExternalIdStage, - FailedToImportStage, - IdStage, - NameStage, - UpdatedAtStage, - _FinalStage { + implements EmailStage, ExternalIdStage, IdStage, NameStage, ProviderTypeStage, UpdatedAtStage, _FinalStage { private String email; private String externalId; - private boolean failedToImport; - private String id; private String name; + private BillingProviderType providerType; + private OffsetDateTime updatedAt; private List subscriptions = new ArrayList<>(); @@ -241,9 +235,9 @@ public Builder from(BillingCustomerWithSubscriptionsResponseData other) { deletedAt(other.getDeletedAt()); email(other.getEmail()); externalId(other.getExternalId()); - failedToImport(other.getFailedToImport()); id(other.getId()); name(other.getName()); + providerType(other.getProviderType()); subscriptions(other.getSubscriptions()); updatedAt(other.getUpdatedAt()); return this; @@ -258,18 +252,11 @@ public ExternalIdStage email(@NotNull String email) { @java.lang.Override @JsonSetter("external_id") - public FailedToImportStage externalId(@NotNull String externalId) { + public IdStage externalId(@NotNull String externalId) { this.externalId = Objects.requireNonNull(externalId, "externalId must not be null"); return this; } - @java.lang.Override - @JsonSetter("failed_to_import") - public IdStage failedToImport(boolean failedToImport) { - this.failedToImport = failedToImport; - return this; - } - @java.lang.Override @JsonSetter("id") public NameStage id(@NotNull String id) { @@ -279,11 +266,18 @@ public NameStage id(@NotNull String id) { @java.lang.Override @JsonSetter("name") - public UpdatedAtStage name(@NotNull String name) { + public ProviderTypeStage name(@NotNull String name) { this.name = Objects.requireNonNull(name, "name must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public UpdatedAtStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -348,9 +342,9 @@ public BillingCustomerWithSubscriptionsResponseData build() { deletedAt, email, externalId, - failedToImport, id, name, + providerType, subscriptions, updatedAt, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/BillingMeterResponseData.java b/src/main/java/com/schematic/api/types/BillingMeterResponseData.java index 3bb90ff..e0d2fe4 100644 --- a/src/main/java/com/schematic/api/types/BillingMeterResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingMeterResponseData.java @@ -29,6 +29,8 @@ public final class BillingMeterResponseData { private final String id; + private final BillingProviderType providerType; + private final Map additionalProperties; private BillingMeterResponseData( @@ -37,12 +39,14 @@ private BillingMeterResponseData( String eventPayloadKey, String externalPriceId, String id, + BillingProviderType providerType, Map additionalProperties) { this.dispalyName = dispalyName; this.eventName = eventName; this.eventPayloadKey = eventPayloadKey; this.externalPriceId = externalPriceId; this.id = id; + this.providerType = providerType; this.additionalProperties = additionalProperties; } @@ -71,6 +75,11 @@ public String getId() { return id; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -87,12 +96,19 @@ private boolean equalTo(BillingMeterResponseData other) { && eventName.equals(other.eventName) && eventPayloadKey.equals(other.eventPayloadKey) && externalPriceId.equals(other.externalPriceId) - && id.equals(other.id); + && id.equals(other.id) + && providerType.equals(other.providerType); } @java.lang.Override public int hashCode() { - return Objects.hash(this.dispalyName, this.eventName, this.eventPayloadKey, this.externalPriceId, this.id); + return Objects.hash( + this.dispalyName, + this.eventName, + this.eventPayloadKey, + this.externalPriceId, + this.id, + this.providerType); } @java.lang.Override @@ -123,7 +139,11 @@ public interface ExternalPriceIdStage { } public interface IdStage { - _FinalStage id(@NotNull String id); + ProviderTypeStage id(@NotNull String id); + } + + public interface ProviderTypeStage { + _FinalStage providerType(@NotNull BillingProviderType providerType); } public interface _FinalStage { @@ -137,6 +157,7 @@ public static final class Builder EventPayloadKeyStage, ExternalPriceIdStage, IdStage, + ProviderTypeStage, _FinalStage { private String dispalyName; @@ -148,6 +169,8 @@ public static final class Builder private String id; + private BillingProviderType providerType; + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -160,6 +183,7 @@ public Builder from(BillingMeterResponseData other) { eventPayloadKey(other.getEventPayloadKey()); externalPriceId(other.getExternalPriceId()); id(other.getId()); + providerType(other.getProviderType()); return this; } @@ -193,15 +217,22 @@ public IdStage externalPriceId(@NotNull String externalPriceId) { @java.lang.Override @JsonSetter("id") - public _FinalStage id(@NotNull String id) { + public ProviderTypeStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public _FinalStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override public BillingMeterResponseData build() { return new BillingMeterResponseData( - dispalyName, eventName, eventPayloadKey, externalPriceId, id, additionalProperties); + dispalyName, eventName, eventPayloadKey, externalPriceId, id, providerType, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetCadence.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetCadence.java similarity index 62% rename from src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetCadence.java rename to src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetCadence.java index f3d9c89..f6b0b88 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetCadence.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetCadence.java @@ -6,24 +6,24 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreditGrantExpiryRequestBodyResetCadence { - public static final CreditGrantExpiryRequestBodyResetCadence YEARLY = - new CreditGrantExpiryRequestBodyResetCadence(Value.YEARLY, "yearly"); +public final class BillingPlanCreditGrantResetCadence { + public static final BillingPlanCreditGrantResetCadence YEARLY = + new BillingPlanCreditGrantResetCadence(Value.YEARLY, "yearly"); - public static final CreditGrantExpiryRequestBodyResetCadence MONTHLY = - new CreditGrantExpiryRequestBodyResetCadence(Value.MONTHLY, "monthly"); + public static final BillingPlanCreditGrantResetCadence MONTHLY = + new BillingPlanCreditGrantResetCadence(Value.MONTHLY, "monthly"); - public static final CreditGrantExpiryRequestBodyResetCadence DAILY = - new CreditGrantExpiryRequestBodyResetCadence(Value.DAILY, "daily"); + public static final BillingPlanCreditGrantResetCadence DAILY = + new BillingPlanCreditGrantResetCadence(Value.DAILY, "daily"); - public static final CreditGrantExpiryRequestBodyResetCadence WEEKLY = - new CreditGrantExpiryRequestBodyResetCadence(Value.WEEKLY, "weekly"); + public static final BillingPlanCreditGrantResetCadence WEEKLY = + new BillingPlanCreditGrantResetCadence(Value.WEEKLY, "weekly"); private final Value value; private final String string; - CreditGrantExpiryRequestBodyResetCadence(Value value, String string) { + BillingPlanCreditGrantResetCadence(Value value, String string) { this.value = value; this.string = string; } @@ -41,8 +41,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreditGrantExpiryRequestBodyResetCadence - && this.string.equals(((CreditGrantExpiryRequestBodyResetCadence) other).string)); + || (other instanceof BillingPlanCreditGrantResetCadence + && this.string.equals(((BillingPlanCreditGrantResetCadence) other).string)); } @java.lang.Override @@ -67,7 +67,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreditGrantExpiryRequestBodyResetCadence valueOf(String value) { + public static BillingPlanCreditGrantResetCadence valueOf(String value) { switch (value) { case "yearly": return YEARLY; @@ -78,31 +78,31 @@ public static CreditGrantExpiryRequestBodyResetCadence valueOf(String value) { case "weekly": return WEEKLY; default: - return new CreditGrantExpiryRequestBodyResetCadence(Value.UNKNOWN, value); + return new BillingPlanCreditGrantResetCadence(Value.UNKNOWN, value); } } public enum Value { - MONTHLY, - - YEARLY, - DAILY, + MONTHLY, + WEEKLY, + YEARLY, + UNKNOWN } public interface Visitor { - T visitMonthly(); - - T visitYearly(); - T visitDaily(); + T visitMonthly(); + T visitWeekly(); + T visitYearly(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetStart.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetStart.java similarity index 65% rename from src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetStart.java rename to src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetStart.java index 57c29dd..12c3fac 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetStart.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetStart.java @@ -6,18 +6,18 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreditGrantExpiryRequestBodyResetStart { - public static final CreditGrantExpiryRequestBodyResetStart FIRST_OF_MONTH = - new CreditGrantExpiryRequestBodyResetStart(Value.FIRST_OF_MONTH, "first_of_month"); +public final class BillingPlanCreditGrantResetStart { + public static final BillingPlanCreditGrantResetStart FIRST_OF_MONTH = + new BillingPlanCreditGrantResetStart(Value.FIRST_OF_MONTH, "first_of_month"); - public static final CreditGrantExpiryRequestBodyResetStart BILLING_PERIOD = - new CreditGrantExpiryRequestBodyResetStart(Value.BILLING_PERIOD, "billing_period"); + public static final BillingPlanCreditGrantResetStart BILLING_PERIOD = + new BillingPlanCreditGrantResetStart(Value.BILLING_PERIOD, "billing_period"); private final Value value; private final String string; - CreditGrantExpiryRequestBodyResetStart(Value value, String string) { + BillingPlanCreditGrantResetStart(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +35,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreditGrantExpiryRequestBodyResetStart - && this.string.equals(((CreditGrantExpiryRequestBodyResetStart) other).string)); + || (other instanceof BillingPlanCreditGrantResetStart + && this.string.equals(((BillingPlanCreditGrantResetStart) other).string)); } @java.lang.Override @@ -57,14 +57,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreditGrantExpiryRequestBodyResetStart valueOf(String value) { + public static BillingPlanCreditGrantResetStart valueOf(String value) { switch (value) { case "first_of_month": return FIRST_OF_MONTH; case "billing_period": return BILLING_PERIOD; default: - return new CreditGrantExpiryRequestBodyResetStart(Value.UNKNOWN, value); + return new BillingPlanCreditGrantResetStart(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetType.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetType.java similarity index 65% rename from src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetType.java rename to src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetType.java index fed0b4d..45d25fd 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBodyResetType.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResetType.java @@ -6,18 +6,18 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreditGrantExpiryRequestBodyResetType { - public static final CreditGrantExpiryRequestBodyResetType NO_RESET = - new CreditGrantExpiryRequestBodyResetType(Value.NO_RESET, "no_reset"); +public final class BillingPlanCreditGrantResetType { + public static final BillingPlanCreditGrantResetType NO_RESET = + new BillingPlanCreditGrantResetType(Value.NO_RESET, "no_reset"); - public static final CreditGrantExpiryRequestBodyResetType PLAN_PERIOD = - new CreditGrantExpiryRequestBodyResetType(Value.PLAN_PERIOD, "plan_period"); + public static final BillingPlanCreditGrantResetType PLAN_PERIOD = + new BillingPlanCreditGrantResetType(Value.PLAN_PERIOD, "plan_period"); private final Value value; private final String string; - CreditGrantExpiryRequestBodyResetType(Value value, String string) { + BillingPlanCreditGrantResetType(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +35,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreditGrantExpiryRequestBodyResetType - && this.string.equals(((CreditGrantExpiryRequestBodyResetType) other).string)); + || (other instanceof BillingPlanCreditGrantResetType + && this.string.equals(((BillingPlanCreditGrantResetType) other).string)); } @java.lang.Override @@ -57,30 +57,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreditGrantExpiryRequestBodyResetType valueOf(String value) { + public static BillingPlanCreditGrantResetType valueOf(String value) { switch (value) { case "no_reset": return NO_RESET; case "plan_period": return PLAN_PERIOD; default: - return new CreditGrantExpiryRequestBodyResetType(Value.UNKNOWN, value); + return new BillingPlanCreditGrantResetType(Value.UNKNOWN, value); } } public enum Value { - PLAN_PERIOD, - NO_RESET, + PLAN_PERIOD, + UNKNOWN } public interface Visitor { - T visitPlanPeriod(); - T visitNoReset(); + T visitPlanPeriod(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index b8b7dbf..b1a66a2 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -22,6 +22,20 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingPlanCreditGrantResponseData.Builder.class) public final class BillingPlanCreditGrantResponseData { + private final Optional autoTopupAmount; + + private final Optional autoTopupAmountType; + + private final boolean autoTopupEnabled; + + private final Optional autoTopupExpiryType; + + private final Optional autoTopupExpiryUnit; + + private final Optional autoTopupExpiryUnitCount; + + private final Optional autoTopupThresholdPercent; + private final OffsetDateTime createdAt; private final int creditAmount; @@ -34,46 +48,63 @@ public final class BillingPlanCreditGrantResponseData { private final Optional creditSingularName; - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; private final String id; + private final Optional plan; + private final String planId; private final String planName; - private final String resetCadence; + private final BillingPlanCreditGrantResetCadence resetCadence; - private final String resetStart; + private final BillingPlanCreditGrantResetStart resetStart; - private final Optional resetType; + private final Optional resetType; private final OffsetDateTime updatedAt; private final Map additionalProperties; private BillingPlanCreditGrantResponseData( + Optional autoTopupAmount, + Optional autoTopupAmountType, + boolean autoTopupEnabled, + Optional autoTopupExpiryType, + Optional autoTopupExpiryUnit, + Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdPercent, OffsetDateTime createdAt, int creditAmount, String creditId, String creditName, Optional creditPluralName, Optional creditSingularName, - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, String id, + Optional plan, String planId, String planName, - String resetCadence, - String resetStart, - Optional resetType, + BillingPlanCreditGrantResetCadence resetCadence, + BillingPlanCreditGrantResetStart resetStart, + Optional resetType, OffsetDateTime updatedAt, Map additionalProperties) { + this.autoTopupAmount = autoTopupAmount; + this.autoTopupAmountType = autoTopupAmountType; + this.autoTopupEnabled = autoTopupEnabled; + this.autoTopupExpiryType = autoTopupExpiryType; + this.autoTopupExpiryUnit = autoTopupExpiryUnit; + this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.createdAt = createdAt; this.creditAmount = creditAmount; this.creditId = creditId; @@ -84,6 +115,7 @@ private BillingPlanCreditGrantResponseData( this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; this.id = id; + this.plan = plan; this.planId = planId; this.planName = planName; this.resetCadence = resetCadence; @@ -93,6 +125,41 @@ private BillingPlanCreditGrantResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("auto_topup_amount") + public Optional getAutoTopupAmount() { + return autoTopupAmount; + } + + @JsonProperty("auto_topup_amount_type") + public Optional getAutoTopupAmountType() { + return autoTopupAmountType; + } + + @JsonProperty("auto_topup_enabled") + public boolean getAutoTopupEnabled() { + return autoTopupEnabled; + } + + @JsonProperty("auto_topup_expiry_type") + public Optional getAutoTopupExpiryType() { + return autoTopupExpiryType; + } + + @JsonProperty("auto_topup_expiry_unit") + public Optional getAutoTopupExpiryUnit() { + return autoTopupExpiryUnit; + } + + @JsonProperty("auto_topup_expiry_unit_count") + public Optional getAutoTopupExpiryUnitCount() { + return autoTopupExpiryUnitCount; + } + + @JsonProperty("auto_topup_threshold_percent") + public Optional getAutoTopupThresholdPercent() { + return autoTopupThresholdPercent; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -124,12 +191,12 @@ public Optional getCreditSingularName() { } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -143,28 +210,36 @@ public String getId() { return id; } + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + @JsonProperty("plan_id") public String getPlanId() { return planId; } + /** + * @return Use plan.name from the nested plan object instead + */ @JsonProperty("plan_name") public String getPlanName() { return planName; } @JsonProperty("reset_cadence") - public String getResetCadence() { + public BillingPlanCreditGrantResetCadence getResetCadence() { return resetCadence; } @JsonProperty("reset_start") - public String getResetStart() { + public BillingPlanCreditGrantResetStart getResetStart() { return resetStart; } @JsonProperty("reset_type") - public Optional getResetType() { + public Optional getResetType() { return resetType; } @@ -186,7 +261,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(BillingPlanCreditGrantResponseData other) { - return createdAt.equals(other.createdAt) + return autoTopupAmount.equals(other.autoTopupAmount) + && autoTopupAmountType.equals(other.autoTopupAmountType) + && autoTopupEnabled == other.autoTopupEnabled + && autoTopupExpiryType.equals(other.autoTopupExpiryType) + && autoTopupExpiryUnit.equals(other.autoTopupExpiryUnit) + && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) + && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) + && createdAt.equals(other.createdAt) && creditAmount == other.creditAmount && creditId.equals(other.creditId) && creditName.equals(other.creditName) @@ -196,6 +278,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && id.equals(other.id) + && plan.equals(other.plan) && planId.equals(other.planId) && planName.equals(other.planName) && resetCadence.equals(other.resetCadence) @@ -207,6 +290,13 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.autoTopupAmount, + this.autoTopupAmountType, + this.autoTopupEnabled, + this.autoTopupExpiryType, + this.autoTopupExpiryUnit, + this.autoTopupExpiryUnitCount, + this.autoTopupThresholdPercent, this.createdAt, this.creditAmount, this.creditId, @@ -217,6 +307,7 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.id, + this.plan, this.planId, this.planName, this.resetCadence, @@ -230,16 +321,20 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CreatedAtStage builder() { + public static AutoTopupEnabledStage builder() { return new Builder(); } - public interface CreatedAtStage { - CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt); + public interface AutoTopupEnabledStage { + CreatedAtStage autoTopupEnabled(boolean autoTopupEnabled); Builder from(BillingPlanCreditGrantResponseData other); } + public interface CreatedAtStage { + CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt); + } + public interface CreditAmountStage { CreditIdStage creditAmount(int creditAmount); } @@ -261,15 +356,18 @@ public interface PlanIdStage { } public interface PlanNameStage { + /** + *

Use plan.name from the nested plan object instead

+ */ ResetCadenceStage planName(@NotNull String planName); } public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull String resetCadence); + ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); } public interface ResetStartStage { - UpdatedAtStage resetStart(@NotNull String resetStart); + UpdatedAtStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); } public interface UpdatedAtStage { @@ -279,6 +377,30 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingPlanCreditGrantResponseData build(); + _FinalStage autoTopupAmount(Optional autoTopupAmount); + + _FinalStage autoTopupAmount(Integer autoTopupAmount); + + _FinalStage autoTopupAmountType(Optional autoTopupAmountType); + + _FinalStage autoTopupAmountType(String autoTopupAmountType); + + _FinalStage autoTopupExpiryType(Optional autoTopupExpiryType); + + _FinalStage autoTopupExpiryType(BillingCreditExpiryType autoTopupExpiryType); + + _FinalStage autoTopupExpiryUnit(Optional autoTopupExpiryUnit); + + _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit); + + _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + + _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount); + + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); + + _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent); + _FinalStage creditPluralName(Optional creditPluralName); _FinalStage creditPluralName(String creditPluralName); @@ -287,26 +409,31 @@ public interface _FinalStage { _FinalStage creditSingularName(String creditSingularName); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(String expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(String expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); _FinalStage expiryUnitCount(Integer expiryUnitCount); - _FinalStage resetType(Optional resetType); + _FinalStage plan(Optional plan); - _FinalStage resetType(String resetType); + _FinalStage plan(PreviewObjectResponseData plan); + + _FinalStage resetType(Optional resetType); + + _FinalStage resetType(BillingPlanCreditGrantResetType resetType); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CreatedAtStage, + implements AutoTopupEnabledStage, + CreatedAtStage, CreditAmountStage, CreditIdStage, CreditNameStage, @@ -317,6 +444,8 @@ public static final class Builder ResetStartStage, UpdatedAtStage, _FinalStage { + private boolean autoTopupEnabled; + private OffsetDateTime createdAt; private int creditAmount; @@ -331,24 +460,38 @@ public static final class Builder private String planName; - private String resetCadence; + private BillingPlanCreditGrantResetCadence resetCadence; - private String resetStart; + private BillingPlanCreditGrantResetStart resetStart; private OffsetDateTime updatedAt; - private Optional resetType = Optional.empty(); + private Optional resetType = Optional.empty(); + + private Optional plan = Optional.empty(); private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); private Optional creditSingularName = Optional.empty(); private Optional creditPluralName = Optional.empty(); + private Optional autoTopupThresholdPercent = Optional.empty(); + + private Optional autoTopupExpiryUnitCount = Optional.empty(); + + private Optional autoTopupExpiryUnit = Optional.empty(); + + private Optional autoTopupExpiryType = Optional.empty(); + + private Optional autoTopupAmountType = Optional.empty(); + + private Optional autoTopupAmount = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -356,6 +499,13 @@ private Builder() {} @java.lang.Override public Builder from(BillingPlanCreditGrantResponseData other) { + autoTopupAmount(other.getAutoTopupAmount()); + autoTopupAmountType(other.getAutoTopupAmountType()); + autoTopupEnabled(other.getAutoTopupEnabled()); + autoTopupExpiryType(other.getAutoTopupExpiryType()); + autoTopupExpiryUnit(other.getAutoTopupExpiryUnit()); + autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); + autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); createdAt(other.getCreatedAt()); creditAmount(other.getCreditAmount()); creditId(other.getCreditId()); @@ -366,6 +516,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); id(other.getId()); + plan(other.getPlan()); planId(other.getPlanId()); planName(other.getPlanName()); resetCadence(other.getResetCadence()); @@ -375,6 +526,13 @@ public Builder from(BillingPlanCreditGrantResponseData other) { return this; } + @java.lang.Override + @JsonSetter("auto_topup_enabled") + public CreatedAtStage autoTopupEnabled(boolean autoTopupEnabled) { + this.autoTopupEnabled = autoTopupEnabled; + return this; + } + @java.lang.Override @JsonSetter("created_at") public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -417,6 +575,11 @@ public PlanNameStage planId(@NotNull String planId) { return this; } + /** + *

Use plan.name from the nested plan object instead

+ *

Use plan.name from the nested plan object instead

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("plan_name") public ResetCadenceStage planName(@NotNull String planName) { @@ -426,14 +589,14 @@ public ResetCadenceStage planName(@NotNull String planName) { @java.lang.Override @JsonSetter("reset_cadence") - public ResetStartStage resetCadence(@NotNull String resetCadence) { + public ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence) { this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); return this; } @java.lang.Override @JsonSetter("reset_start") - public UpdatedAtStage resetStart(@NotNull String resetStart) { + public UpdatedAtStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart) { this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); return this; } @@ -446,18 +609,31 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { } @java.lang.Override - public _FinalStage resetType(String resetType) { + public _FinalStage resetType(BillingPlanCreditGrantResetType resetType) { this.resetType = Optional.ofNullable(resetType); return this; } @java.lang.Override @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) - public _FinalStage resetType(Optional resetType) { + public _FinalStage resetType(Optional resetType) { this.resetType = resetType; return this; } + @java.lang.Override + public _FinalStage plan(PreviewObjectResponseData plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Integer expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -472,27 +648,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(String expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(String expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } @@ -523,9 +699,94 @@ public _FinalStage creditPluralName(Optional creditPluralName) { return this; } + @java.lang.Override + public _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent) { + this.autoTopupThresholdPercent = Optional.ofNullable(autoTopupThresholdPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_threshold_percent", nulls = Nulls.SKIP) + public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent) { + this.autoTopupThresholdPercent = autoTopupThresholdPercent; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount) { + this.autoTopupExpiryUnitCount = Optional.ofNullable(autoTopupExpiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount) { + this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit) { + this.autoTopupExpiryUnit = Optional.ofNullable(autoTopupExpiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_unit", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryUnit(Optional autoTopupExpiryUnit) { + this.autoTopupExpiryUnit = autoTopupExpiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryType(BillingCreditExpiryType autoTopupExpiryType) { + this.autoTopupExpiryType = Optional.ofNullable(autoTopupExpiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_type", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryType(Optional autoTopupExpiryType) { + this.autoTopupExpiryType = autoTopupExpiryType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupAmountType(String autoTopupAmountType) { + this.autoTopupAmountType = Optional.ofNullable(autoTopupAmountType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_amount_type", nulls = Nulls.SKIP) + public _FinalStage autoTopupAmountType(Optional autoTopupAmountType) { + this.autoTopupAmountType = autoTopupAmountType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupAmount(Integer autoTopupAmount) { + this.autoTopupAmount = Optional.ofNullable(autoTopupAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_amount", nulls = Nulls.SKIP) + public _FinalStage autoTopupAmount(Optional autoTopupAmount) { + this.autoTopupAmount = autoTopupAmount; + return this; + } + @java.lang.Override public BillingPlanCreditGrantResponseData build() { return new BillingPlanCreditGrantResponseData( + autoTopupAmount, + autoTopupAmountType, + autoTopupEnabled, + autoTopupExpiryType, + autoTopupExpiryUnit, + autoTopupExpiryUnitCount, + autoTopupThresholdPercent, createdAt, creditAmount, creditId, @@ -536,6 +797,7 @@ public BillingPlanCreditGrantResponseData build() { expiryUnit, expiryUnitCount, id, + plan, planId, planName, resetCadence, diff --git a/src/main/java/com/schematic/api/types/BillingPriceResponseData.java b/src/main/java/com/schematic/api/types/BillingPriceResponseData.java index b784b88..c684c22 100644 --- a/src/main/java/com/schematic/api/types/BillingPriceResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPriceResponseData.java @@ -27,13 +27,15 @@ public final class BillingPriceResponseData { private final String id; - private final String interval; + private final BillingProductPriceInterval interval; private final int price; private final Optional priceDecimal; - private final String scheme; + private final BillingProviderType providerType; + + private final BillingPriceScheme scheme; private final Map additionalProperties; @@ -41,10 +43,11 @@ private BillingPriceResponseData( String currency, String externalPriceId, String id, - String interval, + BillingProductPriceInterval interval, int price, Optional priceDecimal, - String scheme, + BillingProviderType providerType, + BillingPriceScheme scheme, Map additionalProperties) { this.currency = currency; this.externalPriceId = externalPriceId; @@ -52,6 +55,7 @@ private BillingPriceResponseData( this.interval = interval; this.price = price; this.priceDecimal = priceDecimal; + this.providerType = providerType; this.scheme = scheme; this.additionalProperties = additionalProperties; } @@ -72,7 +76,7 @@ public String getId() { } @JsonProperty("interval") - public String getInterval() { + public BillingProductPriceInterval getInterval() { return interval; } @@ -86,8 +90,13 @@ public Optional getPriceDecimal() { return priceDecimal; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("scheme") - public String getScheme() { + public BillingPriceScheme getScheme() { return scheme; } @@ -109,6 +118,7 @@ private boolean equalTo(BillingPriceResponseData other) { && interval.equals(other.interval) && price == other.price && priceDecimal.equals(other.priceDecimal) + && providerType.equals(other.providerType) && scheme.equals(other.scheme); } @@ -121,6 +131,7 @@ public int hashCode() { this.interval, this.price, this.priceDecimal, + this.providerType, this.scheme); } @@ -148,15 +159,19 @@ public interface IdStage { } public interface IntervalStage { - PriceStage interval(@NotNull String interval); + PriceStage interval(@NotNull BillingProductPriceInterval interval); } public interface PriceStage { - SchemeStage price(int price); + ProviderTypeStage price(int price); + } + + public interface ProviderTypeStage { + SchemeStage providerType(@NotNull BillingProviderType providerType); } public interface SchemeStage { - _FinalStage scheme(@NotNull String scheme); + _FinalStage scheme(@NotNull BillingPriceScheme scheme); } public interface _FinalStage { @@ -174,6 +189,7 @@ public static final class Builder IdStage, IntervalStage, PriceStage, + ProviderTypeStage, SchemeStage, _FinalStage { private String currency; @@ -182,11 +198,13 @@ public static final class Builder private String id; - private String interval; + private BillingProductPriceInterval interval; private int price; - private String scheme; + private BillingProviderType providerType; + + private BillingPriceScheme scheme; private Optional priceDecimal = Optional.empty(); @@ -203,6 +221,7 @@ public Builder from(BillingPriceResponseData other) { interval(other.getInterval()); price(other.getPrice()); priceDecimal(other.getPriceDecimal()); + providerType(other.getProviderType()); scheme(other.getScheme()); return this; } @@ -230,21 +249,28 @@ public IntervalStage id(@NotNull String id) { @java.lang.Override @JsonSetter("interval") - public PriceStage interval(@NotNull String interval) { + public PriceStage interval(@NotNull BillingProductPriceInterval interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } @java.lang.Override @JsonSetter("price") - public SchemeStage price(int price) { + public ProviderTypeStage price(int price) { this.price = price; return this; } + @java.lang.Override + @JsonSetter("provider_type") + public SchemeStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("scheme") - public _FinalStage scheme(@NotNull String scheme) { + public _FinalStage scheme(@NotNull BillingPriceScheme scheme) { this.scheme = Objects.requireNonNull(scheme, "scheme must not be null"); return this; } @@ -265,7 +291,15 @@ public _FinalStage priceDecimal(Optional priceDecimal) { @java.lang.Override public BillingPriceResponseData build() { return new BillingPriceResponseData( - currency, externalPriceId, id, interval, price, priceDecimal, scheme, additionalProperties); + currency, + externalPriceId, + id, + interval, + price, + priceDecimal, + providerType, + scheme, + additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyBillingScheme.java b/src/main/java/com/schematic/api/types/BillingPriceScheme.java similarity index 62% rename from src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyBillingScheme.java rename to src/main/java/com/schematic/api/types/BillingPriceScheme.java index fb292ca..fce9029 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingPriceRequestBodyBillingScheme.java +++ b/src/main/java/com/schematic/api/types/BillingPriceScheme.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.billing.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateBillingPriceRequestBodyBillingScheme { - public static final CreateBillingPriceRequestBodyBillingScheme PER_UNIT = - new CreateBillingPriceRequestBodyBillingScheme(Value.PER_UNIT, "per_unit"); +public final class BillingPriceScheme { + public static final BillingPriceScheme PER_UNIT = new BillingPriceScheme(Value.PER_UNIT, "per_unit"); - public static final CreateBillingPriceRequestBodyBillingScheme TIERED = - new CreateBillingPriceRequestBodyBillingScheme(Value.TIERED, "tiered"); + public static final BillingPriceScheme TIERED = new BillingPriceScheme(Value.TIERED, "tiered"); private final Value value; private final String string; - CreateBillingPriceRequestBodyBillingScheme(Value value, String string) { + BillingPriceScheme(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateBillingPriceRequestBodyBillingScheme - && this.string.equals(((CreateBillingPriceRequestBodyBillingScheme) other).string)); + || (other instanceof BillingPriceScheme && this.string.equals(((BillingPriceScheme) other).string)); } @java.lang.Override @@ -57,14 +54,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPriceRequestBodyBillingScheme valueOf(String value) { + public static BillingPriceScheme valueOf(String value) { switch (value) { case "per_unit": return PER_UNIT; case "tiered": return TIERED; default: - return new CreateBillingPriceRequestBodyBillingScheme(Value.UNKNOWN, value); + return new BillingPriceScheme(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/BillingProductPricingUsageType.java b/src/main/java/com/schematic/api/types/BillingPriceUsageType.java similarity index 67% rename from src/main/java/com/schematic/api/types/BillingProductPricingUsageType.java rename to src/main/java/com/schematic/api/types/BillingPriceUsageType.java index 9e7a437..8229a11 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPricingUsageType.java +++ b/src/main/java/com/schematic/api/types/BillingPriceUsageType.java @@ -6,18 +6,16 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class BillingProductPricingUsageType { - public static final BillingProductPricingUsageType METERED = - new BillingProductPricingUsageType(Value.METERED, "metered"); +public final class BillingPriceUsageType { + public static final BillingPriceUsageType METERED = new BillingPriceUsageType(Value.METERED, "metered"); - public static final BillingProductPricingUsageType LICENSED = - new BillingProductPricingUsageType(Value.LICENSED, "licensed"); + public static final BillingPriceUsageType LICENSED = new BillingPriceUsageType(Value.LICENSED, "licensed"); private final Value value; private final String string; - BillingProductPricingUsageType(Value value, String string) { + BillingPriceUsageType(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof BillingProductPricingUsageType - && this.string.equals(((BillingProductPricingUsageType) other).string)); + || (other instanceof BillingPriceUsageType + && this.string.equals(((BillingPriceUsageType) other).string)); } @java.lang.Override @@ -57,14 +55,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BillingProductPricingUsageType valueOf(String value) { + public static BillingPriceUsageType valueOf(String value) { switch (value) { case "metered": return METERED; case "licensed": return LICENSED; default: - return new BillingProductPricingUsageType(Value.UNKNOWN, value); + return new BillingPriceUsageType(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/BillingPriceView.java b/src/main/java/com/schematic/api/types/BillingPriceView.java index d76838a..37a66b0 100644 --- a/src/main/java/com/schematic/api/types/BillingPriceView.java +++ b/src/main/java/com/schematic/api/types/BillingPriceView.java @@ -24,7 +24,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingPriceView.Builder.class) public final class BillingPriceView { - private final String billingScheme; + private final BillingPriceScheme billingScheme; private final OffsetDateTime createdAt; @@ -32,7 +32,7 @@ public final class BillingPriceView { private final String id; - private final String interval; + private final BillingProductPriceInterval interval; private final boolean isActive; @@ -60,20 +60,22 @@ public final class BillingPriceView { private final String productName; - private final Optional tiersMode; + private final BillingProviderType providerType; + + private final Optional tiersMode; private final OffsetDateTime updatedAt; - private final String usageType; + private final BillingPriceUsageType usageType; private final Map additionalProperties; private BillingPriceView( - String billingScheme, + BillingPriceScheme billingScheme, OffsetDateTime createdAt, String currency, String id, - String interval, + BillingProductPriceInterval interval, boolean isActive, Optional meterEventName, Optional meterEventPayloadKey, @@ -87,9 +89,10 @@ private BillingPriceView( String productExternalId, String productId, String productName, - Optional tiersMode, + BillingProviderType providerType, + Optional tiersMode, OffsetDateTime updatedAt, - String usageType, + BillingPriceUsageType usageType, Map additionalProperties) { this.billingScheme = billingScheme; this.createdAt = createdAt; @@ -109,6 +112,7 @@ private BillingPriceView( this.productExternalId = productExternalId; this.productId = productId; this.productName = productName; + this.providerType = providerType; this.tiersMode = tiersMode; this.updatedAt = updatedAt; this.usageType = usageType; @@ -116,7 +120,7 @@ private BillingPriceView( } @JsonProperty("billing_scheme") - public String getBillingScheme() { + public BillingPriceScheme getBillingScheme() { return billingScheme; } @@ -136,7 +140,7 @@ public String getId() { } @JsonProperty("interval") - public String getInterval() { + public BillingProductPriceInterval getInterval() { return interval; } @@ -205,8 +209,13 @@ public String getProductName() { return productName; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("tiers_mode") - public Optional getTiersMode() { + public Optional getTiersMode() { return tiersMode; } @@ -216,7 +225,7 @@ public OffsetDateTime getUpdatedAt() { } @JsonProperty("usage_type") - public String getUsageType() { + public BillingPriceUsageType getUsageType() { return usageType; } @@ -250,6 +259,7 @@ private boolean equalTo(BillingPriceView other) { && productExternalId.equals(other.productExternalId) && productId.equals(other.productId) && productName.equals(other.productName) + && providerType.equals(other.providerType) && tiersMode.equals(other.tiersMode) && updatedAt.equals(other.updatedAt) && usageType.equals(other.usageType); @@ -276,6 +286,7 @@ public int hashCode() { this.productExternalId, this.productId, this.productName, + this.providerType, this.tiersMode, this.updatedAt, this.usageType); @@ -291,7 +302,7 @@ public static BillingSchemeStage builder() { } public interface BillingSchemeStage { - CreatedAtStage billingScheme(@NotNull String billingScheme); + CreatedAtStage billingScheme(@NotNull BillingPriceScheme billingScheme); Builder from(BillingPriceView other); } @@ -309,7 +320,7 @@ public interface IdStage { } public interface IntervalStage { - IsActiveStage interval(@NotNull String interval); + IsActiveStage interval(@NotNull BillingProductPriceInterval interval); } public interface IsActiveStage { @@ -341,7 +352,11 @@ public interface ProductIdStage { } public interface ProductNameStage { - UpdatedAtStage productName(@NotNull String productName); + ProviderTypeStage productName(@NotNull String productName); + } + + public interface ProviderTypeStage { + UpdatedAtStage providerType(@NotNull BillingProviderType providerType); } public interface UpdatedAtStage { @@ -349,7 +364,7 @@ public interface UpdatedAtStage { } public interface UsageTypeStage { - _FinalStage usageType(@NotNull String usageType); + _FinalStage usageType(@NotNull BillingPriceUsageType usageType); } public interface _FinalStage { @@ -377,9 +392,9 @@ public interface _FinalStage { _FinalStage addAllPriceTier(List priceTier); - _FinalStage tiersMode(Optional tiersMode); + _FinalStage tiersMode(Optional tiersMode); - _FinalStage tiersMode(String tiersMode); + _FinalStage tiersMode(BillingTiersMode tiersMode); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -397,10 +412,11 @@ public static final class Builder ProductExternalIdStage, ProductIdStage, ProductNameStage, + ProviderTypeStage, UpdatedAtStage, UsageTypeStage, _FinalStage { - private String billingScheme; + private BillingPriceScheme billingScheme; private OffsetDateTime createdAt; @@ -408,7 +424,7 @@ public static final class Builder private String id; - private String interval; + private BillingProductPriceInterval interval; private boolean isActive; @@ -426,11 +442,13 @@ public static final class Builder private String productName; + private BillingProviderType providerType; + private OffsetDateTime updatedAt; - private String usageType; + private BillingPriceUsageType usageType; - private Optional tiersMode = Optional.empty(); + private Optional tiersMode = Optional.empty(); private List priceTier = new ArrayList<>(); @@ -467,6 +485,7 @@ public Builder from(BillingPriceView other) { productExternalId(other.getProductExternalId()); productId(other.getProductId()); productName(other.getProductName()); + providerType(other.getProviderType()); tiersMode(other.getTiersMode()); updatedAt(other.getUpdatedAt()); usageType(other.getUsageType()); @@ -475,7 +494,7 @@ public Builder from(BillingPriceView other) { @java.lang.Override @JsonSetter("billing_scheme") - public CreatedAtStage billingScheme(@NotNull String billingScheme) { + public CreatedAtStage billingScheme(@NotNull BillingPriceScheme billingScheme) { this.billingScheme = Objects.requireNonNull(billingScheme, "billingScheme must not be null"); return this; } @@ -503,7 +522,7 @@ public IntervalStage id(@NotNull String id) { @java.lang.Override @JsonSetter("interval") - public IsActiveStage interval(@NotNull String interval) { + public IsActiveStage interval(@NotNull BillingProductPriceInterval interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } @@ -559,11 +578,18 @@ public ProductNameStage productId(@NotNull String productId) { @java.lang.Override @JsonSetter("product_name") - public UpdatedAtStage productName(@NotNull String productName) { + public ProviderTypeStage productName(@NotNull String productName) { this.productName = Objects.requireNonNull(productName, "productName must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public UpdatedAtStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public UsageTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -573,20 +599,20 @@ public UsageTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("usage_type") - public _FinalStage usageType(@NotNull String usageType) { + public _FinalStage usageType(@NotNull BillingPriceUsageType usageType) { this.usageType = Objects.requireNonNull(usageType, "usageType must not be null"); return this; } @java.lang.Override - public _FinalStage tiersMode(String tiersMode) { + public _FinalStage tiersMode(BillingTiersMode tiersMode) { this.tiersMode = Optional.ofNullable(tiersMode); return this; } @java.lang.Override @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) - public _FinalStage tiersMode(Optional tiersMode) { + public _FinalStage tiersMode(Optional tiersMode) { this.tiersMode = tiersMode; return this; } @@ -688,6 +714,7 @@ public BillingPriceView build() { productExternalId, productId, productName, + providerType, tiersMode, updatedAt, usageType, diff --git a/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java b/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java index f1406f4..d676272 100644 --- a/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java @@ -46,6 +46,8 @@ public final class BillingProductDetailResponseData { private final String productId; + private final BillingProviderType providerType; + private final double quantity; private final int subscriptionCount; @@ -66,6 +68,7 @@ private BillingProductDetailResponseData( Optional priceDecimal, List prices, String productId, + BillingProviderType providerType, double quantity, int subscriptionCount, OffsetDateTime updatedAt, @@ -81,6 +84,7 @@ private BillingProductDetailResponseData( this.priceDecimal = priceDecimal; this.prices = prices; this.productId = productId; + this.providerType = providerType; this.quantity = quantity; this.subscriptionCount = subscriptionCount; this.updatedAt = updatedAt; @@ -145,6 +149,11 @@ public String getProductId() { return productId; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("quantity") public double getQuantity() { return quantity; @@ -183,6 +192,7 @@ private boolean equalTo(BillingProductDetailResponseData other) { && priceDecimal.equals(other.priceDecimal) && prices.equals(other.prices) && productId.equals(other.productId) + && providerType.equals(other.providerType) && quantity == other.quantity && subscriptionCount == other.subscriptionCount && updatedAt.equals(other.updatedAt); @@ -202,6 +212,7 @@ public int hashCode() { this.priceDecimal, this.prices, this.productId, + this.providerType, this.quantity, this.subscriptionCount, this.updatedAt); @@ -247,7 +258,11 @@ public interface PriceStage { } public interface ProductIdStage { - QuantityStage productId(@NotNull String productId); + ProviderTypeStage productId(@NotNull String productId); + } + + public interface ProviderTypeStage { + QuantityStage providerType(@NotNull BillingProviderType providerType); } public interface QuantityStage { @@ -293,6 +308,7 @@ public static final class Builder NameStage, PriceStage, ProductIdStage, + ProviderTypeStage, QuantityStage, SubscriptionCountStage, UpdatedAtStage, @@ -313,6 +329,8 @@ public static final class Builder private String productId; + private BillingProviderType providerType; + private double quantity; private int subscriptionCount; @@ -343,6 +361,7 @@ public Builder from(BillingProductDetailResponseData other) { priceDecimal(other.getPriceDecimal()); prices(other.getPrices()); productId(other.getProductId()); + providerType(other.getProviderType()); quantity(other.getQuantity()); subscriptionCount(other.getSubscriptionCount()); updatedAt(other.getUpdatedAt()); @@ -400,11 +419,18 @@ public ProductIdStage price(double price) { @java.lang.Override @JsonSetter("product_id") - public QuantityStage productId(@NotNull String productId) { + public ProviderTypeStage productId(@NotNull String productId) { this.productId = Objects.requireNonNull(productId, "productId must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public QuantityStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("quantity") public SubscriptionCountStage quantity(double quantity) { @@ -497,6 +523,7 @@ public BillingProductDetailResponseData build() { priceDecimal, prices, productId, + providerType, quantity, subscriptionCount, updatedAt, diff --git a/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java b/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java index 8043ec6..8be568a 100644 --- a/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java @@ -24,7 +24,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingProductForSubscriptionResponseData.Builder.class) public final class BillingProductForSubscriptionResponseData { - private final String billingScheme; + private final BillingPriceScheme billingScheme; private final Optional billingThreshold; @@ -56,6 +56,8 @@ public final class BillingProductForSubscriptionResponseData { private final List priceTier; + private final BillingProviderType providerType; + private final double quantity; private final String subscriptionId; @@ -64,12 +66,12 @@ public final class BillingProductForSubscriptionResponseData { private final OffsetDateTime updatedAt; - private final String usageType; + private final BillingPriceUsageType usageType; private final Map additionalProperties; private BillingProductForSubscriptionResponseData( - String billingScheme, + BillingPriceScheme billingScheme, Optional billingThreshold, OffsetDateTime createdAt, String currency, @@ -85,11 +87,12 @@ private BillingProductForSubscriptionResponseData( String priceExternalId, String priceId, List priceTier, + BillingProviderType providerType, double quantity, String subscriptionId, Optional subscriptionItemExternalId, OffsetDateTime updatedAt, - String usageType, + BillingPriceUsageType usageType, Map additionalProperties) { this.billingScheme = billingScheme; this.billingThreshold = billingThreshold; @@ -107,6 +110,7 @@ private BillingProductForSubscriptionResponseData( this.priceExternalId = priceExternalId; this.priceId = priceId; this.priceTier = priceTier; + this.providerType = providerType; this.quantity = quantity; this.subscriptionId = subscriptionId; this.subscriptionItemExternalId = subscriptionItemExternalId; @@ -116,7 +120,7 @@ private BillingProductForSubscriptionResponseData( } @JsonProperty("billing_scheme") - public String getBillingScheme() { + public BillingPriceScheme getBillingScheme() { return billingScheme; } @@ -195,6 +199,11 @@ public List getPriceTier() { return priceTier; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("quantity") public double getQuantity() { return quantity; @@ -216,7 +225,7 @@ public OffsetDateTime getUpdatedAt() { } @JsonProperty("usage_type") - public String getUsageType() { + public BillingPriceUsageType getUsageType() { return usageType; } @@ -249,6 +258,7 @@ private boolean equalTo(BillingProductForSubscriptionResponseData other) { && priceExternalId.equals(other.priceExternalId) && priceId.equals(other.priceId) && priceTier.equals(other.priceTier) + && providerType.equals(other.providerType) && quantity == other.quantity && subscriptionId.equals(other.subscriptionId) && subscriptionItemExternalId.equals(other.subscriptionItemExternalId) @@ -275,6 +285,7 @@ public int hashCode() { this.priceExternalId, this.priceId, this.priceTier, + this.providerType, this.quantity, this.subscriptionId, this.subscriptionItemExternalId, @@ -292,7 +303,7 @@ public static BillingSchemeStage builder() { } public interface BillingSchemeStage { - CreatedAtStage billingScheme(@NotNull String billingScheme); + CreatedAtStage billingScheme(@NotNull BillingPriceScheme billingScheme); Builder from(BillingProductForSubscriptionResponseData other); } @@ -338,7 +349,11 @@ public interface PriceExternalIdStage { } public interface PriceIdStage { - QuantityStage priceId(@NotNull String priceId); + ProviderTypeStage priceId(@NotNull String priceId); + } + + public interface ProviderTypeStage { + QuantityStage providerType(@NotNull BillingProviderType providerType); } public interface QuantityStage { @@ -354,7 +369,7 @@ public interface UpdatedAtStage { } public interface UsageTypeStage { - _FinalStage usageType(@NotNull String usageType); + _FinalStage usageType(@NotNull BillingPriceUsageType usageType); } public interface _FinalStage { @@ -397,12 +412,13 @@ public static final class Builder PriceStage, PriceExternalIdStage, PriceIdStage, + ProviderTypeStage, QuantityStage, SubscriptionIdStage, UpdatedAtStage, UsageTypeStage, _FinalStage { - private String billingScheme; + private BillingPriceScheme billingScheme; private OffsetDateTime createdAt; @@ -426,13 +442,15 @@ public static final class Builder private String priceId; + private BillingProviderType providerType; + private double quantity; private String subscriptionId; private OffsetDateTime updatedAt; - private String usageType; + private BillingPriceUsageType usageType; private Optional subscriptionItemExternalId = Optional.empty(); @@ -467,6 +485,7 @@ public Builder from(BillingProductForSubscriptionResponseData other) { priceExternalId(other.getPriceExternalId()); priceId(other.getPriceId()); priceTier(other.getPriceTier()); + providerType(other.getProviderType()); quantity(other.getQuantity()); subscriptionId(other.getSubscriptionId()); subscriptionItemExternalId(other.getSubscriptionItemExternalId()); @@ -477,7 +496,7 @@ public Builder from(BillingProductForSubscriptionResponseData other) { @java.lang.Override @JsonSetter("billing_scheme") - public CreatedAtStage billingScheme(@NotNull String billingScheme) { + public CreatedAtStage billingScheme(@NotNull BillingPriceScheme billingScheme) { this.billingScheme = Objects.requireNonNull(billingScheme, "billingScheme must not be null"); return this; } @@ -554,11 +573,18 @@ public PriceIdStage priceExternalId(@NotNull String priceExternalId) { @java.lang.Override @JsonSetter("price_id") - public QuantityStage priceId(@NotNull String priceId) { + public ProviderTypeStage priceId(@NotNull String priceId) { this.priceId = Objects.requireNonNull(priceId, "priceId must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public QuantityStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("quantity") public SubscriptionIdStage quantity(double quantity) { @@ -582,7 +608,7 @@ public UsageTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("usage_type") - public _FinalStage usageType(@NotNull String usageType) { + public _FinalStage usageType(@NotNull BillingPriceUsageType usageType) { this.usageType = Objects.requireNonNull(usageType, "usageType must not be null"); return this; } @@ -682,6 +708,7 @@ public BillingProductForSubscriptionResponseData build() { priceExternalId, priceId, priceTier, + providerType, quantity, subscriptionId, subscriptionItemExternalId, diff --git a/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java index 0a458e5..f48e059 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java @@ -25,9 +25,9 @@ public final class BillingProductPlanResponseData { private final String billingProductId; - private final String chargeType; + private final ChargeType chargeType; - private final String controlledBy; + private final PlanControlledByType controlledBy; private final String environmentId; @@ -48,8 +48,8 @@ public final class BillingProductPlanResponseData { private BillingProductPlanResponseData( String accountId, String billingProductId, - String chargeType, - String controlledBy, + ChargeType chargeType, + PlanControlledByType controlledBy, String environmentId, boolean isTrialable, Optional monthlyPriceId, @@ -83,12 +83,12 @@ public String getBillingProductId() { } @JsonProperty("charge_type") - public String getChargeType() { + public ChargeType getChargeType() { return chargeType; } @JsonProperty("controlled_by") - public String getControlledBy() { + public PlanControlledByType getControlledBy() { return controlledBy; } @@ -188,11 +188,11 @@ public interface BillingProductIdStage { } public interface ChargeTypeStage { - ControlledByStage chargeType(@NotNull String chargeType); + ControlledByStage chargeType(@NotNull ChargeType chargeType); } public interface ControlledByStage { - EnvironmentIdStage controlledBy(@NotNull String controlledBy); + EnvironmentIdStage controlledBy(@NotNull PlanControlledByType controlledBy); } public interface EnvironmentIdStage { @@ -241,9 +241,9 @@ public static final class Builder private String billingProductId; - private String chargeType; + private ChargeType chargeType; - private String controlledBy; + private PlanControlledByType controlledBy; private String environmentId; @@ -296,14 +296,14 @@ public ChargeTypeStage billingProductId(@NotNull String billingProductId) { @java.lang.Override @JsonSetter("charge_type") - public ControlledByStage chargeType(@NotNull String chargeType) { + public ControlledByStage chargeType(@NotNull ChargeType chargeType) { this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); return this; } @java.lang.Override @JsonSetter("controlled_by") - public EnvironmentIdStage controlledBy(@NotNull String controlledBy) { + public EnvironmentIdStage controlledBy(@NotNull PlanControlledByType controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/BillingProductPriceInterval.java b/src/main/java/com/schematic/api/types/BillingProductPriceInterval.java new file mode 100644 index 0000000..541143c --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingProductPriceInterval.java @@ -0,0 +1,105 @@ +/** + * 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 BillingProductPriceInterval { + public static final BillingProductPriceInterval MONTH = new BillingProductPriceInterval(Value.MONTH, "month"); + + public static final BillingProductPriceInterval DAY = new BillingProductPriceInterval(Value.DAY, "day"); + + public static final BillingProductPriceInterval ONE_TIME = + new BillingProductPriceInterval(Value.ONE_TIME, "one-time"); + + public static final BillingProductPriceInterval YEAR = new BillingProductPriceInterval(Value.YEAR, "year"); + + private final Value value; + + private final String string; + + BillingProductPriceInterval(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 BillingProductPriceInterval + && this.string.equals(((BillingProductPriceInterval) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MONTH: + return visitor.visitMonth(); + case DAY: + return visitor.visitDay(); + case ONE_TIME: + return visitor.visitOneTime(); + case YEAR: + return visitor.visitYear(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BillingProductPriceInterval valueOf(String value) { + switch (value) { + case "month": + return MONTH; + case "day": + return DAY; + case "one-time": + return ONE_TIME; + case "year": + return YEAR; + default: + return new BillingProductPriceInterval(Value.UNKNOWN, value); + } + } + + public enum Value { + DAY, + + MONTH, + + ONE_TIME, + + YEAR, + + UNKNOWN + } + + public interface Visitor { + T visitDay(); + + T visitMonth(); + + T visitOneTime(); + + T visitYear(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java index 0073959..1455e11 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingProductPriceResponseData.Builder.class) public final class BillingProductPriceResponseData { - private final String billingScheme; + private final BillingPriceScheme billingScheme; private final OffsetDateTime createdAt; @@ -30,7 +30,7 @@ public final class BillingProductPriceResponseData { private final String id; - private final String interval; + private final BillingProductPriceInterval interval; private final boolean isActive; @@ -46,20 +46,22 @@ public final class BillingProductPriceResponseData { private final String productExternalId; - private final Optional tiersMode; + private final BillingProviderType providerType; + + private final Optional tiersMode; private final OffsetDateTime updatedAt; - private final String usageType; + private final BillingPriceUsageType usageType; private final Map additionalProperties; private BillingProductPriceResponseData( - String billingScheme, + BillingPriceScheme billingScheme, OffsetDateTime createdAt, String currency, String id, - String interval, + BillingProductPriceInterval interval, boolean isActive, Optional meterId, int packageSize, @@ -67,9 +69,10 @@ private BillingProductPriceResponseData( Optional priceDecimal, String priceExternalId, String productExternalId, - Optional tiersMode, + BillingProviderType providerType, + Optional tiersMode, OffsetDateTime updatedAt, - String usageType, + BillingPriceUsageType usageType, Map additionalProperties) { this.billingScheme = billingScheme; this.createdAt = createdAt; @@ -83,6 +86,7 @@ private BillingProductPriceResponseData( this.priceDecimal = priceDecimal; this.priceExternalId = priceExternalId; this.productExternalId = productExternalId; + this.providerType = providerType; this.tiersMode = tiersMode; this.updatedAt = updatedAt; this.usageType = usageType; @@ -90,7 +94,7 @@ private BillingProductPriceResponseData( } @JsonProperty("billing_scheme") - public String getBillingScheme() { + public BillingPriceScheme getBillingScheme() { return billingScheme; } @@ -110,7 +114,7 @@ public String getId() { } @JsonProperty("interval") - public String getInterval() { + public BillingProductPriceInterval getInterval() { return interval; } @@ -149,8 +153,13 @@ public String getProductExternalId() { return productExternalId; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("tiers_mode") - public Optional getTiersMode() { + public Optional getTiersMode() { return tiersMode; } @@ -160,7 +169,7 @@ public OffsetDateTime getUpdatedAt() { } @JsonProperty("usage_type") - public String getUsageType() { + public BillingPriceUsageType getUsageType() { return usageType; } @@ -188,6 +197,7 @@ private boolean equalTo(BillingProductPriceResponseData other) { && priceDecimal.equals(other.priceDecimal) && priceExternalId.equals(other.priceExternalId) && productExternalId.equals(other.productExternalId) + && providerType.equals(other.providerType) && tiersMode.equals(other.tiersMode) && updatedAt.equals(other.updatedAt) && usageType.equals(other.usageType); @@ -208,6 +218,7 @@ public int hashCode() { this.priceDecimal, this.priceExternalId, this.productExternalId, + this.providerType, this.tiersMode, this.updatedAt, this.usageType); @@ -223,7 +234,7 @@ public static BillingSchemeStage builder() { } public interface BillingSchemeStage { - CreatedAtStage billingScheme(@NotNull String billingScheme); + CreatedAtStage billingScheme(@NotNull BillingPriceScheme billingScheme); Builder from(BillingProductPriceResponseData other); } @@ -241,7 +252,7 @@ public interface IdStage { } public interface IntervalStage { - IsActiveStage interval(@NotNull String interval); + IsActiveStage interval(@NotNull BillingProductPriceInterval interval); } public interface IsActiveStage { @@ -261,7 +272,11 @@ public interface PriceExternalIdStage { } public interface ProductExternalIdStage { - UpdatedAtStage productExternalId(@NotNull String productExternalId); + ProviderTypeStage productExternalId(@NotNull String productExternalId); + } + + public interface ProviderTypeStage { + UpdatedAtStage providerType(@NotNull BillingProviderType providerType); } public interface UpdatedAtStage { @@ -269,7 +284,7 @@ public interface UpdatedAtStage { } public interface UsageTypeStage { - _FinalStage usageType(@NotNull String usageType); + _FinalStage usageType(@NotNull BillingPriceUsageType usageType); } public interface _FinalStage { @@ -283,9 +298,9 @@ public interface _FinalStage { _FinalStage priceDecimal(String priceDecimal); - _FinalStage tiersMode(Optional tiersMode); + _FinalStage tiersMode(Optional tiersMode); - _FinalStage tiersMode(String tiersMode); + _FinalStage tiersMode(BillingTiersMode tiersMode); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -300,10 +315,11 @@ public static final class Builder PriceStage, PriceExternalIdStage, ProductExternalIdStage, + ProviderTypeStage, UpdatedAtStage, UsageTypeStage, _FinalStage { - private String billingScheme; + private BillingPriceScheme billingScheme; private OffsetDateTime createdAt; @@ -311,7 +327,7 @@ public static final class Builder private String id; - private String interval; + private BillingProductPriceInterval interval; private boolean isActive; @@ -323,11 +339,13 @@ public static final class Builder private String productExternalId; + private BillingProviderType providerType; + private OffsetDateTime updatedAt; - private String usageType; + private BillingPriceUsageType usageType; - private Optional tiersMode = Optional.empty(); + private Optional tiersMode = Optional.empty(); private Optional priceDecimal = Optional.empty(); @@ -352,6 +370,7 @@ public Builder from(BillingProductPriceResponseData other) { priceDecimal(other.getPriceDecimal()); priceExternalId(other.getPriceExternalId()); productExternalId(other.getProductExternalId()); + providerType(other.getProviderType()); tiersMode(other.getTiersMode()); updatedAt(other.getUpdatedAt()); usageType(other.getUsageType()); @@ -360,7 +379,7 @@ public Builder from(BillingProductPriceResponseData other) { @java.lang.Override @JsonSetter("billing_scheme") - public CreatedAtStage billingScheme(@NotNull String billingScheme) { + public CreatedAtStage billingScheme(@NotNull BillingPriceScheme billingScheme) { this.billingScheme = Objects.requireNonNull(billingScheme, "billingScheme must not be null"); return this; } @@ -388,7 +407,7 @@ public IntervalStage id(@NotNull String id) { @java.lang.Override @JsonSetter("interval") - public IsActiveStage interval(@NotNull String interval) { + public IsActiveStage interval(@NotNull BillingProductPriceInterval interval) { this.interval = Objects.requireNonNull(interval, "interval must not be null"); return this; } @@ -423,11 +442,18 @@ public ProductExternalIdStage priceExternalId(@NotNull String priceExternalId) { @java.lang.Override @JsonSetter("product_external_id") - public UpdatedAtStage productExternalId(@NotNull String productExternalId) { + public ProviderTypeStage productExternalId(@NotNull String productExternalId) { this.productExternalId = Objects.requireNonNull(productExternalId, "productExternalId must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public UpdatedAtStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public UsageTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -437,20 +463,20 @@ public UsageTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("usage_type") - public _FinalStage usageType(@NotNull String usageType) { + public _FinalStage usageType(@NotNull BillingPriceUsageType usageType) { this.usageType = Objects.requireNonNull(usageType, "usageType must not be null"); return this; } @java.lang.Override - public _FinalStage tiersMode(String tiersMode) { + public _FinalStage tiersMode(BillingTiersMode tiersMode) { this.tiersMode = Optional.ofNullable(tiersMode); return this; } @java.lang.Override @JsonSetter(value = "tiers_mode", nulls = Nulls.SKIP) - public _FinalStage tiersMode(Optional tiersMode) { + public _FinalStage tiersMode(Optional tiersMode) { this.tiersMode = tiersMode; return this; } @@ -496,6 +522,7 @@ public BillingProductPriceResponseData build() { priceDecimal, priceExternalId, productExternalId, + providerType, tiersMode, updatedAt, usageType, diff --git a/src/main/java/com/schematic/api/types/BillingProductPricing.java b/src/main/java/com/schematic/api/types/BillingProductPricing.java index 0325a7f..7d3463c 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPricing.java +++ b/src/main/java/com/schematic/api/types/BillingProductPricing.java @@ -43,7 +43,7 @@ public final class BillingProductPricing { private final Optional subscriptionItemExternalId; - private final BillingProductPricingUsageType usageType; + private final BillingPriceUsageType usageType; private final Map additionalProperties; @@ -59,7 +59,7 @@ private BillingProductPricing( String productExternalId, int quantity, Optional subscriptionItemExternalId, - BillingProductPricingUsageType usageType, + BillingPriceUsageType usageType, Map additionalProperties) { this.billingThreshold = billingThreshold; this.currency = currency; @@ -132,7 +132,7 @@ public Optional getSubscriptionItemExternalId() { } @JsonProperty("usage_type") - public BillingProductPricingUsageType getUsageType() { + public BillingPriceUsageType getUsageType() { return usageType; } @@ -215,7 +215,7 @@ public interface QuantityStage { } public interface UsageTypeStage { - _FinalStage usageType(@NotNull BillingProductPricingUsageType usageType); + _FinalStage usageType(@NotNull BillingPriceUsageType usageType); } public interface _FinalStage { @@ -264,7 +264,7 @@ public static final class Builder private int quantity; - private BillingProductPricingUsageType usageType; + private BillingPriceUsageType usageType; private Optional subscriptionItemExternalId = Optional.empty(); @@ -342,7 +342,7 @@ public UsageTypeStage quantity(int quantity) { @java.lang.Override @JsonSetter("usage_type") - public _FinalStage usageType(@NotNull BillingProductPricingUsageType usageType) { + public _FinalStage usageType(@NotNull BillingPriceUsageType usageType) { this.usageType = Objects.requireNonNull(usageType, "usageType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/BillingProductResponseData.java b/src/main/java/com/schematic/api/types/BillingProductResponseData.java index edb4cff..f0c4f11 100644 --- a/src/main/java/com/schematic/api/types/BillingProductResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductResponseData.java @@ -42,6 +42,8 @@ public final class BillingProductResponseData { private final String productId; + private final BillingProviderType providerType; + private final double quantity; private final OffsetDateTime updatedAt; @@ -59,6 +61,7 @@ private BillingProductResponseData( double price, Optional priceDecimal, String productId, + BillingProviderType providerType, double quantity, OffsetDateTime updatedAt, Map additionalProperties) { @@ -72,6 +75,7 @@ private BillingProductResponseData( this.price = price; this.priceDecimal = priceDecimal; this.productId = productId; + this.providerType = providerType; this.quantity = quantity; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -130,6 +134,11 @@ public String getProductId() { return productId; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("quantity") public double getQuantity() { return quantity; @@ -162,6 +171,7 @@ private boolean equalTo(BillingProductResponseData other) { && price == other.price && priceDecimal.equals(other.priceDecimal) && productId.equals(other.productId) + && providerType.equals(other.providerType) && quantity == other.quantity && updatedAt.equals(other.updatedAt); } @@ -179,6 +189,7 @@ public int hashCode() { this.price, this.priceDecimal, this.productId, + this.providerType, this.quantity, this.updatedAt); } @@ -223,7 +234,11 @@ public interface PriceStage { } public interface ProductIdStage { - QuantityStage productId(@NotNull String productId); + ProviderTypeStage productId(@NotNull String productId); + } + + public interface ProviderTypeStage { + QuantityStage providerType(@NotNull BillingProviderType providerType); } public interface QuantityStage { @@ -259,6 +274,7 @@ public static final class Builder NameStage, PriceStage, ProductIdStage, + ProviderTypeStage, QuantityStage, UpdatedAtStage, _FinalStage { @@ -278,6 +294,8 @@ public static final class Builder private String productId; + private BillingProviderType providerType; + private double quantity; private OffsetDateTime updatedAt; @@ -303,6 +321,7 @@ public Builder from(BillingProductResponseData other) { price(other.getPrice()); priceDecimal(other.getPriceDecimal()); productId(other.getProductId()); + providerType(other.getProviderType()); quantity(other.getQuantity()); updatedAt(other.getUpdatedAt()); return this; @@ -359,11 +378,18 @@ public ProductIdStage price(double price) { @java.lang.Override @JsonSetter("product_id") - public QuantityStage productId(@NotNull String productId) { + public ProviderTypeStage productId(@NotNull String productId) { this.productId = Objects.requireNonNull(productId, "productId must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public QuantityStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("quantity") public UpdatedAtStage quantity(double quantity) { @@ -424,6 +450,7 @@ public BillingProductResponseData build() { price, priceDecimal, productId, + providerType, quantity, updatedAt, additionalProperties); diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansRequestPlanType.java b/src/main/java/com/schematic/api/types/BillingProviderType.java similarity index 52% rename from src/main/java/com/schematic/api/resources/plans/types/CountPlansRequestPlanType.java rename to src/main/java/com/schematic/api/types/BillingProviderType.java index d3f97fa..d70df06 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/CountPlansRequestPlanType.java +++ b/src/main/java/com/schematic/api/types/BillingProviderType.java @@ -1,21 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.plans.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CountPlansRequestPlanType { - public static final CountPlansRequestPlanType PLAN = new CountPlansRequestPlanType(Value.PLAN, "plan"); +public final class BillingProviderType { + public static final BillingProviderType SCHEMATIC = new BillingProviderType(Value.SCHEMATIC, "schematic"); - public static final CountPlansRequestPlanType ADD_ON = new CountPlansRequestPlanType(Value.ADD_ON, "add_on"); + public static final BillingProviderType STRIPE = new BillingProviderType(Value.STRIPE, "stripe"); private final Value value; private final String string; - CountPlansRequestPlanType(Value value, String string) { + BillingProviderType(Value value, String string) { this.value = value; this.string = string; } @@ -33,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CountPlansRequestPlanType - && this.string.equals(((CountPlansRequestPlanType) other).string)); + || (other instanceof BillingProviderType && this.string.equals(((BillingProviderType) other).string)); } @java.lang.Override @@ -44,10 +43,10 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case PLAN: - return visitor.visitPlan(); - case ADD_ON: - return visitor.visitAddOn(); + case SCHEMATIC: + return visitor.visitSchematic(); + case STRIPE: + return visitor.visitStripe(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -55,29 +54,29 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountPlansRequestPlanType valueOf(String value) { + public static BillingProviderType valueOf(String value) { switch (value) { - case "plan": - return PLAN; - case "add_on": - return ADD_ON; + case "schematic": + return SCHEMATIC; + case "stripe": + return STRIPE; default: - return new CountPlansRequestPlanType(Value.UNKNOWN, value); + return new BillingProviderType(Value.UNKNOWN, value); } } public enum Value { - PLAN, + SCHEMATIC, - ADD_ON, + STRIPE, UNKNOWN } public interface Visitor { - T visitPlan(); + T visitSchematic(); - T visitAddOn(); + T visitStripe(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java b/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java index 8f39c3d..5528df4 100644 --- a/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java @@ -23,6 +23,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingSubscriptionResponseData.Builder.class) public final class BillingSubscriptionResponseData { + private final Optional applicationId; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -49,6 +51,8 @@ public final class BillingSubscriptionResponseData { private final int periodStart; + private final BillingProviderType providerType; + private final String status; private final String subscriptionExternalId; @@ -57,11 +61,12 @@ public final class BillingSubscriptionResponseData { private final Optional trialEnd; - private final Optional trialEndSetting; + private final Optional trialEndSetting; private final Map additionalProperties; private BillingSubscriptionResponseData( + Optional applicationId, Optional cancelAt, boolean cancelAtPeriodEnd, Optional companyId, @@ -75,12 +80,14 @@ private BillingSubscriptionResponseData( Optional> metadata, int periodEnd, int periodStart, + BillingProviderType providerType, String status, String subscriptionExternalId, int totalPrice, Optional trialEnd, - Optional trialEndSetting, + Optional trialEndSetting, Map additionalProperties) { + this.applicationId = applicationId; this.cancelAt = cancelAt; this.cancelAtPeriodEnd = cancelAtPeriodEnd; this.companyId = companyId; @@ -94,6 +101,7 @@ private BillingSubscriptionResponseData( this.metadata = metadata; this.periodEnd = periodEnd; this.periodStart = periodStart; + this.providerType = providerType; this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.totalPrice = totalPrice; @@ -102,6 +110,11 @@ private BillingSubscriptionResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("application_id") + public Optional getApplicationId() { + return applicationId; + } + @JsonProperty("cancel_at") public Optional getCancelAt() { return cancelAt; @@ -167,6 +180,11 @@ public int getPeriodStart() { return periodStart; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("status") public String getStatus() { return status; @@ -188,7 +206,7 @@ public Optional getTrialEnd() { } @JsonProperty("trial_end_setting") - public Optional getTrialEndSetting() { + public Optional getTrialEndSetting() { return trialEndSetting; } @@ -204,7 +222,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(BillingSubscriptionResponseData other) { - return cancelAt.equals(other.cancelAt) + return applicationId.equals(other.applicationId) + && cancelAt.equals(other.cancelAt) && cancelAtPeriodEnd == other.cancelAtPeriodEnd && companyId.equals(other.companyId) && createdAt.equals(other.createdAt) @@ -217,6 +236,7 @@ private boolean equalTo(BillingSubscriptionResponseData other) { && metadata.equals(other.metadata) && periodEnd == other.periodEnd && periodStart == other.periodStart + && providerType.equals(other.providerType) && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && totalPrice == other.totalPrice @@ -227,6 +247,7 @@ private boolean equalTo(BillingSubscriptionResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.applicationId, this.cancelAt, this.cancelAtPeriodEnd, this.companyId, @@ -240,6 +261,7 @@ public int hashCode() { this.metadata, this.periodEnd, this.periodStart, + this.providerType, this.status, this.subscriptionExternalId, this.totalPrice, @@ -287,7 +309,11 @@ public interface PeriodEndStage { } public interface PeriodStartStage { - StatusStage periodStart(int periodStart); + ProviderTypeStage periodStart(int periodStart); + } + + public interface ProviderTypeStage { + StatusStage providerType(@NotNull BillingProviderType providerType); } public interface StatusStage { @@ -305,6 +331,10 @@ public interface TotalPriceStage { public interface _FinalStage { BillingSubscriptionResponseData build(); + _FinalStage applicationId(Optional applicationId); + + _FinalStage applicationId(String applicationId); + _FinalStage cancelAt(Optional cancelAt); _FinalStage cancelAt(Integer cancelAt); @@ -329,9 +359,9 @@ public interface _FinalStage { _FinalStage trialEnd(Integer trialEnd); - _FinalStage trialEndSetting(Optional trialEndSetting); + _FinalStage trialEndSetting(Optional trialEndSetting); - _FinalStage trialEndSetting(String trialEndSetting); + _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -344,6 +374,7 @@ public static final class Builder IntervalStage, PeriodEndStage, PeriodStartStage, + ProviderTypeStage, StatusStage, SubscriptionExternalIdStage, TotalPriceStage, @@ -364,13 +395,15 @@ public static final class Builder private int periodStart; + private BillingProviderType providerType; + private String status; private String subscriptionExternalId; private int totalPrice; - private Optional trialEndSetting = Optional.empty(); + private Optional trialEndSetting = Optional.empty(); private Optional trialEnd = Optional.empty(); @@ -384,6 +417,8 @@ public static final class Builder private Optional cancelAt = Optional.empty(); + private Optional applicationId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -391,6 +426,7 @@ private Builder() {} @java.lang.Override public Builder from(BillingSubscriptionResponseData other) { + applicationId(other.getApplicationId()); cancelAt(other.getCancelAt()); cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); companyId(other.getCompanyId()); @@ -404,6 +440,7 @@ public Builder from(BillingSubscriptionResponseData other) { metadata(other.getMetadata()); periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); + providerType(other.getProviderType()); status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); totalPrice(other.getTotalPrice()); @@ -463,11 +500,18 @@ public PeriodStartStage periodEnd(int periodEnd) { @java.lang.Override @JsonSetter("period_start") - public StatusStage periodStart(int periodStart) { + public ProviderTypeStage periodStart(int periodStart) { this.periodStart = periodStart; return this; } + @java.lang.Override + @JsonSetter("provider_type") + public StatusStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("status") public SubscriptionExternalIdStage status(@NotNull String status) { @@ -491,14 +535,14 @@ public _FinalStage totalPrice(int totalPrice) { } @java.lang.Override - public _FinalStage trialEndSetting(String trialEndSetting) { + public _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting) { this.trialEndSetting = Optional.ofNullable(trialEndSetting); return this; } @java.lang.Override @JsonSetter(value = "trial_end_setting", nulls = Nulls.SKIP) - public _FinalStage trialEndSetting(Optional trialEndSetting) { + public _FinalStage trialEndSetting(Optional trialEndSetting) { this.trialEndSetting = trialEndSetting; return this; } @@ -581,9 +625,23 @@ public _FinalStage cancelAt(Optional cancelAt) { return this; } + @java.lang.Override + public _FinalStage applicationId(String applicationId) { + this.applicationId = Optional.ofNullable(applicationId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "application_id", nulls = Nulls.SKIP) + public _FinalStage applicationId(Optional applicationId) { + this.applicationId = applicationId; + return this; + } + @java.lang.Override public BillingSubscriptionResponseData build() { return new BillingSubscriptionResponseData( + applicationId, cancelAt, cancelAtPeriodEnd, companyId, @@ -597,6 +655,7 @@ public BillingSubscriptionResponseData build() { metadata, periodEnd, periodStart, + providerType, status, subscriptionExternalId, totalPrice, diff --git a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingSubscriptionRequestBodyTrialEndSetting.java b/src/main/java/com/schematic/api/types/BillingSubscriptionTrialEndSetting.java similarity index 60% rename from src/main/java/com/schematic/api/resources/billing/types/CreateBillingSubscriptionRequestBodyTrialEndSetting.java rename to src/main/java/com/schematic/api/types/BillingSubscriptionTrialEndSetting.java index 0813a04..e5dbc3a 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CreateBillingSubscriptionRequestBodyTrialEndSetting.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionTrialEndSetting.java @@ -1,23 +1,23 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.billing.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateBillingSubscriptionRequestBodyTrialEndSetting { - public static final CreateBillingSubscriptionRequestBodyTrialEndSetting SUBSCRIBE = - new CreateBillingSubscriptionRequestBodyTrialEndSetting(Value.SUBSCRIBE, "subscribe"); +public final class BillingSubscriptionTrialEndSetting { + public static final BillingSubscriptionTrialEndSetting SUBSCRIBE = + new BillingSubscriptionTrialEndSetting(Value.SUBSCRIBE, "subscribe"); - public static final CreateBillingSubscriptionRequestBodyTrialEndSetting CANCEL = - new CreateBillingSubscriptionRequestBodyTrialEndSetting(Value.CANCEL, "cancel"); + public static final BillingSubscriptionTrialEndSetting CANCEL = + new BillingSubscriptionTrialEndSetting(Value.CANCEL, "cancel"); private final Value value; private final String string; - CreateBillingSubscriptionRequestBodyTrialEndSetting(Value value, String string) { + BillingSubscriptionTrialEndSetting(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +35,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateBillingSubscriptionRequestBodyTrialEndSetting - && this.string.equals(((CreateBillingSubscriptionRequestBodyTrialEndSetting) other).string)); + || (other instanceof BillingSubscriptionTrialEndSetting + && this.string.equals(((BillingSubscriptionTrialEndSetting) other).string)); } @java.lang.Override @@ -57,30 +57,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingSubscriptionRequestBodyTrialEndSetting valueOf(String value) { + public static BillingSubscriptionTrialEndSetting valueOf(String value) { switch (value) { case "subscribe": return SUBSCRIBE; case "cancel": return CANCEL; default: - return new CreateBillingSubscriptionRequestBodyTrialEndSetting(Value.UNKNOWN, value); + return new BillingSubscriptionTrialEndSetting(Value.UNKNOWN, value); } } public enum Value { - SUBSCRIBE, - CANCEL, + SUBSCRIBE, + UNKNOWN } public interface Visitor { - T visitSubscribe(); - T visitCancel(); + T visitSubscribe(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/BillingSubscriptionView.java b/src/main/java/com/schematic/api/types/BillingSubscriptionView.java index 897f01c..de69cf0 100644 --- a/src/main/java/com/schematic/api/types/BillingSubscriptionView.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionView.java @@ -25,6 +25,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingSubscriptionView.Builder.class) public final class BillingSubscriptionView { + private final Optional applicationId; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -59,6 +61,8 @@ public final class BillingSubscriptionView { private final List products; + private final BillingProviderType providerType; + private final String status; private final String subscriptionExternalId; @@ -67,11 +71,12 @@ public final class BillingSubscriptionView { private final Optional trialEnd; - private final Optional trialEndSetting; + private final Optional trialEndSetting; private final Map additionalProperties; private BillingSubscriptionView( + Optional applicationId, Optional cancelAt, boolean cancelAtPeriodEnd, Optional companyId, @@ -89,12 +94,14 @@ private BillingSubscriptionView( int periodEnd, int periodStart, List products, + BillingProviderType providerType, String status, String subscriptionExternalId, int totalPrice, Optional trialEnd, - Optional trialEndSetting, + Optional trialEndSetting, Map additionalProperties) { + this.applicationId = applicationId; this.cancelAt = cancelAt; this.cancelAtPeriodEnd = cancelAtPeriodEnd; this.companyId = companyId; @@ -112,6 +119,7 @@ private BillingSubscriptionView( this.periodEnd = periodEnd; this.periodStart = periodStart; this.products = products; + this.providerType = providerType; this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.totalPrice = totalPrice; @@ -120,6 +128,11 @@ private BillingSubscriptionView( this.additionalProperties = additionalProperties; } + @JsonProperty("application_id") + public Optional getApplicationId() { + return applicationId; + } + @JsonProperty("cancel_at") public Optional getCancelAt() { return cancelAt; @@ -205,6 +218,11 @@ public List getProducts() { return products; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("status") public String getStatus() { return status; @@ -226,7 +244,7 @@ public Optional getTrialEnd() { } @JsonProperty("trial_end_setting") - public Optional getTrialEndSetting() { + public Optional getTrialEndSetting() { return trialEndSetting; } @@ -242,7 +260,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(BillingSubscriptionView other) { - return cancelAt.equals(other.cancelAt) + return applicationId.equals(other.applicationId) + && cancelAt.equals(other.cancelAt) && cancelAtPeriodEnd == other.cancelAtPeriodEnd && companyId.equals(other.companyId) && createdAt.equals(other.createdAt) @@ -259,6 +278,7 @@ private boolean equalTo(BillingSubscriptionView other) { && periodEnd == other.periodEnd && periodStart == other.periodStart && products.equals(other.products) + && providerType.equals(other.providerType) && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && totalPrice == other.totalPrice @@ -269,6 +289,7 @@ private boolean equalTo(BillingSubscriptionView other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.applicationId, this.cancelAt, this.cancelAtPeriodEnd, this.companyId, @@ -286,6 +307,7 @@ public int hashCode() { this.periodEnd, this.periodStart, this.products, + this.providerType, this.status, this.subscriptionExternalId, this.totalPrice, @@ -333,7 +355,11 @@ public interface PeriodEndStage { } public interface PeriodStartStage { - StatusStage periodStart(int periodStart); + ProviderTypeStage periodStart(int periodStart); + } + + public interface ProviderTypeStage { + StatusStage providerType(@NotNull BillingProviderType providerType); } public interface StatusStage { @@ -351,6 +377,10 @@ public interface TotalPriceStage { public interface _FinalStage { BillingSubscriptionView build(); + _FinalStage applicationId(Optional applicationId); + + _FinalStage applicationId(String applicationId); + _FinalStage cancelAt(Optional cancelAt); _FinalStage cancelAt(Integer cancelAt); @@ -395,9 +425,9 @@ public interface _FinalStage { _FinalStage trialEnd(Integer trialEnd); - _FinalStage trialEndSetting(Optional trialEndSetting); + _FinalStage trialEndSetting(Optional trialEndSetting); - _FinalStage trialEndSetting(String trialEndSetting); + _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -410,6 +440,7 @@ public static final class Builder IntervalStage, PeriodEndStage, PeriodStartStage, + ProviderTypeStage, StatusStage, SubscriptionExternalIdStage, TotalPriceStage, @@ -430,13 +461,15 @@ public static final class Builder private int periodStart; + private BillingProviderType providerType; + private String status; private String subscriptionExternalId; private int totalPrice; - private Optional trialEndSetting = Optional.empty(); + private Optional trialEndSetting = Optional.empty(); private Optional trialEnd = Optional.empty(); @@ -458,6 +491,8 @@ public static final class Builder private Optional cancelAt = Optional.empty(); + private Optional applicationId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -465,6 +500,7 @@ private Builder() {} @java.lang.Override public Builder from(BillingSubscriptionView other) { + applicationId(other.getApplicationId()); cancelAt(other.getCancelAt()); cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); companyId(other.getCompanyId()); @@ -482,6 +518,7 @@ public Builder from(BillingSubscriptionView other) { periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); products(other.getProducts()); + providerType(other.getProviderType()); status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); totalPrice(other.getTotalPrice()); @@ -541,11 +578,18 @@ public PeriodStartStage periodEnd(int periodEnd) { @java.lang.Override @JsonSetter("period_start") - public StatusStage periodStart(int periodStart) { + public ProviderTypeStage periodStart(int periodStart) { this.periodStart = periodStart; return this; } + @java.lang.Override + @JsonSetter("provider_type") + public StatusStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("status") public SubscriptionExternalIdStage status(@NotNull String status) { @@ -569,14 +613,14 @@ public _FinalStage totalPrice(int totalPrice) { } @java.lang.Override - public _FinalStage trialEndSetting(String trialEndSetting) { + public _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting) { this.trialEndSetting = Optional.ofNullable(trialEndSetting); return this; } @java.lang.Override @JsonSetter(value = "trial_end_setting", nulls = Nulls.SKIP) - public _FinalStage trialEndSetting(Optional trialEndSetting) { + public _FinalStage trialEndSetting(Optional trialEndSetting) { this.trialEndSetting = trialEndSetting; return this; } @@ -733,9 +777,23 @@ public _FinalStage cancelAt(Optional cancelAt) { return this; } + @java.lang.Override + public _FinalStage applicationId(String applicationId) { + this.applicationId = Optional.ofNullable(applicationId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "application_id", nulls = Nulls.SKIP) + public _FinalStage applicationId(Optional applicationId) { + this.applicationId = applicationId; + return this; + } + @java.lang.Override public BillingSubscriptionView build() { return new BillingSubscriptionView( + applicationId, cancelAt, cancelAtPeriodEnd, companyId, @@ -753,6 +811,7 @@ public BillingSubscriptionView build() { periodEnd, periodStart, products, + providerType, status, subscriptionExternalId, totalPrice, diff --git a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesRequestTiersMode.java b/src/main/java/com/schematic/api/types/BillingTiersMode.java similarity index 64% rename from src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesRequestTiersMode.java rename to src/main/java/com/schematic/api/types/BillingTiersMode.java index 9fb8dbe..e96665c 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/SearchBillingPricesRequestTiersMode.java +++ b/src/main/java/com/schematic/api/types/BillingTiersMode.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.billing.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class SearchBillingPricesRequestTiersMode { - public static final SearchBillingPricesRequestTiersMode GRADUATED = - new SearchBillingPricesRequestTiersMode(Value.GRADUATED, "graduated"); +public final class BillingTiersMode { + public static final BillingTiersMode GRADUATED = new BillingTiersMode(Value.GRADUATED, "graduated"); - public static final SearchBillingPricesRequestTiersMode VOLUME = - new SearchBillingPricesRequestTiersMode(Value.VOLUME, "volume"); + public static final BillingTiersMode VOLUME = new BillingTiersMode(Value.VOLUME, "volume"); private final Value value; private final String string; - SearchBillingPricesRequestTiersMode(Value value, String string) { + BillingTiersMode(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof SearchBillingPricesRequestTiersMode - && this.string.equals(((SearchBillingPricesRequestTiersMode) other).string)); + || (other instanceof BillingTiersMode && this.string.equals(((BillingTiersMode) other).string)); } @java.lang.Override @@ -57,30 +54,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SearchBillingPricesRequestTiersMode valueOf(String value) { + public static BillingTiersMode valueOf(String value) { switch (value) { case "graduated": return GRADUATED; case "volume": return VOLUME; default: - return new SearchBillingPricesRequestTiersMode(Value.UNKNOWN, value); + return new BillingTiersMode(Value.UNKNOWN, value); } } public enum Value { - VOLUME, - GRADUATED, + VOLUME, + UNKNOWN } public interface Visitor { - T visitVolume(); - T visitGraduated(); + T visitVolume(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductRequestBodyChargeType.java b/src/main/java/com/schematic/api/types/ChargeType.java similarity index 60% rename from src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductRequestBodyChargeType.java rename to src/main/java/com/schematic/api/types/ChargeType.java index 6c96d66..36426db 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductRequestBodyChargeType.java +++ b/src/main/java/com/schematic/api/types/ChargeType.java @@ -1,26 +1,23 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.plans.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpsertBillingProductRequestBodyChargeType { - public static final UpsertBillingProductRequestBodyChargeType RECURRING = - new UpsertBillingProductRequestBodyChargeType(Value.RECURRING, "recurring"); +public final class ChargeType { + public static final ChargeType RECURRING = new ChargeType(Value.RECURRING, "recurring"); - public static final UpsertBillingProductRequestBodyChargeType ONE_TIME = - new UpsertBillingProductRequestBodyChargeType(Value.ONE_TIME, "one_time"); + public static final ChargeType FREE = new ChargeType(Value.FREE, "free"); - public static final UpsertBillingProductRequestBodyChargeType FREE = - new UpsertBillingProductRequestBodyChargeType(Value.FREE, "free"); + public static final ChargeType ONE_TIME = new ChargeType(Value.ONE_TIME, "one_time"); private final Value value; private final String string; - UpsertBillingProductRequestBodyChargeType(Value value, String string) { + ChargeType(Value value, String string) { this.value = value; this.string = string; } @@ -37,9 +34,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof UpsertBillingProductRequestBodyChargeType - && this.string.equals(((UpsertBillingProductRequestBodyChargeType) other).string)); + return (this == other) || (other instanceof ChargeType && this.string.equals(((ChargeType) other).string)); } @java.lang.Override @@ -51,10 +46,10 @@ public T visit(Visitor visitor) { switch (value) { case RECURRING: return visitor.visitRecurring(); - case ONE_TIME: - return visitor.visitOneTime(); case FREE: return visitor.visitFree(); + case ONE_TIME: + return visitor.visitOneTime(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -62,36 +57,36 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpsertBillingProductRequestBodyChargeType valueOf(String value) { + public static ChargeType valueOf(String value) { switch (value) { case "recurring": return RECURRING; - case "one_time": - return ONE_TIME; case "free": return FREE; + case "one_time": + return ONE_TIME; default: - return new UpsertBillingProductRequestBodyChargeType(Value.UNKNOWN, value); + return new ChargeType(Value.UNKNOWN, value); } } public enum Value { + FREE, + ONE_TIME, RECURRING, - FREE, - UNKNOWN } public interface Visitor { + T visitFree(); + T visitOneTime(); T visitRecurring(); - T visitFree(); - T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java new file mode 100644 index 0000000..bc36fa3 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CheckFlagsBulkResponseData.Builder.class) +public final class CheckFlagsBulkResponseData { + private final List data; + + private final Map additionalProperties; + + private CheckFlagsBulkResponseData(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CheckFlagsBulkResponseData && equalTo((CheckFlagsBulkResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CheckFlagsBulkResponseData other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CheckFlagsBulkResponseData other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(CheckFlagsResponseData data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public CheckFlagsBulkResponseData build() { + return new CheckFlagsBulkResponseData(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CheckoutSubscription.java b/src/main/java/com/schematic/api/types/CheckoutSubscription.java index ea8916c..55a1e3f 100644 --- a/src/main/java/com/schematic/api/types/CheckoutSubscription.java +++ b/src/main/java/com/schematic/api/types/CheckoutSubscription.java @@ -23,6 +23,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CheckoutSubscription.Builder.class) public final class CheckoutSubscription { + private final Optional applicationId; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -53,6 +55,8 @@ public final class CheckoutSubscription { private final int periodStart; + private final BillingProviderType providerType; + private final String status; private final String subscriptionExternalId; @@ -61,11 +65,12 @@ public final class CheckoutSubscription { private final Optional trialEnd; - private final Optional trialEndSetting; + private final Optional trialEndSetting; private final Map additionalProperties; private CheckoutSubscription( + Optional applicationId, Optional cancelAt, boolean cancelAtPeriodEnd, Optional companyId, @@ -81,12 +86,14 @@ private CheckoutSubscription( Optional> metadata, int periodEnd, int periodStart, + BillingProviderType providerType, String status, String subscriptionExternalId, int totalPrice, Optional trialEnd, - Optional trialEndSetting, + Optional trialEndSetting, Map additionalProperties) { + this.applicationId = applicationId; this.cancelAt = cancelAt; this.cancelAtPeriodEnd = cancelAtPeriodEnd; this.companyId = companyId; @@ -102,6 +109,7 @@ private CheckoutSubscription( this.metadata = metadata; this.periodEnd = periodEnd; this.periodStart = periodStart; + this.providerType = providerType; this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.totalPrice = totalPrice; @@ -110,6 +118,11 @@ private CheckoutSubscription( this.additionalProperties = additionalProperties; } + @JsonProperty("application_id") + public Optional getApplicationId() { + return applicationId; + } + @JsonProperty("cancel_at") public Optional getCancelAt() { return cancelAt; @@ -185,6 +198,11 @@ public int getPeriodStart() { return periodStart; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("status") public String getStatus() { return status; @@ -206,7 +224,7 @@ public Optional getTrialEnd() { } @JsonProperty("trial_end_setting") - public Optional getTrialEndSetting() { + public Optional getTrialEndSetting() { return trialEndSetting; } @@ -222,7 +240,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(CheckoutSubscription other) { - return cancelAt.equals(other.cancelAt) + return applicationId.equals(other.applicationId) + && cancelAt.equals(other.cancelAt) && cancelAtPeriodEnd == other.cancelAtPeriodEnd && companyId.equals(other.companyId) && confirmPaymentIntentClientSecret.equals(other.confirmPaymentIntentClientSecret) @@ -237,6 +256,7 @@ private boolean equalTo(CheckoutSubscription other) { && metadata.equals(other.metadata) && periodEnd == other.periodEnd && periodStart == other.periodStart + && providerType.equals(other.providerType) && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && totalPrice == other.totalPrice @@ -247,6 +267,7 @@ private boolean equalTo(CheckoutSubscription other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.applicationId, this.cancelAt, this.cancelAtPeriodEnd, this.companyId, @@ -262,6 +283,7 @@ public int hashCode() { this.metadata, this.periodEnd, this.periodStart, + this.providerType, this.status, this.subscriptionExternalId, this.totalPrice, @@ -309,7 +331,11 @@ public interface PeriodEndStage { } public interface PeriodStartStage { - StatusStage periodStart(int periodStart); + ProviderTypeStage periodStart(int periodStart); + } + + public interface ProviderTypeStage { + StatusStage providerType(@NotNull BillingProviderType providerType); } public interface StatusStage { @@ -327,6 +353,10 @@ public interface TotalPriceStage { public interface _FinalStage { CheckoutSubscription build(); + _FinalStage applicationId(Optional applicationId); + + _FinalStage applicationId(String applicationId); + _FinalStage cancelAt(Optional cancelAt); _FinalStage cancelAt(Integer cancelAt); @@ -359,9 +389,9 @@ public interface _FinalStage { _FinalStage trialEnd(Integer trialEnd); - _FinalStage trialEndSetting(Optional trialEndSetting); + _FinalStage trialEndSetting(Optional trialEndSetting); - _FinalStage trialEndSetting(String trialEndSetting); + _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -374,6 +404,7 @@ public static final class Builder IntervalStage, PeriodEndStage, PeriodStartStage, + ProviderTypeStage, StatusStage, SubscriptionExternalIdStage, TotalPriceStage, @@ -394,13 +425,15 @@ public static final class Builder private int periodStart; + private BillingProviderType providerType; + private String status; private String subscriptionExternalId; private int totalPrice; - private Optional trialEndSetting = Optional.empty(); + private Optional trialEndSetting = Optional.empty(); private Optional trialEnd = Optional.empty(); @@ -418,6 +451,8 @@ public static final class Builder private Optional cancelAt = Optional.empty(); + private Optional applicationId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -425,6 +460,7 @@ private Builder() {} @java.lang.Override public Builder from(CheckoutSubscription other) { + applicationId(other.getApplicationId()); cancelAt(other.getCancelAt()); cancelAtPeriodEnd(other.getCancelAtPeriodEnd()); companyId(other.getCompanyId()); @@ -440,6 +476,7 @@ public Builder from(CheckoutSubscription other) { metadata(other.getMetadata()); periodEnd(other.getPeriodEnd()); periodStart(other.getPeriodStart()); + providerType(other.getProviderType()); status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); totalPrice(other.getTotalPrice()); @@ -499,11 +536,18 @@ public PeriodStartStage periodEnd(int periodEnd) { @java.lang.Override @JsonSetter("period_start") - public StatusStage periodStart(int periodStart) { + public ProviderTypeStage periodStart(int periodStart) { this.periodStart = periodStart; return this; } + @java.lang.Override + @JsonSetter("provider_type") + public StatusStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("status") public SubscriptionExternalIdStage status(@NotNull String status) { @@ -527,14 +571,14 @@ public _FinalStage totalPrice(int totalPrice) { } @java.lang.Override - public _FinalStage trialEndSetting(String trialEndSetting) { + public _FinalStage trialEndSetting(BillingSubscriptionTrialEndSetting trialEndSetting) { this.trialEndSetting = Optional.ofNullable(trialEndSetting); return this; } @java.lang.Override @JsonSetter(value = "trial_end_setting", nulls = Nulls.SKIP) - public _FinalStage trialEndSetting(Optional trialEndSetting) { + public _FinalStage trialEndSetting(Optional trialEndSetting) { this.trialEndSetting = trialEndSetting; return this; } @@ -643,9 +687,23 @@ public _FinalStage cancelAt(Optional cancelAt) { return this; } + @java.lang.Override + public _FinalStage applicationId(String applicationId) { + this.applicationId = Optional.ofNullable(applicationId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "application_id", nulls = Nulls.SKIP) + public _FinalStage applicationId(Optional applicationId) { + this.applicationId = applicationId; + return this; + } + @java.lang.Override public CheckoutSubscription build() { return new CheckoutSubscription( + applicationId, cancelAt, cancelAtPeriodEnd, companyId, @@ -661,6 +719,7 @@ public CheckoutSubscription build() { metadata, periodEnd, periodStart, + providerType, status, subscriptionExternalId, totalPrice, diff --git a/src/main/java/com/schematic/api/types/CompanyCrmDealsResponseData.java b/src/main/java/com/schematic/api/types/CompanyCrmDealsResponseData.java deleted file mode 100644 index 9b72763..0000000 --- a/src/main/java/com/schematic/api/types/CompanyCrmDealsResponseData.java +++ /dev/null @@ -1,230 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import java.util.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 = CompanyCrmDealsResponseData.Builder.class) -public final class CompanyCrmDealsResponseData { - private final String dealArr; - - private final String dealExternalId; - - private final String dealMrr; - - private final Optional dealName; - - private final List lineItems; - - private final Map additionalProperties; - - private CompanyCrmDealsResponseData( - String dealArr, - String dealExternalId, - String dealMrr, - Optional dealName, - List lineItems, - Map additionalProperties) { - this.dealArr = dealArr; - this.dealExternalId = dealExternalId; - this.dealMrr = dealMrr; - this.dealName = dealName; - this.lineItems = lineItems; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("deal_arr") - public String getDealArr() { - return dealArr; - } - - @JsonProperty("deal_external_id") - public String getDealExternalId() { - return dealExternalId; - } - - @JsonProperty("deal_mrr") - public String getDealMrr() { - return dealMrr; - } - - @JsonProperty("deal_name") - public Optional getDealName() { - return dealName; - } - - @JsonProperty("line_items") - public List getLineItems() { - return lineItems; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CompanyCrmDealsResponseData && equalTo((CompanyCrmDealsResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CompanyCrmDealsResponseData other) { - return dealArr.equals(other.dealArr) - && dealExternalId.equals(other.dealExternalId) - && dealMrr.equals(other.dealMrr) - && dealName.equals(other.dealName) - && lineItems.equals(other.lineItems); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.dealArr, this.dealExternalId, this.dealMrr, this.dealName, this.lineItems); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DealArrStage builder() { - return new Builder(); - } - - public interface DealArrStage { - DealExternalIdStage dealArr(@NotNull String dealArr); - - Builder from(CompanyCrmDealsResponseData other); - } - - public interface DealExternalIdStage { - DealMrrStage dealExternalId(@NotNull String dealExternalId); - } - - public interface DealMrrStage { - _FinalStage dealMrr(@NotNull String dealMrr); - } - - public interface _FinalStage { - CompanyCrmDealsResponseData build(); - - _FinalStage dealName(Optional dealName); - - _FinalStage dealName(String dealName); - - _FinalStage lineItems(List lineItems); - - _FinalStage addLineItems(CrmDealLineItem lineItems); - - _FinalStage addAllLineItems(List lineItems); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DealArrStage, DealExternalIdStage, DealMrrStage, _FinalStage { - private String dealArr; - - private String dealExternalId; - - private String dealMrr; - - private List lineItems = new ArrayList<>(); - - private Optional dealName = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CompanyCrmDealsResponseData other) { - dealArr(other.getDealArr()); - dealExternalId(other.getDealExternalId()); - dealMrr(other.getDealMrr()); - dealName(other.getDealName()); - lineItems(other.getLineItems()); - return this; - } - - @java.lang.Override - @JsonSetter("deal_arr") - public DealExternalIdStage dealArr(@NotNull String dealArr) { - this.dealArr = Objects.requireNonNull(dealArr, "dealArr must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("deal_external_id") - public DealMrrStage dealExternalId(@NotNull String dealExternalId) { - this.dealExternalId = Objects.requireNonNull(dealExternalId, "dealExternalId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("deal_mrr") - public _FinalStage dealMrr(@NotNull String dealMrr) { - this.dealMrr = Objects.requireNonNull(dealMrr, "dealMrr must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllLineItems(List lineItems) { - if (lineItems != null) { - this.lineItems.addAll(lineItems); - } - return this; - } - - @java.lang.Override - public _FinalStage addLineItems(CrmDealLineItem lineItems) { - this.lineItems.add(lineItems); - return this; - } - - @java.lang.Override - @JsonSetter(value = "line_items", nulls = Nulls.SKIP) - public _FinalStage lineItems(List lineItems) { - this.lineItems.clear(); - if (lineItems != null) { - this.lineItems.addAll(lineItems); - } - return this; - } - - @java.lang.Override - public _FinalStage dealName(String dealName) { - this.dealName = Optional.ofNullable(dealName); - return this; - } - - @java.lang.Override - @JsonSetter(value = "deal_name", nulls = Nulls.SKIP) - public _FinalStage dealName(Optional dealName) { - this.dealName = dealName; - return this; - } - - @java.lang.Override - public CompanyCrmDealsResponseData build() { - return new CompanyCrmDealsResponseData( - dealArr, dealExternalId, dealMrr, dealName, lineItems, additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java index 128dab8..9a10185 100644 --- a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java @@ -37,6 +37,8 @@ public final class CompanyDetailResponseData { private final Optional defaultPaymentMethod; + private final List entitlements; + private final List entityTraits; private final String environmentId; @@ -76,6 +78,7 @@ private CompanyDetailResponseData( List billingSubscriptions, OffsetDateTime createdAt, Optional defaultPaymentMethod, + List entitlements, List entityTraits, String environmentId, String id, @@ -98,6 +101,7 @@ private CompanyDetailResponseData( this.billingSubscriptions = billingSubscriptions; this.createdAt = createdAt; this.defaultPaymentMethod = defaultPaymentMethod; + this.entitlements = entitlements; this.entityTraits = entityTraits; this.environmentId = environmentId; this.id = id; @@ -146,6 +150,11 @@ public Optional getDefaultPaymentMethod() { return defaultPaymentMethod; } + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + @JsonProperty("entity_traits") public List getEntityTraits() { return entityTraits; @@ -242,6 +251,7 @@ private boolean equalTo(CompanyDetailResponseData other) { && billingSubscriptions.equals(other.billingSubscriptions) && createdAt.equals(other.createdAt) && defaultPaymentMethod.equals(other.defaultPaymentMethod) + && entitlements.equals(other.entitlements) && entityTraits.equals(other.entityTraits) && environmentId.equals(other.environmentId) && id.equals(other.id) @@ -268,6 +278,7 @@ public int hashCode() { this.billingSubscriptions, this.createdAt, this.defaultPaymentMethod, + this.entitlements, this.entityTraits, this.environmentId, this.id, @@ -347,6 +358,12 @@ public interface _FinalStage { _FinalStage defaultPaymentMethod(PaymentMethodResponseData defaultPaymentMethod); + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(FeatureEntitlement entitlements); + + _FinalStage addAllEntitlements(List entitlements); + _FinalStage entityTraits(List entityTraits); _FinalStage addEntityTraits(EntityTraitDetailResponseData entityTraits); @@ -444,6 +461,8 @@ public static final class Builder private List entityTraits = new ArrayList<>(); + private List entitlements = new ArrayList<>(); + private Optional defaultPaymentMethod = Optional.empty(); private List billingSubscriptions = new ArrayList<>(); @@ -467,6 +486,7 @@ public Builder from(CompanyDetailResponseData other) { billingSubscriptions(other.getBillingSubscriptions()); createdAt(other.getCreatedAt()); defaultPaymentMethod(other.getDefaultPaymentMethod()); + entitlements(other.getEntitlements()); entityTraits(other.getEntityTraits()); environmentId(other.getEnvironmentId()); id(other.getId()); @@ -730,6 +750,30 @@ public _FinalStage entityTraits(List entityTraits return this; } + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @java.lang.Override + public _FinalStage addEntitlements(FeatureEntitlement entitlements) { + this.entitlements.add(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(List entitlements) { + this.entitlements.clear(); + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + @java.lang.Override public _FinalStage defaultPaymentMethod(PaymentMethodResponseData defaultPaymentMethod) { this.defaultPaymentMethod = Optional.ofNullable(defaultPaymentMethod); @@ -826,6 +870,7 @@ public CompanyDetailResponseData build() { billingSubscriptions, createdAt, defaultPaymentMethod, + entitlements, entityTraits, environmentId, id, diff --git a/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java b/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java index 674f7c7..a5a00b2 100644 --- a/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java @@ -62,7 +62,7 @@ public final class CompanyOverrideResponseData { private final Optional valueTraitId; - private final String valueType; + private final EntitlementValueType valueType; private final Map additionalProperties; @@ -86,7 +86,7 @@ private CompanyOverrideResponseData( Optional valueNumeric, Optional valueTrait, Optional valueTraitId, - String valueType, + EntitlementValueType valueType, Map additionalProperties) { this.company = company; this.companyId = companyId; @@ -207,7 +207,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public String getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -306,7 +306,7 @@ public interface UpdatedAtStage { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull String valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { @@ -389,7 +389,7 @@ public static final class Builder private OffsetDateTime updatedAt; - private String valueType; + private EntitlementValueType valueType; private Optional valueTraitId = Optional.empty(); @@ -491,7 +491,7 @@ public ValueTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull String valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java index 1d355ac..be1d75d 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java @@ -28,7 +28,7 @@ public final class CompanyPlanDetailResponseData { private final Optional billingProduct; - private final String chargeType; + private final ChargeType chargeType; private final boolean companyCanTrial; @@ -36,7 +36,7 @@ public final class CompanyPlanDetailResponseData { private final List compatiblePlanIds; - private final String controlledBy; + private final PlanControlledByType controlledBy; private final OffsetDateTime createdAt; @@ -58,6 +58,8 @@ public final class CompanyPlanDetailResponseData { private final List includedCreditGrants; + private final Optional invalidReason; + private final boolean isCustom; private final boolean isDefault; @@ -72,7 +74,7 @@ public final class CompanyPlanDetailResponseData { private final Optional oneTimePrice; - private final String planType; + private final PlanType planType; private final Optional trialDays; @@ -82,6 +84,8 @@ public final class CompanyPlanDetailResponseData { private final boolean valid; + private final List versions; + private final Optional yearlyPrice; private final Map additionalProperties; @@ -89,11 +93,11 @@ public final class CompanyPlanDetailResponseData { private CompanyPlanDetailResponseData( Optional audienceType, Optional billingProduct, - String chargeType, + ChargeType chargeType, boolean companyCanTrial, int companyCount, List compatiblePlanIds, - String controlledBy, + PlanControlledByType controlledBy, OffsetDateTime createdAt, boolean current, boolean custom, @@ -104,6 +108,7 @@ private CompanyPlanDetailResponseData( String icon, String id, List includedCreditGrants, + Optional invalidReason, boolean isCustom, boolean isDefault, boolean isFree, @@ -111,11 +116,12 @@ private CompanyPlanDetailResponseData( Optional monthlyPrice, String name, Optional oneTimePrice, - String planType, + PlanType planType, Optional trialDays, OffsetDateTime updatedAt, List usageViolations, boolean valid, + List versions, Optional yearlyPrice, Map additionalProperties) { this.audienceType = audienceType; @@ -135,6 +141,7 @@ private CompanyPlanDetailResponseData( this.icon = icon; this.id = id; this.includedCreditGrants = includedCreditGrants; + this.invalidReason = invalidReason; this.isCustom = isCustom; this.isDefault = isDefault; this.isFree = isFree; @@ -147,6 +154,7 @@ private CompanyPlanDetailResponseData( this.updatedAt = updatedAt; this.usageViolations = usageViolations; this.valid = valid; + this.versions = versions; this.yearlyPrice = yearlyPrice; this.additionalProperties = additionalProperties; } @@ -162,7 +170,7 @@ public Optional getBillingProduct() { } @JsonProperty("charge_type") - public String getChargeType() { + public ChargeType getChargeType() { return chargeType; } @@ -182,7 +190,7 @@ public List getCompatiblePlanIds() { } @JsonProperty("controlled_by") - public String getControlledBy() { + public PlanControlledByType getControlledBy() { return controlledBy; } @@ -236,6 +244,11 @@ public List getIncludedCreditGrants() { return includedCreditGrants; } + @JsonProperty("invalid_reason") + public Optional getInvalidReason() { + return invalidReason; + } + @JsonProperty("is_custom") public boolean getIsCustom() { return isCustom; @@ -272,7 +285,7 @@ public Optional getOneTimePrice() { } @JsonProperty("plan_type") - public String getPlanType() { + public PlanType getPlanType() { return planType; } @@ -296,6 +309,11 @@ public boolean getValid() { return valid; } + @JsonProperty("versions") + public List getVersions() { + return versions; + } + @JsonProperty("yearly_price") public Optional getYearlyPrice() { return yearlyPrice; @@ -330,6 +348,7 @@ private boolean equalTo(CompanyPlanDetailResponseData other) { && icon.equals(other.icon) && id.equals(other.id) && includedCreditGrants.equals(other.includedCreditGrants) + && invalidReason.equals(other.invalidReason) && isCustom == other.isCustom && isDefault == other.isDefault && isFree == other.isFree @@ -342,6 +361,7 @@ private boolean equalTo(CompanyPlanDetailResponseData other) { && updatedAt.equals(other.updatedAt) && usageViolations.equals(other.usageViolations) && valid == other.valid + && versions.equals(other.versions) && yearlyPrice.equals(other.yearlyPrice); } @@ -365,6 +385,7 @@ public int hashCode() { this.icon, this.id, this.includedCreditGrants, + this.invalidReason, this.isCustom, this.isDefault, this.isFree, @@ -377,6 +398,7 @@ public int hashCode() { this.updatedAt, this.usageViolations, this.valid, + this.versions, this.yearlyPrice); } @@ -390,7 +412,7 @@ public static ChargeTypeStage builder() { } public interface ChargeTypeStage { - CompanyCanTrialStage chargeType(@NotNull String chargeType); + CompanyCanTrialStage chargeType(@NotNull ChargeType chargeType); Builder from(CompanyPlanDetailResponseData other); } @@ -404,7 +426,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull String controlledBy); + CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); } public interface CreatedAtStage { @@ -452,7 +474,7 @@ public interface NameStage { } public interface PlanTypeStage { - UpdatedAtStage planType(@NotNull String planType); + UpdatedAtStage planType(@NotNull PlanType planType); } public interface UpdatedAtStage { @@ -502,6 +524,10 @@ public interface _FinalStage { _FinalStage addAllIncludedCreditGrants(List includedCreditGrants); + _FinalStage invalidReason(Optional invalidReason); + + _FinalStage invalidReason(CompanyPlanInvalidReason invalidReason); + _FinalStage monthlyPrice(Optional monthlyPrice); _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); @@ -520,6 +546,12 @@ public interface _FinalStage { _FinalStage addAllUsageViolations(List usageViolations); + _FinalStage versions(List versions); + + _FinalStage addVersions(PlanVersionResponseData versions); + + _FinalStage addAllVersions(List versions); + _FinalStage yearlyPrice(Optional yearlyPrice); _FinalStage yearlyPrice(BillingPriceResponseData yearlyPrice); @@ -546,13 +578,13 @@ public static final class Builder UpdatedAtStage, ValidStage, _FinalStage { - private String chargeType; + private ChargeType chargeType; private boolean companyCanTrial; private int companyCount; - private String controlledBy; + private PlanControlledByType controlledBy; private OffsetDateTime createdAt; @@ -576,7 +608,7 @@ public static final class Builder private String name; - private String planType; + private PlanType planType; private OffsetDateTime updatedAt; @@ -584,6 +616,8 @@ public static final class Builder private Optional yearlyPrice = Optional.empty(); + private List versions = new ArrayList<>(); + private List usageViolations = new ArrayList<>(); private Optional trialDays = Optional.empty(); @@ -592,6 +626,8 @@ public static final class Builder private Optional monthlyPrice = Optional.empty(); + private Optional invalidReason = Optional.empty(); + private List includedCreditGrants = new ArrayList<>(); private List features = new ArrayList<>(); @@ -630,6 +666,7 @@ public Builder from(CompanyPlanDetailResponseData other) { icon(other.getIcon()); id(other.getId()); includedCreditGrants(other.getIncludedCreditGrants()); + invalidReason(other.getInvalidReason()); isCustom(other.getIsCustom()); isDefault(other.getIsDefault()); isFree(other.getIsFree()); @@ -642,13 +679,14 @@ public Builder from(CompanyPlanDetailResponseData other) { updatedAt(other.getUpdatedAt()); usageViolations(other.getUsageViolations()); valid(other.getValid()); + versions(other.getVersions()); yearlyPrice(other.getYearlyPrice()); return this; } @java.lang.Override @JsonSetter("charge_type") - public CompanyCanTrialStage chargeType(@NotNull String chargeType) { + public CompanyCanTrialStage chargeType(@NotNull ChargeType chargeType) { this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); return this; } @@ -669,7 +707,7 @@ public ControlledByStage companyCount(int companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull String controlledBy) { + public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -753,7 +791,7 @@ public PlanTypeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("plan_type") - public UpdatedAtStage planType(@NotNull String planType) { + public UpdatedAtStage planType(@NotNull PlanType planType) { this.planType = Objects.requireNonNull(planType, "planType must not be null"); return this; } @@ -785,6 +823,30 @@ public _FinalStage yearlyPrice(Optional yearlyPrice) { return this; } + @java.lang.Override + public _FinalStage addAllVersions(List versions) { + if (versions != null) { + this.versions.addAll(versions); + } + return this; + } + + @java.lang.Override + public _FinalStage addVersions(PlanVersionResponseData versions) { + this.versions.add(versions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "versions", nulls = Nulls.SKIP) + public _FinalStage versions(List versions) { + this.versions.clear(); + if (versions != null) { + this.versions.addAll(versions); + } + return this; + } + @java.lang.Override public _FinalStage addAllUsageViolations(List usageViolations) { if (usageViolations != null) { @@ -848,6 +910,19 @@ public _FinalStage monthlyPrice(Optional monthlyPrice) return this; } + @java.lang.Override + public _FinalStage invalidReason(CompanyPlanInvalidReason invalidReason) { + this.invalidReason = Optional.ofNullable(invalidReason); + return this; + } + + @java.lang.Override + @JsonSetter(value = "invalid_reason", nulls = Nulls.SKIP) + public _FinalStage invalidReason(Optional invalidReason) { + this.invalidReason = invalidReason; + return this; + } + @java.lang.Override public _FinalStage addAllIncludedCreditGrants(List includedCreditGrants) { if (includedCreditGrants != null) { @@ -1003,6 +1078,7 @@ public CompanyPlanDetailResponseData build() { icon, id, includedCreditGrants, + invalidReason, isCustom, isDefault, isFree, @@ -1015,6 +1091,7 @@ public CompanyPlanDetailResponseData build() { updatedAt, usageViolations, valid, + versions, yearlyPrice, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/CompanyPlanInvalidReason.java b/src/main/java/com/schematic/api/types/CompanyPlanInvalidReason.java new file mode 100644 index 0000000..04f81e4 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CompanyPlanInvalidReason.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 CompanyPlanInvalidReason { + public static final CompanyPlanInvalidReason FEATURE_USAGE_EXCEEDED = + new CompanyPlanInvalidReason(Value.FEATURE_USAGE_EXCEEDED, "feature_usage_exceeded"); + + public static final CompanyPlanInvalidReason DOWNGRADE_NOT_PERMITTED = + new CompanyPlanInvalidReason(Value.DOWNGRADE_NOT_PERMITTED, "downgrade_not_permitted"); + + private final Value value; + + private final String string; + + CompanyPlanInvalidReason(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 CompanyPlanInvalidReason + && this.string.equals(((CompanyPlanInvalidReason) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FEATURE_USAGE_EXCEEDED: + return visitor.visitFeatureUsageExceeded(); + case DOWNGRADE_NOT_PERMITTED: + return visitor.visitDowngradeNotPermitted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CompanyPlanInvalidReason valueOf(String value) { + switch (value) { + case "feature_usage_exceeded": + return FEATURE_USAGE_EXCEEDED; + case "downgrade_not_permitted": + return DOWNGRADE_NOT_PERMITTED; + default: + return new CompanyPlanInvalidReason(Value.UNKNOWN, value); + } + } + + public enum Value { + DOWNGRADE_NOT_PERMITTED, + + FEATURE_USAGE_EXCEEDED, + + UNKNOWN + } + + public interface Visitor { + T visitDowngradeNotPermitted(); + + T visitFeatureUsageExceeded(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java b/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java index a4dc62d..7b44914 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java @@ -13,7 +13,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -34,12 +36,16 @@ public final class CompanyPlanWithBillingSubView { private final Optional imageUrl; + private final List includedCreditGrants; + private final String name; private final Optional planPeriod; private final Optional planPrice; + private final Optional planVersionId; + private final Map additionalProperties; private CompanyPlanWithBillingSubView( @@ -49,9 +55,11 @@ private CompanyPlanWithBillingSubView( Optional description, String id, Optional imageUrl, + List includedCreditGrants, String name, Optional planPeriod, Optional planPrice, + Optional planVersionId, Map additionalProperties) { this.addedOn = addedOn; this.billingProductExternalId = billingProductExternalId; @@ -59,9 +67,11 @@ private CompanyPlanWithBillingSubView( this.description = description; this.id = id; this.imageUrl = imageUrl; + this.includedCreditGrants = includedCreditGrants; this.name = name; this.planPeriod = planPeriod; this.planPrice = planPrice; + this.planVersionId = planVersionId; this.additionalProperties = additionalProperties; } @@ -95,6 +105,11 @@ public Optional getImageUrl() { return imageUrl; } + @JsonProperty("included_credit_grants") + public List getIncludedCreditGrants() { + return includedCreditGrants; + } + @JsonProperty("name") public String getName() { return name; @@ -110,6 +125,11 @@ public Optional getPlanPrice() { return planPrice; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -128,9 +148,11 @@ private boolean equalTo(CompanyPlanWithBillingSubView other) { && description.equals(other.description) && id.equals(other.id) && imageUrl.equals(other.imageUrl) + && includedCreditGrants.equals(other.includedCreditGrants) && name.equals(other.name) && planPeriod.equals(other.planPeriod) - && planPrice.equals(other.planPrice); + && planPrice.equals(other.planPrice) + && planVersionId.equals(other.planVersionId); } @java.lang.Override @@ -142,9 +164,11 @@ public int hashCode() { this.description, this.id, this.imageUrl, + this.includedCreditGrants, this.name, this.planPeriod, - this.planPrice); + this.planPrice, + this.planVersionId); } @java.lang.Override @@ -189,6 +213,12 @@ public interface _FinalStage { _FinalStage imageUrl(String imageUrl); + _FinalStage includedCreditGrants(List includedCreditGrants); + + _FinalStage addIncludedCreditGrants(PlanCreditGrantView includedCreditGrants); + + _FinalStage addAllIncludedCreditGrants(List includedCreditGrants); + _FinalStage planPeriod(Optional planPeriod); _FinalStage planPeriod(String planPeriod); @@ -196,6 +226,10 @@ public interface _FinalStage { _FinalStage planPrice(Optional planPrice); _FinalStage planPrice(Integer planPrice); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -204,10 +238,14 @@ public static final class Builder implements IdStage, NameStage, _FinalStage { private String name; + private Optional planVersionId = Optional.empty(); + private Optional planPrice = Optional.empty(); private Optional planPeriod = Optional.empty(); + private List includedCreditGrants = new ArrayList<>(); + private Optional imageUrl = Optional.empty(); private Optional description = Optional.empty(); @@ -231,9 +269,11 @@ public Builder from(CompanyPlanWithBillingSubView other) { description(other.getDescription()); id(other.getId()); imageUrl(other.getImageUrl()); + includedCreditGrants(other.getIncludedCreditGrants()); name(other.getName()); planPeriod(other.getPlanPeriod()); planPrice(other.getPlanPrice()); + planVersionId(other.getPlanVersionId()); return this; } @@ -251,6 +291,19 @@ public _FinalStage name(@NotNull String name) { 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 planPrice(Integer planPrice) { this.planPrice = Optional.ofNullable(planPrice); @@ -277,6 +330,30 @@ public _FinalStage planPeriod(Optional planPeriod) { return this; } + @java.lang.Override + public _FinalStage addAllIncludedCreditGrants(List includedCreditGrants) { + if (includedCreditGrants != null) { + this.includedCreditGrants.addAll(includedCreditGrants); + } + return this; + } + + @java.lang.Override + public _FinalStage addIncludedCreditGrants(PlanCreditGrantView includedCreditGrants) { + this.includedCreditGrants.add(includedCreditGrants); + return this; + } + + @java.lang.Override + @JsonSetter(value = "included_credit_grants", nulls = Nulls.SKIP) + public _FinalStage includedCreditGrants(List includedCreditGrants) { + this.includedCreditGrants.clear(); + if (includedCreditGrants != null) { + this.includedCreditGrants.addAll(includedCreditGrants); + } + return this; + } + @java.lang.Override public _FinalStage imageUrl(String imageUrl) { this.imageUrl = Optional.ofNullable(imageUrl); @@ -351,9 +428,11 @@ public CompanyPlanWithBillingSubView build() { description, id, imageUrl, + includedCreditGrants, name, planPeriod, planPrice, + planVersionId, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java b/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java index e703300..488365a 100644 --- a/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java @@ -37,6 +37,8 @@ public final class CompanyViewWithFeatureUsageResponseData { private final Optional defaultPaymentMethod; + private final List entitlements; + private final List entityTraits; private final String environmentId; @@ -78,6 +80,7 @@ private CompanyViewWithFeatureUsageResponseData( List billingSubscriptions, OffsetDateTime createdAt, Optional defaultPaymentMethod, + List entitlements, List entityTraits, String environmentId, List featureUsage, @@ -101,6 +104,7 @@ private CompanyViewWithFeatureUsageResponseData( this.billingSubscriptions = billingSubscriptions; this.createdAt = createdAt; this.defaultPaymentMethod = defaultPaymentMethod; + this.entitlements = entitlements; this.entityTraits = entityTraits; this.environmentId = environmentId; this.featureUsage = featureUsage; @@ -150,6 +154,11 @@ public Optional getDefaultPaymentMethod() { return defaultPaymentMethod; } + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + @JsonProperty("entity_traits") public List getEntityTraits() { return entityTraits; @@ -252,6 +261,7 @@ private boolean equalTo(CompanyViewWithFeatureUsageResponseData other) { && billingSubscriptions.equals(other.billingSubscriptions) && createdAt.equals(other.createdAt) && defaultPaymentMethod.equals(other.defaultPaymentMethod) + && entitlements.equals(other.entitlements) && entityTraits.equals(other.entityTraits) && environmentId.equals(other.environmentId) && featureUsage.equals(other.featureUsage) @@ -279,6 +289,7 @@ public int hashCode() { this.billingSubscriptions, this.createdAt, this.defaultPaymentMethod, + this.entitlements, this.entityTraits, this.environmentId, this.featureUsage, @@ -359,6 +370,12 @@ public interface _FinalStage { _FinalStage defaultPaymentMethod(PaymentMethodResponseData defaultPaymentMethod); + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(FeatureEntitlement entitlements); + + _FinalStage addAllEntitlements(List entitlements); + _FinalStage entityTraits(List entityTraits); _FinalStage addEntityTraits(EntityTraitDetailResponseData entityTraits); @@ -464,6 +481,8 @@ public static final class Builder private List entityTraits = new ArrayList<>(); + private List entitlements = new ArrayList<>(); + private Optional defaultPaymentMethod = Optional.empty(); private List billingSubscriptions = new ArrayList<>(); @@ -487,6 +506,7 @@ public Builder from(CompanyViewWithFeatureUsageResponseData other) { billingSubscriptions(other.getBillingSubscriptions()); createdAt(other.getCreatedAt()); defaultPaymentMethod(other.getDefaultPaymentMethod()); + entitlements(other.getEntitlements()); entityTraits(other.getEntityTraits()); environmentId(other.getEnvironmentId()); featureUsage(other.getFeatureUsage()); @@ -775,6 +795,30 @@ public _FinalStage entityTraits(List entityTraits return this; } + @java.lang.Override + public _FinalStage addAllEntitlements(List entitlements) { + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + + @java.lang.Override + public _FinalStage addEntitlements(FeatureEntitlement entitlements) { + this.entitlements.add(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(List entitlements) { + this.entitlements.clear(); + if (entitlements != null) { + this.entitlements.addAll(entitlements); + } + return this; + } + @java.lang.Override public _FinalStage defaultPaymentMethod(PaymentMethodResponseData defaultPaymentMethod) { this.defaultPaymentMethod = Optional.ofNullable(defaultPaymentMethod); @@ -871,6 +915,7 @@ public CompanyViewWithFeatureUsageResponseData build() { billingSubscriptions, createdAt, defaultPaymentMethod, + entitlements, entityTraits, environmentId, featureUsage, diff --git a/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java b/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java new file mode 100644 index 0000000..304e37a --- /dev/null +++ b/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java @@ -0,0 +1,216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentDisplaySettings.Builder.class) +public final class ComponentDisplaySettings { + private final boolean showAsMonthlyPrices; + + private final boolean showCredits; + + private final boolean showFeatureDescription; + + private final boolean showPeriodToggle; + + private final boolean showZeroPriceAsFree; + + private final Map additionalProperties; + + private ComponentDisplaySettings( + boolean showAsMonthlyPrices, + boolean showCredits, + boolean showFeatureDescription, + boolean showPeriodToggle, + boolean showZeroPriceAsFree, + Map additionalProperties) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + this.showCredits = showCredits; + this.showFeatureDescription = showFeatureDescription; + this.showPeriodToggle = showPeriodToggle; + this.showZeroPriceAsFree = showZeroPriceAsFree; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + + @JsonProperty("show_credits") + public boolean getShowCredits() { + return showCredits; + } + + @JsonProperty("show_feature_description") + public boolean getShowFeatureDescription() { + return showFeatureDescription; + } + + @JsonProperty("show_period_toggle") + public boolean getShowPeriodToggle() { + return showPeriodToggle; + } + + @JsonProperty("show_zero_price_as_free") + public boolean getShowZeroPriceAsFree() { + return showZeroPriceAsFree; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentDisplaySettings && equalTo((ComponentDisplaySettings) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentDisplaySettings other) { + return showAsMonthlyPrices == other.showAsMonthlyPrices + && showCredits == other.showCredits + && showFeatureDescription == other.showFeatureDescription + && showPeriodToggle == other.showPeriodToggle + && showZeroPriceAsFree == other.showZeroPriceAsFree; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.showAsMonthlyPrices, + this.showCredits, + this.showFeatureDescription, + this.showPeriodToggle, + this.showZeroPriceAsFree); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ShowAsMonthlyPricesStage builder() { + return new Builder(); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); + + Builder from(ComponentDisplaySettings other); + } + + public interface ShowCreditsStage { + ShowFeatureDescriptionStage showCredits(boolean showCredits); + } + + public interface ShowFeatureDescriptionStage { + ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); + } + + public interface ShowPeriodToggleStage { + ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle); + } + + public interface ShowZeroPriceAsFreeStage { + _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + } + + public interface _FinalStage { + ComponentDisplaySettings build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ShowAsMonthlyPricesStage, + ShowCreditsStage, + ShowFeatureDescriptionStage, + ShowPeriodToggleStage, + ShowZeroPriceAsFreeStage, + _FinalStage { + private boolean showAsMonthlyPrices; + + private boolean showCredits; + + private boolean showFeatureDescription; + + private boolean showPeriodToggle; + + private boolean showZeroPriceAsFree; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentDisplaySettings other) { + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); + showCredits(other.getShowCredits()); + showFeatureDescription(other.getShowFeatureDescription()); + showPeriodToggle(other.getShowPeriodToggle()); + showZeroPriceAsFree(other.getShowZeroPriceAsFree()); + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + + @java.lang.Override + @JsonSetter("show_credits") + public ShowFeatureDescriptionStage showCredits(boolean showCredits) { + this.showCredits = showCredits; + return this; + } + + @java.lang.Override + @JsonSetter("show_feature_description") + public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + this.showFeatureDescription = showFeatureDescription; + return this; + } + + @java.lang.Override + @JsonSetter("show_period_toggle") + public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { + this.showPeriodToggle = showPeriodToggle; + return this; + } + + @java.lang.Override + @JsonSetter("show_zero_price_as_free") + public _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { + this.showZeroPriceAsFree = showZeroPriceAsFree; + return this; + } + + @java.lang.Override + public ComponentDisplaySettings build() { + return new ComponentDisplaySettings( + showAsMonthlyPrices, + showCredits, + showFeatureDescription, + showPeriodToggle, + showZeroPriceAsFree, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/components/types/UpdateComponentRequestBodyEntityType.java b/src/main/java/com/schematic/api/types/ComponentEntityType.java similarity index 64% rename from src/main/java/com/schematic/api/resources/components/types/UpdateComponentRequestBodyEntityType.java rename to src/main/java/com/schematic/api/types/ComponentEntityType.java index 0a18ff0..df5bfbf 100644 --- a/src/main/java/com/schematic/api/resources/components/types/UpdateComponentRequestBodyEntityType.java +++ b/src/main/java/com/schematic/api/types/ComponentEntityType.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.components.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateComponentRequestBodyEntityType { - public static final UpdateComponentRequestBodyEntityType BILLING = - new UpdateComponentRequestBodyEntityType(Value.BILLING, "billing"); +public final class ComponentEntityType { + public static final ComponentEntityType BILLING = new ComponentEntityType(Value.BILLING, "billing"); - public static final UpdateComponentRequestBodyEntityType ENTITLEMENT = - new UpdateComponentRequestBodyEntityType(Value.ENTITLEMENT, "entitlement"); + public static final ComponentEntityType ENTITLEMENT = new ComponentEntityType(Value.ENTITLEMENT, "entitlement"); private final Value value; private final String string; - UpdateComponentRequestBodyEntityType(Value value, String string) { + ComponentEntityType(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UpdateComponentRequestBodyEntityType - && this.string.equals(((UpdateComponentRequestBodyEntityType) other).string)); + || (other instanceof ComponentEntityType && this.string.equals(((ComponentEntityType) other).string)); } @java.lang.Override @@ -57,30 +54,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateComponentRequestBodyEntityType valueOf(String value) { + public static ComponentEntityType valueOf(String value) { switch (value) { case "billing": return BILLING; case "entitlement": return ENTITLEMENT; default: - return new UpdateComponentRequestBodyEntityType(Value.UNKNOWN, value); + return new ComponentEntityType(Value.UNKNOWN, value); } } public enum Value { - ENTITLEMENT, - BILLING, + ENTITLEMENT, + UNKNOWN } public interface Visitor { - T visitEntitlement(); - T visitBilling(); + T visitEntitlement(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java index 6a71eb2..ddf3465 100644 --- a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java @@ -45,10 +45,20 @@ public final class ComponentHydrateResponseData { private final Optional defaultPlan; + private final ComponentDisplaySettings displaySettings; + private final Optional featureUsage; private final Optional postTrialPlan; + private final boolean preventSelfServiceDowngrade; + + private final Optional preventSelfServiceDowngradeButtonText; + + private final Optional preventSelfServiceDowngradeUrl; + + private final boolean showAsMonthlyPrices; + private final boolean showCredits; private final boolean showPeriodToggle; @@ -77,8 +87,13 @@ private ComponentHydrateResponseData( List creditBundles, List creditGrants, Optional defaultPlan, + ComponentDisplaySettings displaySettings, Optional featureUsage, Optional postTrialPlan, + boolean preventSelfServiceDowngrade, + Optional preventSelfServiceDowngradeButtonText, + Optional preventSelfServiceDowngradeUrl, + boolean showAsMonthlyPrices, boolean showCredits, boolean showPeriodToggle, boolean showZeroPriceAsFree, @@ -98,8 +113,13 @@ private ComponentHydrateResponseData( this.creditBundles = creditBundles; this.creditGrants = creditGrants; this.defaultPlan = defaultPlan; + this.displaySettings = displaySettings; this.featureUsage = featureUsage; this.postTrialPlan = postTrialPlan; + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; @@ -165,6 +185,11 @@ public Optional getDefaultPlan() { return defaultPlan; } + @JsonProperty("display_settings") + public ComponentDisplaySettings getDisplaySettings() { + return displaySettings; + } + @JsonProperty("feature_usage") public Optional getFeatureUsage() { return featureUsage; @@ -175,6 +200,26 @@ public Optional getPostTrialPlan() { return postTrialPlan; } + @JsonProperty("prevent_self_service_downgrade") + public boolean getPreventSelfServiceDowngrade() { + return preventSelfServiceDowngrade; + } + + @JsonProperty("prevent_self_service_downgrade_button_text") + public Optional getPreventSelfServiceDowngradeButtonText() { + return preventSelfServiceDowngradeButtonText; + } + + @JsonProperty("prevent_self_service_downgrade_url") + public Optional getPreventSelfServiceDowngradeUrl() { + return preventSelfServiceDowngradeUrl; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + @JsonProperty("show_credits") public boolean getShowCredits() { return showCredits; @@ -233,8 +278,13 @@ private boolean equalTo(ComponentHydrateResponseData other) { && creditBundles.equals(other.creditBundles) && creditGrants.equals(other.creditGrants) && defaultPlan.equals(other.defaultPlan) + && displaySettings.equals(other.displaySettings) && featureUsage.equals(other.featureUsage) && postTrialPlan.equals(other.postTrialPlan) + && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade + && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) + && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree @@ -258,8 +308,13 @@ public int hashCode() { this.creditBundles, this.creditGrants, this.defaultPlan, + this.displaySettings, this.featureUsage, this.postTrialPlan, + this.preventSelfServiceDowngrade, + this.preventSelfServiceDowngradeButtonText, + this.preventSelfServiceDowngradeUrl, + this.showAsMonthlyPrices, this.showCredits, this.showPeriodToggle, this.showZeroPriceAsFree, @@ -279,11 +334,23 @@ public static CheckoutSettingsStage builder() { } public interface CheckoutSettingsStage { - ShowCreditsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings); + DisplaySettingsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings); Builder from(ComponentHydrateResponseData other); } + public interface DisplaySettingsStage { + PreventSelfServiceDowngradeStage displaySettings(@NotNull ComponentDisplaySettings displaySettings); + } + + public interface PreventSelfServiceDowngradeStage { + ShowAsMonthlyPricesStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); + } + public interface ShowCreditsStage { ShowPeriodToggleStage showCredits(boolean showCredits); } @@ -360,6 +427,14 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage postTrialPlan(PlanDetailResponseData postTrialPlan); + _FinalStage preventSelfServiceDowngradeButtonText(Optional preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl); + + _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + _FinalStage stripeEmbed(Optional stripeEmbed); _FinalStage stripeEmbed(StripeEmbedInfo stripeEmbed); @@ -380,12 +455,21 @@ _FinalStage addAllActiveUsageBasedEntitlements( @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CheckoutSettingsStage, + DisplaySettingsStage, + PreventSelfServiceDowngradeStage, + ShowAsMonthlyPricesStage, ShowCreditsStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, _FinalStage { private ComponentCheckoutSettings checkoutSettings; + private ComponentDisplaySettings displaySettings; + + private boolean preventSelfServiceDowngrade; + + private boolean showAsMonthlyPrices; + private boolean showCredits; private boolean showPeriodToggle; @@ -400,6 +484,10 @@ public static final class Builder private Optional stripeEmbed = Optional.empty(); + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); + + private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); + private Optional postTrialPlan = Optional.empty(); private Optional featureUsage = Optional.empty(); @@ -442,8 +530,13 @@ public Builder from(ComponentHydrateResponseData other) { creditBundles(other.getCreditBundles()); creditGrants(other.getCreditGrants()); defaultPlan(other.getDefaultPlan()); + displaySettings(other.getDisplaySettings()); featureUsage(other.getFeatureUsage()); postTrialPlan(other.getPostTrialPlan()); + preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); + preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); + preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); @@ -456,11 +549,32 @@ public Builder from(ComponentHydrateResponseData other) { @java.lang.Override @JsonSetter("checkout_settings") - public ShowCreditsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings) { + public DisplaySettingsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings) { this.checkoutSettings = Objects.requireNonNull(checkoutSettings, "checkoutSettings must not be null"); return this; } + @java.lang.Override + @JsonSetter("display_settings") + public PreventSelfServiceDowngradeStage displaySettings(@NotNull ComponentDisplaySettings displaySettings) { + this.displaySettings = Objects.requireNonNull(displaySettings, "displaySettings must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("prevent_self_service_downgrade") + public ShowAsMonthlyPricesStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade) { + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + @java.lang.Override @JsonSetter("show_credits") public ShowPeriodToggleStage showCredits(boolean showCredits) { @@ -534,6 +648,33 @@ public _FinalStage stripeEmbed(Optional stripeEmbed) { return this; } + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_url", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = Optional.ofNullable(preventSelfServiceDowngradeButtonText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_button_text", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeButtonText( + Optional preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + return this; + } + @java.lang.Override public _FinalStage postTrialPlan(PlanDetailResponseData postTrialPlan) { this.postTrialPlan = Optional.ofNullable(postTrialPlan); @@ -773,8 +914,13 @@ public ComponentHydrateResponseData build() { creditBundles, creditGrants, defaultPlan, + displaySettings, featureUsage, postTrialPlan, + preventSelfServiceDowngrade, + preventSelfServiceDowngradeButtonText, + preventSelfServiceDowngradeUrl, + showAsMonthlyPrices, showCredits, showPeriodToggle, showZeroPriceAsFree, diff --git a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java index c6cfeca..3410e3f 100644 --- a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java @@ -45,12 +45,22 @@ public final class ComponentPreviewResponseData { private final Optional defaultPlan; + private final ComponentDisplaySettings displaySettings; + private final Optional featureUsage; private final List invoices; private final Optional postTrialPlan; + private final boolean preventSelfServiceDowngrade; + + private final Optional preventSelfServiceDowngradeButtonText; + + private final Optional preventSelfServiceDowngradeUrl; + + private final boolean showAsMonthlyPrices; + private final boolean showCredits; private final boolean showPeriodToggle; @@ -79,9 +89,14 @@ private ComponentPreviewResponseData( List creditBundles, List creditGrants, Optional defaultPlan, + ComponentDisplaySettings displaySettings, Optional featureUsage, List invoices, Optional postTrialPlan, + boolean preventSelfServiceDowngrade, + Optional preventSelfServiceDowngradeButtonText, + Optional preventSelfServiceDowngradeUrl, + boolean showAsMonthlyPrices, boolean showCredits, boolean showPeriodToggle, boolean showZeroPriceAsFree, @@ -101,9 +116,14 @@ private ComponentPreviewResponseData( this.creditBundles = creditBundles; this.creditGrants = creditGrants; this.defaultPlan = defaultPlan; + this.displaySettings = displaySettings; this.featureUsage = featureUsage; this.invoices = invoices; this.postTrialPlan = postTrialPlan; + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; @@ -169,6 +189,11 @@ public Optional getDefaultPlan() { return defaultPlan; } + @JsonProperty("display_settings") + public ComponentDisplaySettings getDisplaySettings() { + return displaySettings; + } + @JsonProperty("feature_usage") public Optional getFeatureUsage() { return featureUsage; @@ -184,6 +209,26 @@ public Optional getPostTrialPlan() { return postTrialPlan; } + @JsonProperty("prevent_self_service_downgrade") + public boolean getPreventSelfServiceDowngrade() { + return preventSelfServiceDowngrade; + } + + @JsonProperty("prevent_self_service_downgrade_button_text") + public Optional getPreventSelfServiceDowngradeButtonText() { + return preventSelfServiceDowngradeButtonText; + } + + @JsonProperty("prevent_self_service_downgrade_url") + public Optional getPreventSelfServiceDowngradeUrl() { + return preventSelfServiceDowngradeUrl; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + @JsonProperty("show_credits") public boolean getShowCredits() { return showCredits; @@ -242,9 +287,14 @@ private boolean equalTo(ComponentPreviewResponseData other) { && creditBundles.equals(other.creditBundles) && creditGrants.equals(other.creditGrants) && defaultPlan.equals(other.defaultPlan) + && displaySettings.equals(other.displaySettings) && featureUsage.equals(other.featureUsage) && invoices.equals(other.invoices) && postTrialPlan.equals(other.postTrialPlan) + && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade + && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) + && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree @@ -268,9 +318,14 @@ public int hashCode() { this.creditBundles, this.creditGrants, this.defaultPlan, + this.displaySettings, this.featureUsage, this.invoices, this.postTrialPlan, + this.preventSelfServiceDowngrade, + this.preventSelfServiceDowngradeButtonText, + this.preventSelfServiceDowngradeUrl, + this.showAsMonthlyPrices, this.showCredits, this.showPeriodToggle, this.showZeroPriceAsFree, @@ -290,11 +345,23 @@ public static CheckoutSettingsStage builder() { } public interface CheckoutSettingsStage { - ShowCreditsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings); + DisplaySettingsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings); Builder from(ComponentPreviewResponseData other); } + public interface DisplaySettingsStage { + PreventSelfServiceDowngradeStage displaySettings(@NotNull ComponentDisplaySettings displaySettings); + } + + public interface PreventSelfServiceDowngradeStage { + ShowAsMonthlyPricesStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); + } + public interface ShowCreditsStage { ShowPeriodToggleStage showCredits(boolean showCredits); } @@ -377,6 +444,14 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage postTrialPlan(PlanDetailResponseData postTrialPlan); + _FinalStage preventSelfServiceDowngradeButtonText(Optional preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl); + + _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + _FinalStage stripeEmbed(Optional stripeEmbed); _FinalStage stripeEmbed(StripeEmbedInfo stripeEmbed); @@ -397,12 +472,21 @@ _FinalStage addAllActiveUsageBasedEntitlements( @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CheckoutSettingsStage, + DisplaySettingsStage, + PreventSelfServiceDowngradeStage, + ShowAsMonthlyPricesStage, ShowCreditsStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, _FinalStage { private ComponentCheckoutSettings checkoutSettings; + private ComponentDisplaySettings displaySettings; + + private boolean preventSelfServiceDowngrade; + + private boolean showAsMonthlyPrices; + private boolean showCredits; private boolean showPeriodToggle; @@ -417,6 +501,10 @@ public static final class Builder private Optional stripeEmbed = Optional.empty(); + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); + + private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); + private Optional postTrialPlan = Optional.empty(); private List invoices = new ArrayList<>(); @@ -461,9 +549,14 @@ public Builder from(ComponentPreviewResponseData other) { creditBundles(other.getCreditBundles()); creditGrants(other.getCreditGrants()); defaultPlan(other.getDefaultPlan()); + displaySettings(other.getDisplaySettings()); featureUsage(other.getFeatureUsage()); invoices(other.getInvoices()); postTrialPlan(other.getPostTrialPlan()); + preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); + preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); + preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); @@ -476,11 +569,32 @@ public Builder from(ComponentPreviewResponseData other) { @java.lang.Override @JsonSetter("checkout_settings") - public ShowCreditsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings) { + public DisplaySettingsStage checkoutSettings(@NotNull ComponentCheckoutSettings checkoutSettings) { this.checkoutSettings = Objects.requireNonNull(checkoutSettings, "checkoutSettings must not be null"); return this; } + @java.lang.Override + @JsonSetter("display_settings") + public PreventSelfServiceDowngradeStage displaySettings(@NotNull ComponentDisplaySettings displaySettings) { + this.displaySettings = Objects.requireNonNull(displaySettings, "displaySettings must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("prevent_self_service_downgrade") + public ShowAsMonthlyPricesStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade) { + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + @java.lang.Override @JsonSetter("show_credits") public ShowPeriodToggleStage showCredits(boolean showCredits) { @@ -554,6 +668,33 @@ public _FinalStage stripeEmbed(Optional stripeEmbed) { return this; } + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_url", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = Optional.ofNullable(preventSelfServiceDowngradeButtonText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_button_text", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeButtonText( + Optional preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + return this; + } + @java.lang.Override public _FinalStage postTrialPlan(PlanDetailResponseData postTrialPlan) { this.postTrialPlan = Optional.ofNullable(postTrialPlan); @@ -817,9 +958,14 @@ public ComponentPreviewResponseData build() { creditBundles, creditGrants, defaultPlan, + displaySettings, featureUsage, invoices, postTrialPlan, + preventSelfServiceDowngrade, + preventSelfServiceDowngradeButtonText, + preventSelfServiceDowngradeUrl, + showAsMonthlyPrices, showCredits, showPeriodToggle, showZeroPriceAsFree, diff --git a/src/main/java/com/schematic/api/types/ComponentResponseData.java b/src/main/java/com/schematic/api/types/ComponentResponseData.java index 1876458..dfa7fde 100644 --- a/src/main/java/com/schematic/api/types/ComponentResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentResponseData.java @@ -30,9 +30,9 @@ public final class ComponentResponseData { private final String name; - private final String state; + private final ComponentState state; - private final String type; + private final ComponentEntityType type; private final OffsetDateTime updatedAt; @@ -43,8 +43,8 @@ private ComponentResponseData( OffsetDateTime createdAt, String id, String name, - String state, - String type, + ComponentState state, + ComponentEntityType type, OffsetDateTime updatedAt, Map additionalProperties) { this.ast = ast; @@ -78,12 +78,12 @@ public String getName() { } @JsonProperty("state") - public String getState() { + public ComponentState getState() { return state; } @JsonProperty("type") - public String getType() { + public ComponentEntityType getType() { return type; } @@ -142,11 +142,11 @@ public interface NameStage { } public interface StateStage { - TypeStage state(@NotNull String state); + TypeStage state(@NotNull ComponentState state); } public interface TypeStage { - UpdatedAtStage type(@NotNull String type); + UpdatedAtStage type(@NotNull ComponentEntityType type); } public interface UpdatedAtStage { @@ -170,9 +170,9 @@ public static final class Builder private String name; - private String state; + private ComponentState state; - private String type; + private ComponentEntityType type; private OffsetDateTime updatedAt; @@ -218,14 +218,14 @@ public StateStage name(@NotNull String name) { @java.lang.Override @JsonSetter("state") - public TypeStage state(@NotNull String state) { + public TypeStage state(@NotNull ComponentState state) { this.state = Objects.requireNonNull(state, "state must not be null"); return this; } @java.lang.Override @JsonSetter("type") - public UpdatedAtStage type(@NotNull String type) { + public UpdatedAtStage type(@NotNull ComponentEntityType type) { this.type = Objects.requireNonNull(type, "type must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java b/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java new file mode 100644 index 0000000..974d511 --- /dev/null +++ b/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java @@ -0,0 +1,216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentSettingsResponseData.Builder.class) +public final class ComponentSettingsResponseData { + private final boolean showAsMonthlyPrices; + + private final boolean showCredits; + + private final boolean showFeatureDescription; + + private final boolean showPeriodToggle; + + private final boolean showZeroPriceAsFree; + + private final Map additionalProperties; + + private ComponentSettingsResponseData( + boolean showAsMonthlyPrices, + boolean showCredits, + boolean showFeatureDescription, + boolean showPeriodToggle, + boolean showZeroPriceAsFree, + Map additionalProperties) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + this.showCredits = showCredits; + this.showFeatureDescription = showFeatureDescription; + this.showPeriodToggle = showPeriodToggle; + this.showZeroPriceAsFree = showZeroPriceAsFree; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + + @JsonProperty("show_credits") + public boolean getShowCredits() { + return showCredits; + } + + @JsonProperty("show_feature_description") + public boolean getShowFeatureDescription() { + return showFeatureDescription; + } + + @JsonProperty("show_period_toggle") + public boolean getShowPeriodToggle() { + return showPeriodToggle; + } + + @JsonProperty("show_zero_price_as_free") + public boolean getShowZeroPriceAsFree() { + return showZeroPriceAsFree; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentSettingsResponseData && equalTo((ComponentSettingsResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentSettingsResponseData other) { + return showAsMonthlyPrices == other.showAsMonthlyPrices + && showCredits == other.showCredits + && showFeatureDescription == other.showFeatureDescription + && showPeriodToggle == other.showPeriodToggle + && showZeroPriceAsFree == other.showZeroPriceAsFree; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.showAsMonthlyPrices, + this.showCredits, + this.showFeatureDescription, + this.showPeriodToggle, + this.showZeroPriceAsFree); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ShowAsMonthlyPricesStage builder() { + return new Builder(); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); + + Builder from(ComponentSettingsResponseData other); + } + + public interface ShowCreditsStage { + ShowFeatureDescriptionStage showCredits(boolean showCredits); + } + + public interface ShowFeatureDescriptionStage { + ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); + } + + public interface ShowPeriodToggleStage { + ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle); + } + + public interface ShowZeroPriceAsFreeStage { + _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + } + + public interface _FinalStage { + ComponentSettingsResponseData build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ShowAsMonthlyPricesStage, + ShowCreditsStage, + ShowFeatureDescriptionStage, + ShowPeriodToggleStage, + ShowZeroPriceAsFreeStage, + _FinalStage { + private boolean showAsMonthlyPrices; + + private boolean showCredits; + + private boolean showFeatureDescription; + + private boolean showPeriodToggle; + + private boolean showZeroPriceAsFree; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentSettingsResponseData other) { + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); + showCredits(other.getShowCredits()); + showFeatureDescription(other.getShowFeatureDescription()); + showPeriodToggle(other.getShowPeriodToggle()); + showZeroPriceAsFree(other.getShowZeroPriceAsFree()); + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + + @java.lang.Override + @JsonSetter("show_credits") + public ShowFeatureDescriptionStage showCredits(boolean showCredits) { + this.showCredits = showCredits; + return this; + } + + @java.lang.Override + @JsonSetter("show_feature_description") + public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + this.showFeatureDescription = showFeatureDescription; + return this; + } + + @java.lang.Override + @JsonSetter("show_period_toggle") + public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { + this.showPeriodToggle = showPeriodToggle; + return this; + } + + @java.lang.Override + @JsonSetter("show_zero_price_as_free") + public _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { + this.showZeroPriceAsFree = showZeroPriceAsFree; + return this; + } + + @java.lang.Override + public ComponentSettingsResponseData build() { + return new ComponentSettingsResponseData( + showAsMonthlyPrices, + showCredits, + showFeatureDescription, + showPeriodToggle, + showZeroPriceAsFree, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/components/types/UpdateComponentRequestBodyState.java b/src/main/java/com/schematic/api/types/ComponentState.java similarity index 65% rename from src/main/java/com/schematic/api/resources/components/types/UpdateComponentRequestBodyState.java rename to src/main/java/com/schematic/api/types/ComponentState.java index 497e268..b3e783e 100644 --- a/src/main/java/com/schematic/api/resources/components/types/UpdateComponentRequestBodyState.java +++ b/src/main/java/com/schematic/api/types/ComponentState.java @@ -1,22 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.components.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateComponentRequestBodyState { - public static final UpdateComponentRequestBodyState LIVE = new UpdateComponentRequestBodyState(Value.LIVE, "live"); +public final class ComponentState { + public static final ComponentState LIVE = new ComponentState(Value.LIVE, "live"); - public static final UpdateComponentRequestBodyState DRAFT = - new UpdateComponentRequestBodyState(Value.DRAFT, "draft"); + public static final ComponentState DRAFT = new ComponentState(Value.DRAFT, "draft"); private final Value value; private final String string; - UpdateComponentRequestBodyState(Value value, String string) { + ComponentState(Value value, String string) { this.value = value; this.string = string; } @@ -34,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UpdateComponentRequestBodyState - && this.string.equals(((UpdateComponentRequestBodyState) other).string)); + || (other instanceof ComponentState && this.string.equals(((ComponentState) other).string)); } @java.lang.Override @@ -56,14 +54,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateComponentRequestBodyState valueOf(String value) { + public static ComponentState valueOf(String value) { switch (value) { case "live": return LIVE; case "draft": return DRAFT; default: - return new UpdateComponentRequestBodyState(Value.UNKNOWN, value); + return new ComponentState(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/Condition.java b/src/main/java/com/schematic/api/types/Condition.java index 0e2ce2d..fc54d2c 100644 --- a/src/main/java/com/schematic/api/types/Condition.java +++ b/src/main/java/com/schematic/api/types/Condition.java @@ -27,7 +27,7 @@ public final class Condition { private final Optional comparisonTraitDefinition; - private final String conditionType; + private final ConditionConditionType conditionType; private final Optional consumptionRate; @@ -39,13 +39,13 @@ public final class Condition { private final String id; - private final Optional metricPeriod; + private final Optional metricPeriod; - private final Optional metricPeriodMonthReset; + private final Optional metricPeriodMonthReset; private final Optional metricValue; - private final String operator; + private final ConditionOperator operator; private final List resourceIds; @@ -58,16 +58,16 @@ public final class Condition { private Condition( String accountId, Optional comparisonTraitDefinition, - String conditionType, + ConditionConditionType conditionType, Optional consumptionRate, Optional creditId, String environmentId, Optional eventSubtype, String id, - Optional metricPeriod, - Optional metricPeriodMonthReset, + Optional metricPeriod, + Optional metricPeriodMonthReset, Optional metricValue, - String operator, + ConditionOperator operator, List resourceIds, Optional traitDefinition, String traitValue, @@ -101,7 +101,7 @@ public Optional getComparisonTraitDefinition() { } @JsonProperty("condition_type") - public String getConditionType() { + public ConditionConditionType getConditionType() { return conditionType; } @@ -131,12 +131,12 @@ public String getId() { } @JsonProperty("metric_period") - public Optional getMetricPeriod() { + public Optional getMetricPeriod() { return metricPeriod; } @JsonProperty("metric_period_month_reset") - public Optional getMetricPeriodMonthReset() { + public Optional getMetricPeriodMonthReset() { return metricPeriodMonthReset; } @@ -146,7 +146,7 @@ public Optional getMetricValue() { } @JsonProperty("operator") - public String getOperator() { + public ConditionOperator getOperator() { return operator; } @@ -230,7 +230,7 @@ public interface AccountIdStage { } public interface ConditionTypeStage { - EnvironmentIdStage conditionType(@NotNull String conditionType); + EnvironmentIdStage conditionType(@NotNull ConditionConditionType conditionType); } public interface EnvironmentIdStage { @@ -242,7 +242,7 @@ public interface IdStage { } public interface OperatorStage { - TraitValueStage operator(@NotNull String operator); + TraitValueStage operator(@NotNull ConditionOperator operator); } public interface TraitValueStage { @@ -268,13 +268,13 @@ public interface _FinalStage { _FinalStage eventSubtype(String eventSubtype); - _FinalStage metricPeriod(Optional metricPeriod); + _FinalStage metricPeriod(Optional metricPeriod); - _FinalStage metricPeriod(String metricPeriod); + _FinalStage metricPeriod(ConditionMetricPeriod metricPeriod); - _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); + _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); - _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); + _FinalStage metricPeriodMonthReset(ConditionMetricPeriodMonthReset metricPeriodMonthReset); _FinalStage metricValue(Optional metricValue); @@ -302,13 +302,13 @@ public static final class Builder _FinalStage { private String accountId; - private String conditionType; + private ConditionConditionType conditionType; private String environmentId; private String id; - private String operator; + private ConditionOperator operator; private String traitValue; @@ -318,9 +318,9 @@ public static final class Builder private Optional metricValue = Optional.empty(); - private Optional metricPeriodMonthReset = Optional.empty(); + private Optional metricPeriodMonthReset = Optional.empty(); - private Optional metricPeriod = Optional.empty(); + private Optional metricPeriod = Optional.empty(); private Optional eventSubtype = Optional.empty(); @@ -364,7 +364,7 @@ public ConditionTypeStage accountId(@NotNull String accountId) { @java.lang.Override @JsonSetter("condition_type") - public EnvironmentIdStage conditionType(@NotNull String conditionType) { + public EnvironmentIdStage conditionType(@NotNull ConditionConditionType conditionType) { this.conditionType = Objects.requireNonNull(conditionType, "conditionType must not be null"); return this; } @@ -385,7 +385,7 @@ public OperatorStage id(@NotNull String id) { @java.lang.Override @JsonSetter("operator") - public TraitValueStage operator(@NotNull String operator) { + public TraitValueStage operator(@NotNull ConditionOperator operator) { this.operator = Objects.requireNonNull(operator, "operator must not be null"); return this; } @@ -448,27 +448,27 @@ public _FinalStage metricValue(Optional metricValue) { } @java.lang.Override - public _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset) { + public _FinalStage metricPeriodMonthReset(ConditionMetricPeriodMonthReset 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) { + public _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset) { this.metricPeriodMonthReset = metricPeriodMonthReset; return this; } @java.lang.Override - public _FinalStage metricPeriod(String metricPeriod) { + public _FinalStage metricPeriod(ConditionMetricPeriod metricPeriod) { this.metricPeriod = Optional.ofNullable(metricPeriod); return this; } @java.lang.Override @JsonSetter(value = "metric_period", nulls = Nulls.SKIP) - public _FinalStage metricPeriod(Optional metricPeriod) { + public _FinalStage metricPeriod(Optional metricPeriod) { this.metricPeriod = metricPeriod; return this; } diff --git a/src/main/java/com/schematic/api/types/ConditionConditionType.java b/src/main/java/com/schematic/api/types/ConditionConditionType.java new file mode 100644 index 0000000..f963094 --- /dev/null +++ b/src/main/java/com/schematic/api/types/ConditionConditionType.java @@ -0,0 +1,156 @@ +/** + * 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 ConditionConditionType { + public static final ConditionConditionType BASE_PLAN = new ConditionConditionType(Value.BASE_PLAN, "base_plan"); + + public static final ConditionConditionType METRIC = new ConditionConditionType(Value.METRIC, "metric"); + + public static final ConditionConditionType PLAN = new ConditionConditionType(Value.PLAN, "plan"); + + public static final ConditionConditionType PLAN_VERSION = + new ConditionConditionType(Value.PLAN_VERSION, "plan_version"); + + public static final ConditionConditionType TRAIT = new ConditionConditionType(Value.TRAIT, "trait"); + + public static final ConditionConditionType CREDIT = new ConditionConditionType(Value.CREDIT, "credit"); + + public static final ConditionConditionType BILLING_PRODUCT = + new ConditionConditionType(Value.BILLING_PRODUCT, "billing_product"); + + public static final ConditionConditionType USER = new ConditionConditionType(Value.USER, "user"); + + public static final ConditionConditionType COMPANY = new ConditionConditionType(Value.COMPANY, "company"); + + private final Value value; + + private final String string; + + ConditionConditionType(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 ConditionConditionType + && this.string.equals(((ConditionConditionType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BASE_PLAN: + return visitor.visitBasePlan(); + case METRIC: + return visitor.visitMetric(); + case PLAN: + return visitor.visitPlan(); + case PLAN_VERSION: + return visitor.visitPlanVersion(); + case TRAIT: + return visitor.visitTrait(); + case CREDIT: + return visitor.visitCredit(); + case BILLING_PRODUCT: + return visitor.visitBillingProduct(); + case USER: + return visitor.visitUser(); + case COMPANY: + return visitor.visitCompany(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ConditionConditionType valueOf(String value) { + switch (value) { + case "base_plan": + return BASE_PLAN; + case "metric": + return METRIC; + case "plan": + return PLAN; + case "plan_version": + return PLAN_VERSION; + case "trait": + return TRAIT; + case "credit": + return CREDIT; + case "billing_product": + return BILLING_PRODUCT; + case "user": + return USER; + case "company": + return COMPANY; + default: + return new ConditionConditionType(Value.UNKNOWN, value); + } + } + + public enum Value { + BASE_PLAN, + + BILLING_PRODUCT, + + COMPANY, + + CREDIT, + + METRIC, + + PLAN, + + PLAN_VERSION, + + TRAIT, + + USER, + + UNKNOWN + } + + public interface Visitor { + T visitBasePlan(); + + T visitBillingProduct(); + + T visitCompany(); + + T visitCredit(); + + T visitMetric(); + + T visitPlan(); + + T visitPlanVersion(); + + T visitTrait(); + + T visitUser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CrmLineItemResponseData.java b/src/main/java/com/schematic/api/types/ConditionGroupResponseData.java similarity index 55% rename from src/main/java/com/schematic/api/types/CrmLineItemResponseData.java rename to src/main/java/com/schematic/api/types/ConditionGroupResponseData.java index b19ae0d..b7f700d 100644 --- a/src/main/java/com/schematic/api/types/CrmLineItemResponseData.java +++ b/src/main/java/com/schematic/api/types/ConditionGroupResponseData.java @@ -20,35 +20,43 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CrmLineItemResponseData.Builder.class) -public final class CrmLineItemResponseData { +@JsonDeserialize(builder = ConditionGroupResponseData.Builder.class) +public final class ConditionGroupResponseData { private final String accountId; private final OffsetDateTime createdAt; - private final Optional dealId; - private final String environmentId; - private final Optional productExternalId; + private final Optional flagId; + + private final String id; + + private final Optional planVersionId; + + private final String ruleId; private final OffsetDateTime updatedAt; private final Map additionalProperties; - private CrmLineItemResponseData( + private ConditionGroupResponseData( String accountId, OffsetDateTime createdAt, - Optional dealId, String environmentId, - Optional productExternalId, + Optional flagId, + String id, + Optional planVersionId, + String ruleId, OffsetDateTime updatedAt, Map additionalProperties) { this.accountId = accountId; this.createdAt = createdAt; - this.dealId = dealId; this.environmentId = environmentId; - this.productExternalId = productExternalId; + this.flagId = flagId; + this.id = id; + this.planVersionId = planVersionId; + this.ruleId = ruleId; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -63,19 +71,29 @@ public OffsetDateTime getCreatedAt() { return createdAt; } - @JsonProperty("deal_id") - public Optional getDealId() { - return dealId; - } - @JsonProperty("environment_id") public String getEnvironmentId() { return environmentId; } - @JsonProperty("product_external_id") - public Optional getProductExternalId() { - return productExternalId; + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("rule_id") + public String getRuleId() { + return ruleId; } @JsonProperty("updated_at") @@ -86,7 +104,7 @@ public OffsetDateTime getUpdatedAt() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CrmLineItemResponseData && equalTo((CrmLineItemResponseData) other); + return other instanceof ConditionGroupResponseData && equalTo((ConditionGroupResponseData) other); } @JsonAnyGetter @@ -94,12 +112,14 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CrmLineItemResponseData other) { + private boolean equalTo(ConditionGroupResponseData other) { return accountId.equals(other.accountId) && createdAt.equals(other.createdAt) - && dealId.equals(other.dealId) && environmentId.equals(other.environmentId) - && productExternalId.equals(other.productExternalId) + && flagId.equals(other.flagId) + && id.equals(other.id) + && planVersionId.equals(other.planVersionId) + && ruleId.equals(other.ruleId) && updatedAt.equals(other.updatedAt); } @@ -108,9 +128,11 @@ public int hashCode() { return Objects.hash( this.accountId, this.createdAt, - this.dealId, this.environmentId, - this.productExternalId, + this.flagId, + this.id, + this.planVersionId, + this.ruleId, this.updatedAt); } @@ -126,7 +148,7 @@ public static AccountIdStage builder() { public interface AccountIdStage { CreatedAtStage accountId(@NotNull String accountId); - Builder from(CrmLineItemResponseData other); + Builder from(ConditionGroupResponseData other); } public interface CreatedAtStage { @@ -134,7 +156,15 @@ public interface CreatedAtStage { } public interface EnvironmentIdStage { - UpdatedAtStage environmentId(@NotNull String environmentId); + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + RuleIdStage id(@NotNull String id); + } + + public interface RuleIdStage { + UpdatedAtStage ruleId(@NotNull String ruleId); } public interface UpdatedAtStage { @@ -142,31 +172,41 @@ public interface UpdatedAtStage { } public interface _FinalStage { - CrmLineItemResponseData build(); + ConditionGroupResponseData build(); - _FinalStage dealId(Optional dealId); + _FinalStage flagId(Optional flagId); - _FinalStage dealId(String dealId); + _FinalStage flagId(String flagId); - _FinalStage productExternalId(Optional productExternalId); + _FinalStage planVersionId(Optional planVersionId); - _FinalStage productExternalId(String productExternalId); + _FinalStage planVersionId(String planVersionId); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements AccountIdStage, CreatedAtStage, EnvironmentIdStage, UpdatedAtStage, _FinalStage { + implements AccountIdStage, + CreatedAtStage, + EnvironmentIdStage, + IdStage, + RuleIdStage, + UpdatedAtStage, + _FinalStage { private String accountId; private OffsetDateTime createdAt; private String environmentId; + private String id; + + private String ruleId; + private OffsetDateTime updatedAt; - private Optional productExternalId = Optional.empty(); + private Optional planVersionId = Optional.empty(); - private Optional dealId = Optional.empty(); + private Optional flagId = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -174,12 +214,14 @@ public static final class Builder private Builder() {} @java.lang.Override - public Builder from(CrmLineItemResponseData other) { + public Builder from(ConditionGroupResponseData other) { accountId(other.getAccountId()); createdAt(other.getCreatedAt()); - dealId(other.getDealId()); environmentId(other.getEnvironmentId()); - productExternalId(other.getProductExternalId()); + flagId(other.getFlagId()); + id(other.getId()); + planVersionId(other.getPlanVersionId()); + ruleId(other.getRuleId()); updatedAt(other.getUpdatedAt()); return this; } @@ -200,11 +242,25 @@ public EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("environment_id") - public UpdatedAtStage environmentId(@NotNull String environmentId) { + public IdStage environmentId(@NotNull String environmentId) { this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); return this; } + @java.lang.Override + @JsonSetter("id") + public RuleIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("rule_id") + public UpdatedAtStage ruleId(@NotNull String ruleId) { + this.ruleId = Objects.requireNonNull(ruleId, "ruleId must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -213,35 +269,43 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { } @java.lang.Override - public _FinalStage productExternalId(String productExternalId) { - this.productExternalId = Optional.ofNullable(productExternalId); + public _FinalStage planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); return this; } @java.lang.Override - @JsonSetter(value = "product_external_id", nulls = Nulls.SKIP) - public _FinalStage productExternalId(Optional productExternalId) { - this.productExternalId = productExternalId; + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public _FinalStage planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; return this; } @java.lang.Override - public _FinalStage dealId(String dealId) { - this.dealId = Optional.ofNullable(dealId); + public _FinalStage flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); return this; } @java.lang.Override - @JsonSetter(value = "deal_id", nulls = Nulls.SKIP) - public _FinalStage dealId(Optional dealId) { - this.dealId = dealId; + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; return this; } @java.lang.Override - public CrmLineItemResponseData build() { - return new CrmLineItemResponseData( - accountId, createdAt, dealId, environmentId, productExternalId, updatedAt, additionalProperties); + public ConditionGroupResponseData build() { + return new ConditionGroupResponseData( + accountId, + createdAt, + environmentId, + flagId, + id, + planVersionId, + ruleId, + updatedAt, + additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/CrmProductResponseData.java b/src/main/java/com/schematic/api/types/ConditionGroupView.java similarity index 50% rename from src/main/java/com/schematic/api/types/CrmProductResponseData.java rename to src/main/java/com/schematic/api/types/ConditionGroupView.java index aafa32e..81f60c1 100644 --- a/src/main/java/com/schematic/api/types/CrmProductResponseData.java +++ b/src/main/java/com/schematic/api/types/ConditionGroupView.java @@ -9,60 +9,60 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CrmProductResponseData.Builder.class) -public final class CrmProductResponseData { +@JsonDeserialize(builder = ConditionGroupView.Builder.class) +public final class ConditionGroupView { private final String accountId; - private final OffsetDateTime createdAt; + private final List conditions; - private final String currency; + private final OffsetDateTime createdAt; private final String environmentId; - private final String externalId; + private final Optional flagId; - private final String name; + private final String id; - private final String price; + private final Optional planVersionId; - private final String productId; - - private final double quantity; + private final String ruleId; private final OffsetDateTime updatedAt; private final Map additionalProperties; - private CrmProductResponseData( + private ConditionGroupView( String accountId, + List conditions, OffsetDateTime createdAt, - String currency, String environmentId, - String externalId, - String name, - String price, - String productId, - double quantity, + Optional flagId, + String id, + Optional planVersionId, + String ruleId, OffsetDateTime updatedAt, Map additionalProperties) { this.accountId = accountId; + this.conditions = conditions; this.createdAt = createdAt; - this.currency = currency; this.environmentId = environmentId; - this.externalId = externalId; - this.name = name; - this.price = price; - this.productId = productId; - this.quantity = quantity; + this.flagId = flagId; + this.id = id; + this.planVersionId = planVersionId; + this.ruleId = ruleId; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -72,44 +72,39 @@ public String getAccountId() { return accountId; } + @JsonProperty("conditions") + public List getConditions() { + return conditions; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; } - @JsonProperty("currency") - public String getCurrency() { - return currency; - } - @JsonProperty("environment_id") public String getEnvironmentId() { return environmentId; } - @JsonProperty("external_id") - public String getExternalId() { - return externalId; + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; } - @JsonProperty("name") - public String getName() { - return name; + @JsonProperty("id") + public String getId() { + return id; } - @JsonProperty("price") - public String getPrice() { - return price; + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; } - @JsonProperty("product_id") - public String getProductId() { - return productId; - } - - @JsonProperty("quantity") - public double getQuantity() { - return quantity; + @JsonProperty("rule_id") + public String getRuleId() { + return ruleId; } @JsonProperty("updated_at") @@ -120,7 +115,7 @@ public OffsetDateTime getUpdatedAt() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CrmProductResponseData && equalTo((CrmProductResponseData) other); + return other instanceof ConditionGroupView && equalTo((ConditionGroupView) other); } @JsonAnyGetter @@ -128,16 +123,15 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CrmProductResponseData other) { + private boolean equalTo(ConditionGroupView other) { return accountId.equals(other.accountId) + && conditions.equals(other.conditions) && createdAt.equals(other.createdAt) - && currency.equals(other.currency) && environmentId.equals(other.environmentId) - && externalId.equals(other.externalId) - && name.equals(other.name) - && price.equals(other.price) - && productId.equals(other.productId) - && quantity == other.quantity + && flagId.equals(other.flagId) + && id.equals(other.id) + && planVersionId.equals(other.planVersionId) + && ruleId.equals(other.ruleId) && updatedAt.equals(other.updatedAt); } @@ -145,14 +139,13 @@ private boolean equalTo(CrmProductResponseData other) { public int hashCode() { return Objects.hash( this.accountId, + this.conditions, this.createdAt, - this.currency, this.environmentId, - this.externalId, - this.name, - this.price, - this.productId, - this.quantity, + this.flagId, + this.id, + this.planVersionId, + this.ruleId, this.updatedAt); } @@ -168,39 +161,23 @@ public static AccountIdStage builder() { public interface AccountIdStage { CreatedAtStage accountId(@NotNull String accountId); - Builder from(CrmProductResponseData other); + Builder from(ConditionGroupView other); } public interface CreatedAtStage { - CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface CurrencyStage { - EnvironmentIdStage currency(@NotNull String currency); + EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt); } public interface EnvironmentIdStage { - ExternalIdStage environmentId(@NotNull String environmentId); - } - - public interface ExternalIdStage { - NameStage externalId(@NotNull String externalId); + IdStage environmentId(@NotNull String environmentId); } - public interface NameStage { - PriceStage name(@NotNull String name); + public interface IdStage { + RuleIdStage id(@NotNull String id); } - public interface PriceStage { - ProductIdStage price(@NotNull String price); - } - - public interface ProductIdStage { - QuantityStage productId(@NotNull String productId); - } - - public interface QuantityStage { - UpdatedAtStage quantity(double quantity); + public interface RuleIdStage { + UpdatedAtStage ruleId(@NotNull String ruleId); } public interface UpdatedAtStage { @@ -208,41 +185,49 @@ public interface UpdatedAtStage { } public interface _FinalStage { - CrmProductResponseData build(); + ConditionGroupView build(); + + _FinalStage conditions(List conditions); + + _FinalStage addConditions(ConditionView conditions); + + _FinalStage addAllConditions(List conditions); + + _FinalStage flagId(Optional flagId); + + _FinalStage flagId(String flagId); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements AccountIdStage, CreatedAtStage, - CurrencyStage, EnvironmentIdStage, - ExternalIdStage, - NameStage, - PriceStage, - ProductIdStage, - QuantityStage, + IdStage, + RuleIdStage, UpdatedAtStage, _FinalStage { private String accountId; private OffsetDateTime createdAt; - private String currency; - private String environmentId; - private String externalId; + private String id; - private String name; + private String ruleId; - private String price; + private OffsetDateTime updatedAt; - private String productId; + private Optional planVersionId = Optional.empty(); - private double quantity; + private Optional flagId = Optional.empty(); - private OffsetDateTime updatedAt; + private List conditions = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -250,16 +235,15 @@ public static final class Builder private Builder() {} @java.lang.Override - public Builder from(CrmProductResponseData other) { + public Builder from(ConditionGroupView other) { accountId(other.getAccountId()); + conditions(other.getConditions()); createdAt(other.getCreatedAt()); - currency(other.getCurrency()); environmentId(other.getEnvironmentId()); - externalId(other.getExternalId()); - name(other.getName()); - price(other.getPrice()); - productId(other.getProductId()); - quantity(other.getQuantity()); + flagId(other.getFlagId()); + id(other.getId()); + planVersionId(other.getPlanVersionId()); + ruleId(other.getRuleId()); updatedAt(other.getUpdatedAt()); return this; } @@ -273,79 +257,100 @@ public CreatedAtStage accountId(@NotNull String accountId) { @java.lang.Override @JsonSetter("created_at") - public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { + public EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt) { this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); return this; } @java.lang.Override - @JsonSetter("currency") - public EnvironmentIdStage currency(@NotNull String currency) { - this.currency = Objects.requireNonNull(currency, "currency must not be null"); + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); return this; } @java.lang.Override - @JsonSetter("environment_id") - public ExternalIdStage environmentId(@NotNull String environmentId) { - this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + @JsonSetter("id") + public RuleIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } @java.lang.Override - @JsonSetter("external_id") - public NameStage externalId(@NotNull String externalId) { - this.externalId = Objects.requireNonNull(externalId, "externalId must not be null"); + @JsonSetter("rule_id") + public UpdatedAtStage ruleId(@NotNull String ruleId) { + this.ruleId = Objects.requireNonNull(ruleId, "ruleId must not be null"); return this; } @java.lang.Override - @JsonSetter("name") - public PriceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); return this; } @java.lang.Override - @JsonSetter("price") - public ProductIdStage price(@NotNull String price) { - this.price = Objects.requireNonNull(price, "price must not be null"); + public _FinalStage planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); return this; } @java.lang.Override - @JsonSetter("product_id") - public QuantityStage productId(@NotNull String productId) { - this.productId = Objects.requireNonNull(productId, "productId must not be null"); + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public _FinalStage planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; return this; } @java.lang.Override - @JsonSetter("quantity") - public UpdatedAtStage quantity(double quantity) { - this.quantity = quantity; + public _FinalStage flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); return this; } @java.lang.Override - @JsonSetter("updated_at") - public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; + return this; + } + + @java.lang.Override + public _FinalStage addAllConditions(List conditions) { + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + @java.lang.Override + public _FinalStage addConditions(ConditionView conditions) { + this.conditions.add(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(List conditions) { + this.conditions.clear(); + if (conditions != null) { + this.conditions.addAll(conditions); + } return this; } @java.lang.Override - public CrmProductResponseData build() { - return new CrmProductResponseData( + public ConditionGroupView build() { + return new ConditionGroupView( accountId, + conditions, createdAt, - currency, environmentId, - externalId, - name, - price, - productId, - quantity, + flagId, + id, + planVersionId, + ruleId, updatedAt, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/ConditionMetricPeriod.java b/src/main/java/com/schematic/api/types/ConditionMetricPeriod.java new file mode 100644 index 0000000..2e7adfd --- /dev/null +++ b/src/main/java/com/schematic/api/types/ConditionMetricPeriod.java @@ -0,0 +1,106 @@ +/** + * 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 ConditionMetricPeriod { + public static final ConditionMetricPeriod CURRENT_DAY = new ConditionMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final ConditionMetricPeriod ALL_TIME = new ConditionMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final ConditionMetricPeriod CURRENT_WEEK = + new ConditionMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final ConditionMetricPeriod CURRENT_MONTH = + new ConditionMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + ConditionMetricPeriod(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 ConditionMetricPeriod + && this.string.equals(((ConditionMetricPeriod) 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 ConditionMetricPeriod 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 ConditionMetricPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_DAY, + + CURRENT_MONTH, + + CURRENT_WEEK, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentDay(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetStart.java b/src/main/java/com/schematic/api/types/ConditionMetricPeriodMonthReset.java similarity index 52% rename from src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetStart.java rename to src/main/java/com/schematic/api/types/ConditionMetricPeriodMonthReset.java index bbd345d..5ce4228 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantRequestBodyResetStart.java +++ b/src/main/java/com/schematic/api/types/ConditionMetricPeriodMonthReset.java @@ -1,23 +1,23 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateBillingPlanCreditGrantRequestBodyResetStart { - public static final CreateBillingPlanCreditGrantRequestBodyResetStart FIRST_OF_MONTH = - new CreateBillingPlanCreditGrantRequestBodyResetStart(Value.FIRST_OF_MONTH, "first_of_month"); +public final class ConditionMetricPeriodMonthReset { + public static final ConditionMetricPeriodMonthReset FIRST_OF_MONTH = + new ConditionMetricPeriodMonthReset(Value.FIRST_OF_MONTH, "first_of_month"); - public static final CreateBillingPlanCreditGrantRequestBodyResetStart BILLING_PERIOD = - new CreateBillingPlanCreditGrantRequestBodyResetStart(Value.BILLING_PERIOD, "billing_period"); + public static final ConditionMetricPeriodMonthReset BILLING_CYCLE = + new ConditionMetricPeriodMonthReset(Value.BILLING_CYCLE, "billing_cycle"); private final Value value; private final String string; - CreateBillingPlanCreditGrantRequestBodyResetStart(Value value, String string) { + ConditionMetricPeriodMonthReset(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +35,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateBillingPlanCreditGrantRequestBodyResetStart - && this.string.equals(((CreateBillingPlanCreditGrantRequestBodyResetStart) other).string)); + || (other instanceof ConditionMetricPeriodMonthReset + && this.string.equals(((ConditionMetricPeriodMonthReset) other).string)); } @java.lang.Override @@ -48,8 +48,8 @@ public T visit(Visitor visitor) { switch (value) { case FIRST_OF_MONTH: return visitor.visitFirstOfMonth(); - case BILLING_PERIOD: - return visitor.visitBillingPeriod(); + case BILLING_CYCLE: + return visitor.visitBillingCycle(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -57,30 +57,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateBillingPlanCreditGrantRequestBodyResetStart valueOf(String value) { + public static ConditionMetricPeriodMonthReset valueOf(String value) { switch (value) { case "first_of_month": return FIRST_OF_MONTH; - case "billing_period": - return BILLING_PERIOD; + case "billing_cycle": + return BILLING_CYCLE; default: - return new CreateBillingPlanCreditGrantRequestBodyResetStart(Value.UNKNOWN, value); + return new ConditionMetricPeriodMonthReset(Value.UNKNOWN, value); } } public enum Value { - BILLING_PERIOD, - FIRST_OF_MONTH, + BILLING_CYCLE, + UNKNOWN } public interface Visitor { - T visitBillingPeriod(); - T visitFirstOfMonth(); + T visitBillingCycle(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/ConditionOperator.java b/src/main/java/com/schematic/api/types/ConditionOperator.java new file mode 100644 index 0000000..ea6cb93 --- /dev/null +++ b/src/main/java/com/schematic/api/types/ConditionOperator.java @@ -0,0 +1,143 @@ +/** + * 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 ConditionOperator { + public static final ConditionOperator GTE = new ConditionOperator(Value.GTE, "gte"); + + public static final ConditionOperator LT = new ConditionOperator(Value.LT, "lt"); + + public static final ConditionOperator GT = new ConditionOperator(Value.GT, "gt"); + + public static final ConditionOperator NOT_EMPTY = new ConditionOperator(Value.NOT_EMPTY, "not_empty"); + + public static final ConditionOperator EQ = new ConditionOperator(Value.EQ, "eq"); + + public static final ConditionOperator NE = new ConditionOperator(Value.NE, "ne"); + + public static final ConditionOperator LTE = new ConditionOperator(Value.LTE, "lte"); + + public static final ConditionOperator IS_EMPTY = new ConditionOperator(Value.IS_EMPTY, "is_empty"); + + private final Value value; + + private final String string; + + ConditionOperator(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 ConditionOperator && this.string.equals(((ConditionOperator) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GTE: + return visitor.visitGte(); + case LT: + return visitor.visitLt(); + case GT: + return visitor.visitGt(); + case NOT_EMPTY: + return visitor.visitNotEmpty(); + case EQ: + return visitor.visitEq(); + case NE: + return visitor.visitNe(); + case LTE: + return visitor.visitLte(); + case IS_EMPTY: + return visitor.visitIsEmpty(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ConditionOperator valueOf(String value) { + switch (value) { + case "gte": + return GTE; + case "lt": + return LT; + case "gt": + return GT; + case "not_empty": + return NOT_EMPTY; + case "eq": + return EQ; + case "ne": + return NE; + case "lte": + return LTE; + case "is_empty": + return IS_EMPTY; + default: + return new ConditionOperator(Value.UNKNOWN, value); + } + } + + public enum Value { + EQ, + + NE, + + GT, + + LT, + + GTE, + + LTE, + + IS_EMPTY, + + NOT_EMPTY, + + UNKNOWN + } + + public interface Visitor { + T visitEq(); + + T visitNe(); + + T visitGt(); + + T visitLt(); + + T visitGte(); + + T visitLte(); + + T visitIsEmpty(); + + T visitNotEmpty(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/ConditionResponseData.java b/src/main/java/com/schematic/api/types/ConditionResponseData.java new file mode 100644 index 0000000..adc231c --- /dev/null +++ b/src/main/java/com/schematic/api/types/ConditionResponseData.java @@ -0,0 +1,845 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConditionResponseData.Builder.class) +public final class ConditionResponseData { + private final String accountId; + + private final Optional comparisonTraitId; + + private final Optional conditionGroupId; + + private final String conditionType; + + private final Optional consumptionRate; + + private final OffsetDateTime createdAt; + + private final Optional creditId; + + private final String environmentId; + + private final Optional eventSubtype; + + private final Optional flagId; + + private final String id; + + private final Optional metricPeriod; + + private final Optional metricPeriodMonthReset; + + private final Optional metricValue; + + private final String operator; + + private final Optional planVersionId; + + private final List resourceUnspecifiedIds; + + private final String ruleId; + + private final Optional traitEntityType; + + private final Optional traitId; + + private final String traitValue; + + private final boolean traitValueBool; + + private final Optional traitValueDate; + + private final int traitValueInt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private ConditionResponseData( + String accountId, + Optional comparisonTraitId, + Optional conditionGroupId, + String conditionType, + Optional consumptionRate, + OffsetDateTime createdAt, + Optional creditId, + String environmentId, + Optional eventSubtype, + Optional flagId, + String id, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional metricValue, + String operator, + Optional planVersionId, + List resourceUnspecifiedIds, + String ruleId, + Optional traitEntityType, + Optional traitId, + String traitValue, + boolean traitValueBool, + Optional traitValueDate, + int traitValueInt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.comparisonTraitId = comparisonTraitId; + this.conditionGroupId = conditionGroupId; + this.conditionType = conditionType; + this.consumptionRate = consumptionRate; + this.createdAt = createdAt; + this.creditId = creditId; + this.environmentId = environmentId; + this.eventSubtype = eventSubtype; + this.flagId = flagId; + this.id = id; + this.metricPeriod = metricPeriod; + this.metricPeriodMonthReset = metricPeriodMonthReset; + this.metricValue = metricValue; + this.operator = operator; + this.planVersionId = planVersionId; + this.resourceUnspecifiedIds = resourceUnspecifiedIds; + this.ruleId = ruleId; + this.traitEntityType = traitEntityType; + this.traitId = traitId; + this.traitValue = traitValue; + this.traitValueBool = traitValueBool; + this.traitValueDate = traitValueDate; + this.traitValueInt = traitValueInt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("comparison_trait_id") + public Optional getComparisonTraitId() { + return comparisonTraitId; + } + + @JsonProperty("condition_group_id") + public Optional getConditionGroupId() { + return conditionGroupId; + } + + @JsonProperty("condition_type") + public String getConditionType() { + return conditionType; + } + + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + @JsonProperty("metric_period_month_reset") + public Optional getMetricPeriodMonthReset() { + return metricPeriodMonthReset; + } + + @JsonProperty("metric_value") + public Optional getMetricValue() { + return metricValue; + } + + @JsonProperty("operator") + public String getOperator() { + return operator; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("resource_unspecified_ids") + public List getResourceUnspecifiedIds() { + return resourceUnspecifiedIds; + } + + @JsonProperty("rule_id") + public String getRuleId() { + return ruleId; + } + + @JsonProperty("trait_entity_type") + public Optional getTraitEntityType() { + return traitEntityType; + } + + @JsonProperty("trait_id") + public Optional getTraitId() { + return traitId; + } + + @JsonProperty("trait_value") + public String getTraitValue() { + return traitValue; + } + + @JsonProperty("trait_value_bool") + public boolean getTraitValueBool() { + return traitValueBool; + } + + @JsonProperty("trait_value_date") + public Optional getTraitValueDate() { + return traitValueDate; + } + + @JsonProperty("trait_value_int") + public int getTraitValueInt() { + return traitValueInt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConditionResponseData && equalTo((ConditionResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConditionResponseData other) { + return accountId.equals(other.accountId) + && comparisonTraitId.equals(other.comparisonTraitId) + && conditionGroupId.equals(other.conditionGroupId) + && conditionType.equals(other.conditionType) + && consumptionRate.equals(other.consumptionRate) + && createdAt.equals(other.createdAt) + && creditId.equals(other.creditId) + && environmentId.equals(other.environmentId) + && eventSubtype.equals(other.eventSubtype) + && flagId.equals(other.flagId) + && id.equals(other.id) + && metricPeriod.equals(other.metricPeriod) + && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && metricValue.equals(other.metricValue) + && operator.equals(other.operator) + && planVersionId.equals(other.planVersionId) + && resourceUnspecifiedIds.equals(other.resourceUnspecifiedIds) + && ruleId.equals(other.ruleId) + && traitEntityType.equals(other.traitEntityType) + && traitId.equals(other.traitId) + && traitValue.equals(other.traitValue) + && traitValueBool == other.traitValueBool + && traitValueDate.equals(other.traitValueDate) + && traitValueInt == other.traitValueInt + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.comparisonTraitId, + this.conditionGroupId, + this.conditionType, + this.consumptionRate, + this.createdAt, + this.creditId, + this.environmentId, + this.eventSubtype, + this.flagId, + this.id, + this.metricPeriod, + this.metricPeriodMonthReset, + this.metricValue, + this.operator, + this.planVersionId, + this.resourceUnspecifiedIds, + this.ruleId, + this.traitEntityType, + this.traitId, + this.traitValue, + this.traitValueBool, + this.traitValueDate, + this.traitValueInt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + ConditionTypeStage accountId(@NotNull String accountId); + + Builder from(ConditionResponseData other); + } + + public interface ConditionTypeStage { + CreatedAtStage conditionType(@NotNull String conditionType); + } + + public interface CreatedAtStage { + EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + OperatorStage id(@NotNull String id); + } + + public interface OperatorStage { + RuleIdStage operator(@NotNull String operator); + } + + public interface RuleIdStage { + TraitValueStage ruleId(@NotNull String ruleId); + } + + public interface TraitValueStage { + TraitValueBoolStage traitValue(@NotNull String traitValue); + } + + public interface TraitValueBoolStage { + TraitValueIntStage traitValueBool(boolean traitValueBool); + } + + public interface TraitValueIntStage { + UpdatedAtStage traitValueInt(int traitValueInt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ConditionResponseData build(); + + _FinalStage comparisonTraitId(Optional comparisonTraitId); + + _FinalStage comparisonTraitId(String comparisonTraitId); + + _FinalStage conditionGroupId(Optional conditionGroupId); + + _FinalStage conditionGroupId(String conditionGroupId); + + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + + _FinalStage creditId(Optional creditId); + + _FinalStage creditId(String creditId); + + _FinalStage eventSubtype(Optional eventSubtype); + + _FinalStage eventSubtype(String eventSubtype); + + _FinalStage flagId(Optional flagId); + + _FinalStage flagId(String flagId); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(String metricPeriod); + + _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); + + _FinalStage metricValue(Optional metricValue); + + _FinalStage metricValue(Integer metricValue); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + + _FinalStage resourceUnspecifiedIds(List resourceUnspecifiedIds); + + _FinalStage addResourceUnspecifiedIds(String resourceUnspecifiedIds); + + _FinalStage addAllResourceUnspecifiedIds(List resourceUnspecifiedIds); + + _FinalStage traitEntityType(Optional traitEntityType); + + _FinalStage traitEntityType(EntityType traitEntityType); + + _FinalStage traitId(Optional traitId); + + _FinalStage traitId(String traitId); + + _FinalStage traitValueDate(Optional traitValueDate); + + _FinalStage traitValueDate(OffsetDateTime traitValueDate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + ConditionTypeStage, + CreatedAtStage, + EnvironmentIdStage, + IdStage, + OperatorStage, + RuleIdStage, + TraitValueStage, + TraitValueBoolStage, + TraitValueIntStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private String conditionType; + + private OffsetDateTime createdAt; + + private String environmentId; + + private String id; + + private String operator; + + private String ruleId; + + private String traitValue; + + private boolean traitValueBool; + + private int traitValueInt; + + private OffsetDateTime updatedAt; + + private Optional traitValueDate = Optional.empty(); + + private Optional traitId = Optional.empty(); + + private Optional traitEntityType = Optional.empty(); + + private List resourceUnspecifiedIds = new ArrayList<>(); + + private Optional planVersionId = Optional.empty(); + + private Optional metricValue = Optional.empty(); + + private Optional metricPeriodMonthReset = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional flagId = Optional.empty(); + + private Optional eventSubtype = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional consumptionRate = Optional.empty(); + + private Optional conditionGroupId = Optional.empty(); + + private Optional comparisonTraitId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConditionResponseData other) { + accountId(other.getAccountId()); + comparisonTraitId(other.getComparisonTraitId()); + conditionGroupId(other.getConditionGroupId()); + conditionType(other.getConditionType()); + consumptionRate(other.getConsumptionRate()); + createdAt(other.getCreatedAt()); + creditId(other.getCreditId()); + environmentId(other.getEnvironmentId()); + eventSubtype(other.getEventSubtype()); + flagId(other.getFlagId()); + id(other.getId()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + metricValue(other.getMetricValue()); + operator(other.getOperator()); + planVersionId(other.getPlanVersionId()); + resourceUnspecifiedIds(other.getResourceUnspecifiedIds()); + ruleId(other.getRuleId()); + traitEntityType(other.getTraitEntityType()); + traitId(other.getTraitId()); + traitValue(other.getTraitValue()); + traitValueBool(other.getTraitValueBool()); + traitValueDate(other.getTraitValueDate()); + traitValueInt(other.getTraitValueInt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public ConditionTypeStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("condition_type") + public CreatedAtStage conditionType(@NotNull String conditionType) { + this.conditionType = Objects.requireNonNull(conditionType, "conditionType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public OperatorStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("operator") + public RuleIdStage operator(@NotNull String operator) { + this.operator = Objects.requireNonNull(operator, "operator must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("rule_id") + public TraitValueStage ruleId(@NotNull String ruleId) { + this.ruleId = Objects.requireNonNull(ruleId, "ruleId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("trait_value") + public TraitValueBoolStage traitValue(@NotNull String traitValue) { + this.traitValue = Objects.requireNonNull(traitValue, "traitValue must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("trait_value_bool") + public TraitValueIntStage traitValueBool(boolean traitValueBool) { + this.traitValueBool = traitValueBool; + return this; + } + + @java.lang.Override + @JsonSetter("trait_value_int") + public UpdatedAtStage traitValueInt(int traitValueInt) { + this.traitValueInt = traitValueInt; + 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 traitValueDate(OffsetDateTime traitValueDate) { + this.traitValueDate = Optional.ofNullable(traitValueDate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_value_date", nulls = Nulls.SKIP) + public _FinalStage traitValueDate(Optional traitValueDate) { + this.traitValueDate = traitValueDate; + 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 traitEntityType(EntityType traitEntityType) { + this.traitEntityType = Optional.ofNullable(traitEntityType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_entity_type", nulls = Nulls.SKIP) + public _FinalStage traitEntityType(Optional traitEntityType) { + this.traitEntityType = traitEntityType; + return this; + } + + @java.lang.Override + public _FinalStage addAllResourceUnspecifiedIds(List resourceUnspecifiedIds) { + if (resourceUnspecifiedIds != null) { + this.resourceUnspecifiedIds.addAll(resourceUnspecifiedIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addResourceUnspecifiedIds(String resourceUnspecifiedIds) { + this.resourceUnspecifiedIds.add(resourceUnspecifiedIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_unspecified_ids", nulls = Nulls.SKIP) + public _FinalStage resourceUnspecifiedIds(List resourceUnspecifiedIds) { + this.resourceUnspecifiedIds.clear(); + if (resourceUnspecifiedIds != null) { + this.resourceUnspecifiedIds.addAll(resourceUnspecifiedIds); + } + 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 metricValue(Integer metricValue) { + this.metricValue = Optional.ofNullable(metricValue); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) + public _FinalStage metricValue(Optional metricValue) { + this.metricValue = metricValue; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriodMonthReset(String 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(String 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 flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; + return this; + } + + @java.lang.Override + public _FinalStage 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 _FinalStage creditId(String creditId) { + this.creditId = Optional.ofNullable(creditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_id", nulls = Nulls.SKIP) + public _FinalStage creditId(Optional creditId) { + this.creditId = creditId; + return this; + } + + @java.lang.Override + public _FinalStage consumptionRate(Double consumptionRate) { + this.consumptionRate = Optional.ofNullable(consumptionRate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "consumption_rate", nulls = Nulls.SKIP) + public _FinalStage consumptionRate(Optional consumptionRate) { + this.consumptionRate = consumptionRate; + return this; + } + + @java.lang.Override + public _FinalStage conditionGroupId(String conditionGroupId) { + this.conditionGroupId = Optional.ofNullable(conditionGroupId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "condition_group_id", nulls = Nulls.SKIP) + public _FinalStage conditionGroupId(Optional conditionGroupId) { + this.conditionGroupId = conditionGroupId; + return this; + } + + @java.lang.Override + public _FinalStage comparisonTraitId(String comparisonTraitId) { + this.comparisonTraitId = Optional.ofNullable(comparisonTraitId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "comparison_trait_id", nulls = Nulls.SKIP) + public _FinalStage comparisonTraitId(Optional comparisonTraitId) { + this.comparisonTraitId = comparisonTraitId; + return this; + } + + @java.lang.Override + public ConditionResponseData build() { + return new ConditionResponseData( + accountId, + comparisonTraitId, + conditionGroupId, + conditionType, + consumptionRate, + createdAt, + creditId, + environmentId, + eventSubtype, + flagId, + id, + metricPeriod, + metricPeriodMonthReset, + metricValue, + operator, + planVersionId, + resourceUnspecifiedIds, + ruleId, + traitEntityType, + traitId, + traitValue, + traitValueBool, + traitValueDate, + traitValueInt, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/ConditionView.java b/src/main/java/com/schematic/api/types/ConditionView.java new file mode 100644 index 0000000..d7d069f --- /dev/null +++ b/src/main/java/com/schematic/api/types/ConditionView.java @@ -0,0 +1,1134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConditionView.Builder.class) +public final class ConditionView { + private final String accountId; + + private final List billingProducts; + + private final List companies; + + private final Optional comparisonTrait; + + private final Optional comparisonTraitId; + + private final Optional conditionGroupId; + + private final String conditionType; + + private final Optional consumptionRate; + + private final OffsetDateTime createdAt; + + private final Optional creditId; + + private final String environmentId; + + private final Optional eventSubtype; + + private final Optional flagId; + + private final String id; + + private final Optional metricPeriod; + + private final Optional metricPeriodMonthReset; + + private final Optional metricValue; + + private final String operator; + + private final Optional planVersionId; + + private final List planVersions; + + private final List plans; + + private final List resourceUnspecifiedIds; + + private final String ruleId; + + private final Optional trait; + + private final Optional traitEntityType; + + private final Optional traitId; + + private final String traitValue; + + private final boolean traitValueBool; + + private final Optional traitValueDate; + + private final int traitValueInt; + + private final OffsetDateTime updatedAt; + + private final List users; + + private final Map additionalProperties; + + private ConditionView( + String accountId, + List billingProducts, + List companies, + Optional comparisonTrait, + Optional comparisonTraitId, + Optional conditionGroupId, + String conditionType, + Optional consumptionRate, + OffsetDateTime createdAt, + Optional creditId, + String environmentId, + Optional eventSubtype, + Optional flagId, + String id, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional metricValue, + String operator, + Optional planVersionId, + List planVersions, + List plans, + List resourceUnspecifiedIds, + String ruleId, + Optional trait, + Optional traitEntityType, + Optional traitId, + String traitValue, + boolean traitValueBool, + Optional traitValueDate, + int traitValueInt, + OffsetDateTime updatedAt, + List users, + Map additionalProperties) { + this.accountId = accountId; + this.billingProducts = billingProducts; + this.companies = companies; + this.comparisonTrait = comparisonTrait; + this.comparisonTraitId = comparisonTraitId; + this.conditionGroupId = conditionGroupId; + this.conditionType = conditionType; + this.consumptionRate = consumptionRate; + this.createdAt = createdAt; + this.creditId = creditId; + this.environmentId = environmentId; + this.eventSubtype = eventSubtype; + this.flagId = flagId; + this.id = id; + this.metricPeriod = metricPeriod; + this.metricPeriodMonthReset = metricPeriodMonthReset; + this.metricValue = metricValue; + this.operator = operator; + this.planVersionId = planVersionId; + this.planVersions = planVersions; + this.plans = plans; + this.resourceUnspecifiedIds = resourceUnspecifiedIds; + this.ruleId = ruleId; + this.trait = trait; + this.traitEntityType = traitEntityType; + this.traitId = traitId; + this.traitValue = traitValue; + this.traitValueBool = traitValueBool; + this.traitValueDate = traitValueDate; + this.traitValueInt = traitValueInt; + this.updatedAt = updatedAt; + this.users = users; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("billing_products") + public List getBillingProducts() { + return billingProducts; + } + + @JsonProperty("companies") + public List getCompanies() { + return companies; + } + + @JsonProperty("comparison_trait") + public Optional getComparisonTrait() { + return comparisonTrait; + } + + @JsonProperty("comparison_trait_id") + public Optional getComparisonTraitId() { + return comparisonTraitId; + } + + @JsonProperty("condition_group_id") + public Optional getConditionGroupId() { + return conditionGroupId; + } + + @JsonProperty("condition_type") + public String getConditionType() { + return conditionType; + } + + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + @JsonProperty("metric_period_month_reset") + public Optional getMetricPeriodMonthReset() { + return metricPeriodMonthReset; + } + + @JsonProperty("metric_value") + public Optional getMetricValue() { + return metricValue; + } + + @JsonProperty("operator") + public String getOperator() { + return operator; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("plan_versions") + public List getPlanVersions() { + return planVersions; + } + + @JsonProperty("plans") + public List getPlans() { + return plans; + } + + @JsonProperty("resource_unspecified_ids") + public List getResourceUnspecifiedIds() { + return resourceUnspecifiedIds; + } + + @JsonProperty("rule_id") + public String getRuleId() { + return ruleId; + } + + @JsonProperty("trait") + public Optional getTrait() { + return trait; + } + + @JsonProperty("trait_entity_type") + public Optional getTraitEntityType() { + return traitEntityType; + } + + @JsonProperty("trait_id") + public Optional getTraitId() { + return traitId; + } + + @JsonProperty("trait_value") + public String getTraitValue() { + return traitValue; + } + + @JsonProperty("trait_value_bool") + public boolean getTraitValueBool() { + return traitValueBool; + } + + @JsonProperty("trait_value_date") + public Optional getTraitValueDate() { + return traitValueDate; + } + + @JsonProperty("trait_value_int") + public int getTraitValueInt() { + return traitValueInt; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("users") + public List getUsers() { + return users; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConditionView && equalTo((ConditionView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConditionView other) { + return accountId.equals(other.accountId) + && billingProducts.equals(other.billingProducts) + && companies.equals(other.companies) + && comparisonTrait.equals(other.comparisonTrait) + && comparisonTraitId.equals(other.comparisonTraitId) + && conditionGroupId.equals(other.conditionGroupId) + && conditionType.equals(other.conditionType) + && consumptionRate.equals(other.consumptionRate) + && createdAt.equals(other.createdAt) + && creditId.equals(other.creditId) + && environmentId.equals(other.environmentId) + && eventSubtype.equals(other.eventSubtype) + && flagId.equals(other.flagId) + && id.equals(other.id) + && metricPeriod.equals(other.metricPeriod) + && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && metricValue.equals(other.metricValue) + && operator.equals(other.operator) + && planVersionId.equals(other.planVersionId) + && planVersions.equals(other.planVersions) + && plans.equals(other.plans) + && resourceUnspecifiedIds.equals(other.resourceUnspecifiedIds) + && ruleId.equals(other.ruleId) + && trait.equals(other.trait) + && traitEntityType.equals(other.traitEntityType) + && traitId.equals(other.traitId) + && traitValue.equals(other.traitValue) + && traitValueBool == other.traitValueBool + && traitValueDate.equals(other.traitValueDate) + && traitValueInt == other.traitValueInt + && updatedAt.equals(other.updatedAt) + && users.equals(other.users); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.billingProducts, + this.companies, + this.comparisonTrait, + this.comparisonTraitId, + this.conditionGroupId, + this.conditionType, + this.consumptionRate, + this.createdAt, + this.creditId, + this.environmentId, + this.eventSubtype, + this.flagId, + this.id, + this.metricPeriod, + this.metricPeriodMonthReset, + this.metricValue, + this.operator, + this.planVersionId, + this.planVersions, + this.plans, + this.resourceUnspecifiedIds, + this.ruleId, + this.trait, + this.traitEntityType, + this.traitId, + this.traitValue, + this.traitValueBool, + this.traitValueDate, + this.traitValueInt, + this.updatedAt, + this.users); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + ConditionTypeStage accountId(@NotNull String accountId); + + Builder from(ConditionView other); + } + + public interface ConditionTypeStage { + CreatedAtStage conditionType(@NotNull String conditionType); + } + + public interface CreatedAtStage { + EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + OperatorStage id(@NotNull String id); + } + + public interface OperatorStage { + RuleIdStage operator(@NotNull String operator); + } + + public interface RuleIdStage { + TraitValueStage ruleId(@NotNull String ruleId); + } + + public interface TraitValueStage { + TraitValueBoolStage traitValue(@NotNull String traitValue); + } + + public interface TraitValueBoolStage { + TraitValueIntStage traitValueBool(boolean traitValueBool); + } + + public interface TraitValueIntStage { + UpdatedAtStage traitValueInt(int traitValueInt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ConditionView build(); + + _FinalStage billingProducts(List billingProducts); + + _FinalStage addBillingProducts(GenericPreviewObject billingProducts); + + _FinalStage addAllBillingProducts(List billingProducts); + + _FinalStage companies(List companies); + + _FinalStage addCompanies(GenericPreviewObject companies); + + _FinalStage addAllCompanies(List companies); + + _FinalStage comparisonTrait(Optional comparisonTrait); + + _FinalStage comparisonTrait(EntityTraitDefinitionResponseData comparisonTrait); + + _FinalStage comparisonTraitId(Optional comparisonTraitId); + + _FinalStage comparisonTraitId(String comparisonTraitId); + + _FinalStage conditionGroupId(Optional conditionGroupId); + + _FinalStage conditionGroupId(String conditionGroupId); + + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + + _FinalStage creditId(Optional creditId); + + _FinalStage creditId(String creditId); + + _FinalStage eventSubtype(Optional eventSubtype); + + _FinalStage eventSubtype(String eventSubtype); + + _FinalStage flagId(Optional flagId); + + _FinalStage flagId(String flagId); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(String metricPeriod); + + _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); + + _FinalStage metricValue(Optional metricValue); + + _FinalStage metricValue(Integer metricValue); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + + _FinalStage planVersions(List planVersions); + + _FinalStage addPlanVersions(GenericPreviewObject planVersions); + + _FinalStage addAllPlanVersions(List planVersions); + + _FinalStage plans(List plans); + + _FinalStage addPlans(GenericPreviewObject plans); + + _FinalStage addAllPlans(List plans); + + _FinalStage resourceUnspecifiedIds(List resourceUnspecifiedIds); + + _FinalStage addResourceUnspecifiedIds(String resourceUnspecifiedIds); + + _FinalStage addAllResourceUnspecifiedIds(List resourceUnspecifiedIds); + + _FinalStage trait(Optional trait); + + _FinalStage trait(EntityTraitDefinitionResponseData trait); + + _FinalStage traitEntityType(Optional traitEntityType); + + _FinalStage traitEntityType(EntityType traitEntityType); + + _FinalStage traitId(Optional traitId); + + _FinalStage traitId(String traitId); + + _FinalStage traitValueDate(Optional traitValueDate); + + _FinalStage traitValueDate(OffsetDateTime traitValueDate); + + _FinalStage users(List users); + + _FinalStage addUsers(GenericPreviewObject users); + + _FinalStage addAllUsers(List users); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + ConditionTypeStage, + CreatedAtStage, + EnvironmentIdStage, + IdStage, + OperatorStage, + RuleIdStage, + TraitValueStage, + TraitValueBoolStage, + TraitValueIntStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private String conditionType; + + private OffsetDateTime createdAt; + + private String environmentId; + + private String id; + + private String operator; + + private String ruleId; + + private String traitValue; + + private boolean traitValueBool; + + private int traitValueInt; + + private OffsetDateTime updatedAt; + + private List users = new ArrayList<>(); + + private Optional traitValueDate = Optional.empty(); + + private Optional traitId = Optional.empty(); + + private Optional traitEntityType = Optional.empty(); + + private Optional trait = Optional.empty(); + + private List resourceUnspecifiedIds = new ArrayList<>(); + + private List plans = new ArrayList<>(); + + private List planVersions = new ArrayList<>(); + + private Optional planVersionId = Optional.empty(); + + private Optional metricValue = Optional.empty(); + + private Optional metricPeriodMonthReset = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional flagId = Optional.empty(); + + private Optional eventSubtype = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional consumptionRate = Optional.empty(); + + private Optional conditionGroupId = Optional.empty(); + + private Optional comparisonTraitId = Optional.empty(); + + private Optional comparisonTrait = Optional.empty(); + + private List companies = new ArrayList<>(); + + private List billingProducts = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConditionView other) { + accountId(other.getAccountId()); + billingProducts(other.getBillingProducts()); + companies(other.getCompanies()); + comparisonTrait(other.getComparisonTrait()); + comparisonTraitId(other.getComparisonTraitId()); + conditionGroupId(other.getConditionGroupId()); + conditionType(other.getConditionType()); + consumptionRate(other.getConsumptionRate()); + createdAt(other.getCreatedAt()); + creditId(other.getCreditId()); + environmentId(other.getEnvironmentId()); + eventSubtype(other.getEventSubtype()); + flagId(other.getFlagId()); + id(other.getId()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + metricValue(other.getMetricValue()); + operator(other.getOperator()); + planVersionId(other.getPlanVersionId()); + planVersions(other.getPlanVersions()); + plans(other.getPlans()); + resourceUnspecifiedIds(other.getResourceUnspecifiedIds()); + ruleId(other.getRuleId()); + trait(other.getTrait()); + traitEntityType(other.getTraitEntityType()); + traitId(other.getTraitId()); + traitValue(other.getTraitValue()); + traitValueBool(other.getTraitValueBool()); + traitValueDate(other.getTraitValueDate()); + traitValueInt(other.getTraitValueInt()); + updatedAt(other.getUpdatedAt()); + users(other.getUsers()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public ConditionTypeStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("condition_type") + public CreatedAtStage conditionType(@NotNull String conditionType) { + this.conditionType = Objects.requireNonNull(conditionType, "conditionType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public OperatorStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("operator") + public RuleIdStage operator(@NotNull String operator) { + this.operator = Objects.requireNonNull(operator, "operator must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("rule_id") + public TraitValueStage ruleId(@NotNull String ruleId) { + this.ruleId = Objects.requireNonNull(ruleId, "ruleId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("trait_value") + public TraitValueBoolStage traitValue(@NotNull String traitValue) { + this.traitValue = Objects.requireNonNull(traitValue, "traitValue must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("trait_value_bool") + public TraitValueIntStage traitValueBool(boolean traitValueBool) { + this.traitValueBool = traitValueBool; + return this; + } + + @java.lang.Override + @JsonSetter("trait_value_int") + public UpdatedAtStage traitValueInt(int traitValueInt) { + this.traitValueInt = traitValueInt; + 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 addAllUsers(List users) { + if (users != null) { + this.users.addAll(users); + } + return this; + } + + @java.lang.Override + public _FinalStage addUsers(GenericPreviewObject users) { + this.users.add(users); + return this; + } + + @java.lang.Override + @JsonSetter(value = "users", nulls = Nulls.SKIP) + public _FinalStage users(List users) { + this.users.clear(); + if (users != null) { + this.users.addAll(users); + } + return this; + } + + @java.lang.Override + public _FinalStage traitValueDate(OffsetDateTime traitValueDate) { + this.traitValueDate = Optional.ofNullable(traitValueDate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_value_date", nulls = Nulls.SKIP) + public _FinalStage traitValueDate(Optional traitValueDate) { + this.traitValueDate = traitValueDate; + 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 traitEntityType(EntityType traitEntityType) { + this.traitEntityType = Optional.ofNullable(traitEntityType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_entity_type", nulls = Nulls.SKIP) + public _FinalStage traitEntityType(Optional traitEntityType) { + this.traitEntityType = traitEntityType; + return this; + } + + @java.lang.Override + public _FinalStage trait(EntityTraitDefinitionResponseData trait) { + this.trait = Optional.ofNullable(trait); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait", nulls = Nulls.SKIP) + public _FinalStage trait(Optional trait) { + this.trait = trait; + return this; + } + + @java.lang.Override + public _FinalStage addAllResourceUnspecifiedIds(List resourceUnspecifiedIds) { + if (resourceUnspecifiedIds != null) { + this.resourceUnspecifiedIds.addAll(resourceUnspecifiedIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addResourceUnspecifiedIds(String resourceUnspecifiedIds) { + this.resourceUnspecifiedIds.add(resourceUnspecifiedIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_unspecified_ids", nulls = Nulls.SKIP) + public _FinalStage resourceUnspecifiedIds(List resourceUnspecifiedIds) { + this.resourceUnspecifiedIds.clear(); + if (resourceUnspecifiedIds != null) { + this.resourceUnspecifiedIds.addAll(resourceUnspecifiedIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllPlans(List plans) { + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlans(GenericPreviewObject plans) { + this.plans.add(plans); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plans", nulls = Nulls.SKIP) + public _FinalStage plans(List plans) { + this.plans.clear(); + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllPlanVersions(List planVersions) { + if (planVersions != null) { + this.planVersions.addAll(planVersions); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlanVersions(GenericPreviewObject planVersions) { + this.planVersions.add(planVersions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_versions", nulls = Nulls.SKIP) + public _FinalStage planVersions(List planVersions) { + this.planVersions.clear(); + if (planVersions != null) { + this.planVersions.addAll(planVersions); + } + 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 metricValue(Integer metricValue) { + this.metricValue = Optional.ofNullable(metricValue); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) + public _FinalStage metricValue(Optional metricValue) { + this.metricValue = metricValue; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriodMonthReset(String 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(String 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 flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; + return this; + } + + @java.lang.Override + public _FinalStage 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 _FinalStage creditId(String creditId) { + this.creditId = Optional.ofNullable(creditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_id", nulls = Nulls.SKIP) + public _FinalStage creditId(Optional creditId) { + this.creditId = creditId; + return this; + } + + @java.lang.Override + public _FinalStage consumptionRate(Double consumptionRate) { + this.consumptionRate = Optional.ofNullable(consumptionRate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "consumption_rate", nulls = Nulls.SKIP) + public _FinalStage consumptionRate(Optional consumptionRate) { + this.consumptionRate = consumptionRate; + return this; + } + + @java.lang.Override + public _FinalStage conditionGroupId(String conditionGroupId) { + this.conditionGroupId = Optional.ofNullable(conditionGroupId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "condition_group_id", nulls = Nulls.SKIP) + public _FinalStage conditionGroupId(Optional conditionGroupId) { + this.conditionGroupId = conditionGroupId; + return this; + } + + @java.lang.Override + public _FinalStage comparisonTraitId(String comparisonTraitId) { + this.comparisonTraitId = Optional.ofNullable(comparisonTraitId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "comparison_trait_id", nulls = Nulls.SKIP) + public _FinalStage comparisonTraitId(Optional comparisonTraitId) { + this.comparisonTraitId = comparisonTraitId; + return this; + } + + @java.lang.Override + public _FinalStage comparisonTrait(EntityTraitDefinitionResponseData comparisonTrait) { + this.comparisonTrait = Optional.ofNullable(comparisonTrait); + return this; + } + + @java.lang.Override + @JsonSetter(value = "comparison_trait", nulls = Nulls.SKIP) + public _FinalStage comparisonTrait(Optional comparisonTrait) { + this.comparisonTrait = comparisonTrait; + return this; + } + + @java.lang.Override + public _FinalStage addAllCompanies(List companies) { + if (companies != null) { + this.companies.addAll(companies); + } + return this; + } + + @java.lang.Override + public _FinalStage addCompanies(GenericPreviewObject companies) { + this.companies.add(companies); + return this; + } + + @java.lang.Override + @JsonSetter(value = "companies", nulls = Nulls.SKIP) + public _FinalStage companies(List companies) { + this.companies.clear(); + if (companies != null) { + this.companies.addAll(companies); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllBillingProducts(List billingProducts) { + if (billingProducts != null) { + this.billingProducts.addAll(billingProducts); + } + return this; + } + + @java.lang.Override + public _FinalStage addBillingProducts(GenericPreviewObject billingProducts) { + this.billingProducts.add(billingProducts); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_products", nulls = Nulls.SKIP) + public _FinalStage billingProducts(List billingProducts) { + this.billingProducts.clear(); + if (billingProducts != null) { + this.billingProducts.addAll(billingProducts); + } + return this; + } + + @java.lang.Override + public ConditionView build() { + return new ConditionView( + accountId, + billingProducts, + companies, + comparisonTrait, + comparisonTraitId, + conditionGroupId, + conditionType, + consumptionRate, + createdAt, + creditId, + environmentId, + eventSubtype, + flagId, + id, + metricPeriod, + metricPeriodMonthReset, + metricValue, + operator, + planVersionId, + planVersions, + plans, + resourceUnspecifiedIds, + ruleId, + trait, + traitEntityType, + traitId, + traitValue, + traitValueBool, + traitValueDate, + traitValueInt, + updatedAt, + users, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java new file mode 100644 index 0000000..776995a --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -0,0 +1,599 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBillingPlanCreditGrantRequestBody.Builder.class) +public final class CreateBillingPlanCreditGrantRequestBody { + private final Optional applyToExisting; + + private final Optional autoTopupAmount; + + private final Optional autoTopupAmountType; + + private final Optional autoTopupEnabled; + + private final Optional autoTopupExpiryType; + + private final Optional autoTopupExpiryUnit; + + private final Optional autoTopupExpiryUnitCount; + + private final Optional autoTopupThresholdPercent; + + private final int creditAmount; + + private final String creditId; + + private final Optional expiryType; + + private final Optional expiryUnit; + + private final Optional expiryUnitCount; + + private final String planId; + + private final BillingPlanCreditGrantResetCadence resetCadence; + + private final BillingPlanCreditGrantResetStart resetStart; + + private final Optional resetType; + + private final Map additionalProperties; + + private CreateBillingPlanCreditGrantRequestBody( + Optional applyToExisting, + Optional autoTopupAmount, + Optional autoTopupAmountType, + Optional autoTopupEnabled, + Optional autoTopupExpiryType, + Optional autoTopupExpiryUnit, + Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdPercent, + int creditAmount, + String creditId, + Optional expiryType, + Optional expiryUnit, + Optional expiryUnitCount, + String planId, + BillingPlanCreditGrantResetCadence resetCadence, + BillingPlanCreditGrantResetStart resetStart, + Optional resetType, + Map additionalProperties) { + this.applyToExisting = applyToExisting; + this.autoTopupAmount = autoTopupAmount; + this.autoTopupAmountType = autoTopupAmountType; + this.autoTopupEnabled = autoTopupEnabled; + this.autoTopupExpiryType = autoTopupExpiryType; + this.autoTopupExpiryUnit = autoTopupExpiryUnit; + this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + this.autoTopupThresholdPercent = autoTopupThresholdPercent; + this.creditAmount = creditAmount; + this.creditId = creditId; + this.expiryType = expiryType; + this.expiryUnit = expiryUnit; + this.expiryUnitCount = expiryUnitCount; + this.planId = planId; + this.resetCadence = resetCadence; + this.resetStart = resetStart; + this.resetType = resetType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + + @JsonProperty("auto_topup_amount") + public Optional getAutoTopupAmount() { + return autoTopupAmount; + } + + @JsonProperty("auto_topup_amount_type") + public Optional getAutoTopupAmountType() { + return autoTopupAmountType; + } + + @JsonProperty("auto_topup_enabled") + public Optional getAutoTopupEnabled() { + return autoTopupEnabled; + } + + @JsonProperty("auto_topup_expiry_type") + public Optional getAutoTopupExpiryType() { + return autoTopupExpiryType; + } + + @JsonProperty("auto_topup_expiry_unit") + public Optional getAutoTopupExpiryUnit() { + return autoTopupExpiryUnit; + } + + @JsonProperty("auto_topup_expiry_unit_count") + public Optional getAutoTopupExpiryUnitCount() { + return autoTopupExpiryUnitCount; + } + + @JsonProperty("auto_topup_threshold_percent") + public Optional getAutoTopupThresholdPercent() { + return autoTopupThresholdPercent; + } + + @JsonProperty("credit_amount") + public int getCreditAmount() { + return creditAmount; + } + + @JsonProperty("credit_id") + public String getCreditId() { + return creditId; + } + + @JsonProperty("expiry_type") + public Optional getExpiryType() { + return expiryType; + } + + @JsonProperty("expiry_unit") + public Optional getExpiryUnit() { + return expiryUnit; + } + + @JsonProperty("expiry_unit_count") + public Optional getExpiryUnitCount() { + return expiryUnitCount; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonProperty("reset_cadence") + public BillingPlanCreditGrantResetCadence getResetCadence() { + return resetCadence; + } + + @JsonProperty("reset_start") + public BillingPlanCreditGrantResetStart getResetStart() { + return resetStart; + } + + @JsonProperty("reset_type") + public Optional getResetType() { + return resetType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBillingPlanCreditGrantRequestBody + && equalTo((CreateBillingPlanCreditGrantRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { + return applyToExisting.equals(other.applyToExisting) + && autoTopupAmount.equals(other.autoTopupAmount) + && autoTopupAmountType.equals(other.autoTopupAmountType) + && autoTopupEnabled.equals(other.autoTopupEnabled) + && autoTopupExpiryType.equals(other.autoTopupExpiryType) + && autoTopupExpiryUnit.equals(other.autoTopupExpiryUnit) + && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) + && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) + && creditAmount == other.creditAmount + && creditId.equals(other.creditId) + && expiryType.equals(other.expiryType) + && expiryUnit.equals(other.expiryUnit) + && expiryUnitCount.equals(other.expiryUnitCount) + && planId.equals(other.planId) + && resetCadence.equals(other.resetCadence) + && resetStart.equals(other.resetStart) + && resetType.equals(other.resetType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.applyToExisting, + this.autoTopupAmount, + this.autoTopupAmountType, + this.autoTopupEnabled, + this.autoTopupExpiryType, + this.autoTopupExpiryUnit, + this.autoTopupExpiryUnitCount, + this.autoTopupThresholdPercent, + this.creditAmount, + this.creditId, + this.expiryType, + this.expiryUnit, + this.expiryUnitCount, + this.planId, + this.resetCadence, + this.resetStart, + this.resetType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreditAmountStage builder() { + return new Builder(); + } + + public interface CreditAmountStage { + CreditIdStage creditAmount(int creditAmount); + + Builder from(CreateBillingPlanCreditGrantRequestBody other); + } + + public interface CreditIdStage { + PlanIdStage creditId(@NotNull String creditId); + } + + public interface PlanIdStage { + ResetCadenceStage planId(@NotNull String planId); + } + + public interface ResetCadenceStage { + ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); + } + + public interface ResetStartStage { + _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); + } + + public interface _FinalStage { + CreateBillingPlanCreditGrantRequestBody build(); + + _FinalStage applyToExisting(Optional applyToExisting); + + _FinalStage applyToExisting(Boolean applyToExisting); + + _FinalStage autoTopupAmount(Optional autoTopupAmount); + + _FinalStage autoTopupAmount(Integer autoTopupAmount); + + _FinalStage autoTopupAmountType(Optional autoTopupAmountType); + + _FinalStage autoTopupAmountType(String autoTopupAmountType); + + _FinalStage autoTopupEnabled(Optional autoTopupEnabled); + + _FinalStage autoTopupEnabled(Boolean autoTopupEnabled); + + _FinalStage autoTopupExpiryType(Optional autoTopupExpiryType); + + _FinalStage autoTopupExpiryType(BillingCreditExpiryType autoTopupExpiryType); + + _FinalStage autoTopupExpiryUnit(Optional autoTopupExpiryUnit); + + _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit); + + _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + + _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount); + + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); + + _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent); + + _FinalStage expiryType(Optional expiryType); + + _FinalStage expiryType(BillingCreditExpiryType expiryType); + + _FinalStage expiryUnit(Optional expiryUnit); + + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Integer expiryUnitCount); + + _FinalStage resetType(Optional resetType); + + _FinalStage resetType(BillingPlanCreditGrantResetType resetType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreditAmountStage, CreditIdStage, PlanIdStage, ResetCadenceStage, ResetStartStage, _FinalStage { + private int creditAmount; + + private String creditId; + + private String planId; + + private BillingPlanCreditGrantResetCadence resetCadence; + + private BillingPlanCreditGrantResetStart resetStart; + + private Optional resetType = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); + + private Optional expiryUnit = Optional.empty(); + + private Optional expiryType = Optional.empty(); + + private Optional autoTopupThresholdPercent = Optional.empty(); + + private Optional autoTopupExpiryUnitCount = Optional.empty(); + + private Optional autoTopupExpiryUnit = Optional.empty(); + + private Optional autoTopupExpiryType = Optional.empty(); + + private Optional autoTopupEnabled = Optional.empty(); + + private Optional autoTopupAmountType = Optional.empty(); + + private Optional autoTopupAmount = Optional.empty(); + + private Optional applyToExisting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBillingPlanCreditGrantRequestBody other) { + applyToExisting(other.getApplyToExisting()); + autoTopupAmount(other.getAutoTopupAmount()); + autoTopupAmountType(other.getAutoTopupAmountType()); + autoTopupEnabled(other.getAutoTopupEnabled()); + autoTopupExpiryType(other.getAutoTopupExpiryType()); + autoTopupExpiryUnit(other.getAutoTopupExpiryUnit()); + autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); + autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); + creditAmount(other.getCreditAmount()); + creditId(other.getCreditId()); + expiryType(other.getExpiryType()); + expiryUnit(other.getExpiryUnit()); + expiryUnitCount(other.getExpiryUnitCount()); + planId(other.getPlanId()); + resetCadence(other.getResetCadence()); + resetStart(other.getResetStart()); + resetType(other.getResetType()); + return this; + } + + @java.lang.Override + @JsonSetter("credit_amount") + public CreditIdStage creditAmount(int creditAmount) { + this.creditAmount = creditAmount; + return this; + } + + @java.lang.Override + @JsonSetter("credit_id") + public PlanIdStage creditId(@NotNull String creditId) { + this.creditId = Objects.requireNonNull(creditId, "creditId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public ResetCadenceStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reset_cadence") + public ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence) { + this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reset_start") + public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart) { + this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage resetType(BillingPlanCreditGrantResetType resetType) { + this.resetType = Optional.ofNullable(resetType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) + public _FinalStage resetType(Optional resetType) { + this.resetType = resetType; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + this.expiryUnitCount = expiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { + this.expiryUnit = Optional.ofNullable(expiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) + public _FinalStage expiryUnit(Optional expiryUnit) { + this.expiryUnit = expiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { + this.expiryType = Optional.ofNullable(expiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) + public _FinalStage expiryType(Optional expiryType) { + this.expiryType = expiryType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent) { + this.autoTopupThresholdPercent = Optional.ofNullable(autoTopupThresholdPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_threshold_percent", nulls = Nulls.SKIP) + public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent) { + this.autoTopupThresholdPercent = autoTopupThresholdPercent; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount) { + this.autoTopupExpiryUnitCount = Optional.ofNullable(autoTopupExpiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount) { + this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit) { + this.autoTopupExpiryUnit = Optional.ofNullable(autoTopupExpiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_unit", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryUnit(Optional autoTopupExpiryUnit) { + this.autoTopupExpiryUnit = autoTopupExpiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryType(BillingCreditExpiryType autoTopupExpiryType) { + this.autoTopupExpiryType = Optional.ofNullable(autoTopupExpiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_type", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryType(Optional autoTopupExpiryType) { + this.autoTopupExpiryType = autoTopupExpiryType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupEnabled(Boolean autoTopupEnabled) { + this.autoTopupEnabled = Optional.ofNullable(autoTopupEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_enabled", nulls = Nulls.SKIP) + public _FinalStage autoTopupEnabled(Optional autoTopupEnabled) { + this.autoTopupEnabled = autoTopupEnabled; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupAmountType(String autoTopupAmountType) { + this.autoTopupAmountType = Optional.ofNullable(autoTopupAmountType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_amount_type", nulls = Nulls.SKIP) + public _FinalStage autoTopupAmountType(Optional autoTopupAmountType) { + this.autoTopupAmountType = autoTopupAmountType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupAmount(Integer autoTopupAmount) { + this.autoTopupAmount = Optional.ofNullable(autoTopupAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_amount", nulls = Nulls.SKIP) + public _FinalStage autoTopupAmount(Optional autoTopupAmount) { + this.autoTopupAmount = autoTopupAmount; + return this; + } + + @java.lang.Override + public _FinalStage applyToExisting(Boolean applyToExisting) { + this.applyToExisting = Optional.ofNullable(applyToExisting); + return this; + } + + @java.lang.Override + @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) + public _FinalStage applyToExisting(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + + @java.lang.Override + public CreateBillingPlanCreditGrantRequestBody build() { + return new CreateBillingPlanCreditGrantRequestBody( + applyToExisting, + autoTopupAmount, + autoTopupAmountType, + autoTopupEnabled, + autoTopupExpiryType, + autoTopupExpiryUnit, + autoTopupExpiryUnitCount, + autoTopupThresholdPercent, + creditAmount, + creditId, + expiryType, + expiryUnit, + expiryUnitCount, + planId, + resetCadence, + resetStart, + resetType, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java index acc495b..5bafe8c 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java @@ -29,6 +29,8 @@ public final class CreateBillingPriceTierRequestBody { private final String priceExternalId; + private final Optional providerType; + private final Optional upTo; private final Map additionalProperties; @@ -38,12 +40,14 @@ private CreateBillingPriceTierRequestBody( Optional perUnitDecimal, Optional perUnitPrice, String priceExternalId, + Optional providerType, Optional upTo, Map additionalProperties) { this.flatAmount = flatAmount; this.perUnitDecimal = perUnitDecimal; this.perUnitPrice = perUnitPrice; this.priceExternalId = priceExternalId; + this.providerType = providerType; this.upTo = upTo; this.additionalProperties = additionalProperties; } @@ -68,6 +72,11 @@ public String getPriceExternalId() { return priceExternalId; } + @JsonProperty("provider_type") + public Optional getProviderType() { + return providerType; + } + @JsonProperty("up_to") public Optional getUpTo() { return upTo; @@ -89,12 +98,19 @@ private boolean equalTo(CreateBillingPriceTierRequestBody other) { && perUnitDecimal.equals(other.perUnitDecimal) && perUnitPrice.equals(other.perUnitPrice) && priceExternalId.equals(other.priceExternalId) + && providerType.equals(other.providerType) && upTo.equals(other.upTo); } @java.lang.Override public int hashCode() { - return Objects.hash(this.flatAmount, this.perUnitDecimal, this.perUnitPrice, this.priceExternalId, this.upTo); + return Objects.hash( + this.flatAmount, + this.perUnitDecimal, + this.perUnitPrice, + this.priceExternalId, + this.providerType, + this.upTo); } @java.lang.Override @@ -127,6 +143,10 @@ public interface _FinalStage { _FinalStage perUnitPrice(Integer perUnitPrice); + _FinalStage providerType(Optional providerType); + + _FinalStage providerType(BillingProviderType providerType); + _FinalStage upTo(Optional upTo); _FinalStage upTo(Integer upTo); @@ -138,6 +158,8 @@ public static final class Builder implements PriceExternalIdStage, _FinalStage { private Optional upTo = Optional.empty(); + private Optional providerType = Optional.empty(); + private Optional perUnitPrice = Optional.empty(); private Optional perUnitDecimal = Optional.empty(); @@ -155,6 +177,7 @@ public Builder from(CreateBillingPriceTierRequestBody other) { perUnitDecimal(other.getPerUnitDecimal()); perUnitPrice(other.getPerUnitPrice()); priceExternalId(other.getPriceExternalId()); + providerType(other.getProviderType()); upTo(other.getUpTo()); return this; } @@ -179,6 +202,19 @@ public _FinalStage upTo(Optional upTo) { 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 perUnitPrice(Integer perUnitPrice) { this.perUnitPrice = Optional.ofNullable(perUnitPrice); @@ -221,7 +257,13 @@ public _FinalStage flatAmount(Optional flatAmount) { @java.lang.Override public CreateBillingPriceTierRequestBody build() { return new CreateBillingPriceTierRequestBody( - flatAmount, perUnitDecimal, perUnitPrice, priceExternalId, upTo, additionalProperties); + flatAmount, + perUnitDecimal, + perUnitPrice, + priceExternalId, + providerType, + upTo, + additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java new file mode 100644 index 0000000..e619ea1 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java @@ -0,0 +1,891 @@ +/** + * 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 = CreateEntitlementInBundleRequestBody.Builder.class) +public final class CreateEntitlementInBundleRequestBody { + private final Optional billingProductId; + + private final Optional billingThreshold; + + private final Optional creditConsumptionRate; + + private final Optional currency; + + 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 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 CreateEntitlementInBundleRequestBody( + Optional billingProductId, + Optional billingThreshold, + Optional creditConsumptionRate, + Optional currency, + String featureId, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional monthlyMeteredPriceId, + Optional> monthlyPriceTiers, + Optional monthlyUnitPrice, + Optional monthlyUnitPriceDecimal, + Optional overageBillingProductId, + 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.billingThreshold = billingThreshold; + this.creditConsumptionRate = creditConsumptionRate; + this.currency = currency; + 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.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_threshold") + public Optional getBillingThreshold() { + return billingThreshold; + } + + @JsonProperty("credit_consumption_rate") + public Optional getCreditConsumptionRate() { + return creditConsumptionRate; + } + + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + + @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("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 CreateEntitlementInBundleRequestBody + && equalTo((CreateEntitlementInBundleRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateEntitlementInBundleRequestBody other) { + return billingProductId.equals(other.billingProductId) + && billingThreshold.equals(other.billingThreshold) + && creditConsumptionRate.equals(other.creditConsumptionRate) + && currency.equals(other.currency) + && 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) + && 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.billingThreshold, + this.creditConsumptionRate, + this.currency, + this.featureId, + this.metricPeriod, + this.metricPeriodMonthReset, + this.monthlyMeteredPriceId, + this.monthlyPriceTiers, + this.monthlyUnitPrice, + this.monthlyUnitPriceDecimal, + this.overageBillingProductId, + 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 FeatureIdStage builder() { + return new Builder(); + } + + public interface FeatureIdStage { + ValueTypeStage featureId(@NotNull String featureId); + + Builder from(CreateEntitlementInBundleRequestBody other); + } + + public interface ValueTypeStage { + _FinalStage valueType(@NotNull EntitlementValueType valueType); + } + + public interface _FinalStage { + CreateEntitlementInBundleRequestBody build(); + + _FinalStage billingProductId(Optional billingProductId); + + _FinalStage billingProductId(String billingProductId); + + _FinalStage billingThreshold(Optional billingThreshold); + + _FinalStage billingThreshold(Integer billingThreshold); + + _FinalStage creditConsumptionRate(Optional creditConsumptionRate); + + _FinalStage creditConsumptionRate(Double creditConsumptionRate); + + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(CreateEntitlementInBundleRequestBodyMetricPeriod metricPeriod); + + _FinalStage metricPeriodMonthReset( + Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset( + CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset metricPeriodMonthReset); + + _FinalStage monthlyMeteredPriceId(Optional monthlyMeteredPriceId); + + _FinalStage monthlyMeteredPriceId(String monthlyMeteredPriceId); + + _FinalStage monthlyPriceTiers(Optional> monthlyPriceTiers); + + _FinalStage monthlyPriceTiers(List monthlyPriceTiers); + + _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); + + _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice); + + _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal); + + _FinalStage monthlyUnitPriceDecimal(String monthlyUnitPriceDecimal); + + _FinalStage overageBillingProductId(Optional overageBillingProductId); + + _FinalStage overageBillingProductId(String overageBillingProductId); + + _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(Integer 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(Integer 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(Integer yearlyUnitPrice); + + _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal); + + _FinalStage yearlyUnitPriceDecimal(String yearlyUnitPriceDecimal); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeatureIdStage, ValueTypeStage, _FinalStage { + private String featureId; + + 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 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 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(CreateEntitlementInBundleRequestBody other) { + billingProductId(other.getBillingProductId()); + billingThreshold(other.getBillingThreshold()); + creditConsumptionRate(other.getCreditConsumptionRate()); + currency(other.getCurrency()); + featureId(other.getFeatureId()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + monthlyMeteredPriceId(other.getMonthlyMeteredPriceId()); + monthlyPriceTiers(other.getMonthlyPriceTiers()); + monthlyUnitPrice(other.getMonthlyUnitPrice()); + monthlyUnitPriceDecimal(other.getMonthlyUnitPriceDecimal()); + overageBillingProductId(other.getOverageBillingProductId()); + 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("feature_id") + public ValueTypeStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId 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(Integer 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(Integer 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(Integer 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 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(Integer 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( + CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset 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(CreateEntitlementInBundleRequestBodyMetricPeriod 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 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(Integer 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 CreateEntitlementInBundleRequestBody build() { + return new CreateEntitlementInBundleRequestBody( + billingProductId, + billingThreshold, + creditConsumptionRate, + currency, + featureId, + metricPeriod, + metricPeriodMonthReset, + monthlyMeteredPriceId, + monthlyPriceTiers, + monthlyUnitPrice, + monthlyUnitPriceDecimal, + overageBillingProductId, + priceBehavior, + priceTiers, + softLimit, + tierMode, + valueBool, + valueCreditId, + valueNumeric, + valueTraitId, + valueType, + yearlyMeteredPriceId, + yearlyPriceTiers, + yearlyUnitPrice, + yearlyUnitPriceDecimal, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.java new file mode 100644 index 0000000..58d7994 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateEntitlementInBundleRequestBodyMetricPeriod { + public static final CreateEntitlementInBundleRequestBodyMetricPeriod CURRENT_DAY = + new CreateEntitlementInBundleRequestBodyMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final CreateEntitlementInBundleRequestBodyMetricPeriod ALL_TIME = + new CreateEntitlementInBundleRequestBodyMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final CreateEntitlementInBundleRequestBodyMetricPeriod CURRENT_WEEK = + new CreateEntitlementInBundleRequestBodyMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final CreateEntitlementInBundleRequestBodyMetricPeriod CURRENT_MONTH = + new CreateEntitlementInBundleRequestBodyMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + CreateEntitlementInBundleRequestBodyMetricPeriod(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 CreateEntitlementInBundleRequestBodyMetricPeriod + && this.string.equals(((CreateEntitlementInBundleRequestBodyMetricPeriod) 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 CreateEntitlementInBundleRequestBodyMetricPeriod 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 CreateEntitlementInBundleRequestBodyMetricPeriod(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/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.java new file mode 100644 index 0000000..ef8fcad --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.java @@ -0,0 +1,87 @@ +/** + * 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 CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset { + public static final CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset FIRST_OF_MONTH = + new CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset(Value.FIRST_OF_MONTH, "first_of_month"); + + public static final CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset BILLING_CYCLE = + new CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset(Value.BILLING_CYCLE, "billing_cycle"); + + private final Value value; + + private final String string; + + CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset(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 CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset + && this.string.equals( + ((CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset) 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 CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_cycle": + return BILLING_CYCLE; + default: + return new CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset(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/types/CreateEntitlementReqCommon.java b/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java index 39dd52a..d805b2f 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java +++ b/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java @@ -37,7 +37,7 @@ public final class CreateEntitlementReqCommon { private final Optional valueTraitId; - private final CreateEntitlementReqCommonValueType valueType; + private final EntitlementValueType valueType; private final Map additionalProperties; @@ -50,7 +50,7 @@ private CreateEntitlementReqCommon( Optional valueCreditId, Optional valueNumeric, Optional valueTraitId, - CreateEntitlementReqCommonValueType valueType, + EntitlementValueType valueType, Map additionalProperties) { this.creditConsumptionRate = creditConsumptionRate; this.featureId = featureId; @@ -105,7 +105,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public CreateEntitlementReqCommonValueType getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -162,7 +162,7 @@ public interface FeatureIdStage { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull CreateEntitlementReqCommonValueType valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { @@ -202,7 +202,7 @@ _FinalStage metricPeriodMonthReset( public static final class Builder implements FeatureIdStage, ValueTypeStage, _FinalStage { private String featureId; - private CreateEntitlementReqCommonValueType valueType; + private EntitlementValueType valueType; private Optional valueTraitId = Optional.empty(); @@ -246,7 +246,7 @@ public ValueTypeStage featureId(@NotNull String featureId) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull CreateEntitlementReqCommonValueType valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/CreateEventRequestBody.java b/src/main/java/com/schematic/api/types/CreateEventRequestBody.java index 513a006..d766c20 100644 --- a/src/main/java/com/schematic/api/types/CreateEventRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateEventRequestBody.java @@ -24,7 +24,7 @@ public final class CreateEventRequestBody { private final Optional body; - private final CreateEventRequestBodyEventType eventType; + private final EventType eventType; private final Optional sentAt; @@ -32,7 +32,7 @@ public final class CreateEventRequestBody { private CreateEventRequestBody( Optional body, - CreateEventRequestBodyEventType eventType, + EventType eventType, Optional sentAt, Map additionalProperties) { this.body = body; @@ -46,11 +46,8 @@ public Optional getBody() { return body; } - /** - * @return Either 'identify' or 'track' - */ @JsonProperty("event_type") - public CreateEventRequestBodyEventType getEventType() { + public EventType getEventType() { return eventType; } @@ -92,10 +89,7 @@ public static EventTypeStage builder() { } public interface EventTypeStage { - /** - *

Either 'identify' or 'track'

- */ - _FinalStage eventType(@NotNull CreateEventRequestBodyEventType eventType); + _FinalStage eventType(@NotNull EventType eventType); Builder from(CreateEventRequestBody other); } @@ -117,7 +111,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements EventTypeStage, _FinalStage { - private CreateEventRequestBodyEventType eventType; + private EventType eventType; private Optional sentAt = Optional.empty(); @@ -136,14 +130,9 @@ public Builder from(CreateEventRequestBody other) { return this; } - /** - *

Either 'identify' or 'track'

- *

Either 'identify' or 'track'

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override @JsonSetter("event_type") - public _FinalStage eventType(@NotNull CreateEventRequestBodyEventType eventType) { + public _FinalStage eventType(@NotNull EventType eventType) { this.eventType = Objects.requireNonNull(eventType, "eventType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java b/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java index eea9a3d..2c3ab1e 100644 --- a/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java @@ -27,6 +27,8 @@ public final class CreateFlagRequestBody { private final Optional featureId; + private final String flagType; + private final String key; private final Optional maintainerId; @@ -39,6 +41,7 @@ private CreateFlagRequestBody( boolean defaultValue, String description, Optional featureId, + String flagType, String key, Optional maintainerId, String name, @@ -46,6 +49,7 @@ private CreateFlagRequestBody( this.defaultValue = defaultValue; this.description = description; this.featureId = featureId; + this.flagType = flagType; this.key = key; this.maintainerId = maintainerId; this.name = name; @@ -69,7 +73,7 @@ public Optional getFeatureId() { @JsonProperty("flag_type") public String getFlagType() { - return "boolean"; + return flagType; } @JsonProperty("key") @@ -102,6 +106,7 @@ private boolean equalTo(CreateFlagRequestBody other) { return defaultValue == other.defaultValue && description.equals(other.description) && featureId.equals(other.featureId) + && flagType.equals(other.flagType) && key.equals(other.key) && maintainerId.equals(other.maintainerId) && name.equals(other.name); @@ -110,7 +115,13 @@ private boolean equalTo(CreateFlagRequestBody other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.defaultValue, this.description, this.featureId, this.key, this.maintainerId, this.name); + this.defaultValue, + this.description, + this.featureId, + this.flagType, + this.key, + this.maintainerId, + this.name); } @java.lang.Override @@ -129,7 +140,11 @@ public interface DefaultValueStage { } public interface DescriptionStage { - KeyStage description(@NotNull String description); + FlagTypeStage description(@NotNull String description); + } + + public interface FlagTypeStage { + KeyStage flagType(@NotNull String flagType); } public interface KeyStage { @@ -153,11 +168,14 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DefaultValueStage, DescriptionStage, KeyStage, NameStage, _FinalStage { + public static final class Builder + implements DefaultValueStage, DescriptionStage, FlagTypeStage, KeyStage, NameStage, _FinalStage { private boolean defaultValue; private String description; + private String flagType; + private String key; private String name; @@ -176,6 +194,7 @@ public Builder from(CreateFlagRequestBody other) { defaultValue(other.getDefaultValue()); description(other.getDescription()); featureId(other.getFeatureId()); + flagType(other.getFlagType()); key(other.getKey()); maintainerId(other.getMaintainerId()); name(other.getName()); @@ -191,11 +210,18 @@ public DescriptionStage defaultValue(boolean defaultValue) { @java.lang.Override @JsonSetter("description") - public KeyStage description(@NotNull String description) { + public FlagTypeStage description(@NotNull String description) { this.description = Objects.requireNonNull(description, "description must not be null"); return this; } + @java.lang.Override + @JsonSetter("flag_type") + public KeyStage flagType(@NotNull String flagType) { + this.flagType = Objects.requireNonNull(flagType, "flagType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("key") public NameStage key(@NotNull String key) { @@ -239,7 +265,7 @@ public _FinalStage featureId(Optional featureId) { @java.lang.Override public CreateFlagRequestBody build() { return new CreateFlagRequestBody( - defaultValue, description, featureId, key, maintainerId, name, additionalProperties); + defaultValue, description, featureId, flagType, key, maintainerId, name, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java index ab770a0..bfaddcb 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBodyConditionType.java @@ -7,9 +7,6 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class CreateOrUpdateConditionRequestBodyConditionType { - public static final CreateOrUpdateConditionRequestBodyConditionType CRM_PRODUCT = - new CreateOrUpdateConditionRequestBodyConditionType(Value.CRM_PRODUCT, "crm_product"); - public static final CreateOrUpdateConditionRequestBodyConditionType METRIC = new CreateOrUpdateConditionRequestBodyConditionType(Value.METRIC, "metric"); @@ -64,8 +61,6 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case CRM_PRODUCT: - return visitor.visitCrmProduct(); case METRIC: return visitor.visitMetric(); case BASE_PLAN: @@ -89,8 +84,6 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static CreateOrUpdateConditionRequestBodyConditionType valueOf(String value) { switch (value) { - case "crm_product": - return CRM_PRODUCT; case "metric": return METRIC; case "base_plan": @@ -123,8 +116,6 @@ public enum Value { BILLING_PRODUCT, - CRM_PRODUCT, - BASE_PLAN, UNKNOWN @@ -143,8 +134,6 @@ public interface Visitor { T visitBillingProduct(); - T visitCrmProduct(); - T visitBasePlan(); T visitUnknown(String unknownType); diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java b/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java index ef9517e..28c4904 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java @@ -27,6 +27,8 @@ public final class CreateOrUpdateFlagRequestBody { private final Optional featureId; + private final String flagType; + private final Optional id; private final String key; @@ -41,6 +43,7 @@ private CreateOrUpdateFlagRequestBody( boolean defaultValue, String description, Optional featureId, + String flagType, Optional id, String key, Optional maintainerId, @@ -49,6 +52,7 @@ private CreateOrUpdateFlagRequestBody( this.defaultValue = defaultValue; this.description = description; this.featureId = featureId; + this.flagType = flagType; this.id = id; this.key = key; this.maintainerId = maintainerId; @@ -73,7 +77,7 @@ public Optional getFeatureId() { @JsonProperty("flag_type") public String getFlagType() { - return "boolean"; + return flagType; } @JsonProperty("id") @@ -111,6 +115,7 @@ private boolean equalTo(CreateOrUpdateFlagRequestBody other) { return defaultValue == other.defaultValue && description.equals(other.description) && featureId.equals(other.featureId) + && flagType.equals(other.flagType) && id.equals(other.id) && key.equals(other.key) && maintainerId.equals(other.maintainerId) @@ -120,7 +125,14 @@ private boolean equalTo(CreateOrUpdateFlagRequestBody other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.defaultValue, this.description, this.featureId, this.id, this.key, this.maintainerId, this.name); + this.defaultValue, + this.description, + this.featureId, + this.flagType, + this.id, + this.key, + this.maintainerId, + this.name); } @java.lang.Override @@ -139,7 +151,11 @@ public interface DefaultValueStage { } public interface DescriptionStage { - KeyStage description(@NotNull String description); + FlagTypeStage description(@NotNull String description); + } + + public interface FlagTypeStage { + KeyStage flagType(@NotNull String flagType); } public interface KeyStage { @@ -167,11 +183,14 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DefaultValueStage, DescriptionStage, KeyStage, NameStage, _FinalStage { + public static final class Builder + implements DefaultValueStage, DescriptionStage, FlagTypeStage, KeyStage, NameStage, _FinalStage { private boolean defaultValue; private String description; + private String flagType; + private String key; private String name; @@ -192,6 +211,7 @@ public Builder from(CreateOrUpdateFlagRequestBody other) { defaultValue(other.getDefaultValue()); description(other.getDescription()); featureId(other.getFeatureId()); + flagType(other.getFlagType()); id(other.getId()); key(other.getKey()); maintainerId(other.getMaintainerId()); @@ -208,11 +228,18 @@ public DescriptionStage defaultValue(boolean defaultValue) { @java.lang.Override @JsonSetter("description") - public KeyStage description(@NotNull String description) { + public FlagTypeStage description(@NotNull String description) { this.description = Objects.requireNonNull(description, "description must not be null"); return this; } + @java.lang.Override + @JsonSetter("flag_type") + public KeyStage flagType(@NotNull String flagType) { + this.flagType = Objects.requireNonNull(flagType, "flagType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("key") public NameStage key(@NotNull String key) { @@ -269,7 +296,7 @@ public _FinalStage featureId(Optional featureId) { @java.lang.Override public CreateOrUpdateFlagRequestBody build() { return new CreateOrUpdateFlagRequestBody( - defaultValue, description, featureId, id, key, maintainerId, name, additionalProperties); + defaultValue, description, featureId, flagType, id, key, maintainerId, name, additionalProperties); } } } diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CreatePlanRequestBody.java b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java similarity index 90% rename from src/main/java/com/schematic/api/resources/plans/requests/CreatePlanRequestBody.java rename to src/main/java/com/schematic/api/types/CreatePlanRequestBody.java index 956a385..487fa6c 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/CreatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.plans.requests; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,7 +12,6 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.plans.types.CreatePlanRequestBodyPlanType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -28,7 +27,7 @@ public final class CreatePlanRequestBody { private final String name; - private final CreatePlanRequestBodyPlanType planType; + private final PlanType planType; private final Map additionalProperties; @@ -36,7 +35,7 @@ private CreatePlanRequestBody( String description, Optional icon, String name, - CreatePlanRequestBodyPlanType planType, + PlanType planType, Map additionalProperties) { this.description = description; this.icon = icon; @@ -61,7 +60,7 @@ public String getName() { } @JsonProperty("plan_type") - public CreatePlanRequestBodyPlanType getPlanType() { + public PlanType getPlanType() { return planType; } @@ -108,7 +107,7 @@ public interface NameStage { } public interface PlanTypeStage { - _FinalStage planType(@NotNull CreatePlanRequestBodyPlanType planType); + _FinalStage planType(@NotNull PlanType planType); } public interface _FinalStage { @@ -125,7 +124,7 @@ public static final class Builder implements DescriptionStage, NameStage, PlanTy private String name; - private CreatePlanRequestBodyPlanType planType; + private PlanType planType; private Optional icon = Optional.empty(); @@ -159,7 +158,7 @@ public PlanTypeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("plan_type") - public _FinalStage planType(@NotNull CreatePlanRequestBodyPlanType planType) { + public _FinalStage planType(@NotNull PlanType planType) { this.planType = Objects.requireNonNull(planType, "planType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java index 4cf2a27..741f7cb 100644 --- a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java +++ b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java @@ -14,6 +14,7 @@ import com.schematic.api.core.ObjectMappers; import java.time.OffsetDateTime; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -38,15 +39,17 @@ public final class CreditCompanyGrantView { private final String creditName; + private final Optional exhaustedAt; + private final Optional expiresAt; - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; - private final String grantReason; + private final BillingCreditGrantReason grantReason; private final String id; @@ -64,17 +67,23 @@ public final class CreditCompanyGrantView { private final double quantityUsed; + private final boolean renewalEnabled; + + private final Optional renewalPeriod; + private final Optional singularName; private final String sourceLabel; + private final Optional> transfers; + private final OffsetDateTime updatedAt; private final Optional validFrom; private final Optional zeroedOutDate; - private final Optional zeroedOutReason; + private final Optional zeroedOutReason; private final Map additionalProperties; @@ -87,11 +96,12 @@ private CreditCompanyGrantView( String creditDescription, Optional creditIcon, String creditName, + Optional exhaustedAt, Optional expiresAt, - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, - String grantReason, + BillingCreditGrantReason grantReason, String id, Optional planId, Optional planName, @@ -100,12 +110,15 @@ private CreditCompanyGrantView( int quantity, double quantityRemaining, double quantityUsed, + boolean renewalEnabled, + Optional renewalPeriod, Optional singularName, String sourceLabel, + Optional> transfers, OffsetDateTime updatedAt, Optional validFrom, Optional zeroedOutDate, - Optional zeroedOutReason, + Optional zeroedOutReason, Map additionalProperties) { this.billingCreditBundleId = billingCreditBundleId; this.billingCreditId = billingCreditId; @@ -115,6 +128,7 @@ private CreditCompanyGrantView( this.creditDescription = creditDescription; this.creditIcon = creditIcon; this.creditName = creditName; + this.exhaustedAt = exhaustedAt; this.expiresAt = expiresAt; this.expiryType = expiryType; this.expiryUnit = expiryUnit; @@ -128,8 +142,11 @@ private CreditCompanyGrantView( this.quantity = quantity; this.quantityRemaining = quantityRemaining; this.quantityUsed = quantityUsed; + this.renewalEnabled = renewalEnabled; + this.renewalPeriod = renewalPeriod; this.singularName = singularName; this.sourceLabel = sourceLabel; + this.transfers = transfers; this.updatedAt = updatedAt; this.validFrom = validFrom; this.zeroedOutDate = zeroedOutDate; @@ -177,18 +194,23 @@ public String getCreditName() { return creditName; } + @JsonProperty("exhausted_at") + public Optional getExhaustedAt() { + return exhaustedAt; + } + @JsonProperty("expires_at") public Optional getExpiresAt() { return expiresAt; } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -198,7 +220,7 @@ public Optional getExpiryUnitCount() { } @JsonProperty("grant_reason") - public String getGrantReason() { + public BillingCreditGrantReason getGrantReason() { return grantReason; } @@ -242,6 +264,16 @@ public double getQuantityUsed() { return quantityUsed; } + @JsonProperty("renewal_enabled") + public boolean getRenewalEnabled() { + return renewalEnabled; + } + + @JsonProperty("renewal_period") + public Optional getRenewalPeriod() { + return renewalPeriod; + } + @JsonProperty("singular_name") public Optional getSingularName() { return singularName; @@ -252,6 +284,11 @@ public String getSourceLabel() { return sourceLabel; } + @JsonProperty("transfers") + public Optional> getTransfers() { + return transfers; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -268,7 +305,7 @@ public Optional getZeroedOutDate() { } @JsonProperty("zeroed_out_reason") - public Optional getZeroedOutReason() { + public Optional getZeroedOutReason() { return zeroedOutReason; } @@ -292,6 +329,7 @@ private boolean equalTo(CreditCompanyGrantView other) { && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) && creditName.equals(other.creditName) + && exhaustedAt.equals(other.exhaustedAt) && expiresAt.equals(other.expiresAt) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) @@ -305,8 +343,11 @@ private boolean equalTo(CreditCompanyGrantView other) { && quantity == other.quantity && quantityRemaining == other.quantityRemaining && quantityUsed == other.quantityUsed + && renewalEnabled == other.renewalEnabled + && renewalPeriod.equals(other.renewalPeriod) && singularName.equals(other.singularName) && sourceLabel.equals(other.sourceLabel) + && transfers.equals(other.transfers) && updatedAt.equals(other.updatedAt) && validFrom.equals(other.validFrom) && zeroedOutDate.equals(other.zeroedOutDate) @@ -324,6 +365,7 @@ public int hashCode() { this.creditDescription, this.creditIcon, this.creditName, + this.exhaustedAt, this.expiresAt, this.expiryType, this.expiryUnit, @@ -337,8 +379,11 @@ public int hashCode() { this.quantity, this.quantityRemaining, this.quantityUsed, + this.renewalEnabled, + this.renewalPeriod, this.singularName, this.sourceLabel, + this.transfers, this.updatedAt, this.validFrom, this.zeroedOutDate, @@ -381,7 +426,7 @@ public interface CreditNameStage { } public interface GrantReasonStage { - IdStage grantReason(@NotNull String grantReason); + IdStage grantReason(@NotNull BillingCreditGrantReason grantReason); } public interface IdStage { @@ -397,7 +442,11 @@ public interface QuantityRemainingStage { } public interface QuantityUsedStage { - SourceLabelStage quantityUsed(double quantityUsed); + RenewalEnabledStage quantityUsed(double quantityUsed); + } + + public interface RenewalEnabledStage { + SourceLabelStage renewalEnabled(boolean renewalEnabled); } public interface SourceLabelStage { @@ -419,17 +468,21 @@ public interface _FinalStage { _FinalStage creditIcon(String creditIcon); + _FinalStage exhaustedAt(Optional exhaustedAt); + + _FinalStage exhaustedAt(OffsetDateTime exhaustedAt); + _FinalStage expiresAt(Optional expiresAt); _FinalStage expiresAt(OffsetDateTime expiresAt); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(String expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(String expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); @@ -451,10 +504,18 @@ public interface _FinalStage { _FinalStage price(BillingProductPriceResponseData price); + _FinalStage renewalPeriod(Optional renewalPeriod); + + _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod); + _FinalStage singularName(Optional singularName); _FinalStage singularName(String singularName); + _FinalStage transfers(Optional> transfers); + + _FinalStage transfers(List transfers); + _FinalStage validFrom(Optional validFrom); _FinalStage validFrom(OffsetDateTime validFrom); @@ -463,9 +524,9 @@ public interface _FinalStage { _FinalStage zeroedOutDate(OffsetDateTime zeroedOutDate); - _FinalStage zeroedOutReason(Optional zeroedOutReason); + _FinalStage zeroedOutReason(Optional zeroedOutReason); - _FinalStage zeroedOutReason(String zeroedOutReason); + _FinalStage zeroedOutReason(BillingCreditGrantZeroedOutReason zeroedOutReason); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -481,6 +542,7 @@ public static final class Builder QuantityStage, QuantityRemainingStage, QuantityUsedStage, + RenewalEnabledStage, SourceLabelStage, UpdatedAtStage, _FinalStage { @@ -496,7 +558,7 @@ public static final class Builder private String creditName; - private String grantReason; + private BillingCreditGrantReason grantReason; private String id; @@ -506,18 +568,24 @@ public static final class Builder private double quantityUsed; + private boolean renewalEnabled; + private String sourceLabel; private OffsetDateTime updatedAt; - private Optional zeroedOutReason = Optional.empty(); + private Optional zeroedOutReason = Optional.empty(); private Optional zeroedOutDate = Optional.empty(); private Optional validFrom = Optional.empty(); + private Optional> transfers = Optional.empty(); + private Optional singularName = Optional.empty(); + private Optional renewalPeriod = Optional.empty(); + private Optional price = Optional.empty(); private Optional pluralName = Optional.empty(); @@ -528,12 +596,14 @@ public static final class Builder private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); private Optional expiresAt = Optional.empty(); + private Optional exhaustedAt = Optional.empty(); + private Optional creditIcon = Optional.empty(); private Optional billingCreditBundleId = Optional.empty(); @@ -553,6 +623,7 @@ public Builder from(CreditCompanyGrantView other) { creditDescription(other.getCreditDescription()); creditIcon(other.getCreditIcon()); creditName(other.getCreditName()); + exhaustedAt(other.getExhaustedAt()); expiresAt(other.getExpiresAt()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); @@ -566,8 +637,11 @@ public Builder from(CreditCompanyGrantView other) { quantity(other.getQuantity()); quantityRemaining(other.getQuantityRemaining()); quantityUsed(other.getQuantityUsed()); + renewalEnabled(other.getRenewalEnabled()); + renewalPeriod(other.getRenewalPeriod()); singularName(other.getSingularName()); sourceLabel(other.getSourceLabel()); + transfers(other.getTransfers()); updatedAt(other.getUpdatedAt()); validFrom(other.getValidFrom()); zeroedOutDate(other.getZeroedOutDate()); @@ -619,7 +693,7 @@ public GrantReasonStage creditName(@NotNull String creditName) { @java.lang.Override @JsonSetter("grant_reason") - public IdStage grantReason(@NotNull String grantReason) { + public IdStage grantReason(@NotNull BillingCreditGrantReason grantReason) { this.grantReason = Objects.requireNonNull(grantReason, "grantReason must not be null"); return this; } @@ -647,11 +721,18 @@ public QuantityUsedStage quantityRemaining(double quantityRemaining) { @java.lang.Override @JsonSetter("quantity_used") - public SourceLabelStage quantityUsed(double quantityUsed) { + public RenewalEnabledStage quantityUsed(double quantityUsed) { this.quantityUsed = quantityUsed; return this; } + @java.lang.Override + @JsonSetter("renewal_enabled") + public SourceLabelStage renewalEnabled(boolean renewalEnabled) { + this.renewalEnabled = renewalEnabled; + return this; + } + @java.lang.Override @JsonSetter("source_label") public UpdatedAtStage sourceLabel(@NotNull String sourceLabel) { @@ -667,14 +748,14 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { } @java.lang.Override - public _FinalStage zeroedOutReason(String zeroedOutReason) { + public _FinalStage zeroedOutReason(BillingCreditGrantZeroedOutReason zeroedOutReason) { this.zeroedOutReason = Optional.ofNullable(zeroedOutReason); return this; } @java.lang.Override @JsonSetter(value = "zeroed_out_reason", nulls = Nulls.SKIP) - public _FinalStage zeroedOutReason(Optional zeroedOutReason) { + public _FinalStage zeroedOutReason(Optional zeroedOutReason) { this.zeroedOutReason = zeroedOutReason; return this; } @@ -705,6 +786,19 @@ public _FinalStage validFrom(Optional validFrom) { return this; } + @java.lang.Override + public _FinalStage transfers(List transfers) { + this.transfers = Optional.ofNullable(transfers); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transfers", nulls = Nulls.SKIP) + public _FinalStage transfers(Optional> transfers) { + this.transfers = transfers; + return this; + } + @java.lang.Override public _FinalStage singularName(String singularName) { this.singularName = Optional.ofNullable(singularName); @@ -718,6 +812,19 @@ public _FinalStage singularName(Optional singularName) { return this; } + @java.lang.Override + public _FinalStage renewalPeriod(BillingPlanCreditGrantResetCadence renewalPeriod) { + this.renewalPeriod = Optional.ofNullable(renewalPeriod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "renewal_period", nulls = Nulls.SKIP) + public _FinalStage renewalPeriod(Optional renewalPeriod) { + this.renewalPeriod = renewalPeriod; + return this; + } + @java.lang.Override public _FinalStage price(BillingProductPriceResponseData price) { this.price = Optional.ofNullable(price); @@ -784,27 +891,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(String expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(String expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } @@ -822,6 +929,19 @@ public _FinalStage expiresAt(Optional expiresAt) { return this; } + @java.lang.Override + public _FinalStage exhaustedAt(OffsetDateTime exhaustedAt) { + this.exhaustedAt = Optional.ofNullable(exhaustedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "exhausted_at", nulls = Nulls.SKIP) + public _FinalStage exhaustedAt(Optional exhaustedAt) { + this.exhaustedAt = exhaustedAt; + return this; + } + @java.lang.Override public _FinalStage creditIcon(String creditIcon) { this.creditIcon = Optional.ofNullable(creditIcon); @@ -859,6 +979,7 @@ public CreditCompanyGrantView build() { creditDescription, creditIcon, creditName, + exhaustedAt, expiresAt, expiryType, expiryUnit, @@ -872,8 +993,11 @@ public CreditCompanyGrantView build() { quantity, quantityRemaining, quantityUsed, + renewalEnabled, + renewalPeriod, singularName, sourceLabel, + transfers, updatedAt, validFrom, zeroedOutDate, diff --git a/src/main/java/com/schematic/api/types/CreditGrantDetail.java b/src/main/java/com/schematic/api/types/CreditGrantDetail.java index e9d2a46..45bd658 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantDetail.java +++ b/src/main/java/com/schematic/api/types/CreditGrantDetail.java @@ -26,7 +26,7 @@ public final class CreditGrantDetail { private final Optional expiresAt; - private final CreditGrantDetailGrantReason grantReason; + private final BillingCreditGrantReason grantReason; private final double quantity; @@ -35,7 +35,7 @@ public final class CreditGrantDetail { private CreditGrantDetail( Optional creditTypeIcon, Optional expiresAt, - CreditGrantDetailGrantReason grantReason, + BillingCreditGrantReason grantReason, double quantity, Map additionalProperties) { this.creditTypeIcon = creditTypeIcon; @@ -56,7 +56,7 @@ public Optional getExpiresAt() { } @JsonProperty("grant_reason") - public CreditGrantDetailGrantReason getGrantReason() { + public BillingCreditGrantReason getGrantReason() { return grantReason; } @@ -98,7 +98,7 @@ public static GrantReasonStage builder() { } public interface GrantReasonStage { - QuantityStage grantReason(@NotNull CreditGrantDetailGrantReason grantReason); + QuantityStage grantReason(@NotNull BillingCreditGrantReason grantReason); Builder from(CreditGrantDetail other); } @@ -121,7 +121,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements GrantReasonStage, QuantityStage, _FinalStage { - private CreditGrantDetailGrantReason grantReason; + private BillingCreditGrantReason grantReason; private double quantity; @@ -145,7 +145,7 @@ public Builder from(CreditGrantDetail other) { @java.lang.Override @JsonSetter("grant_reason") - public QuantityStage grantReason(@NotNull CreditGrantDetailGrantReason grantReason) { + public QuantityStage grantReason(@NotNull BillingCreditGrantReason grantReason) { this.grantReason = Objects.requireNonNull(grantReason, "grantReason must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java index 55dd818..268ee24 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java @@ -21,27 +21,27 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreditGrantExpiryRequestBody.Builder.class) public final class CreditGrantExpiryRequestBody { - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; - private final CreditGrantExpiryRequestBodyResetCadence resetCadence; + private final BillingPlanCreditGrantResetCadence resetCadence; - private final CreditGrantExpiryRequestBodyResetStart resetStart; + private final BillingPlanCreditGrantResetStart resetStart; - private final Optional resetType; + private final Optional resetType; private final Map additionalProperties; private CreditGrantExpiryRequestBody( - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, - CreditGrantExpiryRequestBodyResetCadence resetCadence, - CreditGrantExpiryRequestBodyResetStart resetStart, - Optional resetType, + BillingPlanCreditGrantResetCadence resetCadence, + BillingPlanCreditGrantResetStart resetStart, + Optional resetType, Map additionalProperties) { this.expiryType = expiryType; this.expiryUnit = expiryUnit; @@ -53,12 +53,12 @@ private CreditGrantExpiryRequestBody( } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -68,17 +68,17 @@ public Optional getExpiryUnitCount() { } @JsonProperty("reset_cadence") - public CreditGrantExpiryRequestBodyResetCadence getResetCadence() { + public BillingPlanCreditGrantResetCadence getResetCadence() { return resetCadence; } @JsonProperty("reset_start") - public CreditGrantExpiryRequestBodyResetStart getResetStart() { + public BillingPlanCreditGrantResetStart getResetStart() { return resetStart; } @JsonProperty("reset_type") - public Optional getResetType() { + public Optional getResetType() { return resetType; } @@ -123,48 +123,48 @@ public static ResetCadenceStage builder() { } public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull CreditGrantExpiryRequestBodyResetCadence resetCadence); + ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); Builder from(CreditGrantExpiryRequestBody other); } public interface ResetStartStage { - _FinalStage resetStart(@NotNull CreditGrantExpiryRequestBodyResetStart resetStart); + _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); } public interface _FinalStage { CreditGrantExpiryRequestBody build(); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(CreditGrantExpiryRequestBodyExpiryType expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(CreditGrantExpiryRequestBodyExpiryUnit expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); _FinalStage expiryUnitCount(Integer expiryUnitCount); - _FinalStage resetType(Optional resetType); + _FinalStage resetType(Optional resetType); - _FinalStage resetType(CreditGrantExpiryRequestBodyResetType resetType); + _FinalStage resetType(BillingPlanCreditGrantResetType resetType); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ResetCadenceStage, ResetStartStage, _FinalStage { - private CreditGrantExpiryRequestBodyResetCadence resetCadence; + private BillingPlanCreditGrantResetCadence resetCadence; - private CreditGrantExpiryRequestBodyResetStart resetStart; + private BillingPlanCreditGrantResetStart resetStart; - private Optional resetType = Optional.empty(); + private Optional resetType = Optional.empty(); private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -184,27 +184,27 @@ public Builder from(CreditGrantExpiryRequestBody other) { @java.lang.Override @JsonSetter("reset_cadence") - public ResetStartStage resetCadence(@NotNull CreditGrantExpiryRequestBodyResetCadence resetCadence) { + public ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence) { this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); return this; } @java.lang.Override @JsonSetter("reset_start") - public _FinalStage resetStart(@NotNull CreditGrantExpiryRequestBodyResetStart resetStart) { + public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart) { this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); return this; } @java.lang.Override - public _FinalStage resetType(CreditGrantExpiryRequestBodyResetType resetType) { + public _FinalStage resetType(BillingPlanCreditGrantResetType resetType) { this.resetType = Optional.ofNullable(resetType); return this; } @java.lang.Override @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) - public _FinalStage resetType(Optional resetType) { + public _FinalStage resetType(Optional resetType) { this.resetType = resetType; return this; } @@ -223,27 +223,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(CreditGrantExpiryRequestBodyExpiryUnit expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(CreditGrantExpiryRequestBodyExpiryType expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsRequestOrder.java b/src/main/java/com/schematic/api/types/CreditGrantSortOrder.java similarity index 64% rename from src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsRequestOrder.java rename to src/main/java/com/schematic/api/types/CreditGrantSortOrder.java index a5f9886..2af2ab2 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsRequestOrder.java +++ b/src/main/java/com/schematic/api/types/CreditGrantSortOrder.java @@ -1,29 +1,26 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListCompanyGrantsRequestOrder { - public static final ListCompanyGrantsRequestOrder QUANTITY = - new ListCompanyGrantsRequestOrder(Value.QUANTITY, "quantity"); +public final class CreditGrantSortOrder { + public static final CreditGrantSortOrder QUANTITY = new CreditGrantSortOrder(Value.QUANTITY, "quantity"); - public static final ListCompanyGrantsRequestOrder EXPIRES_AT = - new ListCompanyGrantsRequestOrder(Value.EXPIRES_AT, "expires_at"); + public static final CreditGrantSortOrder EXPIRES_AT = new CreditGrantSortOrder(Value.EXPIRES_AT, "expires_at"); - public static final ListCompanyGrantsRequestOrder CREATED_AT = - new ListCompanyGrantsRequestOrder(Value.CREATED_AT, "created_at"); + public static final CreditGrantSortOrder CREATED_AT = new CreditGrantSortOrder(Value.CREATED_AT, "created_at"); - public static final ListCompanyGrantsRequestOrder QUANTITY_REMAINING = - new ListCompanyGrantsRequestOrder(Value.QUANTITY_REMAINING, "quantity_remaining"); + public static final CreditGrantSortOrder QUANTITY_REMAINING = + new CreditGrantSortOrder(Value.QUANTITY_REMAINING, "quantity_remaining"); private final Value value; private final String string; - ListCompanyGrantsRequestOrder(Value value, String string) { + CreditGrantSortOrder(Value value, String string) { this.value = value; this.string = string; } @@ -41,8 +38,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof ListCompanyGrantsRequestOrder - && this.string.equals(((ListCompanyGrantsRequestOrder) other).string)); + || (other instanceof CreditGrantSortOrder && this.string.equals(((CreditGrantSortOrder) other).string)); } @java.lang.Override @@ -67,7 +63,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCompanyGrantsRequestOrder valueOf(String value) { + public static CreditGrantSortOrder valueOf(String value) { switch (value) { case "quantity": return QUANTITY; @@ -78,7 +74,7 @@ public static ListCompanyGrantsRequestOrder valueOf(String value) { case "quantity_remaining": return QUANTITY_REMAINING; default: - return new ListCompanyGrantsRequestOrder(Value.UNKNOWN, value); + return new CreditGrantSortOrder(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java b/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java index 30a7d3a..f591fb2 100644 --- a/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java @@ -22,6 +22,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreditLedgerEnrichedEntryResponseData.Builder.class) public final class CreditLedgerEnrichedEntryResponseData { + private final int billingCreditAutoTopupGrantCount; + private final String billingCreditId; private final Optional company; @@ -67,6 +69,7 @@ public final class CreditLedgerEnrichedEntryResponseData { private final Map additionalProperties; private CreditLedgerEnrichedEntryResponseData( + int billingCreditAutoTopupGrantCount, String billingCreditId, Optional company, String companyId, @@ -89,6 +92,7 @@ private CreditLedgerEnrichedEntryResponseData( int usageCount, int zeroedOutCount, Map additionalProperties) { + this.billingCreditAutoTopupGrantCount = billingCreditAutoTopupGrantCount; this.billingCreditId = billingCreditId; this.company = company; this.companyId = companyId; @@ -113,6 +117,11 @@ private CreditLedgerEnrichedEntryResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("billing_credit_auto_topup_grant_count") + public int getBillingCreditAutoTopupGrantCount() { + return billingCreditAutoTopupGrantCount; + } + @JsonProperty("billing_credit_id") public String getBillingCreditId() { return billingCreditId; @@ -231,7 +240,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(CreditLedgerEnrichedEntryResponseData other) { - return billingCreditId.equals(other.billingCreditId) + return billingCreditAutoTopupGrantCount == other.billingCreditAutoTopupGrantCount + && billingCreditId.equals(other.billingCreditId) && company.equals(other.company) && companyId.equals(other.companyId) && credit.equals(other.credit) @@ -257,6 +267,7 @@ private boolean equalTo(CreditLedgerEnrichedEntryResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.billingCreditAutoTopupGrantCount, this.billingCreditId, this.company, this.companyId, @@ -285,16 +296,20 @@ public String toString() { return ObjectMappers.stringify(this); } - public static BillingCreditIdStage builder() { + public static BillingCreditAutoTopupGrantCountStage builder() { return new Builder(); } - public interface BillingCreditIdStage { - CompanyIdStage billingCreditId(@NotNull String billingCreditId); + public interface BillingCreditAutoTopupGrantCountStage { + BillingCreditIdStage billingCreditAutoTopupGrantCount(int billingCreditAutoTopupGrantCount); Builder from(CreditLedgerEnrichedEntryResponseData other); } + public interface BillingCreditIdStage { + CompanyIdStage billingCreditId(@NotNull String billingCreditId); + } + public interface CompanyIdStage { ExpiredGrantCountStage companyId(@NotNull String companyId); } @@ -381,7 +396,8 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements BillingCreditIdStage, + implements BillingCreditAutoTopupGrantCountStage, + BillingCreditIdStage, CompanyIdStage, ExpiredGrantCountStage, FirstTransactionAtStage, @@ -399,6 +415,8 @@ public static final class Builder UsageCountStage, ZeroedOutCountStage, _FinalStage { + private int billingCreditAutoTopupGrantCount; + private String billingCreditId; private String companyId; @@ -448,6 +466,7 @@ private Builder() {} @java.lang.Override public Builder from(CreditLedgerEnrichedEntryResponseData other) { + billingCreditAutoTopupGrantCount(other.getBillingCreditAutoTopupGrantCount()); billingCreditId(other.getBillingCreditId()); company(other.getCompany()); companyId(other.getCompanyId()); @@ -472,6 +491,13 @@ public Builder from(CreditLedgerEnrichedEntryResponseData other) { return this; } + @java.lang.Override + @JsonSetter("billing_credit_auto_topup_grant_count") + public BillingCreditIdStage billingCreditAutoTopupGrantCount(int billingCreditAutoTopupGrantCount) { + this.billingCreditAutoTopupGrantCount = billingCreditAutoTopupGrantCount; + return this; + } + @java.lang.Override @JsonSetter("billing_credit_id") public CompanyIdStage billingCreditId(@NotNull String billingCreditId) { @@ -646,6 +672,7 @@ public _FinalStage company(Optional company) { @java.lang.Override public CreditLedgerEnrichedEntryResponseData build() { return new CreditLedgerEnrichedEntryResponseData( + billingCreditAutoTopupGrantCount, billingCreditId, company, companyId, diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerRequestPeriod.java b/src/main/java/com/schematic/api/types/CreditLedgerPeriod.java similarity index 64% rename from src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerRequestPeriod.java rename to src/main/java/com/schematic/api/types/CreditLedgerPeriod.java index eec7a49..5c7eaa3 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerRequestPeriod.java +++ b/src/main/java/com/schematic/api/types/CreditLedgerPeriod.java @@ -1,27 +1,25 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CountCreditLedgerRequestPeriod { - public static final CountCreditLedgerRequestPeriod RAW = new CountCreditLedgerRequestPeriod(Value.RAW, "raw"); +public final class CreditLedgerPeriod { + public static final CreditLedgerPeriod RAW = new CreditLedgerPeriod(Value.RAW, "raw"); - public static final CountCreditLedgerRequestPeriod MONTHLY = - new CountCreditLedgerRequestPeriod(Value.MONTHLY, "monthly"); + public static final CreditLedgerPeriod MONTHLY = new CreditLedgerPeriod(Value.MONTHLY, "monthly"); - public static final CountCreditLedgerRequestPeriod DAILY = new CountCreditLedgerRequestPeriod(Value.DAILY, "daily"); + public static final CreditLedgerPeriod DAILY = new CreditLedgerPeriod(Value.DAILY, "daily"); - public static final CountCreditLedgerRequestPeriod WEEKLY = - new CountCreditLedgerRequestPeriod(Value.WEEKLY, "weekly"); + public static final CreditLedgerPeriod WEEKLY = new CreditLedgerPeriod(Value.WEEKLY, "weekly"); private final Value value; private final String string; - CountCreditLedgerRequestPeriod(Value value, String string) { + CreditLedgerPeriod(Value value, String string) { this.value = value; this.string = string; } @@ -39,8 +37,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CountCreditLedgerRequestPeriod - && this.string.equals(((CountCreditLedgerRequestPeriod) other).string)); + || (other instanceof CreditLedgerPeriod && this.string.equals(((CreditLedgerPeriod) other).string)); } @java.lang.Override @@ -65,7 +62,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CountCreditLedgerRequestPeriod valueOf(String value) { + public static CreditLedgerPeriod valueOf(String value) { switch (value) { case "raw": return RAW; @@ -76,31 +73,31 @@ public static CountCreditLedgerRequestPeriod valueOf(String value) { case "weekly": return WEEKLY; default: - return new CountCreditLedgerRequestPeriod(Value.UNKNOWN, value); + return new CreditLedgerPeriod(Value.UNKNOWN, value); } } public enum Value { DAILY, - WEEKLY, - MONTHLY, RAW, + WEEKLY, + UNKNOWN } public interface Visitor { T visitDaily(); - T visitWeekly(); - T visitMonthly(); T visitRaw(); + T visitWeekly(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/CreditTransferResponseData.java b/src/main/java/com/schematic/api/types/CreditTransferResponseData.java new file mode 100644 index 0000000..f443066 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditTransferResponseData.java @@ -0,0 +1,233 @@ +/** + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditTransferResponseData.Builder.class) +public final class CreditTransferResponseData { + private final double amount; + + private final OffsetDateTime createdAt; + + private final String direction; + + private final String id; + + private final String reason; + + private final String relatedGrantId; + + private final Map additionalProperties; + + private CreditTransferResponseData( + double amount, + OffsetDateTime createdAt, + String direction, + String id, + String reason, + String relatedGrantId, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.direction = direction; + this.id = id; + this.reason = reason; + this.relatedGrantId = relatedGrantId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("direction") + public String getDirection() { + return direction; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("reason") + public String getReason() { + return reason; + } + + @JsonProperty("related_grant_id") + public String getRelatedGrantId() { + return relatedGrantId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditTransferResponseData && equalTo((CreditTransferResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditTransferResponseData other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && direction.equals(other.direction) + && id.equals(other.id) + && reason.equals(other.reason) + && relatedGrantId.equals(other.relatedGrantId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.createdAt, this.direction, this.id, this.reason, this.relatedGrantId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + CreatedAtStage amount(double amount); + + Builder from(CreditTransferResponseData other); + } + + public interface CreatedAtStage { + DirectionStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface DirectionStage { + IdStage direction(@NotNull String direction); + } + + public interface IdStage { + ReasonStage id(@NotNull String id); + } + + public interface ReasonStage { + RelatedGrantIdStage reason(@NotNull String reason); + } + + public interface RelatedGrantIdStage { + _FinalStage relatedGrantId(@NotNull String relatedGrantId); + } + + public interface _FinalStage { + CreditTransferResponseData build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + DirectionStage, + IdStage, + ReasonStage, + RelatedGrantIdStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String direction; + + private String id; + + private String reason; + + private String relatedGrantId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditTransferResponseData other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + direction(other.getDirection()); + id(other.getId()); + reason(other.getReason()); + relatedGrantId(other.getRelatedGrantId()); + return this; + } + + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DirectionStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("direction") + public IdStage direction(@NotNull String direction) { + this.direction = Objects.requireNonNull(direction, "direction must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ReasonStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reason") + public RelatedGrantIdStage reason(@NotNull String reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("related_grant_id") + public _FinalStage relatedGrantId(@NotNull String relatedGrantId) { + this.relatedGrantId = Objects.requireNonNull(relatedGrantId, "relatedGrantId must not be null"); + return this; + } + + @java.lang.Override + public CreditTransferResponseData build() { + return new CreditTransferResponseData( + amount, createdAt, direction, id, reason, relatedGrantId, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditTransferView.java b/src/main/java/com/schematic/api/types/CreditTransferView.java new file mode 100644 index 0000000..555932e --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditTransferView.java @@ -0,0 +1,233 @@ +/** + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditTransferView.Builder.class) +public final class CreditTransferView { + private final double amount; + + private final OffsetDateTime createdAt; + + private final String direction; + + private final String id; + + private final String reason; + + private final String relatedGrantId; + + private final Map additionalProperties; + + private CreditTransferView( + double amount, + OffsetDateTime createdAt, + String direction, + String id, + String reason, + String relatedGrantId, + Map additionalProperties) { + this.amount = amount; + this.createdAt = createdAt; + this.direction = direction; + this.id = id; + this.reason = reason; + this.relatedGrantId = relatedGrantId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("direction") + public String getDirection() { + return direction; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("reason") + public String getReason() { + return reason; + } + + @JsonProperty("related_grant_id") + public String getRelatedGrantId() { + return relatedGrantId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditTransferView && equalTo((CreditTransferView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditTransferView other) { + return amount == other.amount + && createdAt.equals(other.createdAt) + && direction.equals(other.direction) + && id.equals(other.id) + && reason.equals(other.reason) + && relatedGrantId.equals(other.relatedGrantId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.amount, this.createdAt, this.direction, this.id, this.reason, this.relatedGrantId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + CreatedAtStage amount(double amount); + + Builder from(CreditTransferView other); + } + + public interface CreatedAtStage { + DirectionStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface DirectionStage { + IdStage direction(@NotNull String direction); + } + + public interface IdStage { + ReasonStage id(@NotNull String id); + } + + public interface ReasonStage { + RelatedGrantIdStage reason(@NotNull String reason); + } + + public interface RelatedGrantIdStage { + _FinalStage relatedGrantId(@NotNull String relatedGrantId); + } + + public interface _FinalStage { + CreditTransferView build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + CreatedAtStage, + DirectionStage, + IdStage, + ReasonStage, + RelatedGrantIdStage, + _FinalStage { + private double amount; + + private OffsetDateTime createdAt; + + private String direction; + + private String id; + + private String reason; + + private String relatedGrantId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditTransferView other) { + amount(other.getAmount()); + createdAt(other.getCreatedAt()); + direction(other.getDirection()); + id(other.getId()); + reason(other.getReason()); + relatedGrantId(other.getRelatedGrantId()); + return this; + } + + @java.lang.Override + @JsonSetter("amount") + public CreatedAtStage amount(double amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DirectionStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("direction") + public IdStage direction(@NotNull String direction) { + this.direction = Objects.requireNonNull(direction, "direction must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public ReasonStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reason") + public RelatedGrantIdStage reason(@NotNull String reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("related_grant_id") + public _FinalStage relatedGrantId(@NotNull String relatedGrantId) { + this.relatedGrantId = Objects.requireNonNull(relatedGrantId, "relatedGrantId must not be null"); + return this; + } + + @java.lang.Override + public CreditTransferView build() { + return new CreditTransferView( + amount, createdAt, direction, id, reason, relatedGrantId, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditUsage.java b/src/main/java/com/schematic/api/types/CreditUsage.java index 15fa81e..9e41dd4 100644 --- a/src/main/java/com/schematic/api/types/CreditUsage.java +++ b/src/main/java/com/schematic/api/types/CreditUsage.java @@ -37,6 +37,8 @@ public final class CreditUsage { private final Optional creditUsed; + private final Optional usageAggregation; + private final Map additionalProperties; private CreditUsage( @@ -48,6 +50,7 @@ private CreditUsage( Optional creditTypeIcon, Optional creditTypeName, Optional creditUsed, + Optional usageAggregation, Map additionalProperties) { this.creditConsumptionRate = creditConsumptionRate; this.creditGrantCounts = creditGrantCounts; @@ -57,6 +60,7 @@ private CreditUsage( this.creditTypeIcon = creditTypeIcon; this.creditTypeName = creditTypeName; this.creditUsed = creditUsed; + this.usageAggregation = usageAggregation; this.additionalProperties = additionalProperties; } @@ -100,6 +104,11 @@ public Optional getCreditUsed() { return creditUsed; } + @JsonProperty("usage_aggregation") + public Optional getUsageAggregation() { + return usageAggregation; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -119,7 +128,8 @@ private boolean equalTo(CreditUsage other) { && creditTotal.equals(other.creditTotal) && creditTypeIcon.equals(other.creditTypeIcon) && creditTypeName.equals(other.creditTypeName) - && creditUsed.equals(other.creditUsed); + && creditUsed.equals(other.creditUsed) + && usageAggregation.equals(other.usageAggregation); } @java.lang.Override @@ -132,7 +142,8 @@ public int hashCode() { this.creditTotal, this.creditTypeIcon, this.creditTypeName, - this.creditUsed); + this.creditUsed, + this.usageAggregation); } @java.lang.Override @@ -162,6 +173,8 @@ public static final class Builder { private Optional creditUsed = Optional.empty(); + private Optional usageAggregation = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -176,6 +189,7 @@ public Builder from(CreditUsage other) { creditTypeIcon(other.getCreditTypeIcon()); creditTypeName(other.getCreditTypeName()); creditUsed(other.getCreditUsed()); + usageAggregation(other.getUsageAggregation()); return this; } @@ -267,6 +281,17 @@ public Builder creditUsed(Double creditUsed) { return this; } + @JsonSetter(value = "usage_aggregation", nulls = Nulls.SKIP) + public Builder usageAggregation(Optional usageAggregation) { + this.usageAggregation = usageAggregation; + return this; + } + + public Builder usageAggregation(CreditUsageAggregation usageAggregation) { + this.usageAggregation = Optional.ofNullable(usageAggregation); + return this; + } + public CreditUsage build() { return new CreditUsage( creditConsumptionRate, @@ -277,6 +302,7 @@ public CreditUsage build() { creditTypeIcon, creditTypeName, creditUsed, + usageAggregation, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/types/CreditUsageAggregation.java b/src/main/java/com/schematic/api/types/CreditUsageAggregation.java new file mode 100644 index 0000000..0c75da7 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditUsageAggregation.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditUsageAggregation.Builder.class) +public final class CreditUsageAggregation { + private final Optional usageThisBillingPeriod; + + private final Optional usageThisCalendarMonth; + + private final Optional usageThisWeek; + + private final Optional usageToday; + + private final Map additionalProperties; + + private CreditUsageAggregation( + Optional usageThisBillingPeriod, + Optional usageThisCalendarMonth, + Optional usageThisWeek, + Optional usageToday, + Map additionalProperties) { + this.usageThisBillingPeriod = usageThisBillingPeriod; + this.usageThisCalendarMonth = usageThisCalendarMonth; + this.usageThisWeek = usageThisWeek; + this.usageToday = usageToday; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credit usage within the current billing period + */ + @JsonProperty("usage_this_billing_period") + public Optional getUsageThisBillingPeriod() { + return usageThisBillingPeriod; + } + + /** + * @return Credit usage within the current calendar month + */ + @JsonProperty("usage_this_calendar_month") + public Optional getUsageThisCalendarMonth() { + return usageThisCalendarMonth; + } + + /** + * @return Credit usage within the current calendar week (Monday to Sunday) + */ + @JsonProperty("usage_this_week") + public Optional getUsageThisWeek() { + return usageThisWeek; + } + + /** + * @return Credit usage for the current day + */ + @JsonProperty("usage_today") + public Optional getUsageToday() { + return usageToday; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditUsageAggregation && equalTo((CreditUsageAggregation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditUsageAggregation other) { + return usageThisBillingPeriod.equals(other.usageThisBillingPeriod) + && usageThisCalendarMonth.equals(other.usageThisCalendarMonth) + && usageThisWeek.equals(other.usageThisWeek) + && usageToday.equals(other.usageToday); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.usageThisBillingPeriod, this.usageThisCalendarMonth, this.usageThisWeek, this.usageToday); + } + + @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 usageThisBillingPeriod = Optional.empty(); + + private Optional usageThisCalendarMonth = Optional.empty(); + + private Optional usageThisWeek = Optional.empty(); + + private Optional usageToday = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreditUsageAggregation other) { + usageThisBillingPeriod(other.getUsageThisBillingPeriod()); + usageThisCalendarMonth(other.getUsageThisCalendarMonth()); + usageThisWeek(other.getUsageThisWeek()); + usageToday(other.getUsageToday()); + return this; + } + + /** + *

Credit usage within the current billing period

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

Credit usage within the current calendar month

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

Credit usage within the current calendar week (Monday to Sunday)

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

Credit usage for the current day

+ */ + @JsonSetter(value = "usage_today", nulls = Nulls.SKIP) + public Builder usageToday(Optional usageToday) { + this.usageToday = usageToday; + return this; + } + + public Builder usageToday(Double usageToday) { + this.usageToday = Optional.ofNullable(usageToday); + return this; + } + + public CreditUsageAggregation build() { + return new CreditUsageAggregation( + usageThisBillingPeriod, usageThisCalendarMonth, usageThisWeek, usageToday, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditUsageResponseData.java b/src/main/java/com/schematic/api/types/CreditUsageResponseData.java index 1e9bbd5..3bf4a27 100644 --- a/src/main/java/com/schematic/api/types/CreditUsageResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditUsageResponseData.java @@ -81,6 +81,9 @@ public Optional getCreditRemaining() { return creditRemaining; } + /** + * @return Deprecated: Use credit_remaining instead. + */ @JsonProperty("credit_total") public Optional getCreditTotal() { return creditTotal; @@ -234,6 +237,9 @@ public Builder creditRemaining(Double creditRemaining) { return this; } + /** + *

Deprecated: Use credit_remaining instead.

+ */ @JsonSetter(value = "credit_total", nulls = Nulls.SKIP) public Builder creditTotal(Optional creditTotal) { this.creditTotal = creditTotal; diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java new file mode 100644 index 0000000..6f50961 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java @@ -0,0 +1,124 @@ +/** + * 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 = CreditsAutoTopupCompanySummary.Builder.class) +public final class CreditsAutoTopupCompanySummary { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private CreditsAutoTopupCompanySummary(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsAutoTopupCompanySummary && equalTo((CreditsAutoTopupCompanySummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsAutoTopupCompanySummary other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreditsAutoTopupCompanySummary other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreditsAutoTopupCompanySummary build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsAutoTopupCompanySummary other) { + id(other.getId()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public CreditsAutoTopupCompanySummary build() { + return new CreditsAutoTopupCompanySummary(id, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java new file mode 100644 index 0000000..e33893f --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java @@ -0,0 +1,124 @@ +/** + * 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 = CreditsAutoTopupCreditSummary.Builder.class) +public final class CreditsAutoTopupCreditSummary { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private CreditsAutoTopupCreditSummary(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsAutoTopupCreditSummary && equalTo((CreditsAutoTopupCreditSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsAutoTopupCreditSummary other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(@NotNull String id); + + Builder from(CreditsAutoTopupCreditSummary other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + CreditsAutoTopupCreditSummary build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsAutoTopupCreditSummary other) { + id(other.getId()); + name(other.getName()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public CreditsAutoTopupCreditSummary build() { + return new CreditsAutoTopupCreditSummary(id, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.java new file mode 100644 index 0000000..b9778df --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.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.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 = CreditsAutoTopupHardFailure.Builder.class) +public final class CreditsAutoTopupHardFailure { + private final Optional company; + + private final Optional credit; + + private final Optional errorMessage; + + private final Optional stripeErrorCode; + + private final Map additionalProperties; + + private CreditsAutoTopupHardFailure( + Optional company, + Optional credit, + Optional errorMessage, + Optional stripeErrorCode, + Map additionalProperties) { + this.company = company; + this.credit = credit; + this.errorMessage = errorMessage; + this.stripeErrorCode = stripeErrorCode; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + + @JsonProperty("error_message") + public Optional getErrorMessage() { + return errorMessage; + } + + @JsonProperty("stripe_error_code") + public Optional getStripeErrorCode() { + return stripeErrorCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsAutoTopupHardFailure && equalTo((CreditsAutoTopupHardFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsAutoTopupHardFailure other) { + return company.equals(other.company) + && credit.equals(other.credit) + && errorMessage.equals(other.errorMessage) + && stripeErrorCode.equals(other.stripeErrorCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.company, this.credit, this.errorMessage, this.stripeErrorCode); + } + + @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 company = Optional.empty(); + + private Optional credit = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional stripeErrorCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreditsAutoTopupHardFailure other) { + company(other.getCompany()); + credit(other.getCredit()); + errorMessage(other.getErrorMessage()); + stripeErrorCode(other.getStripeErrorCode()); + return this; + } + + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public Builder company(Optional company) { + this.company = company; + return this; + } + + public Builder company(CreditsAutoTopupCompanySummary company) { + this.company = Optional.ofNullable(company); + return this; + } + + @JsonSetter(value = "credit", nulls = Nulls.SKIP) + public Builder credit(Optional credit) { + this.credit = credit; + return this; + } + + public Builder credit(CreditsAutoTopupCreditSummary credit) { + this.credit = Optional.ofNullable(credit); + return this; + } + + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public Builder errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + public Builder errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + @JsonSetter(value = "stripe_error_code", nulls = Nulls.SKIP) + public Builder stripeErrorCode(Optional stripeErrorCode) { + this.stripeErrorCode = stripeErrorCode; + return this; + } + + public Builder stripeErrorCode(String stripeErrorCode) { + this.stripeErrorCode = Optional.ofNullable(stripeErrorCode); + return this; + } + + public CreditsAutoTopupHardFailure build() { + return new CreditsAutoTopupHardFailure( + company, credit, errorMessage, stripeErrorCode, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java new file mode 100644 index 0000000..d37b85d --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreditsAutoTopupRetryFailure.Builder.class) +public final class CreditsAutoTopupRetryFailure { + private final Optional company; + + private final int consecutiveFailures; + + private final Optional credit; + + private final Optional lastErrorMessage; + + private final Optional stripeErrorCode; + + private final Map additionalProperties; + + private CreditsAutoTopupRetryFailure( + Optional company, + int consecutiveFailures, + Optional credit, + Optional lastErrorMessage, + Optional stripeErrorCode, + Map additionalProperties) { + this.company = company; + this.consecutiveFailures = consecutiveFailures; + this.credit = credit; + this.lastErrorMessage = lastErrorMessage; + this.stripeErrorCode = stripeErrorCode; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("consecutive_failures") + public int getConsecutiveFailures() { + return consecutiveFailures; + } + + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + + @JsonProperty("last_error_message") + public Optional getLastErrorMessage() { + return lastErrorMessage; + } + + @JsonProperty("stripe_error_code") + public Optional getStripeErrorCode() { + return stripeErrorCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditsAutoTopupRetryFailure && equalTo((CreditsAutoTopupRetryFailure) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditsAutoTopupRetryFailure other) { + return company.equals(other.company) + && consecutiveFailures == other.consecutiveFailures + && credit.equals(other.credit) + && lastErrorMessage.equals(other.lastErrorMessage) + && stripeErrorCode.equals(other.stripeErrorCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.company, this.consecutiveFailures, this.credit, this.lastErrorMessage, this.stripeErrorCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConsecutiveFailuresStage builder() { + return new Builder(); + } + + public interface ConsecutiveFailuresStage { + _FinalStage consecutiveFailures(int consecutiveFailures); + + Builder from(CreditsAutoTopupRetryFailure other); + } + + public interface _FinalStage { + CreditsAutoTopupRetryFailure build(); + + _FinalStage company(Optional company); + + _FinalStage company(CreditsAutoTopupCompanySummary company); + + _FinalStage credit(Optional credit); + + _FinalStage credit(CreditsAutoTopupCreditSummary credit); + + _FinalStage lastErrorMessage(Optional lastErrorMessage); + + _FinalStage lastErrorMessage(String lastErrorMessage); + + _FinalStage stripeErrorCode(Optional stripeErrorCode); + + _FinalStage stripeErrorCode(String stripeErrorCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConsecutiveFailuresStage, _FinalStage { + private int consecutiveFailures; + + private Optional stripeErrorCode = Optional.empty(); + + private Optional lastErrorMessage = Optional.empty(); + + private Optional credit = Optional.empty(); + + private Optional company = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditsAutoTopupRetryFailure other) { + company(other.getCompany()); + consecutiveFailures(other.getConsecutiveFailures()); + credit(other.getCredit()); + lastErrorMessage(other.getLastErrorMessage()); + stripeErrorCode(other.getStripeErrorCode()); + return this; + } + + @java.lang.Override + @JsonSetter("consecutive_failures") + public _FinalStage consecutiveFailures(int consecutiveFailures) { + this.consecutiveFailures = consecutiveFailures; + return this; + } + + @java.lang.Override + public _FinalStage stripeErrorCode(String stripeErrorCode) { + this.stripeErrorCode = Optional.ofNullable(stripeErrorCode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripe_error_code", nulls = Nulls.SKIP) + public _FinalStage stripeErrorCode(Optional stripeErrorCode) { + this.stripeErrorCode = stripeErrorCode; + return this; + } + + @java.lang.Override + public _FinalStage lastErrorMessage(String lastErrorMessage) { + this.lastErrorMessage = Optional.ofNullable(lastErrorMessage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_error_message", nulls = Nulls.SKIP) + public _FinalStage lastErrorMessage(Optional lastErrorMessage) { + this.lastErrorMessage = lastErrorMessage; + return this; + } + + @java.lang.Override + public _FinalStage credit(CreditsAutoTopupCreditSummary credit) { + this.credit = Optional.ofNullable(credit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit", nulls = Nulls.SKIP) + public _FinalStage credit(Optional credit) { + this.credit = credit; + return this; + } + + @java.lang.Override + public _FinalStage company(CreditsAutoTopupCompanySummary company) { + this.company = Optional.ofNullable(company); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + @java.lang.Override + public CreditsAutoTopupRetryFailure build() { + return new CreditsAutoTopupRetryFailure( + company, consecutiveFailures, credit, lastErrorMessage, stripeErrorCode, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/CrmDealLineItem.java b/src/main/java/com/schematic/api/types/CrmDealLineItem.java deleted file mode 100644 index eb9e9ad..0000000 --- a/src/main/java/com/schematic/api/types/CrmDealLineItem.java +++ /dev/null @@ -1,425 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.JsonNode; -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 = CrmDealLineItem.Builder.class) -public final class CrmDealLineItem { - private final String billingFrequency; - - private final OffsetDateTime createdAt; - - private final String currency; - - private final String description; - - private final Optional> discountPercentage; - - private final String id; - - private final String name; - - private final double price; - - private final int quantity; - - private final Optional termMonth; - - private final Optional> totalDiscount; - - private final OffsetDateTime updatedAt; - - private final Map additionalProperties; - - private CrmDealLineItem( - String billingFrequency, - OffsetDateTime createdAt, - String currency, - String description, - Optional> discountPercentage, - String id, - String name, - double price, - int quantity, - Optional termMonth, - Optional> totalDiscount, - OffsetDateTime updatedAt, - Map additionalProperties) { - this.billingFrequency = billingFrequency; - this.createdAt = createdAt; - this.currency = currency; - this.description = description; - this.discountPercentage = discountPercentage; - this.id = id; - this.name = name; - this.price = price; - this.quantity = quantity; - this.termMonth = termMonth; - this.totalDiscount = totalDiscount; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("billing_frequency") - public String getBillingFrequency() { - return billingFrequency; - } - - @JsonProperty("created_at") - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("currency") - public String getCurrency() { - return currency; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("discount_percentage") - public Optional> getDiscountPercentage() { - return discountPercentage; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("price") - public double getPrice() { - return price; - } - - @JsonProperty("quantity") - public int getQuantity() { - return quantity; - } - - @JsonProperty("term_month") - public Optional getTermMonth() { - return termMonth; - } - - @JsonProperty("total_discount") - public Optional> getTotalDiscount() { - return totalDiscount; - } - - @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CrmDealLineItem && equalTo((CrmDealLineItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CrmDealLineItem other) { - return billingFrequency.equals(other.billingFrequency) - && createdAt.equals(other.createdAt) - && currency.equals(other.currency) - && description.equals(other.description) - && discountPercentage.equals(other.discountPercentage) - && id.equals(other.id) - && name.equals(other.name) - && price == other.price - && quantity == other.quantity - && termMonth.equals(other.termMonth) - && totalDiscount.equals(other.totalDiscount) - && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.billingFrequency, - this.createdAt, - this.currency, - this.description, - this.discountPercentage, - this.id, - this.name, - this.price, - this.quantity, - this.termMonth, - this.totalDiscount, - this.updatedAt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BillingFrequencyStage builder() { - return new Builder(); - } - - public interface BillingFrequencyStage { - CreatedAtStage billingFrequency(@NotNull String billingFrequency); - - Builder from(CrmDealLineItem other); - } - - public interface CreatedAtStage { - CurrencyStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface CurrencyStage { - DescriptionStage currency(@NotNull String currency); - } - - public interface DescriptionStage { - IdStage description(@NotNull String description); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - PriceStage name(@NotNull String name); - } - - public interface PriceStage { - QuantityStage price(double price); - } - - public interface QuantityStage { - UpdatedAtStage quantity(int quantity); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - CrmDealLineItem build(); - - _FinalStage discountPercentage(Optional> discountPercentage); - - _FinalStage discountPercentage(Map discountPercentage); - - _FinalStage termMonth(Optional termMonth); - - _FinalStage termMonth(Integer termMonth); - - _FinalStage totalDiscount(Optional> totalDiscount); - - _FinalStage totalDiscount(Map totalDiscount); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements BillingFrequencyStage, - CreatedAtStage, - CurrencyStage, - DescriptionStage, - IdStage, - NameStage, - PriceStage, - QuantityStage, - UpdatedAtStage, - _FinalStage { - private String billingFrequency; - - private OffsetDateTime createdAt; - - private String currency; - - private String description; - - private String id; - - private String name; - - private double price; - - private int quantity; - - private OffsetDateTime updatedAt; - - private Optional> totalDiscount = Optional.empty(); - - private Optional termMonth = Optional.empty(); - - private Optional> discountPercentage = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CrmDealLineItem other) { - billingFrequency(other.getBillingFrequency()); - createdAt(other.getCreatedAt()); - currency(other.getCurrency()); - description(other.getDescription()); - discountPercentage(other.getDiscountPercentage()); - id(other.getId()); - name(other.getName()); - price(other.getPrice()); - quantity(other.getQuantity()); - termMonth(other.getTermMonth()); - totalDiscount(other.getTotalDiscount()); - updatedAt(other.getUpdatedAt()); - return this; - } - - @java.lang.Override - @JsonSetter("billing_frequency") - public CreatedAtStage billingFrequency(@NotNull String billingFrequency) { - this.billingFrequency = Objects.requireNonNull(billingFrequency, "billingFrequency must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("created_at") - public CurrencyStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("currency") - public DescriptionStage currency(@NotNull String currency) { - this.currency = Objects.requireNonNull(currency, "currency must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("description") - public IdStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public PriceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("price") - public QuantityStage price(double price) { - this.price = price; - return this; - } - - @java.lang.Override - @JsonSetter("quantity") - public UpdatedAtStage quantity(int quantity) { - this.quantity = quantity; - 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 totalDiscount(Map totalDiscount) { - this.totalDiscount = Optional.ofNullable(totalDiscount); - return this; - } - - @java.lang.Override - @JsonSetter(value = "total_discount", nulls = Nulls.SKIP) - public _FinalStage totalDiscount(Optional> totalDiscount) { - this.totalDiscount = totalDiscount; - return this; - } - - @java.lang.Override - public _FinalStage termMonth(Integer termMonth) { - this.termMonth = Optional.ofNullable(termMonth); - return this; - } - - @java.lang.Override - @JsonSetter(value = "term_month", nulls = Nulls.SKIP) - public _FinalStage termMonth(Optional termMonth) { - this.termMonth = termMonth; - return this; - } - - @java.lang.Override - public _FinalStage discountPercentage(Map discountPercentage) { - this.discountPercentage = Optional.ofNullable(discountPercentage); - return this; - } - - @java.lang.Override - @JsonSetter(value = "discount_percentage", nulls = Nulls.SKIP) - public _FinalStage discountPercentage(Optional> discountPercentage) { - this.discountPercentage = discountPercentage; - return this; - } - - @java.lang.Override - public CrmDealLineItem build() { - return new CrmDealLineItem( - billingFrequency, - createdAt, - currency, - description, - discountPercentage, - id, - name, - price, - quantity, - termMonth, - totalDiscount, - updatedAt, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/CrmDealResponseData.java b/src/main/java/com/schematic/api/types/CrmDealResponseData.java deleted file mode 100644 index cf29f82..0000000 --- a/src/main/java/com/schematic/api/types/CrmDealResponseData.java +++ /dev/null @@ -1,397 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.schematic.api.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.schematic.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.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 = CrmDealResponseData.Builder.class) -public final class CrmDealResponseData { - private final String accountId; - - private final String arr; - - private final Optional companyExternalId; - - private final OffsetDateTime createdAt; - - private final String dealExternalId; - - private final String dealId; - - private final String environmentId; - - private final String mrr; - - private final Optional name; - - private final Optional productExternalId; - - private final OffsetDateTime updatedAt; - - private final Map additionalProperties; - - private CrmDealResponseData( - String accountId, - String arr, - Optional companyExternalId, - OffsetDateTime createdAt, - String dealExternalId, - String dealId, - String environmentId, - String mrr, - Optional name, - Optional productExternalId, - OffsetDateTime updatedAt, - Map additionalProperties) { - this.accountId = accountId; - this.arr = arr; - this.companyExternalId = companyExternalId; - this.createdAt = createdAt; - this.dealExternalId = dealExternalId; - this.dealId = dealId; - this.environmentId = environmentId; - this.mrr = mrr; - this.name = name; - this.productExternalId = productExternalId; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("account_id") - public String getAccountId() { - return accountId; - } - - @JsonProperty("arr") - public String getArr() { - return arr; - } - - @JsonProperty("company_external_id") - public Optional getCompanyExternalId() { - return companyExternalId; - } - - @JsonProperty("created_at") - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("deal_external_id") - public String getDealExternalId() { - return dealExternalId; - } - - @JsonProperty("deal_id") - public String getDealId() { - return dealId; - } - - @JsonProperty("environment_id") - public String getEnvironmentId() { - return environmentId; - } - - @JsonProperty("mrr") - public String getMrr() { - return mrr; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("product_external_id") - public Optional getProductExternalId() { - return productExternalId; - } - - @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CrmDealResponseData && equalTo((CrmDealResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CrmDealResponseData other) { - return accountId.equals(other.accountId) - && arr.equals(other.arr) - && companyExternalId.equals(other.companyExternalId) - && createdAt.equals(other.createdAt) - && dealExternalId.equals(other.dealExternalId) - && dealId.equals(other.dealId) - && environmentId.equals(other.environmentId) - && mrr.equals(other.mrr) - && name.equals(other.name) - && productExternalId.equals(other.productExternalId) - && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.accountId, - this.arr, - this.companyExternalId, - this.createdAt, - this.dealExternalId, - this.dealId, - this.environmentId, - this.mrr, - this.name, - this.productExternalId, - this.updatedAt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static AccountIdStage builder() { - return new Builder(); - } - - public interface AccountIdStage { - ArrStage accountId(@NotNull String accountId); - - Builder from(CrmDealResponseData other); - } - - public interface ArrStage { - CreatedAtStage arr(@NotNull String arr); - } - - public interface CreatedAtStage { - DealExternalIdStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface DealExternalIdStage { - DealIdStage dealExternalId(@NotNull String dealExternalId); - } - - public interface DealIdStage { - EnvironmentIdStage dealId(@NotNull String dealId); - } - - public interface EnvironmentIdStage { - MrrStage environmentId(@NotNull String environmentId); - } - - public interface MrrStage { - UpdatedAtStage mrr(@NotNull String mrr); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - CrmDealResponseData build(); - - _FinalStage companyExternalId(Optional companyExternalId); - - _FinalStage companyExternalId(String companyExternalId); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage productExternalId(Optional productExternalId); - - _FinalStage productExternalId(String productExternalId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements AccountIdStage, - ArrStage, - CreatedAtStage, - DealExternalIdStage, - DealIdStage, - EnvironmentIdStage, - MrrStage, - UpdatedAtStage, - _FinalStage { - private String accountId; - - private String arr; - - private OffsetDateTime createdAt; - - private String dealExternalId; - - private String dealId; - - private String environmentId; - - private String mrr; - - private OffsetDateTime updatedAt; - - private Optional productExternalId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional companyExternalId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CrmDealResponseData other) { - accountId(other.getAccountId()); - arr(other.getArr()); - companyExternalId(other.getCompanyExternalId()); - createdAt(other.getCreatedAt()); - dealExternalId(other.getDealExternalId()); - dealId(other.getDealId()); - environmentId(other.getEnvironmentId()); - mrr(other.getMrr()); - name(other.getName()); - productExternalId(other.getProductExternalId()); - updatedAt(other.getUpdatedAt()); - return this; - } - - @java.lang.Override - @JsonSetter("account_id") - public ArrStage accountId(@NotNull String accountId) { - this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("arr") - public CreatedAtStage arr(@NotNull String arr) { - this.arr = Objects.requireNonNull(arr, "arr must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("created_at") - public DealExternalIdStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("deal_external_id") - public DealIdStage dealExternalId(@NotNull String dealExternalId) { - this.dealExternalId = Objects.requireNonNull(dealExternalId, "dealExternalId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("deal_id") - public EnvironmentIdStage dealId(@NotNull String dealId) { - this.dealId = Objects.requireNonNull(dealId, "dealId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("environment_id") - public MrrStage environmentId(@NotNull String environmentId) { - this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("mrr") - public UpdatedAtStage mrr(@NotNull String mrr) { - this.mrr = Objects.requireNonNull(mrr, "mrr 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 productExternalId(String productExternalId) { - this.productExternalId = Optional.ofNullable(productExternalId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "product_external_id", nulls = Nulls.SKIP) - public _FinalStage productExternalId(Optional productExternalId) { - this.productExternalId = productExternalId; - 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 companyExternalId(String companyExternalId) { - this.companyExternalId = Optional.ofNullable(companyExternalId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "company_external_id", nulls = Nulls.SKIP) - public _FinalStage companyExternalId(Optional companyExternalId) { - this.companyExternalId = companyExternalId; - return this; - } - - @java.lang.Override - public CrmDealResponseData build() { - return new CrmDealResponseData( - accountId, - arr, - companyExternalId, - createdAt, - dealExternalId, - dealId, - environmentId, - mrr, - name, - productExternalId, - updatedAt, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/DataExportResponseData.java b/src/main/java/com/schematic/api/types/DataExportResponseData.java index f043bed..4deef38 100644 --- a/src/main/java/com/schematic/api/types/DataExportResponseData.java +++ b/src/main/java/com/schematic/api/types/DataExportResponseData.java @@ -34,7 +34,7 @@ public final class DataExportResponseData { private final String outputFileType; - private final String status; + private final DataExportStatus status; private final OffsetDateTime updatedAt; @@ -48,7 +48,7 @@ private DataExportResponseData( String id, String metadata, String outputFileType, - String status, + DataExportStatus status, OffsetDateTime updatedAt, Map additionalProperties) { this.accountId = accountId; @@ -99,7 +99,7 @@ public String getOutputFileType() { } @JsonProperty("status") - public String getStatus() { + public DataExportStatus getStatus() { return status; } @@ -185,7 +185,7 @@ public interface OutputFileTypeStage { } public interface StatusStage { - UpdatedAtStage status(@NotNull String status); + UpdatedAtStage status(@NotNull DataExportStatus status); } public interface UpdatedAtStage { @@ -222,7 +222,7 @@ public static final class Builder private String outputFileType; - private String status; + private DataExportStatus status; private OffsetDateTime updatedAt; @@ -296,7 +296,7 @@ public StatusStage outputFileType(@NotNull String outputFileType) { @java.lang.Override @JsonSetter("status") - public UpdatedAtStage status(@NotNull String status) { + public UpdatedAtStage status(@NotNull DataExportStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/DataExportStatus.java b/src/main/java/com/schematic/api/types/DataExportStatus.java new file mode 100644 index 0000000..e250a99 --- /dev/null +++ b/src/main/java/com/schematic/api/types/DataExportStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DataExportStatus { + public static final DataExportStatus FAILURE = new DataExportStatus(Value.FAILURE, "failure"); + + public static final DataExportStatus SUCCESS = new DataExportStatus(Value.SUCCESS, "success"); + + public static final DataExportStatus PENDING = new DataExportStatus(Value.PENDING, "pending"); + + private final Value value; + + private final String string; + + DataExportStatus(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 DataExportStatus && this.string.equals(((DataExportStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILURE: + return visitor.visitFailure(); + case SUCCESS: + return visitor.visitSuccess(); + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DataExportStatus valueOf(String value) { + switch (value) { + case "failure": + return FAILURE; + case "success": + return SUCCESS; + case "pending": + return PENDING; + default: + return new DataExportStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + FAILURE, + + PENDING, + + SUCCESS, + + UNKNOWN + } + + public interface Visitor { + T visitFailure(); + + T visitPending(); + + T visitSuccess(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java new file mode 100644 index 0000000..9f1903c --- /dev/null +++ b/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.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 = DeleteBillingPlanCreditGrantRequestBody.Builder.class) +public final class DeleteBillingPlanCreditGrantRequestBody { + private final Optional applyToExisting; + + private final Map additionalProperties; + + private DeleteBillingPlanCreditGrantRequestBody( + Optional applyToExisting, Map additionalProperties) { + this.applyToExisting = applyToExisting; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteBillingPlanCreditGrantRequestBody + && equalTo((DeleteBillingPlanCreditGrantRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteBillingPlanCreditGrantRequestBody other) { + return applyToExisting.equals(other.applyToExisting); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.applyToExisting); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional applyToExisting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteBillingPlanCreditGrantRequestBody other) { + applyToExisting(other.getApplyToExisting()); + return this; + } + + @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) + public Builder applyToExisting(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + + public Builder applyToExisting(Boolean applyToExisting) { + this.applyToExisting = Optional.ofNullable(applyToExisting); + return this; + } + + public DeleteBillingPlanCreditGrantRequestBody build() { + return new DeleteBillingPlanCreditGrantRequestBody(applyToExisting, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java b/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java new file mode 100644 index 0000000..b7e92c9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DuplicatePlanEntitlementsResponseResponseData.Builder.class) +public final class DuplicatePlanEntitlementsResponseResponseData { + private final List data; + + private final List skipped; + + private final Map additionalProperties; + + private DuplicatePlanEntitlementsResponseResponseData( + List data, + List skipped, + Map additionalProperties) { + this.data = data; + this.skipped = skipped; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("skipped") + public List getSkipped() { + return skipped; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DuplicatePlanEntitlementsResponseResponseData + && equalTo((DuplicatePlanEntitlementsResponseResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DuplicatePlanEntitlementsResponseResponseData other) { + return data.equals(other.data) && skipped.equals(other.skipped); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.skipped); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + private List skipped = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DuplicatePlanEntitlementsResponseResponseData other) { + data(other.getData()); + skipped(other.getSkipped()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + if (data != null) { + this.data.addAll(data); + } + return this; + } + + public Builder addData(PlanEntitlementResponseData data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + if (data != null) { + this.data.addAll(data); + } + return this; + } + + @JsonSetter(value = "skipped", nulls = Nulls.SKIP) + public Builder skipped(List skipped) { + this.skipped.clear(); + if (skipped != null) { + this.skipped.addAll(skipped); + } + return this; + } + + public Builder addSkipped(SkippedEntitlementResponseData skipped) { + this.skipped.add(skipped); + return this; + } + + public Builder addAllSkipped(List skipped) { + if (skipped != null) { + this.skipped.addAll(skipped); + } + return this; + } + + public DuplicatePlanEntitlementsResponseResponseData build() { + return new DuplicatePlanEntitlementsResponseResponseData(data, skipped, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBodyPriceBehavior.java b/src/main/java/com/schematic/api/types/EntitlementPriceBehavior.java similarity index 60% rename from src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBodyPriceBehavior.java rename to src/main/java/com/schematic/api/types/EntitlementPriceBehavior.java index 0a8299c..bf486e5 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBodyPriceBehavior.java +++ b/src/main/java/com/schematic/api/types/EntitlementPriceBehavior.java @@ -6,27 +6,25 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UsageBasedEntitlementRequestBodyPriceBehavior { - public static final UsageBasedEntitlementRequestBodyPriceBehavior TIER = - new UsageBasedEntitlementRequestBodyPriceBehavior(Value.TIER, "tier"); +public final class EntitlementPriceBehavior { + public static final EntitlementPriceBehavior TIER = new EntitlementPriceBehavior(Value.TIER, "tier"); - public static final UsageBasedEntitlementRequestBodyPriceBehavior CREDIT_BURNDOWN = - new UsageBasedEntitlementRequestBodyPriceBehavior(Value.CREDIT_BURNDOWN, "credit_burndown"); + public static final EntitlementPriceBehavior CREDIT_BURNDOWN = + new EntitlementPriceBehavior(Value.CREDIT_BURNDOWN, "credit_burndown"); - public static final UsageBasedEntitlementRequestBodyPriceBehavior OVERAGE = - new UsageBasedEntitlementRequestBodyPriceBehavior(Value.OVERAGE, "overage"); + public static final EntitlementPriceBehavior OVERAGE = new EntitlementPriceBehavior(Value.OVERAGE, "overage"); - public static final UsageBasedEntitlementRequestBodyPriceBehavior PAY_AS_YOU_GO = - new UsageBasedEntitlementRequestBodyPriceBehavior(Value.PAY_AS_YOU_GO, "pay_as_you_go"); + public static final EntitlementPriceBehavior PAY_AS_YOU_GO = + new EntitlementPriceBehavior(Value.PAY_AS_YOU_GO, "pay_as_you_go"); - public static final UsageBasedEntitlementRequestBodyPriceBehavior PAY_IN_ADVANCE = - new UsageBasedEntitlementRequestBodyPriceBehavior(Value.PAY_IN_ADVANCE, "pay_in_advance"); + public static final EntitlementPriceBehavior PAY_IN_ADVANCE = + new EntitlementPriceBehavior(Value.PAY_IN_ADVANCE, "pay_in_advance"); private final Value value; private final String string; - UsageBasedEntitlementRequestBodyPriceBehavior(Value value, String string) { + EntitlementPriceBehavior(Value value, String string) { this.value = value; this.string = string; } @@ -44,8 +42,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UsageBasedEntitlementRequestBodyPriceBehavior - && this.string.equals(((UsageBasedEntitlementRequestBodyPriceBehavior) other).string)); + || (other instanceof EntitlementPriceBehavior + && this.string.equals(((EntitlementPriceBehavior) other).string)); } @java.lang.Override @@ -72,7 +70,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UsageBasedEntitlementRequestBodyPriceBehavior valueOf(String value) { + public static EntitlementPriceBehavior valueOf(String value) { switch (value) { case "tier": return TIER; @@ -85,18 +83,18 @@ public static UsageBasedEntitlementRequestBodyPriceBehavior valueOf(String value case "pay_in_advance": return PAY_IN_ADVANCE; default: - return new UsageBasedEntitlementRequestBodyPriceBehavior(Value.UNKNOWN, value); + return new EntitlementPriceBehavior(Value.UNKNOWN, value); } } public enum Value { - PAY_AS_YOU_GO, - - PAY_IN_ADVANCE, + CREDIT_BURNDOWN, OVERAGE, - CREDIT_BURNDOWN, + PAY_AS_YOU_GO, + + PAY_IN_ADVANCE, TIER, @@ -104,13 +102,13 @@ public enum Value { } public interface Visitor { - T visitPayAsYouGo(); - - T visitPayInAdvance(); + T visitCreditBurndown(); T visitOverage(); - T visitCreditBurndown(); + T visitPayAsYouGo(); + + T visitPayInAdvance(); T visitTier(); diff --git a/src/main/java/com/schematic/api/types/EntitlementType.java b/src/main/java/com/schematic/api/types/EntitlementType.java new file mode 100644 index 0000000..bcf9d5d --- /dev/null +++ b/src/main/java/com/schematic/api/types/EntitlementType.java @@ -0,0 +1,95 @@ +/** + * 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 EntitlementType { + public static final EntitlementType COMPANY_OVERRIDE = + new EntitlementType(Value.COMPANY_OVERRIDE, "company_override"); + + public static final EntitlementType UNKNOWN = new EntitlementType(Value.UNKNOWN, "unknown"); + + public static final EntitlementType PLAN_ENTITLEMENT = + new EntitlementType(Value.PLAN_ENTITLEMENT, "plan_entitlement"); + + private final Value value; + + private final String string; + + EntitlementType(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 EntitlementType && this.string.equals(((EntitlementType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case COMPANY_OVERRIDE: + return visitor.visitCompanyOverride(); + case UNKNOWN: + return visitor.visitUnknown(); + case PLAN_ENTITLEMENT: + return visitor.visitPlanEntitlement(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static EntitlementType valueOf(String value) { + switch (value) { + case "company_override": + return COMPANY_OVERRIDE; + case "unknown": + return UNKNOWN; + case "plan_entitlement": + return PLAN_ENTITLEMENT; + default: + return new EntitlementType(Value._UNKNOWN, value); + } + } + + public enum Value { + COMPANY_OVERRIDE, + + PLAN_ENTITLEMENT, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitCompanyOverride(); + + T visitPlanEntitlement(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementReqCommonValueType.java b/src/main/java/com/schematic/api/types/EntitlementValueType.java similarity index 62% rename from src/main/java/com/schematic/api/types/CreateEntitlementReqCommonValueType.java rename to src/main/java/com/schematic/api/types/EntitlementValueType.java index 9032e84..44f3df0 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementReqCommonValueType.java +++ b/src/main/java/com/schematic/api/types/EntitlementValueType.java @@ -6,27 +6,24 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateEntitlementReqCommonValueType { - public static final CreateEntitlementReqCommonValueType NUMERIC = - new CreateEntitlementReqCommonValueType(Value.NUMERIC, "numeric"); +public final class EntitlementValueType { + public static final EntitlementValueType NUMERIC = new EntitlementValueType(Value.NUMERIC, "numeric"); - public static final CreateEntitlementReqCommonValueType TRAIT = - new CreateEntitlementReqCommonValueType(Value.TRAIT, "trait"); + public static final EntitlementValueType TRAIT = new EntitlementValueType(Value.TRAIT, "trait"); - public static final CreateEntitlementReqCommonValueType BOOLEAN = - new CreateEntitlementReqCommonValueType(Value.BOOLEAN, "boolean"); + public static final EntitlementValueType BOOLEAN = new EntitlementValueType(Value.BOOLEAN, "boolean"); - public static final CreateEntitlementReqCommonValueType CREDIT = - new CreateEntitlementReqCommonValueType(Value.CREDIT, "credit"); + public static final EntitlementValueType UNKNOWN = new EntitlementValueType(Value.UNKNOWN, "unknown"); - public static final CreateEntitlementReqCommonValueType UNLIMITED = - new CreateEntitlementReqCommonValueType(Value.UNLIMITED, "unlimited"); + public static final EntitlementValueType CREDIT = new EntitlementValueType(Value.CREDIT, "credit"); + + public static final EntitlementValueType UNLIMITED = new EntitlementValueType(Value.UNLIMITED, "unlimited"); private final Value value; private final String string; - CreateEntitlementReqCommonValueType(Value value, String string) { + EntitlementValueType(Value value, String string) { this.value = value; this.string = string; } @@ -44,8 +41,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateEntitlementReqCommonValueType - && this.string.equals(((CreateEntitlementReqCommonValueType) other).string)); + || (other instanceof EntitlementValueType && this.string.equals(((EntitlementValueType) other).string)); } @java.lang.Override @@ -61,18 +57,20 @@ public T visit(Visitor visitor) { return visitor.visitTrait(); case BOOLEAN: return visitor.visitBoolean(); + case UNKNOWN: + return visitor.visitUnknown(); case CREDIT: return visitor.visitCredit(); case UNLIMITED: return visitor.visitUnlimited(); - case UNKNOWN: + case _UNKNOWN: default: return visitor.visitUnknown(string); } } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateEntitlementReqCommonValueType valueOf(String value) { + public static EntitlementValueType valueOf(String value) { switch (value) { case "numeric": return NUMERIC; @@ -80,12 +78,14 @@ public static CreateEntitlementReqCommonValueType valueOf(String value) { return TRAIT; case "boolean": return BOOLEAN; + case "unknown": + return UNKNOWN; case "credit": return CREDIT; case "unlimited": return UNLIMITED; default: - return new CreateEntitlementReqCommonValueType(Value.UNKNOWN, value); + return new EntitlementValueType(Value._UNKNOWN, value); } } @@ -98,9 +98,11 @@ public enum Value { TRAIT, + UNKNOWN, + UNLIMITED, - UNKNOWN + _UNKNOWN } public interface Visitor { @@ -112,6 +114,8 @@ public interface Visitor { T visitTrait(); + T visitUnknown(); + T visitUnlimited(); T visitUnknown(String unknownType); diff --git a/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java b/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java index 1e40627..4acbdb1 100644 --- a/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java @@ -22,7 +22,7 @@ public final class EntityKeyDefinitionResponseData { private final OffsetDateTime createdAt; - private final String entityType; + private final EntityType entityType; private final String id; @@ -34,7 +34,7 @@ public final class EntityKeyDefinitionResponseData { private EntityKeyDefinitionResponseData( OffsetDateTime createdAt, - String entityType, + EntityType entityType, String id, String key, OffsetDateTime updatedAt, @@ -53,7 +53,7 @@ public OffsetDateTime getCreatedAt() { } @JsonProperty("entity_type") - public String getEntityType() { + public EntityType getEntityType() { return entityType; } @@ -112,7 +112,7 @@ public interface CreatedAtStage { } public interface EntityTypeStage { - IdStage entityType(@NotNull String entityType); + IdStage entityType(@NotNull EntityType entityType); } public interface IdStage { @@ -136,7 +136,7 @@ public static final class Builder implements CreatedAtStage, EntityTypeStage, IdStage, KeyStage, UpdatedAtStage, _FinalStage { private OffsetDateTime createdAt; - private String entityType; + private EntityType entityType; private String id; @@ -168,7 +168,7 @@ public EntityTypeStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("entity_type") - public IdStage entityType(@NotNull String entityType) { + public IdStage entityType(@NotNull EntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java b/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java index b224447..1194f02 100644 --- a/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java @@ -30,7 +30,7 @@ public final class EntityKeyDetailResponseData { private final String entityId; - private final String entityType; + private final EntityType entityType; private final String environmentId; @@ -49,7 +49,7 @@ private EntityKeyDetailResponseData( Optional definition, String definitionId, String entityId, - String entityType, + EntityType entityType, String environmentId, String id, String key, @@ -90,7 +90,7 @@ public String getEntityId() { } @JsonProperty("entity_type") - public String getEntityType() { + public EntityType getEntityType() { return entityType; } @@ -182,7 +182,7 @@ public interface EntityIdStage { } public interface EntityTypeStage { - EnvironmentIdStage entityType(@NotNull String entityType); + EnvironmentIdStage entityType(@NotNull EntityType entityType); } public interface EnvironmentIdStage { @@ -231,7 +231,7 @@ public static final class Builder private String entityId; - private String entityType; + private EntityType entityType; private String environmentId; @@ -288,7 +288,7 @@ public EntityTypeStage entityId(@NotNull String entityId) { @java.lang.Override @JsonSetter("entity_type") - public EnvironmentIdStage entityType(@NotNull String entityType) { + public EnvironmentIdStage entityType(@NotNull EntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/EntityKeyResponseData.java b/src/main/java/com/schematic/api/types/EntityKeyResponseData.java index 2ed75ed..bb6100e 100644 --- a/src/main/java/com/schematic/api/types/EntityKeyResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityKeyResponseData.java @@ -26,7 +26,7 @@ public final class EntityKeyResponseData { private final String entityId; - private final String entityType; + private final EntityType entityType; private final String environmentId; @@ -44,7 +44,7 @@ private EntityKeyResponseData( OffsetDateTime createdAt, String definitionId, String entityId, - String entityType, + EntityType entityType, String environmentId, String id, String key, @@ -79,7 +79,7 @@ public String getEntityId() { } @JsonProperty("entity_type") - public String getEntityType() { + public EntityType getEntityType() { return entityType; } @@ -169,7 +169,7 @@ public interface EntityIdStage { } public interface EntityTypeStage { - EnvironmentIdStage entityType(@NotNull String entityType); + EnvironmentIdStage entityType(@NotNull EntityType entityType); } public interface EnvironmentIdStage { @@ -214,7 +214,7 @@ public static final class Builder private String entityId; - private String entityType; + private EntityType entityType; private String environmentId; @@ -268,7 +268,7 @@ public EntityTypeStage entityId(@NotNull String entityId) { @java.lang.Override @JsonSetter("entity_type") - public EnvironmentIdStage entityType(@NotNull String entityType) { + public EnvironmentIdStage entityType(@NotNull EntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java b/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java index c397434..87b7879 100644 --- a/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java @@ -27,13 +27,13 @@ public final class EntityTraitDefinitionResponseData { private final String displayName; - private final String entityType; + private final EntityType entityType; private final List hierarchy; private final String id; - private final String traitType; + private final TraitType traitType; private final OffsetDateTime updatedAt; @@ -42,10 +42,10 @@ public final class EntityTraitDefinitionResponseData { private EntityTraitDefinitionResponseData( OffsetDateTime createdAt, String displayName, - String entityType, + EntityType entityType, List hierarchy, String id, - String traitType, + TraitType traitType, OffsetDateTime updatedAt, Map additionalProperties) { this.createdAt = createdAt; @@ -69,7 +69,7 @@ public String getDisplayName() { } @JsonProperty("entity_type") - public String getEntityType() { + public EntityType getEntityType() { return entityType; } @@ -84,7 +84,7 @@ public String getId() { } @JsonProperty("trait_type") - public String getTraitType() { + public TraitType getTraitType() { return traitType; } @@ -146,7 +146,7 @@ public interface DisplayNameStage { } public interface EntityTypeStage { - IdStage entityType(@NotNull String entityType); + IdStage entityType(@NotNull EntityType entityType); } public interface IdStage { @@ -154,7 +154,7 @@ public interface IdStage { } public interface TraitTypeStage { - UpdatedAtStage traitType(@NotNull String traitType); + UpdatedAtStage traitType(@NotNull TraitType traitType); } public interface UpdatedAtStage { @@ -184,11 +184,11 @@ public static final class Builder private String displayName; - private String entityType; + private EntityType entityType; private String id; - private String traitType; + private TraitType traitType; private OffsetDateTime updatedAt; @@ -227,7 +227,7 @@ public EntityTypeStage displayName(@NotNull String displayName) { @java.lang.Override @JsonSetter("entity_type") - public IdStage entityType(@NotNull String entityType) { + public IdStage entityType(@NotNull EntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } @@ -241,7 +241,7 @@ public TraitTypeStage id(@NotNull String id) { @java.lang.Override @JsonSetter("trait_type") - public UpdatedAtStage traitType(@NotNull String traitType) { + public UpdatedAtStage traitType(@NotNull TraitType traitType) { this.traitType = Objects.requireNonNull(traitType, "traitType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsRequestEntityType.java b/src/main/java/com/schematic/api/types/EntityType.java similarity index 61% rename from src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsRequestEntityType.java rename to src/main/java/com/schematic/api/types/EntityType.java index 3d1157e..0c53637 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsRequestEntityType.java +++ b/src/main/java/com/schematic/api/types/EntityType.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.companies.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListEntityTraitDefinitionsRequestEntityType { - public static final ListEntityTraitDefinitionsRequestEntityType USER = - new ListEntityTraitDefinitionsRequestEntityType(Value.USER, "user"); +public final class EntityType { + public static final EntityType USER = new EntityType(Value.USER, "user"); - public static final ListEntityTraitDefinitionsRequestEntityType COMPANY = - new ListEntityTraitDefinitionsRequestEntityType(Value.COMPANY, "company"); + public static final EntityType COMPANY = new EntityType(Value.COMPANY, "company"); private final Value value; private final String string; - ListEntityTraitDefinitionsRequestEntityType(Value value, String string) { + EntityType(Value value, String string) { this.value = value; this.string = string; } @@ -34,9 +32,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof ListEntityTraitDefinitionsRequestEntityType - && this.string.equals(((ListEntityTraitDefinitionsRequestEntityType) other).string)); + return (this == other) || (other instanceof EntityType && this.string.equals(((EntityType) other).string)); } @java.lang.Override @@ -57,14 +53,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEntityTraitDefinitionsRequestEntityType valueOf(String value) { + public static EntityType valueOf(String value) { switch (value) { case "user": return USER; case "company": return COMPANY; default: - return new ListEntityTraitDefinitionsRequestEntityType(Value.UNKNOWN, value); + return new EntityType(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java b/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java index c8fb78f..08aa523 100644 --- a/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java @@ -27,7 +27,7 @@ public final class EnvironmentDetailResponseData { private final OffsetDateTime createdAt; - private final String environmentType; + private final EnvironmentType environmentType; private final String id; @@ -40,7 +40,7 @@ public final class EnvironmentDetailResponseData { private EnvironmentDetailResponseData( List apiKeys, OffsetDateTime createdAt, - String environmentType, + EnvironmentType environmentType, String id, String name, OffsetDateTime updatedAt, @@ -65,7 +65,7 @@ public OffsetDateTime getCreatedAt() { } @JsonProperty("environment_type") - public String getEnvironmentType() { + public EnvironmentType getEnvironmentType() { return environmentType; } @@ -125,7 +125,7 @@ public interface CreatedAtStage { } public interface EnvironmentTypeStage { - IdStage environmentType(@NotNull String environmentType); + IdStage environmentType(@NotNull EnvironmentType environmentType); } public interface IdStage { @@ -155,7 +155,7 @@ public static final class Builder implements CreatedAtStage, EnvironmentTypeStage, IdStage, NameStage, UpdatedAtStage, _FinalStage { private OffsetDateTime createdAt; - private String environmentType; + private EnvironmentType environmentType; private String id; @@ -190,7 +190,7 @@ public EnvironmentTypeStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("environment_type") - public IdStage environmentType(@NotNull String environmentType) { + public IdStage environmentType(@NotNull EnvironmentType environmentType) { this.environmentType = Objects.requireNonNull(environmentType, "environmentType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/EnvironmentResponseData.java b/src/main/java/com/schematic/api/types/EnvironmentResponseData.java index e6a0ec6..b1c88ed 100644 --- a/src/main/java/com/schematic/api/types/EnvironmentResponseData.java +++ b/src/main/java/com/schematic/api/types/EnvironmentResponseData.java @@ -22,7 +22,7 @@ public final class EnvironmentResponseData { private final OffsetDateTime createdAt; - private final String environmentType; + private final EnvironmentType environmentType; private final String id; @@ -34,7 +34,7 @@ public final class EnvironmentResponseData { private EnvironmentResponseData( OffsetDateTime createdAt, - String environmentType, + EnvironmentType environmentType, String id, String name, OffsetDateTime updatedAt, @@ -53,7 +53,7 @@ public OffsetDateTime getCreatedAt() { } @JsonProperty("environment_type") - public String getEnvironmentType() { + public EnvironmentType getEnvironmentType() { return environmentType; } @@ -112,7 +112,7 @@ public interface CreatedAtStage { } public interface EnvironmentTypeStage { - IdStage environmentType(@NotNull String environmentType); + IdStage environmentType(@NotNull EnvironmentType environmentType); } public interface IdStage { @@ -136,7 +136,7 @@ public static final class Builder implements CreatedAtStage, EnvironmentTypeStage, IdStage, NameStage, UpdatedAtStage, _FinalStage { private OffsetDateTime createdAt; - private String environmentType; + private EnvironmentType environmentType; private String id; @@ -168,7 +168,7 @@ public EnvironmentTypeStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("environment_type") - public IdStage environmentType(@NotNull String environmentType) { + public IdStage environmentType(@NotNull EnvironmentType environmentType) { this.environmentType = Objects.requireNonNull(environmentType, "environmentType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentRequestBodyEnvironmentType.java b/src/main/java/com/schematic/api/types/EnvironmentType.java similarity index 61% rename from src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentRequestBodyEnvironmentType.java rename to src/main/java/com/schematic/api/types/EnvironmentType.java index 54b7ffe..be16544 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentRequestBodyEnvironmentType.java +++ b/src/main/java/com/schematic/api/types/EnvironmentType.java @@ -1,26 +1,23 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateEnvironmentRequestBodyEnvironmentType { - public static final CreateEnvironmentRequestBodyEnvironmentType DEVELOPMENT = - new CreateEnvironmentRequestBodyEnvironmentType(Value.DEVELOPMENT, "development"); +public final class EnvironmentType { + public static final EnvironmentType DEVELOPMENT = new EnvironmentType(Value.DEVELOPMENT, "development"); - public static final CreateEnvironmentRequestBodyEnvironmentType STAGING = - new CreateEnvironmentRequestBodyEnvironmentType(Value.STAGING, "staging"); + public static final EnvironmentType STAGING = new EnvironmentType(Value.STAGING, "staging"); - public static final CreateEnvironmentRequestBodyEnvironmentType PRODUCTION = - new CreateEnvironmentRequestBodyEnvironmentType(Value.PRODUCTION, "production"); + public static final EnvironmentType PRODUCTION = new EnvironmentType(Value.PRODUCTION, "production"); private final Value value; private final String string; - CreateEnvironmentRequestBodyEnvironmentType(Value value, String string) { + EnvironmentType(Value value, String string) { this.value = value; this.string = string; } @@ -38,8 +35,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateEnvironmentRequestBodyEnvironmentType - && this.string.equals(((CreateEnvironmentRequestBodyEnvironmentType) other).string)); + || (other instanceof EnvironmentType && this.string.equals(((EnvironmentType) other).string)); } @java.lang.Override @@ -62,7 +58,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateEnvironmentRequestBodyEnvironmentType valueOf(String value) { + public static EnvironmentType valueOf(String value) { switch (value) { case "development": return DEVELOPMENT; @@ -71,27 +67,27 @@ public static CreateEnvironmentRequestBodyEnvironmentType valueOf(String value) case "production": return PRODUCTION; default: - return new CreateEnvironmentRequestBodyEnvironmentType(Value.UNKNOWN, value); + return new EnvironmentType(Value.UNKNOWN, value); } } public enum Value { DEVELOPMENT, - STAGING, - PRODUCTION, + STAGING, + UNKNOWN } public interface Visitor { T visitDevelopment(); - T visitStaging(); - T visitProduction(); + T visitStaging(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/EventDetailResponseData.java b/src/main/java/com/schematic/api/types/EventDetailResponseData.java index e02e5a8..a31eaef 100644 --- a/src/main/java/com/schematic/api/types/EventDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EventDetailResponseData.java @@ -58,13 +58,13 @@ public final class EventDetailResponseData { private final Optional sentAt; - private final String status; + private final EventStatus status; private final Optional subtype; - private final String type; + private final EventType type; - private final OffsetDateTime updatedAt; + private final Optional updatedAt; private final Optional user; @@ -89,10 +89,10 @@ private EventDetailResponseData( Optional processedAt, int quantity, Optional sentAt, - String status, + EventStatus status, Optional subtype, - String type, - OffsetDateTime updatedAt, + EventType type, + Optional updatedAt, Optional user, Optional userId, Map additionalProperties) { @@ -202,7 +202,7 @@ public Optional getSentAt() { } @JsonProperty("status") - public String getStatus() { + public EventStatus getStatus() { return status; } @@ -212,12 +212,12 @@ public Optional getSubtype() { } @JsonProperty("type") - public String getType() { + public EventType getType() { return type; } @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { + public Optional getUpdatedAt() { return updatedAt; } @@ -322,15 +322,11 @@ public interface QuantityStage { } public interface StatusStage { - TypeStage status(@NotNull String status); + TypeStage status(@NotNull EventStatus status); } public interface TypeStage { - UpdatedAtStage type(@NotNull String type); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + _FinalStage type(@NotNull EventType type); } public interface _FinalStage { @@ -394,6 +390,10 @@ public interface _FinalStage { _FinalStage subtype(String subtype); + _FinalStage updatedAt(Optional updatedAt); + + _FinalStage updatedAt(OffsetDateTime updatedAt); + _FinalStage user(Optional user); _FinalStage user(PreviewObject user); @@ -405,14 +405,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements BodyPreviewStage, - CapturedAtStage, - IdStage, - QuantityStage, - StatusStage, - TypeStage, - UpdatedAtStage, - _FinalStage { + implements BodyPreviewStage, CapturedAtStage, IdStage, QuantityStage, StatusStage, TypeStage, _FinalStage { private String bodyPreview; private OffsetDateTime capturedAt; @@ -421,16 +414,16 @@ public static final class Builder private int quantity; - private String status; - - private String type; + private EventStatus status; - private OffsetDateTime updatedAt; + private EventType type; private Optional userId = Optional.empty(); private Optional user = Optional.empty(); + private Optional updatedAt = Optional.empty(); + private Optional subtype = Optional.empty(); private Optional sentAt = Optional.empty(); @@ -519,25 +512,18 @@ public StatusStage quantity(int quantity) { @java.lang.Override @JsonSetter("status") - public TypeStage status(@NotNull String status) { + public TypeStage status(@NotNull EventStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } @java.lang.Override @JsonSetter("type") - public UpdatedAtStage type(@NotNull String type) { + public _FinalStage type(@NotNull EventType type) { this.type = Objects.requireNonNull(type, "type 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 userId(String userId) { this.userId = Optional.ofNullable(userId); @@ -564,6 +550,19 @@ public _FinalStage user(Optional user) { return this; } + @java.lang.Override + public _FinalStage updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public _FinalStage updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + @java.lang.Override public _FinalStage subtype(String subtype) { this.subtype = Optional.ofNullable(subtype); diff --git a/src/main/java/com/schematic/api/types/EventResponseData.java b/src/main/java/com/schematic/api/types/EventResponseData.java index cdbf66d..dc04ba4 100644 --- a/src/main/java/com/schematic/api/types/EventResponseData.java +++ b/src/main/java/com/schematic/api/types/EventResponseData.java @@ -54,13 +54,13 @@ public final class EventResponseData { private final Optional sentAt; - private final String status; + private final EventStatus status; private final Optional subtype; - private final String type; + private final EventType type; - private final OffsetDateTime updatedAt; + private final Optional updatedAt; private final Optional userId; @@ -81,10 +81,10 @@ private EventResponseData( Optional processedAt, int quantity, Optional sentAt, - String status, + EventStatus status, Optional subtype, - String type, - OffsetDateTime updatedAt, + EventType type, + Optional updatedAt, Optional userId, Map additionalProperties) { this.apiKey = apiKey; @@ -180,7 +180,7 @@ public Optional getSentAt() { } @JsonProperty("status") - public String getStatus() { + public EventStatus getStatus() { return status; } @@ -190,12 +190,12 @@ public Optional getSubtype() { } @JsonProperty("type") - public String getType() { + public EventType getType() { return type; } @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { + public Optional getUpdatedAt() { return updatedAt; } @@ -289,15 +289,11 @@ public interface QuantityStage { } public interface StatusStage { - TypeStage status(@NotNull String status); + TypeStage status(@NotNull EventStatus status); } public interface TypeStage { - UpdatedAtStage type(@NotNull String type); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + _FinalStage type(@NotNull EventType type); } public interface _FinalStage { @@ -351,6 +347,10 @@ public interface _FinalStage { _FinalStage subtype(String subtype); + _FinalStage updatedAt(Optional updatedAt); + + _FinalStage updatedAt(OffsetDateTime updatedAt); + _FinalStage userId(Optional userId); _FinalStage userId(String userId); @@ -358,14 +358,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements BodyPreviewStage, - CapturedAtStage, - IdStage, - QuantityStage, - StatusStage, - TypeStage, - UpdatedAtStage, - _FinalStage { + implements BodyPreviewStage, CapturedAtStage, IdStage, QuantityStage, StatusStage, TypeStage, _FinalStage { private String bodyPreview; private OffsetDateTime capturedAt; @@ -374,14 +367,14 @@ public static final class Builder private int quantity; - private String status; - - private String type; + private EventStatus status; - private OffsetDateTime updatedAt; + private EventType type; private Optional userId = Optional.empty(); + private Optional updatedAt = Optional.empty(); + private Optional subtype = Optional.empty(); private Optional sentAt = Optional.empty(); @@ -463,25 +456,18 @@ public StatusStage quantity(int quantity) { @java.lang.Override @JsonSetter("status") - public TypeStage status(@NotNull String status) { + public TypeStage status(@NotNull EventStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } @java.lang.Override @JsonSetter("type") - public UpdatedAtStage type(@NotNull String type) { + public _FinalStage type(@NotNull EventType type) { this.type = Objects.requireNonNull(type, "type 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 userId(String userId) { this.userId = Optional.ofNullable(userId); @@ -495,6 +481,19 @@ public _FinalStage userId(Optional userId) { return this; } + @java.lang.Override + public _FinalStage updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public _FinalStage updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + @java.lang.Override public _FinalStage subtype(String subtype) { this.subtype = Optional.ofNullable(subtype); diff --git a/src/main/java/com/schematic/api/types/EventStatus.java b/src/main/java/com/schematic/api/types/EventStatus.java new file mode 100644 index 0000000..f84a72e --- /dev/null +++ b/src/main/java/com/schematic/api/types/EventStatus.java @@ -0,0 +1,112 @@ +/** + * 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 EventStatus { + public static final EventStatus FAILED = new EventStatus(Value.FAILED, "failed"); + + public static final EventStatus PENDING = new EventStatus(Value.PENDING, "pending"); + + public static final EventStatus UNKNOWN = new EventStatus(Value.UNKNOWN, "unknown"); + + public static final EventStatus PROCESSED = new EventStatus(Value.PROCESSED, "processed"); + + public static final EventStatus ENRICHED = new EventStatus(Value.ENRICHED, "enriched"); + + private final Value value; + + private final String string; + + EventStatus(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 EventStatus && this.string.equals(((EventStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILED: + return visitor.visitFailed(); + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + return visitor.visitUnknown(); + case PROCESSED: + return visitor.visitProcessed(); + case ENRICHED: + return visitor.visitEnriched(); + case _UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static EventStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "pending": + return PENDING; + case "unknown": + return UNKNOWN; + case "processed": + return PROCESSED; + case "enriched": + return ENRICHED; + default: + return new EventStatus(Value._UNKNOWN, value); + } + } + + public enum Value { + ENRICHED, + + FAILED, + + PENDING, + + PROCESSED, + + UNKNOWN, + + _UNKNOWN + } + + public interface Visitor { + T visitEnriched(); + + T visitFailed(); + + T visitPending(); + + T visitProcessed(); + + T visitUnknown(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreateEventRequestBodyEventType.java b/src/main/java/com/schematic/api/types/EventType.java similarity index 64% rename from src/main/java/com/schematic/api/types/CreateEventRequestBodyEventType.java rename to src/main/java/com/schematic/api/types/EventType.java index 8ce4cb7..f03bb91 100644 --- a/src/main/java/com/schematic/api/types/CreateEventRequestBodyEventType.java +++ b/src/main/java/com/schematic/api/types/EventType.java @@ -6,21 +6,18 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateEventRequestBodyEventType { - public static final CreateEventRequestBodyEventType FLAG_CHECK = - new CreateEventRequestBodyEventType(Value.FLAG_CHECK, "flag_check"); +public final class EventType { + public static final EventType FLAG_CHECK = new EventType(Value.FLAG_CHECK, "flag_check"); - public static final CreateEventRequestBodyEventType TRACK = - new CreateEventRequestBodyEventType(Value.TRACK, "track"); + public static final EventType TRACK = new EventType(Value.TRACK, "track"); - public static final CreateEventRequestBodyEventType IDENTIFY = - new CreateEventRequestBodyEventType(Value.IDENTIFY, "identify"); + public static final EventType IDENTIFY = new EventType(Value.IDENTIFY, "identify"); private final Value value; private final String string; - CreateEventRequestBodyEventType(Value value, String string) { + EventType(Value value, String string) { this.value = value; this.string = string; } @@ -37,9 +34,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof CreateEventRequestBodyEventType - && this.string.equals(((CreateEventRequestBodyEventType) other).string)); + return (this == other) || (other instanceof EventType && this.string.equals(((EventType) other).string)); } @java.lang.Override @@ -62,7 +57,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateEventRequestBodyEventType valueOf(String value) { + public static EventType valueOf(String value) { switch (value) { case "flag_check": return FLAG_CHECK; @@ -71,27 +66,27 @@ public static CreateEventRequestBodyEventType valueOf(String value) { case "identify": return IDENTIFY; default: - return new CreateEventRequestBodyEventType(Value.UNKNOWN, value); + return new EventType(Value.UNKNOWN, value); } } public enum Value { + FLAG_CHECK, + IDENTIFY, TRACK, - FLAG_CHECK, - UNKNOWN } public interface Visitor { + T visitFlagCheck(); + T visitIdentify(); T visitTrack(); - T visitFlagCheck(); - T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java b/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java index 3aaa7a6..8f1b227 100644 --- a/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java @@ -27,7 +27,7 @@ public final class FeatureCompanyResponseData { private final Optional allocation; - private final FeatureCompanyResponseDataAllocationType allocationType; + private final EntitlementValueType allocationType; private final Optional company; @@ -39,7 +39,7 @@ public final class FeatureCompanyResponseData { private final Optional> creditGrantDetails; - private final Optional creditGrantReason; + private final Optional creditGrantReason; private final Optional creditRemaining; @@ -49,6 +49,8 @@ public final class FeatureCompanyResponseData { private final Optional creditUsage; + private final Optional creditUsageAggregation; + private final Optional creditUsed; private final Optional effectiveLimit; @@ -61,7 +63,7 @@ public final class FeatureCompanyResponseData { private final Optional entitlementSource; - private final String entitlementType; + private final EntitlementType entitlementType; private final Optional feature; @@ -85,7 +87,7 @@ public final class FeatureCompanyResponseData { private final Optional planEntitlement; - private final Optional priceBehavior; + private final Optional priceBehavior; private final Optional softLimit; @@ -98,24 +100,25 @@ public final class FeatureCompanyResponseData { private FeatureCompanyResponseData( boolean access, Optional allocation, - FeatureCompanyResponseDataAllocationType allocationType, + EntitlementValueType allocationType, Optional company, Optional companyOverride, Optional creditConsumptionRate, Optional> creditGrantCounts, Optional> creditGrantDetails, - Optional creditGrantReason, + Optional creditGrantReason, Optional creditRemaining, Optional creditTotal, Optional creditTypeIcon, Optional creditUsage, + Optional creditUsageAggregation, Optional creditUsed, Optional effectiveLimit, Optional effectivePrice, Optional entitlementExpirationDate, String entitlementId, Optional entitlementSource, - String entitlementType, + EntitlementType entitlementType, Optional feature, Optional hasValidAllocation, Optional isUnlimited, @@ -127,7 +130,7 @@ private FeatureCompanyResponseData( Optional period, Optional plan, Optional planEntitlement, - Optional priceBehavior, + Optional priceBehavior, Optional softLimit, Optional usage, Optional yearlyUsageBasedPrice, @@ -145,6 +148,7 @@ private FeatureCompanyResponseData( this.creditTotal = creditTotal; this.creditTypeIcon = creditTypeIcon; this.creditUsage = creditUsage; + this.creditUsageAggregation = creditUsageAggregation; this.creditUsed = creditUsed; this.effectiveLimit = effectiveLimit; this.effectivePrice = effectivePrice; @@ -179,18 +183,15 @@ public boolean getAccess() { } /** - * @return The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted. + * @return The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead). */ @JsonProperty("allocation") public Optional getAllocation() { return allocation; } - /** - * @return The type of allocation that is being used. - */ @JsonProperty("allocation_type") - public FeatureCompanyResponseDataAllocationType getAllocationType() { + public EntitlementValueType getAllocationType() { return allocationType; } @@ -222,11 +223,8 @@ public Optional> getCreditGrantDetails() { return creditGrantDetails; } - /** - * @return Reason for the credit grant - */ @JsonProperty("credit_grant_reason") - public Optional getCreditGrantReason() { + public Optional getCreditGrantReason() { return creditGrantReason; } @@ -235,6 +233,9 @@ public Optional getCreditRemaining() { return creditRemaining; } + /** + * @return Deprecated: Use credit_remaining instead. + */ @JsonProperty("credit_total") public Optional getCreditTotal() { return creditTotal; @@ -253,6 +254,11 @@ public Optional getCreditUsage() { return creditUsage; } + @JsonProperty("credit_usage_aggregation") + public Optional getCreditUsageAggregation() { + return creditUsageAggregation; + } + @JsonProperty("credit_used") public Optional getCreditUsed() { return creditUsed; @@ -293,7 +299,7 @@ public Optional getEntitlementSource() { } @JsonProperty("entitlement_type") - public String getEntitlementType() { + public EntitlementType getEntitlementType() { return entitlementType; } @@ -374,7 +380,7 @@ public Optional getPlanEntitlement() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -387,7 +393,7 @@ public Optional getSoftLimit() { } /** - * @return The amount of usage that has been consumed; a null value indicates that usage is not being measured. + * @return The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead). */ @JsonProperty("usage") public Optional getUsage() { @@ -424,6 +430,7 @@ private boolean equalTo(FeatureCompanyResponseData other) { && creditTotal.equals(other.creditTotal) && creditTypeIcon.equals(other.creditTypeIcon) && creditUsage.equals(other.creditUsage) + && creditUsageAggregation.equals(other.creditUsageAggregation) && creditUsed.equals(other.creditUsed) && effectiveLimit.equals(other.effectiveLimit) && effectivePrice.equals(other.effectivePrice) @@ -464,6 +471,7 @@ public int hashCode() { this.creditTotal, this.creditTypeIcon, this.creditUsage, + this.creditUsageAggregation, this.creditUsed, this.effectiveLimit, this.effectivePrice, @@ -507,10 +515,7 @@ public interface AccessStage { } public interface AllocationTypeStage { - /** - *

The type of allocation that is being used.

- */ - EntitlementIdStage allocationType(@NotNull FeatureCompanyResponseDataAllocationType allocationType); + EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType); } public interface EntitlementIdStage { @@ -518,14 +523,14 @@ public interface EntitlementIdStage { } public interface EntitlementTypeStage { - _FinalStage entitlementType(@NotNull String entitlementType); + _FinalStage entitlementType(@NotNull EntitlementType entitlementType); } public interface _FinalStage { FeatureCompanyResponseData build(); /** - *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted.

+ *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead).

*/ _FinalStage allocation(Optional allocation); @@ -554,17 +559,17 @@ public interface _FinalStage { _FinalStage creditGrantDetails(List creditGrantDetails); - /** - *

Reason for the credit grant

- */ - _FinalStage creditGrantReason(Optional creditGrantReason); + _FinalStage creditGrantReason(Optional creditGrantReason); - _FinalStage creditGrantReason(FeatureCompanyResponseDataCreditGrantReason creditGrantReason); + _FinalStage creditGrantReason(BillingCreditGrantReason creditGrantReason); _FinalStage creditRemaining(Optional creditRemaining); _FinalStage creditRemaining(Double creditRemaining); + /** + *

Deprecated: Use credit_remaining instead.

+ */ _FinalStage creditTotal(Optional creditTotal); _FinalStage creditTotal(Double creditTotal); @@ -580,6 +585,10 @@ public interface _FinalStage { _FinalStage creditUsage(CreditUsage creditUsage); + _FinalStage creditUsageAggregation(Optional creditUsageAggregation); + + _FinalStage creditUsageAggregation(CreditUsageAggregation creditUsageAggregation); + _FinalStage creditUsed(Optional creditUsed); _FinalStage creditUsed(Double creditUsed); @@ -674,9 +683,9 @@ public interface _FinalStage { _FinalStage planEntitlement(PlanEntitlementResponseData planEntitlement); - _FinalStage priceBehavior(Optional priceBehavior); + _FinalStage priceBehavior(Optional priceBehavior); - _FinalStage priceBehavior(String priceBehavior); + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); /** *

The soft limit for the feature usage. Available only for overage price behavior

@@ -686,7 +695,7 @@ public interface _FinalStage { _FinalStage softLimit(Integer softLimit); /** - *

The amount of usage that has been consumed; a null value indicates that usage is not being measured.

+ *

The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead).

*/ _FinalStage usage(Optional usage); @@ -702,11 +711,11 @@ public static final class Builder implements AccessStage, AllocationTypeStage, EntitlementIdStage, EntitlementTypeStage, _FinalStage { private boolean access; - private FeatureCompanyResponseDataAllocationType allocationType; + private EntitlementValueType allocationType; private String entitlementId; - private String entitlementType; + private EntitlementType entitlementType; private Optional yearlyUsageBasedPrice = Optional.empty(); @@ -714,7 +723,7 @@ public static final class Builder private Optional softLimit = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional planEntitlement = Optional.empty(); @@ -748,6 +757,8 @@ public static final class Builder private Optional creditUsed = Optional.empty(); + private Optional creditUsageAggregation = Optional.empty(); + private Optional creditUsage = Optional.empty(); private Optional creditTypeIcon = Optional.empty(); @@ -756,7 +767,7 @@ public static final class Builder private Optional creditRemaining = Optional.empty(); - private Optional creditGrantReason = Optional.empty(); + private Optional creditGrantReason = Optional.empty(); private Optional> creditGrantDetails = Optional.empty(); @@ -790,6 +801,7 @@ public Builder from(FeatureCompanyResponseData other) { creditTotal(other.getCreditTotal()); creditTypeIcon(other.getCreditTypeIcon()); creditUsage(other.getCreditUsage()); + creditUsageAggregation(other.getCreditUsageAggregation()); creditUsed(other.getCreditUsed()); effectiveLimit(other.getEffectiveLimit()); effectivePrice(other.getEffectivePrice()); @@ -827,14 +839,9 @@ public AllocationTypeStage access(boolean access) { return this; } - /** - *

The type of allocation that is being used.

- *

The type of allocation that is being used.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override @JsonSetter("allocation_type") - public EntitlementIdStage allocationType(@NotNull FeatureCompanyResponseDataAllocationType allocationType) { + public EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType) { this.allocationType = Objects.requireNonNull(allocationType, "allocationType must not be null"); return this; } @@ -848,7 +855,7 @@ public EntitlementTypeStage entitlementId(@NotNull String entitlementId) { @java.lang.Override @JsonSetter("entitlement_type") - public _FinalStage entitlementType(@NotNull String entitlementType) { + public _FinalStage entitlementType(@NotNull EntitlementType entitlementType) { this.entitlementType = Objects.requireNonNull(entitlementType, "entitlementType must not be null"); return this; } @@ -867,7 +874,7 @@ public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageB } /** - *

The amount of usage that has been consumed; a null value indicates that usage is not being measured.

+ *

The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead).

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

The amount of usage that has been consumed; a null value indicates that usage is not being measured.

+ *

The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead).

*/ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) @@ -907,14 +914,14 @@ public _FinalStage softLimit(Optional softLimit) { } @java.lang.Override - public _FinalStage priceBehavior(String priceBehavior) { + 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) { + public _FinalStage priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } @@ -1197,6 +1204,19 @@ public _FinalStage creditUsed(Optional creditUsed) { return this; } + @java.lang.Override + public _FinalStage creditUsageAggregation(CreditUsageAggregation creditUsageAggregation) { + this.creditUsageAggregation = Optional.ofNullable(creditUsageAggregation); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_usage_aggregation", nulls = Nulls.SKIP) + public _FinalStage creditUsageAggregation(Optional creditUsageAggregation) { + this.creditUsageAggregation = creditUsageAggregation; + return this; + } + @java.lang.Override public _FinalStage creditUsage(CreditUsage creditUsage) { this.creditUsage = Optional.ofNullable(creditUsage); @@ -1230,12 +1250,19 @@ public _FinalStage creditTypeIcon(Optional creditTypeIcon) { return this; } + /** + *

Deprecated: Use credit_remaining instead.

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

Deprecated: Use credit_remaining instead.

+ */ @java.lang.Override @JsonSetter(value = "credit_total", nulls = Nulls.SKIP) public _FinalStage creditTotal(Optional creditTotal) { @@ -1256,22 +1283,15 @@ public _FinalStage creditRemaining(Optional creditRemaining) { return this; } - /** - *

Reason for the credit grant

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

Reason for the credit grant

- */ @java.lang.Override @JsonSetter(value = "credit_grant_reason", nulls = Nulls.SKIP) - public _FinalStage creditGrantReason(Optional creditGrantReason) { + public _FinalStage creditGrantReason(Optional creditGrantReason) { this.creditGrantReason = creditGrantReason; return this; } @@ -1349,7 +1369,7 @@ public _FinalStage company(Optional company) { } /** - *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted.

+ *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead).

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

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted.

+ *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead).

*/ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) @@ -1384,6 +1404,7 @@ public FeatureCompanyResponseData build() { creditTotal, creditTypeIcon, creditUsage, + creditUsageAggregation, creditUsed, effectiveLimit, effectivePrice, diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyResponseDataAllocationType.java b/src/main/java/com/schematic/api/types/FeatureCompanyResponseDataAllocationType.java deleted file mode 100644 index 33511cc..0000000 --- a/src/main/java/com/schematic/api/types/FeatureCompanyResponseDataAllocationType.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * 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 FeatureCompanyResponseDataAllocationType { - public static final FeatureCompanyResponseDataAllocationType NUMERIC = - new FeatureCompanyResponseDataAllocationType(Value.NUMERIC, "numeric"); - - public static final FeatureCompanyResponseDataAllocationType TRAIT = - new FeatureCompanyResponseDataAllocationType(Value.TRAIT, "trait"); - - public static final FeatureCompanyResponseDataAllocationType BOOLEAN = - new FeatureCompanyResponseDataAllocationType(Value.BOOLEAN, "boolean"); - - public static final FeatureCompanyResponseDataAllocationType UNLIMITED = - new FeatureCompanyResponseDataAllocationType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - FeatureCompanyResponseDataAllocationType(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 FeatureCompanyResponseDataAllocationType - && this.string.equals(((FeatureCompanyResponseDataAllocationType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static FeatureCompanyResponseDataAllocationType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "unlimited": - return UNLIMITED; - default: - return new FeatureCompanyResponseDataAllocationType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyResponseDataCreditGrantReason.java b/src/main/java/com/schematic/api/types/FeatureCompanyResponseDataCreditGrantReason.java deleted file mode 100644 index 8482230..0000000 --- a/src/main/java/com/schematic/api/types/FeatureCompanyResponseDataCreditGrantReason.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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 FeatureCompanyResponseDataCreditGrantReason { - public static final FeatureCompanyResponseDataCreditGrantReason PURCHASED = - new FeatureCompanyResponseDataCreditGrantReason(Value.PURCHASED, "purchased"); - - public static final FeatureCompanyResponseDataCreditGrantReason PLAN = - new FeatureCompanyResponseDataCreditGrantReason(Value.PLAN, "plan"); - - public static final FeatureCompanyResponseDataCreditGrantReason FREE = - new FeatureCompanyResponseDataCreditGrantReason(Value.FREE, "free"); - - private final Value value; - - private final String string; - - FeatureCompanyResponseDataCreditGrantReason(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 FeatureCompanyResponseDataCreditGrantReason - && this.string.equals(((FeatureCompanyResponseDataCreditGrantReason) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PURCHASED: - return visitor.visitPurchased(); - case PLAN: - return visitor.visitPlan(); - case FREE: - return visitor.visitFree(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static FeatureCompanyResponseDataCreditGrantReason valueOf(String value) { - switch (value) { - case "purchased": - return PURCHASED; - case "plan": - return PLAN; - case "free": - return FREE; - default: - return new FeatureCompanyResponseDataCreditGrantReason(Value.UNKNOWN, value); - } - } - - public enum Value { - FREE, - - PLAN, - - PURCHASED, - - UNKNOWN - } - - public interface Visitor { - T visitFree(); - - T visitPlan(); - - T visitPurchased(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java b/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java index 4935055..bfc7580 100644 --- a/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java @@ -26,13 +26,13 @@ public final class FeatureCompanyUserResponseData { private final Optional allocation; - private final FeatureCompanyUserResponseDataAllocationType allocationType; + private final EntitlementValueType allocationType; private final Optional company; private final String entitlementId; - private final String entitlementType; + private final EntitlementType entitlementType; private final Optional feature; @@ -53,10 +53,10 @@ public final class FeatureCompanyUserResponseData { private FeatureCompanyUserResponseData( boolean access, Optional allocation, - FeatureCompanyUserResponseDataAllocationType allocationType, + EntitlementValueType allocationType, Optional company, String entitlementId, - String entitlementType, + EntitlementType entitlementType, Optional feature, Optional metricResetAt, Optional monthReset, @@ -97,11 +97,8 @@ public Optional getAllocation() { return allocation; } - /** - * @return The type of allocation that is being used. - */ @JsonProperty("allocation_type") - public FeatureCompanyUserResponseDataAllocationType getAllocationType() { + public EntitlementValueType getAllocationType() { return allocationType; } @@ -116,7 +113,7 @@ public String getEntitlementId() { } @JsonProperty("entitlement_type") - public String getEntitlementType() { + public EntitlementType getEntitlementType() { return entitlementType; } @@ -231,10 +228,7 @@ public interface AccessStage { } public interface AllocationTypeStage { - /** - *

The type of allocation that is being used.

- */ - EntitlementIdStage allocationType(@NotNull FeatureCompanyUserResponseDataAllocationType allocationType); + EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType); } public interface EntitlementIdStage { @@ -242,7 +236,7 @@ public interface EntitlementIdStage { } public interface EntitlementTypeStage { - _FinalStage entitlementType(@NotNull String entitlementType); + _FinalStage entitlementType(@NotNull EntitlementType entitlementType); } public interface _FinalStage { @@ -305,11 +299,11 @@ public static final class Builder implements AccessStage, AllocationTypeStage, EntitlementIdStage, EntitlementTypeStage, _FinalStage { private boolean access; - private FeatureCompanyUserResponseDataAllocationType allocationType; + private EntitlementValueType allocationType; private String entitlementId; - private String entitlementType; + private EntitlementType entitlementType; private Optional user = Optional.empty(); @@ -364,14 +358,9 @@ public AllocationTypeStage access(boolean access) { return this; } - /** - *

The type of allocation that is being used.

- *

The type of allocation that is being used.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override @JsonSetter("allocation_type") - public EntitlementIdStage allocationType(@NotNull FeatureCompanyUserResponseDataAllocationType allocationType) { + public EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType) { this.allocationType = Objects.requireNonNull(allocationType, "allocationType must not be null"); return this; } @@ -385,7 +374,7 @@ public EntitlementTypeStage entitlementId(@NotNull String entitlementId) { @java.lang.Override @JsonSetter("entitlement_type") - public _FinalStage entitlementType(@NotNull String entitlementType) { + public _FinalStage entitlementType(@NotNull EntitlementType entitlementType) { this.entitlementType = Objects.requireNonNull(entitlementType, "entitlementType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java b/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java index 0127ee2..43c67d7 100644 --- a/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java @@ -32,7 +32,7 @@ public final class FeatureDetailResponseData { private final Optional eventSummary; - private final String featureType; + private final FeatureType featureType; private final List flags; @@ -40,7 +40,7 @@ public final class FeatureDetailResponseData { private final String id; - private final Optional lifecyclePhase; + private final Optional lifecyclePhase; private final Optional maintainerId; @@ -65,11 +65,11 @@ private FeatureDetailResponseData( String description, Optional eventSubtype, Optional eventSummary, - String featureType, + FeatureType featureType, List flags, String icon, String id, - Optional lifecyclePhase, + Optional lifecyclePhase, Optional maintainerId, String name, List plans, @@ -120,7 +120,7 @@ public Optional getEventSummary() { } @JsonProperty("feature_type") - public String getFeatureType() { + public FeatureType getFeatureType() { return featureType; } @@ -140,7 +140,7 @@ public String getId() { } @JsonProperty("lifecycle_phase") - public Optional getLifecyclePhase() { + public Optional getLifecyclePhase() { return lifecyclePhase; } @@ -257,7 +257,7 @@ public interface DescriptionStage { } public interface FeatureTypeStage { - IconStage featureType(@NotNull String featureType); + IconStage featureType(@NotNull FeatureType featureType); } public interface IconStage { @@ -293,9 +293,9 @@ public interface _FinalStage { _FinalStage addAllFlags(List flags); - _FinalStage lifecyclePhase(Optional lifecyclePhase); + _FinalStage lifecyclePhase(Optional lifecyclePhase); - _FinalStage lifecyclePhase(String lifecyclePhase); + _FinalStage lifecyclePhase(FeatureLifecyclePhase lifecyclePhase); _FinalStage maintainerId(Optional maintainerId); @@ -338,7 +338,7 @@ public static final class Builder private String description; - private String featureType; + private FeatureType featureType; private String icon; @@ -360,7 +360,7 @@ public static final class Builder private Optional maintainerId = Optional.empty(); - private Optional lifecyclePhase = Optional.empty(); + private Optional lifecyclePhase = Optional.empty(); private List flags = new ArrayList<>(); @@ -411,7 +411,7 @@ public FeatureTypeStage description(@NotNull String description) { @java.lang.Override @JsonSetter("feature_type") - public IconStage featureType(@NotNull String featureType) { + public IconStage featureType(@NotNull FeatureType featureType) { this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); return this; } @@ -534,14 +534,14 @@ public _FinalStage maintainerId(Optional maintainerId) { } @java.lang.Override - public _FinalStage lifecyclePhase(String lifecyclePhase) { + 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) { + public _FinalStage lifecyclePhase(Optional lifecyclePhase) { this.lifecyclePhase = lifecyclePhase; return this; } diff --git a/src/main/java/com/schematic/api/types/FeatureEntitlement.java b/src/main/java/com/schematic/api/types/FeatureEntitlement.java new file mode 100644 index 0000000..2b4958c --- /dev/null +++ b/src/main/java/com/schematic/api/types/FeatureEntitlement.java @@ -0,0 +1,679 @@ +/** + * 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 = FeatureEntitlement.Builder.class) +public final class FeatureEntitlement { + private final Optional allocation; + + private final Optional creditId; + + private final Optional creditRemaining; + + private final Optional creditTotal; + + private final Optional creditUsed; + + private final Optional eventName; + + private final String featureId; + + private final String featureKey; + + private final Optional metricPeriod; + + private final Optional metricResetAt; + + private final Optional monthReset; + + private final Optional softLimit; + + private final Optional usage; + + private final EntitlementValueType valueType; + + private final Map additionalProperties; + + private FeatureEntitlement( + Optional allocation, + Optional creditId, + Optional creditRemaining, + Optional creditTotal, + Optional creditUsed, + Optional eventName, + String featureId, + String featureKey, + Optional metricPeriod, + Optional metricResetAt, + Optional monthReset, + Optional softLimit, + Optional usage, + EntitlementValueType valueType, + Map additionalProperties) { + this.allocation = allocation; + this.creditId = creditId; + this.creditRemaining = creditRemaining; + this.creditTotal = creditTotal; + this.creditUsed = creditUsed; + this.eventName = eventName; + this.featureId = featureId; + this.featureKey = featureKey; + this.metricPeriod = metricPeriod; + this.metricResetAt = metricResetAt; + this.monthReset = monthReset; + this.softLimit = softLimit; + this.usage = usage; + this.valueType = valueType; + this.additionalProperties = additionalProperties; + } + + /** + * @return If the company has a numeric entitlement for this feature, the allocated amount + */ + @JsonProperty("allocation") + public Optional getAllocation() { + return allocation; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the ID of the credit + */ + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the remaining credit amount + */ + @JsonProperty("credit_remaining") + public Optional getCreditRemaining() { + return creditRemaining; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the total credit amount + */ + @JsonProperty("credit_total") + public Optional getCreditTotal() { + return creditTotal; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the amount of credit used + */ + @JsonProperty("credit_used") + public Optional getCreditUsed() { + return creditUsed; + } + + /** + * @return If the feature is event-based, the name of the event tracked for usage + */ + @JsonProperty("event_name") + public Optional getEventName() { + return eventName; + } + + /** + * @return The ID of the feature + */ + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + /** + * @return The key of the flag associated with the feature + */ + @JsonProperty("feature_key") + public String getFeatureKey() { + return featureKey; + } + + /** + * @return For event-based feature entitlements, the period over which usage is tracked + */ + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + /** + * @return For event-based feature entitlements, when the usage period will reset + */ + @JsonProperty("metric_reset_at") + public Optional getMetricResetAt() { + return metricResetAt; + } + + /** + * @return For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle + */ + @JsonProperty("month_reset") + public Optional getMonthReset() { + return monthReset; + } + + /** + * @return For usage-based pricing, the soft limit for overage charges or the next tier boundary + */ + @JsonProperty("soft_limit") + public Optional getSoftLimit() { + return softLimit; + } + + /** + * @return If the company has a numeric entitlement for this feature, the current usage amount + */ + @JsonProperty("usage") + public Optional getUsage() { + return usage; + } + + @JsonProperty("value_type") + public EntitlementValueType getValueType() { + return valueType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureEntitlement && equalTo((FeatureEntitlement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureEntitlement other) { + return allocation.equals(other.allocation) + && creditId.equals(other.creditId) + && creditRemaining.equals(other.creditRemaining) + && creditTotal.equals(other.creditTotal) + && creditUsed.equals(other.creditUsed) + && eventName.equals(other.eventName) + && featureId.equals(other.featureId) + && featureKey.equals(other.featureKey) + && metricPeriod.equals(other.metricPeriod) + && metricResetAt.equals(other.metricResetAt) + && monthReset.equals(other.monthReset) + && softLimit.equals(other.softLimit) + && usage.equals(other.usage) + && valueType.equals(other.valueType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allocation, + this.creditId, + this.creditRemaining, + this.creditTotal, + this.creditUsed, + this.eventName, + this.featureId, + this.featureKey, + this.metricPeriod, + this.metricResetAt, + this.monthReset, + this.softLimit, + this.usage, + this.valueType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeatureIdStage builder() { + return new Builder(); + } + + public interface FeatureIdStage { + /** + *

The ID of the feature

+ */ + FeatureKeyStage featureId(@NotNull String featureId); + + Builder from(FeatureEntitlement other); + } + + public interface FeatureKeyStage { + /** + *

The key of the flag associated with the feature

+ */ + ValueTypeStage featureKey(@NotNull String featureKey); + } + + public interface ValueTypeStage { + _FinalStage valueType(@NotNull EntitlementValueType valueType); + } + + public interface _FinalStage { + FeatureEntitlement build(); + + /** + *

If the company has a numeric entitlement for this feature, the allocated amount

+ */ + _FinalStage allocation(Optional allocation); + + _FinalStage allocation(Integer allocation); + + /** + *

If the company has a credit-based entitlement for this feature, the ID of the credit

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

If the company has a credit-based entitlement for this feature, the remaining credit amount

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

If the company has a credit-based entitlement for this feature, the total credit amount

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

If the company has a credit-based entitlement for this feature, the amount of credit used

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

If the feature is event-based, the name of the event tracked for usage

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

For event-based feature entitlements, the period over which usage is tracked

+ */ + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(FeatureEntitlementMetricPeriod metricPeriod); + + /** + *

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

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

For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle

+ */ + _FinalStage monthReset(Optional monthReset); + + _FinalStage monthReset(FeatureEntitlementMonthReset monthReset); + + /** + *

For usage-based pricing, the soft limit for overage charges or the next tier boundary

+ */ + _FinalStage softLimit(Optional softLimit); + + _FinalStage softLimit(Integer softLimit); + + /** + *

If the company has a numeric entitlement for this feature, the current usage amount

+ */ + _FinalStage usage(Optional usage); + + _FinalStage usage(Integer usage); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeatureIdStage, FeatureKeyStage, ValueTypeStage, _FinalStage { + private String featureId; + + private String featureKey; + + private EntitlementValueType valueType; + + private Optional usage = Optional.empty(); + + private Optional softLimit = Optional.empty(); + + private Optional monthReset = Optional.empty(); + + private Optional metricResetAt = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional eventName = Optional.empty(); + + private Optional creditUsed = Optional.empty(); + + private Optional creditTotal = Optional.empty(); + + private Optional creditRemaining = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional allocation = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureEntitlement other) { + allocation(other.getAllocation()); + creditId(other.getCreditId()); + creditRemaining(other.getCreditRemaining()); + creditTotal(other.getCreditTotal()); + creditUsed(other.getCreditUsed()); + eventName(other.getEventName()); + featureId(other.getFeatureId()); + featureKey(other.getFeatureKey()); + metricPeriod(other.getMetricPeriod()); + metricResetAt(other.getMetricResetAt()); + monthReset(other.getMonthReset()); + softLimit(other.getSoftLimit()); + usage(other.getUsage()); + valueType(other.getValueType()); + return this; + } + + /** + *

The ID of the feature

+ *

The ID of the feature

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

The key of the flag associated with the feature

+ *

The key of the flag associated with the feature

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("feature_key") + public ValueTypeStage featureKey(@NotNull String featureKey) { + this.featureKey = Objects.requireNonNull(featureKey, "featureKey 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; + } + + /** + *

If the company has a numeric entitlement for this feature, the current usage amount

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

If the company has a numeric entitlement for this feature, the current usage amount

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

For usage-based pricing, the soft limit for overage charges or the next tier boundary

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

For usage-based pricing, the soft limit for overage charges or the next tier boundary

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

For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle

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

For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle

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

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

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

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

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

For event-based feature entitlements, the period over which usage is tracked

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

For event-based feature entitlements, the period over which usage is tracked

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

If the feature is event-based, the name of the event tracked for usage

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

If the feature is event-based, the name of the event tracked for usage

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

If the company has a credit-based entitlement for this feature, the amount of credit used

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

If the company has a credit-based entitlement for this feature, the amount of credit used

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

If the company has a credit-based entitlement for this feature, the total credit amount

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

If the company has a credit-based entitlement for this feature, the total credit amount

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

If the company has a credit-based entitlement for this feature, the remaining credit amount

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

If the company has a credit-based entitlement for this feature, the remaining credit amount

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

If the company has a credit-based entitlement for this feature, the ID of the credit

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

If the company has a credit-based entitlement for this feature, the ID of the credit

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

If the company has a numeric entitlement for this feature, the allocated amount

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

If the company has a numeric entitlement for this feature, the allocated amount

+ */ + @java.lang.Override + @JsonSetter(value = "allocation", nulls = Nulls.SKIP) + public _FinalStage allocation(Optional allocation) { + this.allocation = allocation; + return this; + } + + @java.lang.Override + public FeatureEntitlement build() { + return new FeatureEntitlement( + allocation, + creditId, + creditRemaining, + creditTotal, + creditUsed, + eventName, + featureId, + featureKey, + metricPeriod, + metricResetAt, + monthReset, + softLimit, + usage, + valueType, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/FeatureEntitlementMetricPeriod.java b/src/main/java/com/schematic/api/types/FeatureEntitlementMetricPeriod.java new file mode 100644 index 0000000..3cddbbb --- /dev/null +++ b/src/main/java/com/schematic/api/types/FeatureEntitlementMetricPeriod.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class FeatureEntitlementMetricPeriod { + public static final FeatureEntitlementMetricPeriod CURRENT_DAY = + new FeatureEntitlementMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final FeatureEntitlementMetricPeriod ALL_TIME = + new FeatureEntitlementMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final FeatureEntitlementMetricPeriod CURRENT_WEEK = + new FeatureEntitlementMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final FeatureEntitlementMetricPeriod CURRENT_MONTH = + new FeatureEntitlementMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + FeatureEntitlementMetricPeriod(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 FeatureEntitlementMetricPeriod + && this.string.equals(((FeatureEntitlementMetricPeriod) 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 FeatureEntitlementMetricPeriod 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 FeatureEntitlementMetricPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_DAY, + + CURRENT_MONTH, + + CURRENT_WEEK, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentDay(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.java b/src/main/java/com/schematic/api/types/FeatureEntitlementMonthReset.java similarity index 52% rename from src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.java rename to src/main/java/com/schematic/api/types/FeatureEntitlementMonthReset.java index 4659ac1..b07e479 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantRequestBodyResetStart.java +++ b/src/main/java/com/schematic/api/types/FeatureEntitlementMonthReset.java @@ -1,23 +1,23 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateBillingPlanCreditGrantRequestBodyResetStart { - public static final UpdateBillingPlanCreditGrantRequestBodyResetStart FIRST_OF_MONTH = - new UpdateBillingPlanCreditGrantRequestBodyResetStart(Value.FIRST_OF_MONTH, "first_of_month"); +public final class FeatureEntitlementMonthReset { + public static final FeatureEntitlementMonthReset FIRST_OF_MONTH = + new FeatureEntitlementMonthReset(Value.FIRST_OF_MONTH, "first_of_month"); - public static final UpdateBillingPlanCreditGrantRequestBodyResetStart BILLING_PERIOD = - new UpdateBillingPlanCreditGrantRequestBodyResetStart(Value.BILLING_PERIOD, "billing_period"); + public static final FeatureEntitlementMonthReset BILLING_CYCLE = + new FeatureEntitlementMonthReset(Value.BILLING_CYCLE, "billing_cycle"); private final Value value; private final String string; - UpdateBillingPlanCreditGrantRequestBodyResetStart(Value value, String string) { + FeatureEntitlementMonthReset(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +35,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UpdateBillingPlanCreditGrantRequestBodyResetStart - && this.string.equals(((UpdateBillingPlanCreditGrantRequestBodyResetStart) other).string)); + || (other instanceof FeatureEntitlementMonthReset + && this.string.equals(((FeatureEntitlementMonthReset) other).string)); } @java.lang.Override @@ -48,8 +48,8 @@ public T visit(Visitor visitor) { switch (value) { case FIRST_OF_MONTH: return visitor.visitFirstOfMonth(); - case BILLING_PERIOD: - return visitor.visitBillingPeriod(); + case BILLING_CYCLE: + return visitor.visitBillingCycle(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -57,30 +57,30 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateBillingPlanCreditGrantRequestBodyResetStart valueOf(String value) { + public static FeatureEntitlementMonthReset valueOf(String value) { switch (value) { case "first_of_month": return FIRST_OF_MONTH; - case "billing_period": - return BILLING_PERIOD; + case "billing_cycle": + return BILLING_CYCLE; default: - return new UpdateBillingPlanCreditGrantRequestBodyResetStart(Value.UNKNOWN, value); + return new FeatureEntitlementMonthReset(Value.UNKNOWN, value); } } public enum Value { - BILLING_PERIOD, - FIRST_OF_MONTH, + BILLING_CYCLE, + UNKNOWN } public interface Visitor { - T visitBillingPeriod(); - T visitFirstOfMonth(); + T visitBillingCycle(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CreateFeatureRequestBodyLifecyclePhase.java b/src/main/java/com/schematic/api/types/FeatureLifecyclePhase.java similarity index 58% rename from src/main/java/com/schematic/api/resources/features/types/CreateFeatureRequestBodyLifecyclePhase.java rename to src/main/java/com/schematic/api/types/FeatureLifecyclePhase.java index 4810c38..dec872e 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CreateFeatureRequestBodyLifecyclePhase.java +++ b/src/main/java/com/schematic/api/types/FeatureLifecyclePhase.java @@ -1,44 +1,36 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.features.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateFeatureRequestBodyLifecyclePhase { - public static final CreateFeatureRequestBodyLifecyclePhase GA = - new CreateFeatureRequestBodyLifecyclePhase(Value.GA, "ga"); +public final class FeatureLifecyclePhase { + public static final FeatureLifecyclePhase GA = new FeatureLifecyclePhase(Value.GA, "ga"); - public static final CreateFeatureRequestBodyLifecyclePhase ALPHA = - new CreateFeatureRequestBodyLifecyclePhase(Value.ALPHA, "alpha"); + public static final FeatureLifecyclePhase ALPHA = new FeatureLifecyclePhase(Value.ALPHA, "alpha"); - public static final CreateFeatureRequestBodyLifecyclePhase BETA = - new CreateFeatureRequestBodyLifecyclePhase(Value.BETA, "beta"); + public static final FeatureLifecyclePhase BETA = new FeatureLifecyclePhase(Value.BETA, "beta"); - public static final CreateFeatureRequestBodyLifecyclePhase INACTIVE = - new CreateFeatureRequestBodyLifecyclePhase(Value.INACTIVE, "inactive"); + public static final FeatureLifecyclePhase INACTIVE = new FeatureLifecyclePhase(Value.INACTIVE, "inactive"); - public static final CreateFeatureRequestBodyLifecyclePhase ADD_ON = - new CreateFeatureRequestBodyLifecyclePhase(Value.ADD_ON, "add_on"); + public static final FeatureLifecyclePhase ADD_ON = new FeatureLifecyclePhase(Value.ADD_ON, "add_on"); - public static final CreateFeatureRequestBodyLifecyclePhase DEPRECATED = - new CreateFeatureRequestBodyLifecyclePhase(Value.DEPRECATED, "deprecated"); + public static final FeatureLifecyclePhase DEPRECATED = new FeatureLifecyclePhase(Value.DEPRECATED, "deprecated"); - public static final CreateFeatureRequestBodyLifecyclePhase LEGACY = - new CreateFeatureRequestBodyLifecyclePhase(Value.LEGACY, "legacy"); + public static final FeatureLifecyclePhase LEGACY = new FeatureLifecyclePhase(Value.LEGACY, "legacy"); - public static final CreateFeatureRequestBodyLifecyclePhase INTERNAL_TESTING = - new CreateFeatureRequestBodyLifecyclePhase(Value.INTERNAL_TESTING, "internal_testing"); + public static final FeatureLifecyclePhase INTERNAL_TESTING = + new FeatureLifecyclePhase(Value.INTERNAL_TESTING, "internal_testing"); - public static final CreateFeatureRequestBodyLifecyclePhase IN_PLAN = - new CreateFeatureRequestBodyLifecyclePhase(Value.IN_PLAN, "in_plan"); + public static final FeatureLifecyclePhase IN_PLAN = new FeatureLifecyclePhase(Value.IN_PLAN, "in_plan"); private final Value value; private final String string; - CreateFeatureRequestBodyLifecyclePhase(Value value, String string) { + FeatureLifecyclePhase(Value value, String string) { this.value = value; this.string = string; } @@ -56,8 +48,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateFeatureRequestBodyLifecyclePhase - && this.string.equals(((CreateFeatureRequestBodyLifecyclePhase) other).string)); + || (other instanceof FeatureLifecyclePhase + && this.string.equals(((FeatureLifecyclePhase) other).string)); } @java.lang.Override @@ -92,7 +84,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateFeatureRequestBodyLifecyclePhase valueOf(String value) { + public static FeatureLifecyclePhase valueOf(String value) { switch (value) { case "ga": return GA; @@ -113,7 +105,7 @@ public static CreateFeatureRequestBodyLifecyclePhase valueOf(String value) { case "in_plan": return IN_PLAN; default: - return new CreateFeatureRequestBodyLifecyclePhase(Value.UNKNOWN, value); + return new FeatureLifecyclePhase(Value.UNKNOWN, value); } } @@ -128,10 +120,10 @@ public enum Value { GA, - IN_PLAN, - INACTIVE, + IN_PLAN, + INTERNAL_TESTING, LEGACY, @@ -150,10 +142,10 @@ public interface Visitor { T visitGa(); - T visitInPlan(); - T visitInactive(); + T visitInPlan(); + T visitInternalTesting(); T visitLegacy(); diff --git a/src/main/java/com/schematic/api/types/FeatureResponseData.java b/src/main/java/com/schematic/api/types/FeatureResponseData.java index d084175..ab7b191 100644 --- a/src/main/java/com/schematic/api/types/FeatureResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureResponseData.java @@ -28,13 +28,13 @@ public final class FeatureResponseData { private final Optional eventSubtype; - private final String featureType; + private final FeatureType featureType; private final String icon; private final String id; - private final Optional lifecyclePhase; + private final Optional lifecyclePhase; private final Optional maintainerId; @@ -54,10 +54,10 @@ private FeatureResponseData( OffsetDateTime createdAt, String description, Optional eventSubtype, - String featureType, + FeatureType featureType, String icon, String id, - Optional lifecyclePhase, + Optional lifecyclePhase, Optional maintainerId, String name, Optional pluralName, @@ -97,7 +97,7 @@ public Optional getEventSubtype() { } @JsonProperty("feature_type") - public String getFeatureType() { + public FeatureType getFeatureType() { return featureType; } @@ -112,7 +112,7 @@ public String getId() { } @JsonProperty("lifecycle_phase") - public Optional getLifecyclePhase() { + public Optional getLifecyclePhase() { return lifecyclePhase; } @@ -211,7 +211,7 @@ public interface DescriptionStage { } public interface FeatureTypeStage { - IconStage featureType(@NotNull String featureType); + IconStage featureType(@NotNull FeatureType featureType); } public interface IconStage { @@ -237,9 +237,9 @@ public interface _FinalStage { _FinalStage eventSubtype(String eventSubtype); - _FinalStage lifecyclePhase(Optional lifecyclePhase); + _FinalStage lifecyclePhase(Optional lifecyclePhase); - _FinalStage lifecyclePhase(String lifecyclePhase); + _FinalStage lifecyclePhase(FeatureLifecyclePhase lifecyclePhase); _FinalStage maintainerId(Optional maintainerId); @@ -272,7 +272,7 @@ public static final class Builder private String description; - private String featureType; + private FeatureType featureType; private String icon; @@ -290,7 +290,7 @@ public static final class Builder private Optional maintainerId = Optional.empty(); - private Optional lifecyclePhase = Optional.empty(); + private Optional lifecyclePhase = Optional.empty(); private Optional eventSubtype = Optional.empty(); @@ -333,7 +333,7 @@ public FeatureTypeStage description(@NotNull String description) { @java.lang.Override @JsonSetter("feature_type") - public IconStage featureType(@NotNull String featureType) { + public IconStage featureType(@NotNull FeatureType featureType) { this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); return this; } @@ -419,14 +419,14 @@ public _FinalStage maintainerId(Optional maintainerId) { } @java.lang.Override - public _FinalStage lifecyclePhase(String lifecyclePhase) { + 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) { + public _FinalStage lifecyclePhase(Optional lifecyclePhase) { this.lifecyclePhase = lifecyclePhase; return this; } diff --git a/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureRequestBodyFeatureType.java b/src/main/java/com/schematic/api/types/FeatureType.java similarity index 61% rename from src/main/java/com/schematic/api/resources/features/types/UpdateFeatureRequestBodyFeatureType.java rename to src/main/java/com/schematic/api/types/FeatureType.java index 7c45ffa..e42c42c 100644 --- a/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureRequestBodyFeatureType.java +++ b/src/main/java/com/schematic/api/types/FeatureType.java @@ -1,26 +1,23 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.features.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateFeatureRequestBodyFeatureType { - public static final UpdateFeatureRequestBodyFeatureType TRAIT = - new UpdateFeatureRequestBodyFeatureType(Value.TRAIT, "trait"); +public final class FeatureType { + public static final FeatureType TRAIT = new FeatureType(Value.TRAIT, "trait"); - public static final UpdateFeatureRequestBodyFeatureType BOOLEAN = - new UpdateFeatureRequestBodyFeatureType(Value.BOOLEAN, "boolean"); + public static final FeatureType BOOLEAN = new FeatureType(Value.BOOLEAN, "boolean"); - public static final UpdateFeatureRequestBodyFeatureType EVENT = - new UpdateFeatureRequestBodyFeatureType(Value.EVENT, "event"); + public static final FeatureType EVENT = new FeatureType(Value.EVENT, "event"); private final Value value; private final String string; - UpdateFeatureRequestBodyFeatureType(Value value, String string) { + FeatureType(Value value, String string) { this.value = value; this.string = string; } @@ -37,9 +34,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof UpdateFeatureRequestBodyFeatureType - && this.string.equals(((UpdateFeatureRequestBodyFeatureType) other).string)); + return (this == other) || (other instanceof FeatureType && this.string.equals(((FeatureType) other).string)); } @java.lang.Override @@ -62,7 +57,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateFeatureRequestBodyFeatureType valueOf(String value) { + public static FeatureType valueOf(String value) { switch (value) { case "trait": return TRAIT; @@ -71,7 +66,7 @@ public static UpdateFeatureRequestBodyFeatureType valueOf(String value) { case "event": return EVENT; default: - return new UpdateFeatureRequestBodyFeatureType(Value.UNKNOWN, value); + return new FeatureType(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java index a3bf021..f281348 100644 --- a/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java @@ -34,7 +34,7 @@ public final class FeatureUsageDataResponseData { private final String featureName; - private final String featureType; + private final FeatureType featureType; private final String hardLimit; @@ -63,7 +63,7 @@ private FeatureUsageDataResponseData( String entitlementValueType, String featureId, String featureName, - String featureType, + FeatureType featureType, String hardLimit, boolean hasAccess, Optional metricResetAt, @@ -124,7 +124,7 @@ public String getFeatureName() { } @JsonProperty("feature_type") - public String getFeatureType() { + public FeatureType getFeatureType() { return featureType; } @@ -252,7 +252,7 @@ public interface FeatureNameStage { } public interface FeatureTypeStage { - HardLimitStage featureType(@NotNull String featureType); + HardLimitStage featureType(@NotNull FeatureType featureType); } public interface HardLimitStage { @@ -323,7 +323,7 @@ public static final class Builder private String featureName; - private String featureType; + private FeatureType featureType; private String hardLimit; @@ -404,7 +404,7 @@ public FeatureTypeStage featureName(@NotNull String featureName) { @java.lang.Override @JsonSetter("feature_type") - public HardLimitStage featureType(@NotNull String featureType) { + public HardLimitStage featureType(@NotNull FeatureType featureType) { this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java new file mode 100644 index 0000000..c402af5 --- /dev/null +++ b/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java @@ -0,0 +1,259 @@ +/** + * 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 = FeatureUsageLegacyResponseData.Builder.class) +public final class FeatureUsageLegacyResponseData { + private final Optional allocation; + + private final Optional creditUsage; + + private final String entitlement; + + private final Optional feature; + + private final Optional metricResetAt; + + private final Optional usage; + + private final Map additionalProperties; + + private FeatureUsageLegacyResponseData( + Optional allocation, + Optional creditUsage, + String entitlement, + Optional feature, + Optional metricResetAt, + Optional usage, + Map additionalProperties) { + this.allocation = allocation; + this.creditUsage = creditUsage; + this.entitlement = entitlement; + this.feature = feature; + this.metricResetAt = metricResetAt; + this.usage = usage; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("Allocation") + public Optional getAllocation() { + return allocation; + } + + @JsonProperty("CreditUsage") + public Optional getCreditUsage() { + return creditUsage; + } + + @JsonProperty("Entitlement") + public String getEntitlement() { + return entitlement; + } + + @JsonProperty("Feature") + public Optional getFeature() { + return feature; + } + + @JsonProperty("MetricResetAt") + public Optional getMetricResetAt() { + return metricResetAt; + } + + @JsonProperty("Usage") + public Optional getUsage() { + return usage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureUsageLegacyResponseData && equalTo((FeatureUsageLegacyResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureUsageLegacyResponseData other) { + return allocation.equals(other.allocation) + && creditUsage.equals(other.creditUsage) + && entitlement.equals(other.entitlement) + && feature.equals(other.feature) + && metricResetAt.equals(other.metricResetAt) + && usage.equals(other.usage); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allocation, this.creditUsage, this.entitlement, this.feature, this.metricResetAt, this.usage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EntitlementStage builder() { + return new Builder(); + } + + public interface EntitlementStage { + _FinalStage entitlement(@NotNull String entitlement); + + Builder from(FeatureUsageLegacyResponseData other); + } + + public interface _FinalStage { + FeatureUsageLegacyResponseData build(); + + _FinalStage allocation(Optional allocation); + + _FinalStage allocation(Integer allocation); + + _FinalStage creditUsage(Optional creditUsage); + + _FinalStage creditUsage(CreditUsage creditUsage); + + _FinalStage feature(Optional feature); + + _FinalStage feature(FeatureView feature); + + _FinalStage metricResetAt(Optional metricResetAt); + + _FinalStage metricResetAt(OffsetDateTime metricResetAt); + + _FinalStage usage(Optional usage); + + _FinalStage usage(Integer usage); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EntitlementStage, _FinalStage { + private String entitlement; + + private Optional usage = Optional.empty(); + + private Optional metricResetAt = Optional.empty(); + + private Optional feature = Optional.empty(); + + private Optional creditUsage = Optional.empty(); + + private Optional allocation = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureUsageLegacyResponseData other) { + allocation(other.getAllocation()); + creditUsage(other.getCreditUsage()); + entitlement(other.getEntitlement()); + feature(other.getFeature()); + metricResetAt(other.getMetricResetAt()); + usage(other.getUsage()); + return this; + } + + @java.lang.Override + @JsonSetter("Entitlement") + public _FinalStage entitlement(@NotNull String entitlement) { + this.entitlement = Objects.requireNonNull(entitlement, "entitlement must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage usage(Integer usage) { + this.usage = Optional.ofNullable(usage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "Usage", nulls = Nulls.SKIP) + public _FinalStage usage(Optional usage) { + this.usage = usage; + return this; + } + + @java.lang.Override + public _FinalStage metricResetAt(OffsetDateTime metricResetAt) { + this.metricResetAt = Optional.ofNullable(metricResetAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "MetricResetAt", nulls = Nulls.SKIP) + public _FinalStage metricResetAt(Optional metricResetAt) { + this.metricResetAt = metricResetAt; + return this; + } + + @java.lang.Override + public _FinalStage feature(FeatureView feature) { + this.feature = Optional.ofNullable(feature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "Feature", nulls = Nulls.SKIP) + public _FinalStage feature(Optional feature) { + this.feature = feature; + return this; + } + + @java.lang.Override + public _FinalStage creditUsage(CreditUsage creditUsage) { + this.creditUsage = Optional.ofNullable(creditUsage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "CreditUsage", nulls = Nulls.SKIP) + public _FinalStage creditUsage(Optional creditUsage) { + this.creditUsage = creditUsage; + return this; + } + + @java.lang.Override + public _FinalStage allocation(Integer allocation) { + this.allocation = Optional.ofNullable(allocation); + return this; + } + + @java.lang.Override + @JsonSetter(value = "Allocation", nulls = Nulls.SKIP) + public _FinalStage allocation(Optional allocation) { + this.allocation = allocation; + return this; + } + + @java.lang.Override + public FeatureUsageLegacyResponseData build() { + return new FeatureUsageLegacyResponseData( + allocation, creditUsage, entitlement, feature, metricResetAt, usage, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java index 3c32ae7..335c5ea 100644 --- a/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java @@ -27,7 +27,7 @@ public final class FeatureUsageResponseData { private final Optional allocation; - private final FeatureUsageResponseDataAllocationType allocationType; + private final EntitlementValueType allocationType; private final Optional companyOverride; @@ -37,7 +37,7 @@ public final class FeatureUsageResponseData { private final Optional> creditGrantDetails; - private final Optional creditGrantReason; + private final Optional creditGrantReason; private final Optional creditRemaining; @@ -45,6 +45,8 @@ public final class FeatureUsageResponseData { private final Optional creditTypeIcon; + private final Optional creditUsageAggregation; + private final Optional creditUsed; private final Optional effectiveLimit; @@ -57,7 +59,7 @@ public final class FeatureUsageResponseData { private final Optional entitlementSource; - private final String entitlementType; + private final EntitlementType entitlementType; private final Optional feature; @@ -81,7 +83,7 @@ public final class FeatureUsageResponseData { private final Optional planEntitlement; - private final Optional priceBehavior; + private final Optional priceBehavior; private final Optional softLimit; @@ -94,22 +96,23 @@ public final class FeatureUsageResponseData { private FeatureUsageResponseData( boolean access, Optional allocation, - FeatureUsageResponseDataAllocationType allocationType, + EntitlementValueType allocationType, Optional companyOverride, Optional creditConsumptionRate, Optional> creditGrantCounts, Optional> creditGrantDetails, - Optional creditGrantReason, + Optional creditGrantReason, Optional creditRemaining, Optional creditTotal, Optional creditTypeIcon, + Optional creditUsageAggregation, Optional creditUsed, Optional effectiveLimit, Optional effectivePrice, Optional entitlementExpirationDate, String entitlementId, Optional entitlementSource, - String entitlementType, + EntitlementType entitlementType, Optional feature, Optional hasValidAllocation, Optional isUnlimited, @@ -121,7 +124,7 @@ private FeatureUsageResponseData( Optional period, Optional plan, Optional planEntitlement, - Optional priceBehavior, + Optional priceBehavior, Optional softLimit, Optional usage, Optional yearlyUsageBasedPrice, @@ -137,6 +140,7 @@ private FeatureUsageResponseData( this.creditRemaining = creditRemaining; this.creditTotal = creditTotal; this.creditTypeIcon = creditTypeIcon; + this.creditUsageAggregation = creditUsageAggregation; this.creditUsed = creditUsed; this.effectiveLimit = effectiveLimit; this.effectivePrice = effectivePrice; @@ -171,18 +175,15 @@ public boolean getAccess() { } /** - * @return The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted. + * @return The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead). */ @JsonProperty("allocation") public Optional getAllocation() { return allocation; } - /** - * @return The type of allocation that is being used. - */ @JsonProperty("allocation_type") - public FeatureUsageResponseDataAllocationType getAllocationType() { + public EntitlementValueType getAllocationType() { return allocationType; } @@ -209,11 +210,8 @@ public Optional> getCreditGrantDetails() { return creditGrantDetails; } - /** - * @return Reason for the credit grant - */ @JsonProperty("credit_grant_reason") - public Optional getCreditGrantReason() { + public Optional getCreditGrantReason() { return creditGrantReason; } @@ -222,6 +220,9 @@ public Optional getCreditRemaining() { return creditRemaining; } + /** + * @return Deprecated: Use credit_remaining instead. + */ @JsonProperty("credit_total") public Optional getCreditTotal() { return creditTotal; @@ -235,6 +236,11 @@ public Optional getCreditTypeIcon() { return creditTypeIcon; } + @JsonProperty("credit_usage_aggregation") + public Optional getCreditUsageAggregation() { + return creditUsageAggregation; + } + @JsonProperty("credit_used") public Optional getCreditUsed() { return creditUsed; @@ -275,7 +281,7 @@ public Optional getEntitlementSource() { } @JsonProperty("entitlement_type") - public String getEntitlementType() { + public EntitlementType getEntitlementType() { return entitlementType; } @@ -356,7 +362,7 @@ public Optional getPlanEntitlement() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -369,7 +375,7 @@ public Optional getSoftLimit() { } /** - * @return The amount of usage that has been consumed; a null value indicates that usage is not being measured. + * @return The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead). */ @JsonProperty("usage") public Optional getUsage() { @@ -404,6 +410,7 @@ private boolean equalTo(FeatureUsageResponseData other) { && creditRemaining.equals(other.creditRemaining) && creditTotal.equals(other.creditTotal) && creditTypeIcon.equals(other.creditTypeIcon) + && creditUsageAggregation.equals(other.creditUsageAggregation) && creditUsed.equals(other.creditUsed) && effectiveLimit.equals(other.effectiveLimit) && effectivePrice.equals(other.effectivePrice) @@ -442,6 +449,7 @@ public int hashCode() { this.creditRemaining, this.creditTotal, this.creditTypeIcon, + this.creditUsageAggregation, this.creditUsed, this.effectiveLimit, this.effectivePrice, @@ -485,10 +493,7 @@ public interface AccessStage { } public interface AllocationTypeStage { - /** - *

The type of allocation that is being used.

- */ - EntitlementIdStage allocationType(@NotNull FeatureUsageResponseDataAllocationType allocationType); + EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType); } public interface EntitlementIdStage { @@ -496,14 +501,14 @@ public interface EntitlementIdStage { } public interface EntitlementTypeStage { - _FinalStage entitlementType(@NotNull String entitlementType); + _FinalStage entitlementType(@NotNull EntitlementType entitlementType); } public interface _FinalStage { FeatureUsageResponseData build(); /** - *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted.

+ *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead).

*/ _FinalStage allocation(Optional allocation); @@ -528,17 +533,17 @@ public interface _FinalStage { _FinalStage creditGrantDetails(List creditGrantDetails); - /** - *

Reason for the credit grant

- */ - _FinalStage creditGrantReason(Optional creditGrantReason); + _FinalStage creditGrantReason(Optional creditGrantReason); - _FinalStage creditGrantReason(FeatureUsageResponseDataCreditGrantReason creditGrantReason); + _FinalStage creditGrantReason(BillingCreditGrantReason creditGrantReason); _FinalStage creditRemaining(Optional creditRemaining); _FinalStage creditRemaining(Double creditRemaining); + /** + *

Deprecated: Use credit_remaining instead.

+ */ _FinalStage creditTotal(Optional creditTotal); _FinalStage creditTotal(Double creditTotal); @@ -550,6 +555,10 @@ public interface _FinalStage { _FinalStage creditTypeIcon(String creditTypeIcon); + _FinalStage creditUsageAggregation(Optional creditUsageAggregation); + + _FinalStage creditUsageAggregation(CreditUsageAggregation creditUsageAggregation); + _FinalStage creditUsed(Optional creditUsed); _FinalStage creditUsed(Double creditUsed); @@ -644,9 +653,9 @@ public interface _FinalStage { _FinalStage planEntitlement(PlanEntitlementResponseData planEntitlement); - _FinalStage priceBehavior(Optional priceBehavior); + _FinalStage priceBehavior(Optional priceBehavior); - _FinalStage priceBehavior(String priceBehavior); + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); /** *

The soft limit for the feature usage. Available only for overage price behavior

@@ -656,7 +665,7 @@ public interface _FinalStage { _FinalStage softLimit(Integer softLimit); /** - *

The amount of usage that has been consumed; a null value indicates that usage is not being measured.

+ *

The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead).

*/ _FinalStage usage(Optional usage); @@ -672,11 +681,11 @@ public static final class Builder implements AccessStage, AllocationTypeStage, EntitlementIdStage, EntitlementTypeStage, _FinalStage { private boolean access; - private FeatureUsageResponseDataAllocationType allocationType; + private EntitlementValueType allocationType; private String entitlementId; - private String entitlementType; + private EntitlementType entitlementType; private Optional yearlyUsageBasedPrice = Optional.empty(); @@ -684,7 +693,7 @@ public static final class Builder private Optional softLimit = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional planEntitlement = Optional.empty(); @@ -718,13 +727,15 @@ public static final class Builder private Optional creditUsed = Optional.empty(); + private Optional creditUsageAggregation = Optional.empty(); + private Optional creditTypeIcon = Optional.empty(); private Optional creditTotal = Optional.empty(); private Optional creditRemaining = Optional.empty(); - private Optional creditGrantReason = Optional.empty(); + private Optional creditGrantReason = Optional.empty(); private Optional> creditGrantDetails = Optional.empty(); @@ -754,6 +765,7 @@ public Builder from(FeatureUsageResponseData other) { creditRemaining(other.getCreditRemaining()); creditTotal(other.getCreditTotal()); creditTypeIcon(other.getCreditTypeIcon()); + creditUsageAggregation(other.getCreditUsageAggregation()); creditUsed(other.getCreditUsed()); effectiveLimit(other.getEffectiveLimit()); effectivePrice(other.getEffectivePrice()); @@ -791,14 +803,9 @@ public AllocationTypeStage access(boolean access) { return this; } - /** - *

The type of allocation that is being used.

- *

The type of allocation that is being used.

- * @return Reference to {@code this} so that method calls can be chained together. - */ @java.lang.Override @JsonSetter("allocation_type") - public EntitlementIdStage allocationType(@NotNull FeatureUsageResponseDataAllocationType allocationType) { + public EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType) { this.allocationType = Objects.requireNonNull(allocationType, "allocationType must not be null"); return this; } @@ -812,7 +819,7 @@ public EntitlementTypeStage entitlementId(@NotNull String entitlementId) { @java.lang.Override @JsonSetter("entitlement_type") - public _FinalStage entitlementType(@NotNull String entitlementType) { + public _FinalStage entitlementType(@NotNull EntitlementType entitlementType) { this.entitlementType = Objects.requireNonNull(entitlementType, "entitlementType must not be null"); return this; } @@ -831,7 +838,7 @@ public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageB } /** - *

The amount of usage that has been consumed; a null value indicates that usage is not being measured.

+ *

The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead).

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

The amount of usage that has been consumed; a null value indicates that usage is not being measured.

+ *

The amount of usage that has been consumed; a null value indicates that usage is not being measured or that this is a credit-based entitlement (use credit_used instead).

*/ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) @@ -871,14 +878,14 @@ public _FinalStage softLimit(Optional softLimit) { } @java.lang.Override - public _FinalStage priceBehavior(String priceBehavior) { + 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) { + public _FinalStage priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } @@ -1161,6 +1168,19 @@ public _FinalStage creditUsed(Optional creditUsed) { return this; } + @java.lang.Override + public _FinalStage creditUsageAggregation(CreditUsageAggregation creditUsageAggregation) { + this.creditUsageAggregation = Optional.ofNullable(creditUsageAggregation); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_usage_aggregation", nulls = Nulls.SKIP) + public _FinalStage creditUsageAggregation(Optional creditUsageAggregation) { + this.creditUsageAggregation = creditUsageAggregation; + return this; + } + /** *

Icon identifier for the credit type

* @return Reference to {@code this} so that method calls can be chained together. @@ -1181,12 +1201,19 @@ public _FinalStage creditTypeIcon(Optional creditTypeIcon) { return this; } + /** + *

Deprecated: Use credit_remaining instead.

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

Deprecated: Use credit_remaining instead.

+ */ @java.lang.Override @JsonSetter(value = "credit_total", nulls = Nulls.SKIP) public _FinalStage creditTotal(Optional creditTotal) { @@ -1207,22 +1234,15 @@ public _FinalStage creditRemaining(Optional creditRemaining) { return this; } - /** - *

Reason for the credit grant

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

Reason for the credit grant

- */ @java.lang.Override @JsonSetter(value = "credit_grant_reason", nulls = Nulls.SKIP) - public _FinalStage creditGrantReason(Optional creditGrantReason) { + public _FinalStage creditGrantReason(Optional creditGrantReason) { this.creditGrantReason = creditGrantReason; return this; } @@ -1287,7 +1307,7 @@ public _FinalStage companyOverride(Optional company } /** - *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted.

+ *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead).

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

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted.

+ *

The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted or that this is a credit-based entitlement (use credit_remaining instead).

*/ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) @@ -1320,6 +1340,7 @@ public FeatureUsageResponseData build() { creditRemaining, creditTotal, creditTypeIcon, + creditUsageAggregation, creditUsed, effectiveLimit, effectivePrice, diff --git a/src/main/java/com/schematic/api/types/FeatureUsageResponseDataAllocationType.java b/src/main/java/com/schematic/api/types/FeatureUsageResponseDataAllocationType.java deleted file mode 100644 index 33f1b2d..0000000 --- a/src/main/java/com/schematic/api/types/FeatureUsageResponseDataAllocationType.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * 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 FeatureUsageResponseDataAllocationType { - public static final FeatureUsageResponseDataAllocationType NUMERIC = - new FeatureUsageResponseDataAllocationType(Value.NUMERIC, "numeric"); - - public static final FeatureUsageResponseDataAllocationType TRAIT = - new FeatureUsageResponseDataAllocationType(Value.TRAIT, "trait"); - - public static final FeatureUsageResponseDataAllocationType BOOLEAN = - new FeatureUsageResponseDataAllocationType(Value.BOOLEAN, "boolean"); - - public static final FeatureUsageResponseDataAllocationType UNLIMITED = - new FeatureUsageResponseDataAllocationType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - FeatureUsageResponseDataAllocationType(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 FeatureUsageResponseDataAllocationType - && this.string.equals(((FeatureUsageResponseDataAllocationType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static FeatureUsageResponseDataAllocationType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "unlimited": - return UNLIMITED; - default: - return new FeatureUsageResponseDataAllocationType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/types/FeatureUsageResponseDataCreditGrantReason.java b/src/main/java/com/schematic/api/types/FeatureUsageResponseDataCreditGrantReason.java deleted file mode 100644 index c12e8d6..0000000 --- a/src/main/java/com/schematic/api/types/FeatureUsageResponseDataCreditGrantReason.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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 FeatureUsageResponseDataCreditGrantReason { - public static final FeatureUsageResponseDataCreditGrantReason PURCHASED = - new FeatureUsageResponseDataCreditGrantReason(Value.PURCHASED, "purchased"); - - public static final FeatureUsageResponseDataCreditGrantReason PLAN = - new FeatureUsageResponseDataCreditGrantReason(Value.PLAN, "plan"); - - public static final FeatureUsageResponseDataCreditGrantReason FREE = - new FeatureUsageResponseDataCreditGrantReason(Value.FREE, "free"); - - private final Value value; - - private final String string; - - FeatureUsageResponseDataCreditGrantReason(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 FeatureUsageResponseDataCreditGrantReason - && this.string.equals(((FeatureUsageResponseDataCreditGrantReason) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PURCHASED: - return visitor.visitPurchased(); - case PLAN: - return visitor.visitPlan(); - case FREE: - return visitor.visitFree(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static FeatureUsageResponseDataCreditGrantReason valueOf(String value) { - switch (value) { - case "purchased": - return PURCHASED; - case "plan": - return PLAN; - case "free": - return FREE; - default: - return new FeatureUsageResponseDataCreditGrantReason(Value.UNKNOWN, value); - } - } - - public enum Value { - FREE, - - PLAN, - - PURCHASED, - - UNKNOWN - } - - public interface Visitor { - T visitFree(); - - T visitPlan(); - - T visitPurchased(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java new file mode 100644 index 0000000..65f4806 --- /dev/null +++ b/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java @@ -0,0 +1,250 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FeatureUsageTimeSeriesResponseData.Builder.class) +public final class FeatureUsageTimeSeriesResponseData { + private final String featureId; + + private final FeatureType featureType; + + private final List limits; + + private final Optional periodType; + + private final List usagePoints; + + private final Map additionalProperties; + + private FeatureUsageTimeSeriesResponseData( + String featureId, + FeatureType featureType, + List limits, + Optional periodType, + List usagePoints, + Map additionalProperties) { + this.featureId = featureId; + this.featureType = featureType; + this.limits = limits; + this.periodType = periodType; + this.usagePoints = usagePoints; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + @JsonProperty("feature_type") + public FeatureType getFeatureType() { + return featureType; + } + + @JsonProperty("limits") + public List getLimits() { + return limits; + } + + @JsonProperty("period_type") + public Optional getPeriodType() { + return periodType; + } + + @JsonProperty("usage_points") + public List getUsagePoints() { + return usagePoints; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureUsageTimeSeriesResponseData + && equalTo((FeatureUsageTimeSeriesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureUsageTimeSeriesResponseData other) { + return featureId.equals(other.featureId) + && featureType.equals(other.featureType) + && limits.equals(other.limits) + && periodType.equals(other.periodType) + && usagePoints.equals(other.usagePoints); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.featureId, this.featureType, this.limits, this.periodType, this.usagePoints); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeatureIdStage builder() { + return new Builder(); + } + + public interface FeatureIdStage { + FeatureTypeStage featureId(@NotNull String featureId); + + Builder from(FeatureUsageTimeSeriesResponseData other); + } + + public interface FeatureTypeStage { + _FinalStage featureType(@NotNull FeatureType featureType); + } + + public interface _FinalStage { + FeatureUsageTimeSeriesResponseData build(); + + _FinalStage limits(List limits); + + _FinalStage addLimits(LimitTimeSeriesPointResponseData limits); + + _FinalStage addAllLimits(List limits); + + _FinalStage periodType(Optional periodType); + + _FinalStage periodType(String periodType); + + _FinalStage usagePoints(List usagePoints); + + _FinalStage addUsagePoints(UsageTimeSeriesPointResponseData usagePoints); + + _FinalStage addAllUsagePoints(List usagePoints); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeatureIdStage, FeatureTypeStage, _FinalStage { + private String featureId; + + private FeatureType featureType; + + private List usagePoints = new ArrayList<>(); + + private Optional periodType = Optional.empty(); + + private List limits = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureUsageTimeSeriesResponseData other) { + featureId(other.getFeatureId()); + featureType(other.getFeatureType()); + limits(other.getLimits()); + periodType(other.getPeriodType()); + usagePoints(other.getUsagePoints()); + return this; + } + + @java.lang.Override + @JsonSetter("feature_id") + public FeatureTypeStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_type") + public _FinalStage featureType(@NotNull FeatureType featureType) { + this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllUsagePoints(List usagePoints) { + if (usagePoints != null) { + this.usagePoints.addAll(usagePoints); + } + return this; + } + + @java.lang.Override + public _FinalStage addUsagePoints(UsageTimeSeriesPointResponseData usagePoints) { + this.usagePoints.add(usagePoints); + return this; + } + + @java.lang.Override + @JsonSetter(value = "usage_points", nulls = Nulls.SKIP) + public _FinalStage usagePoints(List usagePoints) { + this.usagePoints.clear(); + if (usagePoints != null) { + this.usagePoints.addAll(usagePoints); + } + return this; + } + + @java.lang.Override + public _FinalStage periodType(String periodType) { + this.periodType = Optional.ofNullable(periodType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "period_type", nulls = Nulls.SKIP) + public _FinalStage periodType(Optional periodType) { + this.periodType = periodType; + return this; + } + + @java.lang.Override + public _FinalStage addAllLimits(List limits) { + if (limits != null) { + this.limits.addAll(limits); + } + return this; + } + + @java.lang.Override + public _FinalStage addLimits(LimitTimeSeriesPointResponseData limits) { + this.limits.add(limits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "limits", nulls = Nulls.SKIP) + public _FinalStage limits(List limits) { + this.limits.clear(); + if (limits != null) { + this.limits.addAll(limits); + } + return this; + } + + @java.lang.Override + public FeatureUsageTimeSeriesResponseData build() { + return new FeatureUsageTimeSeriesResponseData( + featureId, featureType, limits, periodType, usagePoints, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/FeatureView.java b/src/main/java/com/schematic/api/types/FeatureView.java new file mode 100644 index 0000000..a8ec98f --- /dev/null +++ b/src/main/java/com/schematic/api/types/FeatureView.java @@ -0,0 +1,649 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FeatureView.Builder.class) +public final class FeatureView { + private final String accountId; + + private final OffsetDateTime createdAt; + + private final String description; + + private final Optional eventSubtype; + + private final Optional eventSummary; + + private final FeatureType featureType; + + private final List flags; + + private final String icon; + + private final String id; + + private final Optional lifecyclePhase; + + private final Optional maintainerId; + + private final String name; + + private final List plans; + + private final Optional pluralName; + + private final Optional singularName; + + private final Optional trait; + + private final Optional traitId; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private FeatureView( + String accountId, + OffsetDateTime createdAt, + String description, + Optional eventSubtype, + Optional eventSummary, + FeatureType featureType, + List flags, + String icon, + String id, + Optional lifecyclePhase, + Optional maintainerId, + String name, + List plans, + Optional pluralName, + Optional singularName, + Optional trait, + Optional traitId, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.createdAt = createdAt; + this.description = description; + this.eventSubtype = eventSubtype; + this.eventSummary = eventSummary; + this.featureType = featureType; + this.flags = flags; + this.icon = icon; + this.id = id; + this.lifecyclePhase = lifecyclePhase; + this.maintainerId = maintainerId; + this.name = name; + this.plans = plans; + this.pluralName = pluralName; + this.singularName = singularName; + this.trait = trait; + this.traitId = traitId; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("event_summary") + public Optional getEventSummary() { + return eventSummary; + } + + @JsonProperty("feature_type") + public FeatureType getFeatureType() { + return featureType; + } + + @JsonProperty("flags") + public List getFlags() { + return flags; + } + + @JsonProperty("icon") + public String getIcon() { + return icon; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("lifecycle_phase") + public Optional getLifecyclePhase() { + return lifecyclePhase; + } + + @JsonProperty("maintainer_id") + public Optional getMaintainerId() { + return maintainerId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("plans") + public List getPlans() { + return plans; + } + + @JsonProperty("plural_name") + public Optional getPluralName() { + return pluralName; + } + + @JsonProperty("singular_name") + public Optional getSingularName() { + return singularName; + } + + @JsonProperty("trait") + public Optional getTrait() { + return trait; + } + + @JsonProperty("trait_id") + public Optional getTraitId() { + return traitId; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FeatureView && equalTo((FeatureView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FeatureView other) { + return accountId.equals(other.accountId) + && createdAt.equals(other.createdAt) + && description.equals(other.description) + && eventSubtype.equals(other.eventSubtype) + && eventSummary.equals(other.eventSummary) + && featureType.equals(other.featureType) + && flags.equals(other.flags) + && icon.equals(other.icon) + && id.equals(other.id) + && lifecyclePhase.equals(other.lifecyclePhase) + && maintainerId.equals(other.maintainerId) + && name.equals(other.name) + && plans.equals(other.plans) + && pluralName.equals(other.pluralName) + && singularName.equals(other.singularName) + && trait.equals(other.trait) + && traitId.equals(other.traitId) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.createdAt, + this.description, + this.eventSubtype, + this.eventSummary, + this.featureType, + this.flags, + this.icon, + this.id, + this.lifecyclePhase, + this.maintainerId, + this.name, + this.plans, + this.pluralName, + this.singularName, + this.trait, + this.traitId, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(FeatureView other); + } + + public interface CreatedAtStage { + DescriptionStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface DescriptionStage { + FeatureTypeStage description(@NotNull String description); + } + + public interface FeatureTypeStage { + IconStage featureType(@NotNull FeatureType featureType); + } + + public interface IconStage { + IdStage icon(@NotNull String icon); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + UpdatedAtStage name(@NotNull String name); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + FeatureView build(); + + _FinalStage eventSubtype(Optional eventSubtype); + + _FinalStage eventSubtype(String eventSubtype); + + _FinalStage eventSummary(Optional eventSummary); + + _FinalStage eventSummary(EventSummaryResponseData eventSummary); + + _FinalStage flags(List flags); + + _FinalStage addFlags(FlagView flags); + + _FinalStage addAllFlags(List flags); + + _FinalStage lifecyclePhase(Optional lifecyclePhase); + + _FinalStage lifecyclePhase(FeatureLifecyclePhase lifecyclePhase); + + _FinalStage maintainerId(Optional maintainerId); + + _FinalStage maintainerId(String maintainerId); + + _FinalStage plans(List plans); + + _FinalStage addPlans(PreviewObject plans); + + _FinalStage addAllPlans(List plans); + + _FinalStage pluralName(Optional pluralName); + + _FinalStage pluralName(String pluralName); + + _FinalStage singularName(Optional singularName); + + _FinalStage singularName(String singularName); + + _FinalStage trait(Optional trait); + + _FinalStage trait(EntityTraitDefinitionResponseData trait); + + _FinalStage traitId(Optional traitId); + + _FinalStage traitId(String traitId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CreatedAtStage, + DescriptionStage, + FeatureTypeStage, + IconStage, + IdStage, + NameStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private OffsetDateTime createdAt; + + private String description; + + private FeatureType featureType; + + private String icon; + + private String id; + + private String name; + + private OffsetDateTime updatedAt; + + private Optional traitId = Optional.empty(); + + private Optional trait = Optional.empty(); + + private Optional singularName = Optional.empty(); + + private Optional pluralName = Optional.empty(); + + private List plans = new ArrayList<>(); + + private Optional maintainerId = Optional.empty(); + + private Optional lifecyclePhase = Optional.empty(); + + private List flags = new ArrayList<>(); + + private Optional eventSummary = Optional.empty(); + + private Optional eventSubtype = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FeatureView other) { + accountId(other.getAccountId()); + createdAt(other.getCreatedAt()); + description(other.getDescription()); + eventSubtype(other.getEventSubtype()); + eventSummary(other.getEventSummary()); + featureType(other.getFeatureType()); + flags(other.getFlags()); + icon(other.getIcon()); + id(other.getId()); + lifecyclePhase(other.getLifecyclePhase()); + maintainerId(other.getMaintainerId()); + name(other.getName()); + plans(other.getPlans()); + pluralName(other.getPluralName()); + singularName(other.getSingularName()); + trait(other.getTrait()); + traitId(other.getTraitId()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DescriptionStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("description") + public FeatureTypeStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_type") + public IconStage featureType(@NotNull FeatureType featureType) { + this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull String icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public UpdatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name 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 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 trait(EntityTraitDefinitionResponseData trait) { + this.trait = Optional.ofNullable(trait); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait", nulls = Nulls.SKIP) + public _FinalStage trait(Optional trait) { + this.trait = trait; + 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 addAllPlans(List plans) { + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlans(PreviewObject plans) { + this.plans.add(plans); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plans", nulls = Nulls.SKIP) + public _FinalStage plans(List plans) { + this.plans.clear(); + if (plans != null) { + this.plans.addAll(plans); + } + return this; + } + + @java.lang.Override + public _FinalStage 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 addAllFlags(List flags) { + if (flags != null) { + this.flags.addAll(flags); + } + return this; + } + + @java.lang.Override + public _FinalStage addFlags(FlagView flags) { + this.flags.add(flags); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flags", nulls = Nulls.SKIP) + public _FinalStage flags(List flags) { + this.flags.clear(); + if (flags != null) { + this.flags.addAll(flags); + } + return this; + } + + @java.lang.Override + public _FinalStage eventSummary(EventSummaryResponseData eventSummary) { + this.eventSummary = Optional.ofNullable(eventSummary); + return this; + } + + @java.lang.Override + @JsonSetter(value = "event_summary", nulls = Nulls.SKIP) + public _FinalStage eventSummary(Optional eventSummary) { + this.eventSummary = eventSummary; + 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 FeatureView build() { + return new FeatureView( + accountId, + createdAt, + description, + eventSubtype, + eventSummary, + featureType, + flags, + icon, + id, + lifecyclePhase, + maintainerId, + name, + plans, + pluralName, + singularName, + trait, + traitId, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/FlagView.java b/src/main/java/com/schematic/api/types/FlagView.java new file mode 100644 index 0000000..6e4c91e --- /dev/null +++ b/src/main/java/com/schematic/api/types/FlagView.java @@ -0,0 +1,503 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FlagView.Builder.class) +public final class FlagView { + private final String accountId; + + private final OffsetDateTime createdAt; + + private final boolean defaultValue; + + private final String description; + + private final Optional feature; + + private final Optional featureId; + + private final String flagType; + + private final String id; + + private final String key; + + private final Optional lastCheckedAt; + + private final Optional maintainerId; + + private final String name; + + private final List rules; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private FlagView( + String accountId, + OffsetDateTime createdAt, + boolean defaultValue, + String description, + Optional feature, + Optional featureId, + String flagType, + String id, + String key, + Optional lastCheckedAt, + Optional maintainerId, + String name, + List rules, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.createdAt = createdAt; + this.defaultValue = defaultValue; + this.description = description; + this.feature = feature; + this.featureId = featureId; + this.flagType = flagType; + this.id = id; + this.key = key; + this.lastCheckedAt = lastCheckedAt; + this.maintainerId = maintainerId; + this.name = name; + this.rules = rules; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("default_value") + public boolean getDefaultValue() { + return defaultValue; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("feature") + public Optional getFeature() { + return feature; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + @JsonProperty("flag_type") + public String getFlagType() { + return flagType; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("key") + public String getKey() { + return key; + } + + @JsonProperty("last_checked_at") + public Optional getLastCheckedAt() { + return lastCheckedAt; + } + + @JsonProperty("maintainer_id") + public Optional getMaintainerId() { + return maintainerId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FlagView && equalTo((FlagView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FlagView other) { + return accountId.equals(other.accountId) + && createdAt.equals(other.createdAt) + && defaultValue == other.defaultValue + && description.equals(other.description) + && feature.equals(other.feature) + && featureId.equals(other.featureId) + && flagType.equals(other.flagType) + && id.equals(other.id) + && key.equals(other.key) + && lastCheckedAt.equals(other.lastCheckedAt) + && maintainerId.equals(other.maintainerId) + && name.equals(other.name) + && rules.equals(other.rules) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.createdAt, + this.defaultValue, + this.description, + this.feature, + this.featureId, + this.flagType, + this.id, + this.key, + this.lastCheckedAt, + this.maintainerId, + this.name, + this.rules, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(FlagView other); + } + + public interface CreatedAtStage { + DefaultValueStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface DefaultValueStage { + DescriptionStage defaultValue(boolean defaultValue); + } + + public interface DescriptionStage { + FlagTypeStage description(@NotNull String description); + } + + public interface FlagTypeStage { + IdStage flagType(@NotNull String flagType); + } + + public interface IdStage { + KeyStage id(@NotNull String id); + } + + public interface KeyStage { + NameStage key(@NotNull String key); + } + + public interface NameStage { + UpdatedAtStage name(@NotNull String name); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + FlagView build(); + + _FinalStage feature(Optional feature); + + _FinalStage feature(FeatureResponseData feature); + + _FinalStage featureId(Optional featureId); + + _FinalStage featureId(String featureId); + + _FinalStage lastCheckedAt(Optional lastCheckedAt); + + _FinalStage lastCheckedAt(OffsetDateTime lastCheckedAt); + + _FinalStage maintainerId(Optional maintainerId); + + _FinalStage maintainerId(String maintainerId); + + _FinalStage rules(List rules); + + _FinalStage addRules(RuleView rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CreatedAtStage, + DefaultValueStage, + DescriptionStage, + FlagTypeStage, + IdStage, + KeyStage, + NameStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private OffsetDateTime createdAt; + + private boolean defaultValue; + + private String description; + + private String flagType; + + private String id; + + private String key; + + private String name; + + private OffsetDateTime updatedAt; + + private List rules = new ArrayList<>(); + + private Optional maintainerId = Optional.empty(); + + private Optional lastCheckedAt = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional feature = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FlagView other) { + accountId(other.getAccountId()); + createdAt(other.getCreatedAt()); + defaultValue(other.getDefaultValue()); + description(other.getDescription()); + feature(other.getFeature()); + featureId(other.getFeatureId()); + flagType(other.getFlagType()); + id(other.getId()); + key(other.getKey()); + lastCheckedAt(other.getLastCheckedAt()); + maintainerId(other.getMaintainerId()); + name(other.getName()); + rules(other.getRules()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DefaultValueStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("default_value") + public DescriptionStage defaultValue(boolean defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @java.lang.Override + @JsonSetter("description") + public FlagTypeStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("flag_type") + public IdStage flagType(@NotNull String flagType) { + this.flagType = Objects.requireNonNull(flagType, "flagType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public KeyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("key") + public NameStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public UpdatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name 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 addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(RuleView rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + 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 lastCheckedAt(OffsetDateTime lastCheckedAt) { + this.lastCheckedAt = Optional.ofNullable(lastCheckedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "last_checked_at", nulls = Nulls.SKIP) + public _FinalStage lastCheckedAt(Optional lastCheckedAt) { + this.lastCheckedAt = lastCheckedAt; + return this; + } + + @java.lang.Override + public _FinalStage featureId(String featureId) { + this.featureId = Optional.ofNullable(featureId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_id", nulls = Nulls.SKIP) + public _FinalStage featureId(Optional featureId) { + this.featureId = featureId; + return this; + } + + @java.lang.Override + public _FinalStage feature(FeatureResponseData feature) { + this.feature = Optional.ofNullable(feature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature", nulls = Nulls.SKIP) + public _FinalStage feature(Optional feature) { + this.feature = feature; + return this; + } + + @java.lang.Override + public FlagView build() { + return new FlagView( + accountId, + createdAt, + defaultValue, + description, + feature, + featureId, + flagType, + id, + key, + lastCheckedAt, + maintainerId, + name, + rules, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/InvoiceResponseData.java b/src/main/java/com/schematic/api/types/InvoiceResponseData.java index 6f7f03e..91c8feb 100644 --- a/src/main/java/com/schematic/api/types/InvoiceResponseData.java +++ b/src/main/java/com/schematic/api/types/InvoiceResponseData.java @@ -48,6 +48,8 @@ public final class InvoiceResponseData { private final Optional paymentMethodExternalId; + private final BillingProviderType providerType; + private final Optional subscriptionExternalId; private final int subtotal; @@ -72,6 +74,7 @@ private InvoiceResponseData( Optional externalId, String id, Optional paymentMethodExternalId, + BillingProviderType providerType, Optional subscriptionExternalId, int subtotal, OffsetDateTime updatedAt, @@ -90,6 +93,7 @@ private InvoiceResponseData( this.externalId = externalId; this.id = id; this.paymentMethodExternalId = paymentMethodExternalId; + this.providerType = providerType; this.subscriptionExternalId = subscriptionExternalId; this.subtotal = subtotal; this.updatedAt = updatedAt; @@ -162,6 +166,11 @@ public Optional getPaymentMethodExternalId() { return paymentMethodExternalId; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("subscription_external_id") public Optional getSubscriptionExternalId() { return subscriptionExternalId; @@ -207,6 +216,7 @@ private boolean equalTo(InvoiceResponseData other) { && externalId.equals(other.externalId) && id.equals(other.id) && paymentMethodExternalId.equals(other.paymentMethodExternalId) + && providerType.equals(other.providerType) && subscriptionExternalId.equals(other.subscriptionExternalId) && subtotal == other.subtotal && updatedAt.equals(other.updatedAt) @@ -229,6 +239,7 @@ public int hashCode() { this.externalId, this.id, this.paymentMethodExternalId, + this.providerType, this.subscriptionExternalId, this.subtotal, this.updatedAt, @@ -279,7 +290,11 @@ public interface EnvironmentIdStage { } public interface IdStage { - SubtotalStage id(@NotNull String id); + ProviderTypeStage id(@NotNull String id); + } + + public interface ProviderTypeStage { + SubtotalStage providerType(@NotNull BillingProviderType providerType); } public interface SubtotalStage { @@ -329,6 +344,7 @@ public static final class Builder CustomerExternalIdStage, EnvironmentIdStage, IdStage, + ProviderTypeStage, SubtotalStage, UpdatedAtStage, _FinalStage { @@ -350,6 +366,8 @@ public static final class Builder private String id; + private BillingProviderType providerType; + private int subtotal; private OffsetDateTime updatedAt; @@ -386,6 +404,7 @@ public Builder from(InvoiceResponseData other) { externalId(other.getExternalId()); id(other.getId()); paymentMethodExternalId(other.getPaymentMethodExternalId()); + providerType(other.getProviderType()); subscriptionExternalId(other.getSubscriptionExternalId()); subtotal(other.getSubtotal()); updatedAt(other.getUpdatedAt()); @@ -451,11 +470,18 @@ public IdStage environmentId(@NotNull String environmentId) { @java.lang.Override @JsonSetter("id") - public SubtotalStage id(@NotNull String id) { + public ProviderTypeStage id(@NotNull String id) { this.id = Objects.requireNonNull(id, "id must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public SubtotalStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("subtotal") public UpdatedAtStage subtotal(int subtotal) { @@ -564,6 +590,7 @@ public InvoiceResponseData build() { externalId, id, paymentMethodExternalId, + providerType, subscriptionExternalId, subtotal, updatedAt, diff --git a/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java b/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java new file mode 100644 index 0000000..bbb610d --- /dev/null +++ b/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java @@ -0,0 +1,247 @@ +/** + * 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 = LimitTimeSeriesPointResponseData.Builder.class) +public final class LimitTimeSeriesPointResponseData { + private final OffsetDateTime effectiveAt; + + private final boolean isSoftLimit; + + private final EntitlementType limitSource; + + private final Optional limitValue; + + private final Optional planId; + + private final Optional priceBehavior; + + private final Map additionalProperties; + + private LimitTimeSeriesPointResponseData( + OffsetDateTime effectiveAt, + boolean isSoftLimit, + EntitlementType limitSource, + Optional limitValue, + Optional planId, + Optional priceBehavior, + Map additionalProperties) { + this.effectiveAt = effectiveAt; + this.isSoftLimit = isSoftLimit; + this.limitSource = limitSource; + this.limitValue = limitValue; + this.planId = planId; + this.priceBehavior = priceBehavior; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("effective_at") + public OffsetDateTime getEffectiveAt() { + return effectiveAt; + } + + @JsonProperty("is_soft_limit") + public boolean getIsSoftLimit() { + return isSoftLimit; + } + + @JsonProperty("limit_source") + public EntitlementType getLimitSource() { + return limitSource; + } + + @JsonProperty("limit_value") + public Optional getLimitValue() { + return limitValue; + } + + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + @JsonProperty("price_behavior") + public Optional getPriceBehavior() { + return priceBehavior; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LimitTimeSeriesPointResponseData && equalTo((LimitTimeSeriesPointResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LimitTimeSeriesPointResponseData other) { + return effectiveAt.equals(other.effectiveAt) + && isSoftLimit == other.isSoftLimit + && limitSource.equals(other.limitSource) + && limitValue.equals(other.limitValue) + && planId.equals(other.planId) + && priceBehavior.equals(other.priceBehavior); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.effectiveAt, this.isSoftLimit, this.limitSource, this.limitValue, this.planId, this.priceBehavior); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EffectiveAtStage builder() { + return new Builder(); + } + + public interface EffectiveAtStage { + IsSoftLimitStage effectiveAt(@NotNull OffsetDateTime effectiveAt); + + Builder from(LimitTimeSeriesPointResponseData other); + } + + public interface IsSoftLimitStage { + LimitSourceStage isSoftLimit(boolean isSoftLimit); + } + + public interface LimitSourceStage { + _FinalStage limitSource(@NotNull EntitlementType limitSource); + } + + public interface _FinalStage { + LimitTimeSeriesPointResponseData build(); + + _FinalStage limitValue(Optional limitValue); + + _FinalStage limitValue(Integer limitValue); + + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage priceBehavior(Optional priceBehavior); + + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EffectiveAtStage, IsSoftLimitStage, LimitSourceStage, _FinalStage { + private OffsetDateTime effectiveAt; + + private boolean isSoftLimit; + + private EntitlementType limitSource; + + private Optional priceBehavior = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional limitValue = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LimitTimeSeriesPointResponseData other) { + effectiveAt(other.getEffectiveAt()); + isSoftLimit(other.getIsSoftLimit()); + limitSource(other.getLimitSource()); + limitValue(other.getLimitValue()); + planId(other.getPlanId()); + priceBehavior(other.getPriceBehavior()); + return this; + } + + @java.lang.Override + @JsonSetter("effective_at") + public IsSoftLimitStage effectiveAt(@NotNull OffsetDateTime effectiveAt) { + this.effectiveAt = Objects.requireNonNull(effectiveAt, "effectiveAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_soft_limit") + public LimitSourceStage isSoftLimit(boolean isSoftLimit) { + this.isSoftLimit = isSoftLimit; + return this; + } + + @java.lang.Override + @JsonSetter("limit_source") + public _FinalStage limitSource(@NotNull EntitlementType limitSource) { + this.limitSource = Objects.requireNonNull(limitSource, "limitSource must not be null"); + 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 planId(String planId) { + this.planId = Optional.ofNullable(planId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_id", nulls = Nulls.SKIP) + public _FinalStage planId(Optional planId) { + this.planId = planId; + return this; + } + + @java.lang.Override + public _FinalStage limitValue(Integer limitValue) { + this.limitValue = Optional.ofNullable(limitValue); + return this; + } + + @java.lang.Override + @JsonSetter(value = "limit_value", nulls = Nulls.SKIP) + public _FinalStage limitValue(Optional limitValue) { + this.limitValue = limitValue; + return this; + } + + @java.lang.Override + public LimitTimeSeriesPointResponseData build() { + return new LimitTimeSeriesPointResponseData( + effectiveAt, isSoftLimit, limitSource, limitValue, planId, priceBehavior, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/ManagePlanRequest.java b/src/main/java/com/schematic/api/types/ManagePlanRequest.java index 731ae45..870fe4a 100644 --- a/src/main/java/com/schematic/api/types/ManagePlanRequest.java +++ b/src/main/java/com/schematic/api/types/ManagePlanRequest.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -29,6 +30,8 @@ public final class ManagePlanRequest { private final Optional basePlanPriceId; + private final Optional cancelImmediately; + private final String companyId; private final Optional couponExternalId; @@ -41,28 +44,38 @@ public final class ManagePlanRequest { private final Optional promoCode; + private final Optional prorate; + + private final Optional trialEnd; + private final Map additionalProperties; private ManagePlanRequest( List addOnSelections, Optional basePlanId, Optional basePlanPriceId, + Optional cancelImmediately, String companyId, Optional couponExternalId, List creditBundles, List payInAdvanceEntitlements, Optional paymentMethodExternalId, Optional promoCode, + Optional prorate, + Optional trialEnd, Map additionalProperties) { this.addOnSelections = addOnSelections; this.basePlanId = basePlanId; this.basePlanPriceId = basePlanPriceId; + this.cancelImmediately = cancelImmediately; this.companyId = companyId; this.couponExternalId = couponExternalId; this.creditBundles = creditBundles; this.payInAdvanceEntitlements = payInAdvanceEntitlements; this.paymentMethodExternalId = paymentMethodExternalId; this.promoCode = promoCode; + this.prorate = prorate; + this.trialEnd = trialEnd; this.additionalProperties = additionalProperties; } @@ -81,6 +94,14 @@ public Optional getBasePlanPriceId() { return basePlanPriceId; } + /** + * @return If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true. + */ + @JsonProperty("cancel_immediately") + public Optional getCancelImmediately() { + return cancelImmediately; + } + @JsonProperty("company_id") public String getCompanyId() { return companyId; @@ -111,6 +132,19 @@ public Optional getPromoCode() { return promoCode; } + /** + * @return If true and cancel_immediately is true, issue prorated credit. Only applies when removing all plans. Defaults to true. + */ + @JsonProperty("prorate") + public Optional getProrate() { + return prorate; + } + + @JsonProperty("trial_end") + public Optional getTrialEnd() { + return trialEnd; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -126,12 +160,15 @@ private boolean equalTo(ManagePlanRequest other) { return addOnSelections.equals(other.addOnSelections) && basePlanId.equals(other.basePlanId) && basePlanPriceId.equals(other.basePlanPriceId) + && cancelImmediately.equals(other.cancelImmediately) && companyId.equals(other.companyId) && couponExternalId.equals(other.couponExternalId) && creditBundles.equals(other.creditBundles) && payInAdvanceEntitlements.equals(other.payInAdvanceEntitlements) && paymentMethodExternalId.equals(other.paymentMethodExternalId) - && promoCode.equals(other.promoCode); + && promoCode.equals(other.promoCode) + && prorate.equals(other.prorate) + && trialEnd.equals(other.trialEnd); } @java.lang.Override @@ -140,12 +177,15 @@ public int hashCode() { this.addOnSelections, this.basePlanId, this.basePlanPriceId, + this.cancelImmediately, this.companyId, this.couponExternalId, this.creditBundles, this.payInAdvanceEntitlements, this.paymentMethodExternalId, - this.promoCode); + this.promoCode, + this.prorate, + this.trialEnd); } @java.lang.Override @@ -180,6 +220,13 @@ public interface _FinalStage { _FinalStage basePlanPriceId(String basePlanPriceId); + /** + *

If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true.

+ */ + _FinalStage cancelImmediately(Optional cancelImmediately); + + _FinalStage cancelImmediately(Boolean cancelImmediately); + _FinalStage couponExternalId(Optional couponExternalId); _FinalStage couponExternalId(String couponExternalId); @@ -203,12 +250,27 @@ public interface _FinalStage { _FinalStage promoCode(Optional promoCode); _FinalStage promoCode(String promoCode); + + /** + *

If true and cancel_immediately is true, issue prorated credit. Only applies when removing all plans. Defaults to true.

+ */ + _FinalStage prorate(Optional prorate); + + _FinalStage prorate(Boolean prorate); + + _FinalStage trialEnd(Optional trialEnd); + + _FinalStage trialEnd(OffsetDateTime trialEnd); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CompanyIdStage, _FinalStage { private String companyId; + private Optional trialEnd = Optional.empty(); + + private Optional prorate = Optional.empty(); + private Optional promoCode = Optional.empty(); private Optional paymentMethodExternalId = Optional.empty(); @@ -219,6 +281,8 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private Optional couponExternalId = Optional.empty(); + private Optional cancelImmediately = Optional.empty(); + private Optional basePlanPriceId = Optional.empty(); private Optional basePlanId = Optional.empty(); @@ -235,12 +299,15 @@ public Builder from(ManagePlanRequest other) { addOnSelections(other.getAddOnSelections()); basePlanId(other.getBasePlanId()); basePlanPriceId(other.getBasePlanPriceId()); + cancelImmediately(other.getCancelImmediately()); companyId(other.getCompanyId()); couponExternalId(other.getCouponExternalId()); creditBundles(other.getCreditBundles()); payInAdvanceEntitlements(other.getPayInAdvanceEntitlements()); paymentMethodExternalId(other.getPaymentMethodExternalId()); promoCode(other.getPromoCode()); + prorate(other.getProrate()); + trialEnd(other.getTrialEnd()); return this; } @@ -251,6 +318,39 @@ public _FinalStage companyId(@NotNull String companyId) { return this; } + @java.lang.Override + public _FinalStage trialEnd(OffsetDateTime trialEnd) { + this.trialEnd = Optional.ofNullable(trialEnd); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trial_end", nulls = Nulls.SKIP) + public _FinalStage trialEnd(Optional trialEnd) { + this.trialEnd = trialEnd; + return this; + } + + /** + *

If true and cancel_immediately is true, issue prorated credit. Only applies when removing all plans. Defaults to true.

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

If true and cancel_immediately is true, issue prorated credit. Only applies when removing all plans. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "prorate", nulls = Nulls.SKIP) + public _FinalStage prorate(Optional prorate) { + this.prorate = prorate; + return this; + } + @java.lang.Override public _FinalStage promoCode(String promoCode) { this.promoCode = Optional.ofNullable(promoCode); @@ -339,6 +439,26 @@ public _FinalStage couponExternalId(Optional couponExternalId) { return this; } + /** + *

If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true.

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

If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true.

+ */ + @java.lang.Override + @JsonSetter(value = "cancel_immediately", nulls = Nulls.SKIP) + public _FinalStage cancelImmediately(Optional cancelImmediately) { + this.cancelImmediately = cancelImmediately; + return this; + } + @java.lang.Override public _FinalStage basePlanPriceId(String basePlanPriceId) { this.basePlanPriceId = Optional.ofNullable(basePlanPriceId); @@ -395,12 +515,15 @@ public ManagePlanRequest build() { addOnSelections, basePlanId, basePlanPriceId, + cancelImmediately, companyId, couponExternalId, creditBundles, payInAdvanceEntitlements, paymentMethodExternalId, promoCode, + prorate, + trialEnd, additionalProperties); } } diff --git a/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java b/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java index 2c11568..f5acc53 100644 --- a/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java +++ b/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java @@ -54,6 +54,8 @@ public final class PaymentMethodResponseData { private final String paymentMethodType; + private final BillingProviderType providerType; + private final OffsetDateTime updatedAt; private final Map additionalProperties; @@ -75,6 +77,7 @@ private PaymentMethodResponseData( String externalId, String id, String paymentMethodType, + BillingProviderType providerType, OffsetDateTime updatedAt, Map additionalProperties) { this.accountLast4 = accountLast4; @@ -93,6 +96,7 @@ private PaymentMethodResponseData( this.externalId = externalId; this.id = id; this.paymentMethodType = paymentMethodType; + this.providerType = providerType; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; } @@ -177,6 +181,11 @@ public String getPaymentMethodType() { return paymentMethodType; } + @JsonProperty("provider_type") + public BillingProviderType getProviderType() { + return providerType; + } + @JsonProperty("updated_at") public OffsetDateTime getUpdatedAt() { return updatedAt; @@ -210,6 +219,7 @@ private boolean equalTo(PaymentMethodResponseData other) { && externalId.equals(other.externalId) && id.equals(other.id) && paymentMethodType.equals(other.paymentMethodType) + && providerType.equals(other.providerType) && updatedAt.equals(other.updatedAt); } @@ -232,6 +242,7 @@ public int hashCode() { this.externalId, this.id, this.paymentMethodType, + this.providerType, this.updatedAt); } @@ -267,7 +278,11 @@ public interface IdStage { } public interface PaymentMethodTypeStage { - UpdatedAtStage paymentMethodType(@NotNull String paymentMethodType); + ProviderTypeStage paymentMethodType(@NotNull String paymentMethodType); + } + + public interface ProviderTypeStage { + UpdatedAtStage providerType(@NotNull BillingProviderType providerType); } public interface UpdatedAtStage { @@ -326,6 +341,7 @@ public static final class Builder ExternalIdStage, IdStage, PaymentMethodTypeStage, + ProviderTypeStage, UpdatedAtStage, _FinalStage { private OffsetDateTime createdAt; @@ -340,6 +356,8 @@ public static final class Builder private String paymentMethodType; + private BillingProviderType providerType; + private OffsetDateTime updatedAt; private Optional companyId = Optional.empty(); @@ -385,6 +403,7 @@ public Builder from(PaymentMethodResponseData other) { externalId(other.getExternalId()); id(other.getId()); paymentMethodType(other.getPaymentMethodType()); + providerType(other.getProviderType()); updatedAt(other.getUpdatedAt()); return this; } @@ -426,11 +445,18 @@ public PaymentMethodTypeStage id(@NotNull String id) { @java.lang.Override @JsonSetter("payment_method_type") - public UpdatedAtStage paymentMethodType(@NotNull String paymentMethodType) { + public ProviderTypeStage paymentMethodType(@NotNull String paymentMethodType) { this.paymentMethodType = Objects.requireNonNull(paymentMethodType, "paymentMethodType must not be null"); return this; } + @java.lang.Override + @JsonSetter("provider_type") + public UpdatedAtStage providerType(@NotNull BillingProviderType providerType) { + this.providerType = Objects.requireNonNull(providerType, "providerType must not be null"); + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -587,6 +613,7 @@ public PaymentMethodResponseData build() { externalId, id, paymentMethodType, + providerType, updatedAt, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/PlanBundleAction.java b/src/main/java/com/schematic/api/types/PlanBundleAction.java new file mode 100644 index 0000000..0d00700 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanBundleAction.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanBundleAction { + public static final PlanBundleAction UPDATE = new PlanBundleAction(Value.UPDATE, "update"); + + public static final PlanBundleAction DELETE = new PlanBundleAction(Value.DELETE, "delete"); + + public static final PlanBundleAction CREATE = new PlanBundleAction(Value.CREATE, "create"); + + private final Value value; + + private final String string; + + PlanBundleAction(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 PlanBundleAction && this.string.equals(((PlanBundleAction) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case UPDATE: + return visitor.visitUpdate(); + case DELETE: + return visitor.visitDelete(); + case CREATE: + return visitor.visitCreate(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanBundleAction valueOf(String value) { + switch (value) { + case "update": + return UPDATE; + case "delete": + return DELETE; + case "create": + return CREATE; + default: + return new PlanBundleAction(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATE, + + UPDATE, + + DELETE, + + UNKNOWN + } + + public interface Visitor { + T visitCreate(); + + T visitUpdate(); + + T visitDelete(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java new file mode 100644 index 0000000..e2baba8 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlanBundleCreditGrantRequestBody.Builder.class) +public final class PlanBundleCreditGrantRequestBody { + private final PlanBundleAction action; + + private final Optional createReq; + + private final Optional creditGrantId; + + private final Optional deleteReq; + + private final Optional updateReq; + + private final Map additionalProperties; + + private PlanBundleCreditGrantRequestBody( + PlanBundleAction action, + Optional createReq, + Optional creditGrantId, + Optional deleteReq, + Optional updateReq, + Map additionalProperties) { + this.action = action; + this.createReq = createReq; + this.creditGrantId = creditGrantId; + this.deleteReq = deleteReq; + this.updateReq = updateReq; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("action") + public PlanBundleAction getAction() { + return action; + } + + @JsonProperty("create_req") + public Optional getCreateReq() { + return createReq; + } + + @JsonProperty("credit_grant_id") + public Optional getCreditGrantId() { + return creditGrantId; + } + + @JsonProperty("delete_req") + public Optional getDeleteReq() { + return deleteReq; + } + + @JsonProperty("update_req") + public Optional getUpdateReq() { + return updateReq; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanBundleCreditGrantRequestBody && equalTo((PlanBundleCreditGrantRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanBundleCreditGrantRequestBody other) { + return action.equals(other.action) + && createReq.equals(other.createReq) + && creditGrantId.equals(other.creditGrantId) + && deleteReq.equals(other.deleteReq) + && updateReq.equals(other.updateReq); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.createReq, this.creditGrantId, this.deleteReq, this.updateReq); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + _FinalStage action(@NotNull PlanBundleAction action); + + Builder from(PlanBundleCreditGrantRequestBody other); + } + + public interface _FinalStage { + PlanBundleCreditGrantRequestBody build(); + + _FinalStage createReq(Optional createReq); + + _FinalStage createReq(CreateBillingPlanCreditGrantRequestBody createReq); + + _FinalStage creditGrantId(Optional creditGrantId); + + _FinalStage creditGrantId(String creditGrantId); + + _FinalStage deleteReq(Optional deleteReq); + + _FinalStage deleteReq(DeleteBillingPlanCreditGrantRequestBody deleteReq); + + _FinalStage updateReq(Optional updateReq); + + _FinalStage updateReq(UpdateBillingPlanCreditGrantRequestBody updateReq); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, _FinalStage { + private PlanBundleAction action; + + private Optional updateReq = Optional.empty(); + + private Optional deleteReq = Optional.empty(); + + private Optional creditGrantId = Optional.empty(); + + private Optional createReq = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanBundleCreditGrantRequestBody other) { + action(other.getAction()); + createReq(other.getCreateReq()); + creditGrantId(other.getCreditGrantId()); + deleteReq(other.getDeleteReq()); + updateReq(other.getUpdateReq()); + return this; + } + + @java.lang.Override + @JsonSetter("action") + public _FinalStage action(@NotNull PlanBundleAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage updateReq(UpdateBillingPlanCreditGrantRequestBody updateReq) { + this.updateReq = Optional.ofNullable(updateReq); + return this; + } + + @java.lang.Override + @JsonSetter(value = "update_req", nulls = Nulls.SKIP) + public _FinalStage updateReq(Optional updateReq) { + this.updateReq = updateReq; + return this; + } + + @java.lang.Override + public _FinalStage deleteReq(DeleteBillingPlanCreditGrantRequestBody deleteReq) { + this.deleteReq = Optional.ofNullable(deleteReq); + return this; + } + + @java.lang.Override + @JsonSetter(value = "delete_req", nulls = Nulls.SKIP) + public _FinalStage deleteReq(Optional deleteReq) { + this.deleteReq = deleteReq; + return this; + } + + @java.lang.Override + public _FinalStage creditGrantId(String creditGrantId) { + this.creditGrantId = Optional.ofNullable(creditGrantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_grant_id", nulls = Nulls.SKIP) + public _FinalStage creditGrantId(Optional creditGrantId) { + this.creditGrantId = creditGrantId; + return this; + } + + @java.lang.Override + public _FinalStage createReq(CreateBillingPlanCreditGrantRequestBody createReq) { + this.createReq = Optional.ofNullable(createReq); + return this; + } + + @java.lang.Override + @JsonSetter(value = "create_req", nulls = Nulls.SKIP) + public _FinalStage createReq(Optional createReq) { + this.createReq = createReq; + return this; + } + + @java.lang.Override + public PlanBundleCreditGrantRequestBody build() { + return new PlanBundleCreditGrantRequestBody( + action, createReq, creditGrantId, deleteReq, updateReq, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java b/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java new file mode 100644 index 0000000..7a07a44 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlanBundleEntitlementRequestBody.Builder.class) +public final class PlanBundleEntitlementRequestBody { + private final PlanBundleAction action; + + private final Optional entitlementId; + + private final Optional req; + + private final Map additionalProperties; + + private PlanBundleEntitlementRequestBody( + PlanBundleAction action, + Optional entitlementId, + Optional req, + Map additionalProperties) { + this.action = action; + this.entitlementId = entitlementId; + this.req = req; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("action") + public PlanBundleAction getAction() { + return action; + } + + @JsonProperty("entitlement_id") + public Optional getEntitlementId() { + return entitlementId; + } + + @JsonProperty("req") + public Optional getReq() { + return req; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanBundleEntitlementRequestBody && equalTo((PlanBundleEntitlementRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanBundleEntitlementRequestBody other) { + return action.equals(other.action) && entitlementId.equals(other.entitlementId) && req.equals(other.req); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.action, this.entitlementId, this.req); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + _FinalStage action(@NotNull PlanBundleAction action); + + Builder from(PlanBundleEntitlementRequestBody other); + } + + public interface _FinalStage { + PlanBundleEntitlementRequestBody build(); + + _FinalStage entitlementId(Optional entitlementId); + + _FinalStage entitlementId(String entitlementId); + + _FinalStage req(Optional req); + + _FinalStage req(CreateEntitlementInBundleRequestBody req); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, _FinalStage { + private PlanBundleAction action; + + private Optional req = Optional.empty(); + + private Optional entitlementId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanBundleEntitlementRequestBody other) { + action(other.getAction()); + entitlementId(other.getEntitlementId()); + req(other.getReq()); + return this; + } + + @java.lang.Override + @JsonSetter("action") + public _FinalStage action(@NotNull PlanBundleAction action) { + this.action = Objects.requireNonNull(action, "action must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage req(CreateEntitlementInBundleRequestBody req) { + this.req = Optional.ofNullable(req); + return this; + } + + @java.lang.Override + @JsonSetter(value = "req", nulls = Nulls.SKIP) + public _FinalStage req(Optional req) { + this.req = req; + return this; + } + + @java.lang.Override + public _FinalStage entitlementId(String entitlementId) { + this.entitlementId = Optional.ofNullable(entitlementId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlement_id", nulls = Nulls.SKIP) + public _FinalStage entitlementId(Optional entitlementId) { + this.entitlementId = entitlementId; + return this; + } + + @java.lang.Override + public PlanBundleEntitlementRequestBody build() { + return new PlanBundleEntitlementRequestBody(action, entitlementId, req, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanBundleResponseData.java b/src/main/java/com/schematic/api/types/PlanBundleResponseData.java new file mode 100644 index 0000000..909bf3a --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanBundleResponseData.java @@ -0,0 +1,195 @@ +/** + * 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; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlanBundleResponseData.Builder.class) +public final class PlanBundleResponseData { + private final Optional billingProduct; + + private final Optional> creditGrants; + + private final Optional> entitlements; + + private final Optional plan; + + private final Optional> traits; + + private final Map additionalProperties; + + private PlanBundleResponseData( + Optional billingProduct, + Optional> creditGrants, + Optional> entitlements, + Optional plan, + Optional> traits, + Map additionalProperties) { + this.billingProduct = billingProduct; + this.creditGrants = creditGrants; + this.entitlements = entitlements; + this.plan = plan; + this.traits = traits; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_product") + public Optional getBillingProduct() { + return billingProduct; + } + + @JsonProperty("credit_grants") + public Optional> getCreditGrants() { + return creditGrants; + } + + @JsonProperty("entitlements") + public Optional> getEntitlements() { + return entitlements; + } + + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + + @JsonProperty("traits") + public Optional> getTraits() { + return traits; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanBundleResponseData && equalTo((PlanBundleResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanBundleResponseData other) { + return billingProduct.equals(other.billingProduct) + && creditGrants.equals(other.creditGrants) + && entitlements.equals(other.entitlements) + && plan.equals(other.plan) + && traits.equals(other.traits); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.traits); + } + + @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 billingProduct = Optional.empty(); + + private Optional> creditGrants = Optional.empty(); + + private Optional> entitlements = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional> traits = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PlanBundleResponseData other) { + billingProduct(other.getBillingProduct()); + creditGrants(other.getCreditGrants()); + entitlements(other.getEntitlements()); + plan(other.getPlan()); + traits(other.getTraits()); + return this; + } + + @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) + public Builder billingProduct(Optional billingProduct) { + this.billingProduct = billingProduct; + return this; + } + + public Builder billingProduct(BillingProductPlanResponseData billingProduct) { + this.billingProduct = Optional.ofNullable(billingProduct); + return this; + } + + @JsonSetter(value = "credit_grants", nulls = Nulls.SKIP) + public Builder creditGrants(Optional> creditGrants) { + this.creditGrants = creditGrants; + return this; + } + + public Builder creditGrants(List creditGrants) { + this.creditGrants = Optional.ofNullable(creditGrants); + return this; + } + + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public Builder entitlements(Optional> entitlements) { + this.entitlements = entitlements; + return this; + } + + public Builder entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); + return this; + } + + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(PlanResponseData plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + @JsonSetter(value = "traits", nulls = Nulls.SKIP) + public Builder traits(Optional> traits) { + this.traits = traits; + return this; + } + + public Builder traits(List traits) { + this.traits = Optional.ofNullable(traits); + return this; + } + + public PlanBundleResponseData build() { + return new PlanBundleResponseData( + billingProduct, creditGrants, entitlements, plan, traits, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseDataAction.java b/src/main/java/com/schematic/api/types/PlanChangeAction.java similarity index 59% rename from src/main/java/com/schematic/api/types/PlanChangeResponseDataAction.java rename to src/main/java/com/schematic/api/types/PlanChangeAction.java index 060f114..cf6592c 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseDataAction.java +++ b/src/main/java/com/schematic/api/types/PlanChangeAction.java @@ -6,36 +6,35 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class PlanChangeResponseDataAction { - public static final PlanChangeResponseDataAction CHECKOUT = - new PlanChangeResponseDataAction(Value.CHECKOUT, "checkout"); +public final class PlanChangeAction { + public static final PlanChangeAction CHECKOUT = new PlanChangeAction(Value.CHECKOUT, "checkout"); - public static final PlanChangeResponseDataAction COMPANY_UPSERT = - new PlanChangeResponseDataAction(Value.COMPANY_UPSERT, "company_upsert"); + public static final PlanChangeAction MIGRATION = new PlanChangeAction(Value.MIGRATION, "migration"); - public static final PlanChangeResponseDataAction PLAN_BILLING_PRODUCT_CHANGED = - new PlanChangeResponseDataAction(Value.PLAN_BILLING_PRODUCT_CHANGED, "plan_billing_product_changed"); + public static final PlanChangeAction COMPANY_UPSERT = new PlanChangeAction(Value.COMPANY_UPSERT, "company_upsert"); - public static final PlanChangeResponseDataAction FALLBACK_PLAN = - new PlanChangeResponseDataAction(Value.FALLBACK_PLAN, "fallback_plan"); + public static final PlanChangeAction PLAN_BILLING_PRODUCT_CHANGED = + new PlanChangeAction(Value.PLAN_BILLING_PRODUCT_CHANGED, "plan_billing_product_changed"); - public static final PlanChangeResponseDataAction SUBSCRIPTION_CHANGE = - new PlanChangeResponseDataAction(Value.SUBSCRIPTION_CHANGE, "subscription_change"); + public static final PlanChangeAction FALLBACK_PLAN = new PlanChangeAction(Value.FALLBACK_PLAN, "fallback_plan"); - public static final PlanChangeResponseDataAction PLAN_DELETED = - new PlanChangeResponseDataAction(Value.PLAN_DELETED, "plan_deleted"); + public static final PlanChangeAction SUBSCRIPTION_CHANGE = + new PlanChangeAction(Value.SUBSCRIPTION_CHANGE, "subscription_change"); - public static final PlanChangeResponseDataAction QUICKSTART = - new PlanChangeResponseDataAction(Value.QUICKSTART, "quickstart"); + public static final PlanChangeAction PLAN_DELETED = new PlanChangeAction(Value.PLAN_DELETED, "plan_deleted"); - public static final PlanChangeResponseDataAction MANAGE_PLAN = - new PlanChangeResponseDataAction(Value.MANAGE_PLAN, "manage_plan"); + public static final PlanChangeAction QUICKSTART = new PlanChangeAction(Value.QUICKSTART, "quickstart"); + + public static final PlanChangeAction MANAGE_PLAN = new PlanChangeAction(Value.MANAGE_PLAN, "manage_plan"); + + public static final PlanChangeAction PLAN_TRAIT_CHANGE = + new PlanChangeAction(Value.PLAN_TRAIT_CHANGE, "plan_trait_change"); private final Value value; private final String string; - PlanChangeResponseDataAction(Value value, String string) { + PlanChangeAction(Value value, String string) { this.value = value; this.string = string; } @@ -53,8 +52,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof PlanChangeResponseDataAction - && this.string.equals(((PlanChangeResponseDataAction) other).string)); + || (other instanceof PlanChangeAction && this.string.equals(((PlanChangeAction) other).string)); } @java.lang.Override @@ -66,6 +64,8 @@ public T visit(Visitor visitor) { switch (value) { case CHECKOUT: return visitor.visitCheckout(); + case MIGRATION: + return visitor.visitMigration(); case COMPANY_UPSERT: return visitor.visitCompanyUpsert(); case PLAN_BILLING_PRODUCT_CHANGED: @@ -80,6 +80,8 @@ public T visit(Visitor visitor) { return visitor.visitQuickstart(); case MANAGE_PLAN: return visitor.visitManagePlan(); + case PLAN_TRAIT_CHANGE: + return visitor.visitPlanTraitChange(); case UNKNOWN: default: return visitor.visitUnknown(string); @@ -87,10 +89,12 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static PlanChangeResponseDataAction valueOf(String value) { + public static PlanChangeAction valueOf(String value) { switch (value) { case "checkout": return CHECKOUT; + case "migration": + return MIGRATION; case "company_upsert": return COMPANY_UPSERT; case "plan_billing_product_changed": @@ -105,8 +109,10 @@ public static PlanChangeResponseDataAction valueOf(String value) { return QUICKSTART; case "manage_plan": return MANAGE_PLAN; + case "plan_trait_change": + return PLAN_TRAIT_CHANGE; default: - return new PlanChangeResponseDataAction(Value.UNKNOWN, value); + return new PlanChangeAction(Value.UNKNOWN, value); } } @@ -119,10 +125,14 @@ public enum Value { MANAGE_PLAN, + MIGRATION, + PLAN_BILLING_PRODUCT_CHANGED, PLAN_DELETED, + PLAN_TRAIT_CHANGE, + QUICKSTART, SUBSCRIPTION_CHANGE, @@ -139,10 +149,14 @@ public interface Visitor { T visitManagePlan(); + T visitMigration(); + T visitPlanBillingProductChanged(); T visitPlanDeleted(); + T visitPlanTraitChange(); + T visitQuickstart(); T visitSubscriptionChange(); diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseDataBasePlanAction.java b/src/main/java/com/schematic/api/types/PlanChangeBasePlanAction.java similarity index 63% rename from src/main/java/com/schematic/api/types/PlanChangeResponseDataBasePlanAction.java rename to src/main/java/com/schematic/api/types/PlanChangeBasePlanAction.java index e619d36..be16805 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseDataBasePlanAction.java +++ b/src/main/java/com/schematic/api/types/PlanChangeBasePlanAction.java @@ -6,24 +6,21 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class PlanChangeResponseDataBasePlanAction { - public static final PlanChangeResponseDataBasePlanAction FALLBACK = - new PlanChangeResponseDataBasePlanAction(Value.FALLBACK, "fallback"); +public final class PlanChangeBasePlanAction { + public static final PlanChangeBasePlanAction FALLBACK = new PlanChangeBasePlanAction(Value.FALLBACK, "fallback"); - public static final PlanChangeResponseDataBasePlanAction INITIAL = - new PlanChangeResponseDataBasePlanAction(Value.INITIAL, "initial"); + public static final PlanChangeBasePlanAction INITIAL = new PlanChangeBasePlanAction(Value.INITIAL, "initial"); - public static final PlanChangeResponseDataBasePlanAction TRAIT = - new PlanChangeResponseDataBasePlanAction(Value.TRAIT, "trait"); + public static final PlanChangeBasePlanAction TRAIT = new PlanChangeBasePlanAction(Value.TRAIT, "trait"); - public static final PlanChangeResponseDataBasePlanAction TRIAL_EXPIRY = - new PlanChangeResponseDataBasePlanAction(Value.TRIAL_EXPIRY, "trial_expiry"); + public static final PlanChangeBasePlanAction TRIAL_EXPIRY = + new PlanChangeBasePlanAction(Value.TRIAL_EXPIRY, "trial_expiry"); private final Value value; private final String string; - PlanChangeResponseDataBasePlanAction(Value value, String string) { + PlanChangeBasePlanAction(Value value, String string) { this.value = value; this.string = string; } @@ -41,8 +38,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof PlanChangeResponseDataBasePlanAction - && this.string.equals(((PlanChangeResponseDataBasePlanAction) other).string)); + || (other instanceof PlanChangeBasePlanAction + && this.string.equals(((PlanChangeBasePlanAction) other).string)); } @java.lang.Override @@ -67,7 +64,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static PlanChangeResponseDataBasePlanAction valueOf(String value) { + public static PlanChangeBasePlanAction valueOf(String value) { switch (value) { case "fallback": return FALLBACK; @@ -78,7 +75,7 @@ public static PlanChangeResponseDataBasePlanAction valueOf(String value) { case "trial_expiry": return TRIAL_EXPIRY; default: - return new PlanChangeResponseDataBasePlanAction(Value.UNKNOWN, value); + return new PlanChangeBasePlanAction(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseData.java b/src/main/java/com/schematic/api/types/PlanChangeResponseData.java index 0713dac..3c01064 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanChangeResponseData.java @@ -24,9 +24,9 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanChangeResponseData.Builder.class) public final class PlanChangeResponseData { - private final PlanChangeResponseDataAction action; + private final PlanChangeAction action; - private final PlanChangeResponseDataActorType actorType; + private final ActorType actorType; private final List addOnsAdded; @@ -38,7 +38,7 @@ public final class PlanChangeResponseData { private final Optional basePlan; - private final Optional basePlanAction; + private final Optional basePlanAction; private final Optional company; @@ -54,7 +54,7 @@ public final class PlanChangeResponseData { private final Optional requestId; - private final Optional subscriptionChangeAction; + private final Optional subscriptionChangeAction; private final List traitsUpdated; @@ -67,14 +67,14 @@ public final class PlanChangeResponseData { private final Map additionalProperties; private PlanChangeResponseData( - PlanChangeResponseDataAction action, - PlanChangeResponseDataActorType actorType, + PlanChangeAction action, + ActorType actorType, List addOnsAdded, List addOnsRemoved, Optional apiKey, Optional apiKeyRequest, Optional basePlan, - Optional basePlanAction, + Optional basePlanAction, Optional company, String companyId, OffsetDateTime createdAt, @@ -82,7 +82,7 @@ private PlanChangeResponseData( String id, Optional previousBasePlan, Optional requestId, - Optional subscriptionChangeAction, + Optional subscriptionChangeAction, List traitsUpdated, OffsetDateTime updatedAt, Optional userId, @@ -112,12 +112,12 @@ private PlanChangeResponseData( } @JsonProperty("action") - public PlanChangeResponseDataAction getAction() { + public PlanChangeAction getAction() { return action; } @JsonProperty("actor_type") - public PlanChangeResponseDataActorType getActorType() { + public ActorType getActorType() { return actorType; } @@ -146,11 +146,8 @@ public Optional getBasePlan() { return basePlan; } - /** - * @return Any special behavior that affected the assignment of the base plan during this change. - */ @JsonProperty("base_plan_action") - public Optional getBasePlanAction() { + public Optional getBasePlanAction() { return basePlanAction; } @@ -189,11 +186,8 @@ public Optional getRequestId() { return requestId; } - /** - * @return If a subscription was changed as a part of this plan change, indicates the type of change that was made. - */ @JsonProperty("subscription_change_action") - public Optional getSubscriptionChangeAction() { + public Optional getSubscriptionChangeAction() { return subscriptionChangeAction; } @@ -289,13 +283,13 @@ public static ActionStage builder() { } public interface ActionStage { - ActorTypeStage action(@NotNull PlanChangeResponseDataAction action); + ActorTypeStage action(@NotNull PlanChangeAction action); Builder from(PlanChangeResponseData other); } public interface ActorTypeStage { - CompanyIdStage actorType(@NotNull PlanChangeResponseDataActorType actorType); + CompanyIdStage actorType(@NotNull ActorType actorType); } public interface CompanyIdStage { @@ -345,12 +339,9 @@ public interface _FinalStage { _FinalStage basePlan(PlanSnapshotView basePlan); - /** - *

Any special behavior that affected the assignment of the base plan during this change.

- */ - _FinalStage basePlanAction(Optional basePlanAction); + _FinalStage basePlanAction(Optional basePlanAction); - _FinalStage basePlanAction(PlanChangeResponseDataBasePlanAction basePlanAction); + _FinalStage basePlanAction(PlanChangeBasePlanAction basePlanAction); _FinalStage company(Optional company); @@ -364,13 +355,9 @@ public interface _FinalStage { _FinalStage requestId(String requestId); - /** - *

If a subscription was changed as a part of this plan change, indicates the type of change that was made.

- */ - _FinalStage subscriptionChangeAction( - Optional subscriptionChangeAction); + _FinalStage subscriptionChangeAction(Optional subscriptionChangeAction); - _FinalStage subscriptionChangeAction(PlanChangeResponseDataSubscriptionChangeAction subscriptionChangeAction); + _FinalStage subscriptionChangeAction(PlanChangeSubscriptionAction subscriptionChangeAction); /** *

Any traits were updated as part of this plan change (via pay-in-advance entitlements).

@@ -400,9 +387,9 @@ public static final class Builder IdStage, UpdatedAtStage, _FinalStage { - private PlanChangeResponseDataAction action; + private PlanChangeAction action; - private PlanChangeResponseDataActorType actorType; + private ActorType actorType; private String companyId; @@ -420,7 +407,7 @@ public static final class Builder private List traitsUpdated = new ArrayList<>(); - private Optional subscriptionChangeAction = Optional.empty(); + private Optional subscriptionChangeAction = Optional.empty(); private Optional requestId = Optional.empty(); @@ -428,7 +415,7 @@ public static final class Builder private Optional company = Optional.empty(); - private Optional basePlanAction = Optional.empty(); + private Optional basePlanAction = Optional.empty(); private Optional basePlan = Optional.empty(); @@ -472,14 +459,14 @@ public Builder from(PlanChangeResponseData other) { @java.lang.Override @JsonSetter("action") - public ActorTypeStage action(@NotNull PlanChangeResponseDataAction action) { + public ActorTypeStage action(@NotNull PlanChangeAction action) { this.action = Objects.requireNonNull(action, "action must not be null"); return this; } @java.lang.Override @JsonSetter("actor_type") - public CompanyIdStage actorType(@NotNull PlanChangeResponseDataActorType actorType) { + public CompanyIdStage actorType(@NotNull ActorType actorType) { this.actorType = Objects.requireNonNull(actorType, "actorType must not be null"); return this; } @@ -580,24 +567,15 @@ public _FinalStage traitsUpdated(List traitsUpdated) { return this; } - /** - *

If a subscription was changed as a part of this plan change, indicates the type of change that was made.

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

If a subscription was changed as a part of this plan change, indicates the type of change that was made.

- */ @java.lang.Override @JsonSetter(value = "subscription_change_action", nulls = Nulls.SKIP) - public _FinalStage subscriptionChangeAction( - Optional subscriptionChangeAction) { + public _FinalStage subscriptionChangeAction(Optional subscriptionChangeAction) { this.subscriptionChangeAction = subscriptionChangeAction; return this; } @@ -641,22 +619,15 @@ public _FinalStage company(Optional company) { return this; } - /** - *

Any special behavior that affected the assignment of the base plan during this change.

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

Any special behavior that affected the assignment of the base plan during this change.

- */ @java.lang.Override @JsonSetter(value = "base_plan_action", nulls = Nulls.SKIP) - public _FinalStage basePlanAction(Optional basePlanAction) { + public _FinalStage basePlanAction(Optional basePlanAction) { this.basePlanAction = basePlanAction; return this; } diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseDataSubscriptionChangeAction.java b/src/main/java/com/schematic/api/types/PlanChangeSubscriptionAction.java similarity index 58% rename from src/main/java/com/schematic/api/types/PlanChangeResponseDataSubscriptionChangeAction.java rename to src/main/java/com/schematic/api/types/PlanChangeSubscriptionAction.java index f9fa09c..057352e 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseDataSubscriptionChangeAction.java +++ b/src/main/java/com/schematic/api/types/PlanChangeSubscriptionAction.java @@ -6,30 +6,33 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class PlanChangeResponseDataSubscriptionChangeAction { - public static final PlanChangeResponseDataSubscriptionChangeAction DOWNGRADE = - new PlanChangeResponseDataSubscriptionChangeAction(Value.DOWNGRADE, "downgrade"); +public final class PlanChangeSubscriptionAction { + public static final PlanChangeSubscriptionAction ADJUSTMENT = + new PlanChangeSubscriptionAction(Value.ADJUSTMENT, "adjustment"); - public static final PlanChangeResponseDataSubscriptionChangeAction INVALID = - new PlanChangeResponseDataSubscriptionChangeAction(Value.INVALID, "invalid"); + public static final PlanChangeSubscriptionAction DOWNGRADE = + new PlanChangeSubscriptionAction(Value.DOWNGRADE, "downgrade"); - public static final PlanChangeResponseDataSubscriptionChangeAction UNSUBSCRIBE = - new PlanChangeResponseDataSubscriptionChangeAction(Value.UNSUBSCRIBE, "unsubscribe"); + public static final PlanChangeSubscriptionAction INVALID = + new PlanChangeSubscriptionAction(Value.INVALID, "invalid"); - public static final PlanChangeResponseDataSubscriptionChangeAction SUBSCRIBE = - new PlanChangeResponseDataSubscriptionChangeAction(Value.SUBSCRIBE, "subscribe"); + public static final PlanChangeSubscriptionAction UNSUBSCRIBE = + new PlanChangeSubscriptionAction(Value.UNSUBSCRIBE, "unsubscribe"); - public static final PlanChangeResponseDataSubscriptionChangeAction UPGRADE_TRIAL = - new PlanChangeResponseDataSubscriptionChangeAction(Value.UPGRADE_TRIAL, "upgrade_trial"); + public static final PlanChangeSubscriptionAction SUBSCRIBE = + new PlanChangeSubscriptionAction(Value.SUBSCRIBE, "subscribe"); - public static final PlanChangeResponseDataSubscriptionChangeAction UPGRADE = - new PlanChangeResponseDataSubscriptionChangeAction(Value.UPGRADE, "upgrade"); + public static final PlanChangeSubscriptionAction UPGRADE_TRIAL = + new PlanChangeSubscriptionAction(Value.UPGRADE_TRIAL, "upgrade_trial"); + + public static final PlanChangeSubscriptionAction UPGRADE = + new PlanChangeSubscriptionAction(Value.UPGRADE, "upgrade"); private final Value value; private final String string; - PlanChangeResponseDataSubscriptionChangeAction(Value value, String string) { + PlanChangeSubscriptionAction(Value value, String string) { this.value = value; this.string = string; } @@ -47,8 +50,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof PlanChangeResponseDataSubscriptionChangeAction - && this.string.equals(((PlanChangeResponseDataSubscriptionChangeAction) other).string)); + || (other instanceof PlanChangeSubscriptionAction + && this.string.equals(((PlanChangeSubscriptionAction) other).string)); } @java.lang.Override @@ -58,6 +61,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case ADJUSTMENT: + return visitor.visitAdjustment(); case DOWNGRADE: return visitor.visitDowngrade(); case INVALID: @@ -77,8 +82,10 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static PlanChangeResponseDataSubscriptionChangeAction valueOf(String value) { + public static PlanChangeSubscriptionAction valueOf(String value) { switch (value) { + case "adjustment": + return ADJUSTMENT; case "downgrade": return DOWNGRADE; case "invalid": @@ -92,11 +99,13 @@ public static PlanChangeResponseDataSubscriptionChangeAction valueOf(String valu case "upgrade": return UPGRADE; default: - return new PlanChangeResponseDataSubscriptionChangeAction(Value.UNKNOWN, value); + return new PlanChangeSubscriptionAction(Value.UNKNOWN, value); } } public enum Value { + ADJUSTMENT, + DOWNGRADE, INVALID, @@ -113,6 +122,8 @@ public enum Value { } public interface Visitor { + T visitAdjustment(); + T visitDowngrade(); T visitInvalid(); diff --git a/src/main/java/com/schematic/api/types/PlanControlledByType.java b/src/main/java/com/schematic/api/types/PlanControlledByType.java new file mode 100644 index 0000000..5fba738 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanControlledByType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanControlledByType { + public static final PlanControlledByType SCHEMATIC = new PlanControlledByType(Value.SCHEMATIC, "schematic"); + + public static final PlanControlledByType STRIPE = new PlanControlledByType(Value.STRIPE, "stripe"); + + private final Value value; + + private final String string; + + PlanControlledByType(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 PlanControlledByType && this.string.equals(((PlanControlledByType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SCHEMATIC: + return visitor.visitSchematic(); + case STRIPE: + return visitor.visitStripe(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanControlledByType valueOf(String value) { + switch (value) { + case "schematic": + return SCHEMATIC; + case "stripe": + return STRIPE; + default: + return new PlanControlledByType(Value.UNKNOWN, value); + } + } + + public enum Value { + SCHEMATIC, + + STRIPE, + + UNKNOWN + } + + public interface Visitor { + T visitSchematic(); + + T visitStripe(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java index c274702..2245f12 100644 --- a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java @@ -22,6 +22,20 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanCreditGrantView.Builder.class) public final class PlanCreditGrantView { + private final Optional billingCreditAutoTopupAmount; + + private final Optional billingCreditAutoTopupAmountType; + + private final boolean billingCreditAutoTopupEnabled; + + private final Optional billingCreditAutoTopupExpiryType; + + private final Optional billingCreditAutoTopupExpiryUnit; + + private final Optional billingCreditAutoTopupExpiryUnitCount; + + private final Optional billingCreditAutoTopupThresholdPercent; + private final OffsetDateTime createdAt; private final int creditAmount; @@ -34,25 +48,25 @@ public final class PlanCreditGrantView { private final String creditName; - private final Optional expiryType; + private final Optional expiryType; - private final Optional expiryUnit; + private final Optional expiryUnit; private final Optional expiryUnitCount; private final String id; - private final String planId; + private final Optional plan; - private final String planName; + private final String planId; private final Optional pluralName; - private final String resetCadence; + private final BillingPlanCreditGrantResetCadence resetCadence; - private final String resetStart; + private final BillingPlanCreditGrantResetStart resetStart; - private final String resetType; + private final BillingPlanCreditGrantResetType resetType; private final Optional singularName; @@ -61,25 +75,39 @@ public final class PlanCreditGrantView { private final Map additionalProperties; private PlanCreditGrantView( + Optional billingCreditAutoTopupAmount, + Optional billingCreditAutoTopupAmountType, + boolean billingCreditAutoTopupEnabled, + Optional billingCreditAutoTopupExpiryType, + Optional billingCreditAutoTopupExpiryUnit, + Optional billingCreditAutoTopupExpiryUnitCount, + Optional billingCreditAutoTopupThresholdPercent, OffsetDateTime createdAt, int creditAmount, String creditDescription, Optional creditIcon, String creditId, String creditName, - Optional expiryType, - Optional expiryUnit, + Optional expiryType, + Optional expiryUnit, Optional expiryUnitCount, String id, + Optional plan, String planId, - String planName, Optional pluralName, - String resetCadence, - String resetStart, - String resetType, + BillingPlanCreditGrantResetCadence resetCadence, + BillingPlanCreditGrantResetStart resetStart, + BillingPlanCreditGrantResetType resetType, Optional singularName, OffsetDateTime updatedAt, Map additionalProperties) { + this.billingCreditAutoTopupAmount = billingCreditAutoTopupAmount; + this.billingCreditAutoTopupAmountType = billingCreditAutoTopupAmountType; + this.billingCreditAutoTopupEnabled = billingCreditAutoTopupEnabled; + this.billingCreditAutoTopupExpiryType = billingCreditAutoTopupExpiryType; + this.billingCreditAutoTopupExpiryUnit = billingCreditAutoTopupExpiryUnit; + this.billingCreditAutoTopupExpiryUnitCount = billingCreditAutoTopupExpiryUnitCount; + this.billingCreditAutoTopupThresholdPercent = billingCreditAutoTopupThresholdPercent; this.createdAt = createdAt; this.creditAmount = creditAmount; this.creditDescription = creditDescription; @@ -90,8 +118,8 @@ private PlanCreditGrantView( this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; this.id = id; + this.plan = plan; this.planId = planId; - this.planName = planName; this.pluralName = pluralName; this.resetCadence = resetCadence; this.resetStart = resetStart; @@ -101,6 +129,41 @@ private PlanCreditGrantView( this.additionalProperties = additionalProperties; } + @JsonProperty("billing_credit_auto_topup_amount") + public Optional getBillingCreditAutoTopupAmount() { + return billingCreditAutoTopupAmount; + } + + @JsonProperty("billing_credit_auto_topup_amount_type") + public Optional getBillingCreditAutoTopupAmountType() { + return billingCreditAutoTopupAmountType; + } + + @JsonProperty("billing_credit_auto_topup_enabled") + public boolean getBillingCreditAutoTopupEnabled() { + return billingCreditAutoTopupEnabled; + } + + @JsonProperty("billing_credit_auto_topup_expiry_type") + public Optional getBillingCreditAutoTopupExpiryType() { + return billingCreditAutoTopupExpiryType; + } + + @JsonProperty("billing_credit_auto_topup_expiry_unit") + public Optional getBillingCreditAutoTopupExpiryUnit() { + return billingCreditAutoTopupExpiryUnit; + } + + @JsonProperty("billing_credit_auto_topup_expiry_unit_count") + public Optional getBillingCreditAutoTopupExpiryUnitCount() { + return billingCreditAutoTopupExpiryUnitCount; + } + + @JsonProperty("billing_credit_auto_topup_threshold_percent") + public Optional getBillingCreditAutoTopupThresholdPercent() { + return billingCreditAutoTopupThresholdPercent; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; @@ -132,12 +195,12 @@ public String getCreditName() { } @JsonProperty("expiry_type") - public Optional getExpiryType() { + public Optional getExpiryType() { return expiryType; } @JsonProperty("expiry_unit") - public Optional getExpiryUnit() { + public Optional getExpiryUnit() { return expiryUnit; } @@ -151,33 +214,33 @@ public String getId() { return id; } + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + @JsonProperty("plan_id") public String getPlanId() { return planId; } - @JsonProperty("plan_name") - public String getPlanName() { - return planName; - } - @JsonProperty("plural_name") public Optional getPluralName() { return pluralName; } @JsonProperty("reset_cadence") - public String getResetCadence() { + public BillingPlanCreditGrantResetCadence getResetCadence() { return resetCadence; } @JsonProperty("reset_start") - public String getResetStart() { + public BillingPlanCreditGrantResetStart getResetStart() { return resetStart; } @JsonProperty("reset_type") - public String getResetType() { + public BillingPlanCreditGrantResetType getResetType() { return resetType; } @@ -203,7 +266,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(PlanCreditGrantView other) { - return createdAt.equals(other.createdAt) + return billingCreditAutoTopupAmount.equals(other.billingCreditAutoTopupAmount) + && billingCreditAutoTopupAmountType.equals(other.billingCreditAutoTopupAmountType) + && billingCreditAutoTopupEnabled == other.billingCreditAutoTopupEnabled + && billingCreditAutoTopupExpiryType.equals(other.billingCreditAutoTopupExpiryType) + && billingCreditAutoTopupExpiryUnit.equals(other.billingCreditAutoTopupExpiryUnit) + && billingCreditAutoTopupExpiryUnitCount.equals(other.billingCreditAutoTopupExpiryUnitCount) + && billingCreditAutoTopupThresholdPercent.equals(other.billingCreditAutoTopupThresholdPercent) + && createdAt.equals(other.createdAt) && creditAmount == other.creditAmount && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) @@ -213,8 +283,8 @@ private boolean equalTo(PlanCreditGrantView other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && id.equals(other.id) + && plan.equals(other.plan) && planId.equals(other.planId) - && planName.equals(other.planName) && pluralName.equals(other.pluralName) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) @@ -226,6 +296,13 @@ private boolean equalTo(PlanCreditGrantView other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.billingCreditAutoTopupAmount, + this.billingCreditAutoTopupAmountType, + this.billingCreditAutoTopupEnabled, + this.billingCreditAutoTopupExpiryType, + this.billingCreditAutoTopupExpiryUnit, + this.billingCreditAutoTopupExpiryUnitCount, + this.billingCreditAutoTopupThresholdPercent, this.createdAt, this.creditAmount, this.creditDescription, @@ -236,8 +313,8 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.id, + this.plan, this.planId, - this.planName, this.pluralName, this.resetCadence, this.resetStart, @@ -251,16 +328,20 @@ public String toString() { return ObjectMappers.stringify(this); } - public static CreatedAtStage builder() { + public static BillingCreditAutoTopupEnabledStage builder() { return new Builder(); } - public interface CreatedAtStage { - CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt); + public interface BillingCreditAutoTopupEnabledStage { + CreatedAtStage billingCreditAutoTopupEnabled(boolean billingCreditAutoTopupEnabled); Builder from(PlanCreditGrantView other); } + public interface CreatedAtStage { + CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt); + } + public interface CreditAmountStage { CreditDescriptionStage creditAmount(int creditAmount); } @@ -282,23 +363,19 @@ public interface IdStage { } public interface PlanIdStage { - PlanNameStage planId(@NotNull String planId); - } - - public interface PlanNameStage { - ResetCadenceStage planName(@NotNull String planName); + ResetCadenceStage planId(@NotNull String planId); } public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull String resetCadence); + ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); } public interface ResetStartStage { - ResetTypeStage resetStart(@NotNull String resetStart); + ResetTypeStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); } public interface ResetTypeStage { - UpdatedAtStage resetType(@NotNull String resetType); + UpdatedAtStage resetType(@NotNull BillingPlanCreditGrantResetType resetType); } public interface UpdatedAtStage { @@ -308,22 +385,52 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanCreditGrantView build(); + _FinalStage billingCreditAutoTopupAmount(Optional billingCreditAutoTopupAmount); + + _FinalStage billingCreditAutoTopupAmount(Integer billingCreditAutoTopupAmount); + + _FinalStage billingCreditAutoTopupAmountType(Optional billingCreditAutoTopupAmountType); + + _FinalStage billingCreditAutoTopupAmountType(String billingCreditAutoTopupAmountType); + + _FinalStage billingCreditAutoTopupExpiryType( + Optional billingCreditAutoTopupExpiryType); + + _FinalStage billingCreditAutoTopupExpiryType(BillingCreditExpiryType billingCreditAutoTopupExpiryType); + + _FinalStage billingCreditAutoTopupExpiryUnit( + Optional billingCreditAutoTopupExpiryUnit); + + _FinalStage billingCreditAutoTopupExpiryUnit(BillingCreditExpiryUnit billingCreditAutoTopupExpiryUnit); + + _FinalStage billingCreditAutoTopupExpiryUnitCount(Optional billingCreditAutoTopupExpiryUnitCount); + + _FinalStage billingCreditAutoTopupExpiryUnitCount(Integer billingCreditAutoTopupExpiryUnitCount); + + _FinalStage billingCreditAutoTopupThresholdPercent(Optional billingCreditAutoTopupThresholdPercent); + + _FinalStage billingCreditAutoTopupThresholdPercent(Integer billingCreditAutoTopupThresholdPercent); + _FinalStage creditIcon(Optional creditIcon); _FinalStage creditIcon(String creditIcon); - _FinalStage expiryType(Optional expiryType); + _FinalStage expiryType(Optional expiryType); - _FinalStage expiryType(String expiryType); + _FinalStage expiryType(BillingCreditExpiryType expiryType); - _FinalStage expiryUnit(Optional expiryUnit); + _FinalStage expiryUnit(Optional expiryUnit); - _FinalStage expiryUnit(String expiryUnit); + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); _FinalStage expiryUnitCount(Optional expiryUnitCount); _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage plan(Optional plan); + + _FinalStage plan(GenericPreviewObject plan); + _FinalStage pluralName(Optional pluralName); _FinalStage pluralName(String pluralName); @@ -335,19 +442,21 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CreatedAtStage, + implements BillingCreditAutoTopupEnabledStage, + CreatedAtStage, CreditAmountStage, CreditDescriptionStage, CreditIdStage, CreditNameStage, IdStage, PlanIdStage, - PlanNameStage, ResetCadenceStage, ResetStartStage, ResetTypeStage, UpdatedAtStage, _FinalStage { + private boolean billingCreditAutoTopupEnabled; + private OffsetDateTime createdAt; private int creditAmount; @@ -362,13 +471,11 @@ public static final class Builder private String planId; - private String planName; + private BillingPlanCreditGrantResetCadence resetCadence; - private String resetCadence; + private BillingPlanCreditGrantResetStart resetStart; - private String resetStart; - - private String resetType; + private BillingPlanCreditGrantResetType resetType; private OffsetDateTime updatedAt; @@ -376,14 +483,28 @@ public static final class Builder private Optional pluralName = Optional.empty(); + private Optional plan = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); - private Optional expiryUnit = Optional.empty(); + private Optional expiryUnit = Optional.empty(); - private Optional expiryType = Optional.empty(); + private Optional expiryType = Optional.empty(); private Optional creditIcon = Optional.empty(); + private Optional billingCreditAutoTopupThresholdPercent = Optional.empty(); + + private Optional billingCreditAutoTopupExpiryUnitCount = Optional.empty(); + + private Optional billingCreditAutoTopupExpiryUnit = Optional.empty(); + + private Optional billingCreditAutoTopupExpiryType = Optional.empty(); + + private Optional billingCreditAutoTopupAmountType = Optional.empty(); + + private Optional billingCreditAutoTopupAmount = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -391,6 +512,13 @@ private Builder() {} @java.lang.Override public Builder from(PlanCreditGrantView other) { + billingCreditAutoTopupAmount(other.getBillingCreditAutoTopupAmount()); + billingCreditAutoTopupAmountType(other.getBillingCreditAutoTopupAmountType()); + billingCreditAutoTopupEnabled(other.getBillingCreditAutoTopupEnabled()); + billingCreditAutoTopupExpiryType(other.getBillingCreditAutoTopupExpiryType()); + billingCreditAutoTopupExpiryUnit(other.getBillingCreditAutoTopupExpiryUnit()); + billingCreditAutoTopupExpiryUnitCount(other.getBillingCreditAutoTopupExpiryUnitCount()); + billingCreditAutoTopupThresholdPercent(other.getBillingCreditAutoTopupThresholdPercent()); createdAt(other.getCreatedAt()); creditAmount(other.getCreditAmount()); creditDescription(other.getCreditDescription()); @@ -401,8 +529,8 @@ public Builder from(PlanCreditGrantView other) { expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); id(other.getId()); + plan(other.getPlan()); planId(other.getPlanId()); - planName(other.getPlanName()); pluralName(other.getPluralName()); resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); @@ -412,6 +540,13 @@ public Builder from(PlanCreditGrantView other) { return this; } + @java.lang.Override + @JsonSetter("billing_credit_auto_topup_enabled") + public CreatedAtStage billingCreditAutoTopupEnabled(boolean billingCreditAutoTopupEnabled) { + this.billingCreditAutoTopupEnabled = billingCreditAutoTopupEnabled; + return this; + } + @java.lang.Override @JsonSetter("created_at") public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -456,35 +591,28 @@ public PlanIdStage id(@NotNull String id) { @java.lang.Override @JsonSetter("plan_id") - public PlanNameStage planId(@NotNull String planId) { + public ResetCadenceStage planId(@NotNull String planId) { this.planId = Objects.requireNonNull(planId, "planId must not be null"); return this; } - @java.lang.Override - @JsonSetter("plan_name") - public ResetCadenceStage planName(@NotNull String planName) { - this.planName = Objects.requireNonNull(planName, "planName must not be null"); - return this; - } - @java.lang.Override @JsonSetter("reset_cadence") - public ResetStartStage resetCadence(@NotNull String resetCadence) { + public ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence) { this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); return this; } @java.lang.Override @JsonSetter("reset_start") - public ResetTypeStage resetStart(@NotNull String resetStart) { + public ResetTypeStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart) { this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); return this; } @java.lang.Override @JsonSetter("reset_type") - public UpdatedAtStage resetType(@NotNull String resetType) { + public UpdatedAtStage resetType(@NotNull BillingPlanCreditGrantResetType resetType) { this.resetType = Objects.requireNonNull(resetType, "resetType must not be null"); return this; } @@ -522,6 +650,19 @@ public _FinalStage pluralName(Optional pluralName) { return this; } + @java.lang.Override + public _FinalStage plan(GenericPreviewObject plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + @java.lang.Override public _FinalStage expiryUnitCount(Integer expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); @@ -536,27 +677,27 @@ public _FinalStage expiryUnitCount(Optional expiryUnitCount) { } @java.lang.Override - public _FinalStage expiryUnit(String expiryUnit) { + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { this.expiryUnit = Optional.ofNullable(expiryUnit); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) - public _FinalStage expiryUnit(Optional expiryUnit) { + public _FinalStage expiryUnit(Optional expiryUnit) { this.expiryUnit = expiryUnit; return this; } @java.lang.Override - public _FinalStage expiryType(String expiryType) { + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { this.expiryType = Optional.ofNullable(expiryType); return this; } @java.lang.Override @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) - public _FinalStage expiryType(Optional expiryType) { + public _FinalStage expiryType(Optional expiryType) { this.expiryType = expiryType; return this; } @@ -574,9 +715,98 @@ public _FinalStage creditIcon(Optional creditIcon) { return this; } + @java.lang.Override + public _FinalStage billingCreditAutoTopupThresholdPercent(Integer billingCreditAutoTopupThresholdPercent) { + this.billingCreditAutoTopupThresholdPercent = Optional.ofNullable(billingCreditAutoTopupThresholdPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_threshold_percent", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupThresholdPercent( + Optional billingCreditAutoTopupThresholdPercent) { + this.billingCreditAutoTopupThresholdPercent = billingCreditAutoTopupThresholdPercent; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditAutoTopupExpiryUnitCount(Integer billingCreditAutoTopupExpiryUnitCount) { + this.billingCreditAutoTopupExpiryUnitCount = Optional.ofNullable(billingCreditAutoTopupExpiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupExpiryUnitCount( + Optional billingCreditAutoTopupExpiryUnitCount) { + this.billingCreditAutoTopupExpiryUnitCount = billingCreditAutoTopupExpiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditAutoTopupExpiryUnit(BillingCreditExpiryUnit billingCreditAutoTopupExpiryUnit) { + this.billingCreditAutoTopupExpiryUnit = Optional.ofNullable(billingCreditAutoTopupExpiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_expiry_unit", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupExpiryUnit( + Optional billingCreditAutoTopupExpiryUnit) { + this.billingCreditAutoTopupExpiryUnit = billingCreditAutoTopupExpiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditAutoTopupExpiryType(BillingCreditExpiryType billingCreditAutoTopupExpiryType) { + this.billingCreditAutoTopupExpiryType = Optional.ofNullable(billingCreditAutoTopupExpiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_expiry_type", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupExpiryType( + Optional billingCreditAutoTopupExpiryType) { + this.billingCreditAutoTopupExpiryType = billingCreditAutoTopupExpiryType; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditAutoTopupAmountType(String billingCreditAutoTopupAmountType) { + this.billingCreditAutoTopupAmountType = Optional.ofNullable(billingCreditAutoTopupAmountType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_amount_type", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupAmountType(Optional billingCreditAutoTopupAmountType) { + this.billingCreditAutoTopupAmountType = billingCreditAutoTopupAmountType; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditAutoTopupAmount(Integer billingCreditAutoTopupAmount) { + this.billingCreditAutoTopupAmount = Optional.ofNullable(billingCreditAutoTopupAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_auto_topup_amount", nulls = Nulls.SKIP) + public _FinalStage billingCreditAutoTopupAmount(Optional billingCreditAutoTopupAmount) { + this.billingCreditAutoTopupAmount = billingCreditAutoTopupAmount; + return this; + } + @java.lang.Override public PlanCreditGrantView build() { return new PlanCreditGrantView( + billingCreditAutoTopupAmount, + billingCreditAutoTopupAmountType, + billingCreditAutoTopupEnabled, + billingCreditAutoTopupExpiryType, + billingCreditAutoTopupExpiryUnit, + billingCreditAutoTopupExpiryUnitCount, + billingCreditAutoTopupThresholdPercent, createdAt, creditAmount, creditDescription, @@ -587,8 +817,8 @@ public PlanCreditGrantView build() { expiryUnit, expiryUnitCount, id, + plan, planId, - planName, pluralName, resetCadence, resetStart, diff --git a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java index 873a4a1..ae9a77d 100644 --- a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java @@ -28,11 +28,11 @@ public final class PlanDetailResponseData { private final Optional billingProduct; - private final String chargeType; + private final ChargeType chargeType; private final int companyCount; - private final String controlledBy; + private final PlanControlledByType controlledBy; private final OffsetDateTime createdAt; @@ -58,12 +58,14 @@ public final class PlanDetailResponseData { private final Optional oneTimePrice; - private final String planType; + private final PlanType planType; private final Optional trialDays; private final OffsetDateTime updatedAt; + private final List versions; + private final Optional yearlyPrice; private final Map additionalProperties; @@ -71,9 +73,9 @@ public final class PlanDetailResponseData { private PlanDetailResponseData( Optional audienceType, Optional billingProduct, - String chargeType, + ChargeType chargeType, int companyCount, - String controlledBy, + PlanControlledByType controlledBy, OffsetDateTime createdAt, String description, List features, @@ -86,9 +88,10 @@ private PlanDetailResponseData( Optional monthlyPrice, String name, Optional oneTimePrice, - String planType, + PlanType planType, Optional trialDays, OffsetDateTime updatedAt, + List versions, Optional yearlyPrice, Map additionalProperties) { this.audienceType = audienceType; @@ -111,6 +114,7 @@ private PlanDetailResponseData( this.planType = planType; this.trialDays = trialDays; this.updatedAt = updatedAt; + this.versions = versions; this.yearlyPrice = yearlyPrice; this.additionalProperties = additionalProperties; } @@ -126,7 +130,7 @@ public Optional getBillingProduct() { } @JsonProperty("charge_type") - public String getChargeType() { + public ChargeType getChargeType() { return chargeType; } @@ -136,7 +140,7 @@ public int getCompanyCount() { } @JsonProperty("controlled_by") - public String getControlledBy() { + public PlanControlledByType getControlledBy() { return controlledBy; } @@ -201,7 +205,7 @@ public Optional getOneTimePrice() { } @JsonProperty("plan_type") - public String getPlanType() { + public PlanType getPlanType() { return planType; } @@ -215,6 +219,11 @@ public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonProperty("versions") + public List getVersions() { + return versions; + } + @JsonProperty("yearly_price") public Optional getYearlyPrice() { return yearlyPrice; @@ -252,6 +261,7 @@ private boolean equalTo(PlanDetailResponseData other) { && planType.equals(other.planType) && trialDays.equals(other.trialDays) && updatedAt.equals(other.updatedAt) + && versions.equals(other.versions) && yearlyPrice.equals(other.yearlyPrice); } @@ -278,6 +288,7 @@ public int hashCode() { this.planType, this.trialDays, this.updatedAt, + this.versions, this.yearlyPrice); } @@ -291,7 +302,7 @@ public static ChargeTypeStage builder() { } public interface ChargeTypeStage { - CompanyCountStage chargeType(@NotNull String chargeType); + CompanyCountStage chargeType(@NotNull ChargeType chargeType); Builder from(PlanDetailResponseData other); } @@ -301,7 +312,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull String controlledBy); + CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); } public interface CreatedAtStage { @@ -337,7 +348,7 @@ public interface NameStage { } public interface PlanTypeStage { - UpdatedAtStage planType(@NotNull String planType); + UpdatedAtStage planType(@NotNull PlanType planType); } public interface UpdatedAtStage { @@ -377,6 +388,12 @@ public interface _FinalStage { _FinalStage trialDays(Integer trialDays); + _FinalStage versions(List versions); + + _FinalStage addVersions(PlanVersionResponseData versions); + + _FinalStage addAllVersions(List versions); + _FinalStage yearlyPrice(Optional yearlyPrice); _FinalStage yearlyPrice(BillingPriceResponseData yearlyPrice); @@ -398,11 +415,11 @@ public static final class Builder PlanTypeStage, UpdatedAtStage, _FinalStage { - private String chargeType; + private ChargeType chargeType; private int companyCount; - private String controlledBy; + private PlanControlledByType controlledBy; private OffsetDateTime createdAt; @@ -420,12 +437,14 @@ public static final class Builder private String name; - private String planType; + private PlanType planType; private OffsetDateTime updatedAt; private Optional yearlyPrice = Optional.empty(); + private List versions = new ArrayList<>(); + private Optional trialDays = Optional.empty(); private Optional oneTimePrice = Optional.empty(); @@ -467,13 +486,14 @@ public Builder from(PlanDetailResponseData other) { planType(other.getPlanType()); trialDays(other.getTrialDays()); updatedAt(other.getUpdatedAt()); + versions(other.getVersions()); yearlyPrice(other.getYearlyPrice()); return this; } @java.lang.Override @JsonSetter("charge_type") - public CompanyCountStage chargeType(@NotNull String chargeType) { + public CompanyCountStage chargeType(@NotNull ChargeType chargeType) { this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); return this; } @@ -487,7 +507,7 @@ public ControlledByStage companyCount(int companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull String controlledBy) { + public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -550,7 +570,7 @@ public PlanTypeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("plan_type") - public UpdatedAtStage planType(@NotNull String planType) { + public UpdatedAtStage planType(@NotNull PlanType planType) { this.planType = Objects.requireNonNull(planType, "planType must not be null"); return this; } @@ -575,6 +595,30 @@ public _FinalStage yearlyPrice(Optional yearlyPrice) { return this; } + @java.lang.Override + public _FinalStage addAllVersions(List versions) { + if (versions != null) { + this.versions.addAll(versions); + } + return this; + } + + @java.lang.Override + public _FinalStage addVersions(PlanVersionResponseData versions) { + this.versions.add(versions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "versions", nulls = Nulls.SKIP) + public _FinalStage versions(List versions) { + this.versions.clear(); + if (versions != null) { + this.versions.addAll(versions); + } + return this; + } + @java.lang.Override public _FinalStage trialDays(Integer trialDays) { this.trialDays = Optional.ofNullable(trialDays); @@ -701,6 +745,7 @@ public PlanDetailResponseData build() { planType, trialDays, updatedAt, + versions, yearlyPrice, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java index f5757a5..d779430 100644 --- a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java @@ -48,7 +48,7 @@ public final class PlanEntitlementResponseData { private final String planId; - private final Optional priceBehavior; + private final Optional priceBehavior; private final String ruleId; @@ -70,7 +70,7 @@ public final class PlanEntitlementResponseData { private final Optional valueTraitId; - private final String valueType; + private final EntitlementValueType valueType; private final Map additionalProperties; @@ -88,7 +88,7 @@ private PlanEntitlementResponseData( Optional metricPeriodMonthReset, Optional plan, String planId, - Optional priceBehavior, + Optional priceBehavior, String ruleId, Optional ruleIdUsageExceeded, Optional softLimit, @@ -99,7 +99,7 @@ private PlanEntitlementResponseData( Optional valueNumeric, Optional valueTrait, Optional valueTraitId, - String valueType, + EntitlementValueType valueType, Map additionalProperties) { this.billingThreshold = billingThreshold; this.consumptionRate = consumptionRate; @@ -195,7 +195,7 @@ public String getPlanId() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -250,7 +250,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public String getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -363,7 +363,7 @@ public interface UpdatedAtStage { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull String valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { @@ -401,9 +401,9 @@ public interface _FinalStage { _FinalStage plan(PlanResponseData plan); - _FinalStage priceBehavior(Optional priceBehavior); + _FinalStage priceBehavior(Optional priceBehavior); - _FinalStage priceBehavior(String priceBehavior); + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); _FinalStage ruleIdUsageExceeded(Optional ruleIdUsageExceeded); @@ -463,7 +463,7 @@ public static final class Builder private OffsetDateTime updatedAt; - private String valueType; + private EntitlementValueType valueType; private Optional valueTraitId = Optional.empty(); @@ -481,7 +481,7 @@ public static final class Builder private Optional ruleIdUsageExceeded = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional plan = Optional.empty(); @@ -585,7 +585,7 @@ public ValueTypeStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull String valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } @@ -695,14 +695,14 @@ public _FinalStage ruleIdUsageExceeded(Optional ruleIdUsageExceeded) { } @java.lang.Override - public _FinalStage priceBehavior(String priceBehavior) { + 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) { + public _FinalStage priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } diff --git a/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java index 39b50df..62e29a2 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java @@ -27,6 +27,8 @@ public final class PlanGroupDetailResponseData { private final CheckoutSettingsResponseData checkoutSettings; + private final ComponentSettingsResponseData componentSettings; + private final Optional customPlanConfig; private final Optional customPlanId; @@ -45,7 +47,7 @@ public final class PlanGroupDetailResponseData { private final Optional initialPlanId; - private final Optional initialPlanPrice; + private final Optional initialPlanPrice; private final Optional initialPlanPriceId; @@ -59,13 +61,27 @@ public final class PlanGroupDetailResponseData { private final boolean preventDowngradesWhenOverLimit; + private final boolean preventSelfServiceDowngrade; + + private final Optional preventSelfServiceDowngradeButtonText; + + private final Optional preventSelfServiceDowngradeUrl; + + private final String prorationBehavior; + + private final Optional scheduledDowngradeBehavior; + + private final Optional scheduledDowngradePreventWhenOverLimit; + + private final boolean showAsMonthlyPrices; + private final boolean showCredits; private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; - private final boolean syncCustomerBillingDetailsForTax; + private final boolean syncCustomerBillingDetails; private final boolean taxCollectionEnabled; @@ -75,7 +91,7 @@ public final class PlanGroupDetailResponseData { private final Optional trialExpiryPlanId; - private final Optional trialExpiryPlanPrice; + private final Optional trialExpiryPlanPrice; private final Optional trialExpiryPlanPriceId; @@ -86,6 +102,7 @@ public final class PlanGroupDetailResponseData { private PlanGroupDetailResponseData( List addOns, CheckoutSettingsResponseData checkoutSettings, + ComponentSettingsResponseData componentSettings, Optional customPlanConfig, Optional customPlanId, Optional defaultPlan, @@ -95,27 +112,35 @@ private PlanGroupDetailResponseData( String id, Optional initialPlan, Optional initialPlanId, - Optional initialPlanPrice, + Optional initialPlanPrice, Optional initialPlanPriceId, List orderedAddOnList, List orderedBundleList, List orderedPlanList, List plans, boolean preventDowngradesWhenOverLimit, + boolean preventSelfServiceDowngrade, + Optional preventSelfServiceDowngradeButtonText, + Optional preventSelfServiceDowngradeUrl, + String prorationBehavior, + Optional scheduledDowngradeBehavior, + Optional scheduledDowngradePreventWhenOverLimit, + boolean showAsMonthlyPrices, boolean showCredits, boolean showPeriodToggle, boolean showZeroPriceAsFree, - boolean syncCustomerBillingDetailsForTax, + boolean syncCustomerBillingDetails, boolean taxCollectionEnabled, Optional trialDays, Optional trialExpiryPlan, Optional trialExpiryPlanId, - Optional trialExpiryPlanPrice, + Optional trialExpiryPlanPrice, Optional trialExpiryPlanPriceId, Optional trialPaymentMethodRequired, Map additionalProperties) { this.addOns = addOns; this.checkoutSettings = checkoutSettings; + this.componentSettings = componentSettings; this.customPlanConfig = customPlanConfig; this.customPlanId = customPlanId; this.defaultPlan = defaultPlan; @@ -132,10 +157,17 @@ private PlanGroupDetailResponseData( this.orderedPlanList = orderedPlanList; this.plans = plans; this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.prorationBehavior = prorationBehavior; + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + this.syncCustomerBillingDetails = syncCustomerBillingDetails; this.taxCollectionEnabled = taxCollectionEnabled; this.trialDays = trialDays; this.trialExpiryPlan = trialExpiryPlan; @@ -156,6 +188,11 @@ public CheckoutSettingsResponseData getCheckoutSettings() { return checkoutSettings; } + @JsonProperty("component_settings") + public ComponentSettingsResponseData getComponentSettings() { + return componentSettings; + } + @JsonProperty("custom_plan_config") public Optional getCustomPlanConfig() { return customPlanConfig; @@ -202,7 +239,7 @@ public Optional getInitialPlanId() { } @JsonProperty("initial_plan_price") - public Optional getInitialPlanPrice() { + public Optional getInitialPlanPrice() { return initialPlanPrice; } @@ -236,6 +273,41 @@ public boolean getPreventDowngradesWhenOverLimit() { return preventDowngradesWhenOverLimit; } + @JsonProperty("prevent_self_service_downgrade") + public boolean getPreventSelfServiceDowngrade() { + return preventSelfServiceDowngrade; + } + + @JsonProperty("prevent_self_service_downgrade_button_text") + public Optional getPreventSelfServiceDowngradeButtonText() { + return preventSelfServiceDowngradeButtonText; + } + + @JsonProperty("prevent_self_service_downgrade_url") + public Optional getPreventSelfServiceDowngradeUrl() { + return preventSelfServiceDowngradeUrl; + } + + @JsonProperty("proration_behavior") + public String getProrationBehavior() { + return prorationBehavior; + } + + @JsonProperty("scheduled_downgrade_behavior") + public Optional getScheduledDowngradeBehavior() { + return scheduledDowngradeBehavior; + } + + @JsonProperty("scheduled_downgrade_prevent_when_over_limit") + public Optional getScheduledDowngradePreventWhenOverLimit() { + return scheduledDowngradePreventWhenOverLimit; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + @JsonProperty("show_credits") public boolean getShowCredits() { return showCredits; @@ -251,9 +323,9 @@ public boolean getShowZeroPriceAsFree() { return showZeroPriceAsFree; } - @JsonProperty("sync_customer_billing_details_for_tax") - public boolean getSyncCustomerBillingDetailsForTax() { - return syncCustomerBillingDetailsForTax; + @JsonProperty("sync_customer_billing_details") + public boolean getSyncCustomerBillingDetails() { + return syncCustomerBillingDetails; } @JsonProperty("tax_collection_enabled") @@ -277,7 +349,7 @@ public Optional getTrialExpiryPlanId() { } @JsonProperty("trial_expiry_plan_price") - public Optional getTrialExpiryPlanPrice() { + public Optional getTrialExpiryPlanPrice() { return trialExpiryPlanPrice; } @@ -305,6 +377,7 @@ public Map getAdditionalProperties() { private boolean equalTo(PlanGroupDetailResponseData other) { return addOns.equals(other.addOns) && checkoutSettings.equals(other.checkoutSettings) + && componentSettings.equals(other.componentSettings) && customPlanConfig.equals(other.customPlanConfig) && customPlanId.equals(other.customPlanId) && defaultPlan.equals(other.defaultPlan) @@ -321,10 +394,17 @@ private boolean equalTo(PlanGroupDetailResponseData other) { && orderedPlanList.equals(other.orderedPlanList) && plans.equals(other.plans) && preventDowngradesWhenOverLimit == other.preventDowngradesWhenOverLimit + && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade + && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) + && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && prorationBehavior.equals(other.prorationBehavior) + && scheduledDowngradeBehavior.equals(other.scheduledDowngradeBehavior) + && scheduledDowngradePreventWhenOverLimit.equals(other.scheduledDowngradePreventWhenOverLimit) + && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree - && syncCustomerBillingDetailsForTax == other.syncCustomerBillingDetailsForTax + && syncCustomerBillingDetails == other.syncCustomerBillingDetails && taxCollectionEnabled == other.taxCollectionEnabled && trialDays.equals(other.trialDays) && trialExpiryPlan.equals(other.trialExpiryPlan) @@ -339,6 +419,7 @@ public int hashCode() { return Objects.hash( this.addOns, this.checkoutSettings, + this.componentSettings, this.customPlanConfig, this.customPlanId, this.defaultPlan, @@ -355,10 +436,17 @@ public int hashCode() { this.orderedPlanList, this.plans, this.preventDowngradesWhenOverLimit, + this.preventSelfServiceDowngrade, + this.preventSelfServiceDowngradeButtonText, + this.preventSelfServiceDowngradeUrl, + this.prorationBehavior, + this.scheduledDowngradeBehavior, + this.scheduledDowngradePreventWhenOverLimit, + this.showAsMonthlyPrices, this.showCredits, this.showPeriodToggle, this.showZeroPriceAsFree, - this.syncCustomerBillingDetailsForTax, + this.syncCustomerBillingDetails, this.taxCollectionEnabled, this.trialDays, this.trialExpiryPlan, @@ -378,17 +466,33 @@ public static CheckoutSettingsStage builder() { } public interface CheckoutSettingsStage { - IdStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings); + ComponentSettingsStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings); Builder from(PlanGroupDetailResponseData other); } + public interface ComponentSettingsStage { + IdStage componentSettings(@NotNull ComponentSettingsResponseData componentSettings); + } + public interface IdStage { PreventDowngradesWhenOverLimitStage id(@NotNull String id); } public interface PreventDowngradesWhenOverLimitStage { - ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + } + + public interface PreventSelfServiceDowngradeStage { + ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade); + } + + public interface ProrationBehaviorStage { + ShowAsMonthlyPricesStage prorationBehavior(@NotNull String prorationBehavior); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); } public interface ShowCreditsStage { @@ -400,11 +504,11 @@ public interface ShowPeriodToggleStage { } public interface ShowZeroPriceAsFreeStage { - SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree); } - public interface SyncCustomerBillingDetailsForTaxStage { - TaxCollectionEnabledStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax); + public interface SyncCustomerBillingDetailsStage { + TaxCollectionEnabledStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails); } public interface TaxCollectionEnabledStage { @@ -452,9 +556,9 @@ public interface _FinalStage { _FinalStage initialPlanId(String initialPlanId); - _FinalStage initialPlanPrice(Optional initialPlanPrice); + _FinalStage initialPlanPrice(Optional initialPlanPrice); - _FinalStage initialPlanPrice(BillingPriceResponseData initialPlanPrice); + _FinalStage initialPlanPrice(BillingPriceView initialPlanPrice); _FinalStage initialPlanPriceId(Optional initialPlanPriceId); @@ -484,6 +588,22 @@ public interface _FinalStage { _FinalStage addAllPlans(List plans); + _FinalStage preventSelfServiceDowngradeButtonText(Optional preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl); + + _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + + _FinalStage scheduledDowngradeBehavior(Optional scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradeBehavior(String scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Optional scheduledDowngradePreventWhenOverLimit); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); + _FinalStage trialDays(Optional trialDays); _FinalStage trialDays(Integer trialDays); @@ -496,9 +616,9 @@ public interface _FinalStage { _FinalStage trialExpiryPlanId(String trialExpiryPlanId); - _FinalStage trialExpiryPlanPrice(Optional trialExpiryPlanPrice); + _FinalStage trialExpiryPlanPrice(Optional trialExpiryPlanPrice); - _FinalStage trialExpiryPlanPrice(BillingPriceResponseData trialExpiryPlanPrice); + _FinalStage trialExpiryPlanPrice(BillingPriceView trialExpiryPlanPrice); _FinalStage trialExpiryPlanPriceId(Optional trialExpiryPlanPriceId); @@ -512,27 +632,39 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CheckoutSettingsStage, + ComponentSettingsStage, IdStage, PreventDowngradesWhenOverLimitStage, + PreventSelfServiceDowngradeStage, + ProrationBehaviorStage, + ShowAsMonthlyPricesStage, ShowCreditsStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, - SyncCustomerBillingDetailsForTaxStage, + SyncCustomerBillingDetailsStage, TaxCollectionEnabledStage, _FinalStage { private CheckoutSettingsResponseData checkoutSettings; + private ComponentSettingsResponseData componentSettings; + private String id; private boolean preventDowngradesWhenOverLimit; + private boolean preventSelfServiceDowngrade; + + private String prorationBehavior; + + private boolean showAsMonthlyPrices; + private boolean showCredits; private boolean showPeriodToggle; private boolean showZeroPriceAsFree; - private boolean syncCustomerBillingDetailsForTax; + private boolean syncCustomerBillingDetails; private boolean taxCollectionEnabled; @@ -540,7 +672,7 @@ public static final class Builder private Optional trialExpiryPlanPriceId = Optional.empty(); - private Optional trialExpiryPlanPrice = Optional.empty(); + private Optional trialExpiryPlanPrice = Optional.empty(); private Optional trialExpiryPlanId = Optional.empty(); @@ -548,6 +680,14 @@ public static final class Builder private Optional trialDays = Optional.empty(); + private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); + + private Optional scheduledDowngradeBehavior = Optional.empty(); + + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); + + private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); + private List plans = new ArrayList<>(); private List orderedPlanList = new ArrayList<>(); @@ -558,7 +698,7 @@ public static final class Builder private Optional initialPlanPriceId = Optional.empty(); - private Optional initialPlanPrice = Optional.empty(); + private Optional initialPlanPrice = Optional.empty(); private Optional initialPlanId = Optional.empty(); @@ -587,6 +727,7 @@ private Builder() {} public Builder from(PlanGroupDetailResponseData other) { addOns(other.getAddOns()); checkoutSettings(other.getCheckoutSettings()); + componentSettings(other.getComponentSettings()); customPlanConfig(other.getCustomPlanConfig()); customPlanId(other.getCustomPlanId()); defaultPlan(other.getDefaultPlan()); @@ -603,10 +744,17 @@ public Builder from(PlanGroupDetailResponseData other) { orderedPlanList(other.getOrderedPlanList()); plans(other.getPlans()); preventDowngradesWhenOverLimit(other.getPreventDowngradesWhenOverLimit()); + preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); + preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); + preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + prorationBehavior(other.getProrationBehavior()); + scheduledDowngradeBehavior(other.getScheduledDowngradeBehavior()); + scheduledDowngradePreventWhenOverLimit(other.getScheduledDowngradePreventWhenOverLimit()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); - syncCustomerBillingDetailsForTax(other.getSyncCustomerBillingDetailsForTax()); + syncCustomerBillingDetails(other.getSyncCustomerBillingDetails()); taxCollectionEnabled(other.getTaxCollectionEnabled()); trialDays(other.getTrialDays()); trialExpiryPlan(other.getTrialExpiryPlan()); @@ -619,11 +767,18 @@ public Builder from(PlanGroupDetailResponseData other) { @java.lang.Override @JsonSetter("checkout_settings") - public IdStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings) { + public ComponentSettingsStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings) { this.checkoutSettings = Objects.requireNonNull(checkoutSettings, "checkoutSettings must not be null"); return this; } + @java.lang.Override + @JsonSetter("component_settings") + public IdStage componentSettings(@NotNull ComponentSettingsResponseData componentSettings) { + this.componentSettings = Objects.requireNonNull(componentSettings, "componentSettings must not be null"); + return this; + } + @java.lang.Override @JsonSetter("id") public PreventDowngradesWhenOverLimitStage id(@NotNull String id) { @@ -633,11 +788,32 @@ public PreventDowngradesWhenOverLimitStage id(@NotNull String id) { @java.lang.Override @JsonSetter("prevent_downgrades_when_over_limit") - public ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { + public PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; return this; } + @java.lang.Override + @JsonSetter("prevent_self_service_downgrade") + public ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade) { + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + return this; + } + + @java.lang.Override + @JsonSetter("proration_behavior") + public ShowAsMonthlyPricesStage prorationBehavior(@NotNull String prorationBehavior) { + this.prorationBehavior = Objects.requireNonNull(prorationBehavior, "prorationBehavior must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + @java.lang.Override @JsonSetter("show_credits") public ShowPeriodToggleStage showCredits(boolean showCredits) { @@ -654,15 +830,15 @@ public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @java.lang.Override @JsonSetter("show_zero_price_as_free") - public SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { + public SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { this.showZeroPriceAsFree = showZeroPriceAsFree; return this; } @java.lang.Override - @JsonSetter("sync_customer_billing_details_for_tax") - public TaxCollectionEnabledStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax) { - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + @JsonSetter("sync_customer_billing_details") + public TaxCollectionEnabledStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails) { + this.syncCustomerBillingDetails = syncCustomerBillingDetails; return this; } @@ -700,14 +876,14 @@ public _FinalStage trialExpiryPlanPriceId(Optional trialExpiryPlanPriceI } @java.lang.Override - public _FinalStage trialExpiryPlanPrice(BillingPriceResponseData trialExpiryPlanPrice) { + public _FinalStage trialExpiryPlanPrice(BillingPriceView trialExpiryPlanPrice) { this.trialExpiryPlanPrice = Optional.ofNullable(trialExpiryPlanPrice); return this; } @java.lang.Override @JsonSetter(value = "trial_expiry_plan_price", nulls = Nulls.SKIP) - public _FinalStage trialExpiryPlanPrice(Optional trialExpiryPlanPrice) { + public _FinalStage trialExpiryPlanPrice(Optional trialExpiryPlanPrice) { this.trialExpiryPlanPrice = trialExpiryPlanPrice; return this; } @@ -751,6 +927,60 @@ public _FinalStage trialDays(Optional trialDays) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = Optional.ofNullable(scheduledDowngradePreventWhenOverLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_prevent_when_over_limit", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradePreventWhenOverLimit( + Optional scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + return this; + } + + @java.lang.Override + public _FinalStage scheduledDowngradeBehavior(String scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = Optional.ofNullable(scheduledDowngradeBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_behavior", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradeBehavior(Optional scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_url", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = Optional.ofNullable(preventSelfServiceDowngradeButtonText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_button_text", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeButtonText( + Optional preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + return this; + } + @java.lang.Override public _FinalStage addAllPlans(List plans) { if (plans != null) { @@ -861,14 +1091,14 @@ public _FinalStage initialPlanPriceId(Optional initialPlanPriceId) { } @java.lang.Override - public _FinalStage initialPlanPrice(BillingPriceResponseData initialPlanPrice) { + public _FinalStage initialPlanPrice(BillingPriceView initialPlanPrice) { this.initialPlanPrice = Optional.ofNullable(initialPlanPrice); return this; } @java.lang.Override @JsonSetter(value = "initial_plan_price", nulls = Nulls.SKIP) - public _FinalStage initialPlanPrice(Optional initialPlanPrice) { + public _FinalStage initialPlanPrice(Optional initialPlanPrice) { this.initialPlanPrice = initialPlanPrice; return this; } @@ -1006,6 +1236,7 @@ public PlanGroupDetailResponseData build() { return new PlanGroupDetailResponseData( addOns, checkoutSettings, + componentSettings, customPlanConfig, customPlanId, defaultPlan, @@ -1022,10 +1253,17 @@ public PlanGroupDetailResponseData build() { orderedPlanList, plans, preventDowngradesWhenOverLimit, + preventSelfServiceDowngrade, + preventSelfServiceDowngradeButtonText, + preventSelfServiceDowngradeUrl, + prorationBehavior, + scheduledDowngradeBehavior, + scheduledDowngradePreventWhenOverLimit, + showAsMonthlyPrices, showCredits, showPeriodToggle, showZeroPriceAsFree, - syncCustomerBillingDetailsForTax, + syncCustomerBillingDetails, taxCollectionEnabled, trialDays, trialExpiryPlan, diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java index 02b7440..ed1915a 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java @@ -28,13 +28,13 @@ public final class PlanGroupPlanDetailResponseData { private final Optional billingProduct; - private final String chargeType; + private final ChargeType chargeType; private final int companyCount; private final List compatiblePlanIds; - private final String controlledBy; + private final PlanControlledByType controlledBy; private final OffsetDateTime createdAt; @@ -66,12 +66,14 @@ public final class PlanGroupPlanDetailResponseData { private final Optional oneTimePrice; - private final String planType; + private final PlanType planType; private final Optional trialDays; private final OffsetDateTime updatedAt; + private final List versions; + private final Optional yearlyPrice; private final Map additionalProperties; @@ -79,10 +81,10 @@ public final class PlanGroupPlanDetailResponseData { private PlanGroupPlanDetailResponseData( Optional audienceType, Optional billingProduct, - String chargeType, + ChargeType chargeType, int companyCount, List compatiblePlanIds, - String controlledBy, + PlanControlledByType controlledBy, OffsetDateTime createdAt, Optional customPlanConfig, String description, @@ -98,9 +100,10 @@ private PlanGroupPlanDetailResponseData( Optional monthlyPrice, String name, Optional oneTimePrice, - String planType, + PlanType planType, Optional trialDays, OffsetDateTime updatedAt, + List versions, Optional yearlyPrice, Map additionalProperties) { this.audienceType = audienceType; @@ -127,6 +130,7 @@ private PlanGroupPlanDetailResponseData( this.planType = planType; this.trialDays = trialDays; this.updatedAt = updatedAt; + this.versions = versions; this.yearlyPrice = yearlyPrice; this.additionalProperties = additionalProperties; } @@ -142,7 +146,7 @@ public Optional getBillingProduct() { } @JsonProperty("charge_type") - public String getChargeType() { + public ChargeType getChargeType() { return chargeType; } @@ -157,7 +161,7 @@ public List getCompatiblePlanIds() { } @JsonProperty("controlled_by") - public String getControlledBy() { + public PlanControlledByType getControlledBy() { return controlledBy; } @@ -237,7 +241,7 @@ public Optional getOneTimePrice() { } @JsonProperty("plan_type") - public String getPlanType() { + public PlanType getPlanType() { return planType; } @@ -251,6 +255,11 @@ public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonProperty("versions") + public List getVersions() { + return versions; + } + @JsonProperty("yearly_price") public Optional getYearlyPrice() { return yearlyPrice; @@ -292,6 +301,7 @@ private boolean equalTo(PlanGroupPlanDetailResponseData other) { && planType.equals(other.planType) && trialDays.equals(other.trialDays) && updatedAt.equals(other.updatedAt) + && versions.equals(other.versions) && yearlyPrice.equals(other.yearlyPrice); } @@ -322,6 +332,7 @@ public int hashCode() { this.planType, this.trialDays, this.updatedAt, + this.versions, this.yearlyPrice); } @@ -335,7 +346,7 @@ public static ChargeTypeStage builder() { } public interface ChargeTypeStage { - CompanyCountStage chargeType(@NotNull String chargeType); + CompanyCountStage chargeType(@NotNull ChargeType chargeType); Builder from(PlanGroupPlanDetailResponseData other); } @@ -345,7 +356,7 @@ public interface CompanyCountStage { } public interface ControlledByStage { - CreatedAtStage controlledBy(@NotNull String controlledBy); + CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); } public interface CreatedAtStage { @@ -385,7 +396,7 @@ public interface NameStage { } public interface PlanTypeStage { - UpdatedAtStage planType(@NotNull String planType); + UpdatedAtStage planType(@NotNull PlanType planType); } public interface UpdatedAtStage { @@ -441,6 +452,12 @@ public interface _FinalStage { _FinalStage trialDays(Integer trialDays); + _FinalStage versions(List versions); + + _FinalStage addVersions(PlanVersionResponseData versions); + + _FinalStage addAllVersions(List versions); + _FinalStage yearlyPrice(Optional yearlyPrice); _FinalStage yearlyPrice(BillingPriceResponseData yearlyPrice); @@ -463,11 +480,11 @@ public static final class Builder PlanTypeStage, UpdatedAtStage, _FinalStage { - private String chargeType; + private ChargeType chargeType; private int companyCount; - private String controlledBy; + private PlanControlledByType controlledBy; private OffsetDateTime createdAt; @@ -487,12 +504,14 @@ public static final class Builder private String name; - private String planType; + private PlanType planType; private OffsetDateTime updatedAt; private Optional yearlyPrice = Optional.empty(); + private List versions = new ArrayList<>(); + private Optional trialDays = Optional.empty(); private Optional oneTimePrice = Optional.empty(); @@ -544,13 +563,14 @@ public Builder from(PlanGroupPlanDetailResponseData other) { planType(other.getPlanType()); trialDays(other.getTrialDays()); updatedAt(other.getUpdatedAt()); + versions(other.getVersions()); yearlyPrice(other.getYearlyPrice()); return this; } @java.lang.Override @JsonSetter("charge_type") - public CompanyCountStage chargeType(@NotNull String chargeType) { + public CompanyCountStage chargeType(@NotNull ChargeType chargeType) { this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); return this; } @@ -564,7 +584,7 @@ public ControlledByStage companyCount(int companyCount) { @java.lang.Override @JsonSetter("controlled_by") - public CreatedAtStage controlledBy(@NotNull String controlledBy) { + public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); return this; } @@ -634,7 +654,7 @@ public PlanTypeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("plan_type") - public UpdatedAtStage planType(@NotNull String planType) { + public UpdatedAtStage planType(@NotNull PlanType planType) { this.planType = Objects.requireNonNull(planType, "planType must not be null"); return this; } @@ -659,6 +679,30 @@ public _FinalStage yearlyPrice(Optional yearlyPrice) { return this; } + @java.lang.Override + public _FinalStage addAllVersions(List versions) { + if (versions != null) { + this.versions.addAll(versions); + } + return this; + } + + @java.lang.Override + public _FinalStage addVersions(PlanVersionResponseData versions) { + this.versions.add(versions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "versions", nulls = Nulls.SKIP) + public _FinalStage versions(List versions) { + this.versions.clear(); + if (versions != null) { + this.versions.addAll(versions); + } + return this; + } + @java.lang.Override public _FinalStage trialDays(Integer trialDays) { this.trialDays = Optional.ofNullable(trialDays); @@ -850,6 +894,7 @@ public PlanGroupPlanDetailResponseData build() { planType, trialDays, updatedAt, + versions, yearlyPrice, additionalProperties); } diff --git a/src/main/java/com/schematic/api/types/PlanGroupResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupResponseData.java index 9772bfb..e57ddb7 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupResponseData.java @@ -29,6 +29,8 @@ public final class PlanGroupResponseData { private final CheckoutSettingsResponseData checkoutSettings; + private final ComponentSettingsResponseData componentSettings; + private final Optional defaultPlanId; private final Optional fallbackPlanId; @@ -45,13 +47,27 @@ public final class PlanGroupResponseData { private final boolean preventDowngradesWhenOverLimit; + private final boolean preventSelfServiceDowngrade; + + private final Optional preventSelfServiceDowngradeButtonText; + + private final Optional preventSelfServiceDowngradeUrl; + + private final String prorationBehavior; + + private final Optional scheduledDowngradeBehavior; + + private final Optional scheduledDowngradePreventWhenOverLimit; + + private final boolean showAsMonthlyPrices; + private final boolean showCredits; private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; - private final boolean syncCustomerBillingDetailsForTax; + private final boolean syncCustomerBillingDetails; private final boolean taxCollectionEnabled; @@ -69,6 +85,7 @@ private PlanGroupResponseData( List addOnCompatibilities, List addOnIds, CheckoutSettingsResponseData checkoutSettings, + ComponentSettingsResponseData componentSettings, Optional defaultPlanId, Optional fallbackPlanId, String id, @@ -77,10 +94,17 @@ private PlanGroupResponseData( List orderedAddOnIds, List planIds, boolean preventDowngradesWhenOverLimit, + boolean preventSelfServiceDowngrade, + Optional preventSelfServiceDowngradeButtonText, + Optional preventSelfServiceDowngradeUrl, + String prorationBehavior, + Optional scheduledDowngradeBehavior, + Optional scheduledDowngradePreventWhenOverLimit, + boolean showAsMonthlyPrices, boolean showCredits, boolean showPeriodToggle, boolean showZeroPriceAsFree, - boolean syncCustomerBillingDetailsForTax, + boolean syncCustomerBillingDetails, boolean taxCollectionEnabled, Optional trialDays, Optional trialExpiryPlanId, @@ -90,6 +114,7 @@ private PlanGroupResponseData( this.addOnCompatibilities = addOnCompatibilities; this.addOnIds = addOnIds; this.checkoutSettings = checkoutSettings; + this.componentSettings = componentSettings; this.defaultPlanId = defaultPlanId; this.fallbackPlanId = fallbackPlanId; this.id = id; @@ -98,10 +123,17 @@ private PlanGroupResponseData( this.orderedAddOnIds = orderedAddOnIds; this.planIds = planIds; this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.prorationBehavior = prorationBehavior; + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + this.syncCustomerBillingDetails = syncCustomerBillingDetails; this.taxCollectionEnabled = taxCollectionEnabled; this.trialDays = trialDays; this.trialExpiryPlanId = trialExpiryPlanId; @@ -125,6 +157,11 @@ public CheckoutSettingsResponseData getCheckoutSettings() { return checkoutSettings; } + @JsonProperty("component_settings") + public ComponentSettingsResponseData getComponentSettings() { + return componentSettings; + } + @JsonProperty("default_plan_id") public Optional getDefaultPlanId() { return defaultPlanId; @@ -165,6 +202,41 @@ public boolean getPreventDowngradesWhenOverLimit() { return preventDowngradesWhenOverLimit; } + @JsonProperty("prevent_self_service_downgrade") + public boolean getPreventSelfServiceDowngrade() { + return preventSelfServiceDowngrade; + } + + @JsonProperty("prevent_self_service_downgrade_button_text") + public Optional getPreventSelfServiceDowngradeButtonText() { + return preventSelfServiceDowngradeButtonText; + } + + @JsonProperty("prevent_self_service_downgrade_url") + public Optional getPreventSelfServiceDowngradeUrl() { + return preventSelfServiceDowngradeUrl; + } + + @JsonProperty("proration_behavior") + public String getProrationBehavior() { + return prorationBehavior; + } + + @JsonProperty("scheduled_downgrade_behavior") + public Optional getScheduledDowngradeBehavior() { + return scheduledDowngradeBehavior; + } + + @JsonProperty("scheduled_downgrade_prevent_when_over_limit") + public Optional getScheduledDowngradePreventWhenOverLimit() { + return scheduledDowngradePreventWhenOverLimit; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + @JsonProperty("show_credits") public boolean getShowCredits() { return showCredits; @@ -180,9 +252,9 @@ public boolean getShowZeroPriceAsFree() { return showZeroPriceAsFree; } - @JsonProperty("sync_customer_billing_details_for_tax") - public boolean getSyncCustomerBillingDetailsForTax() { - return syncCustomerBillingDetailsForTax; + @JsonProperty("sync_customer_billing_details") + public boolean getSyncCustomerBillingDetails() { + return syncCustomerBillingDetails; } @JsonProperty("tax_collection_enabled") @@ -225,6 +297,7 @@ private boolean equalTo(PlanGroupResponseData other) { return addOnCompatibilities.equals(other.addOnCompatibilities) && addOnIds.equals(other.addOnIds) && checkoutSettings.equals(other.checkoutSettings) + && componentSettings.equals(other.componentSettings) && defaultPlanId.equals(other.defaultPlanId) && fallbackPlanId.equals(other.fallbackPlanId) && id.equals(other.id) @@ -233,10 +306,17 @@ private boolean equalTo(PlanGroupResponseData other) { && orderedAddOnIds.equals(other.orderedAddOnIds) && planIds.equals(other.planIds) && preventDowngradesWhenOverLimit == other.preventDowngradesWhenOverLimit + && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade + && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) + && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && prorationBehavior.equals(other.prorationBehavior) + && scheduledDowngradeBehavior.equals(other.scheduledDowngradeBehavior) + && scheduledDowngradePreventWhenOverLimit.equals(other.scheduledDowngradePreventWhenOverLimit) + && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree - && syncCustomerBillingDetailsForTax == other.syncCustomerBillingDetailsForTax + && syncCustomerBillingDetails == other.syncCustomerBillingDetails && taxCollectionEnabled == other.taxCollectionEnabled && trialDays.equals(other.trialDays) && trialExpiryPlanId.equals(other.trialExpiryPlanId) @@ -250,6 +330,7 @@ public int hashCode() { this.addOnCompatibilities, this.addOnIds, this.checkoutSettings, + this.componentSettings, this.defaultPlanId, this.fallbackPlanId, this.id, @@ -258,10 +339,17 @@ public int hashCode() { this.orderedAddOnIds, this.planIds, this.preventDowngradesWhenOverLimit, + this.preventSelfServiceDowngrade, + this.preventSelfServiceDowngradeButtonText, + this.preventSelfServiceDowngradeUrl, + this.prorationBehavior, + this.scheduledDowngradeBehavior, + this.scheduledDowngradePreventWhenOverLimit, + this.showAsMonthlyPrices, this.showCredits, this.showPeriodToggle, this.showZeroPriceAsFree, - this.syncCustomerBillingDetailsForTax, + this.syncCustomerBillingDetails, this.taxCollectionEnabled, this.trialDays, this.trialExpiryPlanId, @@ -279,17 +367,33 @@ public static CheckoutSettingsStage builder() { } public interface CheckoutSettingsStage { - IdStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings); + ComponentSettingsStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings); Builder from(PlanGroupResponseData other); } + public interface ComponentSettingsStage { + IdStage componentSettings(@NotNull ComponentSettingsResponseData componentSettings); + } + public interface IdStage { PreventDowngradesWhenOverLimitStage id(@NotNull String id); } public interface PreventDowngradesWhenOverLimitStage { - ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit); + } + + public interface PreventSelfServiceDowngradeStage { + ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade); + } + + public interface ProrationBehaviorStage { + ShowAsMonthlyPricesStage prorationBehavior(@NotNull String prorationBehavior); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); } public interface ShowCreditsStage { @@ -301,11 +405,11 @@ public interface ShowPeriodToggleStage { } public interface ShowZeroPriceAsFreeStage { - SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree); } - public interface SyncCustomerBillingDetailsForTaxStage { - TaxCollectionEnabledStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax); + public interface SyncCustomerBillingDetailsStage { + TaxCollectionEnabledStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails); } public interface TaxCollectionEnabledStage { @@ -355,6 +459,22 @@ public interface _FinalStage { _FinalStage addAllPlanIds(List planIds); + _FinalStage preventSelfServiceDowngradeButtonText(Optional preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText); + + _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl); + + _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + + _FinalStage scheduledDowngradeBehavior(Optional scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradeBehavior(String scheduledDowngradeBehavior); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Optional scheduledDowngradePreventWhenOverLimit); + + _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); + _FinalStage trialDays(Optional trialDays); _FinalStage trialDays(Integer trialDays); @@ -375,27 +495,39 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CheckoutSettingsStage, + ComponentSettingsStage, IdStage, PreventDowngradesWhenOverLimitStage, + PreventSelfServiceDowngradeStage, + ProrationBehaviorStage, + ShowAsMonthlyPricesStage, ShowCreditsStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, - SyncCustomerBillingDetailsForTaxStage, + SyncCustomerBillingDetailsStage, TaxCollectionEnabledStage, _FinalStage { private CheckoutSettingsResponseData checkoutSettings; + private ComponentSettingsResponseData componentSettings; + private String id; private boolean preventDowngradesWhenOverLimit; + private boolean preventSelfServiceDowngrade; + + private String prorationBehavior; + + private boolean showAsMonthlyPrices; + private boolean showCredits; private boolean showPeriodToggle; private boolean showZeroPriceAsFree; - private boolean syncCustomerBillingDetailsForTax; + private boolean syncCustomerBillingDetails; private boolean taxCollectionEnabled; @@ -407,6 +539,14 @@ public static final class Builder private Optional trialDays = Optional.empty(); + private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); + + private Optional scheduledDowngradeBehavior = Optional.empty(); + + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); + + private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); + private List planIds = new ArrayList<>(); private List orderedAddOnIds = new ArrayList<>(); @@ -433,6 +573,7 @@ public Builder from(PlanGroupResponseData other) { addOnCompatibilities(other.getAddOnCompatibilities()); addOnIds(other.getAddOnIds()); checkoutSettings(other.getCheckoutSettings()); + componentSettings(other.getComponentSettings()); defaultPlanId(other.getDefaultPlanId()); fallbackPlanId(other.getFallbackPlanId()); id(other.getId()); @@ -441,10 +582,17 @@ public Builder from(PlanGroupResponseData other) { orderedAddOnIds(other.getOrderedAddOnIds()); planIds(other.getPlanIds()); preventDowngradesWhenOverLimit(other.getPreventDowngradesWhenOverLimit()); + preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); + preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); + preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + prorationBehavior(other.getProrationBehavior()); + scheduledDowngradeBehavior(other.getScheduledDowngradeBehavior()); + scheduledDowngradePreventWhenOverLimit(other.getScheduledDowngradePreventWhenOverLimit()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); - syncCustomerBillingDetailsForTax(other.getSyncCustomerBillingDetailsForTax()); + syncCustomerBillingDetails(other.getSyncCustomerBillingDetails()); taxCollectionEnabled(other.getTaxCollectionEnabled()); trialDays(other.getTrialDays()); trialExpiryPlanId(other.getTrialExpiryPlanId()); @@ -455,11 +603,18 @@ public Builder from(PlanGroupResponseData other) { @java.lang.Override @JsonSetter("checkout_settings") - public IdStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings) { + public ComponentSettingsStage checkoutSettings(@NotNull CheckoutSettingsResponseData checkoutSettings) { this.checkoutSettings = Objects.requireNonNull(checkoutSettings, "checkoutSettings must not be null"); return this; } + @java.lang.Override + @JsonSetter("component_settings") + public IdStage componentSettings(@NotNull ComponentSettingsResponseData componentSettings) { + this.componentSettings = Objects.requireNonNull(componentSettings, "componentSettings must not be null"); + return this; + } + @java.lang.Override @JsonSetter("id") public PreventDowngradesWhenOverLimitStage id(@NotNull String id) { @@ -469,11 +624,32 @@ public PreventDowngradesWhenOverLimitStage id(@NotNull String id) { @java.lang.Override @JsonSetter("prevent_downgrades_when_over_limit") - public ShowCreditsStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { + public PreventSelfServiceDowngradeStage preventDowngradesWhenOverLimit(boolean preventDowngradesWhenOverLimit) { this.preventDowngradesWhenOverLimit = preventDowngradesWhenOverLimit; return this; } + @java.lang.Override + @JsonSetter("prevent_self_service_downgrade") + public ProrationBehaviorStage preventSelfServiceDowngrade(boolean preventSelfServiceDowngrade) { + this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; + return this; + } + + @java.lang.Override + @JsonSetter("proration_behavior") + public ShowAsMonthlyPricesStage prorationBehavior(@NotNull String prorationBehavior) { + this.prorationBehavior = Objects.requireNonNull(prorationBehavior, "prorationBehavior must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("show_as_monthly_prices") + public ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices) { + this.showAsMonthlyPrices = showAsMonthlyPrices; + return this; + } + @java.lang.Override @JsonSetter("show_credits") public ShowPeriodToggleStage showCredits(boolean showCredits) { @@ -490,15 +666,15 @@ public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @java.lang.Override @JsonSetter("show_zero_price_as_free") - public SyncCustomerBillingDetailsForTaxStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { + public SyncCustomerBillingDetailsStage showZeroPriceAsFree(boolean showZeroPriceAsFree) { this.showZeroPriceAsFree = showZeroPriceAsFree; return this; } @java.lang.Override - @JsonSetter("sync_customer_billing_details_for_tax") - public TaxCollectionEnabledStage syncCustomerBillingDetailsForTax(boolean syncCustomerBillingDetailsForTax) { - this.syncCustomerBillingDetailsForTax = syncCustomerBillingDetailsForTax; + @JsonSetter("sync_customer_billing_details") + public TaxCollectionEnabledStage syncCustomerBillingDetails(boolean syncCustomerBillingDetails) { + this.syncCustomerBillingDetails = syncCustomerBillingDetails; return this; } @@ -561,6 +737,60 @@ public _FinalStage trialDays(Optional trialDays) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = Optional.ofNullable(scheduledDowngradePreventWhenOverLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_prevent_when_over_limit", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradePreventWhenOverLimit( + Optional scheduledDowngradePreventWhenOverLimit) { + this.scheduledDowngradePreventWhenOverLimit = scheduledDowngradePreventWhenOverLimit; + return this; + } + + @java.lang.Override + public _FinalStage scheduledDowngradeBehavior(String scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = Optional.ofNullable(scheduledDowngradeBehavior); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade_behavior", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngradeBehavior(Optional scheduledDowngradeBehavior) { + this.scheduledDowngradeBehavior = scheduledDowngradeBehavior; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_url", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeUrl(Optional preventSelfServiceDowngradeUrl) { + this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + return this; + } + + @java.lang.Override + public _FinalStage preventSelfServiceDowngradeButtonText(String preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = Optional.ofNullable(preventSelfServiceDowngradeButtonText); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prevent_self_service_downgrade_button_text", nulls = Nulls.SKIP) + public _FinalStage preventSelfServiceDowngradeButtonText( + Optional preventSelfServiceDowngradeButtonText) { + this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; + return this; + } + @java.lang.Override public _FinalStage addAllPlanIds(List planIds) { if (planIds != null) { @@ -715,6 +945,7 @@ public PlanGroupResponseData build() { addOnCompatibilities, addOnIds, checkoutSettings, + componentSettings, defaultPlanId, fallbackPlanId, id, @@ -723,10 +954,17 @@ public PlanGroupResponseData build() { orderedAddOnIds, planIds, preventDowngradesWhenOverLimit, + preventSelfServiceDowngrade, + preventSelfServiceDowngradeButtonText, + preventSelfServiceDowngradeUrl, + prorationBehavior, + scheduledDowngradeBehavior, + scheduledDowngradePreventWhenOverLimit, + showAsMonthlyPrices, showCredits, showPeriodToggle, showZeroPriceAsFree, - syncCustomerBillingDetailsForTax, + syncCustomerBillingDetails, taxCollectionEnabled, trialDays, trialExpiryPlanId, diff --git a/src/main/java/com/schematic/api/types/PlanResponseData.java b/src/main/java/com/schematic/api/types/PlanResponseData.java index ed86395..4a557ff 100644 --- a/src/main/java/com/schematic/api/types/PlanResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanResponseData.java @@ -34,7 +34,7 @@ public final class PlanResponseData { private final String name; - private final String planType; + private final PlanType planType; private final OffsetDateTime updatedAt; @@ -47,7 +47,7 @@ private PlanResponseData( String icon, String id, String name, - String planType, + PlanType planType, OffsetDateTime updatedAt, Map additionalProperties) { this.audienceType = audienceType; @@ -92,7 +92,7 @@ public String getName() { } @JsonProperty("plan_type") - public String getPlanType() { + public PlanType getPlanType() { return planType; } @@ -168,7 +168,7 @@ public interface NameStage { } public interface PlanTypeStage { - UpdatedAtStage planType(@NotNull String planType); + UpdatedAtStage planType(@NotNull PlanType planType); } public interface UpdatedAtStage { @@ -203,7 +203,7 @@ public static final class Builder private String name; - private String planType; + private PlanType planType; private OffsetDateTime updatedAt; @@ -264,7 +264,7 @@ public PlanTypeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("plan_type") - public UpdatedAtStage planType(@NotNull String planType) { + public UpdatedAtStage planType(@NotNull PlanType planType) { this.planType = Objects.requireNonNull(planType, "planType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansRequestPlanType.java b/src/main/java/com/schematic/api/types/PlanType.java similarity index 66% rename from src/main/java/com/schematic/api/resources/plans/types/ListPlansRequestPlanType.java rename to src/main/java/com/schematic/api/types/PlanType.java index b34f28c..0ca7684 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlansRequestPlanType.java +++ b/src/main/java/com/schematic/api/types/PlanType.java @@ -1,21 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.plans.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListPlansRequestPlanType { - public static final ListPlansRequestPlanType PLAN = new ListPlansRequestPlanType(Value.PLAN, "plan"); +public final class PlanType { + public static final PlanType PLAN = new PlanType(Value.PLAN, "plan"); - public static final ListPlansRequestPlanType ADD_ON = new ListPlansRequestPlanType(Value.ADD_ON, "add_on"); + public static final PlanType ADD_ON = new PlanType(Value.ADD_ON, "add_on"); private final Value value; private final String string; - ListPlansRequestPlanType(Value value, String string) { + PlanType(Value value, String string) { this.value = value; this.string = string; } @@ -32,9 +32,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof ListPlansRequestPlanType - && this.string.equals(((ListPlansRequestPlanType) other).string)); + return (this == other) || (other instanceof PlanType && this.string.equals(((PlanType) other).string)); } @java.lang.Override @@ -55,14 +53,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListPlansRequestPlanType valueOf(String value) { + public static PlanType valueOf(String value) { switch (value) { case "plan": return PLAN; case "add_on": return ADD_ON; default: - return new ListPlansRequestPlanType(Value.UNKNOWN, value); + return new PlanType(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/PlanVersionResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java new file mode 100644 index 0000000..2699bcb --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java @@ -0,0 +1,387 @@ +/** + * 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 = PlanVersionResponseData.Builder.class) +public final class PlanVersionResponseData { + private final OffsetDateTime createdAt; + + private final String description; + + private final String environmentId; + + private final String icon; + + private final String id; + + private final String name; + + private final Optional originalPlanId; + + private final PlanType planType; + + private final PlanVersionStatus status; + + private final OffsetDateTime updatedAt; + + private final int version; + + private final Map additionalProperties; + + private PlanVersionResponseData( + OffsetDateTime createdAt, + String description, + String environmentId, + String icon, + String id, + String name, + Optional originalPlanId, + PlanType planType, + PlanVersionStatus status, + OffsetDateTime updatedAt, + int version, + Map additionalProperties) { + this.createdAt = createdAt; + this.description = description; + this.environmentId = environmentId; + this.icon = icon; + this.id = id; + this.name = name; + this.originalPlanId = originalPlanId; + this.planType = planType; + this.status = status; + this.updatedAt = updatedAt; + this.version = version; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("icon") + public String getIcon() { + return icon; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("original_plan_id") + public Optional getOriginalPlanId() { + return originalPlanId; + } + + @JsonProperty("plan_type") + public PlanType getPlanType() { + return planType; + } + + @JsonProperty("status") + public PlanVersionStatus getStatus() { + return status; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("version") + public int getVersion() { + return version; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanVersionResponseData && equalTo((PlanVersionResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanVersionResponseData other) { + return createdAt.equals(other.createdAt) + && description.equals(other.description) + && environmentId.equals(other.environmentId) + && icon.equals(other.icon) + && id.equals(other.id) + && name.equals(other.name) + && originalPlanId.equals(other.originalPlanId) + && planType.equals(other.planType) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt) + && version == other.version; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.createdAt, + this.description, + this.environmentId, + this.icon, + this.id, + this.name, + this.originalPlanId, + this.planType, + this.status, + this.updatedAt, + this.version); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CreatedAtStage builder() { + return new Builder(); + } + + public interface CreatedAtStage { + DescriptionStage createdAt(@NotNull OffsetDateTime createdAt); + + Builder from(PlanVersionResponseData other); + } + + public interface DescriptionStage { + EnvironmentIdStage description(@NotNull String description); + } + + public interface EnvironmentIdStage { + IconStage environmentId(@NotNull String environmentId); + } + + public interface IconStage { + IdStage icon(@NotNull String icon); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + PlanTypeStage name(@NotNull String name); + } + + public interface PlanTypeStage { + StatusStage planType(@NotNull PlanType planType); + } + + public interface StatusStage { + UpdatedAtStage status(@NotNull PlanVersionStatus status); + } + + public interface UpdatedAtStage { + VersionStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VersionStage { + _FinalStage version(int version); + } + + public interface _FinalStage { + PlanVersionResponseData build(); + + _FinalStage originalPlanId(Optional originalPlanId); + + _FinalStage originalPlanId(String originalPlanId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CreatedAtStage, + DescriptionStage, + EnvironmentIdStage, + IconStage, + IdStage, + NameStage, + PlanTypeStage, + StatusStage, + UpdatedAtStage, + VersionStage, + _FinalStage { + private OffsetDateTime createdAt; + + private String description; + + private String environmentId; + + private String icon; + + private String id; + + private String name; + + private PlanType planType; + + private PlanVersionStatus status; + + private OffsetDateTime updatedAt; + + private int version; + + private Optional originalPlanId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanVersionResponseData other) { + createdAt(other.getCreatedAt()); + description(other.getDescription()); + environmentId(other.getEnvironmentId()); + icon(other.getIcon()); + id(other.getId()); + name(other.getName()); + originalPlanId(other.getOriginalPlanId()); + planType(other.getPlanType()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + version(other.getVersion()); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DescriptionStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("description") + public EnvironmentIdStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IconStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull String icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id 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 StatusStage planType(@NotNull PlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull PlanVersionStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public VersionStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("version") + public _FinalStage version(int version) { + this.version = version; + return this; + } + + @java.lang.Override + public _FinalStage originalPlanId(String originalPlanId) { + this.originalPlanId = Optional.ofNullable(originalPlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "original_plan_id", nulls = Nulls.SKIP) + public _FinalStage originalPlanId(Optional originalPlanId) { + this.originalPlanId = originalPlanId; + return this; + } + + @java.lang.Override + public PlanVersionResponseData build() { + return new PlanVersionResponseData( + createdAt, + description, + environmentId, + icon, + id, + name, + originalPlanId, + planType, + status, + updatedAt, + version, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionStatus.java b/src/main/java/com/schematic/api/types/PlanVersionStatus.java new file mode 100644 index 0000000..77bac99 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanVersionStatus { + public static final PlanVersionStatus PUBLISHED = new PlanVersionStatus(Value.PUBLISHED, "published"); + + public static final PlanVersionStatus ARCHIVED = new PlanVersionStatus(Value.ARCHIVED, "archived"); + + public static final PlanVersionStatus DRAFT = new PlanVersionStatus(Value.DRAFT, "draft"); + + private final Value value; + + private final String string; + + PlanVersionStatus(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 PlanVersionStatus && this.string.equals(((PlanVersionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUBLISHED: + return visitor.visitPublished(); + case ARCHIVED: + return visitor.visitArchived(); + case DRAFT: + return visitor.visitDraft(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanVersionStatus valueOf(String value) { + switch (value) { + case "published": + return PUBLISHED; + case "archived": + return ARCHIVED; + case "draft": + return DRAFT; + default: + return new PlanVersionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + PUBLISHED, + + DRAFT, + + ARCHIVED, + + UNKNOWN + } + + public interface Visitor { + T visitPublished(); + + T visitDraft(); + + T visitArchived(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java index eaeb24b..bb45182 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java @@ -44,6 +44,8 @@ public final class PreviewSubscriptionFinanceResponseData { private final boolean taxRequireBillingDetails; + private final int totalPerBillingPeriod; + private final Optional trialEnd; private final List upcomingInvoiceLineItems; @@ -61,6 +63,7 @@ private PreviewSubscriptionFinanceResponseData( Optional taxAmount, Optional taxDisplayName, boolean taxRequireBillingDetails, + int totalPerBillingPeriod, Optional trialEnd, List upcomingInvoiceLineItems, Map additionalProperties) { @@ -74,6 +77,7 @@ private PreviewSubscriptionFinanceResponseData( this.taxAmount = taxAmount; this.taxDisplayName = taxDisplayName; this.taxRequireBillingDetails = taxRequireBillingDetails; + this.totalPerBillingPeriod = totalPerBillingPeriod; this.trialEnd = trialEnd; this.upcomingInvoiceLineItems = upcomingInvoiceLineItems; this.additionalProperties = additionalProperties; @@ -129,6 +133,11 @@ public boolean getTaxRequireBillingDetails() { return taxRequireBillingDetails; } + @JsonProperty("total_per_billing_period") + public int getTotalPerBillingPeriod() { + return totalPerBillingPeriod; + } + @JsonProperty("trial_end") public Optional getTrialEnd() { return trialEnd; @@ -162,6 +171,7 @@ private boolean equalTo(PreviewSubscriptionFinanceResponseData other) { && taxAmount.equals(other.taxAmount) && taxDisplayName.equals(other.taxDisplayName) && taxRequireBillingDetails == other.taxRequireBillingDetails + && totalPerBillingPeriod == other.totalPerBillingPeriod && trialEnd.equals(other.trialEnd) && upcomingInvoiceLineItems.equals(other.upcomingInvoiceLineItems); } @@ -179,6 +189,7 @@ public int hashCode() { this.taxAmount, this.taxDisplayName, this.taxRequireBillingDetails, + this.totalPerBillingPeriod, this.trialEnd, this.upcomingInvoiceLineItems); } @@ -223,7 +234,11 @@ public interface ProrationStage { } public interface TaxRequireBillingDetailsStage { - _FinalStage taxRequireBillingDetails(boolean taxRequireBillingDetails); + TotalPerBillingPeriodStage taxRequireBillingDetails(boolean taxRequireBillingDetails); + } + + public interface TotalPerBillingPeriodStage { + _FinalStage totalPerBillingPeriod(int totalPerBillingPeriod); } public interface _FinalStage { @@ -260,6 +275,7 @@ public static final class Builder PromoCodeAppliedStage, ProrationStage, TaxRequireBillingDetailsStage, + TotalPerBillingPeriodStage, _FinalStage { private int amountOff; @@ -277,6 +293,8 @@ public static final class Builder private boolean taxRequireBillingDetails; + private int totalPerBillingPeriod; + private List upcomingInvoiceLineItems = new ArrayList<>(); private Optional trialEnd = Optional.empty(); @@ -302,6 +320,7 @@ public Builder from(PreviewSubscriptionFinanceResponseData other) { taxAmount(other.getTaxAmount()); taxDisplayName(other.getTaxDisplayName()); taxRequireBillingDetails(other.getTaxRequireBillingDetails()); + totalPerBillingPeriod(other.getTotalPerBillingPeriod()); trialEnd(other.getTrialEnd()); upcomingInvoiceLineItems(other.getUpcomingInvoiceLineItems()); return this; @@ -358,11 +377,18 @@ public TaxRequireBillingDetailsStage proration(int proration) { @java.lang.Override @JsonSetter("tax_require_billing_details") - public _FinalStage taxRequireBillingDetails(boolean taxRequireBillingDetails) { + public TotalPerBillingPeriodStage taxRequireBillingDetails(boolean taxRequireBillingDetails) { this.taxRequireBillingDetails = taxRequireBillingDetails; return this; } + @java.lang.Override + @JsonSetter("total_per_billing_period") + public _FinalStage totalPerBillingPeriod(int totalPerBillingPeriod) { + this.totalPerBillingPeriod = totalPerBillingPeriod; + return this; + } + @java.lang.Override public _FinalStage addAllUpcomingInvoiceLineItems( List upcomingInvoiceLineItems) { @@ -442,6 +468,7 @@ public PreviewSubscriptionFinanceResponseData build() { taxAmount, taxDisplayName, taxRequireBillingDetails, + totalPerBillingPeriod, trialEnd, upcomingInvoiceLineItems, additionalProperties); diff --git a/src/main/java/com/schematic/api/types/ProrationBehavior.java b/src/main/java/com/schematic/api/types/ProrationBehavior.java new file mode 100644 index 0000000..032ab7f --- /dev/null +++ b/src/main/java/com/schematic/api/types/ProrationBehavior.java @@ -0,0 +1,85 @@ +/** + * 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 ProrationBehavior { + public static final ProrationBehavior INVOICE_IMMEDIATELY = + new ProrationBehavior(Value.INVOICE_IMMEDIATELY, "invoice_immediately"); + + public static final ProrationBehavior CREATE_PRORATIONS = + new ProrationBehavior(Value.CREATE_PRORATIONS, "create_prorations"); + + private final Value value; + + private final String string; + + ProrationBehavior(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 ProrationBehavior && this.string.equals(((ProrationBehavior) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case INVOICE_IMMEDIATELY: + return visitor.visitInvoiceImmediately(); + case CREATE_PRORATIONS: + return visitor.visitCreateProrations(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ProrationBehavior valueOf(String value) { + switch (value) { + case "invoice_immediately": + return INVOICE_IMMEDIATELY; + case "create_prorations": + return CREATE_PRORATIONS; + default: + return new ProrationBehavior(Value.UNKNOWN, value); + } + } + + public enum Value { + CREATE_PRORATIONS, + + INVOICE_IMMEDIATELY, + + UNKNOWN + } + + public interface Visitor { + T visitCreateProrations(); + + T visitInvoiceImmediately(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RawEventResponseData.java b/src/main/java/com/schematic/api/types/RawEventResponseData.java index eb90646..cf1fdf0 100644 --- a/src/main/java/com/schematic/api/types/RawEventResponseData.java +++ b/src/main/java/com/schematic/api/types/RawEventResponseData.java @@ -26,7 +26,7 @@ public final class RawEventResponseData { private final Optional eventId; - private final String remoteAddr; + private final Optional remoteAddr; private final String remoteIp; @@ -37,7 +37,7 @@ public final class RawEventResponseData { private RawEventResponseData( OffsetDateTime capturedAt, Optional eventId, - String remoteAddr, + Optional remoteAddr, String remoteIp, String userAgent, Map additionalProperties) { @@ -60,7 +60,7 @@ public Optional getEventId() { } @JsonProperty("remote_addr") - public String getRemoteAddr() { + public Optional getRemoteAddr() { return remoteAddr; } @@ -108,15 +108,11 @@ public static CapturedAtStage builder() { } public interface CapturedAtStage { - RemoteAddrStage capturedAt(@NotNull OffsetDateTime capturedAt); + RemoteIpStage capturedAt(@NotNull OffsetDateTime capturedAt); Builder from(RawEventResponseData other); } - public interface RemoteAddrStage { - RemoteIpStage remoteAddr(@NotNull String remoteAddr); - } - public interface RemoteIpStage { UserAgentStage remoteIp(@NotNull String remoteIp); } @@ -131,19 +127,22 @@ public interface _FinalStage { _FinalStage eventId(Optional eventId); _FinalStage eventId(String eventId); + + _FinalStage remoteAddr(Optional remoteAddr); + + _FinalStage remoteAddr(String remoteAddr); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements CapturedAtStage, RemoteAddrStage, RemoteIpStage, UserAgentStage, _FinalStage { + public static final class Builder implements CapturedAtStage, RemoteIpStage, UserAgentStage, _FinalStage { private OffsetDateTime capturedAt; - private String remoteAddr; - private String remoteIp; private String userAgent; + private Optional remoteAddr = Optional.empty(); + private Optional eventId = Optional.empty(); @JsonAnySetter @@ -163,18 +162,11 @@ public Builder from(RawEventResponseData other) { @java.lang.Override @JsonSetter("captured_at") - public RemoteAddrStage capturedAt(@NotNull OffsetDateTime capturedAt) { + public RemoteIpStage capturedAt(@NotNull OffsetDateTime capturedAt) { this.capturedAt = Objects.requireNonNull(capturedAt, "capturedAt must not be null"); return this; } - @java.lang.Override - @JsonSetter("remote_addr") - public RemoteIpStage remoteAddr(@NotNull String remoteAddr) { - this.remoteAddr = Objects.requireNonNull(remoteAddr, "remoteAddr must not be null"); - return this; - } - @java.lang.Override @JsonSetter("remote_ip") public UserAgentStage remoteIp(@NotNull String remoteIp) { @@ -189,6 +181,19 @@ public _FinalStage userAgent(@NotNull String userAgent) { return this; } + @java.lang.Override + public _FinalStage remoteAddr(String remoteAddr) { + this.remoteAddr = Optional.ofNullable(remoteAddr); + return this; + } + + @java.lang.Override + @JsonSetter(value = "remote_addr", nulls = Nulls.SKIP) + public _FinalStage remoteAddr(Optional remoteAddr) { + this.remoteAddr = remoteAddr; + return this; + } + @java.lang.Override public _FinalStage eventId(String eventId) { this.eventId = Optional.ofNullable(eventId); diff --git a/src/main/java/com/schematic/api/types/Rule.java b/src/main/java/com/schematic/api/types/Rule.java index 9d8eeba..489003e 100644 --- a/src/main/java/com/schematic/api/types/Rule.java +++ b/src/main/java/com/schematic/api/types/Rule.java @@ -39,7 +39,7 @@ public final class Rule { private final int priority; - private final String ruleType; + private final RuleRuleType ruleType; private final boolean value; @@ -54,7 +54,7 @@ private Rule( String id, String name, int priority, - String ruleType, + RuleRuleType ruleType, boolean value, Map additionalProperties) { this.accountId = accountId; @@ -111,7 +111,7 @@ public int getPriority() { } @JsonProperty("rule_type") - public String getRuleType() { + public RuleRuleType getRuleType() { return ruleType; } @@ -191,7 +191,7 @@ public interface PriorityStage { } public interface RuleTypeStage { - ValueStage ruleType(@NotNull String ruleType); + ValueStage ruleType(@NotNull RuleRuleType ruleType); } public interface ValueStage { @@ -238,7 +238,7 @@ public static final class Builder private int priority; - private String ruleType; + private RuleRuleType ruleType; private boolean value; @@ -305,7 +305,7 @@ public RuleTypeStage priority(int priority) { @java.lang.Override @JsonSetter("rule_type") - public ValueStage ruleType(@NotNull String ruleType) { + public ValueStage ruleType(@NotNull RuleRuleType ruleType) { this.ruleType = Objects.requireNonNull(ruleType, "ruleType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java b/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java index b94bef5..2971737 100644 --- a/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java @@ -58,7 +58,7 @@ public final class RuleConditionDetailResponseData { private final Optional trait; - private final Optional traitEntityType; + private final Optional traitEntityType; private final Optional traitId; @@ -86,7 +86,7 @@ private RuleConditionDetailResponseData( List resources, String ruleId, Optional trait, - Optional traitEntityType, + Optional traitEntityType, Optional traitId, String traitValue, OffsetDateTime updatedAt, @@ -201,7 +201,7 @@ public Optional getTrait() { } @JsonProperty("trait_entity_type") - public Optional getTraitEntityType() { + public Optional getTraitEntityType() { return traitEntityType; } @@ -375,9 +375,9 @@ public interface _FinalStage { _FinalStage trait(EntityTraitDefinitionResponseData trait); - _FinalStage traitEntityType(Optional traitEntityType); + _FinalStage traitEntityType(Optional traitEntityType); - _FinalStage traitEntityType(String traitEntityType); + _FinalStage traitEntityType(EntityType traitEntityType); _FinalStage traitId(Optional traitId); @@ -413,7 +413,7 @@ public static final class Builder private Optional traitId = Optional.empty(); - private Optional traitEntityType = Optional.empty(); + private Optional traitEntityType = Optional.empty(); private Optional trait = Optional.empty(); @@ -538,14 +538,14 @@ public _FinalStage traitId(Optional traitId) { } @java.lang.Override - public _FinalStage traitEntityType(String traitEntityType) { + public _FinalStage traitEntityType(EntityType traitEntityType) { this.traitEntityType = Optional.ofNullable(traitEntityType); return this; } @java.lang.Override @JsonSetter(value = "trait_entity_type", nulls = Nulls.SKIP) - public _FinalStage traitEntityType(Optional traitEntityType) { + public _FinalStage traitEntityType(Optional traitEntityType) { this.traitEntityType = traitEntityType; return this; } diff --git a/src/main/java/com/schematic/api/types/RuleConditionResponseData.java b/src/main/java/com/schematic/api/types/RuleConditionResponseData.java index 56a4b50..8be4d73 100644 --- a/src/main/java/com/schematic/api/types/RuleConditionResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleConditionResponseData.java @@ -52,7 +52,7 @@ public final class RuleConditionResponseData { private final String ruleId; - private final Optional traitEntityType; + private final Optional traitEntityType; private final Optional traitId; @@ -77,7 +77,7 @@ private RuleConditionResponseData( String operator, List resourceIds, String ruleId, - Optional traitEntityType, + Optional traitEntityType, Optional traitId, String traitValue, OffsetDateTime updatedAt, @@ -174,7 +174,7 @@ public String getRuleId() { } @JsonProperty("trait_entity_type") - public Optional getTraitEntityType() { + public Optional getTraitEntityType() { return traitEntityType; } @@ -328,9 +328,9 @@ public interface _FinalStage { _FinalStage addAllResourceIds(List resourceIds); - _FinalStage traitEntityType(Optional traitEntityType); + _FinalStage traitEntityType(Optional traitEntityType); - _FinalStage traitEntityType(String traitEntityType); + _FinalStage traitEntityType(EntityType traitEntityType); _FinalStage traitId(Optional traitId); @@ -366,7 +366,7 @@ public static final class Builder private Optional traitId = Optional.empty(); - private Optional traitEntityType = Optional.empty(); + private Optional traitEntityType = Optional.empty(); private List resourceIds = new ArrayList<>(); @@ -482,14 +482,14 @@ public _FinalStage traitId(Optional traitId) { } @java.lang.Override - public _FinalStage traitEntityType(String traitEntityType) { + public _FinalStage traitEntityType(EntityType traitEntityType) { this.traitEntityType = Optional.ofNullable(traitEntityType); return this; } @java.lang.Override @JsonSetter(value = "trait_entity_type", nulls = Nulls.SKIP) - public _FinalStage traitEntityType(Optional traitEntityType) { + public _FinalStage traitEntityType(Optional traitEntityType) { this.traitEntityType = traitEntityType; return this; } diff --git a/src/main/java/com/schematic/api/types/RuleRuleType.java b/src/main/java/com/schematic/api/types/RuleRuleType.java new file mode 100644 index 0000000..f87d054 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RuleRuleType.java @@ -0,0 +1,134 @@ +/** + * 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 RuleRuleType { + public static final RuleRuleType GLOBAL_OVERRIDE = new RuleRuleType(Value.GLOBAL_OVERRIDE, "global_override"); + + public static final RuleRuleType COMPANY_OVERRIDE = new RuleRuleType(Value.COMPANY_OVERRIDE, "company_override"); + + public static final RuleRuleType COMPANY_OVERRIDE_USAGE_EXCEEDED = + new RuleRuleType(Value.COMPANY_OVERRIDE_USAGE_EXCEEDED, "company_override_usage_exceeded"); + + public static final RuleRuleType PLAN_ENTITLEMENT_USAGE_EXCEEDED = + new RuleRuleType(Value.PLAN_ENTITLEMENT_USAGE_EXCEEDED, "plan_entitlement_usage_exceeded"); + + public static final RuleRuleType STANDARD = new RuleRuleType(Value.STANDARD, "standard"); + + public static final RuleRuleType DEFAULT = new RuleRuleType(Value.DEFAULT, "default"); + + public static final RuleRuleType PLAN_ENTITLEMENT = new RuleRuleType(Value.PLAN_ENTITLEMENT, "plan_entitlement"); + + private final Value value; + + private final String string; + + RuleRuleType(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 RuleRuleType && this.string.equals(((RuleRuleType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GLOBAL_OVERRIDE: + return visitor.visitGlobalOverride(); + case COMPANY_OVERRIDE: + return visitor.visitCompanyOverride(); + case COMPANY_OVERRIDE_USAGE_EXCEEDED: + return visitor.visitCompanyOverrideUsageExceeded(); + case PLAN_ENTITLEMENT_USAGE_EXCEEDED: + return visitor.visitPlanEntitlementUsageExceeded(); + case STANDARD: + return visitor.visitStandard(); + case DEFAULT: + return visitor.visitDefault(); + case PLAN_ENTITLEMENT: + return visitor.visitPlanEntitlement(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RuleRuleType valueOf(String value) { + switch (value) { + case "global_override": + return GLOBAL_OVERRIDE; + case "company_override": + return COMPANY_OVERRIDE; + case "company_override_usage_exceeded": + return COMPANY_OVERRIDE_USAGE_EXCEEDED; + case "plan_entitlement_usage_exceeded": + return PLAN_ENTITLEMENT_USAGE_EXCEEDED; + case "standard": + return STANDARD; + case "default": + return DEFAULT; + case "plan_entitlement": + return PLAN_ENTITLEMENT; + default: + return new RuleRuleType(Value.UNKNOWN, value); + } + } + + public enum Value { + DEFAULT, + + GLOBAL_OVERRIDE, + + COMPANY_OVERRIDE, + + COMPANY_OVERRIDE_USAGE_EXCEEDED, + + PLAN_ENTITLEMENT, + + PLAN_ENTITLEMENT_USAGE_EXCEEDED, + + STANDARD, + + UNKNOWN + } + + public interface Visitor { + T visitDefault(); + + T visitGlobalOverride(); + + T visitCompanyOverride(); + + T visitCompanyOverrideUsageExceeded(); + + T visitPlanEntitlement(); + + T visitPlanEntitlementUsageExceeded(); + + T visitStandard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RuleView.java b/src/main/java/com/schematic/api/types/RuleView.java new file mode 100644 index 0000000..ee143ca --- /dev/null +++ b/src/main/java/com/schematic/api/types/RuleView.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RuleView.Builder.class) +public final class RuleView { + private final String accountId; + + private final List conditionGroups; + + private final List conditions; + + private final OffsetDateTime createdAt; + + private final String environmentId; + + private final Optional flagId; + + private final String id; + + private final String name; + + private final Optional planVersionId; + + private final int priority; + + private final String ruleType; + + private final OffsetDateTime updatedAt; + + private final boolean value; + + private final Map additionalProperties; + + private RuleView( + String accountId, + List conditionGroups, + List conditions, + OffsetDateTime createdAt, + String environmentId, + Optional flagId, + String id, + String name, + Optional planVersionId, + int priority, + String ruleType, + OffsetDateTime updatedAt, + boolean value, + Map additionalProperties) { + this.accountId = accountId; + this.conditionGroups = conditionGroups; + this.conditions = conditions; + this.createdAt = createdAt; + this.environmentId = environmentId; + this.flagId = flagId; + this.id = id; + this.name = name; + this.planVersionId = planVersionId; + this.priority = priority; + this.ruleType = ruleType; + this.updatedAt = updatedAt; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("condition_groups") + public List getConditionGroups() { + return conditionGroups; + } + + @JsonProperty("conditions") + public List getConditions() { + return conditions; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("priority") + public int getPriority() { + return priority; + } + + @JsonProperty("rule_type") + public String getRuleType() { + return ruleType; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("value") + public boolean getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleView && equalTo((RuleView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RuleView other) { + return accountId.equals(other.accountId) + && conditionGroups.equals(other.conditionGroups) + && conditions.equals(other.conditions) + && createdAt.equals(other.createdAt) + && environmentId.equals(other.environmentId) + && flagId.equals(other.flagId) + && id.equals(other.id) + && name.equals(other.name) + && planVersionId.equals(other.planVersionId) + && priority == other.priority + && ruleType.equals(other.ruleType) + && updatedAt.equals(other.updatedAt) + && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.conditionGroups, + this.conditions, + this.createdAt, + this.environmentId, + this.flagId, + this.id, + this.name, + this.planVersionId, + this.priority, + this.ruleType, + this.updatedAt, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + CreatedAtStage accountId(@NotNull String accountId); + + Builder from(RuleView other); + } + + public interface CreatedAtStage { + EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + PriorityStage name(@NotNull String name); + } + + public interface PriorityStage { + RuleTypeStage priority(int priority); + } + + public interface RuleTypeStage { + UpdatedAtStage ruleType(@NotNull String ruleType); + } + + public interface UpdatedAtStage { + ValueStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface ValueStage { + _FinalStage value(boolean value); + } + + public interface _FinalStage { + RuleView build(); + + _FinalStage conditionGroups(List conditionGroups); + + _FinalStage addConditionGroups(ConditionGroupView conditionGroups); + + _FinalStage addAllConditionGroups(List conditionGroups); + + _FinalStage conditions(List conditions); + + _FinalStage addConditions(ConditionView conditions); + + _FinalStage addAllConditions(List conditions); + + _FinalStage flagId(Optional flagId); + + _FinalStage flagId(String flagId); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CreatedAtStage, + EnvironmentIdStage, + IdStage, + NameStage, + PriorityStage, + RuleTypeStage, + UpdatedAtStage, + ValueStage, + _FinalStage { + private String accountId; + + private OffsetDateTime createdAt; + + private String environmentId; + + private String id; + + private String name; + + private int priority; + + private String ruleType; + + private OffsetDateTime updatedAt; + + private boolean value; + + private Optional planVersionId = Optional.empty(); + + private Optional flagId = Optional.empty(); + + private List conditions = new ArrayList<>(); + + private List conditionGroups = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RuleView other) { + accountId(other.getAccountId()); + conditionGroups(other.getConditionGroups()); + conditions(other.getConditions()); + createdAt(other.getCreatedAt()); + environmentId(other.getEnvironmentId()); + flagId(other.getFlagId()); + id(other.getId()); + name(other.getName()); + planVersionId(other.getPlanVersionId()); + priority(other.getPriority()); + ruleType(other.getRuleType()); + updatedAt(other.getUpdatedAt()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public CreatedAtStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public PriorityStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("priority") + public RuleTypeStage priority(int priority) { + this.priority = priority; + return this; + } + + @java.lang.Override + @JsonSetter("rule_type") + public UpdatedAtStage ruleType(@NotNull String ruleType) { + this.ruleType = Objects.requireNonNull(ruleType, "ruleType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public ValueStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(boolean value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage 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 flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; + return this; + } + + @java.lang.Override + public _FinalStage addAllConditions(List conditions) { + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + @java.lang.Override + public _FinalStage addConditions(ConditionView conditions) { + this.conditions.add(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(List conditions) { + this.conditions.clear(); + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllConditionGroups(List conditionGroups) { + if (conditionGroups != null) { + this.conditionGroups.addAll(conditionGroups); + } + return this; + } + + @java.lang.Override + public _FinalStage addConditionGroups(ConditionGroupView conditionGroups) { + this.conditionGroups.add(conditionGroups); + return this; + } + + @java.lang.Override + @JsonSetter(value = "condition_groups", nulls = Nulls.SKIP) + public _FinalStage conditionGroups(List conditionGroups) { + this.conditionGroups.clear(); + if (conditionGroups != null) { + this.conditionGroups.addAll(conditionGroups); + } + return this; + } + + @java.lang.Override + public RuleView build() { + return new RuleView( + accountId, + conditionGroups, + conditions, + createdAt, + environmentId, + flagId, + id, + name, + planVersionId, + priority, + ruleType, + updatedAt, + value, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java new file mode 100644 index 0000000..b6ffacd --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.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 RulesEngineSchemaVersion { + public static final RulesEngineSchemaVersion PLACEHOLDER_FOR_FERN_COMPATIBILITY = new RulesEngineSchemaVersion( + Value.PLACEHOLDER_FOR_FERN_COMPATIBILITY, "placeholder-for-fern-compatibility"); + + public static final RulesEngineSchemaVersion V_0_F_048_DD_3 = + new RulesEngineSchemaVersion(Value.V_0_F_048_DD_3, "v0f048dd3"); + + private final Value value; + + private final String string; + + RulesEngineSchemaVersion(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 RulesEngineSchemaVersion + && this.string.equals(((RulesEngineSchemaVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PLACEHOLDER_FOR_FERN_COMPATIBILITY: + return visitor.visitPlaceholderForFernCompatibility(); + case V_0_F_048_DD_3: + return visitor.visitV0F048Dd3(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RulesEngineSchemaVersion valueOf(String value) { + switch (value) { + case "placeholder-for-fern-compatibility": + return PLACEHOLDER_FOR_FERN_COMPATIBILITY; + case "v0f048dd3": + return V_0_F_048_DD_3; + default: + return new RulesEngineSchemaVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + V_0_F_048_DD_3, + + PLACEHOLDER_FOR_FERN_COMPATIBILITY, + + UNKNOWN + } + + public interface Visitor { + T visitV0F048Dd3(); + + T visitPlaceholderForFernCompatibility(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java new file mode 100644 index 0000000..3ffa530 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java @@ -0,0 +1,547 @@ +/** + * 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 = RulesengineCheckFlagResult.Builder.class) +public final class RulesengineCheckFlagResult { + private final Optional companyId; + + private final Optional entitlement; + + private final Optional err; + + private final Optional featureAllocation; + + private final Optional featureUsage; + + private final Optional featureUsageEvent; + + private final Optional featureUsagePeriod; + + private final Optional featureUsageResetAt; + + private final Optional flagId; + + private final String flagKey; + + private final String reason; + + private final Optional ruleId; + + private final Optional ruleType; + + private final Optional userId; + + private final boolean value; + + private final Map additionalProperties; + + private RulesengineCheckFlagResult( + Optional companyId, + Optional entitlement, + Optional err, + Optional featureAllocation, + Optional featureUsage, + Optional featureUsageEvent, + Optional featureUsagePeriod, + Optional featureUsageResetAt, + Optional flagId, + String flagKey, + String reason, + Optional ruleId, + Optional ruleType, + Optional userId, + boolean value, + Map additionalProperties) { + this.companyId = companyId; + this.entitlement = entitlement; + this.err = err; + this.featureAllocation = featureAllocation; + this.featureUsage = featureUsage; + this.featureUsageEvent = featureUsageEvent; + this.featureUsagePeriod = featureUsagePeriod; + this.featureUsageResetAt = featureUsageResetAt; + this.flagId = flagId; + this.flagKey = flagKey; + this.reason = reason; + this.ruleId = ruleId; + this.ruleType = ruleType; + this.userId = userId; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("entitlement") + public Optional getEntitlement() { + return entitlement; + } + + @JsonProperty("err") + public Optional getErr() { + return err; + } + + @JsonProperty("feature_allocation") + public Optional getFeatureAllocation() { + return featureAllocation; + } + + @JsonProperty("feature_usage") + public Optional getFeatureUsage() { + return featureUsage; + } + + @JsonProperty("feature_usage_event") + public Optional getFeatureUsageEvent() { + return featureUsageEvent; + } + + @JsonProperty("feature_usage_period") + public Optional getFeatureUsagePeriod() { + return featureUsagePeriod; + } + + @JsonProperty("feature_usage_reset_at") + public Optional getFeatureUsageResetAt() { + return featureUsageResetAt; + } + + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; + } + + @JsonProperty("flag_key") + public String getFlagKey() { + return flagKey; + } + + @JsonProperty("reason") + public String getReason() { + return reason; + } + + @JsonProperty("rule_id") + public Optional getRuleId() { + return ruleId; + } + + @JsonProperty("rule_type") + public Optional getRuleType() { + return ruleType; + } + + @JsonProperty("user_id") + public Optional getUserId() { + return userId; + } + + @JsonProperty("value") + public boolean getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineCheckFlagResult && equalTo((RulesengineCheckFlagResult) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineCheckFlagResult other) { + return companyId.equals(other.companyId) + && entitlement.equals(other.entitlement) + && err.equals(other.err) + && featureAllocation.equals(other.featureAllocation) + && featureUsage.equals(other.featureUsage) + && featureUsageEvent.equals(other.featureUsageEvent) + && featureUsagePeriod.equals(other.featureUsagePeriod) + && featureUsageResetAt.equals(other.featureUsageResetAt) + && flagId.equals(other.flagId) + && flagKey.equals(other.flagKey) + && reason.equals(other.reason) + && ruleId.equals(other.ruleId) + && ruleType.equals(other.ruleType) + && userId.equals(other.userId) + && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, + this.entitlement, + this.err, + this.featureAllocation, + this.featureUsage, + this.featureUsageEvent, + this.featureUsagePeriod, + this.featureUsageResetAt, + this.flagId, + this.flagKey, + this.reason, + this.ruleId, + this.ruleType, + this.userId, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FlagKeyStage builder() { + return new Builder(); + } + + public interface FlagKeyStage { + ReasonStage flagKey(@NotNull String flagKey); + + Builder from(RulesengineCheckFlagResult other); + } + + public interface ReasonStage { + ValueStage reason(@NotNull String reason); + } + + public interface ValueStage { + _FinalStage value(boolean value); + } + + public interface _FinalStage { + RulesengineCheckFlagResult build(); + + _FinalStage companyId(Optional companyId); + + _FinalStage companyId(String companyId); + + _FinalStage entitlement(Optional entitlement); + + _FinalStage entitlement(RulesengineFeatureEntitlement entitlement); + + _FinalStage err(Optional err); + + _FinalStage err(String err); + + _FinalStage featureAllocation(Optional featureAllocation); + + _FinalStage featureAllocation(Integer featureAllocation); + + _FinalStage featureUsage(Optional featureUsage); + + _FinalStage featureUsage(Integer featureUsage); + + _FinalStage featureUsageEvent(Optional featureUsageEvent); + + _FinalStage featureUsageEvent(String featureUsageEvent); + + _FinalStage featureUsagePeriod(Optional featureUsagePeriod); + + _FinalStage featureUsagePeriod(RulesengineCheckFlagResultFeatureUsagePeriod featureUsagePeriod); + + _FinalStage featureUsageResetAt(Optional featureUsageResetAt); + + _FinalStage featureUsageResetAt(OffsetDateTime featureUsageResetAt); + + _FinalStage flagId(Optional flagId); + + _FinalStage flagId(String flagId); + + _FinalStage ruleId(Optional ruleId); + + _FinalStage ruleId(String ruleId); + + _FinalStage ruleType(Optional ruleType); + + _FinalStage ruleType(RulesengineCheckFlagResultRuleType ruleType); + + _FinalStage userId(Optional userId); + + _FinalStage userId(String userId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FlagKeyStage, ReasonStage, ValueStage, _FinalStage { + private String flagKey; + + private String reason; + + private boolean value; + + private Optional userId = Optional.empty(); + + private Optional ruleType = Optional.empty(); + + private Optional ruleId = Optional.empty(); + + private Optional flagId = Optional.empty(); + + private Optional featureUsageResetAt = Optional.empty(); + + private Optional featureUsagePeriod = Optional.empty(); + + private Optional featureUsageEvent = Optional.empty(); + + private Optional featureUsage = Optional.empty(); + + private Optional featureAllocation = Optional.empty(); + + private Optional err = Optional.empty(); + + private Optional entitlement = Optional.empty(); + + private Optional companyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineCheckFlagResult other) { + companyId(other.getCompanyId()); + entitlement(other.getEntitlement()); + err(other.getErr()); + featureAllocation(other.getFeatureAllocation()); + featureUsage(other.getFeatureUsage()); + featureUsageEvent(other.getFeatureUsageEvent()); + featureUsagePeriod(other.getFeatureUsagePeriod()); + featureUsageResetAt(other.getFeatureUsageResetAt()); + flagId(other.getFlagId()); + flagKey(other.getFlagKey()); + reason(other.getReason()); + ruleId(other.getRuleId()); + ruleType(other.getRuleType()); + userId(other.getUserId()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("flag_key") + public ReasonStage flagKey(@NotNull String flagKey) { + this.flagKey = Objects.requireNonNull(flagKey, "flagKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reason") + public ValueStage reason(@NotNull String reason) { + this.reason = Objects.requireNonNull(reason, "reason must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(boolean value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage userId(String userId) { + this.userId = Optional.ofNullable(userId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "user_id", nulls = Nulls.SKIP) + public _FinalStage userId(Optional userId) { + this.userId = userId; + return this; + } + + @java.lang.Override + public _FinalStage ruleType(RulesengineCheckFlagResultRuleType ruleType) { + this.ruleType = Optional.ofNullable(ruleType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rule_type", nulls = Nulls.SKIP) + public _FinalStage ruleType(Optional ruleType) { + this.ruleType = ruleType; + return this; + } + + @java.lang.Override + public _FinalStage ruleId(String ruleId) { + this.ruleId = Optional.ofNullable(ruleId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rule_id", nulls = Nulls.SKIP) + public _FinalStage ruleId(Optional ruleId) { + this.ruleId = ruleId; + return this; + } + + @java.lang.Override + public _FinalStage flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; + return this; + } + + @java.lang.Override + public _FinalStage featureUsageResetAt(OffsetDateTime featureUsageResetAt) { + this.featureUsageResetAt = Optional.ofNullable(featureUsageResetAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_usage_reset_at", nulls = Nulls.SKIP) + public _FinalStage featureUsageResetAt(Optional featureUsageResetAt) { + this.featureUsageResetAt = featureUsageResetAt; + return this; + } + + @java.lang.Override + public _FinalStage featureUsagePeriod(RulesengineCheckFlagResultFeatureUsagePeriod featureUsagePeriod) { + this.featureUsagePeriod = Optional.ofNullable(featureUsagePeriod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_usage_period", nulls = Nulls.SKIP) + public _FinalStage featureUsagePeriod( + Optional featureUsagePeriod) { + this.featureUsagePeriod = featureUsagePeriod; + return this; + } + + @java.lang.Override + public _FinalStage featureUsageEvent(String featureUsageEvent) { + this.featureUsageEvent = Optional.ofNullable(featureUsageEvent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_usage_event", nulls = Nulls.SKIP) + public _FinalStage featureUsageEvent(Optional featureUsageEvent) { + this.featureUsageEvent = featureUsageEvent; + return this; + } + + @java.lang.Override + public _FinalStage featureUsage(Integer featureUsage) { + this.featureUsage = Optional.ofNullable(featureUsage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) + public _FinalStage featureUsage(Optional featureUsage) { + this.featureUsage = featureUsage; + return this; + } + + @java.lang.Override + public _FinalStage featureAllocation(Integer featureAllocation) { + this.featureAllocation = Optional.ofNullable(featureAllocation); + return this; + } + + @java.lang.Override + @JsonSetter(value = "feature_allocation", nulls = Nulls.SKIP) + public _FinalStage featureAllocation(Optional featureAllocation) { + this.featureAllocation = featureAllocation; + return this; + } + + @java.lang.Override + public _FinalStage err(String err) { + this.err = Optional.ofNullable(err); + return this; + } + + @java.lang.Override + @JsonSetter(value = "err", nulls = Nulls.SKIP) + public _FinalStage err(Optional err) { + this.err = err; + return this; + } + + @java.lang.Override + public _FinalStage entitlement(RulesengineFeatureEntitlement entitlement) { + this.entitlement = Optional.ofNullable(entitlement); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlement", nulls = Nulls.SKIP) + public _FinalStage entitlement(Optional entitlement) { + this.entitlement = entitlement; + 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 RulesengineCheckFlagResult build() { + return new RulesengineCheckFlagResult( + companyId, + entitlement, + err, + featureAllocation, + featureUsage, + featureUsageEvent, + featureUsagePeriod, + featureUsageResetAt, + flagId, + flagKey, + reason, + ruleId, + ruleType, + userId, + value, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCheckFlagResultFeatureUsagePeriod.java b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResultFeatureUsagePeriod.java new file mode 100644 index 0000000..a85a252 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResultFeatureUsagePeriod.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RulesengineCheckFlagResultFeatureUsagePeriod { + public static final RulesengineCheckFlagResultFeatureUsagePeriod CURRENT_DAY = + new RulesengineCheckFlagResultFeatureUsagePeriod(Value.CURRENT_DAY, "current_day"); + + public static final RulesengineCheckFlagResultFeatureUsagePeriod ALL_TIME = + new RulesengineCheckFlagResultFeatureUsagePeriod(Value.ALL_TIME, "all_time"); + + public static final RulesengineCheckFlagResultFeatureUsagePeriod CURRENT_WEEK = + new RulesengineCheckFlagResultFeatureUsagePeriod(Value.CURRENT_WEEK, "current_week"); + + public static final RulesengineCheckFlagResultFeatureUsagePeriod CURRENT_MONTH = + new RulesengineCheckFlagResultFeatureUsagePeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + RulesengineCheckFlagResultFeatureUsagePeriod(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 RulesengineCheckFlagResultFeatureUsagePeriod + && this.string.equals(((RulesengineCheckFlagResultFeatureUsagePeriod) 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 RulesengineCheckFlagResultFeatureUsagePeriod 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 RulesengineCheckFlagResultFeatureUsagePeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_DAY, + + CURRENT_MONTH, + + CURRENT_WEEK, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentDay(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCheckFlagResultRuleType.java b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResultRuleType.java new file mode 100644 index 0000000..4f9a060 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResultRuleType.java @@ -0,0 +1,143 @@ +/** + * 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 RulesengineCheckFlagResultRuleType { + public static final RulesengineCheckFlagResultRuleType GLOBAL_OVERRIDE = + new RulesengineCheckFlagResultRuleType(Value.GLOBAL_OVERRIDE, "global_override"); + + public static final RulesengineCheckFlagResultRuleType COMPANY_OVERRIDE = + new RulesengineCheckFlagResultRuleType(Value.COMPANY_OVERRIDE, "company_override"); + + public static final RulesengineCheckFlagResultRuleType COMPANY_OVERRIDE_USAGE_EXCEEDED = + new RulesengineCheckFlagResultRuleType( + Value.COMPANY_OVERRIDE_USAGE_EXCEEDED, "company_override_usage_exceeded"); + + public static final RulesengineCheckFlagResultRuleType PLAN_ENTITLEMENT_USAGE_EXCEEDED = + new RulesengineCheckFlagResultRuleType( + Value.PLAN_ENTITLEMENT_USAGE_EXCEEDED, "plan_entitlement_usage_exceeded"); + + public static final RulesengineCheckFlagResultRuleType STANDARD = + new RulesengineCheckFlagResultRuleType(Value.STANDARD, "standard"); + + public static final RulesengineCheckFlagResultRuleType DEFAULT = + new RulesengineCheckFlagResultRuleType(Value.DEFAULT, "default"); + + public static final RulesengineCheckFlagResultRuleType PLAN_ENTITLEMENT = + new RulesengineCheckFlagResultRuleType(Value.PLAN_ENTITLEMENT, "plan_entitlement"); + + private final Value value; + + private final String string; + + RulesengineCheckFlagResultRuleType(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 RulesengineCheckFlagResultRuleType + && this.string.equals(((RulesengineCheckFlagResultRuleType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GLOBAL_OVERRIDE: + return visitor.visitGlobalOverride(); + case COMPANY_OVERRIDE: + return visitor.visitCompanyOverride(); + case COMPANY_OVERRIDE_USAGE_EXCEEDED: + return visitor.visitCompanyOverrideUsageExceeded(); + case PLAN_ENTITLEMENT_USAGE_EXCEEDED: + return visitor.visitPlanEntitlementUsageExceeded(); + case STANDARD: + return visitor.visitStandard(); + case DEFAULT: + return visitor.visitDefault(); + case PLAN_ENTITLEMENT: + return visitor.visitPlanEntitlement(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RulesengineCheckFlagResultRuleType valueOf(String value) { + switch (value) { + case "global_override": + return GLOBAL_OVERRIDE; + case "company_override": + return COMPANY_OVERRIDE; + case "company_override_usage_exceeded": + return COMPANY_OVERRIDE_USAGE_EXCEEDED; + case "plan_entitlement_usage_exceeded": + return PLAN_ENTITLEMENT_USAGE_EXCEEDED; + case "standard": + return STANDARD; + case "default": + return DEFAULT; + case "plan_entitlement": + return PLAN_ENTITLEMENT; + default: + return new RulesengineCheckFlagResultRuleType(Value.UNKNOWN, value); + } + } + + public enum Value { + DEFAULT, + + GLOBAL_OVERRIDE, + + COMPANY_OVERRIDE, + + COMPANY_OVERRIDE_USAGE_EXCEEDED, + + PLAN_ENTITLEMENT, + + PLAN_ENTITLEMENT_USAGE_EXCEEDED, + + STANDARD, + + UNKNOWN + } + + public interface Visitor { + T visitDefault(); + + T visitGlobalOverride(); + + T visitCompanyOverride(); + + T visitCompanyOverrideUsageExceeded(); + + T visitPlanEntitlement(); + + T visitPlanEntitlementUsageExceeded(); + + T visitStandard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCompany.java b/src/main/java/com/schematic/api/types/RulesengineCompany.java new file mode 100644 index 0000000..64812a0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCompany.java @@ -0,0 +1,620 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.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 = RulesengineCompany.Builder.class) +public final class RulesengineCompany { + private final String accountId; + + private final Optional basePlanId; + + private final List billingProductIds; + + private final Map creditBalances; + + private final Optional> entitlements; + + private final String environmentId; + + private final String id; + + private final Map keys; + + private final List metrics; + + private final List planIds; + + private final List planVersionIds; + + private final List rules; + + private final Optional subscription; + + private final List traits; + + private final Map additionalProperties; + + private RulesengineCompany( + String accountId, + Optional basePlanId, + List billingProductIds, + Map creditBalances, + Optional> entitlements, + String environmentId, + String id, + Map keys, + List metrics, + List planIds, + List planVersionIds, + List rules, + Optional subscription, + List traits, + Map additionalProperties) { + this.accountId = accountId; + this.basePlanId = basePlanId; + this.billingProductIds = billingProductIds; + this.creditBalances = creditBalances; + this.entitlements = entitlements; + this.environmentId = environmentId; + this.id = id; + this.keys = keys; + this.metrics = metrics; + this.planIds = planIds; + this.planVersionIds = planVersionIds; + this.rules = rules; + this.subscription = subscription; + this.traits = traits; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("base_plan_id") + public Optional getBasePlanId() { + return basePlanId; + } + + @JsonProperty("billing_product_ids") + public List getBillingProductIds() { + return billingProductIds; + } + + @JsonProperty("credit_balances") + public Map getCreditBalances() { + return creditBalances; + } + + @JsonProperty("entitlements") + public Optional> getEntitlements() { + return entitlements; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("keys") + public Map getKeys() { + return keys; + } + + @JsonProperty("metrics") + public List getMetrics() { + return metrics; + } + + @JsonProperty("plan_ids") + public List getPlanIds() { + return planIds; + } + + @JsonProperty("plan_version_ids") + public List getPlanVersionIds() { + return planVersionIds; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("subscription") + public Optional getSubscription() { + return subscription; + } + + @JsonProperty("traits") + public List getTraits() { + return traits; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineCompany && equalTo((RulesengineCompany) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineCompany other) { + return accountId.equals(other.accountId) + && basePlanId.equals(other.basePlanId) + && billingProductIds.equals(other.billingProductIds) + && creditBalances.equals(other.creditBalances) + && entitlements.equals(other.entitlements) + && environmentId.equals(other.environmentId) + && id.equals(other.id) + && keys.equals(other.keys) + && metrics.equals(other.metrics) + && planIds.equals(other.planIds) + && planVersionIds.equals(other.planVersionIds) + && rules.equals(other.rules) + && subscription.equals(other.subscription) + && traits.equals(other.traits); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.basePlanId, + this.billingProductIds, + this.creditBalances, + this.entitlements, + this.environmentId, + this.id, + this.keys, + this.metrics, + this.planIds, + this.planVersionIds, + this.rules, + this.subscription, + this.traits); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + EnvironmentIdStage accountId(@NotNull String accountId); + + Builder from(RulesengineCompany other); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + RulesengineCompany build(); + + _FinalStage basePlanId(Optional basePlanId); + + _FinalStage basePlanId(String basePlanId); + + _FinalStage billingProductIds(List billingProductIds); + + _FinalStage addBillingProductIds(String billingProductIds); + + _FinalStage addAllBillingProductIds(List billingProductIds); + + _FinalStage creditBalances(Map creditBalances); + + _FinalStage putAllCreditBalances(Map creditBalances); + + _FinalStage creditBalances(String key, Double value); + + _FinalStage entitlements(Optional> entitlements); + + _FinalStage entitlements(List entitlements); + + _FinalStage keys(Map keys); + + _FinalStage putAllKeys(Map keys); + + _FinalStage keys(String key, String value); + + _FinalStage metrics(List metrics); + + _FinalStage addMetrics(RulesengineCompanyMetric metrics); + + _FinalStage addAllMetrics(List metrics); + + _FinalStage planIds(List planIds); + + _FinalStage addPlanIds(String planIds); + + _FinalStage addAllPlanIds(List planIds); + + _FinalStage planVersionIds(List planVersionIds); + + _FinalStage addPlanVersionIds(String planVersionIds); + + _FinalStage addAllPlanVersionIds(List planVersionIds); + + _FinalStage rules(List rules); + + _FinalStage addRules(RulesengineRule rules); + + _FinalStage addAllRules(List rules); + + _FinalStage subscription(Optional subscription); + + _FinalStage subscription(RulesengineSubscription subscription); + + _FinalStage traits(List traits); + + _FinalStage addTraits(RulesengineTrait traits); + + _FinalStage addAllTraits(List traits); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, EnvironmentIdStage, IdStage, _FinalStage { + private String accountId; + + private String environmentId; + + private String id; + + private List traits = new ArrayList<>(); + + private Optional subscription = Optional.empty(); + + private List rules = new ArrayList<>(); + + private List planVersionIds = new ArrayList<>(); + + private List planIds = new ArrayList<>(); + + private List metrics = new ArrayList<>(); + + private Map keys = new LinkedHashMap<>(); + + private Optional> entitlements = Optional.empty(); + + private Map creditBalances = new LinkedHashMap<>(); + + private List billingProductIds = new ArrayList<>(); + + private Optional basePlanId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineCompany other) { + accountId(other.getAccountId()); + basePlanId(other.getBasePlanId()); + billingProductIds(other.getBillingProductIds()); + creditBalances(other.getCreditBalances()); + entitlements(other.getEntitlements()); + environmentId(other.getEnvironmentId()); + id(other.getId()); + keys(other.getKeys()); + metrics(other.getMetrics()); + planIds(other.getPlanIds()); + planVersionIds(other.getPlanVersionIds()); + rules(other.getRules()); + subscription(other.getSubscription()); + traits(other.getTraits()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public EnvironmentIdStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllTraits(List traits) { + if (traits != null) { + this.traits.addAll(traits); + } + return this; + } + + @java.lang.Override + public _FinalStage addTraits(RulesengineTrait traits) { + this.traits.add(traits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "traits", nulls = Nulls.SKIP) + public _FinalStage traits(List traits) { + this.traits.clear(); + if (traits != null) { + this.traits.addAll(traits); + } + return this; + } + + @java.lang.Override + public _FinalStage subscription(RulesengineSubscription subscription) { + this.subscription = Optional.ofNullable(subscription); + return this; + } + + @java.lang.Override + @JsonSetter(value = "subscription", nulls = Nulls.SKIP) + public _FinalStage subscription(Optional subscription) { + this.subscription = subscription; + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(RulesengineRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllPlanVersionIds(List planVersionIds) { + if (planVersionIds != null) { + this.planVersionIds.addAll(planVersionIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlanVersionIds(String planVersionIds) { + this.planVersionIds.add(planVersionIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_ids", nulls = Nulls.SKIP) + public _FinalStage planVersionIds(List planVersionIds) { + this.planVersionIds.clear(); + if (planVersionIds != null) { + this.planVersionIds.addAll(planVersionIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllPlanIds(List planIds) { + if (planIds != null) { + this.planIds.addAll(planIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addPlanIds(String planIds) { + this.planIds.add(planIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public _FinalStage planIds(List planIds) { + this.planIds.clear(); + if (planIds != null) { + this.planIds.addAll(planIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllMetrics(List metrics) { + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + @java.lang.Override + public _FinalStage addMetrics(RulesengineCompanyMetric metrics) { + this.metrics.add(metrics); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metrics", nulls = Nulls.SKIP) + public _FinalStage metrics(List metrics) { + this.metrics.clear(); + if (metrics != null) { + this.metrics.addAll(metrics); + } + return this; + } + + @java.lang.Override + public _FinalStage keys(String key, String value) { + this.keys.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllKeys(Map keys) { + if (keys != null) { + this.keys.putAll(keys); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "keys", nulls = Nulls.SKIP) + public _FinalStage keys(Map keys) { + this.keys.clear(); + if (keys != null) { + this.keys.putAll(keys); + } + return this; + } + + @java.lang.Override + public _FinalStage entitlements(List entitlements) { + this.entitlements = Optional.ofNullable(entitlements); + return this; + } + + @java.lang.Override + @JsonSetter(value = "entitlements", nulls = Nulls.SKIP) + public _FinalStage entitlements(Optional> entitlements) { + this.entitlements = entitlements; + return this; + } + + @java.lang.Override + public _FinalStage creditBalances(String key, Double value) { + this.creditBalances.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllCreditBalances(Map creditBalances) { + if (creditBalances != null) { + this.creditBalances.putAll(creditBalances); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_balances", nulls = Nulls.SKIP) + public _FinalStage creditBalances(Map creditBalances) { + this.creditBalances.clear(); + if (creditBalances != null) { + this.creditBalances.putAll(creditBalances); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllBillingProductIds(List billingProductIds) { + if (billingProductIds != null) { + this.billingProductIds.addAll(billingProductIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addBillingProductIds(String billingProductIds) { + this.billingProductIds.add(billingProductIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_product_ids", nulls = Nulls.SKIP) + public _FinalStage billingProductIds(List billingProductIds) { + this.billingProductIds.clear(); + if (billingProductIds != null) { + this.billingProductIds.addAll(billingProductIds); + } + return this; + } + + @java.lang.Override + public _FinalStage basePlanId(String basePlanId) { + this.basePlanId = Optional.ofNullable(basePlanId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "base_plan_id", nulls = Nulls.SKIP) + public _FinalStage basePlanId(Optional basePlanId) { + this.basePlanId = basePlanId; + return this; + } + + @java.lang.Override + public RulesengineCompany build() { + return new RulesengineCompany( + accountId, + basePlanId, + billingProductIds, + creditBalances, + entitlements, + environmentId, + id, + keys, + metrics, + planIds, + planVersionIds, + rules, + subscription, + traits, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java b/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java new file mode 100644 index 0000000..c413dc9 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java @@ -0,0 +1,333 @@ +/** + * 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 = RulesengineCompanyMetric.Builder.class) +public final class RulesengineCompanyMetric { + private final String accountId; + + private final String companyId; + + private final OffsetDateTime createdAt; + + private final String environmentId; + + private final String eventSubtype; + + private final RulesengineCompanyMetricMonthReset monthReset; + + private final RulesengineCompanyMetricPeriod period; + + private final Optional validUntil; + + private final int value; + + private final Map additionalProperties; + + private RulesengineCompanyMetric( + String accountId, + String companyId, + OffsetDateTime createdAt, + String environmentId, + String eventSubtype, + RulesengineCompanyMetricMonthReset monthReset, + RulesengineCompanyMetricPeriod period, + Optional validUntil, + int value, + Map additionalProperties) { + this.accountId = accountId; + this.companyId = companyId; + this.createdAt = createdAt; + this.environmentId = environmentId; + this.eventSubtype = eventSubtype; + this.monthReset = monthReset; + this.period = period; + this.validUntil = validUntil; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("event_subtype") + public String getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("month_reset") + public RulesengineCompanyMetricMonthReset getMonthReset() { + return monthReset; + } + + @JsonProperty("period") + public RulesengineCompanyMetricPeriod getPeriod() { + return period; + } + + @JsonProperty("valid_until") + public Optional getValidUntil() { + return validUntil; + } + + @JsonProperty("value") + public int getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineCompanyMetric && equalTo((RulesengineCompanyMetric) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineCompanyMetric other) { + return accountId.equals(other.accountId) + && companyId.equals(other.companyId) + && createdAt.equals(other.createdAt) + && environmentId.equals(other.environmentId) + && eventSubtype.equals(other.eventSubtype) + && monthReset.equals(other.monthReset) + && period.equals(other.period) + && validUntil.equals(other.validUntil) + && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.companyId, + this.createdAt, + this.environmentId, + this.eventSubtype, + this.monthReset, + this.period, + this.validUntil, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + CompanyIdStage accountId(@NotNull String accountId); + + Builder from(RulesengineCompanyMetric other); + } + + public interface CompanyIdStage { + CreatedAtStage companyId(@NotNull String companyId); + } + + public interface CreatedAtStage { + EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface EnvironmentIdStage { + EventSubtypeStage environmentId(@NotNull String environmentId); + } + + public interface EventSubtypeStage { + MonthResetStage eventSubtype(@NotNull String eventSubtype); + } + + public interface MonthResetStage { + PeriodStage monthReset(@NotNull RulesengineCompanyMetricMonthReset monthReset); + } + + public interface PeriodStage { + ValueStage period(@NotNull RulesengineCompanyMetricPeriod period); + } + + public interface ValueStage { + _FinalStage value(int value); + } + + public interface _FinalStage { + RulesengineCompanyMetric build(); + + _FinalStage validUntil(Optional validUntil); + + _FinalStage validUntil(OffsetDateTime validUntil); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + CompanyIdStage, + CreatedAtStage, + EnvironmentIdStage, + EventSubtypeStage, + MonthResetStage, + PeriodStage, + ValueStage, + _FinalStage { + private String accountId; + + private String companyId; + + private OffsetDateTime createdAt; + + private String environmentId; + + private String eventSubtype; + + private RulesengineCompanyMetricMonthReset monthReset; + + private RulesengineCompanyMetricPeriod period; + + private int value; + + private Optional validUntil = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineCompanyMetric other) { + accountId(other.getAccountId()); + companyId(other.getCompanyId()); + createdAt(other.getCreatedAt()); + environmentId(other.getEnvironmentId()); + eventSubtype(other.getEventSubtype()); + monthReset(other.getMonthReset()); + period(other.getPeriod()); + validUntil(other.getValidUntil()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public CompanyIdStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId 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 EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public EventSubtypeStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_subtype") + public MonthResetStage eventSubtype(@NotNull String eventSubtype) { + this.eventSubtype = Objects.requireNonNull(eventSubtype, "eventSubtype must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("month_reset") + public PeriodStage monthReset(@NotNull RulesengineCompanyMetricMonthReset monthReset) { + this.monthReset = Objects.requireNonNull(monthReset, "monthReset must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("period") + public ValueStage period(@NotNull RulesengineCompanyMetricPeriod period) { + this.period = Objects.requireNonNull(period, "period must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(int value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage validUntil(OffsetDateTime validUntil) { + this.validUntil = Optional.ofNullable(validUntil); + return this; + } + + @java.lang.Override + @JsonSetter(value = "valid_until", nulls = Nulls.SKIP) + public _FinalStage validUntil(Optional validUntil) { + this.validUntil = validUntil; + return this; + } + + @java.lang.Override + public RulesengineCompanyMetric build() { + return new RulesengineCompanyMetric( + accountId, + companyId, + createdAt, + environmentId, + eventSubtype, + monthReset, + period, + validUntil, + value, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCompanyMetricMonthReset.java b/src/main/java/com/schematic/api/types/RulesengineCompanyMetricMonthReset.java new file mode 100644 index 0000000..be27a7d --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCompanyMetricMonthReset.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 RulesengineCompanyMetricMonthReset { + public static final RulesengineCompanyMetricMonthReset FIRST_OF_MONTH = + new RulesengineCompanyMetricMonthReset(Value.FIRST_OF_MONTH, "first_of_month"); + + public static final RulesengineCompanyMetricMonthReset BILLING_CYCLE = + new RulesengineCompanyMetricMonthReset(Value.BILLING_CYCLE, "billing_cycle"); + + private final Value value; + + private final String string; + + RulesengineCompanyMetricMonthReset(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 RulesengineCompanyMetricMonthReset + && this.string.equals(((RulesengineCompanyMetricMonthReset) 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 RulesengineCompanyMetricMonthReset valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_cycle": + return BILLING_CYCLE; + default: + return new RulesengineCompanyMetricMonthReset(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/types/RulesengineCompanyMetricPeriod.java b/src/main/java/com/schematic/api/types/RulesengineCompanyMetricPeriod.java new file mode 100644 index 0000000..2fe51ed --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCompanyMetricPeriod.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RulesengineCompanyMetricPeriod { + public static final RulesengineCompanyMetricPeriod CURRENT_DAY = + new RulesengineCompanyMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final RulesengineCompanyMetricPeriod ALL_TIME = + new RulesengineCompanyMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final RulesengineCompanyMetricPeriod CURRENT_WEEK = + new RulesengineCompanyMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final RulesengineCompanyMetricPeriod CURRENT_MONTH = + new RulesengineCompanyMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + RulesengineCompanyMetricPeriod(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 RulesengineCompanyMetricPeriod + && this.string.equals(((RulesengineCompanyMetricPeriod) 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 RulesengineCompanyMetricPeriod 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 RulesengineCompanyMetricPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_DAY, + + CURRENT_MONTH, + + CURRENT_WEEK, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentDay(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineCondition.java b/src/main/java/com/schematic/api/types/RulesengineCondition.java new file mode 100644 index 0000000..47ba85c --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineCondition.java @@ -0,0 +1,550 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineCondition.Builder.class) +public final class RulesengineCondition { + private final String accountId; + + private final Optional comparisonTraitDefinition; + + private final RulesengineConditionConditionType conditionType; + + private final Optional consumptionRate; + + private final Optional creditId; + + private final String environmentId; + + private final Optional eventSubtype; + + private final String id; + + private final Optional metricPeriod; + + private final Optional metricPeriodMonthReset; + + private final Optional metricValue; + + private final RulesengineConditionOperator operator; + + private final List resourceIds; + + private final Optional traitDefinition; + + private final String traitValue; + + private final Map additionalProperties; + + private RulesengineCondition( + String accountId, + Optional comparisonTraitDefinition, + RulesengineConditionConditionType conditionType, + Optional consumptionRate, + Optional creditId, + String environmentId, + Optional eventSubtype, + String id, + Optional metricPeriod, + Optional metricPeriodMonthReset, + Optional metricValue, + RulesengineConditionOperator operator, + List resourceIds, + Optional traitDefinition, + String traitValue, + Map additionalProperties) { + this.accountId = accountId; + this.comparisonTraitDefinition = comparisonTraitDefinition; + this.conditionType = conditionType; + this.consumptionRate = consumptionRate; + this.creditId = creditId; + this.environmentId = environmentId; + this.eventSubtype = eventSubtype; + this.id = id; + this.metricPeriod = metricPeriod; + this.metricPeriodMonthReset = metricPeriodMonthReset; + this.metricValue = metricValue; + this.operator = operator; + this.resourceIds = resourceIds; + this.traitDefinition = traitDefinition; + this.traitValue = traitValue; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("comparison_trait_definition") + public Optional getComparisonTraitDefinition() { + return comparisonTraitDefinition; + } + + @JsonProperty("condition_type") + public RulesengineConditionConditionType getConditionType() { + return conditionType; + } + + @JsonProperty("consumption_rate") + public Optional getConsumptionRate() { + return consumptionRate; + } + + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("event_subtype") + public Optional getEventSubtype() { + return eventSubtype; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + @JsonProperty("metric_period_month_reset") + public Optional getMetricPeriodMonthReset() { + return metricPeriodMonthReset; + } + + @JsonProperty("metric_value") + public Optional getMetricValue() { + return metricValue; + } + + @JsonProperty("operator") + public RulesengineConditionOperator getOperator() { + return operator; + } + + @JsonProperty("resource_ids") + public List getResourceIds() { + return resourceIds; + } + + @JsonProperty("trait_definition") + public Optional getTraitDefinition() { + return traitDefinition; + } + + @JsonProperty("trait_value") + public String getTraitValue() { + return traitValue; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineCondition && equalTo((RulesengineCondition) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineCondition other) { + return accountId.equals(other.accountId) + && comparisonTraitDefinition.equals(other.comparisonTraitDefinition) + && conditionType.equals(other.conditionType) + && consumptionRate.equals(other.consumptionRate) + && creditId.equals(other.creditId) + && environmentId.equals(other.environmentId) + && eventSubtype.equals(other.eventSubtype) + && id.equals(other.id) + && metricPeriod.equals(other.metricPeriod) + && metricPeriodMonthReset.equals(other.metricPeriodMonthReset) + && metricValue.equals(other.metricValue) + && operator.equals(other.operator) + && resourceIds.equals(other.resourceIds) + && traitDefinition.equals(other.traitDefinition) + && traitValue.equals(other.traitValue); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.comparisonTraitDefinition, + this.conditionType, + this.consumptionRate, + this.creditId, + this.environmentId, + this.eventSubtype, + this.id, + this.metricPeriod, + this.metricPeriodMonthReset, + this.metricValue, + this.operator, + this.resourceIds, + this.traitDefinition, + this.traitValue); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + ConditionTypeStage accountId(@NotNull String accountId); + + Builder from(RulesengineCondition other); + } + + public interface ConditionTypeStage { + EnvironmentIdStage conditionType(@NotNull RulesengineConditionConditionType conditionType); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + OperatorStage id(@NotNull String id); + } + + public interface OperatorStage { + TraitValueStage operator(@NotNull RulesengineConditionOperator operator); + } + + public interface TraitValueStage { + _FinalStage traitValue(@NotNull String traitValue); + } + + public interface _FinalStage { + RulesengineCondition build(); + + _FinalStage comparisonTraitDefinition(Optional comparisonTraitDefinition); + + _FinalStage comparisonTraitDefinition(RulesengineTraitDefinition comparisonTraitDefinition); + + _FinalStage consumptionRate(Optional consumptionRate); + + _FinalStage consumptionRate(Double consumptionRate); + + _FinalStage creditId(Optional creditId); + + _FinalStage creditId(String creditId); + + _FinalStage eventSubtype(Optional eventSubtype); + + _FinalStage eventSubtype(String eventSubtype); + + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(RulesengineConditionMetricPeriod metricPeriod); + + _FinalStage metricPeriodMonthReset(Optional metricPeriodMonthReset); + + _FinalStage metricPeriodMonthReset(RulesengineConditionMetricPeriodMonthReset metricPeriodMonthReset); + + _FinalStage metricValue(Optional metricValue); + + _FinalStage metricValue(Integer metricValue); + + _FinalStage resourceIds(List resourceIds); + + _FinalStage addResourceIds(String resourceIds); + + _FinalStage addAllResourceIds(List resourceIds); + + _FinalStage traitDefinition(Optional traitDefinition); + + _FinalStage traitDefinition(RulesengineTraitDefinition traitDefinition); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + ConditionTypeStage, + EnvironmentIdStage, + IdStage, + OperatorStage, + TraitValueStage, + _FinalStage { + private String accountId; + + private RulesengineConditionConditionType conditionType; + + private String environmentId; + + private String id; + + private RulesengineConditionOperator operator; + + private String traitValue; + + private Optional traitDefinition = Optional.empty(); + + private List resourceIds = new ArrayList<>(); + + private Optional metricValue = Optional.empty(); + + private Optional metricPeriodMonthReset = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional eventSubtype = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional consumptionRate = Optional.empty(); + + private Optional comparisonTraitDefinition = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineCondition other) { + accountId(other.getAccountId()); + comparisonTraitDefinition(other.getComparisonTraitDefinition()); + conditionType(other.getConditionType()); + consumptionRate(other.getConsumptionRate()); + creditId(other.getCreditId()); + environmentId(other.getEnvironmentId()); + eventSubtype(other.getEventSubtype()); + id(other.getId()); + metricPeriod(other.getMetricPeriod()); + metricPeriodMonthReset(other.getMetricPeriodMonthReset()); + metricValue(other.getMetricValue()); + operator(other.getOperator()); + resourceIds(other.getResourceIds()); + traitDefinition(other.getTraitDefinition()); + traitValue(other.getTraitValue()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public ConditionTypeStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("condition_type") + public EnvironmentIdStage conditionType(@NotNull RulesengineConditionConditionType conditionType) { + this.conditionType = Objects.requireNonNull(conditionType, "conditionType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public OperatorStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("operator") + public TraitValueStage operator(@NotNull RulesengineConditionOperator operator) { + this.operator = Objects.requireNonNull(operator, "operator must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("trait_value") + public _FinalStage traitValue(@NotNull String traitValue) { + this.traitValue = Objects.requireNonNull(traitValue, "traitValue must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage traitDefinition(RulesengineTraitDefinition traitDefinition) { + this.traitDefinition = Optional.ofNullable(traitDefinition); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_definition", nulls = Nulls.SKIP) + public _FinalStage traitDefinition(Optional traitDefinition) { + this.traitDefinition = traitDefinition; + return this; + } + + @java.lang.Override + public _FinalStage addAllResourceIds(List resourceIds) { + if (resourceIds != null) { + this.resourceIds.addAll(resourceIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addResourceIds(String resourceIds) { + this.resourceIds.add(resourceIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource_ids", nulls = Nulls.SKIP) + public _FinalStage resourceIds(List resourceIds) { + this.resourceIds.clear(); + if (resourceIds != null) { + this.resourceIds.addAll(resourceIds); + } + return this; + } + + @java.lang.Override + public _FinalStage metricValue(Integer metricValue) { + this.metricValue = Optional.ofNullable(metricValue); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) + public _FinalStage metricValue(Optional metricValue) { + this.metricValue = metricValue; + return this; + } + + @java.lang.Override + public _FinalStage metricPeriodMonthReset(RulesengineConditionMetricPeriodMonthReset 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(RulesengineConditionMetricPeriod 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 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 _FinalStage creditId(String creditId) { + this.creditId = Optional.ofNullable(creditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_id", nulls = Nulls.SKIP) + public _FinalStage creditId(Optional creditId) { + this.creditId = creditId; + return this; + } + + @java.lang.Override + public _FinalStage consumptionRate(Double consumptionRate) { + this.consumptionRate = Optional.ofNullable(consumptionRate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "consumption_rate", nulls = Nulls.SKIP) + public _FinalStage consumptionRate(Optional consumptionRate) { + this.consumptionRate = consumptionRate; + return this; + } + + @java.lang.Override + public _FinalStage comparisonTraitDefinition(RulesengineTraitDefinition comparisonTraitDefinition) { + this.comparisonTraitDefinition = Optional.ofNullable(comparisonTraitDefinition); + return this; + } + + @java.lang.Override + @JsonSetter(value = "comparison_trait_definition", nulls = Nulls.SKIP) + public _FinalStage comparisonTraitDefinition(Optional comparisonTraitDefinition) { + this.comparisonTraitDefinition = comparisonTraitDefinition; + return this; + } + + @java.lang.Override + public RulesengineCondition build() { + return new RulesengineCondition( + accountId, + comparisonTraitDefinition, + conditionType, + consumptionRate, + creditId, + environmentId, + eventSubtype, + id, + metricPeriod, + metricPeriodMonthReset, + metricValue, + operator, + resourceIds, + traitDefinition, + traitValue, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineConditionConditionType.java b/src/main/java/com/schematic/api/types/RulesengineConditionConditionType.java new file mode 100644 index 0000000..8ecd096 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineConditionConditionType.java @@ -0,0 +1,163 @@ +/** + * 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 RulesengineConditionConditionType { + public static final RulesengineConditionConditionType BASE_PLAN = + new RulesengineConditionConditionType(Value.BASE_PLAN, "base_plan"); + + public static final RulesengineConditionConditionType METRIC = + new RulesengineConditionConditionType(Value.METRIC, "metric"); + + public static final RulesengineConditionConditionType PLAN = + new RulesengineConditionConditionType(Value.PLAN, "plan"); + + public static final RulesengineConditionConditionType PLAN_VERSION = + new RulesengineConditionConditionType(Value.PLAN_VERSION, "plan_version"); + + public static final RulesengineConditionConditionType TRAIT = + new RulesengineConditionConditionType(Value.TRAIT, "trait"); + + public static final RulesengineConditionConditionType CREDIT = + new RulesengineConditionConditionType(Value.CREDIT, "credit"); + + public static final RulesengineConditionConditionType BILLING_PRODUCT = + new RulesengineConditionConditionType(Value.BILLING_PRODUCT, "billing_product"); + + public static final RulesengineConditionConditionType USER = + new RulesengineConditionConditionType(Value.USER, "user"); + + public static final RulesengineConditionConditionType COMPANY = + new RulesengineConditionConditionType(Value.COMPANY, "company"); + + private final Value value; + + private final String string; + + RulesengineConditionConditionType(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 RulesengineConditionConditionType + && this.string.equals(((RulesengineConditionConditionType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BASE_PLAN: + return visitor.visitBasePlan(); + case METRIC: + return visitor.visitMetric(); + case PLAN: + return visitor.visitPlan(); + case PLAN_VERSION: + return visitor.visitPlanVersion(); + case TRAIT: + return visitor.visitTrait(); + case CREDIT: + return visitor.visitCredit(); + case BILLING_PRODUCT: + return visitor.visitBillingProduct(); + case USER: + return visitor.visitUser(); + case COMPANY: + return visitor.visitCompany(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RulesengineConditionConditionType valueOf(String value) { + switch (value) { + case "base_plan": + return BASE_PLAN; + case "metric": + return METRIC; + case "plan": + return PLAN; + case "plan_version": + return PLAN_VERSION; + case "trait": + return TRAIT; + case "credit": + return CREDIT; + case "billing_product": + return BILLING_PRODUCT; + case "user": + return USER; + case "company": + return COMPANY; + default: + return new RulesengineConditionConditionType(Value.UNKNOWN, value); + } + } + + public enum Value { + BASE_PLAN, + + BILLING_PRODUCT, + + COMPANY, + + CREDIT, + + METRIC, + + PLAN, + + PLAN_VERSION, + + TRAIT, + + USER, + + UNKNOWN + } + + public interface Visitor { + T visitBasePlan(); + + T visitBillingProduct(); + + T visitCompany(); + + T visitCredit(); + + T visitMetric(); + + T visitPlan(); + + T visitPlanVersion(); + + T visitTrait(); + + T visitUser(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java b/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java new file mode 100644 index 0000000..032a44c --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineConditionGroup.Builder.class) +public final class RulesengineConditionGroup { + private final List conditions; + + private final Map additionalProperties; + + private RulesengineConditionGroup(List conditions, Map additionalProperties) { + this.conditions = conditions; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("conditions") + public List getConditions() { + return conditions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineConditionGroup && equalTo((RulesengineConditionGroup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineConditionGroup other) { + return conditions.equals(other.conditions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.conditions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List conditions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RulesengineConditionGroup other) { + conditions(other.getConditions()); + return this; + } + + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public Builder conditions(List conditions) { + this.conditions.clear(); + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + public Builder addConditions(RulesengineCondition conditions) { + this.conditions.add(conditions); + return this; + } + + public Builder addAllConditions(List conditions) { + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + public RulesengineConditionGroup build() { + return new RulesengineConditionGroup(conditions, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineConditionMetricPeriod.java b/src/main/java/com/schematic/api/types/RulesengineConditionMetricPeriod.java new file mode 100644 index 0000000..589481d --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineConditionMetricPeriod.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RulesengineConditionMetricPeriod { + public static final RulesengineConditionMetricPeriod CURRENT_DAY = + new RulesengineConditionMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final RulesengineConditionMetricPeriod ALL_TIME = + new RulesengineConditionMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final RulesengineConditionMetricPeriod CURRENT_WEEK = + new RulesengineConditionMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final RulesengineConditionMetricPeriod CURRENT_MONTH = + new RulesengineConditionMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + RulesengineConditionMetricPeriod(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 RulesengineConditionMetricPeriod + && this.string.equals(((RulesengineConditionMetricPeriod) 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 RulesengineConditionMetricPeriod 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 RulesengineConditionMetricPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_DAY, + + CURRENT_MONTH, + + CURRENT_WEEK, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentDay(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineConditionMetricPeriodMonthReset.java b/src/main/java/com/schematic/api/types/RulesengineConditionMetricPeriodMonthReset.java new file mode 100644 index 0000000..8a97c7e --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineConditionMetricPeriodMonthReset.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 RulesengineConditionMetricPeriodMonthReset { + public static final RulesengineConditionMetricPeriodMonthReset FIRST_OF_MONTH = + new RulesengineConditionMetricPeriodMonthReset(Value.FIRST_OF_MONTH, "first_of_month"); + + public static final RulesengineConditionMetricPeriodMonthReset BILLING_CYCLE = + new RulesengineConditionMetricPeriodMonthReset(Value.BILLING_CYCLE, "billing_cycle"); + + private final Value value; + + private final String string; + + RulesengineConditionMetricPeriodMonthReset(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 RulesengineConditionMetricPeriodMonthReset + && this.string.equals(((RulesengineConditionMetricPeriodMonthReset) 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 RulesengineConditionMetricPeriodMonthReset valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_cycle": + return BILLING_CYCLE; + default: + return new RulesengineConditionMetricPeriodMonthReset(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/types/RulesengineConditionOperator.java b/src/main/java/com/schematic/api/types/RulesengineConditionOperator.java new file mode 100644 index 0000000..44d58ee --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineConditionOperator.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RulesengineConditionOperator { + public static final RulesengineConditionOperator GTE = new RulesengineConditionOperator(Value.GTE, "gte"); + + public static final RulesengineConditionOperator LT = new RulesengineConditionOperator(Value.LT, "lt"); + + public static final RulesengineConditionOperator GT = new RulesengineConditionOperator(Value.GT, "gt"); + + public static final RulesengineConditionOperator NOT_EMPTY = + new RulesengineConditionOperator(Value.NOT_EMPTY, "not_empty"); + + public static final RulesengineConditionOperator EQ = new RulesengineConditionOperator(Value.EQ, "eq"); + + public static final RulesengineConditionOperator NE = new RulesengineConditionOperator(Value.NE, "ne"); + + public static final RulesengineConditionOperator LTE = new RulesengineConditionOperator(Value.LTE, "lte"); + + public static final RulesengineConditionOperator IS_EMPTY = + new RulesengineConditionOperator(Value.IS_EMPTY, "is_empty"); + + private final Value value; + + private final String string; + + RulesengineConditionOperator(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 RulesengineConditionOperator + && this.string.equals(((RulesengineConditionOperator) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GTE: + return visitor.visitGte(); + case LT: + return visitor.visitLt(); + case GT: + return visitor.visitGt(); + case NOT_EMPTY: + return visitor.visitNotEmpty(); + case EQ: + return visitor.visitEq(); + case NE: + return visitor.visitNe(); + case LTE: + return visitor.visitLte(); + case IS_EMPTY: + return visitor.visitIsEmpty(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RulesengineConditionOperator valueOf(String value) { + switch (value) { + case "gte": + return GTE; + case "lt": + return LT; + case "gt": + return GT; + case "not_empty": + return NOT_EMPTY; + case "eq": + return EQ; + case "ne": + return NE; + case "lte": + return LTE; + case "is_empty": + return IS_EMPTY; + default: + return new RulesengineConditionOperator(Value.UNKNOWN, value); + } + } + + public enum Value { + EQ, + + NE, + + GT, + + LT, + + GTE, + + LTE, + + IS_EMPTY, + + NOT_EMPTY, + + UNKNOWN + } + + public interface Visitor { + T visitEq(); + + T visitNe(); + + T visitGt(); + + T visitLt(); + + T visitGte(); + + T visitLte(); + + T visitIsEmpty(); + + T visitNotEmpty(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseDataAllocationType.java b/src/main/java/com/schematic/api/types/RulesengineEntitlementValueType.java similarity index 58% rename from src/main/java/com/schematic/api/types/FeatureCompanyUserResponseDataAllocationType.java rename to src/main/java/com/schematic/api/types/RulesengineEntitlementValueType.java index 557643f..3003b13 100644 --- a/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseDataAllocationType.java +++ b/src/main/java/com/schematic/api/types/RulesengineEntitlementValueType.java @@ -6,27 +6,30 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class FeatureCompanyUserResponseDataAllocationType { - public static final FeatureCompanyUserResponseDataAllocationType NUMERIC = - new FeatureCompanyUserResponseDataAllocationType(Value.NUMERIC, "numeric"); +public final class RulesengineEntitlementValueType { + public static final RulesengineEntitlementValueType NUMERIC = + new RulesengineEntitlementValueType(Value.NUMERIC, "numeric"); - public static final FeatureCompanyUserResponseDataAllocationType TRAIT = - new FeatureCompanyUserResponseDataAllocationType(Value.TRAIT, "trait"); + public static final RulesengineEntitlementValueType TRAIT = + new RulesengineEntitlementValueType(Value.TRAIT, "trait"); - public static final FeatureCompanyUserResponseDataAllocationType BOOLEAN = - new FeatureCompanyUserResponseDataAllocationType(Value.BOOLEAN, "boolean"); + public static final RulesengineEntitlementValueType BOOLEAN = + new RulesengineEntitlementValueType(Value.BOOLEAN, "boolean"); - public static final FeatureCompanyUserResponseDataAllocationType UNKNOWN = - new FeatureCompanyUserResponseDataAllocationType(Value.UNKNOWN, "unknown"); + public static final RulesengineEntitlementValueType UNKNOWN = + new RulesengineEntitlementValueType(Value.UNKNOWN, "unknown"); - public static final FeatureCompanyUserResponseDataAllocationType UNLIMITED = - new FeatureCompanyUserResponseDataAllocationType(Value.UNLIMITED, "unlimited"); + public static final RulesengineEntitlementValueType CREDIT = + new RulesengineEntitlementValueType(Value.CREDIT, "credit"); + + public static final RulesengineEntitlementValueType UNLIMITED = + new RulesengineEntitlementValueType(Value.UNLIMITED, "unlimited"); private final Value value; private final String string; - FeatureCompanyUserResponseDataAllocationType(Value value, String string) { + RulesengineEntitlementValueType(Value value, String string) { this.value = value; this.string = string; } @@ -44,8 +47,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof FeatureCompanyUserResponseDataAllocationType - && this.string.equals(((FeatureCompanyUserResponseDataAllocationType) other).string)); + || (other instanceof RulesengineEntitlementValueType + && this.string.equals(((RulesengineEntitlementValueType) other).string)); } @java.lang.Override @@ -63,6 +66,8 @@ public T visit(Visitor visitor) { return visitor.visitBoolean(); case UNKNOWN: return visitor.visitUnknown(); + case CREDIT: + return visitor.visitCredit(); case UNLIMITED: return visitor.visitUnlimited(); case _UNKNOWN: @@ -72,7 +77,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static FeatureCompanyUserResponseDataAllocationType valueOf(String value) { + public static RulesengineEntitlementValueType valueOf(String value) { switch (value) { case "numeric": return NUMERIC; @@ -82,38 +87,44 @@ public static FeatureCompanyUserResponseDataAllocationType valueOf(String value) return BOOLEAN; case "unknown": return UNKNOWN; + case "credit": + return CREDIT; case "unlimited": return UNLIMITED; default: - return new FeatureCompanyUserResponseDataAllocationType(Value._UNKNOWN, value); + return new RulesengineEntitlementValueType(Value._UNKNOWN, value); } } public enum Value { BOOLEAN, + CREDIT, + NUMERIC, TRAIT, - UNLIMITED, - UNKNOWN, + UNLIMITED, + _UNKNOWN } public interface Visitor { T visitBoolean(); + T visitCredit(); + T visitNumeric(); T visitTrait(); - T visitUnlimited(); - T visitUnknown(); + T visitUnlimited(); + T visitUnknown(String unknownType); } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsRequestEntityType.java b/src/main/java/com/schematic/api/types/RulesengineEntityType.java similarity index 62% rename from src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsRequestEntityType.java rename to src/main/java/com/schematic/api/types/RulesengineEntityType.java index a028b3c..86a9fb0 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsRequestEntityType.java +++ b/src/main/java/com/schematic/api/types/RulesengineEntityType.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.companies.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListEntityKeyDefinitionsRequestEntityType { - public static final ListEntityKeyDefinitionsRequestEntityType USER = - new ListEntityKeyDefinitionsRequestEntityType(Value.USER, "user"); +public final class RulesengineEntityType { + public static final RulesengineEntityType USER = new RulesengineEntityType(Value.USER, "user"); - public static final ListEntityKeyDefinitionsRequestEntityType COMPANY = - new ListEntityKeyDefinitionsRequestEntityType(Value.COMPANY, "company"); + public static final RulesengineEntityType COMPANY = new RulesengineEntityType(Value.COMPANY, "company"); private final Value value; private final String string; - ListEntityKeyDefinitionsRequestEntityType(Value value, String string) { + RulesengineEntityType(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof ListEntityKeyDefinitionsRequestEntityType - && this.string.equals(((ListEntityKeyDefinitionsRequestEntityType) other).string)); + || (other instanceof RulesengineEntityType + && this.string.equals(((RulesengineEntityType) other).string)); } @java.lang.Override @@ -57,14 +55,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEntityKeyDefinitionsRequestEntityType valueOf(String value) { + public static RulesengineEntityType valueOf(String value) { switch (value) { case "user": return USER; case "company": return COMPANY; default: - return new ListEntityKeyDefinitionsRequestEntityType(Value.UNKNOWN, value); + return new RulesengineEntityType(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java new file mode 100644 index 0000000..53d6acb --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java @@ -0,0 +1,679 @@ +/** + * 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 = RulesengineFeatureEntitlement.Builder.class) +public final class RulesengineFeatureEntitlement { + private final Optional allocation; + + private final Optional creditId; + + private final Optional creditRemaining; + + private final Optional creditTotal; + + private final Optional creditUsed; + + private final Optional eventName; + + private final String featureId; + + private final String featureKey; + + private final Optional metricPeriod; + + private final Optional metricResetAt; + + private final Optional monthReset; + + private final Optional softLimit; + + private final Optional usage; + + private final RulesengineEntitlementValueType valueType; + + private final Map additionalProperties; + + private RulesengineFeatureEntitlement( + Optional allocation, + Optional creditId, + Optional creditRemaining, + Optional creditTotal, + Optional creditUsed, + Optional eventName, + String featureId, + String featureKey, + Optional metricPeriod, + Optional metricResetAt, + Optional monthReset, + Optional softLimit, + Optional usage, + RulesengineEntitlementValueType valueType, + Map additionalProperties) { + this.allocation = allocation; + this.creditId = creditId; + this.creditRemaining = creditRemaining; + this.creditTotal = creditTotal; + this.creditUsed = creditUsed; + this.eventName = eventName; + this.featureId = featureId; + this.featureKey = featureKey; + this.metricPeriod = metricPeriod; + this.metricResetAt = metricResetAt; + this.monthReset = monthReset; + this.softLimit = softLimit; + this.usage = usage; + this.valueType = valueType; + this.additionalProperties = additionalProperties; + } + + /** + * @return If the company has a numeric entitlement for this feature, the allocated amount + */ + @JsonProperty("allocation") + public Optional getAllocation() { + return allocation; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the ID of the credit + */ + @JsonProperty("credit_id") + public Optional getCreditId() { + return creditId; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the remaining credit amount + */ + @JsonProperty("credit_remaining") + public Optional getCreditRemaining() { + return creditRemaining; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the total credit amount + */ + @JsonProperty("credit_total") + public Optional getCreditTotal() { + return creditTotal; + } + + /** + * @return If the company has a credit-based entitlement for this feature, the amount of credit used + */ + @JsonProperty("credit_used") + public Optional getCreditUsed() { + return creditUsed; + } + + /** + * @return If the feature is event-based, the name of the event tracked for usage + */ + @JsonProperty("event_name") + public Optional getEventName() { + return eventName; + } + + /** + * @return The ID of the feature + */ + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + /** + * @return The key of the flag associated with the feature + */ + @JsonProperty("feature_key") + public String getFeatureKey() { + return featureKey; + } + + /** + * @return For event-based feature entitlements, the period over which usage is tracked + */ + @JsonProperty("metric_period") + public Optional getMetricPeriod() { + return metricPeriod; + } + + /** + * @return For event-based feature entitlements, when the usage period will reset + */ + @JsonProperty("metric_reset_at") + public Optional getMetricResetAt() { + return metricResetAt; + } + + /** + * @return For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle + */ + @JsonProperty("month_reset") + public Optional getMonthReset() { + return monthReset; + } + + /** + * @return For usage-based pricing, the soft limit for overage charges or the next tier boundary + */ + @JsonProperty("soft_limit") + public Optional getSoftLimit() { + return softLimit; + } + + /** + * @return If the company has a numeric entitlement for this feature, the current usage amount + */ + @JsonProperty("usage") + public Optional getUsage() { + return usage; + } + + @JsonProperty("value_type") + public RulesengineEntitlementValueType getValueType() { + return valueType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineFeatureEntitlement && equalTo((RulesengineFeatureEntitlement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineFeatureEntitlement other) { + return allocation.equals(other.allocation) + && creditId.equals(other.creditId) + && creditRemaining.equals(other.creditRemaining) + && creditTotal.equals(other.creditTotal) + && creditUsed.equals(other.creditUsed) + && eventName.equals(other.eventName) + && featureId.equals(other.featureId) + && featureKey.equals(other.featureKey) + && metricPeriod.equals(other.metricPeriod) + && metricResetAt.equals(other.metricResetAt) + && monthReset.equals(other.monthReset) + && softLimit.equals(other.softLimit) + && usage.equals(other.usage) + && valueType.equals(other.valueType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allocation, + this.creditId, + this.creditRemaining, + this.creditTotal, + this.creditUsed, + this.eventName, + this.featureId, + this.featureKey, + this.metricPeriod, + this.metricResetAt, + this.monthReset, + this.softLimit, + this.usage, + this.valueType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FeatureIdStage builder() { + return new Builder(); + } + + public interface FeatureIdStage { + /** + *

The ID of the feature

+ */ + FeatureKeyStage featureId(@NotNull String featureId); + + Builder from(RulesengineFeatureEntitlement other); + } + + public interface FeatureKeyStage { + /** + *

The key of the flag associated with the feature

+ */ + ValueTypeStage featureKey(@NotNull String featureKey); + } + + public interface ValueTypeStage { + _FinalStage valueType(@NotNull RulesengineEntitlementValueType valueType); + } + + public interface _FinalStage { + RulesengineFeatureEntitlement build(); + + /** + *

If the company has a numeric entitlement for this feature, the allocated amount

+ */ + _FinalStage allocation(Optional allocation); + + _FinalStage allocation(Integer allocation); + + /** + *

If the company has a credit-based entitlement for this feature, the ID of the credit

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

If the company has a credit-based entitlement for this feature, the remaining credit amount

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

If the company has a credit-based entitlement for this feature, the total credit amount

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

If the company has a credit-based entitlement for this feature, the amount of credit used

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

If the feature is event-based, the name of the event tracked for usage

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

For event-based feature entitlements, the period over which usage is tracked

+ */ + _FinalStage metricPeriod(Optional metricPeriod); + + _FinalStage metricPeriod(RulesengineFeatureEntitlementMetricPeriod metricPeriod); + + /** + *

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

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

For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle

+ */ + _FinalStage monthReset(Optional monthReset); + + _FinalStage monthReset(RulesengineFeatureEntitlementMonthReset monthReset); + + /** + *

For usage-based pricing, the soft limit for overage charges or the next tier boundary

+ */ + _FinalStage softLimit(Optional softLimit); + + _FinalStage softLimit(Integer softLimit); + + /** + *

If the company has a numeric entitlement for this feature, the current usage amount

+ */ + _FinalStage usage(Optional usage); + + _FinalStage usage(Integer usage); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FeatureIdStage, FeatureKeyStage, ValueTypeStage, _FinalStage { + private String featureId; + + private String featureKey; + + private RulesengineEntitlementValueType valueType; + + private Optional usage = Optional.empty(); + + private Optional softLimit = Optional.empty(); + + private Optional monthReset = Optional.empty(); + + private Optional metricResetAt = Optional.empty(); + + private Optional metricPeriod = Optional.empty(); + + private Optional eventName = Optional.empty(); + + private Optional creditUsed = Optional.empty(); + + private Optional creditTotal = Optional.empty(); + + private Optional creditRemaining = Optional.empty(); + + private Optional creditId = Optional.empty(); + + private Optional allocation = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineFeatureEntitlement other) { + allocation(other.getAllocation()); + creditId(other.getCreditId()); + creditRemaining(other.getCreditRemaining()); + creditTotal(other.getCreditTotal()); + creditUsed(other.getCreditUsed()); + eventName(other.getEventName()); + featureId(other.getFeatureId()); + featureKey(other.getFeatureKey()); + metricPeriod(other.getMetricPeriod()); + metricResetAt(other.getMetricResetAt()); + monthReset(other.getMonthReset()); + softLimit(other.getSoftLimit()); + usage(other.getUsage()); + valueType(other.getValueType()); + return this; + } + + /** + *

The ID of the feature

+ *

The ID of the feature

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

The key of the flag associated with the feature

+ *

The key of the flag associated with the feature

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

If the company has a numeric entitlement for this feature, the current usage amount

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

If the company has a numeric entitlement for this feature, the current usage amount

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

For usage-based pricing, the soft limit for overage charges or the next tier boundary

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

For usage-based pricing, the soft limit for overage charges or the next tier boundary

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

For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle

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

For event-based feature entitlements that have a monthly period, whether that monthly reset is based on the calendar month or a billing cycle

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

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

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

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

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

For event-based feature entitlements, the period over which usage is tracked

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

For event-based feature entitlements, the period over which usage is tracked

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

If the feature is event-based, the name of the event tracked for usage

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

If the feature is event-based, the name of the event tracked for usage

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

If the company has a credit-based entitlement for this feature, the amount of credit used

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

If the company has a credit-based entitlement for this feature, the amount of credit used

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

If the company has a credit-based entitlement for this feature, the total credit amount

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

If the company has a credit-based entitlement for this feature, the total credit amount

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

If the company has a credit-based entitlement for this feature, the remaining credit amount

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

If the company has a credit-based entitlement for this feature, the remaining credit amount

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

If the company has a credit-based entitlement for this feature, the ID of the credit

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

If the company has a credit-based entitlement for this feature, the ID of the credit

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

If the company has a numeric entitlement for this feature, the allocated amount

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

If the company has a numeric entitlement for this feature, the allocated amount

+ */ + @java.lang.Override + @JsonSetter(value = "allocation", nulls = Nulls.SKIP) + public _FinalStage allocation(Optional allocation) { + this.allocation = allocation; + return this; + } + + @java.lang.Override + public RulesengineFeatureEntitlement build() { + return new RulesengineFeatureEntitlement( + allocation, + creditId, + creditRemaining, + creditTotal, + creditUsed, + eventName, + featureId, + featureKey, + metricPeriod, + metricResetAt, + monthReset, + softLimit, + usage, + valueType, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlementMetricPeriod.java b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlementMetricPeriod.java new file mode 100644 index 0000000..737e28e --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlementMetricPeriod.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RulesengineFeatureEntitlementMetricPeriod { + public static final RulesengineFeatureEntitlementMetricPeriod CURRENT_DAY = + new RulesengineFeatureEntitlementMetricPeriod(Value.CURRENT_DAY, "current_day"); + + public static final RulesengineFeatureEntitlementMetricPeriod ALL_TIME = + new RulesengineFeatureEntitlementMetricPeriod(Value.ALL_TIME, "all_time"); + + public static final RulesengineFeatureEntitlementMetricPeriod CURRENT_WEEK = + new RulesengineFeatureEntitlementMetricPeriod(Value.CURRENT_WEEK, "current_week"); + + public static final RulesengineFeatureEntitlementMetricPeriod CURRENT_MONTH = + new RulesengineFeatureEntitlementMetricPeriod(Value.CURRENT_MONTH, "current_month"); + + private final Value value; + + private final String string; + + RulesengineFeatureEntitlementMetricPeriod(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 RulesengineFeatureEntitlementMetricPeriod + && this.string.equals(((RulesengineFeatureEntitlementMetricPeriod) 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 RulesengineFeatureEntitlementMetricPeriod 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 RulesengineFeatureEntitlementMetricPeriod(Value.UNKNOWN, value); + } + } + + public enum Value { + ALL_TIME, + + CURRENT_DAY, + + CURRENT_MONTH, + + CURRENT_WEEK, + + UNKNOWN + } + + public interface Visitor { + T visitAllTime(); + + T visitCurrentDay(); + + T visitCurrentMonth(); + + T visitCurrentWeek(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlementMonthReset.java b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlementMonthReset.java new file mode 100644 index 0000000..5367968 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlementMonthReset.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 RulesengineFeatureEntitlementMonthReset { + public static final RulesengineFeatureEntitlementMonthReset FIRST_OF_MONTH = + new RulesengineFeatureEntitlementMonthReset(Value.FIRST_OF_MONTH, "first_of_month"); + + public static final RulesengineFeatureEntitlementMonthReset BILLING_CYCLE = + new RulesengineFeatureEntitlementMonthReset(Value.BILLING_CYCLE, "billing_cycle"); + + private final Value value; + + private final String string; + + RulesengineFeatureEntitlementMonthReset(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 RulesengineFeatureEntitlementMonthReset + && this.string.equals(((RulesengineFeatureEntitlementMonthReset) 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 RulesengineFeatureEntitlementMonthReset valueOf(String value) { + switch (value) { + case "first_of_month": + return FIRST_OF_MONTH; + case "billing_cycle": + return BILLING_CYCLE; + default: + return new RulesengineFeatureEntitlementMonthReset(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/types/RulesengineFlag.java b/src/main/java/com/schematic/api/types/RulesengineFlag.java new file mode 100644 index 0000000..2391f93 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineFlag.java @@ -0,0 +1,247 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineFlag.Builder.class) +public final class RulesengineFlag { + private final String accountId; + + private final boolean defaultValue; + + private final String environmentId; + + private final String id; + + private final String key; + + private final List rules; + + private final Map additionalProperties; + + private RulesengineFlag( + String accountId, + boolean defaultValue, + String environmentId, + String id, + String key, + List rules, + Map additionalProperties) { + this.accountId = accountId; + this.defaultValue = defaultValue; + this.environmentId = environmentId; + this.id = id; + this.key = key; + this.rules = rules; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("default_value") + public boolean getDefaultValue() { + return defaultValue; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("key") + public String getKey() { + return key; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineFlag && equalTo((RulesengineFlag) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineFlag other) { + return accountId.equals(other.accountId) + && defaultValue == other.defaultValue + && environmentId.equals(other.environmentId) + && id.equals(other.id) + && key.equals(other.key) + && rules.equals(other.rules); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.defaultValue, this.environmentId, this.id, this.key, this.rules); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + DefaultValueStage accountId(@NotNull String accountId); + + Builder from(RulesengineFlag other); + } + + public interface DefaultValueStage { + EnvironmentIdStage defaultValue(boolean defaultValue); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + KeyStage id(@NotNull String id); + } + + public interface KeyStage { + _FinalStage key(@NotNull String key); + } + + public interface _FinalStage { + RulesengineFlag build(); + + _FinalStage rules(List rules); + + _FinalStage addRules(RulesengineRule rules); + + _FinalStage addAllRules(List rules); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, DefaultValueStage, EnvironmentIdStage, IdStage, KeyStage, _FinalStage { + private String accountId; + + private boolean defaultValue; + + private String environmentId; + + private String id; + + private String key; + + private List rules = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineFlag other) { + accountId(other.getAccountId()); + defaultValue(other.getDefaultValue()); + environmentId(other.getEnvironmentId()); + id(other.getId()); + key(other.getKey()); + rules(other.getRules()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public DefaultValueStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("default_value") + public EnvironmentIdStage defaultValue(boolean defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public KeyStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("key") + public _FinalStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(RulesengineRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public RulesengineFlag build() { + return new RulesengineFlag(accountId, defaultValue, environmentId, id, key, rules, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineRule.java b/src/main/java/com/schematic/api/types/RulesengineRule.java new file mode 100644 index 0000000..1c61ec1 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineRule.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineRule.Builder.class) +public final class RulesengineRule { + private final String accountId; + + private final List conditionGroups; + + private final List conditions; + + private final String environmentId; + + private final Optional flagId; + + private final String id; + + private final String name; + + private final int priority; + + private final RulesengineRuleRuleType ruleType; + + private final boolean value; + + private final Map additionalProperties; + + private RulesengineRule( + String accountId, + List conditionGroups, + List conditions, + String environmentId, + Optional flagId, + String id, + String name, + int priority, + RulesengineRuleRuleType ruleType, + boolean value, + Map additionalProperties) { + this.accountId = accountId; + this.conditionGroups = conditionGroups; + this.conditions = conditions; + this.environmentId = environmentId; + this.flagId = flagId; + this.id = id; + this.name = name; + this.priority = priority; + this.ruleType = ruleType; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("condition_groups") + public List getConditionGroups() { + return conditionGroups; + } + + @JsonProperty("conditions") + public List getConditions() { + return conditions; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("flag_id") + public Optional getFlagId() { + return flagId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("priority") + public int getPriority() { + return priority; + } + + @JsonProperty("rule_type") + public RulesengineRuleRuleType getRuleType() { + return ruleType; + } + + @JsonProperty("value") + public boolean getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineRule && equalTo((RulesengineRule) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineRule other) { + return accountId.equals(other.accountId) + && conditionGroups.equals(other.conditionGroups) + && conditions.equals(other.conditions) + && environmentId.equals(other.environmentId) + && flagId.equals(other.flagId) + && id.equals(other.id) + && name.equals(other.name) + && priority == other.priority + && ruleType.equals(other.ruleType) + && value == other.value; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.conditionGroups, + this.conditions, + this.environmentId, + this.flagId, + this.id, + this.name, + this.priority, + this.ruleType, + this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + EnvironmentIdStage accountId(@NotNull String accountId); + + Builder from(RulesengineRule other); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + NameStage id(@NotNull String id); + } + + public interface NameStage { + PriorityStage name(@NotNull String name); + } + + public interface PriorityStage { + RuleTypeStage priority(int priority); + } + + public interface RuleTypeStage { + ValueStage ruleType(@NotNull RulesengineRuleRuleType ruleType); + } + + public interface ValueStage { + _FinalStage value(boolean value); + } + + public interface _FinalStage { + RulesengineRule build(); + + _FinalStage conditionGroups(List conditionGroups); + + _FinalStage addConditionGroups(RulesengineConditionGroup conditionGroups); + + _FinalStage addAllConditionGroups(List conditionGroups); + + _FinalStage conditions(List conditions); + + _FinalStage addConditions(RulesengineCondition conditions); + + _FinalStage addAllConditions(List conditions); + + _FinalStage flagId(Optional flagId); + + _FinalStage flagId(String flagId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + EnvironmentIdStage, + IdStage, + NameStage, + PriorityStage, + RuleTypeStage, + ValueStage, + _FinalStage { + private String accountId; + + private String environmentId; + + private String id; + + private String name; + + private int priority; + + private RulesengineRuleRuleType ruleType; + + private boolean value; + + private Optional flagId = Optional.empty(); + + private List conditions = new ArrayList<>(); + + private List conditionGroups = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineRule other) { + accountId(other.getAccountId()); + conditionGroups(other.getConditionGroups()); + conditions(other.getConditions()); + environmentId(other.getEnvironmentId()); + flagId(other.getFlagId()); + id(other.getId()); + name(other.getName()); + priority(other.getPriority()); + ruleType(other.getRuleType()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public EnvironmentIdStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public PriorityStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("priority") + public RuleTypeStage priority(int priority) { + this.priority = priority; + return this; + } + + @java.lang.Override + @JsonSetter("rule_type") + public ValueStage ruleType(@NotNull RulesengineRuleRuleType ruleType) { + this.ruleType = Objects.requireNonNull(ruleType, "ruleType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(boolean value) { + this.value = value; + return this; + } + + @java.lang.Override + public _FinalStage flagId(String flagId) { + this.flagId = Optional.ofNullable(flagId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flag_id", nulls = Nulls.SKIP) + public _FinalStage flagId(Optional flagId) { + this.flagId = flagId; + return this; + } + + @java.lang.Override + public _FinalStage addAllConditions(List conditions) { + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + @java.lang.Override + public _FinalStage addConditions(RulesengineCondition conditions) { + this.conditions.add(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(List conditions) { + this.conditions.clear(); + if (conditions != null) { + this.conditions.addAll(conditions); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllConditionGroups(List conditionGroups) { + if (conditionGroups != null) { + this.conditionGroups.addAll(conditionGroups); + } + return this; + } + + @java.lang.Override + public _FinalStage addConditionGroups(RulesengineConditionGroup conditionGroups) { + this.conditionGroups.add(conditionGroups); + return this; + } + + @java.lang.Override + @JsonSetter(value = "condition_groups", nulls = Nulls.SKIP) + public _FinalStage conditionGroups(List conditionGroups) { + this.conditionGroups.clear(); + if (conditionGroups != null) { + this.conditionGroups.addAll(conditionGroups); + } + return this; + } + + @java.lang.Override + public RulesengineRule build() { + return new RulesengineRule( + accountId, + conditionGroups, + conditions, + environmentId, + flagId, + id, + name, + priority, + ruleType, + value, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineRuleRuleType.java b/src/main/java/com/schematic/api/types/RulesengineRuleRuleType.java new file mode 100644 index 0000000..b493e74 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineRuleRuleType.java @@ -0,0 +1,139 @@ +/** + * 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 RulesengineRuleRuleType { + public static final RulesengineRuleRuleType GLOBAL_OVERRIDE = + new RulesengineRuleRuleType(Value.GLOBAL_OVERRIDE, "global_override"); + + public static final RulesengineRuleRuleType COMPANY_OVERRIDE = + new RulesengineRuleRuleType(Value.COMPANY_OVERRIDE, "company_override"); + + public static final RulesengineRuleRuleType COMPANY_OVERRIDE_USAGE_EXCEEDED = + new RulesengineRuleRuleType(Value.COMPANY_OVERRIDE_USAGE_EXCEEDED, "company_override_usage_exceeded"); + + public static final RulesengineRuleRuleType PLAN_ENTITLEMENT_USAGE_EXCEEDED = + new RulesengineRuleRuleType(Value.PLAN_ENTITLEMENT_USAGE_EXCEEDED, "plan_entitlement_usage_exceeded"); + + public static final RulesengineRuleRuleType STANDARD = new RulesengineRuleRuleType(Value.STANDARD, "standard"); + + public static final RulesengineRuleRuleType DEFAULT = new RulesengineRuleRuleType(Value.DEFAULT, "default"); + + public static final RulesengineRuleRuleType PLAN_ENTITLEMENT = + new RulesengineRuleRuleType(Value.PLAN_ENTITLEMENT, "plan_entitlement"); + + private final Value value; + + private final String string; + + RulesengineRuleRuleType(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 RulesengineRuleRuleType + && this.string.equals(((RulesengineRuleRuleType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GLOBAL_OVERRIDE: + return visitor.visitGlobalOverride(); + case COMPANY_OVERRIDE: + return visitor.visitCompanyOverride(); + case COMPANY_OVERRIDE_USAGE_EXCEEDED: + return visitor.visitCompanyOverrideUsageExceeded(); + case PLAN_ENTITLEMENT_USAGE_EXCEEDED: + return visitor.visitPlanEntitlementUsageExceeded(); + case STANDARD: + return visitor.visitStandard(); + case DEFAULT: + return visitor.visitDefault(); + case PLAN_ENTITLEMENT: + return visitor.visitPlanEntitlement(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RulesengineRuleRuleType valueOf(String value) { + switch (value) { + case "global_override": + return GLOBAL_OVERRIDE; + case "company_override": + return COMPANY_OVERRIDE; + case "company_override_usage_exceeded": + return COMPANY_OVERRIDE_USAGE_EXCEEDED; + case "plan_entitlement_usage_exceeded": + return PLAN_ENTITLEMENT_USAGE_EXCEEDED; + case "standard": + return STANDARD; + case "default": + return DEFAULT; + case "plan_entitlement": + return PLAN_ENTITLEMENT; + default: + return new RulesengineRuleRuleType(Value.UNKNOWN, value); + } + } + + public enum Value { + DEFAULT, + + GLOBAL_OVERRIDE, + + COMPANY_OVERRIDE, + + COMPANY_OVERRIDE_USAGE_EXCEEDED, + + PLAN_ENTITLEMENT, + + PLAN_ENTITLEMENT_USAGE_EXCEEDED, + + STANDARD, + + UNKNOWN + } + + public interface Visitor { + T visitDefault(); + + T visitGlobalOverride(); + + T visitCompanyOverride(); + + T visitCompanyOverrideUsageExceeded(); + + T visitPlanEntitlement(); + + T visitPlanEntitlementUsageExceeded(); + + T visitStandard(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineSubscription.java b/src/main/java/com/schematic/api/types/RulesengineSubscription.java new file mode 100644 index 0000000..20ee719 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineSubscription.java @@ -0,0 +1,148 @@ +/** + * 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.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineSubscription.Builder.class) +public final class RulesengineSubscription { + private final String id; + + private final OffsetDateTime periodEnd; + + private final OffsetDateTime periodStart; + + private final Map additionalProperties; + + private RulesengineSubscription( + String id, OffsetDateTime periodEnd, OffsetDateTime periodStart, Map additionalProperties) { + this.id = id; + this.periodEnd = periodEnd; + this.periodStart = periodStart; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("period_end") + public OffsetDateTime getPeriodEnd() { + return periodEnd; + } + + @JsonProperty("period_start") + public OffsetDateTime getPeriodStart() { + return periodStart; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineSubscription && equalTo((RulesengineSubscription) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineSubscription other) { + return id.equals(other.id) && periodEnd.equals(other.periodEnd) && periodStart.equals(other.periodStart); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.periodEnd, this.periodStart); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + PeriodEndStage id(@NotNull String id); + + Builder from(RulesengineSubscription other); + } + + public interface PeriodEndStage { + PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd); + } + + public interface PeriodStartStage { + _FinalStage periodStart(@NotNull OffsetDateTime periodStart); + } + + public interface _FinalStage { + RulesengineSubscription build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, PeriodEndStage, PeriodStartStage, _FinalStage { + private String id; + + private OffsetDateTime periodEnd; + + private OffsetDateTime periodStart; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineSubscription other) { + id(other.getId()); + periodEnd(other.getPeriodEnd()); + periodStart(other.getPeriodStart()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public PeriodEndStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("period_end") + public PeriodStartStage periodEnd(@NotNull OffsetDateTime periodEnd) { + this.periodEnd = Objects.requireNonNull(periodEnd, "periodEnd must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("period_start") + public _FinalStage periodStart(@NotNull OffsetDateTime periodStart) { + this.periodStart = Objects.requireNonNull(periodStart, "periodStart must not be null"); + return this; + } + + @java.lang.Override + public RulesengineSubscription build() { + return new RulesengineSubscription(id, periodEnd, periodStart, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineTrait.java b/src/main/java/com/schematic/api/types/RulesengineTrait.java new file mode 100644 index 0000000..a4f4a60 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineTrait.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineTrait.Builder.class) +public final class RulesengineTrait { + private final Optional traitDefinition; + + private final String value; + + private final Map additionalProperties; + + private RulesengineTrait( + Optional traitDefinition, + String value, + Map additionalProperties) { + this.traitDefinition = traitDefinition; + this.value = value; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("trait_definition") + public Optional getTraitDefinition() { + return traitDefinition; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineTrait && equalTo((RulesengineTrait) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineTrait other) { + return traitDefinition.equals(other.traitDefinition) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.traitDefinition, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ValueStage builder() { + return new Builder(); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + + Builder from(RulesengineTrait other); + } + + public interface _FinalStage { + RulesengineTrait build(); + + _FinalStage traitDefinition(Optional traitDefinition); + + _FinalStage traitDefinition(RulesengineTraitDefinition traitDefinition); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ValueStage, _FinalStage { + private String value; + + private Optional traitDefinition = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineTrait other) { + traitDefinition(other.getTraitDefinition()); + value(other.getValue()); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage traitDefinition(RulesengineTraitDefinition traitDefinition) { + this.traitDefinition = Optional.ofNullable(traitDefinition); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trait_definition", nulls = Nulls.SKIP) + public _FinalStage traitDefinition(Optional traitDefinition) { + this.traitDefinition = traitDefinition; + return this; + } + + @java.lang.Override + public RulesengineTrait build() { + return new RulesengineTrait(traitDefinition, value, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java b/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java new file mode 100644 index 0000000..f0f01f7 --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java @@ -0,0 +1,152 @@ +/** + * 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 = RulesengineTraitDefinition.Builder.class) +public final class RulesengineTraitDefinition { + private final RulesengineTraitDefinitionComparableType comparableType; + + private final RulesengineEntityType entityType; + + private final String id; + + private final Map additionalProperties; + + private RulesengineTraitDefinition( + RulesengineTraitDefinitionComparableType comparableType, + RulesengineEntityType entityType, + String id, + Map additionalProperties) { + this.comparableType = comparableType; + this.entityType = entityType; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("comparable_type") + public RulesengineTraitDefinitionComparableType getComparableType() { + return comparableType; + } + + @JsonProperty("entity_type") + public RulesengineEntityType getEntityType() { + return entityType; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineTraitDefinition && equalTo((RulesengineTraitDefinition) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineTraitDefinition other) { + return comparableType.equals(other.comparableType) + && entityType.equals(other.entityType) + && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.comparableType, this.entityType, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ComparableTypeStage builder() { + return new Builder(); + } + + public interface ComparableTypeStage { + EntityTypeStage comparableType(@NotNull RulesengineTraitDefinitionComparableType comparableType); + + Builder from(RulesengineTraitDefinition other); + } + + public interface EntityTypeStage { + IdStage entityType(@NotNull RulesengineEntityType entityType); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + RulesengineTraitDefinition build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ComparableTypeStage, EntityTypeStage, IdStage, _FinalStage { + private RulesengineTraitDefinitionComparableType comparableType; + + private RulesengineEntityType entityType; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineTraitDefinition other) { + comparableType(other.getComparableType()); + entityType(other.getEntityType()); + id(other.getId()); + return this; + } + + @java.lang.Override + @JsonSetter("comparable_type") + public EntityTypeStage comparableType(@NotNull RulesengineTraitDefinitionComparableType comparableType) { + this.comparableType = Objects.requireNonNull(comparableType, "comparableType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("entity_type") + public IdStage entityType(@NotNull RulesengineEntityType entityType) { + this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public RulesengineTraitDefinition build() { + return new RulesengineTraitDefinition(comparableType, entityType, id, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineTraitDefinitionComparableType.java b/src/main/java/com/schematic/api/types/RulesengineTraitDefinitionComparableType.java new file mode 100644 index 0000000..08eaa2d --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineTraitDefinitionComparableType.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RulesengineTraitDefinitionComparableType { + public static final RulesengineTraitDefinitionComparableType BOOL = + new RulesengineTraitDefinitionComparableType(Value.BOOL, "bool"); + + public static final RulesengineTraitDefinitionComparableType STRING = + new RulesengineTraitDefinitionComparableType(Value.STRING, "string"); + + public static final RulesengineTraitDefinitionComparableType INT = + new RulesengineTraitDefinitionComparableType(Value.INT, "int"); + + public static final RulesengineTraitDefinitionComparableType DATE = + new RulesengineTraitDefinitionComparableType(Value.DATE, "date"); + + private final Value value; + + private final String string; + + RulesengineTraitDefinitionComparableType(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 RulesengineTraitDefinitionComparableType + && this.string.equals(((RulesengineTraitDefinitionComparableType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BOOL: + return visitor.visitBool(); + case STRING: + return visitor.visitString(); + case INT: + return visitor.visitInt(); + case DATE: + return visitor.visitDate(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RulesengineTraitDefinitionComparableType valueOf(String value) { + switch (value) { + case "bool": + return BOOL; + case "string": + return STRING; + case "int": + return INT; + case "date": + return DATE; + default: + return new RulesengineTraitDefinitionComparableType(Value.UNKNOWN, value); + } + } + + public enum Value { + BOOL, + + DATE, + + INT, + + STRING, + + UNKNOWN + } + + public interface Visitor { + T visitBool(); + + T visitDate(); + + T visitInt(); + + T visitString(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/RulesengineUser.java b/src/main/java/com/schematic/api/types/RulesengineUser.java new file mode 100644 index 0000000..161e3ef --- /dev/null +++ b/src/main/java/com/schematic/api/types/RulesengineUser.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RulesengineUser.Builder.class) +public final class RulesengineUser { + private final String accountId; + + private final String environmentId; + + private final String id; + + private final Map keys; + + private final List rules; + + private final List traits; + + private final Map additionalProperties; + + private RulesengineUser( + String accountId, + String environmentId, + String id, + Map keys, + List rules, + List traits, + Map additionalProperties) { + this.accountId = accountId; + this.environmentId = environmentId; + this.id = id; + this.keys = keys; + this.rules = rules; + this.traits = traits; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("keys") + public Map getKeys() { + return keys; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("traits") + public List getTraits() { + return traits; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesengineUser && equalTo((RulesengineUser) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RulesengineUser other) { + return accountId.equals(other.accountId) + && environmentId.equals(other.environmentId) + && id.equals(other.id) + && keys.equals(other.keys) + && rules.equals(other.rules) + && traits.equals(other.traits); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accountId, this.environmentId, this.id, this.keys, this.rules, this.traits); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + EnvironmentIdStage accountId(@NotNull String accountId); + + Builder from(RulesengineUser other); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + RulesengineUser build(); + + _FinalStage keys(Map keys); + + _FinalStage putAllKeys(Map keys); + + _FinalStage keys(String key, String value); + + _FinalStage rules(List rules); + + _FinalStage addRules(RulesengineRule rules); + + _FinalStage addAllRules(List rules); + + _FinalStage traits(List traits); + + _FinalStage addTraits(RulesengineTrait traits); + + _FinalStage addAllTraits(List traits); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccountIdStage, EnvironmentIdStage, IdStage, _FinalStage { + private String accountId; + + private String environmentId; + + private String id; + + private List traits = new ArrayList<>(); + + private List rules = new ArrayList<>(); + + private Map keys = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RulesengineUser other) { + accountId(other.getAccountId()); + environmentId(other.getEnvironmentId()); + id(other.getId()); + keys(other.getKeys()); + rules(other.getRules()); + traits(other.getTraits()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public EnvironmentIdStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public IdStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllTraits(List traits) { + if (traits != null) { + this.traits.addAll(traits); + } + return this; + } + + @java.lang.Override + public _FinalStage addTraits(RulesengineTrait traits) { + this.traits.add(traits); + return this; + } + + @java.lang.Override + @JsonSetter(value = "traits", nulls = Nulls.SKIP) + public _FinalStage traits(List traits) { + this.traits.clear(); + if (traits != null) { + this.traits.addAll(traits); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllRules(List rules) { + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage addRules(RulesengineRule rules) { + this.rules.add(rules); + return this; + } + + @java.lang.Override + @JsonSetter(value = "rules", nulls = Nulls.SKIP) + public _FinalStage rules(List rules) { + this.rules.clear(); + if (rules != null) { + this.rules.addAll(rules); + } + return this; + } + + @java.lang.Override + public _FinalStage keys(String key, String value) { + this.keys.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllKeys(Map keys) { + if (keys != null) { + this.keys.putAll(keys); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "keys", nulls = Nulls.SKIP) + public _FinalStage keys(Map keys) { + this.keys.clear(); + if (keys != null) { + this.keys.putAll(keys); + } + return this; + } + + @java.lang.Override + public RulesengineUser build() { + return new RulesengineUser(accountId, environmentId, id, keys, rules, traits, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/ScheduledDowngradeConfigBehavior.java b/src/main/java/com/schematic/api/types/ScheduledDowngradeConfigBehavior.java new file mode 100644 index 0000000..b175972 --- /dev/null +++ b/src/main/java/com/schematic/api/types/ScheduledDowngradeConfigBehavior.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 ScheduledDowngradeConfigBehavior { + public static final ScheduledDowngradeConfigBehavior END_OF_BILLING_PERIOD = + new ScheduledDowngradeConfigBehavior(Value.END_OF_BILLING_PERIOD, "end_of_billing_period"); + + public static final ScheduledDowngradeConfigBehavior NONE = + new ScheduledDowngradeConfigBehavior(Value.NONE, "none"); + + private final Value value; + + private final String string; + + ScheduledDowngradeConfigBehavior(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 ScheduledDowngradeConfigBehavior + && this.string.equals(((ScheduledDowngradeConfigBehavior) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case END_OF_BILLING_PERIOD: + return visitor.visitEndOfBillingPeriod(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ScheduledDowngradeConfigBehavior valueOf(String value) { + switch (value) { + case "end_of_billing_period": + return END_OF_BILLING_PERIOD; + case "none": + return NONE; + default: + return new ScheduledDowngradeConfigBehavior(Value.UNKNOWN, value); + } + } + + public enum Value { + END_OF_BILLING_PERIOD, + + NONE, + + UNKNOWN + } + + public interface Visitor { + T visitEndOfBillingPeriod(); + + T visitNone(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.java b/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.java new file mode 100644 index 0000000..3799cd7 --- /dev/null +++ b/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.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.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 = SkippedEntitlementErrorResponseData.Builder.class) +public final class SkippedEntitlementErrorResponseData { + private final String message; + + private final Map additionalProperties; + + private SkippedEntitlementErrorResponseData(String message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SkippedEntitlementErrorResponseData + && equalTo((SkippedEntitlementErrorResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SkippedEntitlementErrorResponseData other) { + return message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + _FinalStage message(@NotNull String message); + + Builder from(SkippedEntitlementErrorResponseData other); + } + + public interface _FinalStage { + SkippedEntitlementErrorResponseData build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private String message; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SkippedEntitlementErrorResponseData other) { + message(other.getMessage()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public SkippedEntitlementErrorResponseData build() { + return new SkippedEntitlementErrorResponseData(message, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java new file mode 100644 index 0000000..63491cd --- /dev/null +++ b/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SkippedEntitlementResponseData.Builder.class) +public final class SkippedEntitlementResponseData { + private final String entitlementId; + + private final List errors; + + private final String featureId; + + private final String featureName; + + private final Map additionalProperties; + + private SkippedEntitlementResponseData( + String entitlementId, + List errors, + String featureId, + String featureName, + Map additionalProperties) { + this.entitlementId = entitlementId; + this.errors = errors; + this.featureId = featureId; + this.featureName = featureName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("entitlement_id") + public String getEntitlementId() { + return entitlementId; + } + + @JsonProperty("errors") + public List getErrors() { + return errors; + } + + @JsonProperty("feature_id") + public String getFeatureId() { + return featureId; + } + + @JsonProperty("feature_name") + public String getFeatureName() { + return featureName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SkippedEntitlementResponseData && equalTo((SkippedEntitlementResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SkippedEntitlementResponseData other) { + return entitlementId.equals(other.entitlementId) + && errors.equals(other.errors) + && featureId.equals(other.featureId) + && featureName.equals(other.featureName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.entitlementId, this.errors, this.featureId, this.featureName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EntitlementIdStage builder() { + return new Builder(); + } + + public interface EntitlementIdStage { + FeatureIdStage entitlementId(@NotNull String entitlementId); + + Builder from(SkippedEntitlementResponseData other); + } + + public interface FeatureIdStage { + FeatureNameStage featureId(@NotNull String featureId); + } + + public interface FeatureNameStage { + _FinalStage featureName(@NotNull String featureName); + } + + public interface _FinalStage { + SkippedEntitlementResponseData build(); + + _FinalStage errors(List errors); + + _FinalStage addErrors(SkippedEntitlementErrorResponseData errors); + + _FinalStage addAllErrors(List errors); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EntitlementIdStage, FeatureIdStage, FeatureNameStage, _FinalStage { + private String entitlementId; + + private String featureId; + + private String featureName; + + private List errors = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SkippedEntitlementResponseData other) { + entitlementId(other.getEntitlementId()); + errors(other.getErrors()); + featureId(other.getFeatureId()); + featureName(other.getFeatureName()); + return this; + } + + @java.lang.Override + @JsonSetter("entitlement_id") + public FeatureIdStage entitlementId(@NotNull String entitlementId) { + this.entitlementId = Objects.requireNonNull(entitlementId, "entitlementId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_id") + public FeatureNameStage featureId(@NotNull String featureId) { + this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("feature_name") + public _FinalStage featureName(@NotNull String featureName) { + this.featureName = Objects.requireNonNull(featureName, "featureName must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllErrors(List errors) { + if (errors != null) { + this.errors.addAll(errors); + } + return this; + } + + @java.lang.Override + public _FinalStage addErrors(SkippedEntitlementErrorResponseData errors) { + this.errors.add(errors); + return this; + } + + @java.lang.Override + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public _FinalStage errors(List errors) { + this.errors.clear(); + if (errors != null) { + this.errors.addAll(errors); + } + return this; + } + + @java.lang.Override + public SkippedEntitlementResponseData build() { + return new SkippedEntitlementResponseData( + entitlementId, errors, featureId, featureName, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsRequestDir.java b/src/main/java/com/schematic/api/types/SortDirection.java similarity index 67% rename from src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsRequestDir.java rename to src/main/java/com/schematic/api/types/SortDirection.java index def0181..c9d8b25 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsRequestDir.java +++ b/src/main/java/com/schematic/api/types/SortDirection.java @@ -1,21 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListCompanyGrantsRequestDir { - public static final ListCompanyGrantsRequestDir ASC = new ListCompanyGrantsRequestDir(Value.ASC, "asc"); +public final class SortDirection { + public static final SortDirection ASC = new SortDirection(Value.ASC, "asc"); - public static final ListCompanyGrantsRequestDir DESC = new ListCompanyGrantsRequestDir(Value.DESC, "desc"); + public static final SortDirection DESC = new SortDirection(Value.DESC, "desc"); private final Value value; private final String string; - ListCompanyGrantsRequestDir(Value value, String string) { + SortDirection(Value value, String string) { this.value = value; this.string = string; } @@ -33,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof ListCompanyGrantsRequestDir - && this.string.equals(((ListCompanyGrantsRequestDir) other).string)); + || (other instanceof SortDirection && this.string.equals(((SortDirection) other).string)); } @java.lang.Override @@ -55,14 +54,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListCompanyGrantsRequestDir valueOf(String value) { + public static SortDirection valueOf(String value) { switch (value) { case "asc": return ASC; case "desc": return DESC; default: - return new ListCompanyGrantsRequestDir(Value.UNKNOWN, value); + return new SortDirection(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/SubscriptionStatus.java b/src/main/java/com/schematic/api/types/SubscriptionStatus.java new file mode 100644 index 0000000..27d1d07 --- /dev/null +++ b/src/main/java/com/schematic/api/types/SubscriptionStatus.java @@ -0,0 +1,154 @@ +/** + * 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 SubscriptionStatus { + public static final SubscriptionStatus PAST_DUE = new SubscriptionStatus(Value.PAST_DUE, "past_due"); + + public static final SubscriptionStatus CANCELED = new SubscriptionStatus(Value.CANCELED, "canceled"); + + public static final SubscriptionStatus INCOMPLETE = new SubscriptionStatus(Value.INCOMPLETE, "incomplete"); + + public static final SubscriptionStatus PAUSED = new SubscriptionStatus(Value.PAUSED, "paused"); + + public static final SubscriptionStatus EXPIRED = new SubscriptionStatus(Value.EXPIRED, "expired"); + + public static final SubscriptionStatus INCOMPLETE_EXPIRED = + new SubscriptionStatus(Value.INCOMPLETE_EXPIRED, "incomplete_expired"); + + public static final SubscriptionStatus ACTIVE = new SubscriptionStatus(Value.ACTIVE, "active"); + + public static final SubscriptionStatus UNPAID = new SubscriptionStatus(Value.UNPAID, "unpaid"); + + public static final SubscriptionStatus TRIALING = new SubscriptionStatus(Value.TRIALING, "trialing"); + + private final Value value; + + private final String string; + + SubscriptionStatus(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 SubscriptionStatus && this.string.equals(((SubscriptionStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAST_DUE: + return visitor.visitPastDue(); + case CANCELED: + return visitor.visitCanceled(); + case INCOMPLETE: + return visitor.visitIncomplete(); + case PAUSED: + return visitor.visitPaused(); + case EXPIRED: + return visitor.visitExpired(); + case INCOMPLETE_EXPIRED: + return visitor.visitIncompleteExpired(); + case ACTIVE: + return visitor.visitActive(); + case UNPAID: + return visitor.visitUnpaid(); + case TRIALING: + return visitor.visitTrialing(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SubscriptionStatus valueOf(String value) { + switch (value) { + case "past_due": + return PAST_DUE; + case "canceled": + return CANCELED; + case "incomplete": + return INCOMPLETE; + case "paused": + return PAUSED; + case "expired": + return EXPIRED; + case "incomplete_expired": + return INCOMPLETE_EXPIRED; + case "active": + return ACTIVE; + case "unpaid": + return UNPAID; + case "trialing": + return TRIALING; + default: + return new SubscriptionStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + CANCELED, + + EXPIRED, + + INCOMPLETE, + + INCOMPLETE_EXPIRED, + + PAST_DUE, + + PAUSED, + + TRIALING, + + UNPAID, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitCanceled(); + + T visitExpired(); + + T visitIncomplete(); + + T visitIncompleteExpired(); + + T visitPastDue(); + + T visitPaused(); + + T visitTrialing(); + + T visitUnpaid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java b/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java index 8f7ce4b..1a21731 100644 --- a/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java +++ b/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java @@ -32,7 +32,7 @@ public final class SubscriptionTraitUpdate { private final String traitName; - private final String traitType; + private final TraitType traitType; private final String value; @@ -44,7 +44,7 @@ private SubscriptionTraitUpdate( String reason, String traitId, String traitName, - String traitType, + TraitType traitType, String value, Map additionalProperties) { this.featureId = featureId; @@ -83,7 +83,7 @@ public String getTraitName() { } @JsonProperty("trait_type") - public String getTraitType() { + public TraitType getTraitType() { return traitType; } @@ -147,7 +147,7 @@ public interface TraitNameStage { } public interface TraitTypeStage { - ValueStage traitType(@NotNull String traitType); + ValueStage traitType(@NotNull TraitType traitType); } public interface ValueStage { @@ -181,7 +181,7 @@ public static final class Builder private String traitName; - private String traitType; + private TraitType traitType; private String value; @@ -234,7 +234,7 @@ public TraitTypeStage traitName(@NotNull String traitName) { @java.lang.Override @JsonSetter("trait_type") - public ValueStage traitType(@NotNull String traitType) { + public ValueStage traitType(@NotNull TraitType traitType) { this.traitType = Objects.requireNonNull(traitType, "traitType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/SubscriptionType.java b/src/main/java/com/schematic/api/types/SubscriptionType.java new file mode 100644 index 0000000..ebba3be --- /dev/null +++ b/src/main/java/com/schematic/api/types/SubscriptionType.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 SubscriptionType { + public static final SubscriptionType TRIAL = new SubscriptionType(Value.TRIAL, "trial"); + + public static final SubscriptionType FREE = new SubscriptionType(Value.FREE, "free"); + + public static final SubscriptionType ONE_TIME = new SubscriptionType(Value.ONE_TIME, "one_time"); + + public static final SubscriptionType PAID = new SubscriptionType(Value.PAID, "paid"); + + private final Value value; + + private final String string; + + SubscriptionType(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 SubscriptionType && this.string.equals(((SubscriptionType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TRIAL: + return visitor.visitTrial(); + case FREE: + return visitor.visitFree(); + case ONE_TIME: + return visitor.visitOneTime(); + case PAID: + return visitor.visitPaid(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SubscriptionType valueOf(String value) { + switch (value) { + case "trial": + return TRIAL; + case "free": + return FREE; + case "one_time": + return ONE_TIME; + case "paid": + return PAID; + default: + return new SubscriptionType(Value.UNKNOWN, value); + } + } + + public enum Value { + FREE, + + ONE_TIME, + + PAID, + + TRIAL, + + UNKNOWN + } + + public interface Visitor { + T visitFree(); + + T visitOneTime(); + + T visitPaid(); + + T visitTrial(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerRequestPeriod.java b/src/main/java/com/schematic/api/types/TimeSeriesGranularity.java similarity index 56% rename from src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerRequestPeriod.java rename to src/main/java/com/schematic/api/types/TimeSeriesGranularity.java index b430c98..4ff11e3 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerRequestPeriod.java +++ b/src/main/java/com/schematic/api/types/TimeSeriesGranularity.java @@ -1,29 +1,25 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.credits.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class GetEnrichedCreditLedgerRequestPeriod { - public static final GetEnrichedCreditLedgerRequestPeriod RAW = - new GetEnrichedCreditLedgerRequestPeriod(Value.RAW, "raw"); +public final class TimeSeriesGranularity { + public static final TimeSeriesGranularity HOURLY = new TimeSeriesGranularity(Value.HOURLY, "hourly"); - public static final GetEnrichedCreditLedgerRequestPeriod MONTHLY = - new GetEnrichedCreditLedgerRequestPeriod(Value.MONTHLY, "monthly"); + public static final TimeSeriesGranularity MONTHLY = new TimeSeriesGranularity(Value.MONTHLY, "monthly"); - public static final GetEnrichedCreditLedgerRequestPeriod DAILY = - new GetEnrichedCreditLedgerRequestPeriod(Value.DAILY, "daily"); + public static final TimeSeriesGranularity DAILY = new TimeSeriesGranularity(Value.DAILY, "daily"); - public static final GetEnrichedCreditLedgerRequestPeriod WEEKLY = - new GetEnrichedCreditLedgerRequestPeriod(Value.WEEKLY, "weekly"); + public static final TimeSeriesGranularity WEEKLY = new TimeSeriesGranularity(Value.WEEKLY, "weekly"); private final Value value; private final String string; - GetEnrichedCreditLedgerRequestPeriod(Value value, String string) { + TimeSeriesGranularity(Value value, String string) { this.value = value; this.string = string; } @@ -41,8 +37,8 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof GetEnrichedCreditLedgerRequestPeriod - && this.string.equals(((GetEnrichedCreditLedgerRequestPeriod) other).string)); + || (other instanceof TimeSeriesGranularity + && this.string.equals(((TimeSeriesGranularity) other).string)); } @java.lang.Override @@ -52,8 +48,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { - case RAW: - return visitor.visitRaw(); + case HOURLY: + return visitor.visitHourly(); case MONTHLY: return visitor.visitMonthly(); case DAILY: @@ -67,10 +63,10 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static GetEnrichedCreditLedgerRequestPeriod valueOf(String value) { + public static TimeSeriesGranularity valueOf(String value) { switch (value) { - case "raw": - return RAW; + case "hourly": + return HOURLY; case "monthly": return MONTHLY; case "daily": @@ -78,18 +74,18 @@ public static GetEnrichedCreditLedgerRequestPeriod valueOf(String value) { case "weekly": return WEEKLY; default: - return new GetEnrichedCreditLedgerRequestPeriod(Value.UNKNOWN, value); + return new TimeSeriesGranularity(Value.UNKNOWN, value); } } public enum Value { DAILY, - WEEKLY, + HOURLY, MONTHLY, - RAW, + WEEKLY, UNKNOWN } @@ -97,11 +93,11 @@ public enum Value { public interface Visitor { T visitDaily(); - T visitWeekly(); + T visitHourly(); T visitMonthly(); - T visitRaw(); + T visitWeekly(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/schematic/api/types/TraitDefinition.java b/src/main/java/com/schematic/api/types/TraitDefinition.java index bfeaf2a..90e1a47 100644 --- a/src/main/java/com/schematic/api/types/TraitDefinition.java +++ b/src/main/java/com/schematic/api/types/TraitDefinition.java @@ -19,16 +19,19 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = TraitDefinition.Builder.class) public final class TraitDefinition { - private final String comparableType; + private final TraitDefinitionComparableType comparableType; - private final String entityType; + private final EntityType entityType; private final String id; private final Map additionalProperties; private TraitDefinition( - String comparableType, String entityType, String id, Map additionalProperties) { + TraitDefinitionComparableType comparableType, + EntityType entityType, + String id, + Map additionalProperties) { this.comparableType = comparableType; this.entityType = entityType; this.id = id; @@ -36,12 +39,12 @@ private TraitDefinition( } @JsonProperty("comparable_type") - public String getComparableType() { + public TraitDefinitionComparableType getComparableType() { return comparableType; } @JsonProperty("entity_type") - public String getEntityType() { + public EntityType getEntityType() { return entityType; } @@ -82,13 +85,13 @@ public static ComparableTypeStage builder() { } public interface ComparableTypeStage { - EntityTypeStage comparableType(@NotNull String comparableType); + EntityTypeStage comparableType(@NotNull TraitDefinitionComparableType comparableType); Builder from(TraitDefinition other); } public interface EntityTypeStage { - IdStage entityType(@NotNull String entityType); + IdStage entityType(@NotNull EntityType entityType); } public interface IdStage { @@ -101,9 +104,9 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ComparableTypeStage, EntityTypeStage, IdStage, _FinalStage { - private String comparableType; + private TraitDefinitionComparableType comparableType; - private String entityType; + private EntityType entityType; private String id; @@ -122,14 +125,14 @@ public Builder from(TraitDefinition other) { @java.lang.Override @JsonSetter("comparable_type") - public EntityTypeStage comparableType(@NotNull String comparableType) { + public EntityTypeStage comparableType(@NotNull TraitDefinitionComparableType comparableType) { this.comparableType = Objects.requireNonNull(comparableType, "comparableType must not be null"); return this; } @java.lang.Override @JsonSetter("entity_type") - public IdStage entityType(@NotNull String entityType) { + public IdStage entityType(@NotNull EntityType entityType) { this.entityType = Objects.requireNonNull(entityType, "entityType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/TraitDefinitionComparableType.java b/src/main/java/com/schematic/api/types/TraitDefinitionComparableType.java new file mode 100644 index 0000000..60889f2 --- /dev/null +++ b/src/main/java/com/schematic/api/types/TraitDefinitionComparableType.java @@ -0,0 +1,105 @@ +/** + * 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 TraitDefinitionComparableType { + public static final TraitDefinitionComparableType BOOL = new TraitDefinitionComparableType(Value.BOOL, "bool"); + + public static final TraitDefinitionComparableType STRING = + new TraitDefinitionComparableType(Value.STRING, "string"); + + public static final TraitDefinitionComparableType INT = new TraitDefinitionComparableType(Value.INT, "int"); + + public static final TraitDefinitionComparableType DATE = new TraitDefinitionComparableType(Value.DATE, "date"); + + private final Value value; + + private final String string; + + TraitDefinitionComparableType(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 TraitDefinitionComparableType + && this.string.equals(((TraitDefinitionComparableType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case BOOL: + return visitor.visitBool(); + case STRING: + return visitor.visitString(); + case INT: + return visitor.visitInt(); + case DATE: + return visitor.visitDate(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TraitDefinitionComparableType valueOf(String value) { + switch (value) { + case "bool": + return BOOL; + case "string": + return STRING; + case "int": + return INT; + case "date": + return DATE; + default: + return new TraitDefinitionComparableType(Value.UNKNOWN, value); + } + } + + public enum Value { + BOOL, + + DATE, + + INT, + + STRING, + + UNKNOWN + } + + public interface Visitor { + T visitBool(); + + T visitDate(); + + T visitInt(); + + T visitString(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsRequestTraitType.java b/src/main/java/com/schematic/api/types/TraitType.java similarity index 58% rename from src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsRequestTraitType.java rename to src/main/java/com/schematic/api/types/TraitType.java index 45fad88..5d22857 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsRequestTraitType.java +++ b/src/main/java/com/schematic/api/types/TraitType.java @@ -1,35 +1,29 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.companies.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class ListEntityTraitDefinitionsRequestTraitType { - public static final ListEntityTraitDefinitionsRequestTraitType NUMBER = - new ListEntityTraitDefinitionsRequestTraitType(Value.NUMBER, "number"); +public final class TraitType { + public static final TraitType NUMBER = new TraitType(Value.NUMBER, "number"); - public static final ListEntityTraitDefinitionsRequestTraitType STRING = - new ListEntityTraitDefinitionsRequestTraitType(Value.STRING, "string"); + public static final TraitType STRING = new TraitType(Value.STRING, "string"); - public static final ListEntityTraitDefinitionsRequestTraitType BOOLEAN = - new ListEntityTraitDefinitionsRequestTraitType(Value.BOOLEAN, "boolean"); + public static final TraitType BOOLEAN = new TraitType(Value.BOOLEAN, "boolean"); - public static final ListEntityTraitDefinitionsRequestTraitType CURRENCY = - new ListEntityTraitDefinitionsRequestTraitType(Value.CURRENCY, "currency"); + public static final TraitType CURRENCY = new TraitType(Value.CURRENCY, "currency"); - public static final ListEntityTraitDefinitionsRequestTraitType DATE = - new ListEntityTraitDefinitionsRequestTraitType(Value.DATE, "date"); + public static final TraitType DATE = new TraitType(Value.DATE, "date"); - public static final ListEntityTraitDefinitionsRequestTraitType URL = - new ListEntityTraitDefinitionsRequestTraitType(Value.URL, "url"); + public static final TraitType URL = new TraitType(Value.URL, "url"); private final Value value; private final String string; - ListEntityTraitDefinitionsRequestTraitType(Value value, String string) { + TraitType(Value value, String string) { this.value = value; this.string = string; } @@ -46,9 +40,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { - return (this == other) - || (other instanceof ListEntityTraitDefinitionsRequestTraitType - && this.string.equals(((ListEntityTraitDefinitionsRequestTraitType) other).string)); + return (this == other) || (other instanceof TraitType && this.string.equals(((TraitType) other).string)); } @java.lang.Override @@ -77,7 +69,7 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListEntityTraitDefinitionsRequestTraitType valueOf(String value) { + public static TraitType valueOf(String value) { switch (value) { case "number": return NUMBER; @@ -92,7 +84,7 @@ public static ListEntityTraitDefinitionsRequestTraitType valueOf(String value) { case "url": return URL; default: - return new ListEntityTraitDefinitionsRequestTraitType(Value.UNKNOWN, value); + return new TraitType(Value.UNKNOWN, value); } } diff --git a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java new file mode 100644 index 0000000..094d9f3 --- /dev/null +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -0,0 +1,552 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateBillingPlanCreditGrantRequestBody.Builder.class) +public final class UpdateBillingPlanCreditGrantRequestBody { + private final Optional applyToExisting; + + private final Optional autoTopupAmount; + + private final Optional autoTopupAmountType; + + private final Optional autoTopupEnabled; + + private final Optional autoTopupExpiryType; + + private final Optional autoTopupExpiryUnit; + + private final Optional autoTopupExpiryUnitCount; + + private final Optional autoTopupThresholdPercent; + + private final Optional creditAmount; + + private final Optional expiryType; + + private final Optional expiryUnit; + + private final Optional expiryUnitCount; + + private final BillingPlanCreditGrantResetCadence resetCadence; + + private final BillingPlanCreditGrantResetStart resetStart; + + private final Optional resetType; + + private final Map additionalProperties; + + private UpdateBillingPlanCreditGrantRequestBody( + Optional applyToExisting, + Optional autoTopupAmount, + Optional autoTopupAmountType, + Optional autoTopupEnabled, + Optional autoTopupExpiryType, + Optional autoTopupExpiryUnit, + Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdPercent, + Optional creditAmount, + Optional expiryType, + Optional expiryUnit, + Optional expiryUnitCount, + BillingPlanCreditGrantResetCadence resetCadence, + BillingPlanCreditGrantResetStart resetStart, + Optional resetType, + Map additionalProperties) { + this.applyToExisting = applyToExisting; + this.autoTopupAmount = autoTopupAmount; + this.autoTopupAmountType = autoTopupAmountType; + this.autoTopupEnabled = autoTopupEnabled; + this.autoTopupExpiryType = autoTopupExpiryType; + this.autoTopupExpiryUnit = autoTopupExpiryUnit; + this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + this.autoTopupThresholdPercent = autoTopupThresholdPercent; + this.creditAmount = creditAmount; + this.expiryType = expiryType; + this.expiryUnit = expiryUnit; + this.expiryUnitCount = expiryUnitCount; + this.resetCadence = resetCadence; + this.resetStart = resetStart; + this.resetType = resetType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apply_to_existing") + public Optional getApplyToExisting() { + return applyToExisting; + } + + @JsonProperty("auto_topup_amount") + public Optional getAutoTopupAmount() { + return autoTopupAmount; + } + + @JsonProperty("auto_topup_amount_type") + public Optional getAutoTopupAmountType() { + return autoTopupAmountType; + } + + @JsonProperty("auto_topup_enabled") + public Optional getAutoTopupEnabled() { + return autoTopupEnabled; + } + + @JsonProperty("auto_topup_expiry_type") + public Optional getAutoTopupExpiryType() { + return autoTopupExpiryType; + } + + @JsonProperty("auto_topup_expiry_unit") + public Optional getAutoTopupExpiryUnit() { + return autoTopupExpiryUnit; + } + + @JsonProperty("auto_topup_expiry_unit_count") + public Optional getAutoTopupExpiryUnitCount() { + return autoTopupExpiryUnitCount; + } + + @JsonProperty("auto_topup_threshold_percent") + public Optional getAutoTopupThresholdPercent() { + return autoTopupThresholdPercent; + } + + @JsonProperty("credit_amount") + public Optional getCreditAmount() { + return creditAmount; + } + + @JsonProperty("expiry_type") + public Optional getExpiryType() { + return expiryType; + } + + @JsonProperty("expiry_unit") + public Optional getExpiryUnit() { + return expiryUnit; + } + + @JsonProperty("expiry_unit_count") + public Optional getExpiryUnitCount() { + return expiryUnitCount; + } + + @JsonProperty("reset_cadence") + public BillingPlanCreditGrantResetCadence getResetCadence() { + return resetCadence; + } + + @JsonProperty("reset_start") + public BillingPlanCreditGrantResetStart getResetStart() { + return resetStart; + } + + @JsonProperty("reset_type") + public Optional getResetType() { + return resetType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateBillingPlanCreditGrantRequestBody + && equalTo((UpdateBillingPlanCreditGrantRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateBillingPlanCreditGrantRequestBody other) { + return applyToExisting.equals(other.applyToExisting) + && autoTopupAmount.equals(other.autoTopupAmount) + && autoTopupAmountType.equals(other.autoTopupAmountType) + && autoTopupEnabled.equals(other.autoTopupEnabled) + && autoTopupExpiryType.equals(other.autoTopupExpiryType) + && autoTopupExpiryUnit.equals(other.autoTopupExpiryUnit) + && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) + && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) + && creditAmount.equals(other.creditAmount) + && expiryType.equals(other.expiryType) + && expiryUnit.equals(other.expiryUnit) + && expiryUnitCount.equals(other.expiryUnitCount) + && resetCadence.equals(other.resetCadence) + && resetStart.equals(other.resetStart) + && resetType.equals(other.resetType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.applyToExisting, + this.autoTopupAmount, + this.autoTopupAmountType, + this.autoTopupEnabled, + this.autoTopupExpiryType, + this.autoTopupExpiryUnit, + this.autoTopupExpiryUnitCount, + this.autoTopupThresholdPercent, + this.creditAmount, + this.expiryType, + this.expiryUnit, + this.expiryUnitCount, + this.resetCadence, + this.resetStart, + this.resetType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ResetCadenceStage builder() { + return new Builder(); + } + + public interface ResetCadenceStage { + ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); + + Builder from(UpdateBillingPlanCreditGrantRequestBody other); + } + + public interface ResetStartStage { + _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); + } + + public interface _FinalStage { + UpdateBillingPlanCreditGrantRequestBody build(); + + _FinalStage applyToExisting(Optional applyToExisting); + + _FinalStage applyToExisting(Boolean applyToExisting); + + _FinalStage autoTopupAmount(Optional autoTopupAmount); + + _FinalStage autoTopupAmount(Integer autoTopupAmount); + + _FinalStage autoTopupAmountType(Optional autoTopupAmountType); + + _FinalStage autoTopupAmountType(String autoTopupAmountType); + + _FinalStage autoTopupEnabled(Optional autoTopupEnabled); + + _FinalStage autoTopupEnabled(Boolean autoTopupEnabled); + + _FinalStage autoTopupExpiryType(Optional autoTopupExpiryType); + + _FinalStage autoTopupExpiryType(BillingCreditExpiryType autoTopupExpiryType); + + _FinalStage autoTopupExpiryUnit(Optional autoTopupExpiryUnit); + + _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit); + + _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + + _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount); + + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); + + _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent); + + _FinalStage creditAmount(Optional creditAmount); + + _FinalStage creditAmount(Integer creditAmount); + + _FinalStage expiryType(Optional expiryType); + + _FinalStage expiryType(BillingCreditExpiryType expiryType); + + _FinalStage expiryUnit(Optional expiryUnit); + + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Integer expiryUnitCount); + + _FinalStage resetType(Optional resetType); + + _FinalStage resetType(BillingPlanCreditGrantResetType resetType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResetCadenceStage, ResetStartStage, _FinalStage { + private BillingPlanCreditGrantResetCadence resetCadence; + + private BillingPlanCreditGrantResetStart resetStart; + + private Optional resetType = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); + + private Optional expiryUnit = Optional.empty(); + + private Optional expiryType = Optional.empty(); + + private Optional creditAmount = Optional.empty(); + + private Optional autoTopupThresholdPercent = Optional.empty(); + + private Optional autoTopupExpiryUnitCount = Optional.empty(); + + private Optional autoTopupExpiryUnit = Optional.empty(); + + private Optional autoTopupExpiryType = Optional.empty(); + + private Optional autoTopupEnabled = Optional.empty(); + + private Optional autoTopupAmountType = Optional.empty(); + + private Optional autoTopupAmount = Optional.empty(); + + private Optional applyToExisting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateBillingPlanCreditGrantRequestBody other) { + applyToExisting(other.getApplyToExisting()); + autoTopupAmount(other.getAutoTopupAmount()); + autoTopupAmountType(other.getAutoTopupAmountType()); + autoTopupEnabled(other.getAutoTopupEnabled()); + autoTopupExpiryType(other.getAutoTopupExpiryType()); + autoTopupExpiryUnit(other.getAutoTopupExpiryUnit()); + autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); + autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); + creditAmount(other.getCreditAmount()); + expiryType(other.getExpiryType()); + expiryUnit(other.getExpiryUnit()); + expiryUnitCount(other.getExpiryUnitCount()); + resetCadence(other.getResetCadence()); + resetStart(other.getResetStart()); + resetType(other.getResetType()); + return this; + } + + @java.lang.Override + @JsonSetter("reset_cadence") + public ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence) { + this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("reset_start") + public _FinalStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart) { + this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage resetType(BillingPlanCreditGrantResetType resetType) { + this.resetType = Optional.ofNullable(resetType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_type", nulls = Nulls.SKIP) + public _FinalStage resetType(Optional resetType) { + this.resetType = resetType; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + this.expiryUnitCount = expiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit) { + this.expiryUnit = Optional.ofNullable(expiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit", nulls = Nulls.SKIP) + public _FinalStage expiryUnit(Optional expiryUnit) { + this.expiryUnit = expiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage expiryType(BillingCreditExpiryType expiryType) { + this.expiryType = Optional.ofNullable(expiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_type", nulls = Nulls.SKIP) + public _FinalStage expiryType(Optional expiryType) { + this.expiryType = expiryType; + return this; + } + + @java.lang.Override + public _FinalStage creditAmount(Integer creditAmount) { + this.creditAmount = Optional.ofNullable(creditAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credit_amount", nulls = Nulls.SKIP) + public _FinalStage creditAmount(Optional creditAmount) { + this.creditAmount = creditAmount; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent) { + this.autoTopupThresholdPercent = Optional.ofNullable(autoTopupThresholdPercent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_threshold_percent", nulls = Nulls.SKIP) + public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent) { + this.autoTopupThresholdPercent = autoTopupThresholdPercent; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount) { + this.autoTopupExpiryUnitCount = Optional.ofNullable(autoTopupExpiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount) { + this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit) { + this.autoTopupExpiryUnit = Optional.ofNullable(autoTopupExpiryUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_unit", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryUnit(Optional autoTopupExpiryUnit) { + this.autoTopupExpiryUnit = autoTopupExpiryUnit; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupExpiryType(BillingCreditExpiryType autoTopupExpiryType) { + this.autoTopupExpiryType = Optional.ofNullable(autoTopupExpiryType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_expiry_type", nulls = Nulls.SKIP) + public _FinalStage autoTopupExpiryType(Optional autoTopupExpiryType) { + this.autoTopupExpiryType = autoTopupExpiryType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupEnabled(Boolean autoTopupEnabled) { + this.autoTopupEnabled = Optional.ofNullable(autoTopupEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_enabled", nulls = Nulls.SKIP) + public _FinalStage autoTopupEnabled(Optional autoTopupEnabled) { + this.autoTopupEnabled = autoTopupEnabled; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupAmountType(String autoTopupAmountType) { + this.autoTopupAmountType = Optional.ofNullable(autoTopupAmountType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_amount_type", nulls = Nulls.SKIP) + public _FinalStage autoTopupAmountType(Optional autoTopupAmountType) { + this.autoTopupAmountType = autoTopupAmountType; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupAmount(Integer autoTopupAmount) { + this.autoTopupAmount = Optional.ofNullable(autoTopupAmount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_amount", nulls = Nulls.SKIP) + public _FinalStage autoTopupAmount(Optional autoTopupAmount) { + this.autoTopupAmount = autoTopupAmount; + return this; + } + + @java.lang.Override + public _FinalStage applyToExisting(Boolean applyToExisting) { + this.applyToExisting = Optional.ofNullable(applyToExisting); + return this; + } + + @java.lang.Override + @JsonSetter(value = "apply_to_existing", nulls = Nulls.SKIP) + public _FinalStage applyToExisting(Optional applyToExisting) { + this.applyToExisting = applyToExisting; + return this; + } + + @java.lang.Override + public UpdateBillingPlanCreditGrantRequestBody build() { + return new UpdateBillingPlanCreditGrantRequestBody( + applyToExisting, + autoTopupAmount, + autoTopupAmountType, + autoTopupEnabled, + autoTopupExpiryType, + autoTopupExpiryUnit, + autoTopupExpiryUnitCount, + autoTopupThresholdPercent, + creditAmount, + expiryType, + expiryUnit, + expiryUnitCount, + resetCadence, + resetStart, + resetType, + additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java b/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java index 4a5ee27..59b1bb5 100644 --- a/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java +++ b/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java @@ -35,7 +35,7 @@ public final class UpdateEntitlementReqCommon { private final Optional valueTraitId; - private final UpdateEntitlementReqCommonValueType valueType; + private final EntitlementValueType valueType; private final Map additionalProperties; @@ -47,7 +47,7 @@ private UpdateEntitlementReqCommon( Optional valueCreditId, Optional valueNumeric, Optional valueTraitId, - UpdateEntitlementReqCommonValueType valueType, + EntitlementValueType valueType, Map additionalProperties) { this.creditConsumptionRate = creditConsumptionRate; this.metricPeriod = metricPeriod; @@ -96,7 +96,7 @@ public Optional getValueTraitId() { } @JsonProperty("value_type") - public UpdateEntitlementReqCommonValueType getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -145,7 +145,7 @@ public static ValueTypeStage builder() { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull UpdateEntitlementReqCommonValueType valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); Builder from(UpdateEntitlementReqCommon other); } @@ -185,7 +185,7 @@ _FinalStage metricPeriodMonthReset( @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ValueTypeStage, _FinalStage { - private UpdateEntitlementReqCommonValueType valueType; + private EntitlementValueType valueType; private Optional valueTraitId = Optional.empty(); @@ -221,7 +221,7 @@ public Builder from(UpdateEntitlementReqCommon other) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull UpdateEntitlementReqCommonValueType valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommonValueType.java b/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommonValueType.java deleted file mode 100644 index 3023fc0..0000000 --- a/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommonValueType.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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 UpdateEntitlementReqCommonValueType { - public static final UpdateEntitlementReqCommonValueType NUMERIC = - new UpdateEntitlementReqCommonValueType(Value.NUMERIC, "numeric"); - - public static final UpdateEntitlementReqCommonValueType TRAIT = - new UpdateEntitlementReqCommonValueType(Value.TRAIT, "trait"); - - public static final UpdateEntitlementReqCommonValueType BOOLEAN = - new UpdateEntitlementReqCommonValueType(Value.BOOLEAN, "boolean"); - - public static final UpdateEntitlementReqCommonValueType CREDIT = - new UpdateEntitlementReqCommonValueType(Value.CREDIT, "credit"); - - public static final UpdateEntitlementReqCommonValueType UNLIMITED = - new UpdateEntitlementReqCommonValueType(Value.UNLIMITED, "unlimited"); - - private final Value value; - - private final String string; - - UpdateEntitlementReqCommonValueType(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 UpdateEntitlementReqCommonValueType - && this.string.equals(((UpdateEntitlementReqCommonValueType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NUMERIC: - return visitor.visitNumeric(); - case TRAIT: - return visitor.visitTrait(); - case BOOLEAN: - return visitor.visitBoolean(); - case CREDIT: - return visitor.visitCredit(); - case UNLIMITED: - return visitor.visitUnlimited(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateEntitlementReqCommonValueType valueOf(String value) { - switch (value) { - case "numeric": - return NUMERIC; - case "trait": - return TRAIT; - case "boolean": - return BOOLEAN; - case "credit": - return CREDIT; - case "unlimited": - return UNLIMITED; - default: - return new UpdateEntitlementReqCommonValueType(Value.UNKNOWN, value); - } - } - - public enum Value { - BOOLEAN, - - CREDIT, - - NUMERIC, - - TRAIT, - - UNLIMITED, - - UNKNOWN - } - - public interface Visitor { - T visitBoolean(); - - T visitCredit(); - - T visitNumeric(); - - T visitTrait(); - - T visitUnlimited(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/UpdatePlanRequestBody.java b/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java similarity index 98% rename from src/main/java/com/schematic/api/resources/plans/requests/UpdatePlanRequestBody.java rename to src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java index 5ebbadf..9351a37 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/UpdatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.plans.requests; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; diff --git a/src/main/java/com/schematic/api/resources/plans/requests/UpsertBillingProductRequestBody.java b/src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java similarity index 95% rename from src/main/java/com/schematic/api/resources/plans/requests/UpsertBillingProductRequestBody.java rename to src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java index 4102bf4..13da017 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/UpsertBillingProductRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.plans.requests; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,7 +12,6 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; -import com.schematic.api.resources.plans.types.UpsertBillingProductRequestBodyChargeType; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -24,7 +23,7 @@ public final class UpsertBillingProductRequestBody { private final Optional billingProductId; - private final UpsertBillingProductRequestBodyChargeType chargeType; + private final ChargeType chargeType; private final Optional currency; @@ -48,7 +47,7 @@ public final class UpsertBillingProductRequestBody { private UpsertBillingProductRequestBody( Optional billingProductId, - UpsertBillingProductRequestBodyChargeType chargeType, + ChargeType chargeType, Optional currency, boolean isTrialable, Optional monthlyPrice, @@ -79,7 +78,7 @@ public Optional getBillingProductId() { } @JsonProperty("charge_type") - public UpsertBillingProductRequestBodyChargeType getChargeType() { + public ChargeType getChargeType() { return chargeType; } @@ -179,7 +178,7 @@ public static ChargeTypeStage builder() { } public interface ChargeTypeStage { - IsTrialableStage chargeType(@NotNull UpsertBillingProductRequestBodyChargeType chargeType); + IsTrialableStage chargeType(@NotNull ChargeType chargeType); Builder from(UpsertBillingProductRequestBody other); } @@ -230,7 +229,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ChargeTypeStage, IsTrialableStage, _FinalStage { - private UpsertBillingProductRequestBodyChargeType chargeType; + private ChargeType chargeType; private boolean isTrialable; @@ -275,7 +274,7 @@ public Builder from(UpsertBillingProductRequestBody other) { @java.lang.Override @JsonSetter("charge_type") - public IsTrialableStage chargeType(@NotNull UpsertBillingProductRequestBodyChargeType chargeType) { + public IsTrialableStage chargeType(@NotNull ChargeType chargeType) { this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); 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 6f12001..bc55f53 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java @@ -37,13 +37,13 @@ public final class UsageBasedEntitlementRequestBody { private final Optional overageBillingProductId; - private final Optional priceBehavior; + private final Optional priceBehavior; private final Optional> priceTiers; private final Optional softLimit; - private final Optional tierMode; + private final Optional tierMode; private final Optional yearlyMeteredPriceId; @@ -64,10 +64,10 @@ private UsageBasedEntitlementRequestBody( Optional monthlyUnitPrice, Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, - Optional priceBehavior, + Optional priceBehavior, Optional> priceTiers, Optional softLimit, - Optional tierMode, + Optional tierMode, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, Optional yearlyUnitPrice, @@ -133,7 +133,7 @@ public Optional getOverageBillingProductId() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -151,7 +151,7 @@ public Optional getSoftLimit() { } @JsonProperty("tier_mode") - public Optional getTierMode() { + public Optional getTierMode() { return tierMode; } @@ -253,13 +253,13 @@ public static final class Builder { private Optional overageBillingProductId = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional> priceTiers = Optional.empty(); private Optional softLimit = Optional.empty(); - private Optional tierMode = Optional.empty(); + private Optional tierMode = Optional.empty(); private Optional yearlyMeteredPriceId = Optional.empty(); @@ -383,12 +383,12 @@ public Builder overageBillingProductId(String overageBillingProductId) { } @JsonSetter(value = "price_behavior", nulls = Nulls.SKIP) - public Builder priceBehavior(Optional priceBehavior) { + public Builder priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } - public Builder priceBehavior(UsageBasedEntitlementRequestBodyPriceBehavior priceBehavior) { + public Builder priceBehavior(EntitlementPriceBehavior priceBehavior) { this.priceBehavior = Optional.ofNullable(priceBehavior); return this; } @@ -419,12 +419,12 @@ public Builder softLimit(Integer softLimit) { } @JsonSetter(value = "tier_mode", nulls = Nulls.SKIP) - public Builder tierMode(Optional tierMode) { + public Builder tierMode(Optional tierMode) { this.tierMode = tierMode; return this; } - public Builder tierMode(String tierMode) { + public Builder tierMode(BillingTiersMode tierMode) { this.tierMode = Optional.ofNullable(tierMode); return this; } diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java index 82a011e..8c0b51d 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java @@ -35,13 +35,13 @@ public final class UsageBasedEntitlementResponseData { private final Optional monthlyUsageBasedPrice; - private final Optional priceBehavior; + private final Optional priceBehavior; private final Optional valueBool; private final Optional valueNumeric; - private final String valueType; + private final EntitlementValueType valueType; private final Optional yearlyUsageBasedPrice; @@ -55,10 +55,10 @@ private UsageBasedEntitlementResponseData( Optional metricPeriod, Optional metricPeriodMonthReset, Optional monthlyUsageBasedPrice, - Optional priceBehavior, + Optional priceBehavior, Optional valueBool, Optional valueNumeric, - String valueType, + EntitlementValueType valueType, Optional yearlyUsageBasedPrice, Map additionalProperties) { this.billingThreshold = billingThreshold; @@ -112,7 +112,7 @@ public Optional getMonthlyUsageBasedPrice() { } @JsonProperty("price_behavior") - public Optional getPriceBehavior() { + public Optional getPriceBehavior() { return priceBehavior; } @@ -127,7 +127,7 @@ public Optional getValueNumeric() { } @JsonProperty("value_type") - public String getValueType() { + public EntitlementValueType getValueType() { return valueType; } @@ -195,7 +195,7 @@ public interface FeatureIdStage { } public interface ValueTypeStage { - _FinalStage valueType(@NotNull String valueType); + _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { @@ -225,9 +225,9 @@ public interface _FinalStage { _FinalStage monthlyUsageBasedPrice(BillingPriceView monthlyUsageBasedPrice); - _FinalStage priceBehavior(Optional priceBehavior); + _FinalStage priceBehavior(Optional priceBehavior); - _FinalStage priceBehavior(String priceBehavior); + _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); _FinalStage valueBool(Optional valueBool); @@ -246,7 +246,7 @@ public interface _FinalStage { public static final class Builder implements FeatureIdStage, ValueTypeStage, _FinalStage { private String featureId; - private String valueType; + private EntitlementValueType valueType; private Optional yearlyUsageBasedPrice = Optional.empty(); @@ -254,7 +254,7 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional valueBool = Optional.empty(); - private Optional priceBehavior = Optional.empty(); + private Optional priceBehavior = Optional.empty(); private Optional monthlyUsageBasedPrice = Optional.empty(); @@ -299,7 +299,7 @@ public ValueTypeStage featureId(@NotNull String featureId) { @java.lang.Override @JsonSetter("value_type") - public _FinalStage valueType(@NotNull String valueType) { + public _FinalStage valueType(@NotNull EntitlementValueType valueType) { this.valueType = Objects.requireNonNull(valueType, "valueType must not be null"); return this; } @@ -344,14 +344,14 @@ public _FinalStage valueBool(Optional valueBool) { } @java.lang.Override - public _FinalStage priceBehavior(String priceBehavior) { + 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) { + public _FinalStage priceBehavior(Optional priceBehavior) { this.priceBehavior = priceBehavior; return this; } diff --git a/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java b/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java new file mode 100644 index 0000000..690167c --- /dev/null +++ b/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java @@ -0,0 +1,191 @@ +/** + * 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 = UsageTimeSeriesPointResponseData.Builder.class) +public final class UsageTimeSeriesPointResponseData { + private final Optional periodEnd; + + private final Optional periodStart; + + private final OffsetDateTime timestamp; + + private final int usage; + + private final Map additionalProperties; + + private UsageTimeSeriesPointResponseData( + Optional periodEnd, + Optional periodStart, + OffsetDateTime timestamp, + int usage, + Map additionalProperties) { + this.periodEnd = periodEnd; + this.periodStart = periodStart; + this.timestamp = timestamp; + this.usage = usage; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("period_end") + public Optional getPeriodEnd() { + return periodEnd; + } + + @JsonProperty("period_start") + public Optional getPeriodStart() { + return periodStart; + } + + @JsonProperty("timestamp") + public OffsetDateTime getTimestamp() { + return timestamp; + } + + @JsonProperty("usage") + public int getUsage() { + return usage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageTimeSeriesPointResponseData && equalTo((UsageTimeSeriesPointResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageTimeSeriesPointResponseData other) { + return periodEnd.equals(other.periodEnd) + && periodStart.equals(other.periodStart) + && timestamp.equals(other.timestamp) + && usage == other.usage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.periodEnd, this.periodStart, this.timestamp, this.usage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TimestampStage builder() { + return new Builder(); + } + + public interface TimestampStage { + UsageStage timestamp(@NotNull OffsetDateTime timestamp); + + Builder from(UsageTimeSeriesPointResponseData other); + } + + public interface UsageStage { + _FinalStage usage(int usage); + } + + public interface _FinalStage { + UsageTimeSeriesPointResponseData build(); + + _FinalStage periodEnd(Optional periodEnd); + + _FinalStage periodEnd(OffsetDateTime periodEnd); + + _FinalStage periodStart(Optional periodStart); + + _FinalStage periodStart(OffsetDateTime periodStart); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TimestampStage, UsageStage, _FinalStage { + private OffsetDateTime timestamp; + + private int usage; + + private Optional periodStart = Optional.empty(); + + private Optional periodEnd = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UsageTimeSeriesPointResponseData other) { + periodEnd(other.getPeriodEnd()); + periodStart(other.getPeriodStart()); + timestamp(other.getTimestamp()); + usage(other.getUsage()); + return this; + } + + @java.lang.Override + @JsonSetter("timestamp") + public UsageStage timestamp(@NotNull OffsetDateTime timestamp) { + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("usage") + public _FinalStage usage(int usage) { + this.usage = usage; + return this; + } + + @java.lang.Override + public _FinalStage periodStart(OffsetDateTime periodStart) { + this.periodStart = Optional.ofNullable(periodStart); + return this; + } + + @java.lang.Override + @JsonSetter(value = "period_start", nulls = Nulls.SKIP) + public _FinalStage periodStart(Optional periodStart) { + this.periodStart = periodStart; + return this; + } + + @java.lang.Override + public _FinalStage periodEnd(OffsetDateTime periodEnd) { + this.periodEnd = Optional.ofNullable(periodEnd); + return this; + } + + @java.lang.Override + @JsonSetter(value = "period_end", nulls = Nulls.SKIP) + public _FinalStage periodEnd(Optional periodEnd) { + this.periodEnd = periodEnd; + return this; + } + + @java.lang.Override + public UsageTimeSeriesPointResponseData build() { + return new UsageTimeSeriesPointResponseData(periodEnd, periodStart, timestamp, usage, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java b/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java new file mode 100644 index 0000000..90c59bd --- /dev/null +++ b/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java @@ -0,0 +1,295 @@ +/** + * 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 = WebFeatureUsageWebhookOutput.Builder.class) +public final class WebFeatureUsageWebhookOutput { + private final Optional allocation; + + private final Optional creditUsage; + + private final String entitlement; + + private final Optional feature; + + private final Optional metricResetAt; + + private final Optional usage; + + private final Optional company; + + private final Map additionalProperties; + + private WebFeatureUsageWebhookOutput( + Optional allocation, + Optional creditUsage, + String entitlement, + Optional feature, + Optional metricResetAt, + Optional usage, + Optional company, + Map additionalProperties) { + this.allocation = allocation; + this.creditUsage = creditUsage; + this.entitlement = entitlement; + this.feature = feature; + this.metricResetAt = metricResetAt; + this.usage = usage; + this.company = company; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("Allocation") + public Optional getAllocation() { + return allocation; + } + + @JsonProperty("CreditUsage") + public Optional getCreditUsage() { + return creditUsage; + } + + @JsonProperty("Entitlement") + public String getEntitlement() { + return entitlement; + } + + @JsonProperty("Feature") + public Optional getFeature() { + return feature; + } + + @JsonProperty("MetricResetAt") + public Optional getMetricResetAt() { + return metricResetAt; + } + + @JsonProperty("Usage") + public Optional getUsage() { + return usage; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WebFeatureUsageWebhookOutput && equalTo((WebFeatureUsageWebhookOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WebFeatureUsageWebhookOutput other) { + return allocation.equals(other.allocation) + && creditUsage.equals(other.creditUsage) + && entitlement.equals(other.entitlement) + && feature.equals(other.feature) + && metricResetAt.equals(other.metricResetAt) + && usage.equals(other.usage) + && company.equals(other.company); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allocation, + this.creditUsage, + this.entitlement, + this.feature, + this.metricResetAt, + this.usage, + this.company); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EntitlementStage builder() { + return new Builder(); + } + + public interface EntitlementStage { + _FinalStage entitlement(@NotNull String entitlement); + + Builder from(WebFeatureUsageWebhookOutput other); + } + + public interface _FinalStage { + WebFeatureUsageWebhookOutput build(); + + _FinalStage allocation(Optional allocation); + + _FinalStage allocation(Integer allocation); + + _FinalStage creditUsage(Optional creditUsage); + + _FinalStage creditUsage(CreditUsage creditUsage); + + _FinalStage feature(Optional feature); + + _FinalStage feature(FeatureView feature); + + _FinalStage metricResetAt(Optional metricResetAt); + + _FinalStage metricResetAt(OffsetDateTime metricResetAt); + + _FinalStage usage(Optional usage); + + _FinalStage usage(Integer usage); + + _FinalStage company(Optional company); + + _FinalStage company(CompanyDetailResponseData company); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EntitlementStage, _FinalStage { + private String entitlement; + + private Optional company = Optional.empty(); + + private Optional usage = Optional.empty(); + + private Optional metricResetAt = Optional.empty(); + + private Optional feature = Optional.empty(); + + private Optional creditUsage = Optional.empty(); + + private Optional allocation = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WebFeatureUsageWebhookOutput other) { + allocation(other.getAllocation()); + creditUsage(other.getCreditUsage()); + entitlement(other.getEntitlement()); + feature(other.getFeature()); + metricResetAt(other.getMetricResetAt()); + usage(other.getUsage()); + company(other.getCompany()); + return this; + } + + @java.lang.Override + @JsonSetter("Entitlement") + public _FinalStage entitlement(@NotNull String entitlement) { + this.entitlement = Objects.requireNonNull(entitlement, "entitlement must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage company(CompanyDetailResponseData company) { + this.company = Optional.ofNullable(company); + return this; + } + + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + + @java.lang.Override + public _FinalStage usage(Integer usage) { + this.usage = Optional.ofNullable(usage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "Usage", nulls = Nulls.SKIP) + public _FinalStage usage(Optional usage) { + this.usage = usage; + return this; + } + + @java.lang.Override + public _FinalStage metricResetAt(OffsetDateTime metricResetAt) { + this.metricResetAt = Optional.ofNullable(metricResetAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "MetricResetAt", nulls = Nulls.SKIP) + public _FinalStage metricResetAt(Optional metricResetAt) { + this.metricResetAt = metricResetAt; + return this; + } + + @java.lang.Override + public _FinalStage feature(FeatureView feature) { + this.feature = Optional.ofNullable(feature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "Feature", nulls = Nulls.SKIP) + public _FinalStage feature(Optional feature) { + this.feature = feature; + return this; + } + + @java.lang.Override + public _FinalStage creditUsage(CreditUsage creditUsage) { + this.creditUsage = Optional.ofNullable(creditUsage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "CreditUsage", nulls = Nulls.SKIP) + public _FinalStage creditUsage(Optional creditUsage) { + this.creditUsage = creditUsage; + return this; + } + + @java.lang.Override + public _FinalStage allocation(Integer allocation) { + this.allocation = Optional.ofNullable(allocation); + return this; + } + + @java.lang.Override + @JsonSetter(value = "Allocation", nulls = Nulls.SKIP) + public _FinalStage allocation(Optional allocation) { + this.allocation = allocation; + return this; + } + + @java.lang.Override + public WebFeatureUsageWebhookOutput build() { + return new WebFeatureUsageWebhookOutput( + allocation, creditUsage, entitlement, feature, metricResetAt, usage, company, additionalProperties); + } + } +} diff --git a/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java b/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java index d420620..1a2787a 100644 --- a/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java @@ -28,13 +28,13 @@ public final class WebhookEventDetailResponseData { private final Optional payload; - private final String requestType; + private final WebhookRequestType requestType; private final Optional responseCode; private final Optional sentAt; - private final String status; + private final WebhookEventStatus status; private final OffsetDateTime updatedAt; @@ -48,10 +48,10 @@ private WebhookEventDetailResponseData( OffsetDateTime createdAt, String id, Optional payload, - String requestType, + WebhookRequestType requestType, Optional responseCode, Optional sentAt, - String status, + WebhookEventStatus status, OffsetDateTime updatedAt, Optional webhook, String webhookId, @@ -85,7 +85,7 @@ public Optional getPayload() { } @JsonProperty("request_type") - public String getRequestType() { + public WebhookRequestType getRequestType() { return requestType; } @@ -100,7 +100,7 @@ public Optional getSentAt() { } @JsonProperty("status") - public String getStatus() { + public WebhookEventStatus getStatus() { return status; } @@ -178,11 +178,11 @@ public interface IdStage { } public interface RequestTypeStage { - StatusStage requestType(@NotNull String requestType); + StatusStage requestType(@NotNull WebhookRequestType requestType); } public interface StatusStage { - UpdatedAtStage status(@NotNull String status); + UpdatedAtStage status(@NotNull WebhookEventStatus status); } public interface UpdatedAtStage { @@ -226,9 +226,9 @@ public static final class Builder private String id; - private String requestType; + private WebhookRequestType requestType; - private String status; + private WebhookEventStatus status; private OffsetDateTime updatedAt; @@ -278,14 +278,14 @@ public RequestTypeStage id(@NotNull String id) { @java.lang.Override @JsonSetter("request_type") - public StatusStage requestType(@NotNull String requestType) { + public StatusStage requestType(@NotNull WebhookRequestType requestType) { this.requestType = Objects.requireNonNull(requestType, "requestType must not be null"); return this; } @java.lang.Override @JsonSetter("status") - public UpdatedAtStage status(@NotNull String status) { + public UpdatedAtStage status(@NotNull WebhookEventStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/WebhookEventResponseData.java b/src/main/java/com/schematic/api/types/WebhookEventResponseData.java index bc284e7..a5804cd 100644 --- a/src/main/java/com/schematic/api/types/WebhookEventResponseData.java +++ b/src/main/java/com/schematic/api/types/WebhookEventResponseData.java @@ -28,13 +28,13 @@ public final class WebhookEventResponseData { private final Optional payload; - private final String requestType; + private final WebhookRequestType requestType; private final Optional responseCode; private final Optional sentAt; - private final String status; + private final WebhookEventStatus status; private final OffsetDateTime updatedAt; @@ -46,10 +46,10 @@ private WebhookEventResponseData( OffsetDateTime createdAt, String id, Optional payload, - String requestType, + WebhookRequestType requestType, Optional responseCode, Optional sentAt, - String status, + WebhookEventStatus status, OffsetDateTime updatedAt, String webhookId, Map additionalProperties) { @@ -81,7 +81,7 @@ public Optional getPayload() { } @JsonProperty("request_type") - public String getRequestType() { + public WebhookRequestType getRequestType() { return requestType; } @@ -96,7 +96,7 @@ public Optional getSentAt() { } @JsonProperty("status") - public String getStatus() { + public WebhookEventStatus getStatus() { return status; } @@ -167,11 +167,11 @@ public interface IdStage { } public interface RequestTypeStage { - StatusStage requestType(@NotNull String requestType); + StatusStage requestType(@NotNull WebhookRequestType requestType); } public interface StatusStage { - UpdatedAtStage status(@NotNull String status); + UpdatedAtStage status(@NotNull WebhookEventStatus status); } public interface UpdatedAtStage { @@ -211,9 +211,9 @@ public static final class Builder private String id; - private String requestType; + private WebhookRequestType requestType; - private String status; + private WebhookEventStatus status; private OffsetDateTime updatedAt; @@ -260,14 +260,14 @@ public RequestTypeStage id(@NotNull String id) { @java.lang.Override @JsonSetter("request_type") - public StatusStage requestType(@NotNull String requestType) { + public StatusStage requestType(@NotNull WebhookRequestType requestType) { this.requestType = Objects.requireNonNull(requestType, "requestType must not be null"); return this; } @java.lang.Override @JsonSetter("status") - public UpdatedAtStage status(@NotNull String status) { + public UpdatedAtStage status(@NotNull WebhookEventStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } diff --git a/src/main/java/com/schematic/api/types/WebhookEventStatus.java b/src/main/java/com/schematic/api/types/WebhookEventStatus.java new file mode 100644 index 0000000..82605f5 --- /dev/null +++ b/src/main/java/com/schematic/api/types/WebhookEventStatus.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class WebhookEventStatus { + public static final WebhookEventStatus FAILURE = new WebhookEventStatus(Value.FAILURE, "failure"); + + public static final WebhookEventStatus SUCCESS = new WebhookEventStatus(Value.SUCCESS, "success"); + + public static final WebhookEventStatus PENDING = new WebhookEventStatus(Value.PENDING, "pending"); + + private final Value value; + + private final String string; + + WebhookEventStatus(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 WebhookEventStatus && this.string.equals(((WebhookEventStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FAILURE: + return visitor.visitFailure(); + case SUCCESS: + return visitor.visitSuccess(); + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static WebhookEventStatus valueOf(String value) { + switch (value) { + case "failure": + return FAILURE; + case "success": + return SUCCESS; + case "pending": + return PENDING; + default: + return new WebhookEventStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + FAILURE, + + PENDING, + + SUCCESS, + + UNKNOWN + } + + public interface Visitor { + T visitFailure(); + + T visitPending(); + + T visitSuccess(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java b/src/main/java/com/schematic/api/types/WebhookRequestType.java similarity index 55% rename from src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java rename to src/main/java/com/schematic/api/types/WebhookRequestType.java index b4d25ed..446aa0a 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookRequestBodyRequestTypesItem.java +++ b/src/main/java/com/schematic/api/types/WebhookRequestType.java @@ -1,120 +1,117 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.webhooks.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class CreateWebhookRequestBodyRequestTypesItem { - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_DELETED, "company.deleted"); +public final class WebhookRequestType { + public static final WebhookRequestType AUTO_TOPUP_HARD_FAILURE = + new WebhookRequestType(Value.AUTO_TOPUP_HARD_FAILURE, "auto.topup.hard.failure"); - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_OVERRIDE_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_OVERRIDE_UPDATED, "company.override.updated"); + public static final WebhookRequestType AUTO_TOPUP_RETRY_EXCEEDED = + new WebhookRequestType(Value.AUTO_TOPUP_RETRY_EXCEEDED, "auto.topup.retry.exceeded"); - public static final CreateWebhookRequestBodyRequestTypesItem FLAG_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FLAG_UPDATED, "flag.updated"); + public static final WebhookRequestType COMPANY_DELETED = + new WebhookRequestType(Value.COMPANY_DELETED, "company.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem FEATURE_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FEATURE_UPDATED, "feature.updated"); + public static final WebhookRequestType COMPANY_OVERRIDE_UPDATED = + new WebhookRequestType(Value.COMPANY_OVERRIDE_UPDATED, "company.override.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem FLAG_RULES_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FLAG_RULES_UPDATED, "flag_rules.updated"); + public static final WebhookRequestType FLAG_UPDATED = new WebhookRequestType(Value.FLAG_UPDATED, "flag.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem USER_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.USER_UPDATED, "user.updated"); + public static final WebhookRequestType FEATURE_UPDATED = + new WebhookRequestType(Value.FEATURE_UPDATED, "feature.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem PLAN_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.PLAN_DELETED, "plan.deleted"); + public static final WebhookRequestType FLAG_RULES_UPDATED = + new WebhookRequestType(Value.FLAG_RULES_UPDATED, "flag_rules.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem PLAN_ENTITLEMENT_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.PLAN_ENTITLEMENT_UPDATED, "plan.entitlement.updated"); + public static final WebhookRequestType USER_UPDATED = new WebhookRequestType(Value.USER_UPDATED, "user.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_OVERRIDE_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_OVERRIDE_DELETED, "company.override.deleted"); + public static final WebhookRequestType PLAN_DELETED = new WebhookRequestType(Value.PLAN_DELETED, "plan.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem USER_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.USER_CREATED, "user.created"); + public static final WebhookRequestType COMPANY_OVERRIDE_DELETED = + new WebhookRequestType(Value.COMPANY_OVERRIDE_DELETED, "company.override.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem FEATURE_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FEATURE_DELETED, "feature.deleted"); + public static final WebhookRequestType PLAN_ENTITLEMENT_UPDATED = + new WebhookRequestType(Value.PLAN_ENTITLEMENT_UPDATED, "plan.entitlement.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem CREDIT_LIMIT_REACHED = - new CreateWebhookRequestBodyRequestTypesItem(Value.CREDIT_LIMIT_REACHED, "credit.limit.reached"); + public static final WebhookRequestType RULE_DELETED = new WebhookRequestType(Value.RULE_DELETED, "rule.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem ENTITLEMENT_SOFT_LIMIT_REACHED = - new CreateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_SOFT_LIMIT_REACHED, "entitlement.soft_limit.reached"); + public static final WebhookRequestType USER_CREATED = new WebhookRequestType(Value.USER_CREATED, "user.created"); - public static final CreateWebhookRequestBodyRequestTypesItem SUBSCRIPTION_TRIAL_ENDED = - new CreateWebhookRequestBodyRequestTypesItem(Value.SUBSCRIPTION_TRIAL_ENDED, "subscription.trial.ended"); + public static final WebhookRequestType FEATURE_DELETED = + new WebhookRequestType(Value.FEATURE_DELETED, "feature.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem ENTITLEMENT_LIMIT_REACHED = - new CreateWebhookRequestBodyRequestTypesItem(Value.ENTITLEMENT_LIMIT_REACHED, "entitlement.limit.reached"); + public static final WebhookRequestType CREDIT_LIMIT_REACHED = + new WebhookRequestType(Value.CREDIT_LIMIT_REACHED, "credit.limit.reached"); - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_OVERRIDE_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_OVERRIDE_CREATED, "company.override.created"); + public static final WebhookRequestType ENTITLEMENT_SOFT_LIMIT_REACHED = + new WebhookRequestType(Value.ENTITLEMENT_SOFT_LIMIT_REACHED, "entitlement.soft_limit.reached"); - public static final CreateWebhookRequestBodyRequestTypesItem FLAG_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FLAG_CREATED, "flag.created"); + public static final WebhookRequestType SUBSCRIPTION_TRIAL_ENDED = + new WebhookRequestType(Value.SUBSCRIPTION_TRIAL_ENDED, "subscription.trial.ended"); - public static final CreateWebhookRequestBodyRequestTypesItem PLAN_ENTITLEMENT_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.PLAN_ENTITLEMENT_DELETED, "plan.entitlement.deleted"); + public static final WebhookRequestType ENTITLEMENT_LIMIT_REACHED = + new WebhookRequestType(Value.ENTITLEMENT_LIMIT_REACHED, "entitlement.limit.reached"); - public static final CreateWebhookRequestBodyRequestTypesItem USER_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.USER_DELETED, "user.deleted"); + public static final WebhookRequestType COMPANY_OVERRIDE_CREATED = + new WebhookRequestType(Value.COMPANY_OVERRIDE_CREATED, "company.override.created"); - public static final CreateWebhookRequestBodyRequestTypesItem PLAN_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.PLAN_UPDATED, "plan.updated"); + public static final WebhookRequestType FLAG_CREATED = new WebhookRequestType(Value.FLAG_CREATED, "flag.created"); - public static final CreateWebhookRequestBodyRequestTypesItem ENTITLEMENT_LIMIT_WARNING = - new CreateWebhookRequestBodyRequestTypesItem(Value.ENTITLEMENT_LIMIT_WARNING, "entitlement.limit.warning"); + public static final WebhookRequestType PLAN_ENTITLEMENT_DELETED = + new WebhookRequestType(Value.PLAN_ENTITLEMENT_DELETED, "plan.entitlement.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem CREDIT_LIMIT_WARNING = - new CreateWebhookRequestBodyRequestTypesItem(Value.CREDIT_LIMIT_WARNING, "credit.limit.warning"); + public static final WebhookRequestType USER_DELETED = new WebhookRequestType(Value.USER_DELETED, "user.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem FEATURE_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FEATURE_CREATED, "feature.created"); + public static final WebhookRequestType ENTITLEMENT_LIMIT_WARNING = + new WebhookRequestType(Value.ENTITLEMENT_LIMIT_WARNING, "entitlement.limit.warning"); - public static final CreateWebhookRequestBodyRequestTypesItem ENTITLEMENT_SOFT_LIMIT_WARNING = - new CreateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_SOFT_LIMIT_WARNING, "entitlement.soft_limit.warning"); + public static final WebhookRequestType PLAN_UPDATED = new WebhookRequestType(Value.PLAN_UPDATED, "plan.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_UPDATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_UPDATED, "company.updated"); + public static final WebhookRequestType CREDIT_LIMIT_WARNING = + new WebhookRequestType(Value.CREDIT_LIMIT_WARNING, "credit.limit.warning"); - public static final CreateWebhookRequestBodyRequestTypesItem ENTITLEMENT_TIER_LIMIT_REACHED = - new CreateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_TIER_LIMIT_REACHED, "entitlement.tier_limit.reached"); + public static final WebhookRequestType FEATURE_CREATED = + new WebhookRequestType(Value.FEATURE_CREATED, "feature.created"); - public static final CreateWebhookRequestBodyRequestTypesItem FLAG_DELETED = - new CreateWebhookRequestBodyRequestTypesItem(Value.FLAG_DELETED, "flag.deleted"); + public static final WebhookRequestType ENTITLEMENT_SOFT_LIMIT_WARNING = + new WebhookRequestType(Value.ENTITLEMENT_SOFT_LIMIT_WARNING, "entitlement.soft_limit.warning"); - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_CREATED, "company.created"); + public static final WebhookRequestType COMPANY_PLAN_CHANGED = + new WebhookRequestType(Value.COMPANY_PLAN_CHANGED, "company.plan_changed"); - public static final CreateWebhookRequestBodyRequestTypesItem PLAN_ENTITLEMENT_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.PLAN_ENTITLEMENT_CREATED, "plan.entitlement.created"); + public static final WebhookRequestType COMPANY_UPDATED = + new WebhookRequestType(Value.COMPANY_UPDATED, "company.updated"); - public static final CreateWebhookRequestBodyRequestTypesItem ENTITLEMENT_TIER_LIMIT_WARNING = - new CreateWebhookRequestBodyRequestTypesItem( - Value.ENTITLEMENT_TIER_LIMIT_WARNING, "entitlement.tier_limit.warning"); + public static final WebhookRequestType ENTITLEMENT_TIER_LIMIT_REACHED = + new WebhookRequestType(Value.ENTITLEMENT_TIER_LIMIT_REACHED, "entitlement.tier_limit.reached"); - public static final CreateWebhookRequestBodyRequestTypesItem COMPANY_PLAN_CHANGE = - new CreateWebhookRequestBodyRequestTypesItem(Value.COMPANY_PLAN_CHANGE, "company.plan_change"); + public static final WebhookRequestType COMPANY_OVERRIDE_EXPIRED = + new WebhookRequestType(Value.COMPANY_OVERRIDE_EXPIRED, "company.override.expired"); - public static final CreateWebhookRequestBodyRequestTypesItem PLAN_CREATED = - new CreateWebhookRequestBodyRequestTypesItem(Value.PLAN_CREATED, "plan.created"); + public static final WebhookRequestType FLAG_DELETED = new WebhookRequestType(Value.FLAG_DELETED, "flag.deleted"); - public static final CreateWebhookRequestBodyRequestTypesItem TEST_SEND = - new CreateWebhookRequestBodyRequestTypesItem(Value.TEST_SEND, "test.send"); + public static final WebhookRequestType COMPANY_CREATED = + new WebhookRequestType(Value.COMPANY_CREATED, "company.created"); + + public static final WebhookRequestType ENTITLEMENT_TIER_LIMIT_WARNING = + new WebhookRequestType(Value.ENTITLEMENT_TIER_LIMIT_WARNING, "entitlement.tier_limit.warning"); + + public static final WebhookRequestType PLAN_ENTITLEMENT_CREATED = + new WebhookRequestType(Value.PLAN_ENTITLEMENT_CREATED, "plan.entitlement.created"); + + public static final WebhookRequestType PLAN_CREATED = new WebhookRequestType(Value.PLAN_CREATED, "plan.created"); + + public static final WebhookRequestType TEST_SEND = new WebhookRequestType(Value.TEST_SEND, "test.send"); private final Value value; private final String string; - CreateWebhookRequestBodyRequestTypesItem(Value value, String string) { + WebhookRequestType(Value value, String string) { this.value = value; this.string = string; } @@ -132,8 +129,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof CreateWebhookRequestBodyRequestTypesItem - && this.string.equals(((CreateWebhookRequestBodyRequestTypesItem) other).string)); + || (other instanceof WebhookRequestType && this.string.equals(((WebhookRequestType) other).string)); } @java.lang.Override @@ -143,6 +139,10 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case AUTO_TOPUP_HARD_FAILURE: + return visitor.visitAutoTopupHardFailure(); + case AUTO_TOPUP_RETRY_EXCEEDED: + return visitor.visitAutoTopupRetryExceeded(); case COMPANY_DELETED: return visitor.visitCompanyDeleted(); case COMPANY_OVERRIDE_UPDATED: @@ -157,10 +157,12 @@ public T visit(Visitor visitor) { return visitor.visitUserUpdated(); case PLAN_DELETED: return visitor.visitPlanDeleted(); - case PLAN_ENTITLEMENT_UPDATED: - return visitor.visitPlanEntitlementUpdated(); case COMPANY_OVERRIDE_DELETED: return visitor.visitCompanyOverrideDeleted(); + case PLAN_ENTITLEMENT_UPDATED: + return visitor.visitPlanEntitlementUpdated(); + case RULE_DELETED: + return visitor.visitRuleDeleted(); case USER_CREATED: return visitor.visitUserCreated(); case FEATURE_DELETED: @@ -181,30 +183,32 @@ public T visit(Visitor visitor) { return visitor.visitPlanEntitlementDeleted(); case USER_DELETED: return visitor.visitUserDeleted(); - case PLAN_UPDATED: - return visitor.visitPlanUpdated(); case ENTITLEMENT_LIMIT_WARNING: return visitor.visitEntitlementLimitWarning(); + case PLAN_UPDATED: + return visitor.visitPlanUpdated(); case CREDIT_LIMIT_WARNING: return visitor.visitCreditLimitWarning(); case FEATURE_CREATED: return visitor.visitFeatureCreated(); case ENTITLEMENT_SOFT_LIMIT_WARNING: return visitor.visitEntitlementSoftLimitWarning(); + case COMPANY_PLAN_CHANGED: + return visitor.visitCompanyPlanChanged(); case COMPANY_UPDATED: return visitor.visitCompanyUpdated(); case ENTITLEMENT_TIER_LIMIT_REACHED: return visitor.visitEntitlementTierLimitReached(); + case COMPANY_OVERRIDE_EXPIRED: + return visitor.visitCompanyOverrideExpired(); case FLAG_DELETED: return visitor.visitFlagDeleted(); case COMPANY_CREATED: return visitor.visitCompanyCreated(); - case PLAN_ENTITLEMENT_CREATED: - return visitor.visitPlanEntitlementCreated(); case ENTITLEMENT_TIER_LIMIT_WARNING: return visitor.visitEntitlementTierLimitWarning(); - case COMPANY_PLAN_CHANGE: - return visitor.visitCompanyPlanChange(); + case PLAN_ENTITLEMENT_CREATED: + return visitor.visitPlanEntitlementCreated(); case PLAN_CREATED: return visitor.visitPlanCreated(); case TEST_SEND: @@ -216,8 +220,12 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateWebhookRequestBodyRequestTypesItem valueOf(String value) { + public static WebhookRequestType valueOf(String value) { switch (value) { + case "auto.topup.hard.failure": + return AUTO_TOPUP_HARD_FAILURE; + case "auto.topup.retry.exceeded": + return AUTO_TOPUP_RETRY_EXCEEDED; case "company.deleted": return COMPANY_DELETED; case "company.override.updated": @@ -232,10 +240,12 @@ public static CreateWebhookRequestBodyRequestTypesItem valueOf(String value) { return USER_UPDATED; case "plan.deleted": return PLAN_DELETED; - case "plan.entitlement.updated": - return PLAN_ENTITLEMENT_UPDATED; case "company.override.deleted": return COMPANY_OVERRIDE_DELETED; + case "plan.entitlement.updated": + return PLAN_ENTITLEMENT_UPDATED; + case "rule.deleted": + return RULE_DELETED; case "user.created": return USER_CREATED; case "feature.deleted": @@ -256,175 +266,193 @@ public static CreateWebhookRequestBodyRequestTypesItem valueOf(String value) { return PLAN_ENTITLEMENT_DELETED; case "user.deleted": return USER_DELETED; - case "plan.updated": - return PLAN_UPDATED; case "entitlement.limit.warning": return ENTITLEMENT_LIMIT_WARNING; + case "plan.updated": + return PLAN_UPDATED; case "credit.limit.warning": return CREDIT_LIMIT_WARNING; case "feature.created": return FEATURE_CREATED; case "entitlement.soft_limit.warning": return ENTITLEMENT_SOFT_LIMIT_WARNING; + case "company.plan_changed": + return COMPANY_PLAN_CHANGED; case "company.updated": return COMPANY_UPDATED; case "entitlement.tier_limit.reached": return ENTITLEMENT_TIER_LIMIT_REACHED; + case "company.override.expired": + return COMPANY_OVERRIDE_EXPIRED; case "flag.deleted": return FLAG_DELETED; case "company.created": return COMPANY_CREATED; - case "plan.entitlement.created": - return PLAN_ENTITLEMENT_CREATED; case "entitlement.tier_limit.warning": return ENTITLEMENT_TIER_LIMIT_WARNING; - case "company.plan_change": - return COMPANY_PLAN_CHANGE; + case "plan.entitlement.created": + return PLAN_ENTITLEMENT_CREATED; case "plan.created": return PLAN_CREATED; case "test.send": return TEST_SEND; default: - return new CreateWebhookRequestBodyRequestTypesItem(Value.UNKNOWN, value); + return new WebhookRequestType(Value.UNKNOWN, value); } } public enum Value { - COMPANY_UPDATED, + SUBSCRIPTION_TRIAL_ENDED, - USER_UPDATED, + COMPANY_CREATED, - PLAN_UPDATED, + COMPANY_DELETED, - PLAN_ENTITLEMENT_UPDATED, + COMPANY_OVERRIDE_CREATED, + + COMPANY_OVERRIDE_DELETED, + + COMPANY_OVERRIDE_EXPIRED, COMPANY_OVERRIDE_UPDATED, - FEATURE_UPDATED, + COMPANY_PLAN_CHANGED, - FLAG_UPDATED, + COMPANY_UPDATED, - FLAG_RULES_UPDATED, + CREDIT_LIMIT_REACHED, - COMPANY_CREATED, + CREDIT_LIMIT_WARNING, - USER_CREATED, + ENTITLEMENT_LIMIT_REACHED, - PLAN_CREATED, + ENTITLEMENT_LIMIT_WARNING, - PLAN_ENTITLEMENT_CREATED, + ENTITLEMENT_SOFT_LIMIT_REACHED, - COMPANY_OVERRIDE_CREATED, + ENTITLEMENT_SOFT_LIMIT_WARNING, + + ENTITLEMENT_TIER_LIMIT_REACHED, + + ENTITLEMENT_TIER_LIMIT_WARNING, FEATURE_CREATED, - FLAG_CREATED, + FEATURE_DELETED, - COMPANY_DELETED, + FEATURE_UPDATED, - USER_DELETED, + FLAG_CREATED, - PLAN_DELETED, + FLAG_DELETED, - PLAN_ENTITLEMENT_DELETED, + FLAG_RULES_UPDATED, - COMPANY_OVERRIDE_DELETED, + FLAG_UPDATED, - FEATURE_DELETED, + PLAN_CREATED, - FLAG_DELETED, + PLAN_DELETED, - TEST_SEND, + PLAN_ENTITLEMENT_CREATED, - SUBSCRIPTION_TRIAL_ENDED, + PLAN_ENTITLEMENT_DELETED, - ENTITLEMENT_LIMIT_WARNING, + PLAN_ENTITLEMENT_UPDATED, - ENTITLEMENT_LIMIT_REACHED, + PLAN_UPDATED, - ENTITLEMENT_SOFT_LIMIT_WARNING, + RULE_DELETED, - ENTITLEMENT_SOFT_LIMIT_REACHED, + TEST_SEND, - ENTITLEMENT_TIER_LIMIT_WARNING, + USER_CREATED, - ENTITLEMENT_TIER_LIMIT_REACHED, + USER_DELETED, - CREDIT_LIMIT_WARNING, + USER_UPDATED, - CREDIT_LIMIT_REACHED, + AUTO_TOPUP_HARD_FAILURE, - COMPANY_PLAN_CHANGE, + AUTO_TOPUP_RETRY_EXCEEDED, UNKNOWN } public interface Visitor { - T visitCompanyUpdated(); + T visitSubscriptionTrialEnded(); - T visitUserUpdated(); + T visitCompanyCreated(); - T visitPlanUpdated(); + T visitCompanyDeleted(); - T visitPlanEntitlementUpdated(); + T visitCompanyOverrideCreated(); + + T visitCompanyOverrideDeleted(); + + T visitCompanyOverrideExpired(); T visitCompanyOverrideUpdated(); - T visitFeatureUpdated(); + T visitCompanyPlanChanged(); - T visitFlagUpdated(); + T visitCompanyUpdated(); - T visitFlagRulesUpdated(); + T visitCreditLimitReached(); - T visitCompanyCreated(); + T visitCreditLimitWarning(); - T visitUserCreated(); + T visitEntitlementLimitReached(); - T visitPlanCreated(); + T visitEntitlementLimitWarning(); - T visitPlanEntitlementCreated(); + T visitEntitlementSoftLimitReached(); - T visitCompanyOverrideCreated(); + T visitEntitlementSoftLimitWarning(); + + T visitEntitlementTierLimitReached(); + + T visitEntitlementTierLimitWarning(); T visitFeatureCreated(); - T visitFlagCreated(); + T visitFeatureDeleted(); - T visitCompanyDeleted(); + T visitFeatureUpdated(); - T visitUserDeleted(); + T visitFlagCreated(); - T visitPlanDeleted(); + T visitFlagDeleted(); - T visitPlanEntitlementDeleted(); + T visitFlagRulesUpdated(); - T visitCompanyOverrideDeleted(); + T visitFlagUpdated(); - T visitFeatureDeleted(); + T visitPlanCreated(); - T visitFlagDeleted(); + T visitPlanDeleted(); - T visitTestSend(); + T visitPlanEntitlementCreated(); - T visitSubscriptionTrialEnded(); + T visitPlanEntitlementDeleted(); - T visitEntitlementLimitWarning(); + T visitPlanEntitlementUpdated(); - T visitEntitlementLimitReached(); + T visitPlanUpdated(); - T visitEntitlementSoftLimitWarning(); + T visitRuleDeleted(); - T visitEntitlementSoftLimitReached(); + T visitTestSend(); - T visitEntitlementTierLimitWarning(); + T visitUserCreated(); - T visitEntitlementTierLimitReached(); + T visitUserDeleted(); - T visitCreditLimitWarning(); + T visitUserUpdated(); - T visitCreditLimitReached(); + T visitAutoTopupHardFailure(); - T visitCompanyPlanChange(); + T visitAutoTopupRetryExceeded(); T visitUnknown(String unknownType); } diff --git a/src/main/java/com/schematic/api/types/WebhookResponseData.java b/src/main/java/com/schematic/api/types/WebhookResponseData.java index 1c800ae..59a9b16 100644 --- a/src/main/java/com/schematic/api/types/WebhookResponseData.java +++ b/src/main/java/com/schematic/api/types/WebhookResponseData.java @@ -34,11 +34,11 @@ public final class WebhookResponseData { private final String name; - private final List requestTypes; + private final List requestTypes; private final String secret; - private final String status; + private final WebhookStatus status; private final OffsetDateTime updatedAt; @@ -52,9 +52,9 @@ private WebhookResponseData( Optional> entitlementTriggerConfigs, String id, String name, - List requestTypes, + List requestTypes, String secret, - String status, + WebhookStatus status, OffsetDateTime updatedAt, String url, Map additionalProperties) { @@ -97,7 +97,7 @@ public String getName() { } @JsonProperty("request_types") - public List getRequestTypes() { + public List getRequestTypes() { return requestTypes; } @@ -107,7 +107,7 @@ public String getSecret() { } @JsonProperty("status") - public String getStatus() { + public WebhookStatus getStatus() { return status; } @@ -188,7 +188,7 @@ public interface SecretStage { } public interface StatusStage { - UpdatedAtStage status(@NotNull String status); + UpdatedAtStage status(@NotNull WebhookStatus status); } public interface UpdatedAtStage { @@ -210,11 +210,11 @@ public interface _FinalStage { _FinalStage entitlementTriggerConfigs(List entitlementTriggerConfigs); - _FinalStage requestTypes(List requestTypes); + _FinalStage requestTypes(List requestTypes); - _FinalStage addRequestTypes(String requestTypes); + _FinalStage addRequestTypes(WebhookRequestType requestTypes); - _FinalStage addAllRequestTypes(List requestTypes); + _FinalStage addAllRequestTypes(List requestTypes); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -235,13 +235,13 @@ public static final class Builder private String secret; - private String status; + private WebhookStatus status; private OffsetDateTime updatedAt; private String url; - private List requestTypes = new ArrayList<>(); + private List requestTypes = new ArrayList<>(); private Optional> entitlementTriggerConfigs = Optional.empty(); @@ -297,7 +297,7 @@ public StatusStage secret(@NotNull String secret) { @java.lang.Override @JsonSetter("status") - public UpdatedAtStage status(@NotNull String status) { + public UpdatedAtStage status(@NotNull WebhookStatus status) { this.status = Objects.requireNonNull(status, "status must not be null"); return this; } @@ -317,7 +317,7 @@ public _FinalStage url(@NotNull String url) { } @java.lang.Override - public _FinalStage addAllRequestTypes(List requestTypes) { + public _FinalStage addAllRequestTypes(List requestTypes) { if (requestTypes != null) { this.requestTypes.addAll(requestTypes); } @@ -325,14 +325,14 @@ public _FinalStage addAllRequestTypes(List requestTypes) { } @java.lang.Override - public _FinalStage addRequestTypes(String requestTypes) { + public _FinalStage addRequestTypes(WebhookRequestType requestTypes) { this.requestTypes.add(requestTypes); return this; } @java.lang.Override @JsonSetter(value = "request_types", nulls = Nulls.SKIP) - public _FinalStage requestTypes(List requestTypes) { + public _FinalStage requestTypes(List requestTypes) { this.requestTypes.clear(); if (requestTypes != null) { this.requestTypes.addAll(requestTypes); diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyStatus.java b/src/main/java/com/schematic/api/types/WebhookStatus.java similarity index 65% rename from src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyStatus.java rename to src/main/java/com/schematic/api/types/WebhookStatus.java index 0b973d7..75d6e02 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookRequestBodyStatus.java +++ b/src/main/java/com/schematic/api/types/WebhookStatus.java @@ -1,23 +1,21 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.webhooks.types; +package com.schematic.api.types; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -public final class UpdateWebhookRequestBodyStatus { - public static final UpdateWebhookRequestBodyStatus INACTIVE = - new UpdateWebhookRequestBodyStatus(Value.INACTIVE, "inactive"); +public final class WebhookStatus { + public static final WebhookStatus INACTIVE = new WebhookStatus(Value.INACTIVE, "inactive"); - public static final UpdateWebhookRequestBodyStatus ACTIVE = - new UpdateWebhookRequestBodyStatus(Value.ACTIVE, "active"); + public static final WebhookStatus ACTIVE = new WebhookStatus(Value.ACTIVE, "active"); private final Value value; private final String string; - UpdateWebhookRequestBodyStatus(Value value, String string) { + WebhookStatus(Value value, String string) { this.value = value; this.string = string; } @@ -35,8 +33,7 @@ public String toString() { @java.lang.Override public boolean equals(Object other) { return (this == other) - || (other instanceof UpdateWebhookRequestBodyStatus - && this.string.equals(((UpdateWebhookRequestBodyStatus) other).string)); + || (other instanceof WebhookStatus && this.string.equals(((WebhookStatus) other).string)); } @java.lang.Override @@ -57,14 +54,14 @@ public T visit(Visitor visitor) { } @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UpdateWebhookRequestBodyStatus valueOf(String value) { + public static WebhookStatus valueOf(String value) { switch (value) { case "inactive": return INACTIVE; case "active": return ACTIVE; default: - return new UpdateWebhookRequestBodyStatus(Value.UNKNOWN, value); + return new WebhookStatus(Value.UNKNOWN, value); } }