From 5f2b052b251a2de012c3f044a11708d5c9199674 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 19:19:59 +0000 Subject: [PATCH 1/2] SDK regeneration --- .fern/metadata.json | 16 + .github/workflows/ci.yml | 4 + build.gradle | 25 +- reference.md | 4232 ++++++++++------- .../com/schematic/api/AsyncBaseSchematic.java | 24 + .../api/AsyncBaseSchematicBuilder.java | 24 + .../schematic/api/AsyncRawBaseSchematic.java | 36 +- .../schematic/api/BaseSchematicBuilder.java | 24 + .../com/schematic/api/RawBaseSchematic.java | 36 +- .../api/core/BaseSchematicApiException.java | 4 +- .../com/schematic/api/core/ClientOptions.java | 48 +- .../com/schematic/api/core/ConsoleLogger.java | 51 + .../schematic/api/core/DoubleSerializer.java | 43 + .../java/com/schematic/api/core/ILogger.java | 38 + .../com/schematic/api/core/LogConfig.java | 98 + .../java/com/schematic/api/core/LogLevel.java | 36 + .../java/com/schematic/api/core/Logger.java | 97 + .../api/core/LoggingInterceptor.java | 104 + .../api/core/NullableNonemptyFilter.java | 5 +- .../com/schematic/api/core/ObjectMappers.java | 10 + .../schematic/api/core/RequestOptions.java | 41 +- .../api/core/Rfc2822DateTimeDeserializer.java | 25 + .../java/com/schematic/api/core/SseEvent.java | 114 + .../schematic/api/core/SseEventParser.java | 228 + .../java/com/schematic/api/core/Stream.java | 221 +- .../AsyncRawAccesstokensClient.java | 22 +- .../accesstokens/RawAccesstokensClient.java | 22 +- .../IssueTemporaryAccessTokenRequestBody.java | 16 + .../IssueTemporaryAccessTokenResponse.java | 16 + .../resources/accounts/AccountsClient.java | 66 +- .../accounts/AsyncAccountsClient.java | 69 +- .../accounts/AsyncRawAccountsClient.java | 712 ++- .../resources/accounts/RawAccountsClient.java | 618 +-- .../requests/CountApiKeysRequest.java | 48 +- .../requests/CountAuditLogsRequest.java | 89 +- .../requests/CreateApiKeyRequestBody.java | 52 +- .../CreateEnvironmentRequestBody.java | 16 + .../accounts/requests/ListApiKeysRequest.java | 48 +- .../requests/ListAuditLogsRequest.java | 89 +- .../requests/ListEnvironmentsRequest.java | 34 +- .../requests/UpdateApiKeyRequestBody.java | 10 + .../UpdateEnvironmentRequestBody.java | 10 + .../accounts/types/CountApiKeysParams.java | 34 +- .../accounts/types/CountApiKeysResponse.java | 16 + .../accounts/types/CountAuditLogsParams.java | 91 +- .../types/CountAuditLogsResponse.java | 16 + .../accounts/types/CreateApiKeyResponse.java | 16 + .../types/CreateEnvironmentResponse.java | 16 + .../accounts/types/DeleteApiKeyResponse.java | 16 + .../types/DeleteEnvironmentResponse.java | 16 + .../accounts/types/GetApiKeyResponse.java | 16 + .../accounts/types/GetAuditLogResponse.java | 16 + .../types/GetEnvironmentResponse.java | 16 + ...stResponse.java => GetWhoAmIResponse.java} | 50 +- .../accounts/types/ListApiKeysParams.java | 34 +- .../accounts/types/ListApiKeysResponse.java | 16 + .../accounts/types/ListAuditLogsParams.java | 91 +- .../accounts/types/ListAuditLogsResponse.java | 16 + .../types/ListEnvironmentsParams.java | 34 +- .../types/ListEnvironmentsResponse.java | 16 + .../accounts/types/QuickstartResponse.java | 16 + .../accounts/types/UpdateApiKeyResponse.java | 16 + .../types/UpdateEnvironmentResponse.java | 16 + .../resources/billing/AsyncBillingClient.java | 33 + .../billing/AsyncRawBillingClient.java | 420 +- .../api/resources/billing/BillingClient.java | 32 + .../resources/billing/RawBillingClient.java | 418 +- .../requests/CountBillingProductsRequest.java | 34 +- .../requests/CountCustomersRequest.java | 34 +- .../CreateBillingCustomerRequestBody.java | 16 + .../CreateBillingPriceRequestBody.java | 44 +- .../CreateBillingProductRequestBody.java | 60 +- .../CreateBillingSubscriptionRequestBody.java | 92 +- .../requests/CreateCouponRequestBody.java | 64 +- .../requests/CreateInvoiceRequestBody.java | 97 +- .../requests/CreateMeterRequestBody.java | 16 + .../CreatePaymentMethodRequestBody.java | 48 +- .../requests/ListBillingPricesRequest.java | 78 +- .../ListBillingProductPricesRequest.java | 78 +- .../requests/ListBillingProductsRequest.java | 34 +- .../billing/requests/ListCouponsRequest.java | 34 +- ...ListCustomersWithSubscriptionsRequest.java | 34 +- .../billing/requests/ListInvoicesRequest.java | 48 +- .../billing/requests/ListMetersRequest.java | 34 +- .../requests/ListPaymentMethodsRequest.java | 48 +- .../types/CountBillingProductsParams.java | 34 +- .../types/CountBillingProductsResponse.java | 16 + .../billing/types/CountCustomersParams.java | 34 +- .../billing/types/CountCustomersResponse.java | 16 + .../types/DeleteBillingProductResponse.java | 16 + .../types/DeleteProductPriceResponse.java | 16 + .../types/ListBillingPricesParams.java | 80 +- .../types/ListBillingPricesResponse.java | 16 + .../types/ListBillingProductPricesParams.java | 80 +- .../ListBillingProductPricesResponse.java | 16 + .../types/ListBillingProductsParams.java | 34 +- .../types/ListBillingProductsResponse.java | 16 + .../billing/types/ListCouponsParams.java | 34 +- .../billing/types/ListCouponsResponse.java | 16 + .../ListCustomersWithSubscriptionsParams.java | 34 +- ...istCustomersWithSubscriptionsResponse.java | 16 + .../billing/types/ListInvoicesParams.java | 34 +- .../billing/types/ListInvoicesResponse.java | 16 + .../billing/types/ListMetersParams.java | 34 +- .../billing/types/ListMetersResponse.java | 16 + .../types/ListPaymentMethodsParams.java | 34 +- .../types/ListPaymentMethodsResponse.java | 16 + .../types/UpsertBillingCouponResponse.java | 16 + .../types/UpsertBillingCustomerResponse.java | 16 + .../types/UpsertBillingMeterResponse.java | 16 + .../types/UpsertBillingPriceResponse.java | 16 + .../types/UpsertBillingProductResponse.java | 16 + .../UpsertBillingSubscriptionResponse.java | 16 + .../billing/types/UpsertInvoiceResponse.java | 16 + .../types/UpsertPaymentMethodResponse.java | 16 + .../checkout/AsyncCheckoutClient.java | 7 + .../checkout/AsyncRawCheckoutClient.java | 162 +- .../resources/checkout/CheckoutClient.java | 7 + .../resources/checkout/RawCheckoutClient.java | 161 +- .../requests/CancelSubscriptionRequest.java | 16 + .../requests/CheckoutDataRequestBody.java | 16 + .../requests/UpdateTrialEndRequestBody.java | 10 + .../types/CancelSubscriptionResponse.java | 16 + .../types/CheckoutInternalResponse.java | 16 + .../types/GetCheckoutDataResponse.java | 16 + .../checkout/types/ManagePlanResponse.java | 16 + .../PreviewCheckoutInternalResponse.java | 16 + .../types/PreviewManagePlanResponse.java | 16 + ...eCustomerSubscriptionTrialEndResponse.java | 16 + .../companies/AsyncCompaniesClient.java | 114 +- .../companies/AsyncRawCompaniesClient.java | 1277 +++-- .../resources/companies/CompaniesClient.java | 110 +- .../companies/RawCompaniesClient.java | 1140 ++--- ...ountCompaniesForAdvancedFilterRequest.java | 595 --- .../requests/CountCompaniesRequest.java | 98 +- .../CountEntityKeyDefinitionsRequest.java | 34 +- .../CountEntityTraitDefinitionsRequest.java | 34 +- .../requests/CountPlanTraitsRequest.java | 34 +- .../companies/requests/CountUsersRequest.java | 34 +- ...reateEntityTraitDefinitionRequestBody.java | 16 + .../requests/CreatePlanTraitRequestBody.java | 16 + .../requests/DeleteCompanyRequest.java | 10 + .../GetActiveCompanySubscriptionRequest.java | 34 +- .../requests/GetEntityTraitValuesRequest.java | 48 +- ...tOrCreateCompanyMembershipRequestBody.java | 16 + ...ListCompaniesForAdvancedFilterRequest.java | 595 --- .../requests/ListCompaniesRequest.java | 98 +- .../ListCompanyMembershipsRequest.java | 34 +- .../ListEntityKeyDefinitionsRequest.java | 34 +- .../ListEntityTraitDefinitionsRequest.java | 34 +- .../requests/ListPlanChangesRequest.java | 34 +- .../requests/ListPlanTraitsRequest.java | 34 +- .../companies/requests/ListUsersRequest.java | 34 +- .../requests/LookupCompanyRequest.java | 10 + .../companies/requests/LookupUserRequest.java | 10 + ...pdateEntityTraitDefinitionRequestBody.java | 16 + .../UpdatePlanTraitBulkRequestBody.java | 16 + .../requests/UpdatePlanTraitRequestBody.java | 16 + ...CountCompaniesForAdvancedFilterParams.java | 553 --- .../companies/types/CountCompaniesParams.java | 104 +- .../types/CountCompaniesResponse.java | 16 + .../CountEntityKeyDefinitionsParams.java | 34 +- .../CountEntityKeyDefinitionsResponse.java | 16 + .../CountEntityTraitDefinitionsParams.java | 34 +- .../CountEntityTraitDefinitionsResponse.java | 16 + .../types/CountPlanTraitsParams.java | 34 +- .../types/CountPlanTraitsResponse.java | 16 + .../companies/types/CountUsersParams.java | 34 +- .../companies/types/CountUsersResponse.java | 16 + .../types/CreateCompanyResponse.java | 16 + .../types/CreatePlanTraitResponse.java | 16 + .../companies/types/CreateUserResponse.java | 16 + .../types/DeleteCompanyByKeysResponse.java | 16 + .../DeleteCompanyMembershipResponse.java | 16 + .../companies/types/DeleteCompanyParams.java | 10 + .../types/DeleteCompanyResponse.java | 16 + .../types/DeletePlanTraitResponse.java | 16 + .../types/DeleteUserByKeysResponse.java | 16 + .../companies/types/DeleteUserResponse.java | 16 + .../GetActiveCompanySubscriptionParams.java | 34 +- .../GetActiveCompanySubscriptionResponse.java | 16 + .../companies/types/GetCompanyResponse.java | 16 + .../GetEntityTraitDefinitionResponse.java | 16 + .../types/GetEntityTraitValuesParams.java | 34 +- .../types/GetEntityTraitValuesResponse.java | 16 + .../GetOrCreateCompanyMembershipResponse.java | 16 + ...OrCreateEntityTraitDefinitionResponse.java | 16 + .../types/GetPlanChangeResponse.java | 16 + .../companies/types/GetPlanTraitResponse.java | 16 + .../companies/types/GetUserResponse.java | 16 + .../ListCompaniesForAdvancedFilterParams.java | 553 --- .../companies/types/ListCompaniesParams.java | 104 +- .../types/ListCompaniesResponse.java | 16 + .../types/ListCompanyMembershipsParams.java | 34 +- .../types/ListCompanyMembershipsResponse.java | 16 + .../types/ListEntityKeyDefinitionsParams.java | 34 +- .../ListEntityKeyDefinitionsResponse.java | 16 + .../ListEntityTraitDefinitionsParams.java | 34 +- .../ListEntityTraitDefinitionsResponse.java | 16 + .../types/ListPlanChangesParams.java | 34 +- .../types/ListPlanChangesResponse.java | 16 + .../companies/types/ListPlanTraitsParams.java | 34 +- .../types/ListPlanTraitsResponse.java | 16 + .../companies/types/ListUsersParams.java | 34 +- .../companies/types/ListUsersResponse.java | 16 + .../companies/types/LookupCompanyParams.java | 10 + .../types/LookupCompanyResponse.java | 16 + .../companies/types/LookupUserParams.java | 10 + .../companies/types/LookupUserResponse.java | 16 + .../UpdateEntityTraitDefinitionResponse.java | 16 + .../types/UpdatePlanTraitResponse.java | 16 + .../types/UpdatePlanTraitsBulkResponse.java | 10 + .../types/UpsertCompanyResponse.java | 16 + .../types/UpsertCompanyTraitResponse.java | 16 + .../companies/types/UpsertUserResponse.java | 16 + .../types/UpsertUserTraitResponse.java | 16 + .../components/AsyncComponentsClient.java | 17 + .../components/AsyncRawComponentsClient.java | 158 +- .../components/ComponentsClient.java | 16 + .../components/RawComponentsClient.java | 151 +- .../requests/CountComponentsRequest.java | 35 +- .../requests/CreateComponentRequestBody.java | 16 + .../requests/ListComponentsRequest.java | 35 +- .../requests/PreviewComponentDataRequest.java | 10 + .../requests/UpdateComponentRequestBody.java | 10 + .../types/CountComponentsParams.java | 35 +- .../types/CountComponentsResponse.java | 16 + .../types/CreateComponentResponse.java | 16 + .../types/DeleteComponentResponse.java | 16 + .../types/GetComponentResponse.java | 16 + .../types/ListComponentsParams.java | 35 +- .../types/ListComponentsResponse.java | 16 + .../types/PreviewComponentDataParams.java | 10 + .../types/PreviewComponentDataResponse.java | 16 + .../types/UpdateComponentResponse.java | 16 + .../AsyncComponentspublicClient.java | 35 + .../AsyncRawComponentspublicClient.java | 116 + .../ComponentspublicClient.java | 34 + .../RawComponentspublicClient.java | 90 + .../types/GetPublicPlansResponse.java | 181 + .../resources/credits/AsyncCreditsClient.java | 78 + .../credits/AsyncRawCreditsClient.java | 772 ++- .../api/resources/credits/CreditsClient.java | 73 + .../resources/credits/RawCreditsClient.java | 719 ++- .../CountBillingCreditsGrantsRequest.java | 34 +- .../requests/CountBillingCreditsRequest.java | 34 +- .../CountBillingPlanCreditGrantsRequest.java | 119 +- .../requests/CountCompanyGrantsRequest.java | 34 +- .../requests/CountCreditBundlesRequest.java | 34 +- .../CountCreditEventLedgerRequest.java | 376 ++ .../requests/CountCreditLedgerRequest.java | 48 +- .../CreateBillingCreditRequestBody.java | 82 +- .../requests/CreateCompanyCreditGrant.java | 92 +- .../CreateCreditBundleRequestBody.java | 94 +- .../DeleteBillingPlanCreditGrantRequest.java | 10 + .../GetEnrichedCreditLedgerRequest.java | 48 +- .../requests/ListBillingCreditsRequest.java | 34 +- .../ListBillingPlanCreditGrantsRequest.java | 119 +- .../requests/ListCompanyGrantsRequest.java | 34 +- .../requests/ListCreditBundlesRequest.java | 34 +- .../ListCreditEventLedgerRequest.java | 376 ++ .../requests/ListGrantsForCreditRequest.java | 34 +- .../UpdateBillingCreditRequestBody.java | 82 +- .../UpdateCreditBundleDetailsRequestBody.java | 94 +- .../requests/ZeroOutGrantRequestBody.java | 10 + .../CountBillingCreditsGrantsParams.java | 34 +- .../CountBillingCreditsGrantsResponse.java | 16 + .../types/CountBillingCreditsParams.java | 34 +- .../types/CountBillingCreditsResponse.java | 16 + .../CountBillingPlanCreditGrantsParams.java | 65 +- .../CountBillingPlanCreditGrantsResponse.java | 16 + .../types/CountCompanyGrantsParams.java | 34 +- .../types/CountCompanyGrantsResponse.java | 16 + .../types/CountCreditBundlesParams.java | 34 +- .../types/CountCreditBundlesResponse.java | 16 + .../types/CountCreditEventLedgerParams.java | 305 ++ .../CountCreditEventLedgerResponse.java} | 53 +- .../types/CountCreditLedgerParams.java | 34 +- .../types/CountCreditLedgerResponse.java | 16 + .../types/CreateBillingCreditResponse.java | 16 + .../CreateBillingPlanCreditGrantResponse.java | 16 + .../types/CreateCreditBundleResponse.java | 16 + .../DeleteBillingPlanCreditGrantParams.java | 10 + .../DeleteBillingPlanCreditGrantResponse.java | 16 + .../types/DeleteCreditBundleResponse.java | 16 + .../types/GetCreditBundleResponse.java | 16 + .../types/GetEnrichedCreditLedgerParams.java | 34 +- .../GetEnrichedCreditLedgerResponse.java | 16 + .../types/GetSingleBillingCreditResponse.java | 16 + .../GrantBillingCreditsToCompanyResponse.java | 16 + .../types/ListBillingCreditsParams.java | 34 +- .../types/ListBillingCreditsResponse.java | 16 + .../ListBillingPlanCreditGrantsParams.java | 65 +- .../ListBillingPlanCreditGrantsResponse.java | 16 + .../types/ListCompanyGrantsParams.java | 34 +- .../types/ListCompanyGrantsResponse.java | 16 + .../types/ListCreditBundlesParams.java | 34 +- .../types/ListCreditBundlesResponse.java | 16 + .../types/ListCreditEventLedgerParams.java | 305 ++ .../types/ListCreditEventLedgerResponse.java} | 72 +- .../types/ListGrantsForCreditParams.java | 34 +- .../types/ListGrantsForCreditResponse.java | 16 + .../SoftDeleteBillingCreditResponse.java | 16 + .../types/UpdateBillingCreditResponse.java | 16 + .../UpdateBillingPlanCreditGrantResponse.java | 16 + .../UpdateCreditBundleDetailsResponse.java | 16 + .../credits/types/ZeroOutGrantResponse.java | 16 + .../AsyncRawDataexportsClient.java | 41 +- .../dataexports/RawDataexportsClient.java | 40 +- .../requests/CreateDataExportRequestBody.java | 16 + .../types/CreateDataExportResponse.java | 16 + .../entitlements/AsyncEntitlementsClient.java | 24 + .../AsyncRawEntitlementsClient.java | 410 +- .../entitlements/EntitlementsClient.java | 24 + .../entitlements/RawEntitlementsClient.java | 405 +- .../CountCompanyOverridesRequest.java | 34 +- .../CountFeatureCompaniesRequest.java | 48 +- .../requests/CountFeatureUsageRequest.java | 34 +- .../requests/CountFeatureUsersRequest.java | 48 +- .../CountPlanEntitlementsRequest.java | 34 +- .../CreateCompanyOverrideRequestBody.java | 32 +- .../CreatePlanEntitlementRequestBody.java | 128 +- .../DuplicatePlanEntitlementsRequestBody.java | 16 + .../GetFeatureUsageByCompanyRequest.java | 10 + .../GetFeatureUsageTimeSeriesRequest.java | 16 + .../requests/ListCompanyOverridesRequest.java | 34 +- .../requests/ListFeatureCompaniesRequest.java | 48 +- .../requests/ListFeatureUsageRequest.java | 34 +- .../requests/ListFeatureUsersRequest.java | 48 +- .../requests/ListPlanEntitlementsRequest.java | 34 +- .../UpdateCompanyOverrideRequestBody.java | 32 +- .../UpdatePlanEntitlementRequestBody.java | 96 +- .../types/CountCompanyOverridesParams.java | 34 +- .../types/CountCompanyOverridesResponse.java | 16 + .../types/CountFeatureCompaniesParams.java | 34 +- .../types/CountFeatureCompaniesResponse.java | 16 + .../types/CountFeatureUsageParams.java | 34 +- .../types/CountFeatureUsageResponse.java | 16 + .../types/CountFeatureUsersParams.java | 34 +- .../types/CountFeatureUsersResponse.java | 16 + .../types/CountPlanEntitlementsParams.java | 34 +- .../types/CountPlanEntitlementsResponse.java | 16 + .../types/CreateCompanyOverrideResponse.java | 16 + .../types/CreatePlanEntitlementResponse.java | 16 + .../types/DeleteCompanyOverrideResponse.java | 16 + .../types/DeletePlanEntitlementResponse.java | 16 + .../DuplicatePlanEntitlementsResponse.java | 16 + .../types/GetCompanyOverrideResponse.java | 16 + .../types/GetFeatureUsageByCompanyParams.java | 10 + .../GetFeatureUsageByCompanyResponse.java | 16 + .../GetFeatureUsageTimeSeriesParams.java | 10 + .../GetFeatureUsageTimeSeriesResponse.java | 16 + .../types/GetPlanEntitlementResponse.java | 16 + .../types/ListCompanyOverridesParams.java | 34 +- .../types/ListCompanyOverridesResponse.java | 16 + .../types/ListFeatureCompaniesParams.java | 34 +- .../types/ListFeatureCompaniesResponse.java | 16 + .../types/ListFeatureUsageParams.java | 34 +- .../types/ListFeatureUsageResponse.java | 16 + .../types/ListFeatureUsersParams.java | 34 +- .../types/ListFeatureUsersResponse.java | 16 + .../types/ListPlanEntitlementsParams.java | 34 +- .../types/ListPlanEntitlementsResponse.java | 16 + .../types/UpdateCompanyOverrideResponse.java | 16 + .../types/UpdatePlanEntitlementResponse.java | 16 + .../resources/events/AsyncEventsClient.java | 8 + .../events/AsyncRawEventsClient.java | 128 +- .../api/resources/events/EventsClient.java | 8 + .../api/resources/events/RawEventsClient.java | 127 +- .../requests/CreateEventBatchRequestBody.java | 10 + .../requests/GetEventSummariesRequest.java | 34 +- .../events/requests/ListEventsRequest.java | 34 +- .../types/CreateEventBatchResponse.java | 16 + .../events/types/CreateEventResponse.java | 16 + .../events/types/GetEventResponse.java | 16 + .../events/types/GetEventSummariesParams.java | 34 +- .../types/GetEventSummariesResponse.java | 16 + .../GetSegmentIntegrationStatusResponse.java | 16 + .../events/types/ListEventsParams.java | 34 +- .../events/types/ListEventsResponse.java | 16 + .../features/AsyncFeaturesClient.java | 28 + .../features/AsyncRawFeaturesClient.java | 366 +- .../resources/features/FeaturesClient.java | 28 + .../resources/features/RawFeaturesClient.java | 366 +- .../requests/CheckFlagsBulkRequestBody.java | 10 + .../requests/CountFeaturesRequest.java | 66 +- .../features/requests/CountFlagsRequest.java | 34 +- .../requests/CreateFeatureRequestBody.java | 16 + .../requests/ListFeaturesRequest.java | 66 +- .../features/requests/ListFlagsRequest.java | 34 +- .../requests/UpdateFeatureRequestBody.java | 10 + .../requests/UpdateFlagRulesRequestBody.java | 10 + .../features/types/CheckFlagResponse.java | 16 + .../types/CheckFlagsBulkResponse.java | 16 + .../features/types/CheckFlagsResponse.java | 16 + .../features/types/CountFeaturesParams.java | 66 +- .../features/types/CountFeaturesResponse.java | 16 + .../features/types/CountFlagsParams.java | 34 +- .../features/types/CountFlagsResponse.java | 16 + .../features/types/CreateFeatureResponse.java | 16 + .../features/types/CreateFlagResponse.java | 16 + .../features/types/DeleteFeatureResponse.java | 16 + .../features/types/DeleteFlagResponse.java | 16 + .../features/types/GetFeatureResponse.java | 16 + .../features/types/GetFlagResponse.java | 16 + .../features/types/ListFeaturesParams.java | 66 +- .../features/types/ListFeaturesResponse.java | 16 + .../features/types/ListFlagsParams.java | 34 +- .../features/types/ListFlagsResponse.java | 16 + .../features/types/UpdateFeatureResponse.java | 16 + .../features/types/UpdateFlagResponse.java | 16 + .../types/UpdateFlagRulesResponse.java | 16 + .../planbundle/AsyncRawPlanbundleClient.java | 46 +- .../planbundle/RawPlanbundleClient.java | 44 +- .../requests/CreatePlanBundleRequestBody.java | 10 + .../requests/UpdatePlanBundleRequestBody.java | 39 +- .../types/CreatePlanBundleResponse.java | 16 + .../types/UpdatePlanBundleResponse.java | 16 + .../plangroups/AsyncPlangroupsClient.java | 10 + .../plangroups/AsyncRawPlangroupsClient.java | 95 +- .../plangroups/PlangroupsClient.java | 9 + .../plangroups/RawPlangroupsClient.java | 93 +- .../requests/CreatePlanGroupRequestBody.java | 63 +- .../requests/GetPlanGroupRequest.java | 105 + .../requests/UpdatePlanGroupRequestBody.java | 63 +- .../types/CreatePlanGroupResponse.java | 16 + .../plangroups/types/GetPlanGroupParams.java | 105 + .../types/GetPlanGroupResponse.java | 64 +- .../types/UpdatePlanGroupResponse.java | 16 + .../AsyncPlanmigrationsClient.java | 116 + .../AsyncRawPlanmigrationsClient.java | 576 +++ .../planmigrations/PlanmigrationsClient.java | 110 + .../RawPlanmigrationsClient.java | 451 ++ .../CountCompanyMigrationsRequest.java} | 131 +- .../requests/CountMigrationsRequest.java | 192 + .../ListCompanyMigrationsRequest.java} | 131 +- .../requests/ListMigrationsRequest.java | 192 + .../types/CountCompanyMigrationsParams.java} | 129 +- .../types/CountCompanyMigrationsResponse.java | 153 + .../types/CountMigrationsParams.java | 192 + .../types/CountMigrationsResponse.java} | 50 +- .../types/GetMigrationResponse.java | 183 + .../types/ListCompanyMigrationsParams.java} | 129 +- .../types/ListCompanyMigrationsResponse.java} | 73 +- .../types/ListMigrationsParams.java | 192 + .../types/ListMigrationsResponse.java | 177 + .../api/resources/plans/AsyncPlansClient.java | 53 + .../resources/plans/AsyncRawPlansClient.java | 426 +- .../api/resources/plans/PlansClient.java | 49 + .../api/resources/plans/RawPlansClient.java | 379 +- .../plans/requests/CountPlansRequest.java | 66 +- .../requests/DeletePlanVersionRequest.java | 106 + .../plans/requests/GetPlanRequest.java | 111 + .../plans/requests/ListPlanIssuesRequest.java | 55 +- .../plans/requests/ListPlansRequest.java | 66 +- .../PublishPlanVersionRequestBody.java | 166 + .../UpdateCompanyPlansRequestBody.java | 10 + .../plans/types/CountPlansParams.java | 72 +- .../plans/types/CountPlansResponse.java | 16 + .../plans/types/CreatePlanResponse.java | 16 + .../plans/types/DeletePlanResponse.java | 16 + .../plans/types/DeletePlanVersionParams.java | 106 + .../types/DeletePlanVersionResponse.java | 153 + .../resources/plans/types/GetPlanParams.java | 111 + .../plans/types/GetPlanResponse.java | 64 +- .../plans/types/ListPlanIssuesParams.java | 41 +- .../plans/types/ListPlanIssuesResponse.java | 16 + .../plans/types/ListPlansParams.java | 72 +- .../plans/types/ListPlansResponse.java | 16 + .../types/PublishPlanVersionResponse.java | 181 + .../types/UpdateCompanyPlansResponse.java | 16 + .../plans/types/UpdatePlanResponse.java | 16 + .../UpsertBillingProductPlanResponse.java | 16 + .../AsyncRawScheduledcheckoutClient.java | 443 ++ .../AsyncScheduledcheckoutClient.java | 97 + .../RawScheduledcheckoutClient.java | 342 ++ .../ScheduledcheckoutClient.java | 94 + .../CreateScheduledCheckoutRequest.java | 195 + .../ListScheduledCheckoutsRequest.java | 192 + .../UpdateScheduledCheckoutRequest.java | 132 + .../CreateScheduledCheckoutResponse.java | 183 + .../types/GetScheduledCheckoutResponse.java | 183 + .../types/ListScheduledCheckoutsParams.java | 192 + .../types/ListScheduledCheckoutsResponse.java | 177 + .../UpdateScheduledCheckoutResponse.java | 183 + .../webhooks/AsyncRawWebhooksClient.java | 196 +- .../webhooks/AsyncWebhooksClient.java | 20 + .../resources/webhooks/RawWebhooksClient.java | 196 +- .../resources/webhooks/WebhooksClient.java | 20 + .../requests/CountWebhookEventsRequest.java | 34 +- .../requests/CountWebhooksRequest.java | 35 +- .../requests/CreateWebhookRequestBody.java | 16 + .../requests/ListWebhookEventsRequest.java | 34 +- .../requests/ListWebhooksRequest.java | 35 +- .../requests/UpdateWebhookRequestBody.java | 10 + .../types/CountWebhookEventsParams.java | 34 +- .../types/CountWebhookEventsResponse.java | 16 + .../webhooks/types/CountWebhooksParams.java | 35 +- .../webhooks/types/CountWebhooksResponse.java | 16 + .../webhooks/types/CreateWebhookResponse.java | 16 + .../webhooks/types/DeleteWebhookResponse.java | 16 + .../types/GetWebhookEventResponse.java | 16 + .../webhooks/types/GetWebhookResponse.java | 16 + .../types/ListWebhookEventsParams.java | 34 +- .../types/ListWebhookEventsResponse.java | 16 + .../webhooks/types/ListWebhooksParams.java | 35 +- .../webhooks/types/ListWebhooksResponse.java | 16 + .../webhooks/types/UpdateWebhookResponse.java | 16 + .../com/schematic/api/types/ActorType.java | 10 + .../com/schematic/api/types/ApiError.java | 16 + .../api/types/ApiKeyCreateResponseData.java | 48 +- .../types/ApiKeyRequestListResponseData.java | 567 --- .../api/types/ApiKeyRequestResponseData.java | 695 --- .../api/types/ApiKeyResponseData.java | 49 +- .../api/types/AuditLogListResponseData.java | 48 +- .../api/types/AuditLogResponseData.java | 48 +- .../api/types/BillingCouponResponseData.java | 76 +- .../BillingCreditBundleResponseData.java | 95 +- .../api/types/BillingCreditBundleView.java | 111 +- .../types/BillingCreditGrantResponseData.java | 60 +- .../BillingCreditLedgerResponseData.java | 16 + .../api/types/BillingCreditResponseData.java | 110 +- .../api/types/BillingCreditView.java | 655 +++ .../types/BillingCustomerResponseData.java | 16 + .../types/BillingCustomerSubscription.java | 40 +- ...CustomerWithSubscriptionsResponseData.java | 16 + .../api/types/BillingMeterResponseData.java | 16 + .../BillingPlanCreditGrantResponseData.java | 275 +- .../api/types/BillingPriceResponseData.java | 28 +- .../schematic/api/types/BillingPriceView.java | 40 +- .../BillingProductDetailResponseData.java | 28 +- ...ingProductForSubscriptionResponseData.java | 56 +- .../types/BillingProductPlanResponseData.java | 32 +- .../BillingProductPriceResponseData.java | 40 +- .../BillingProductPriceTierResponseData.java | 46 +- .../api/types/BillingProductPricing.java | 72 +- .../api/types/BillingProductResponseData.java | 16 + .../types/BillingSubscriptionDiscount.java | 16 + .../BillingSubscriptionDiscountView.java | 48 +- .../BillingSubscriptionResponseData.java | 84 +- .../api/types/BillingSubscriptionView.java | 84 +- .../schematic/api/types/CaptureRawEvent.java | 226 + .../api/types/CaptureRawEventBatch.java | 116 + ...ChangeSubscriptionInternalRequestBody.java | 16 + .../types/ChangeSubscriptionRequestBody.java | 16 + .../api/types/CheckFlagRequestBody.java | 10 + .../api/types/CheckFlagResponseData.java | 133 +- .../api/types/CheckFlagsBulkResponseData.java | 10 + .../api/types/CheckFlagsResponseData.java | 44 +- .../api/types/CheckoutDataResponseData.java | 10 + .../types/CheckoutSettingsResponseData.java | 16 + .../api/types/CheckoutSubscription.java | 84 +- .../api/types/CompanyDetailResponseData.java | 60 +- ...CompanyEventPeriodMetricsResponseData.java | 28 +- .../api/types/CompanyLedgerResponseData.java | 16 + .../CompanyMembershipDetailResponseData.java | 16 + .../types/CompanyMembershipResponseData.java | 16 + .../CompanyOverrideNoteResponseData.java | 16 + .../types/CompanyOverrideResponseData.java | 32 +- .../types/CompanyPlanDetailResponseData.java | 155 +- .../types/CompanyPlanWithBillingSubView.java | 32 +- .../api/types/CompanyResponseData.java | 16 + .../CompanySubscriptionResponseData.java | 28 +- ...mpanyViewWithFeatureUsageResponseData.java | 938 ---- .../schematic/api/types/CompatiblePlans.java | 16 + .../types/CompatiblePlansResponseData.java | 16 + .../api/types/ComponentCapabilities.java | 16 + .../api/types/ComponentCheckoutSettings.java | 16 + .../api/types/ComponentDisplaySettings.java | 47 +- .../types/ComponentHydrateResponseData.java | 48 + .../types/ComponentPreviewResponseData.java | 48 + .../api/types/ComponentResponseData.java | 16 + .../types/ComponentSettingsResponseData.java | 47 +- .../com/schematic/api/types/Condition.java | 32 +- .../schematic/api/types/ConditionGroup.java | 10 + .../api/types/ConditionGroupResponseData.java | 65 +- .../api/types/ConditionGroupView.java | 48 +- .../api/types/ConditionResponseData.java | 76 +- .../schematic/api/types/ConditionView.java | 76 +- .../schematic/api/types/CountResponse.java | 10 + .../api/types/CouponRequestBody.java | 64 +- ...eateBillingPlanCreditGrantRequestBody.java | 124 +- .../CreateBillingPriceTierRequestBody.java | 64 +- .../CreateEntitlementInBundleRequestBody.java | 160 +- .../api/types/CreateEntitlementReqCommon.java | 32 +- .../api/types/CreateEventRequestBody.java | 27 + .../api/types/CreateFlagRequestBody.java | 16 + ...eateOrUpdateConditionGroupRequestBody.java | 10 + .../CreateOrUpdateConditionRequestBody.java | 32 +- .../types/CreateOrUpdateFlagRequestBody.java | 16 + .../types/CreateOrUpdateRuleRequestBody.java | 28 +- .../api/types/CreatePlanRequestBody.java | 16 + .../api/types/CreatePriceTierRequestBody.java | 46 +- .../api/types/CreditBundleCurrencyPrice.java | 149 + .../CreditBundleCurrencyPriceRequestBody.java | 184 + ...CreditBundleCurrencyPriceResponseData.java | 150 + .../CreditBundlePurchaseResponseData.java | 40 +- .../api/types/CreditCompanyGrantView.java | 76 +- .../types/CreditCurrencyPriceRequestBody.java | 183 + .../CreditCurrencyPriceResponseData.java | 149 + .../types/CreditEventLedgerResponseData.java | 1048 ++++ .../schematic/api/types/CreditEventType.java | 103 + .../api/types/CreditGrantDetail.java | 16 + .../types/CreditGrantExpiryRequestBody.java | 32 +- ...CreditLedgerEnrichedEntryResponseData.java | 136 +- .../api/types/CreditTransferResponseData.java | 16 + .../api/types/CreditTransferView.java | 16 + .../api/types/CreditTriggerConfig.java | 16 + .../com/schematic/api/types/CreditUsage.java | 10 + .../api/types/CreditUsageAggregation.java | 10 + .../api/types/CreditUsageResponseData.java | 300 -- .../types/CreditsAutoTopupCompanySummary.java | 16 + .../types/CreditsAutoTopupCreditSummary.java | 16 + .../types/CreditsAutoTopupHardFailure.java | 10 + .../types/CreditsAutoTopupRetryFailure.java | 28 +- .../schematic/api/types/CustomPlanConfig.java | 16 + .../CustomPlanViewConfigResponseData.java | 16 + .../schematic/api/types/DataEventPayload.java | 208 + .../api/types/DataExportResponseData.java | 16 + .../api/types/DatastreamCompanyPlan.java | 172 + ...leteBillingPlanCreditGrantRequestBody.java | 10 + .../schematic/api/types/DeleteResponse.java | 10 + ...ePlanEntitlementsResponseResponseData.java | 10 + ...EntitlementCurrencyPricesResponseData.java | 183 + .../api/types/EntitlementTriggerConfig.java | 16 + .../api/types/EntitlementsInPlan.java | 16 + .../EntityKeyDefinitionResponseData.java | 16 + .../types/EntityKeyDetailResponseData.java | 16 + .../api/types/EntityKeyResponseData.java | 16 + .../EntityTraitDefinitionResponseData.java | 16 + .../types/EntityTraitDetailResponseData.java | 16 + .../api/types/EntityTraitResponseData.java | 16 + .../schematic/api/types/EntityTraitValue.java | 16 + .../types/EnvironmentDetailResponseData.java | 16 + .../api/types/EnvironmentResponseData.java | 16 + .../api/types/EventBodyFlagCheck.java | 16 + .../api/types/EventBodyIdentify.java | 10 + .../api/types/EventBodyIdentifyCompany.java | 10 + .../schematic/api/types/EventBodyTrack.java | 16 + .../api/types/EventDetailResponseData.java | 28 +- .../api/types/EventResponseData.java | 28 +- .../api/types/EventSummaryResponseData.java | 52 +- .../api/types/FeatureCompanyResponseData.java | 133 +- .../types/FeatureCompanyUserResponseData.java | 59 +- .../api/types/FeatureDetailResponseData.java | 16 + .../api/types/FeatureEntitlement.java | 75 +- .../api/types/FeatureLedgerResponseData.java | 16 + .../api/types/FeatureResponseData.java | 16 + .../types/FeatureUsageDataResponseData.java | 553 --- .../types/FeatureUsageDetailResponseData.java | 10 + .../types/FeatureUsageLegacyResponseData.java | 48 +- .../api/types/FeatureUsageResponseData.java | 133 +- .../FeatureUsageTimeSeriesResponseData.java | 16 + .../com/schematic/api/types/FeatureView.java | 16 + .../api/types/FlagDetailResponseData.java | 16 + .../schematic/api/types/FlagResponseData.java | 16 + .../com/schematic/api/types/FlagView.java | 16 + .../api/types/GenericPreviewObject.java | 16 + .../api/types/InvoiceRequestBody.java | 96 +- .../api/types/InvoiceResponseData.java | 96 +- .../schematic/api/types/InvoiceStatus.java | 113 + ...IssueTemporaryAccessTokenResponseData.java | 16 + .../schematic/api/types/KeysRequestBody.java | 10 + .../LimitTimeSeriesPointResponseData.java | 32 +- ...ManagePlanPreviewResponseResponseData.java | 10 + .../api/types/ManagePlanRequest.java | 48 + .../types/ManagePlanResponseResponseData.java | 16 + .../schematic/api/types/MeterRequestBody.java | 16 + .../api/types/OrderedPlansInGroup.java | 16 + .../api/types/PaymentMethodRequestBody.java | 48 +- .../api/types/PaymentMethodResponseData.java | 48 +- .../PlanBundleCreditGrantRequestBody.java | 16 + .../PlanBundleEntitlementRequestBody.java | 16 + .../api/types/PlanBundleResponseData.java | 10 + .../schematic/api/types/PlanChangeAction.java | 11 + .../api/types/PlanChangeResponseData.java | 168 +- .../api/types/PlanCreditGrantView.java | 300 +- .../types/PlanCurrencyPriceRequestBody.java | 213 + .../types/PlanCurrencyPricesResponseData.java | 213 + .../api/types/PlanDetailResponseData.java | 155 +- .../types/PlanEntitlementResponseData.java | 111 +- .../api/types/PlanEntitlementsOrder.java | 16 + .../api/types/PlanGroupBundleOrder.java | 16 + .../types/PlanGroupDetailResponseData.java | 32 +- .../PlanGroupPlanDetailResponseData.java | 155 +- .../types/PlanGroupPlanEntitlementsOrder.java | 16 + .../api/types/PlanGroupResponseData.java | 32 +- .../api/types/PlanIssueResponseData.java | 16 + .../schematic/api/types/PlanResponseData.java | 16 + .../schematic/api/types/PlanSelection.java | 56 +- .../schematic/api/types/PlanSnapshotView.java | 16 + .../api/types/PlanTraitResponseData.java | 16 + ...anVersionCompanyMigrationResponseData.java | 419 ++ .../PlanVersionCompanyMigrationStatus.java | 119 + .../PlanVersionMigrationResponseData.java | 526 ++ .../api/types/PlanVersionMigrationStatus.java | 106 + .../types/PlanVersionMigrationStrategy.java | 85 + .../api/types/PlanVersionResponseData.java | 28 +- .../api/types/PlanVersionSnapshotView.java | 162 + .../api/types/PlanViewPublicResponseData.java | 1066 +++++ .../schematic/api/types/PreviewObject.java | 16 + .../api/types/PreviewObjectResponseData.java | 16 + ...PreviewSubscriptionChangeResponseData.java | 123 +- ...reviewSubscriptionFinanceResponseData.java | 92 +- ...wSubscriptionUpcomingInvoiceLineItems.java | 40 +- .../api/types/PublicPlansResponseData.java | 404 ++ .../schematic/api/types/QuickstartResp.java | 16 + .../api/types/RawEventBatchResponseData.java | 10 + .../api/types/RawEventResponseData.java | 16 + .../java/com/schematic/api/types/Rule.java | 28 +- .../RuleConditionDetailResponseData.java | 32 +- .../RuleConditionGroupDetailResponseData.java | 16 + .../types/RuleConditionGroupResponseData.java | 16 + .../api/types/RuleConditionResponseData.java | 32 +- .../api/types/RuleDetailResponseData.java | 28 +- .../schematic/api/types/RuleResponseData.java | 28 +- .../com/schematic/api/types/RuleView.java | 60 +- .../api/types/RulesDetailResponseData.java | 10 + .../api/types/RulesEngineSchemaVersion.java | 18 +- .../api/types/RulesengineCheckFlagResult.java | 48 +- .../api/types/RulesengineCompany.java | 16 + .../api/types/RulesengineCompanyMetric.java | 28 +- .../api/types/RulesengineCondition.java | 32 +- .../api/types/RulesengineConditionGroup.java | 10 + .../types/RulesengineFeatureEntitlement.java | 75 +- .../schematic/api/types/RulesengineFlag.java | 16 + .../schematic/api/types/RulesengineRule.java | 28 +- .../api/types/RulesengineSubscription.java | 16 + .../schematic/api/types/RulesengineTrait.java | 16 + .../api/types/RulesengineTraitDefinition.java | 16 + .../schematic/api/types/RulesengineUser.java | 16 + .../types/ScheduledCheckoutResponseData.java | 504 ++ .../api/types/ScheduledCheckoutStatus.java | 114 + .../types/ScheduledDowngradeResponseData.java | 408 ++ .../api/types/SegmentStatusResp.java | 16 + .../SkippedEntitlementErrorResponseData.java | 16 + .../types/SkippedEntitlementResponseData.java | 16 + .../schematic/api/types/StripeEmbedInfo.java | 16 + .../api/types/SubscriptionTraitUpdate.java | 16 + .../TemporaryAccessTokenResponseData.java | 16 + .../schematic/api/types/TraitDefinition.java | 16 + .../api/types/UpdateAddOnRequestBody.java | 16 + ...dateBillingPlanCreditGrantRequestBody.java | 96 +- .../types/UpdateCreditBundleRequestBody.java | 28 +- .../api/types/UpdateEntitlementReqCommon.java | 32 +- .../types/UpdatePayInAdvanceRequestBody.java | 28 +- .../api/types/UpdatePlanRequestBody.java | 16 + .../UpdatePlanTraitTraitRequestBody.java | 16 + .../api/types/UpdateRuleRequestBody.java | 28 +- .../UpsertBillingProductRequestBody.java | 113 +- .../api/types/UpsertCompanyRequestBody.java | 40 +- .../api/types/UpsertTraitRequestBody.java | 32 +- .../api/types/UpsertUserRequestBody.java | 10 + .../api/types/UpsertUserSubRequestBody.java | 10 + .../UsageBasedEntitlementRequestBody.java | 58 +- .../UsageBasedEntitlementResponseData.java | 48 +- .../UsageTimeSeriesPointResponseData.java | 28 +- .../api/types/UserDetailResponseData.java | 16 + .../schematic/api/types/UserResponseData.java | 16 + .../types/WebFeatureUsageWebhookOutput.java | 48 +- .../WebScheduledDowngradeWebhookOutput.java | 313 ++ .../types/WebhookEventDetailResponseData.java | 32 +- .../api/types/WebhookEventResponseData.java | 32 +- .../api/types/WebhookRequestType.java | 22 + .../api/types/WebhookResponseData.java | 16 + .../api/types/WhoAmIResponseData.java | 384 ++ .../java/com/schematic/api/StreamTest.java | 46 +- 767 files changed, 42685 insertions(+), 15968 deletions(-) create mode 100644 .fern/metadata.json create mode 100644 src/main/java/com/schematic/api/core/ConsoleLogger.java create mode 100644 src/main/java/com/schematic/api/core/DoubleSerializer.java create mode 100644 src/main/java/com/schematic/api/core/ILogger.java create mode 100644 src/main/java/com/schematic/api/core/LogConfig.java create mode 100644 src/main/java/com/schematic/api/core/LogLevel.java create mode 100644 src/main/java/com/schematic/api/core/Logger.java create mode 100644 src/main/java/com/schematic/api/core/LoggingInterceptor.java create mode 100644 src/main/java/com/schematic/api/core/Rfc2822DateTimeDeserializer.java create mode 100644 src/main/java/com/schematic/api/core/SseEvent.java create mode 100644 src/main/java/com/schematic/api/core/SseEventParser.java rename src/main/java/com/schematic/api/resources/accounts/types/{GetApiRequestResponse.java => GetWhoAmIResponse.java} (72%) delete mode 100644 src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java delete mode 100644 src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java delete mode 100644 src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java delete mode 100644 src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java create mode 100644 src/main/java/com/schematic/api/resources/componentspublic/AsyncComponentspublicClient.java create mode 100644 src/main/java/com/schematic/api/resources/componentspublic/AsyncRawComponentspublicClient.java create mode 100644 src/main/java/com/schematic/api/resources/componentspublic/ComponentspublicClient.java create mode 100644 src/main/java/com/schematic/api/resources/componentspublic/RawComponentspublicClient.java create mode 100644 src/main/java/com/schematic/api/resources/componentspublic/types/GetPublicPlansResponse.java create mode 100644 src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java create mode 100644 src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java create mode 100644 src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java rename src/main/java/com/schematic/api/resources/{companies/types/CountCompaniesForAdvancedFilterResponse.java => credits/types/CountCreditEventLedgerResponse.java} (64%) create mode 100644 src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java rename src/main/java/com/schematic/api/resources/{accounts/types/ListApiRequestsResponse.java => credits/types/ListCreditEventLedgerResponse.java} (59%) create mode 100644 src/main/java/com/schematic/api/resources/plangroups/requests/GetPlanGroupRequest.java create mode 100644 src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupParams.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java rename src/main/java/com/schematic/api/resources/{accounts/requests/CountApiRequestsRequest.java => planmigrations/requests/CountCompanyMigrationsRequest.java} (51%) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java rename src/main/java/com/schematic/api/resources/{accounts/requests/ListApiRequestsRequest.java => planmigrations/requests/ListCompanyMigrationsRequest.java} (51%) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java rename src/main/java/com/schematic/api/resources/{accounts/types/ListApiRequestsParams.java => planmigrations/types/CountCompanyMigrationsParams.java} (51%) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsResponse.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsParams.java rename src/main/java/com/schematic/api/resources/{accounts/types/CountApiRequestsResponse.java => planmigrations/types/CountMigrationsResponse.java} (65%) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/GetMigrationResponse.java rename src/main/java/com/schematic/api/resources/{accounts/types/CountApiRequestsParams.java => planmigrations/types/ListCompanyMigrationsParams.java} (51%) rename src/main/java/com/schematic/api/resources/{companies/types/ListCompaniesForAdvancedFilterResponse.java => planmigrations/types/ListCompanyMigrationsResponse.java} (58%) create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsParams.java create mode 100644 src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/DeletePlanVersionRequest.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/GetPlanRequest.java create mode 100644 src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionParams.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionResponse.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/GetPlanParams.java create mode 100644 src/main/java/com/schematic/api/resources/plans/types/PublishPlanVersionResponse.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncScheduledcheckoutClient.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/ScheduledcheckoutClient.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/requests/CreateScheduledCheckoutRequest.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/requests/ListScheduledCheckoutsRequest.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/requests/UpdateScheduledCheckoutRequest.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/types/CreateScheduledCheckoutResponse.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/types/GetScheduledCheckoutResponse.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsParams.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsResponse.java create mode 100644 src/main/java/com/schematic/api/resources/scheduledcheckout/types/UpdateScheduledCheckoutResponse.java delete mode 100644 src/main/java/com/schematic/api/types/ApiKeyRequestListResponseData.java delete mode 100644 src/main/java/com/schematic/api/types/ApiKeyRequestResponseData.java create mode 100644 src/main/java/com/schematic/api/types/BillingCreditView.java create mode 100644 src/main/java/com/schematic/api/types/CaptureRawEvent.java create mode 100644 src/main/java/com/schematic/api/types/CaptureRawEventBatch.java delete mode 100644 src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CreditBundleCurrencyPrice.java create mode 100644 src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CreditCurrencyPriceRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/CreditCurrencyPriceResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java create mode 100644 src/main/java/com/schematic/api/types/CreditEventType.java delete mode 100644 src/main/java/com/schematic/api/types/CreditUsageResponseData.java create mode 100644 src/main/java/com/schematic/api/types/DataEventPayload.java create mode 100644 src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java create mode 100644 src/main/java/com/schematic/api/types/EntitlementCurrencyPricesResponseData.java delete mode 100644 src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java create mode 100644 src/main/java/com/schematic/api/types/InvoiceStatus.java create mode 100644 src/main/java/com/schematic/api/types/PlanCurrencyPriceRequestBody.java create mode 100644 src/main/java/com/schematic/api/types/PlanCurrencyPricesResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java create mode 100644 src/main/java/com/schematic/api/types/PlanVersionSnapshotView.java create mode 100644 src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java create mode 100644 src/main/java/com/schematic/api/types/PublicPlansResponseData.java create mode 100644 src/main/java/com/schematic/api/types/ScheduledCheckoutResponseData.java create mode 100644 src/main/java/com/schematic/api/types/ScheduledCheckoutStatus.java create mode 100644 src/main/java/com/schematic/api/types/ScheduledDowngradeResponseData.java create mode 100644 src/main/java/com/schematic/api/types/WebScheduledDowngradeWebhookOutput.java create mode 100644 src/main/java/com/schematic/api/types/WhoAmIResponseData.java diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 0000000..8d2fe62 --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,16 @@ +{ + "cliVersion": "4.43.1", + "generatorName": "fernapi/fern-java-sdk", + "generatorVersion": "3.44.6", + "generatorConfig": { + "client-class-name": "BaseSchematic", + "generate-unknown-as-json-node": true, + "enable-wire-tests": false, + "custom-dependencies": [ + "testImplementation org.mockito:mockito-core:5.3.1", + "testImplementation org.mockito:mockito-junit-jupiter:5.3.1" + ] + }, + "originGitCommit": "2717563b79232180e36aa245da14c045650ea31b", + "sdkVersion": "1.3.1" +} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cba5f8..1f32646 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,10 @@ name: ci on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: compile: runs-on: ubuntu-latest diff --git a/build.gradle b/build.gradle index e1ffc06..29c05bb 100644 --- a/build.gradle +++ b/build.gradle @@ -14,10 +14,10 @@ repositories { } dependencies { - api 'com.squareup.okhttp3:okhttp:4.12.0' - api 'com.fasterxml.jackson.core:jackson-databind:2.17.2' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' + api 'com.squareup.okhttp3:okhttp:5.2.1' + api 'com.fasterxml.jackson.core:jackson-databind:2.18.6' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.6' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.6' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' @@ -49,7 +49,7 @@ java { group = 'com.schematichq' -version = '1.3.0' +version = '1.3.1' jar { dependsOn(":generatePomFileForMavenPublication") @@ -80,22 +80,21 @@ publishing { maven(MavenPublication) { groupId = 'com.schematichq' artifactId = 'schematic-java' - version = '1.3.0' + version = '1.3.1' from components.java pom { - name = 'schematic' - description = 'The official SDK of schematic' - url = 'https://buildwithfern.com' + name = 'Schematic' + description = 'Official Java SDK for Schematic' + url = 'https://schematichq.com' licenses { license { - name = 'The MIT License (MIT)' - url = 'https://mit-license.org/' + name = 'MIT' } } developers { developer { - name = 'schematic' - email = 'developers@schematic.com' + name = 'Schematic' + email = 'support@schematichq.com' } } scm { diff --git a/reference.md b/reference.md index 0d60eec..1c3e10b 100644 --- a/reference.md +++ b/reference.md @@ -98,8 +98,8 @@ client.accounts().listApiKeys( .builder() .requireEnvironment(true) .environmentId("environment_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -132,7 +132,7 @@ client.accounts().listApiKeys(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -140,7 +140,7 @@ client.accounts().listApiKeys(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -203,6 +203,14 @@ client.accounts().createApiKey( **name:** `String` + + + +
+
+ +**readonly:** `Optional` +
@@ -372,8 +380,8 @@ client.accounts().countApiKeys( .builder() .requireEnvironment(true) .environmentId("environment_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -406,7 +414,7 @@ client.accounts().countApiKeys(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -414,7 +422,7 @@ client.accounts().countApiKeys(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -426,7 +434,7 @@ client.accounts().countApiKeys( -
client.accounts.listApiRequests() -> ListApiRequestsResponse +
client.accounts.listAuditLogs() -> ListAuditLogsResponse
@@ -439,14 +447,16 @@ client.accounts().countApiKeys(
```java -client.accounts().listApiRequests( - ListApiRequestsRequest +client.accounts().listAuditLogs( + ListAuditLogsRequest .builder() - .q("q") - .requestType("request_type") + .actorType(ActorType.API_KEY) + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) .environmentId("environment_id") - .limit(1) - .offset(1) + .q("q") + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -463,7 +473,7 @@ client.accounts().listApiRequests(
-**q:** `Optional` +**actorType:** `Optional`
@@ -471,7 +481,7 @@ client.accounts().listApiRequests(
-**requestType:** `Optional` +**endTime:** `Optional`
@@ -487,7 +497,7 @@ client.accounts().listApiRequests(
-**limit:** `Optional` — Page limit (default 100) +**q:** `Optional`
@@ -495,47 +505,23 @@ client.accounts().listApiRequests(
-**offset:** `Optional` — Page offset (default 0) +**startTime:** `Optional`
-
-
- - - - -
- -
client.accounts.getApiRequest(apiRequestId) -> GetApiRequestResponse -
-
- -#### 🔌 Usage - -
-
-```java -client.accounts().getApiRequest("api_request_id"); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters -
-
-
- -**apiRequestId:** `String` — api_request_id +**offset:** `Optional` — Page offset (default 0)
@@ -547,7 +533,7 @@ client.accounts().getApiRequest("api_request_id");
-
client.accounts.countApiRequests() -> CountApiRequestsResponse +
client.accounts.getAuditLog(auditLogId) -> GetAuditLogResponse
@@ -560,16 +546,7 @@ client.accounts().getApiRequest("api_request_id");
```java -client.accounts().countApiRequests( - CountApiRequestsRequest - .builder() - .q("q") - .requestType("request_type") - .environmentId("environment_id") - .limit(1) - .offset(1) - .build() -); +client.accounts().getAuditLog("audit_log_id"); ```
@@ -584,39 +561,7 @@ client.accounts().countApiRequests(
-**q:** `Optional` - -
-
- -
-
- -**requestType:** `Optional` - -
-
- -
-
- -**environmentId:** `Optional` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) +**auditLogId:** `String` — audit_log_id
@@ -628,7 +573,7 @@ client.accounts().countApiRequests(
-
client.accounts.listAuditLogs() -> ListAuditLogsResponse +
client.accounts.countAuditLogs() -> CountAuditLogsResponse
@@ -641,14 +586,16 @@ client.accounts().countApiRequests(
```java -client.accounts().listAuditLogs( - ListAuditLogsRequest +client.accounts().countAuditLogs( + CountAuditLogsRequest .builder() .actorType(ActorType.API_KEY) + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) .environmentId("environment_id") .q("q") - .limit(1) - .offset(1) + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -673,120 +620,15 @@ client.accounts().listAuditLogs(
-**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 +**endTime:** `Optional`
-
-
- - -
-
-
- -
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`
@@ -794,7 +636,7 @@ client.accounts().countAuditLogs(
-**environmentId:** `Optional` +**q:** `Optional`
@@ -802,7 +644,7 @@ client.accounts().countAuditLogs(
-**q:** `Optional` +**startTime:** `Optional`
@@ -810,7 +652,7 @@ client.accounts().countAuditLogs(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -818,7 +660,7 @@ client.accounts().countAuditLogs(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -846,8 +688,8 @@ client.accounts().countAuditLogs( client.accounts().listEnvironments( ListEnvironmentsRequest .builder() - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -872,7 +714,7 @@ client.accounts().listEnvironments(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -880,7 +722,7 @@ client.accounts().listEnvironments(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -1108,6 +950,31 @@ client.accounts().quickstart();
+
+
+
+ +
client.accounts.getWhoAmI() -> GetWhoAmIResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.accounts().getWhoAmI(); +``` +
+
+
+
+ +
@@ -1131,8 +998,8 @@ client.billing().listCoupons( .builder() .isActive(true) .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1165,7 +1032,7 @@ client.billing().listCoupons(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -1173,7 +1040,7 @@ client.billing().listCoupons(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -1201,14 +1068,14 @@ client.billing().listCoupons( client.billing().upsertBillingCoupon( CreateCouponRequestBody .builder() - .amountOff(1) + .amountOff(1000000L) .duration("duration") - .durationInMonths(1) + .durationInMonths(1000000L) .externalId("external_id") - .maxRedemptions(1) + .maxRedemptions(1000000L) .name("name") .percentOff(1.1) - .timesRedeemed(1) + .timesRedeemed(1000000L) .build() ); ``` @@ -1225,7 +1092,7 @@ client.billing().upsertBillingCoupon(
-**amountOff:** `Integer` +**amountOff:** `Long`
@@ -1249,7 +1116,7 @@ client.billing().upsertBillingCoupon(
-**durationInMonths:** `Integer` +**durationInMonths:** `Long`
@@ -1265,7 +1132,7 @@ client.billing().upsertBillingCoupon(
-**maxRedemptions:** `Integer` +**maxRedemptions:** `Long`
@@ -1289,7 +1156,7 @@ client.billing().upsertBillingCoupon(
-**timesRedeemed:** `Integer` +**timesRedeemed:** `Long`
@@ -1319,12 +1186,12 @@ client.billing().upsertBillingCustomer( .builder() .email("email") .externalId("external_id") + .name("name") .meta( new HashMap() {{ put("key", "value"); }} ) - .name("name") .build() ); ``` @@ -1420,8 +1287,8 @@ client.billing().listCustomersWithSubscriptions( .name("name") .providerType(BillingProviderType.SCHEMATIC) .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1470,7 +1337,7 @@ client.billing().listCustomersWithSubscriptions(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -1478,7 +1345,7 @@ client.billing().listCustomersWithSubscriptions(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -1509,8 +1376,8 @@ client.billing().countCustomers( .name("name") .providerType(BillingProviderType.SCHEMATIC) .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1559,7 +1426,7 @@ client.billing().countCustomers(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -1567,7 +1434,7 @@ client.billing().countCustomers(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -1598,8 +1465,8 @@ client.billing().listInvoices( .customerExternalId("customer_external_id") .subscriptionExternalId("subscription_external_id") .companyId("company_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1640,7 +1507,7 @@ client.billing().listInvoices(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -1648,7 +1515,7 @@ client.billing().listInvoices(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -1676,13 +1543,13 @@ client.billing().listInvoices( client.billing().upsertInvoice( CreateInvoiceRequestBody .builder() - .amountDue(1) - .amountPaid(1) - .amountRemaining(1) + .amountDue(1000000L) + .amountPaid(1000000L) + .amountRemaining(1000000L) .collectionMethod("collection_method") .currency("currency") .customerExternalId("customer_external_id") - .subtotal(1) + .subtotal(1000000L) .build() ); ``` @@ -1699,7 +1566,7 @@ client.billing().upsertInvoice(
-**amountDue:** `Integer` +**amountDue:** `Long`
@@ -1707,7 +1574,7 @@ client.billing().upsertInvoice(
-**amountPaid:** `Integer` +**amountPaid:** `Long`
@@ -1715,7 +1582,7 @@ client.billing().upsertInvoice(
-**amountRemaining:** `Integer` +**amountRemaining:** `Long`
@@ -1771,6 +1638,14 @@ client.billing().upsertInvoice(
+**status:** `Optional` + +
+
+ +
+
+ **subscriptionExternalId:** `Optional`
@@ -1779,7 +1654,7 @@ client.billing().upsertInvoice(
-**subtotal:** `Integer` +**subtotal:** `Long`
@@ -1816,8 +1691,8 @@ client.billing().listMeters( ListMetersRequest .builder() .displayName("display_name") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1842,7 +1717,7 @@ client.billing().listMeters(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -1850,7 +1725,7 @@ client.billing().listMeters(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -1952,8 +1827,8 @@ client.billing().listPaymentMethods( .builder() .customerExternalId("customer_external_id") .companyId("company_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -1986,7 +1861,7 @@ client.billing().listPaymentMethods(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -1994,7 +1869,7 @@ client.billing().listPaymentMethods(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -2089,7 +1964,7 @@ client.billing().upsertPaymentMethod(
-**cardExpMonth:** `Optional` +**cardExpMonth:** `Optional`
@@ -2097,7 +1972,7 @@ client.billing().upsertPaymentMethod(
-**cardExpYear:** `Optional` +**cardExpYear:** `Optional`
@@ -2157,19 +2032,20 @@ client.billing().upsertPaymentMethod( client.billing().listBillingPrices( ListBillingPricesRequest .builder() + .currency("currency") .forInitialPlan(true) .forTrialExpiryPlan(true) .interval("interval") .isActive(true) - .price(1) + .price(1000000L) .productId("product_id") .providerType(BillingProviderType.SCHEMATIC) .q("q") .tiersMode(BillingTiersMode.GRADUATED) .usageType(BillingPriceUsageType.LICENSED) .withMeter(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -2186,6 +2062,14 @@ client.billing().listBillingPrices(
+**currency:** `Optional` — Filter for prices in a specific currency (e.g. usd, eur) + +
+
+ +
+
+ **forInitialPlan:** `Optional` — Filter for prices valid for initial plans (free prices only)
@@ -2226,7 +2110,7 @@ client.billing().listBillingPrices(
-**price:** `Optional` +**price:** `Optional`
@@ -2290,7 +2174,7 @@ client.billing().listBillingPrices(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -2298,7 +2182,7 @@ client.billing().listBillingPrices(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -2331,8 +2215,10 @@ client.billing().upsertBillingPrice( .externalAccountId("external_account_id") .interval("interval") .isActive(true) - .price(1) + .price(1000000L) .priceExternalId("price_external_id") + .productExternalId("product_external_id") + .usageType(BillingPriceUsageType.LICENSED) .priceTiers( Arrays.asList( CreateBillingPriceTierRequestBody @@ -2341,8 +2227,6 @@ client.billing().upsertBillingPrice( .build() ) ) - .productExternalId("product_external_id") - .usageType(BillingPriceUsageType.LICENSED) .build() ); ``` @@ -2407,7 +2291,7 @@ client.billing().upsertBillingPrice(
-**packageSize:** `Optional` +**packageSize:** `Optional`
@@ -2415,7 +2299,7 @@ client.billing().upsertBillingPrice(
-**price:** `Integer` +**price:** `Long`
@@ -2539,19 +2423,20 @@ client.billing().deleteBillingProduct("billing_id"); client.billing().listBillingProductPrices( ListBillingProductPricesRequest .builder() + .currency("currency") .forInitialPlan(true) .forTrialExpiryPlan(true) .interval("interval") .isActive(true) - .price(1) + .price(1000000L) .productId("product_id") .providerType(BillingProviderType.SCHEMATIC) .q("q") .tiersMode(BillingTiersMode.GRADUATED) .usageType(BillingPriceUsageType.LICENSED) .withMeter(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -2568,6 +2453,14 @@ client.billing().listBillingProductPrices(
+**currency:** `Optional` — Filter for prices in a specific currency (e.g. usd, eur) + +
+
+ +
+
+ **forInitialPlan:** `Optional` — Filter for prices valid for initial plans (free prices only)
@@ -2608,7 +2501,7 @@ client.billing().listBillingProductPrices(
-**price:** `Optional` +**price:** `Optional`
@@ -2672,7 +2565,7 @@ client.billing().listBillingProductPrices(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -2680,7 +2573,7 @@ client.billing().listBillingProductPrices(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -2749,7 +2642,6 @@ client.billing().upsertBillingProduct( CreateBillingProductRequestBody .builder() .externalId("external_id") - .name("name") .price(1.1) .build() ); @@ -2783,7 +2675,7 @@ client.billing().upsertBillingProduct(
-**name:** `String` +**name:** `Optional`
@@ -2836,8 +2728,8 @@ client.billing().listBillingProducts( .withPricesOnly(true) .withZeroPrice(true) .withoutLinkedToPlan(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -2934,7 +2826,7 @@ client.billing().listBillingProducts(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -2942,7 +2834,7 @@ client.billing().listBillingProducts(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -2979,8 +2871,8 @@ client.billing().countBillingProducts( .withPricesOnly(true) .withZeroPrice(true) .withoutLinkedToPlan(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -3077,7 +2969,7 @@ client.billing().countBillingProducts(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -3085,7 +2977,7 @@ client.billing().countBillingProducts(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -3116,6 +3008,9 @@ client.billing().upsertBillingSubscription( .cancelAtPeriodEnd(true) .currency("currency") .customerExternalId("customer_external_id") + .expiredAt(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .subscriptionExternalId("subscription_external_id") + .totalPrice(1000000L) .discounts( Arrays.asList( BillingSubscriptionDiscount @@ -3127,23 +3022,20 @@ client.billing().upsertBillingSubscription( .build() ) ) - .expiredAt(OffsetDateTime.parse("2024-01-15T09:30:00Z")) .productExternalIds( Arrays.asList( BillingProductPricing .builder() .currency("currency") .interval("interval") - .price(1) + .price(1000000L) .priceExternalId("price_external_id") .productExternalId("product_external_id") - .quantity(1) + .quantity(1000000L) .usageType(BillingPriceUsageType.LICENSED) .build() ) ) - .subscriptionExternalId("subscription_external_id") - .totalPrice(1) .build() ); ``` @@ -3168,7 +3060,7 @@ client.billing().upsertBillingSubscription(
-**cancelAt:** `Optional` +**cancelAt:** `Optional`
@@ -3248,7 +3140,7 @@ client.billing().upsertBillingSubscription(
-**periodEnd:** `Optional` +**periodEnd:** `Optional`
@@ -3256,7 +3148,7 @@ client.billing().upsertBillingSubscription(
-**periodStart:** `Optional` +**periodStart:** `Optional`
@@ -3288,7 +3180,7 @@ client.billing().upsertBillingSubscription(
-**totalPrice:** `Integer` +**totalPrice:** `Long`
@@ -3296,7 +3188,7 @@ client.billing().upsertBillingSubscription(
-**trialEnd:** `Optional` +**trialEnd:** `Optional`
@@ -3334,8 +3226,8 @@ client.credits().listBillingCredits( ListBillingCreditsRequest .builder() .name("name") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -3368,7 +3260,7 @@ client.credits().listBillingCredits(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -3376,7 +3268,7 @@ client.credits().listBillingCredits(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -3439,7 +3331,7 @@ client.credits().createBillingCredit(
-**defaultExpiryUnit:** `Optional` +**currencyPrices:** `Optional>`
@@ -3447,7 +3339,15 @@ client.credits().createBillingCredit(
-**defaultExpiryUnitCount:** `Optional` +**defaultExpiryUnit:** `Optional` + +
+
+ +
+
+ +**defaultExpiryUnitCount:** `Optional`
@@ -3487,7 +3387,7 @@ client.credits().createBillingCredit(
-**perUnitPrice:** `Optional` +**perUnitPrice:** `Optional`
@@ -3614,6 +3514,14 @@ client.credits().updateBillingCredit(
+**currencyPrices:** `Optional>` + +
+
+ +
+
+ **defaultExpiryUnit:** `Optional`
@@ -3622,7 +3530,7 @@ client.credits().updateBillingCredit(
-**defaultExpiryUnitCount:** `Optional` +**defaultExpiryUnitCount:** `Optional`
@@ -3662,7 +3570,7 @@ client.credits().updateBillingCredit(
-**perUnitPrice:** `Optional` +**perUnitPrice:** `Optional`
@@ -3757,8 +3665,8 @@ client.credits().listCreditBundles( .creditId("credit_id") .status(BillingCreditBundleStatus.ACTIVE) .bundleType("fixed") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -3807,7 +3715,7 @@ client.credits().listCreditBundles(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -3815,7 +3723,7 @@ client.credits().listCreditBundles(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -3846,7 +3754,7 @@ client.credits().createCreditBundle( .bundleName("bundle_name") .creditId("credit_id") .currency("currency") - .pricePerUnit(1) + .pricePerUnit(1000000L) .build() ); ``` @@ -3895,6 +3803,14 @@ client.credits().createCreditBundle(
+**currencyPrices:** `Optional>` + +
+
+ +
+
+ **expiryType:** `Optional`
@@ -3911,7 +3827,7 @@ client.credits().createCreditBundle(
-**expiryUnitCount:** `Optional` +**expiryUnitCount:** `Optional`
@@ -3919,7 +3835,7 @@ client.credits().createCreditBundle(
-**pricePerUnit:** `Integer` +**pricePerUnit:** `Long`
@@ -3935,7 +3851,7 @@ client.credits().createCreditBundle(
-**quantity:** `Optional` +**quantity:** `Optional`
@@ -4013,7 +3929,7 @@ client.credits().updateCreditBundleDetails( UpdateCreditBundleDetailsRequestBody .builder() .bundleName("bundle_name") - .pricePerUnit(1) + .pricePerUnit(1000000L) .build() ); ``` @@ -4046,6 +3962,14 @@ client.credits().updateCreditBundleDetails(
+**currencyPrices:** `Optional>` + +
+
+ +
+
+ **expiryType:** `Optional`
@@ -4062,7 +3986,7 @@ client.credits().updateCreditBundleDetails(
-**expiryUnitCount:** `Optional` +**expiryUnitCount:** `Optional`
@@ -4070,7 +3994,7 @@ client.credits().updateCreditBundleDetails(
-**pricePerUnit:** `Integer` +**pricePerUnit:** `Long`
@@ -4086,7 +4010,7 @@ client.credits().updateCreditBundleDetails(
-**quantity:** `Optional` +**quantity:** `Optional`
@@ -4165,8 +4089,8 @@ client.credits().countCreditBundles( .creditId("credit_id") .status(BillingCreditBundleStatus.ACTIVE) .bundleType("fixed") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4215,7 +4139,7 @@ client.credits().countCreditBundles(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4223,7 +4147,7 @@ client.credits().countCreditBundles(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4252,8 +4176,8 @@ client.credits().countBillingCredits( CountBillingCreditsRequest .builder() .name("name") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4286,7 +4210,7 @@ client.credits().countBillingCredits(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4294,7 +4218,7 @@ client.credits().countBillingCredits(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4377,7 +4301,7 @@ client.credits().grantBillingCreditsToCompany( .builder() .companyId("company_id") .creditId("credit_id") - .quantity(1) + .quantity(1000000L) .reason(BillingCreditGrantReason.BILLING_CREDIT_AUTO_TOPUP) .build() ); @@ -4395,7 +4319,7 @@ client.credits().grantBillingCreditsToCompany(
-**billingPeriodsCount:** `Optional` +**billingPeriodsCount:** `Optional`
@@ -4419,6 +4343,14 @@ client.credits().grantBillingCreditsToCompany(
+**currency:** `Optional` + +
+
+ +
+
+ **expiresAt:** `Optional`
@@ -4443,7 +4375,7 @@ client.credits().grantBillingCreditsToCompany(
-**expiryUnitCount:** `Optional` +**expiryUnitCount:** `Optional`
@@ -4451,7 +4383,7 @@ client.credits().grantBillingCreditsToCompany(
-**quantity:** `Integer` +**quantity:** `Long`
@@ -4506,8 +4438,8 @@ client.credits().countCompanyGrants( .companyId("company_id") .order(CreditGrantSortOrder.CREATED_AT) .dir(SortDirection.ASC) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4548,7 +4480,7 @@ client.credits().countCompanyGrants(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4556,7 +4488,7 @@ client.credits().countCompanyGrants(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4587,8 +4519,8 @@ client.credits().listCompanyGrants( .companyId("company_id") .order(CreditGrantSortOrder.CREATED_AT) .dir(SortDirection.ASC) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4629,7 +4561,7 @@ client.credits().listCompanyGrants(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4637,7 +4569,7 @@ client.credits().listCompanyGrants(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4666,8 +4598,8 @@ client.credits().countBillingCreditsGrants( CountBillingCreditsGrantsRequest .builder() .creditId("credit_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4700,7 +4632,7 @@ client.credits().countBillingCreditsGrants(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4708,7 +4640,7 @@ client.credits().countBillingCreditsGrants(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4737,8 +4669,8 @@ client.credits().listGrantsForCredit( ListGrantsForCreditRequest .builder() .creditId("credit_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4771,7 +4703,7 @@ client.credits().listGrantsForCredit(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4779,7 +4711,7 @@ client.credits().listGrantsForCredit(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4813,8 +4745,8 @@ client.credits().getEnrichedCreditLedger( .featureId("feature_id") .startTime("start_time") .endTime("end_time") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4879,7 +4811,7 @@ client.credits().getEnrichedCreditLedger(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4887,7 +4819,7 @@ client.credits().getEnrichedCreditLedger(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -4921,8 +4853,8 @@ client.credits().countCreditLedger( .featureId("feature_id") .startTime("start_time") .endTime("end_time") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -4987,7 +4919,7 @@ client.credits().countCreditLedger(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -4995,7 +4927,7 @@ client.credits().countCreditLedger(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -5025,8 +4957,9 @@ client.credits().listBillingPlanCreditGrants( .builder() .creditId("credit_id") .planId("plan_id") - .limit(1) - .offset(1) + .planVersionId("plan_version_id") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -5051,6 +4984,14 @@ client.credits().listBillingPlanCreditGrants(
+**ids:** `Optional` + +
+
+ +
+
+ **planId:** `Optional`
@@ -5067,7 +5008,7 @@ client.credits().listBillingPlanCreditGrants(
-**ids:** `Optional` +**planVersionId:** `Optional`
@@ -5075,7 +5016,7 @@ client.credits().listBillingPlanCreditGrants(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -5083,7 +5024,7 @@ client.credits().listBillingPlanCreditGrants(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -5111,7 +5052,7 @@ client.credits().listBillingPlanCreditGrants( client.credits().createBillingPlanCreditGrant( CreateBillingPlanCreditGrantRequestBody .builder() - .creditAmount(1) + .creditAmount(1000000L) .creditId("credit_id") .planId("plan_id") .resetCadence(BillingPlanCreditGrantResetCadence.DAILY) @@ -5271,8 +5212,9 @@ client.credits().countBillingPlanCreditGrants( .builder() .creditId("credit_id") .planId("plan_id") - .limit(1) - .offset(1) + .planVersionId("plan_version_id") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -5297,6 +5239,14 @@ client.credits().countBillingPlanCreditGrants(
+**ids:** `Optional` + +
+
+ +
+
+ **planId:** `Optional`
@@ -5313,7 +5263,7 @@ client.credits().countBillingPlanCreditGrants(
-**ids:** `Optional` +**planVersionId:** `Optional`
@@ -5321,7 +5271,7 @@ client.credits().countBillingPlanCreditGrants(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -5329,7 +5279,7 @@ client.credits().countBillingPlanCreditGrants(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -5341,8 +5291,7 @@ client.credits().countBillingPlanCreditGrants(
-## checkout -
client.checkout.internal(request) -> CheckoutInternalResponse +
client.credits.listCreditEventLedger() -> ListCreditEventLedgerResponse
@@ -5355,40 +5304,17 @@ client.credits().countBillingPlanCreditGrants(
```java -client.checkout().internal( - ChangeSubscriptionInternalRequestBody +client.credits().listCreditEventLedger( + ListCreditEventLedgerRequest .builder() - .addOnIds( - Arrays.asList( - UpdateAddOnRequestBody - .builder() - .addOnId("add_on_id") - .priceId("price_id") - .build() - ) - ) .companyId("company_id") - .creditBundles( - Arrays.asList( - UpdateCreditBundleRequestBody - .builder() - .bundleId("bundle_id") - .quantity(1) - .build() - ) - ) - .newPlanId("new_plan_id") - .newPriceId("new_price_id") - .payInAdvance( - Arrays.asList( - UpdatePayInAdvanceRequestBody - .builder() - .priceId("price_id") - .quantity(1) - .build() - ) - ) - .skipTrial(true) + .billingCreditId("billing_credit_id") + .endTime("end_time") + .eventType(CreditEventType.GRANT) + .featureId("feature_id") + .startTime("start_time") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -5405,7 +5331,63 @@ client.checkout().internal(
-**request:** `ChangeSubscriptionInternalRequestBody` +**billingCreditId:** `Optional` + +
+
+ +
+
+ +**companyId:** `String` + +
+
+ +
+
+ +**endTime:** `Optional` + +
+
+ +
+
+ +**eventType:** `Optional` + +
+
+ +
+
+ +**featureId:** `Optional` + +
+
+ +
+
+ +**startTime:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0)
@@ -5417,7 +5399,7 @@ client.checkout().internal(
-
client.checkout.getCheckoutData(request) -> GetCheckoutDataResponse +
client.credits.countCreditEventLedger() -> CountCreditEventLedgerResponse
@@ -5430,10 +5412,17 @@ client.checkout().internal(
```java -client.checkout().getCheckoutData( - CheckoutDataRequestBody +client.credits().countCreditEventLedger( + CountCreditEventLedgerRequest .builder() .companyId("company_id") + .billingCreditId("billing_credit_id") + .endTime("end_time") + .eventType(CreditEventType.GRANT) + .featureId("feature_id") + .startTime("start_time") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -5450,6 +5439,14 @@ client.checkout().getCheckoutData(
+**billingCreditId:** `Optional` + +
+
+ +
+
+ **companyId:** `String`
@@ -5458,7 +5455,47 @@ client.checkout().getCheckoutData(
-**selectedPlanId:** `Optional` +**endTime:** `Optional` + +
+
+ +
+
+ +**eventType:** `Optional` + +
+
+ +
+
+ +**featureId:** `Optional` + +
+
+ +
+
+ +**startTime:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0)
@@ -5470,7 +5507,8 @@ client.checkout().getCheckoutData(
-
client.checkout.previewCheckoutInternal(request) -> PreviewCheckoutInternalResponse +## checkout +
client.checkout.internal(request) -> CheckoutInternalResponse
@@ -5483,9 +5521,13 @@ client.checkout().getCheckoutData(
```java -client.checkout().previewCheckoutInternal( +client.checkout().internal( ChangeSubscriptionInternalRequestBody .builder() + .companyId("company_id") + .newPlanId("new_plan_id") + .newPriceId("new_price_id") + .skipTrial(true) .addOnIds( Arrays.asList( UpdateAddOnRequestBody @@ -5495,28 +5537,24 @@ client.checkout().previewCheckoutInternal( .build() ) ) - .companyId("company_id") .creditBundles( Arrays.asList( UpdateCreditBundleRequestBody .builder() .bundleId("bundle_id") - .quantity(1) + .quantity(1000000L) .build() ) ) - .newPlanId("new_plan_id") - .newPriceId("new_price_id") .payInAdvance( Arrays.asList( UpdatePayInAdvanceRequestBody .builder() .priceId("price_id") - .quantity(1) + .quantity(1000000L) .build() ) ) - .skipTrial(true) .build() ); ``` @@ -5545,7 +5583,7 @@ client.checkout().previewCheckoutInternal(
-
client.checkout.managePlan(request) -> ManagePlanResponse +
client.checkout.getCheckoutData(request) -> GetCheckoutDataResponse
@@ -5558,36 +5596,10 @@ client.checkout().previewCheckoutInternal(
```java -client.checkout().managePlan( - ManagePlanRequest +client.checkout().getCheckoutData( + CheckoutDataRequestBody .builder() - .addOnSelections( - Arrays.asList( - PlanSelection - .builder() - .planId("plan_id") - .build() - ) - ) .companyId("company_id") - .creditBundles( - Arrays.asList( - UpdateCreditBundleRequestBody - .builder() - .bundleId("bundle_id") - .quantity(1) - .build() - ) - ) - .payInAdvanceEntitlements( - Arrays.asList( - UpdatePayInAdvanceRequestBody - .builder() - .priceId("price_id") - .quantity(1) - .build() - ) - ) .build() ); ``` @@ -5604,7 +5616,15 @@ client.checkout().managePlan(
-**request:** `ManagePlanRequest` +**companyId:** `String` + +
+
+ +
+
+ +**selectedPlanId:** `Optional`
@@ -5616,7 +5636,7 @@ client.checkout().managePlan(
-
client.checkout.previewManagePlan(request) -> PreviewManagePlanResponse +
client.checkout.previewCheckoutInternal(request) -> PreviewCheckoutInternalResponse
@@ -5629,9 +5649,85 @@ client.checkout().managePlan(
```java -client.checkout().previewManagePlan( +client.checkout().previewCheckoutInternal( + ChangeSubscriptionInternalRequestBody + .builder() + .companyId("company_id") + .newPlanId("new_plan_id") + .newPriceId("new_price_id") + .skipTrial(true) + .addOnIds( + Arrays.asList( + UpdateAddOnRequestBody + .builder() + .addOnId("add_on_id") + .priceId("price_id") + .build() + ) + ) + .creditBundles( + Arrays.asList( + UpdateCreditBundleRequestBody + .builder() + .bundleId("bundle_id") + .quantity(1000000L) + .build() + ) + ) + .payInAdvance( + Arrays.asList( + UpdatePayInAdvanceRequestBody + .builder() + .priceId("price_id") + .quantity(1000000L) + .build() + ) + ) + .build() +); +``` +
+
+ + + +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ChangeSubscriptionInternalRequestBody` + +
+
+
+
+ + + + +
+ +
client.checkout.managePlan(request) -> ManagePlanResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkout().managePlan( ManagePlanRequest .builder() + .companyId("company_id") .addOnSelections( Arrays.asList( PlanSelection @@ -5640,13 +5736,83 @@ client.checkout().previewManagePlan( .build() ) ) + .creditBundles( + Arrays.asList( + UpdateCreditBundleRequestBody + .builder() + .bundleId("bundle_id") + .quantity(1000000L) + .build() + ) + ) + .payInAdvanceEntitlements( + Arrays.asList( + UpdatePayInAdvanceRequestBody + .builder() + .priceId("price_id") + .quantity(1000000L) + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ManagePlanRequest` + +
+
+
+
+ + +
+
+
+ +
client.checkout.previewManagePlan(request) -> PreviewManagePlanResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.checkout().previewManagePlan( + ManagePlanRequest + .builder() .companyId("company_id") + .addOnSelections( + Arrays.asList( + PlanSelection + .builder() + .planId("plan_id") + .build() + ) + ) .creditBundles( Arrays.asList( UpdateCreditBundleRequestBody .builder() .bundleId("bundle_id") - .quantity(1) + .quantity(1000000L) .build() ) ) @@ -5655,7 +5821,7 @@ client.checkout().previewManagePlan( UpdatePayInAdvanceRequestBody .builder() .priceId("price_id") - .quantity(1) + .quantity(1000000L) .build() ) ) @@ -5820,15 +5986,17 @@ client.companies().listCompanies( .builder() .monetizedSubscriptions(true) .planId("plan_id") + .planVersionId("plan_version_id") .q("q") .sortOrderColumn("sort_order_column") .sortOrderDirection(SortDirection.ASC) + .withEntitlementFor("with_entitlement_for") .withoutFeatureOverrideFor("without_feature_override_for") .withoutPlan(true) .withoutSubscription(true) .withSubscription(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -5885,6 +6053,14 @@ client.companies().listCompanies(
+**planVersionId:** `Optional` — Filter companies by plan version ID (starts with plvr_) + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -5925,6 +6101,14 @@ client.companies().listCompanies(
+**withEntitlementFor:** `Optional` — Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID + +
+
+ +
+
+ **withoutFeatureOverrideFor:** `Optional` — Filter out companies that already have a company override for the specified feature ID
@@ -5957,7 +6141,7 @@ client.companies().listCompanies(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -5965,7 +6149,7 @@ client.companies().listCompanies(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -6147,15 +6331,17 @@ client.companies().countCompanies( .builder() .monetizedSubscriptions(true) .planId("plan_id") + .planVersionId("plan_version_id") .q("q") .sortOrderColumn("sort_order_column") .sortOrderDirection(SortDirection.ASC) + .withEntitlementFor("with_entitlement_for") .withoutFeatureOverrideFor("without_feature_override_for") .withoutPlan(true) .withoutSubscription(true) .withSubscription(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -6212,6 +6398,14 @@ client.companies().countCompanies(
+**planVersionId:** `Optional` — Filter companies by plan version ID (starts with plvr_) + +
+
+ +
+
+ **q:** `Optional` — Search for companies by name, keys or string traits
@@ -6252,6 +6446,14 @@ client.companies().countCompanies(
+**withEntitlementFor:** `Optional` — Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID + +
+
+ +
+
+ **withoutFeatureOverrideFor:** `Optional` — Filter out companies that already have a company override for the specified feature ID
@@ -6284,7 +6486,7 @@ client.companies().countCompanies(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -6292,7 +6494,7 @@ client.companies().countCompanies(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -6304,7 +6506,7 @@ client.companies().countCompanies(
-
client.companies.countCompaniesForAdvancedFilter() -> CountCompaniesForAdvancedFilterResponse +
client.companies.createCompany(request) -> CreateCompanyResponse
@@ -6317,17 +6519,14 @@ client.companies().countCompanies(
```java -client.companies().countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest +client.companies().createCompany( + UpsertCompanyRequestBody .builder() - .monetizedSubscriptions(true) - .q("q") - .withoutPlan(true) - .withoutSubscription(true) - .sortOrderColumn("sort_order_column") - .sortOrderDirection(SortDirection.ASC) - .limit(1) - .offset(1) + .keys( + new HashMap() {{ + put("key", "value"); + }} + ) .build() ); ``` @@ -6344,119 +6543,123 @@ client.companies().countCompaniesForAdvancedFilter(
-**ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_) +**request:** `UpsertCompanyRequestBody`
+
+
-
-
-**planIds:** `Optional` — Filter companies by one or more plan IDs (each ID starts with plan_) -
+
+
client.companies.deleteCompanyByKeys(request) -> DeleteCompanyByKeysResponse
-**featureIds:** `Optional` — Filter companies by one or more feature IDs (each ID starts with feat_) - -
-
+#### 🔌 Usage
-**creditTypeIds:** `Optional` — Filter companies by one or more credit type IDs (each ID starts with bcrd_) - -
-
-
-**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) - +```java +client.companies().deleteCompanyByKeys( + KeysRequestBody + .builder() + .keys( + new HashMap() {{ + put("key", "value"); + }} + ) + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types (paid, free, trial) - -
-
-
-**monetizedSubscriptions:** `Optional` — Filter companies that have monetized subscriptions +**request:** `KeysRequestBody`
+ + -
-
-**q:** `Optional` — Search for companies by name, keys or string traits -
+
+
client.companies.lookupCompany() -> LookupCompanyResponse
-**withoutPlan:** `Optional` — Filter out companies that have a plan - -
-
+#### 📝 Description
-**withoutSubscription:** `Optional` — Filter out companies that have a subscription - -
-
-
-**sortOrderColumn:** `Optional` — Column to sort by (e.g. name, created_at, last_seen_at) - +Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. +The following approaches will all work to resolve a company and any of them are appropriate: +1. `/companies/lookup?keys={"foo": "bar", "fizz": "buzz"}` +2. `/companies/lookup?keys[foo]=bar&keys[fizz]=buzz` +2. `/companies/lookup?foo=bar&fizz=buzz` +
+
+#### 🔌 Usage +
-**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc) - -
-
-
-**displayProperties:** `Optional` — Select the display columns to return (e.g. plan, subscription, users, last_seen_at) - +```java +client.companies().lookupCompany( + LookupCompanyRequest + .builder() + .keys( + new HashMap() {{ + put("keys", "keys"); + }} + ) + .build() +); +```
+ + + +#### ⚙️ Parameters
-**limit:** `Optional` — Page limit (default 100) - -
-
-
-**offset:** `Optional` — Page offset (default 0) +**keys:** `Map` — Key/value pairs
@@ -6468,7 +6671,7 @@ client.companies().countCompaniesForAdvancedFilter(
-
client.companies.createCompany(request) -> CreateCompanyResponse +
client.companies.listCompanyMemberships() -> ListCompanyMembershipsResponse
@@ -6481,14 +6684,13 @@ client.companies().countCompaniesForAdvancedFilter(
```java -client.companies().createCompany( - UpsertCompanyRequestBody +client.companies().listCompanyMemberships( + ListCompanyMembershipsRequest .builder() - .keys( - new HashMap() {{ - put("key", "value"); - }} - ) + .companyId("company_id") + .userId("user_id") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -6505,56 +6707,31 @@ client.companies().createCompany(
-**request:** `UpsertCompanyRequestBody` +**companyId:** `Optional`
-
-
- - - - -
-
client.companies.deleteCompanyByKeys(request) -> DeleteCompanyByKeysResponse
-#### 🔌 Usage - -
-
+**userId:** `Optional` + +
+
-```java -client.companies().deleteCompanyByKeys( - KeysRequestBody - .builder() - .keys( - new HashMap() {{ - put("key", "value"); - }} - ) - .build() -); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters - -
-
-
-**request:** `KeysRequestBody` +**offset:** `Optional` — Page offset (default 0)
@@ -6566,7 +6743,7 @@ client.companies().deleteCompanyByKeys(
-
client.companies.listCompaniesForAdvancedFilter() -> ListCompaniesForAdvancedFilterResponse +
client.companies.getOrCreateCompanyMembership(request) -> GetOrCreateCompanyMembershipResponse
@@ -6579,17 +6756,11 @@ client.companies().deleteCompanyByKeys(
```java -client.companies().listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest +client.companies().getOrCreateCompanyMembership( + GetOrCreateCompanyMembershipRequestBody .builder() - .monetizedSubscriptions(true) - .q("q") - .withoutPlan(true) - .withoutSubscription(true) - .sortOrderColumn("sort_order_column") - .sortOrderDirection(SortDirection.ASC) - .limit(1) - .offset(1) + .companyId("company_id") + .userId("user_id") .build() ); ``` @@ -6606,7 +6777,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**ids:** `Optional` — Filter companies by multiple company IDs (starts with comp_) +**companyId:** `String`
@@ -6614,87 +6785,94 @@ client.companies().listCompaniesForAdvancedFilter(
-**planIds:** `Optional` — Filter companies by one or more plan IDs (each ID starts with plan_) +**userId:** `String`
+
+
-
-
-**featureIds:** `Optional` — Filter companies by one or more feature IDs (each ID starts with feat_) -
+
+
client.companies.deleteCompanyMembership(companyMembershipId) -> DeleteCompanyMembershipResponse
-**creditTypeIds:** `Optional` — Filter companies by one or more credit type IDs (each ID starts with bcrd_) - -
-
+#### 🔌 Usage
-**subscriptionStatuses:** `Optional` — Filter companies by one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) - -
-
-
-**subscriptionTypes:** `Optional` — Filter companies by one or more subscription types (paid, free, trial) - +```java +client.companies().deleteCompanyMembership("company_membership_id"); +```
+ + + +#### ⚙️ Parameters
-**monetizedSubscriptions:** `Optional` — Filter companies that have monetized subscriptions - -
-
-
-**q:** `Optional` — Search for companies by name, keys or string traits +**companyMembershipId:** `String` — company_membership_id
+ + -
-
-**withoutPlan:** `Optional` — Filter out companies that have a plan -
+
+
client.companies.getActiveCompanySubscription() -> GetActiveCompanySubscriptionResponse
-**withoutSubscription:** `Optional` — Filter out companies that have a subscription - -
-
+#### 🔌 Usage
-**sortOrderColumn:** `Optional` — Column to sort by (e.g. name, created_at, last_seen_at) - +
+
+ +```java +client.companies().getActiveCompanySubscription( + GetActiveCompanySubscriptionRequest + .builder() + .companyId("company_id") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**sortOrderDirection:** `Optional` — Direction to sort by (asc or desc) +
+
+ +**companyId:** `Optional`
@@ -6702,7 +6880,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**displayProperties:** `Optional` — Select the display columns to return (e.g. plan, subscription, users, last_seen_at) +**companyIds:** `Optional`
@@ -6710,7 +6888,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -6718,7 +6896,7 @@ client.companies().listCompaniesForAdvancedFilter(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -6730,7 +6908,7 @@ client.companies().listCompaniesForAdvancedFilter(
-
client.companies.lookupCompany() -> LookupCompanyResponse +
client.companies.upsertCompanyTrait(request) -> UpsertCompanyTraitResponse
@@ -6743,12 +6921,13 @@ client.companies().listCompaniesForAdvancedFilter(
```java -client.companies().lookupCompany( - LookupCompanyRequest +client.companies().upsertCompanyTrait( + UpsertTraitRequestBody .builder() + .trait("trait") .keys( new HashMap() {{ - put("keys", "keys"); + put("key", "value"); }} ) .build() @@ -6767,7 +6946,7 @@ client.companies().lookupCompany(
-**keys:** `Map` — Key/value pairs +**request:** `UpsertTraitRequestBody`
@@ -6779,7 +6958,7 @@ client.companies().lookupCompany(
-
client.companies.listCompanyMemberships() -> ListCompanyMembershipsResponse +
client.companies.listEntityKeyDefinitions() -> ListEntityKeyDefinitionsResponse
@@ -6792,13 +6971,13 @@ client.companies().lookupCompany(
```java -client.companies().listCompanyMemberships( - ListCompanyMembershipsRequest +client.companies().listEntityKeyDefinitions( + ListEntityKeyDefinitionsRequest .builder() - .companyId("company_id") - .userId("user_id") - .limit(1) - .offset(1) + .entityType(EntityType.COMPANY) + .q("q") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -6815,7 +6994,7 @@ client.companies().listCompanyMemberships(
-**companyId:** `Optional` +**entityType:** `Optional`
@@ -6823,7 +7002,15 @@ client.companies().listCompanyMemberships(
-**userId:** `Optional` +**ids:** `Optional` + +
+
+ +
+
+ +**q:** `Optional`
@@ -6831,7 +7018,7 @@ client.companies().listCompanyMemberships(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -6839,7 +7026,7 @@ client.companies().listCompanyMemberships(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -6851,7 +7038,7 @@ client.companies().listCompanyMemberships(
-
client.companies.getOrCreateCompanyMembership(request) -> GetOrCreateCompanyMembershipResponse +
client.companies.countEntityKeyDefinitions() -> CountEntityKeyDefinitionsResponse
@@ -6864,11 +7051,13 @@ client.companies().listCompanyMemberships(
```java -client.companies().getOrCreateCompanyMembership( - GetOrCreateCompanyMembershipRequestBody +client.companies().countEntityKeyDefinitions( + CountEntityKeyDefinitionsRequest .builder() - .companyId("company_id") - .userId("user_id") + .entityType(EntityType.COMPANY) + .q("q") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -6885,7 +7074,7 @@ client.companies().getOrCreateCompanyMembership(
-**companyId:** `String` +**entityType:** `Optional`
@@ -6893,47 +7082,31 @@ client.companies().getOrCreateCompanyMembership(
-**userId:** `String` +**ids:** `Optional`
-
-
- - - -
- -
client.companies.deleteCompanyMembership(companyMembershipId) -> DeleteCompanyMembershipResponse
-#### 🔌 Usage - -
-
+**q:** `Optional` + +
+
-```java -client.companies().deleteCompanyMembership("company_membership_id"); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters - -
-
-
-**companyMembershipId:** `String` — company_membership_id +**offset:** `Optional` — Page offset (default 0)
@@ -6945,7 +7118,7 @@ client.companies().deleteCompanyMembership("company_membership_id");
-
client.companies.getActiveCompanySubscription() -> GetActiveCompanySubscriptionResponse +
client.companies.listEntityTraitDefinitions() -> ListEntityTraitDefinitionsResponse
@@ -6958,12 +7131,14 @@ client.companies().deleteCompanyMembership("company_membership_id");
```java -client.companies().getActiveCompanySubscription( - GetActiveCompanySubscriptionRequest +client.companies().listEntityTraitDefinitions( + ListEntityTraitDefinitionsRequest .builder() - .companyId("company_id") - .limit(1) - .offset(1) + .entityType(EntityType.COMPANY) + .q("q") + .traitType(TraitType.BOOLEAN) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -6980,7 +7155,7 @@ client.companies().getActiveCompanySubscription(
-**companyId:** `Optional` +**entityType:** `Optional`
@@ -6988,7 +7163,7 @@ client.companies().getActiveCompanySubscription(
-**companyIds:** `Optional` +**ids:** `Optional`
@@ -6996,7 +7171,7 @@ client.companies().getActiveCompanySubscription(
-**limit:** `Optional` — Page limit (default 100) +**q:** `Optional`
@@ -7004,57 +7179,31 @@ client.companies().getActiveCompanySubscription(
-**offset:** `Optional` — Page offset (default 0) +**traitType:** `Optional`
-
-
+
+
+**traitTypes:** `Optional` +
-
- -
client.companies.upsertCompanyTrait(request) -> UpsertCompanyTraitResponse -
-
- -#### 🔌 Usage - -
-
-```java -client.companies().upsertCompanyTrait( - UpsertTraitRequestBody - .builder() - .keys( - new HashMap() {{ - put("key", "value"); - }} - ) - .trait("trait") - .build() -); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters -
-
-
- -**request:** `UpsertTraitRequestBody` +**offset:** `Optional` — Page offset (default 0)
@@ -7066,7 +7215,7 @@ client.companies().upsertCompanyTrait(
-
client.companies.listEntityKeyDefinitions() -> ListEntityKeyDefinitionsResponse +
client.companies.getOrCreateEntityTraitDefinition(request) -> GetOrCreateEntityTraitDefinitionResponse
@@ -7079,13 +7228,14 @@ client.companies().upsertCompanyTrait(
```java -client.companies().listEntityKeyDefinitions( - ListEntityKeyDefinitionsRequest +client.companies().getOrCreateEntityTraitDefinition( + CreateEntityTraitDefinitionRequestBody .builder() .entityType(EntityType.COMPANY) - .q("q") - .limit(1) - .offset(1) + .traitType(TraitType.BOOLEAN) + .hierarchy( + Arrays.asList("hierarchy") + ) .build() ); ``` @@ -7102,15 +7252,7 @@ client.companies().listEntityKeyDefinitions(
-**entityType:** `Optional` - -
-
- -
-
- -**ids:** `Optional` +**displayName:** `Optional`
@@ -7118,7 +7260,7 @@ client.companies().listEntityKeyDefinitions(
-**q:** `Optional` +**entityType:** `EntityType`
@@ -7126,7 +7268,7 @@ client.companies().listEntityKeyDefinitions(
-**limit:** `Optional` — Page limit (default 100) +**hierarchy:** `List`
@@ -7134,7 +7276,7 @@ client.companies().listEntityKeyDefinitions(
-**offset:** `Optional` — Page offset (default 0) +**traitType:** `TraitType`
@@ -7146,7 +7288,7 @@ client.companies().listEntityKeyDefinitions(
-
client.companies.countEntityKeyDefinitions() -> CountEntityKeyDefinitionsResponse +
client.companies.getEntityTraitDefinition(entityTraitDefinitionId) -> GetEntityTraitDefinitionResponse
@@ -7159,15 +7301,7 @@ client.companies().listEntityKeyDefinitions(
```java -client.companies().countEntityKeyDefinitions( - CountEntityKeyDefinitionsRequest - .builder() - .entityType(EntityType.COMPANY) - .q("q") - .limit(1) - .offset(1) - .build() -); +client.companies().getEntityTraitDefinition("entity_trait_definition_id"); ```
@@ -7182,23 +7316,53 @@ client.companies().countEntityKeyDefinitions(
-**entityType:** `Optional` +**entityTraitDefinitionId:** `String` — entity_trait_definition_id
+ + + + + + +
+
client.companies.updateEntityTraitDefinition(entityTraitDefinitionId, request) -> UpdateEntityTraitDefinitionResponse
-**ids:** `Optional` - +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.companies().updateEntityTraitDefinition( + "entity_trait_definition_id", + UpdateEntityTraitDefinitionRequestBody + .builder() + .traitType(TraitType.BOOLEAN) + .build() +); +```
+
+
+ +#### ⚙️ Parameters
-**q:** `Optional` +
+
+ +**entityTraitDefinitionId:** `String` — entity_trait_definition_id
@@ -7206,7 +7370,7 @@ client.companies().countEntityKeyDefinitions(
-**limit:** `Optional` — Page limit (default 100) +**displayName:** `Optional`
@@ -7214,7 +7378,7 @@ client.companies().countEntityKeyDefinitions(
-**offset:** `Optional` — Page offset (default 0) +**traitType:** `TraitType`
@@ -7226,7 +7390,7 @@ client.companies().countEntityKeyDefinitions(
-
client.companies.listEntityTraitDefinitions() -> ListEntityTraitDefinitionsResponse +
client.companies.countEntityTraitDefinitions() -> CountEntityTraitDefinitionsResponse
@@ -7239,14 +7403,14 @@ client.companies().countEntityKeyDefinitions(
```java -client.companies().listEntityTraitDefinitions( - ListEntityTraitDefinitionsRequest +client.companies().countEntityTraitDefinitions( + CountEntityTraitDefinitionsRequest .builder() .entityType(EntityType.COMPANY) .q("q") .traitType(TraitType.BOOLEAN) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -7303,7 +7467,7 @@ client.companies().listEntityTraitDefinitions(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -7311,7 +7475,7 @@ client.companies().listEntityTraitDefinitions(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -7323,7 +7487,7 @@ client.companies().listEntityTraitDefinitions(
-
client.companies.getOrCreateEntityTraitDefinition(request) -> GetOrCreateEntityTraitDefinitionResponse +
client.companies.getEntityTraitValues() -> GetEntityTraitValuesResponse
@@ -7336,14 +7500,13 @@ client.companies().listEntityTraitDefinitions(
```java -client.companies().getOrCreateEntityTraitDefinition( - CreateEntityTraitDefinitionRequestBody +client.companies().getEntityTraitValues( + GetEntityTraitValuesRequest .builder() - .entityType(EntityType.COMPANY) - .hierarchy( - Arrays.asList("hierarchy") - ) - .traitType(TraitType.BOOLEAN) + .definitionId("definition_id") + .q("q") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -7360,7 +7523,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-**displayName:** `Optional` +**definitionId:** `String`
@@ -7368,7 +7531,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-**entityType:** `EntityType` +**q:** `Optional`
@@ -7376,7 +7539,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-**hierarchy:** `List` +**limit:** `Optional` — Page limit (default 100)
@@ -7384,7 +7547,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-**traitType:** `TraitType` +**offset:** `Optional` — Page offset (default 0)
@@ -7396,7 +7559,7 @@ client.companies().getOrCreateEntityTraitDefinition(
-
client.companies.getEntityTraitDefinition(entityTraitDefinitionId) -> GetEntityTraitDefinitionResponse +
client.companies.listPlanChanges() -> ListPlanChangesResponse
@@ -7409,7 +7572,16 @@ client.companies().getOrCreateEntityTraitDefinition(
```java -client.companies().getEntityTraitDefinition("entity_trait_definition_id"); +client.companies().listPlanChanges( + ListPlanChangesRequest + .builder() + .action("action") + .basePlanAction("base_plan_action") + .companyId("company_id") + .limit(1000000L) + .offset(1000000L) + .build() +); ```
@@ -7424,45 +7596,71 @@ client.companies().getEntityTraitDefinition("entity_trait_definition_id");
-**entityTraitDefinitionId:** `String` — entity_trait_definition_id +**action:** `Optional`
+ +
+
+ +**basePlanAction:** `Optional` +
+
+
+**companyId:** `Optional` +
-
-
client.companies.updateEntityTraitDefinition(entityTraitDefinitionId, request) -> UpdateEntityTraitDefinitionResponse
-#### 🔌 Usage +**companyIds:** `Optional` + +
+
+**planIds:** `Optional` + +
+
+
-```java -client.companies().updateEntityTraitDefinition( - "entity_trait_definition_id", - UpdateEntityTraitDefinitionRequestBody - .builder() - .traitType(TraitType.BOOLEAN) - .build() -); -``` +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) +
-#### ⚙️ Parameters + + + +
+ +
client.companies.getPlanChange(planChangeId) -> GetPlanChangeResponse +
+
+ +#### 🔌 Usage
@@ -7470,23 +7668,23 @@ client.companies().updateEntityTraitDefinition(
-**entityTraitDefinitionId:** `String` — entity_trait_definition_id - +```java +client.companies().getPlanChange("plan_change_id"); +```
+
+
+ +#### ⚙️ Parameters
-**displayName:** `Optional` - -
-
-
-**traitType:** `TraitType` +**planChangeId:** `String` — plan_change_id
@@ -7498,7 +7696,7 @@ client.companies().updateEntityTraitDefinition(
-
client.companies.countEntityTraitDefinitions() -> CountEntityTraitDefinitionsResponse +
client.companies.listPlanTraits() -> ListPlanTraitsResponse
@@ -7511,14 +7709,13 @@ client.companies().updateEntityTraitDefinition(
```java -client.companies().countEntityTraitDefinitions( - CountEntityTraitDefinitionsRequest +client.companies().listPlanTraits( + ListPlanTraitsRequest .builder() - .entityType(EntityType.COMPANY) - .q("q") - .traitType(TraitType.BOOLEAN) - .limit(1) - .offset(1) + .planId("plan_id") + .traitId("trait_id") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -7535,14 +7732,6 @@ client.companies().countEntityTraitDefinitions(
-**entityType:** `Optional` - -
-
- -
-
- **ids:** `Optional`
@@ -7551,7 +7740,7 @@ client.companies().countEntityTraitDefinitions(
-**q:** `Optional` +**planId:** `Optional`
@@ -7559,7 +7748,7 @@ client.companies().countEntityTraitDefinitions(
-**traitType:** `Optional` +**traitId:** `Optional`
@@ -7567,7 +7756,7 @@ client.companies().countEntityTraitDefinitions(
-**traitTypes:** `Optional` +**traitIds:** `Optional`
@@ -7575,7 +7764,7 @@ client.companies().countEntityTraitDefinitions(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -7583,7 +7772,7 @@ client.companies().countEntityTraitDefinitions(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -7595,7 +7784,7 @@ client.companies().countEntityTraitDefinitions(
-
client.companies.getEntityTraitValues() -> GetEntityTraitValuesResponse +
client.companies.createPlanTrait(request) -> CreatePlanTraitResponse
@@ -7608,13 +7797,12 @@ client.companies().countEntityTraitDefinitions(
```java -client.companies().getEntityTraitValues( - GetEntityTraitValuesRequest +client.companies().createPlanTrait( + CreatePlanTraitRequestBody .builder() - .definitionId("definition_id") - .q("q") - .limit(1) - .offset(1) + .planId("plan_id") + .traitId("trait_id") + .traitValue("trait_value") .build() ); ``` @@ -7631,7 +7819,7 @@ client.companies().getEntityTraitValues(
-**definitionId:** `String` +**planId:** `String`
@@ -7639,7 +7827,7 @@ client.companies().getEntityTraitValues(
-**q:** `Optional` +**traitId:** `String`
@@ -7647,27 +7835,19 @@ client.companies().getEntityTraitValues(
-**limit:** `Optional` — Page limit (default 100) +**traitValue:** `String`
- -
-
- -**offset:** `Optional` — Page offset (default 0) - -
-
-
-
+ +
-
client.companies.listPlanChanges() -> ListPlanChangesResponse +
client.companies.getPlanTrait(planTraitId) -> GetPlanTraitResponse
@@ -7680,16 +7860,7 @@ client.companies().getEntityTraitValues(
```java -client.companies().listPlanChanges( - ListPlanChangesRequest - .builder() - .action("action") - .basePlanAction("base_plan_action") - .companyId("company_id") - .limit(1) - .offset(1) - .build() -); +client.companies().getPlanTrait("plan_trait_id"); ```
@@ -7704,39 +7875,54 @@ client.companies().listPlanChanges(
-**action:** `Optional` +**planTraitId:** `String` — plan_trait_id
+ + -
-
-**basePlanAction:** `Optional` -
+
+
client.companies.updatePlanTrait(planTraitId, request) -> UpdatePlanTraitResponse
-**companyId:** `Optional` - -
-
+#### 🔌 Usage
-**companyIds:** `Optional` - +
+
+ +```java +client.companies().updatePlanTrait( + "plan_trait_id", + UpdatePlanTraitRequestBody + .builder() + .planId("plan_id") + .traitValue("trait_value") + .build() +); +```
+
+
+ +#### ⚙️ Parameters
-**planIds:** `Optional` +
+
+ +**planTraitId:** `String` — plan_trait_id
@@ -7744,7 +7930,7 @@ client.companies().listPlanChanges(
-**limit:** `Optional` — Page limit (default 100) +**planId:** `String`
@@ -7752,7 +7938,7 @@ client.companies().listPlanChanges(
-**offset:** `Optional` — Page offset (default 0) +**traitValue:** `String`
@@ -7764,7 +7950,7 @@ client.companies().listPlanChanges(
-
client.companies.getPlanChange(planChangeId) -> GetPlanChangeResponse +
client.companies.deletePlanTrait(planTraitId) -> DeletePlanTraitResponse
@@ -7777,7 +7963,7 @@ client.companies().listPlanChanges(
```java -client.companies().getPlanChange("plan_change_id"); +client.companies().deletePlanTrait("plan_trait_id"); ```
@@ -7792,7 +7978,7 @@ client.companies().getPlanChange("plan_change_id");
-**planChangeId:** `String` — plan_change_id +**planTraitId:** `String` — plan_trait_id
@@ -7804,7 +7990,7 @@ client.companies().getPlanChange("plan_change_id");
-
client.companies.listPlanTraits() -> ListPlanTraitsResponse +
client.companies.updatePlanTraitsBulk(request) -> UpdatePlanTraitsBulkResponse
@@ -7817,13 +8003,20 @@ client.companies().getPlanChange("plan_change_id");
```java -client.companies().listPlanTraits( - ListPlanTraitsRequest +client.companies().updatePlanTraitsBulk( + UpdatePlanTraitBulkRequestBody .builder() + .applyToExistingCompanies(true) .planId("plan_id") - .traitId("trait_id") - .limit(1) - .offset(1) + .traits( + Arrays.asList( + UpdatePlanTraitTraitRequestBody + .builder() + .traitId("trait_id") + .traitValue("trait_value") + .build() + ) + ) .build() ); ``` @@ -7840,31 +8033,7 @@ client.companies().listPlanTraits(
-**ids:** `Optional` - -
-
- -
-
- -**planId:** `Optional` - -
-
- -
-
- -**traitId:** `Optional` - -
-
- -
-
- -**traitIds:** `Optional` +**applyToExistingCompanies:** `Boolean`
@@ -7872,7 +8041,7 @@ client.companies().listPlanTraits(
-**limit:** `Optional` — Page limit (default 100) +**planId:** `String`
@@ -7880,7 +8049,7 @@ client.companies().listPlanTraits(
-**offset:** `Optional` — Page offset (default 0) +**traits:** `List`
@@ -7892,7 +8061,7 @@ client.companies().listPlanTraits(
-
client.companies.createPlanTrait(request) -> CreatePlanTraitResponse +
client.companies.countPlanTraits() -> CountPlanTraitsResponse
@@ -7905,12 +8074,13 @@ client.companies().listPlanTraits(
```java -client.companies().createPlanTrait( - CreatePlanTraitRequestBody +client.companies().countPlanTraits( + CountPlanTraitsRequest .builder() .planId("plan_id") .traitId("trait_id") - .traitValue("trait_value") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -7927,7 +8097,7 @@ client.companies().createPlanTrait(
-**planId:** `String` +**ids:** `Optional`
@@ -7935,7 +8105,7 @@ client.companies().createPlanTrait(
-**traitId:** `String` +**planId:** `Optional`
@@ -7943,7 +8113,31 @@ client.companies().createPlanTrait(
-**traitValue:** `String` +**traitId:** `Optional` + +
+
+ +
+
+ +**traitIds:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0)
@@ -7955,7 +8149,7 @@ client.companies().createPlanTrait(
-
client.companies.getPlanTrait(planTraitId) -> GetPlanTraitResponse +
client.companies.upsertUserTrait(request) -> UpsertUserTraitResponse
@@ -7968,7 +8162,17 @@ client.companies().createPlanTrait(
```java -client.companies().getPlanTrait("plan_trait_id"); +client.companies().upsertUserTrait( + UpsertTraitRequestBody + .builder() + .trait("trait") + .keys( + new HashMap() {{ + put("key", "value"); + }} + ) + .build() +); ```
@@ -7983,7 +8187,7 @@ client.companies().getPlanTrait("plan_trait_id");
-**planTraitId:** `String` — plan_trait_id +**request:** `UpsertTraitRequestBody`
@@ -7995,7 +8199,7 @@ client.companies().getPlanTrait("plan_trait_id");
-
client.companies.updatePlanTrait(planTraitId, request) -> UpdatePlanTraitResponse +
client.companies.listUsers() -> ListUsersResponse
@@ -8008,12 +8212,14 @@ client.companies().getPlanTrait("plan_trait_id");
```java -client.companies().updatePlanTrait( - "plan_trait_id", - UpdatePlanTraitRequestBody +client.companies().listUsers( + ListUsersRequest .builder() + .companyId("company_id") .planId("plan_id") - .traitValue("trait_value") + .q("q") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -8030,7 +8236,7 @@ client.companies().updatePlanTrait(
-**planTraitId:** `String` — plan_trait_id +**companyId:** `Optional` — Filter users by company ID (starts with comp_)
@@ -8038,7 +8244,7 @@ client.companies().updatePlanTrait(
-**planId:** `String` +**ids:** `Optional` — Filter users by multiple user IDs (starts with user_)
@@ -8046,47 +8252,31 @@ client.companies().updatePlanTrait(
-**traitValue:** `String` +**planId:** `Optional` — Filter users by plan ID (starts with plan_)
-
-
- - - - -
-
client.companies.deletePlanTrait(planTraitId) -> DeletePlanTraitResponse
-#### 🔌 Usage - -
-
+**q:** `Optional` — Search for users by name, keys or string traits + +
+
-```java -client.companies().deletePlanTrait("plan_trait_id"); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters - -
-
-
-**planTraitId:** `String` — plan_trait_id +**offset:** `Optional` — Page offset (default 0)
@@ -8098,7 +8288,7 @@ client.companies().deletePlanTrait("plan_trait_id");
-
client.companies.updatePlanTraitsBulk(request) -> UpdatePlanTraitsBulkResponse +
client.companies.upsertUser(request) -> UpsertUserResponse
@@ -8111,19 +8301,13 @@ client.companies().deletePlanTrait("plan_trait_id");
```java -client.companies().updatePlanTraitsBulk( - UpdatePlanTraitBulkRequestBody +client.companies().upsertUser( + UpsertUserRequestBody .builder() - .applyToExistingCompanies(true) - .planId("plan_id") - .traits( - Arrays.asList( - UpdatePlanTraitTraitRequestBody - .builder() - .traitId("trait_id") - .traitValue("trait_value") - .build() - ) + .keys( + new HashMap() {{ + put("key", "value"); + }} ) .build() ); @@ -8141,23 +8325,7 @@ client.companies().updatePlanTraitsBulk(
-**applyToExistingCompanies:** `Boolean` - -
-
- -
-
- -**planId:** `String` - -
-
- -
-
- -**traits:** `List` +**request:** `UpsertUserRequestBody`
@@ -8169,7 +8337,7 @@ client.companies().updatePlanTraitsBulk(
-
client.companies.countPlanTraits() -> CountPlanTraitsResponse +
client.companies.getUser(userId) -> GetUserResponse
@@ -8182,15 +8350,7 @@ client.companies().updatePlanTraitsBulk(
```java -client.companies().countPlanTraits( - CountPlanTraitsRequest - .builder() - .planId("plan_id") - .traitId("trait_id") - .limit(1) - .offset(1) - .build() -); +client.companies().getUser("user_id"); ```
@@ -8205,47 +8365,7 @@ client.companies().countPlanTraits(
-**ids:** `Optional` - -
-
- -
-
- -**planId:** `Optional` - -
-
- -
-
- -**traitId:** `Optional` - -
-
- -
-
- -**traitIds:** `Optional` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) +**userId:** `String` — user_id
@@ -8257,7 +8377,7 @@ client.companies().countPlanTraits(
-
client.companies.upsertUserTrait(request) -> UpsertUserTraitResponse +
client.companies.deleteUser(userId) -> DeleteUserResponse
@@ -8270,17 +8390,7 @@ client.companies().countPlanTraits(
```java -client.companies().upsertUserTrait( - UpsertTraitRequestBody - .builder() - .keys( - new HashMap() {{ - put("key", "value"); - }} - ) - .trait("trait") - .build() -); +client.companies().deleteUser("user_id"); ```
@@ -8295,7 +8405,7 @@ client.companies().upsertUserTrait(
-**request:** `UpsertTraitRequestBody` +**userId:** `String` — user_id
@@ -8307,7 +8417,7 @@ client.companies().upsertUserTrait(
-
client.companies.listUsers() -> ListUsersResponse +
client.companies.countUsers() -> CountUsersResponse
@@ -8320,14 +8430,14 @@ client.companies().upsertUserTrait(
```java -client.companies().listUsers( - ListUsersRequest +client.companies().countUsers( + CountUsersRequest .builder() .companyId("company_id") .planId("plan_id") .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -8376,7 +8486,7 @@ client.companies().listUsers(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -8384,7 +8494,7 @@ client.companies().listUsers(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -8396,7 +8506,7 @@ client.companies().listUsers(
-
client.companies.upsertUser(request) -> UpsertUserResponse +
client.companies.createUser(request) -> CreateUserResponse
@@ -8409,7 +8519,7 @@ client.companies().listUsers(
```java -client.companies().upsertUser( +client.companies().createUser( UpsertUserRequestBody .builder() .keys( @@ -8445,7 +8555,7 @@ client.companies().upsertUser(
-
client.companies.getUser(userId) -> GetUserResponse +
client.companies.deleteUserByKeys(request) -> DeleteUserByKeysResponse
@@ -8458,7 +8568,16 @@ client.companies().upsertUser(
```java -client.companies().getUser("user_id"); +client.companies().deleteUserByKeys( + KeysRequestBody + .builder() + .keys( + new HashMap() {{ + put("key", "value"); + }} + ) + .build() +); ```
@@ -8473,7 +8592,7 @@ client.companies().getUser("user_id");
-**userId:** `String` — user_id +**request:** `KeysRequestBody`
@@ -8485,7 +8604,7 @@ client.companies().getUser("user_id");
-
client.companies.deleteUser(userId) -> DeleteUserResponse +
client.companies.lookupUser() -> LookupUserResponse
@@ -8498,7 +8617,16 @@ client.companies().getUser("user_id");
```java -client.companies().deleteUser("user_id"); +client.companies().lookupUser( + LookupUserRequest + .builder() + .keys( + new HashMap() {{ + put("keys", "keys"); + }} + ) + .build() +); ```
@@ -8513,7 +8641,7 @@ client.companies().deleteUser("user_id");
-**userId:** `String` — user_id +**keys:** `Map` — Key/value pairs
@@ -8525,7 +8653,8 @@ client.companies().deleteUser("user_id");
-
client.companies.countUsers() -> CountUsersResponse +## entitlements +
client.entitlements.listCompanyOverrides() -> ListCompanyOverridesResponse
@@ -8538,14 +8667,15 @@ client.companies().deleteUser("user_id");
```java -client.companies().countUsers( - CountUsersRequest +client.entitlements().listCompanyOverrides( + ListCompanyOverridesRequest .builder() .companyId("company_id") - .planId("plan_id") + .featureId("feature_id") + .withoutExpired(true) .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -8562,7 +8692,7 @@ client.companies().countUsers(
-**companyId:** `Optional` — Filter users by company ID (starts with comp_) +**companyId:** `Optional` — Filter company overrides by a single company ID (starting with comp_)
@@ -8570,7 +8700,7 @@ client.companies().countUsers(
-**ids:** `Optional` — Filter users by multiple user IDs (starts with user_) +**companyIds:** `Optional` — Filter company overrides by multiple company IDs (starting with comp_)
@@ -8578,7 +8708,7 @@ client.companies().countUsers(
-**planId:** `Optional` — Filter users by plan ID (starts with plan_) +**featureId:** `Optional` — Filter company overrides by a single feature ID (starting with feat_)
@@ -8586,7 +8716,31 @@ client.companies().countUsers(
-**q:** `Optional` — Search for users by name, keys or string traits +**featureIds:** `Optional` — Filter company overrides by multiple feature IDs (starting with feat_) + +
+
+ +
+
+ +**ids:** `Optional` — Filter company overrides by multiple company override IDs (starting with cmov_) + +
+
+ +
+
+ +**withoutExpired:** `Optional` — Filter company overrides by whether they have not expired + +
+
+ +
+
+ +**q:** `Optional` — Search for company overrides by feature or company name
@@ -8594,7 +8748,7 @@ client.companies().countUsers(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -8602,7 +8756,7 @@ client.companies().countUsers(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -8614,7 +8768,7 @@ client.companies().countUsers(
-
client.companies.createUser(request) -> CreateUserResponse +
client.entitlements.createCompanyOverride(request) -> CreateCompanyOverrideResponse
@@ -8627,14 +8781,12 @@ client.companies().countUsers(
```java -client.companies().createUser( - UpsertUserRequestBody +client.entitlements().createCompanyOverride( + CreateCompanyOverrideRequestBody .builder() - .keys( - new HashMap() {{ - put("key", "value"); - }} - ) + .companyId("company_id") + .featureId("feature_id") + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -8651,56 +8803,95 @@ client.companies().createUser(
-**request:** `UpsertUserRequestBody` +**companyId:** `String`
+ +
+
+ +**creditConsumptionRate:** `Optional` +
+
+
+**expirationDate:** `Optional` +
-
-
client.companies.deleteUserByKeys(request) -> DeleteUserByKeysResponse
-#### 🔌 Usage +**featureId:** `String` + +
+
+**metricPeriod:** `Optional` + +
+
+
-```java -client.companies().deleteUserByKeys( - KeysRequestBody - .builder() - .keys( - new HashMap() {{ - put("key", "value"); - }} - ) - .build() -); -``` +**metricPeriodMonthReset:** `Optional` + +
+
+ +
+
+ +**note:** `Optional` +
+ +
+
+ +**valueBool:** `Optional` +
-#### ⚙️ Parameters +
+
+ +**valueCreditId:** `Optional` + +
+
+**valueNumeric:** `Optional` + +
+
+
-**request:** `KeysRequestBody` +**valueTraitId:** `Optional` + +
+
+ +
+
+ +**valueType:** `EntitlementValueType`
@@ -8712,7 +8903,7 @@ client.companies().deleteUserByKeys(
-
client.companies.lookupUser() -> LookupUserResponse +
client.entitlements.getCompanyOverride(companyOverrideId) -> GetCompanyOverrideResponse
@@ -8725,16 +8916,7 @@ client.companies().deleteUserByKeys(
```java -client.companies().lookupUser( - LookupUserRequest - .builder() - .keys( - new HashMap() {{ - put("keys", "keys"); - }} - ) - .build() -); +client.entitlements().getCompanyOverride("company_override_id"); ```
@@ -8749,7 +8931,7 @@ client.companies().lookupUser(
-**keys:** `Map` — Key/value pairs +**companyOverrideId:** `String` — company_override_id
@@ -8761,8 +8943,7 @@ client.companies().lookupUser(
-## entitlements -
client.entitlements.listCompanyOverrides() -> ListCompanyOverridesResponse +
client.entitlements.updateCompanyOverride(companyOverrideId, request) -> UpdateCompanyOverrideResponse
@@ -8775,15 +8956,11 @@ client.companies().lookupUser(
```java -client.entitlements().listCompanyOverrides( - ListCompanyOverridesRequest +client.entitlements().updateCompanyOverride( + "company_override_id", + UpdateCompanyOverrideRequestBody .builder() - .companyId("company_id") - .featureId("feature_id") - .withoutExpired(true) - .q("q") - .limit(1) - .offset(1) + .valueType(EntitlementValueType.BOOLEAN) .build() ); ``` @@ -8800,7 +8977,7 @@ client.entitlements().listCompanyOverrides(
-**companyId:** `Optional` — Filter company overrides by a single company ID (starting with comp_) +**companyOverrideId:** `String` — company_override_id
@@ -8808,7 +8985,7 @@ client.entitlements().listCompanyOverrides(
-**companyIds:** `Optional` — Filter company overrides by multiple company IDs (starting with comp_) +**creditConsumptionRate:** `Optional`
@@ -8816,7 +8993,7 @@ client.entitlements().listCompanyOverrides(
-**featureId:** `Optional` — Filter company overrides by a single feature ID (starting with feat_) +**expirationDate:** `Optional`
@@ -8824,7 +9001,7 @@ client.entitlements().listCompanyOverrides(
-**featureIds:** `Optional` — Filter company overrides by multiple feature IDs (starting with feat_) +**metricPeriod:** `Optional`
@@ -8832,7 +9009,7 @@ client.entitlements().listCompanyOverrides(
-**ids:** `Optional` — Filter company overrides by multiple company override IDs (starting with cmov_) +**metricPeriodMonthReset:** `Optional`
@@ -8840,7 +9017,7 @@ client.entitlements().listCompanyOverrides(
-**withoutExpired:** `Optional` — Filter company overrides by whether they have not expired +**note:** `Optional`
@@ -8848,7 +9025,23 @@ client.entitlements().listCompanyOverrides(
-**q:** `Optional` — Search for company overrides by feature or company name +**valueBool:** `Optional` + +
+
+ +
+
+ +**valueCreditId:** `Optional` + +
+
+ +
+
+ +**valueNumeric:** `Optional`
@@ -8856,7 +9049,7 @@ client.entitlements().listCompanyOverrides(
-**limit:** `Optional` — Page limit (default 100) +**valueTraitId:** `Optional`
@@ -8864,7 +9057,7 @@ client.entitlements().listCompanyOverrides(
-**offset:** `Optional` — Page offset (default 0) +**valueType:** `EntitlementValueType`
@@ -8876,7 +9069,7 @@ client.entitlements().listCompanyOverrides(
-
client.entitlements.createCompanyOverride(request) -> CreateCompanyOverrideResponse +
client.entitlements.deleteCompanyOverride(companyOverrideId) -> DeleteCompanyOverrideResponse
@@ -8889,14 +9082,7 @@ client.entitlements().listCompanyOverrides(
```java -client.entitlements().createCompanyOverride( - CreateCompanyOverrideRequestBody - .builder() - .companyId("company_id") - .featureId("feature_id") - .valueType(EntitlementValueType.BOOLEAN) - .build() -); +client.entitlements().deleteCompanyOverride("company_override_id"); ```
@@ -8911,55 +9097,57 @@ client.entitlements().createCompanyOverride(
-**companyId:** `String` +**companyOverrideId:** `String` — company_override_id
+ + -
-
-**creditConsumptionRate:** `Optional` -
+
+
client.entitlements.countCompanyOverrides() -> CountCompanyOverridesResponse
-**expirationDate:** `Optional` - -
-
+#### 🔌 Usage
-**featureId:** `String` - -
-
-
-**metricPeriod:** `Optional` - +```java +client.entitlements().countCompanyOverrides( + CountCompanyOverridesRequest + .builder() + .companyId("company_id") + .featureId("feature_id") + .withoutExpired(true) + .q("q") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**metricPeriodMonthReset:** `Optional` - -
-
-
-**note:** `Optional` +**companyId:** `Optional` — Filter company overrides by a single company ID (starting with comp_)
@@ -8967,7 +9155,7 @@ client.entitlements().createCompanyOverride(
-**valueBool:** `Optional` +**companyIds:** `Optional` — Filter company overrides by multiple company IDs (starting with comp_)
@@ -8975,7 +9163,7 @@ client.entitlements().createCompanyOverride(
-**valueCreditId:** `Optional` +**featureId:** `Optional` — Filter company overrides by a single feature ID (starting with feat_)
@@ -8983,7 +9171,7 @@ client.entitlements().createCompanyOverride(
-**valueNumeric:** `Optional` +**featureIds:** `Optional` — Filter company overrides by multiple feature IDs (starting with feat_)
@@ -8991,7 +9179,7 @@ client.entitlements().createCompanyOverride(
-**valueTraitId:** `Optional` +**ids:** `Optional` — Filter company overrides by multiple company override IDs (starting with cmov_)
@@ -8999,47 +9187,31 @@ client.entitlements().createCompanyOverride(
-**valueType:** `EntitlementValueType` +**withoutExpired:** `Optional` — Filter company overrides by whether they have not expired
- - - - - - -
-
client.entitlements.getCompanyOverride(companyOverrideId) -> GetCompanyOverrideResponse
-#### 🔌 Usage - -
-
+**q:** `Optional` — Search for company overrides by feature or company name + +
+
-```java -client.entitlements().getCompanyOverride("company_override_id"); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters - -
-
-
-**companyOverrideId:** `String` — company_override_id +**offset:** `Optional` — Page offset (default 0)
@@ -9051,7 +9223,7 @@ client.entitlements().getCompanyOverride("company_override_id");
-
client.entitlements.updateCompanyOverride(companyOverrideId, request) -> UpdateCompanyOverrideResponse +
client.entitlements.listFeatureCompanies() -> ListFeatureCompaniesResponse
@@ -9064,11 +9236,13 @@ client.entitlements().getCompanyOverride("company_override_id");
```java -client.entitlements().updateCompanyOverride( - "company_override_id", - UpdateCompanyOverrideRequestBody +client.entitlements().listFeatureCompanies( + ListFeatureCompaniesRequest .builder() - .valueType(EntitlementValueType.BOOLEAN) + .featureId("feature_id") + .q("q") + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -9085,7 +9259,7 @@ client.entitlements().updateCompanyOverride(
-**companyOverrideId:** `String` — company_override_id +**featureId:** `String`
@@ -9093,7 +9267,7 @@ client.entitlements().updateCompanyOverride(
-**creditConsumptionRate:** `Optional` +**q:** `Optional`
@@ -9101,7 +9275,7 @@ client.entitlements().updateCompanyOverride(
-**expirationDate:** `Optional` +**limit:** `Optional` — Page limit (default 100)
@@ -9109,55 +9283,55 @@ client.entitlements().updateCompanyOverride(
-**metricPeriod:** `Optional` +**offset:** `Optional` — Page offset (default 0)
+
+
-
-
-**metricPeriodMonthReset:** `Optional` -
+
+
client.entitlements.countFeatureCompanies() -> CountFeatureCompaniesResponse
-**note:** `Optional` - -
-
+#### 🔌 Usage
-**valueBool:** `Optional` - -
-
-
-**valueCreditId:** `Optional` - +```java +client.entitlements().countFeatureCompanies( + CountFeatureCompaniesRequest + .builder() + .featureId("feature_id") + .q("q") + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**valueNumeric:** `Optional` - -
-
-
-**valueTraitId:** `Optional` +**featureId:** `String`
@@ -9165,47 +9339,23 @@ client.entitlements().updateCompanyOverride(
-**valueType:** `EntitlementValueType` +**q:** `Optional`
- - - - - - -
- -
client.entitlements.deleteCompanyOverride(companyOverrideId) -> DeleteCompanyOverrideResponse -
-
- -#### 🔌 Usage
-
-
- -```java -client.entitlements().deleteCompanyOverride("company_override_id"); -``` -
-
+**limit:** `Optional` — Page limit (default 100) +
-#### ⚙️ Parameters - -
-
-
-**companyOverrideId:** `String` — company_override_id +**offset:** `Optional` — Page offset (default 0)
@@ -9217,7 +9367,7 @@ client.entitlements().deleteCompanyOverride("company_override_id");
-
client.entitlements.countCompanyOverrides() -> CountCompanyOverridesResponse +
client.entitlements.listFeatureUsage() -> ListFeatureUsageResponse
@@ -9230,15 +9380,15 @@ client.entitlements().deleteCompanyOverride("company_override_id");
```java -client.entitlements().countCompanyOverrides( - CountCompanyOverridesRequest +client.entitlements().listFeatureUsage( + ListFeatureUsageRequest .builder() .companyId("company_id") - .featureId("feature_id") - .withoutExpired(true) + .includeUsageAggregation(true) .q("q") - .limit(1) - .offset(1) + .withoutNegativeEntitlements(true) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -9255,15 +9405,7 @@ client.entitlements().countCompanyOverrides(
-**companyId:** `Optional` — Filter company overrides by a single company ID (starting with comp_) - -
-
- -
-
- -**companyIds:** `Optional` — Filter company overrides by multiple company IDs (starting with comp_) +**companyId:** `Optional`
@@ -9271,7 +9413,7 @@ client.entitlements().countCompanyOverrides(
-**featureId:** `Optional` — Filter company overrides by a single feature ID (starting with feat_) +**companyKeys:** `Optional>`
@@ -9279,7 +9421,7 @@ client.entitlements().countCompanyOverrides(
-**featureIds:** `Optional` — Filter company overrides by multiple feature IDs (starting with feat_) +**featureIds:** `Optional`
@@ -9287,7 +9429,7 @@ client.entitlements().countCompanyOverrides(
-**ids:** `Optional` — Filter company overrides by multiple company override IDs (starting with cmov_) +**includeUsageAggregation:** `Optional` — Include time-bucketed usage aggregation (today, this week, this month, billing period) for credit-based entitlements. Defaults to false for performance.
@@ -9295,7 +9437,7 @@ client.entitlements().countCompanyOverrides(
-**withoutExpired:** `Optional` — Filter company overrides by whether they have not expired +**q:** `Optional`
@@ -9303,7 +9445,7 @@ client.entitlements().countCompanyOverrides(
-**q:** `Optional` — Search for company overrides by feature or company name +**withoutNegativeEntitlements:** `Optional`
@@ -9311,7 +9453,7 @@ client.entitlements().countCompanyOverrides(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -9319,7 +9461,7 @@ client.entitlements().countCompanyOverrides(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -9331,7 +9473,7 @@ client.entitlements().countCompanyOverrides(
-
client.entitlements.listFeatureCompanies() -> ListFeatureCompaniesResponse +
client.entitlements.getFeatureUsageTimeSeries() -> GetFeatureUsageTimeSeriesResponse
@@ -9344,13 +9486,14 @@ client.entitlements().countCompanyOverrides(
```java -client.entitlements().listFeatureCompanies( - ListFeatureCompaniesRequest +client.entitlements().getFeatureUsageTimeSeries( + GetFeatureUsageTimeSeriesRequest .builder() + .companyId("company_id") + .endTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) .featureId("feature_id") - .q("q") - .limit(1) - .offset(1) + .startTime(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .granularity(TimeSeriesGranularity.DAILY) .build() ); ``` @@ -9367,7 +9510,7 @@ client.entitlements().listFeatureCompanies(
-**featureId:** `String` +**companyId:** `String`
@@ -9375,7 +9518,7 @@ client.entitlements().listFeatureCompanies(
-**q:** `Optional` +**endTime:** `OffsetDateTime`
@@ -9383,7 +9526,7 @@ client.entitlements().listFeatureCompanies(
-**limit:** `Optional` — Page limit (default 100) +**featureId:** `String`
@@ -9391,267 +9534,16 @@ client.entitlements().listFeatureCompanies(
-**offset:** `Optional` — Page offset (default 0) +**granularity:** `Optional`
-
-
+
+
-
-
-
- -
client.entitlements.countFeatureCompanies() -> CountFeatureCompaniesResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.entitlements().countFeatureCompanies( - CountFeatureCompaniesRequest - .builder() - .featureId("feature_id") - .q("q") - .limit(1) - .offset(1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**featureId:** `String` - -
-
- -
-
- -**q:** `Optional` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) - -
-
-
-
- - -
-
-
- -
client.entitlements.listFeatureUsage() -> ListFeatureUsageResponse -
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.entitlements().listFeatureUsage( - ListFeatureUsageRequest - .builder() - .companyId("company_id") - .includeUsageAggregation(true) - .q("q") - .withoutNegativeEntitlements(true) - .limit(1) - .offset(1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**companyId:** `Optional` - -
-
- -
-
- -**companyKeys:** `Optional>` - -
-
- -
-
- -**featureIds:** `Optional` - -
-
- -
-
- -**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` - -
-
- -
-
- -**withoutNegativeEntitlements:** `Optional` - -
-
- -
-
- -**limit:** `Optional` — Page limit (default 100) - -
-
- -
-
- -**offset:** `Optional` — Page offset (default 0) - -
-
-
-
- - -
-
-
- -
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` - +**startTime:** `OffsetDateTime` +
@@ -9682,8 +9574,8 @@ client.entitlements().countFeatureUsage( .includeUsageAggregation(true) .q("q") .withoutNegativeEntitlements(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -9748,7 +9640,7 @@ client.entitlements().countFeatureUsage(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -9756,7 +9648,7 @@ client.entitlements().countFeatureUsage(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -9786,8 +9678,8 @@ client.entitlements().listFeatureUsers( .builder() .featureId("feature_id") .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -9820,7 +9712,7 @@ client.entitlements().listFeatureUsers(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -9828,7 +9720,7 @@ client.entitlements().listFeatureUsers(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -9858,8 +9750,8 @@ client.entitlements().countFeatureUsers( .builder() .featureId("feature_id") .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -9892,7 +9784,7 @@ client.entitlements().countFeatureUsers(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -9900,7 +9792,7 @@ client.entitlements().countFeatureUsers(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -9933,8 +9825,8 @@ client.entitlements().listPlanEntitlements( .planVersionId("plan_version_id") .q("q") .withMeteredProducts(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -10023,7 +9915,7 @@ client.entitlements().listPlanEntitlements(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -10031,7 +9923,7 @@ client.entitlements().listPlanEntitlements(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -10086,7 +9978,7 @@ client.entitlements().createPlanEntitlement(
-**billingThreshold:** `Optional` +**billingThreshold:** `Optional`
@@ -10150,7 +10042,7 @@ client.entitlements().createPlanEntitlement(
-**monthlyUnitPrice:** `Optional` +**monthlyUnitPrice:** `Optional`
@@ -10182,6 +10074,14 @@ client.entitlements().createPlanEntitlement(
+**planVersionId:** `Optional` + +
+
+ +
+
+ **priceBehavior:** `Optional`
@@ -10198,7 +10098,7 @@ client.entitlements().createPlanEntitlement(
-**softLimit:** `Optional` +**softLimit:** `Optional`
@@ -10230,7 +10130,7 @@ client.entitlements().createPlanEntitlement(
-**valueNumeric:** `Optional` +**valueNumeric:** `Optional`
@@ -10270,7 +10170,7 @@ client.entitlements().createPlanEntitlement(
-**yearlyUnitPrice:** `Optional` +**yearlyUnitPrice:** `Optional`
@@ -10380,7 +10280,7 @@ client.entitlements().updatePlanEntitlement(
-**billingThreshold:** `Optional` +**billingThreshold:** `Optional`
@@ -10436,7 +10336,7 @@ client.entitlements().updatePlanEntitlement(
-**monthlyUnitPrice:** `Optional` +**monthlyUnitPrice:** `Optional`
@@ -10476,7 +10376,7 @@ client.entitlements().updatePlanEntitlement(
-**softLimit:** `Optional` +**softLimit:** `Optional`
@@ -10508,7 +10408,7 @@ client.entitlements().updatePlanEntitlement(
-**valueNumeric:** `Optional` +**valueNumeric:** `Optional`
@@ -10548,7 +10448,7 @@ client.entitlements().updatePlanEntitlement(
-**yearlyUnitPrice:** `Optional` +**yearlyUnitPrice:** `Optional`
@@ -10629,8 +10529,8 @@ client.entitlements().countPlanEntitlements( .planVersionId("plan_version_id") .q("q") .withMeteredProducts(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -10719,7 +10619,7 @@ client.entitlements().countPlanEntitlements(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -10727,7 +10627,7 @@ client.entitlements().countPlanEntitlements(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -10928,12 +10828,13 @@ client.plans().listPlans( .forInitialPlan(true) .forTrialExpiryPlan(true) .hasProductId(true) + .includeDraftVersions(true) .planType(PlanType.PLAN) .q("q") .withoutEntitlementFor("without_entitlement_for") .withoutPaidProductId(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -10998,7 +10899,7 @@ client.plans().listPlans(
-**planType:** `Optional` — Filter by plan type +**includeDraftVersions:** `Optional` — Include billing settings from draft versions for plans which have draft version
@@ -11006,7 +10907,7 @@ client.plans().listPlans(
-**q:** `Optional` +**planType:** `Optional` — Filter by plan type
@@ -11014,7 +10915,15 @@ client.plans().listPlans(
-**withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID +**q:** `Optional` + +
+
+ +
+
+ +**withoutEntitlementFor:** `Optional` — Filter out plans that already have a plan entitlement for the specified feature ID
@@ -11030,7 +10939,7 @@ client.plans().listPlans(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -11038,7 +10947,7 @@ client.plans().listPlans(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -11110,7 +11019,13 @@ client.plans().createPlan(
```java -client.plans().getPlan("plan_id"); +client.plans().getPlan( + "plan_id", + GetPlanRequest + .builder() + .planVersionId("plan_version_id") + .build() +); ```
@@ -11127,6 +11042,14 @@ client.plans().getPlan("plan_id"); **planId:** `String` — plan_id +
+
+ +
+
+ +**planVersionId:** `Optional` — Fetch billing settings for a specific plan version +
@@ -11307,12 +11230,13 @@ client.plans().countPlans( .forInitialPlan(true) .forTrialExpiryPlan(true) .hasProductId(true) + .includeDraftVersions(true) .planType(PlanType.PLAN) .q("q") .withoutEntitlementFor("without_entitlement_for") .withoutPaidProductId(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -11377,6 +11301,14 @@ client.plans().countPlans(
+**includeDraftVersions:** `Optional` — Include billing settings from draft versions for plans which have draft version + +
+
+ +
+
+ **planType:** `Optional` — Filter by plan type
@@ -11409,7 +11341,7 @@ client.plans().countPlans(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -11417,7 +11349,7 @@ client.plans().countPlans(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -11446,6 +11378,7 @@ client.plans().listPlanIssues( ListPlanIssuesRequest .builder() .planId("plan_id") + .planVersionId("plan_version_id") .build() ); ``` @@ -11464,6 +11397,133 @@ client.plans().listPlanIssues( **planId:** `String` + +
+ +
+
+ +**planVersionId:** `Optional` + +
+
+ + + + + + +
+ +
client.plans.deletePlanVersion(planId) -> DeletePlanVersionResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().deletePlanVersion( + "plan_id", + DeletePlanVersionRequest + .builder() + .promoteArchivedVersion(true) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planId:** `String` — plan_id + +
+
+ +
+
+ +**promoteArchivedVersion:** `Optional` + +
+
+
+
+ + +
+
+
+ +
client.plans.publishPlanVersion(planId, request) -> PublishPlanVersionResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plans().publishPlanVersion( + "plan_id", + PublishPlanVersionRequestBody + .builder() + .migrationStrategy(PlanVersionMigrationStrategy.IMMEDIATE) + .excludedCompanyIds( + Arrays.asList("excluded_company_ids") + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planId:** `String` — plan_id + +
+
+ +
+
+ +**excludedCompanyIds:** `List` + +
+
+ +
+
+ +**migrationStrategy:** `PlanVersionMigrationStrategy` +
@@ -11492,8 +11552,8 @@ client.components().listComponents( ListComponentsRequest .builder() .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -11518,7 +11578,7 @@ client.components().listComponents(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -11526,7 +11586,7 @@ client.components().listComponents(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -11774,8 +11834,8 @@ client.components().countComponents( CountComponentsRequest .builder() .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -11800,7 +11860,7 @@ client.components().countComponents(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -11808,7 +11868,7 @@ client.components().countComponents(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -12048,8 +12108,8 @@ client.events().getEventSummaries( GetEventSummariesRequest .builder() .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -12082,7 +12142,7 @@ client.events().getEventSummaries(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -12090,7 +12150,7 @@ client.events().getEventSummaries(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -12122,8 +12182,8 @@ client.events().listEvents( .eventSubtype("event_subtype") .flagId("flag_id") .userId("user_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -12180,7 +12240,7 @@ client.events().listEvents(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -12188,7 +12248,7 @@ client.events().listEvents(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -12329,10 +12389,11 @@ client.features().listFeatures( .builder() .q("q") .withoutCompanyOverrideFor("without_company_override_for") + .planVersionId("plan_version_id") .withoutPlanEntitlementFor("without_plan_entitlement_for") .booleanRequireEvent(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -12373,6 +12434,14 @@ client.features().listFeatures(
+**planVersionId:** `Optional` — Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + +
+
+ +
+
+ **withoutPlanEntitlementFor:** `Optional` — Filter out features that already have a plan entitlement for the specified plan ID
@@ -12397,7 +12466,7 @@ client.features().listFeatures(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -12405,7 +12474,7 @@ client.features().listFeatures(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -12775,10 +12844,11 @@ client.features().countFeatures( .builder() .q("q") .withoutCompanyOverrideFor("without_company_override_for") + .planVersionId("plan_version_id") .withoutPlanEntitlementFor("without_plan_entitlement_for") .booleanRequireEvent(true) - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -12819,6 +12889,14 @@ client.features().countFeatures(
+**planVersionId:** `Optional` — Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + +
+
+ +
+
+ **withoutPlanEntitlementFor:** `Optional` — Filter out features that already have a plan entitlement for the specified plan ID
@@ -12843,7 +12921,7 @@ client.features().countFeatures(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -12851,7 +12929,7 @@ client.features().countFeatures(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -12881,8 +12959,8 @@ client.features().listFlags( .builder() .featureId("feature_id") .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -12923,7 +13001,7 @@ client.features().listFlags(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -12931,7 +13009,7 @@ client.features().listFlags(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -13151,6 +13229,9 @@ client.features().updateFlagRules( Arrays.asList( CreateOrUpdateRuleRequestBody .builder() + .name("name") + .priority(1000000L) + .value(true) .conditionGroups( Arrays.asList( CreateOrUpdateConditionGroupRequestBody @@ -13182,9 +13263,6 @@ client.features().updateFlagRules( .build() ) ) - .name("name") - .priority(1) - .value(true) .build() ) ) @@ -13390,8 +13468,8 @@ client.features().countFlags( .builder() .featureId("feature_id") .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -13432,7 +13510,7 @@ client.features().countFlags(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -13440,7 +13518,7 @@ client.features().countFlags(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -13618,6 +13696,14 @@ client.planbundle().updatePlanBundle(
+**planVersionId:** `Optional` + +
+
+ +
+
+ **traits:** `Optional>`
@@ -13644,13 +13730,33 @@ client.planbundle().updatePlanBundle(
```java -client.plangroups().getPlanGroup(); +client.plangroups().getPlanGroup( + GetPlanGroupRequest + .builder() + .includeCompanyCounts(true) + .build() +); ```
+#### ⚙️ Parameters + +
+
+ +
+
+ +**includeCompanyCounts:** `Optional` + +
+
+
+
+ @@ -13672,13 +13778,23 @@ client.plangroups().getPlanGroup(); client.plangroups().createPlanGroup( CreatePlanGroupRequestBody .builder() - .addOnIds( - Arrays.asList("add_on_ids") - ) .checkoutCollectAddress(true) .checkoutCollectEmail(true) .checkoutCollectPhone(true) .enableTaxCollection(true) + .preventDowngradesWhenOverLimit(true) + .preventSelfServiceDowngrade(true) + .prorationBehavior(ProrationBehavior.CREATE_PRORATIONS) + .showAsMonthlyPrices(true) + .showCredits(true) + .showFeatureDescription(true) + .showHardLimit(true) + .showPeriodToggle(true) + .showZeroPriceAsFree(true) + .syncCustomerBillingDetails(true) + .addOnIds( + Arrays.asList("add_on_ids") + ) .orderedAddOns( Arrays.asList( OrderedPlansInGroup @@ -13703,15 +13819,6 @@ client.plangroups().createPlanGroup( .build() ) ) - .preventDowngradesWhenOverLimit(true) - .preventSelfServiceDowngrade(true) - .prorationBehavior(ProrationBehavior.CREATE_PRORATIONS) - .showAsMonthlyPrices(true) - .showCredits(true) - .showFeatureDescription(true) - .showPeriodToggle(true) - .showZeroPriceAsFree(true) - .syncCustomerBillingDetails(true) .build() ); ``` @@ -13880,23 +13987,656 @@ client.plangroups().createPlanGroup(
-**scheduledDowngradeBehavior:** `Optional` - +**scheduledDowngradeBehavior:** `Optional` + +
+
+ +
+
+ +**scheduledDowngradePreventWhenOverLimit:** `Optional` + +
+
+ +
+
+ +**showAsMonthlyPrices:** `Boolean` + +
+
+ +
+
+ +**showCredits:** `Boolean` + +
+
+ +
+
+ +**showFeatureDescription:** `Boolean` + +
+
+ +
+
+ +**showHardLimit:** `Boolean` + +
+
+ +
+
+ +**showPeriodToggle:** `Boolean` + +
+
+ +
+
+ +**showZeroPriceAsFree:** `Boolean` + +
+
+ +
+
+ +**syncCustomerBillingDetails:** `Boolean` + +
+
+ +
+
+ +**trialDays:** `Optional` + +
+
+ +
+
+ +**trialExpiryPlanId:** `Optional` + +
+
+ +
+
+ +**trialExpiryPlanPriceId:** `Optional` + +
+
+ +
+
+ +**trialPaymentMethodRequired:** `Optional` + +
+
+ + + + + + +
+ +
client.plangroups.updatePlanGroup(planGroupId, request) -> UpdatePlanGroupResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.plangroups().updatePlanGroup( + "plan_group_id", + UpdatePlanGroupRequestBody + .builder() + .checkoutCollectAddress(true) + .checkoutCollectEmail(true) + .checkoutCollectPhone(true) + .enableTaxCollection(true) + .preventDowngradesWhenOverLimit(true) + .preventSelfServiceDowngrade(true) + .prorationBehavior(ProrationBehavior.CREATE_PRORATIONS) + .showAsMonthlyPrices(true) + .showCredits(true) + .showFeatureDescription(true) + .showHardLimit(true) + .showPeriodToggle(true) + .showZeroPriceAsFree(true) + .syncCustomerBillingDetails(true) + .addOnIds( + Arrays.asList("add_on_ids") + ) + .orderedAddOns( + Arrays.asList( + OrderedPlansInGroup + .builder() + .planId("plan_id") + .build() + ) + ) + .orderedBundleList( + Arrays.asList( + PlanGroupBundleOrder + .builder() + .bundleId("bundleId") + .build() + ) + ) + .orderedPlans( + Arrays.asList( + OrderedPlansInGroup + .builder() + .planId("plan_id") + .build() + ) + ) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**planGroupId:** `String` — plan_group_id + +
+
+ +
+
+ +**addOnCompatibilities:** `Optional>` + +
+
+ +
+
+ +**addOnIds:** `List` — Use OrderedAddOns instead + +
+
+ +
+
+ +**checkoutCollectAddress:** `Boolean` + +
+
+ +
+
+ +**checkoutCollectEmail:** `Boolean` + +
+
+ +
+
+ +**checkoutCollectPhone:** `Boolean` + +
+
+ +
+
+ +**customPlanConfig:** `Optional` + +
+
+ +
+
+ +**customPlanId:** `Optional` + +
+
+ +
+
+ +**enableTaxCollection:** `Boolean` + +
+
+ +
+
+ +**fallbackPlanId:** `Optional` + +
+
+ +
+
+ +**initialPlanId:** `Optional` + +
+
+ +
+
+ +**initialPlanPriceId:** `Optional` + +
+
+ +
+
+ +**orderedAddOns:** `List` + +
+
+ +
+
+ +**orderedBundleList:** `List` + +
+
+ +
+
+ +**orderedPlans:** `List` + +
+
+ +
+
+ +**preventDowngradesWhenOverLimit:** `Boolean` + +
+
+ +
+
+ +**preventSelfServiceDowngrade:** `Boolean` + +
+
+ +
+
+ +**preventSelfServiceDowngradeButtonText:** `Optional` + +
+
+ +
+
+ +**preventSelfServiceDowngradeUrl:** `Optional` + +
+
+ +
+
+ +**prorationBehavior:** `ProrationBehavior` + +
+
+ +
+
+ +**scheduledDowngradeBehavior:** `Optional` + +
+
+ +
+
+ +**scheduledDowngradePreventWhenOverLimit:** `Optional` + +
+
+ +
+
+ +**showAsMonthlyPrices:** `Boolean` + +
+
+ +
+
+ +**showCredits:** `Boolean` + +
+
+ +
+
+ +**showFeatureDescription:** `Boolean` + +
+
+ +
+
+ +**showHardLimit:** `Boolean` + +
+
+ +
+
+ +**showPeriodToggle:** `Boolean` + +
+
+ +
+
+ +**showZeroPriceAsFree:** `Boolean` + +
+
+ +
+
+ +**syncCustomerBillingDetails:** `Boolean` + +
+
+ +
+
+ +**trialDays:** `Optional` + +
+
+ +
+
+ +**trialExpiryPlanId:** `Optional` + +
+
+ +
+
+ +**trialExpiryPlanPriceId:** `Optional` + +
+
+ +
+
+ +**trialPaymentMethodRequired:** `Optional` + +
+
+
+
+ + +
+
+
+ +## planmigrations +
client.planmigrations.listCompanyMigrations() -> ListCompanyMigrationsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().listCompanyMigrations( + ListCompanyMigrationsRequest + .builder() + .migrationId("migration_id") + .q("q") + .status(PlanVersionCompanyMigrationStatus.COMPLETED) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**migrationId:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` + +
+
+ +
+
+ +**status:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ + +
+
+
+ +
client.planmigrations.countCompanyMigrations() -> CountCompanyMigrationsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().countCompanyMigrations( + CountCompanyMigrationsRequest + .builder() + .migrationId("migration_id") + .q("q") + .status(PlanVersionCompanyMigrationStatus.COMPLETED) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**migrationId:** `Optional` + +
+
+ +
+
+ +**q:** `Optional` + +
+
+ +
+
+ +**status:** `Optional` + +
+
+ +
+
+ +**limit:** `Optional` — Page limit (default 100) + +
+
+ +
+
+ +**offset:** `Optional` — Page offset (default 0) + +
+
+
+
+ + +
+
+
+ +
client.planmigrations.listMigrations() -> ListMigrationsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.planmigrations().listMigrations( + ListMigrationsRequest + .builder() + .planVersionId("plan_version_id") + .status(PlanVersionMigrationStatus.COMPLETED) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**scheduledDowngradePreventWhenOverLimit:** `Optional` - -
-
-
-**showAsMonthlyPrices:** `Boolean` +**planVersionId:** `Optional`
@@ -13904,7 +14644,7 @@ client.plangroups().createPlanGroup(
-**showCredits:** `Boolean` +**status:** `Optional`
@@ -13912,7 +14652,7 @@ client.plangroups().createPlanGroup(
-**showFeatureDescription:** `Boolean` +**limit:** `Optional` — Page limit (default 100)
@@ -13920,55 +14660,47 @@ client.plangroups().createPlanGroup(
-**showPeriodToggle:** `Boolean` +**offset:** `Optional` — Page offset (default 0)
+
+
-
-
-**showZeroPriceAsFree:** `Boolean` -
+
+
client.planmigrations.getMigration(planVersionMigrationId) -> GetMigrationResponse
-**syncCustomerBillingDetails:** `Boolean` - -
-
+#### 🔌 Usage
-**trialDays:** `Optional` - -
-
-
-**trialExpiryPlanId:** `Optional` - +```java +client.planmigrations().getMigration("plan_version_migration_id"); +``` +
+
+#### ⚙️ Parameters +
-**trialExpiryPlanPriceId:** `Optional` - -
-
-
-**trialPaymentMethodRequired:** `Optional` +**planVersionMigrationId:** `String` — plan_version_migration_id
@@ -13980,7 +14712,7 @@ client.plangroups().createPlanGroup(
-
client.plangroups.updatePlanGroup(planGroupId, request) -> UpdatePlanGroupResponse +
client.planmigrations.countMigrations() -> CountMigrationsResponse
@@ -13993,50 +14725,13 @@ client.plangroups().createPlanGroup(
```java -client.plangroups().updatePlanGroup( - "plan_group_id", - UpdatePlanGroupRequestBody +client.planmigrations().countMigrations( + CountMigrationsRequest .builder() - .addOnIds( - Arrays.asList("add_on_ids") - ) - .checkoutCollectAddress(true) - .checkoutCollectEmail(true) - .checkoutCollectPhone(true) - .enableTaxCollection(true) - .orderedAddOns( - Arrays.asList( - OrderedPlansInGroup - .builder() - .planId("plan_id") - .build() - ) - ) - .orderedBundleList( - Arrays.asList( - PlanGroupBundleOrder - .builder() - .bundleId("bundleId") - .build() - ) - ) - .orderedPlans( - Arrays.asList( - OrderedPlansInGroup - .builder() - .planId("plan_id") - .build() - ) - ) - .preventDowngradesWhenOverLimit(true) - .preventSelfServiceDowngrade(true) - .prorationBehavior(ProrationBehavior.CREATE_PRORATIONS) - .showAsMonthlyPrices(true) - .showCredits(true) - .showFeatureDescription(true) - .showPeriodToggle(true) - .showZeroPriceAsFree(true) - .syncCustomerBillingDetails(true) + .planVersionId("plan_version_id") + .status(PlanVersionMigrationStatus.COMPLETED) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -14053,7 +14748,7 @@ client.plangroups().updatePlanGroup(
-**planGroupId:** `String` — plan_group_id +**planVersionId:** `Optional`
@@ -14061,7 +14756,7 @@ client.plangroups().updatePlanGroup(
-**addOnCompatibilities:** `Optional>` +**status:** `Optional`
@@ -14069,7 +14764,7 @@ client.plangroups().updatePlanGroup(
-**addOnIds:** `List` — Use OrderedAddOns instead +**limit:** `Optional` — Page limit (default 100)
@@ -14077,71 +14772,82 @@ client.plangroups().updatePlanGroup(
-**checkoutCollectAddress:** `Boolean` +**offset:** `Optional` — Page offset (default 0)
+
+
-
-
-**checkoutCollectEmail:** `Boolean` -
+
+## componentspublic +
client.componentspublic.getPublicPlans() -> GetPublicPlansResponse
-**checkoutCollectPhone:** `Boolean` - -
-
+#### 🔌 Usage
-**customPlanConfig:** `Optional` - -
-
-
-**customPlanId:** `Optional` - +```java +client.componentspublic().getPublicPlans(); +``` +
+
-
-
-**enableTaxCollection:** `Boolean` -
+
+## scheduledcheckout +
client.scheduledcheckout.listScheduledCheckouts() -> ListScheduledCheckoutsResponse
-**fallbackPlanId:** `Optional` - -
-
+#### 🔌 Usage
-**initialPlanId:** `Optional` - +
+
+ +```java +client.scheduledcheckout().listScheduledCheckouts( + ListScheduledCheckoutsRequest + .builder() + .companyId("company_id") + .status(ScheduledCheckoutStatus.CANCELLED) + .limit(1000000L) + .offset(1000000L) + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**initialPlanPriceId:** `Optional` +
+
+ +**companyId:** `Optional`
@@ -14149,7 +14855,7 @@ client.plangroups().updatePlanGroup(
-**orderedAddOns:** `List` +**status:** `Optional`
@@ -14157,7 +14863,7 @@ client.plangroups().updatePlanGroup(
-**orderedBundleList:** `List` +**limit:** `Optional` — Page limit (default 100)
@@ -14165,39 +14871,55 @@ client.plangroups().updatePlanGroup(
-**orderedPlans:** `List` +**offset:** `Optional` — Page offset (default 0)
+
+
-
-
-**preventDowngradesWhenOverLimit:** `Boolean` -
+
+
client.scheduledcheckout.createScheduledCheckout(request) -> CreateScheduledCheckoutResponse
-**preventSelfServiceDowngrade:** `Boolean` - -
-
+#### 🔌 Usage
-**preventSelfServiceDowngradeButtonText:** `Optional` - +
+
+ +```java +client.scheduledcheckout().createScheduledCheckout( + CreateScheduledCheckoutRequest + .builder() + .companyId("company_id") + .executeAfter(OffsetDateTime.parse("2024-01-15T09:30:00Z")) + .fromPlanId("from_plan_id") + .toPlanId("to_plan_id") + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**preventSelfServiceDowngradeUrl:** `Optional` +
+
+ +**companyId:** `String`
@@ -14205,7 +14927,7 @@ client.plangroups().updatePlanGroup(
-**prorationBehavior:** `ProrationBehavior` +**executeAfter:** `OffsetDateTime`
@@ -14213,7 +14935,7 @@ client.plangroups().updatePlanGroup(
-**scheduledDowngradeBehavior:** `Optional` +**fromPlanId:** `String`
@@ -14221,71 +14943,92 @@ client.plangroups().updatePlanGroup(
-**scheduledDowngradePreventWhenOverLimit:** `Optional` +**toPlanId:** `String`
+
+
-
-
-**showAsMonthlyPrices:** `Boolean` -
+
+
client.scheduledcheckout.getScheduledCheckout(scheduledCheckoutId) -> GetScheduledCheckoutResponse
-**showCredits:** `Boolean` - -
-
+#### 🔌 Usage
-**showFeatureDescription:** `Boolean` - +
+
+ +```java +client.scheduledcheckout().getScheduledCheckout("scheduled_checkout_id"); +```
+
+
+ +#### ⚙️ Parameters
-**showPeriodToggle:** `Boolean` +
+
+ +**scheduledCheckoutId:** `String` — scheduled_checkout_id
+
+
-
-
-**showZeroPriceAsFree:** `Boolean` -
+
+
client.scheduledcheckout.updateScheduledCheckout(scheduledCheckoutId, request) -> UpdateScheduledCheckoutResponse
-**syncCustomerBillingDetails:** `Boolean` - -
-
+#### 🔌 Usage
-**trialDays:** `Optional` - +
+
+ +```java +client.scheduledcheckout().updateScheduledCheckout( + "scheduled_checkout_id", + UpdateScheduledCheckoutRequest + .builder() + .build() +); +``` +
+
+#### ⚙️ Parameters +
-**trialExpiryPlanId:** `Optional` +
+
+ +**scheduledCheckoutId:** `String` — scheduled_checkout_id
@@ -14293,7 +15036,7 @@ client.plangroups().updatePlanGroup(
-**trialExpiryPlanPriceId:** `Optional` +**executeAfter:** `Optional`
@@ -14301,7 +15044,7 @@ client.plangroups().updatePlanGroup(
-**trialPaymentMethodRequired:** `Optional` +**status:** `Optional`
@@ -14330,12 +15073,12 @@ client.plangroups().updatePlanGroup( client.accesstokens().issueTemporaryAccessToken( IssueTemporaryAccessTokenRequestBody .builder() + .resourceType("company") .lookup( new HashMap() {{ put("key", "value"); }} ) - .resourceType("company") .build() ); ``` @@ -14391,8 +15134,8 @@ client.webhooks().listWebhookEvents( .builder() .q("q") .webhookId("webhook_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -14433,7 +15176,7 @@ client.webhooks().listWebhookEvents(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -14441,7 +15184,7 @@ client.webhooks().listWebhookEvents(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -14511,8 +15254,8 @@ client.webhooks().countWebhookEvents( .builder() .q("q") .webhookId("webhook_id") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -14553,7 +15296,7 @@ client.webhooks().countWebhookEvents(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -14561,7 +15304,7 @@ client.webhooks().countWebhookEvents(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -14590,8 +15333,8 @@ client.webhooks().listWebhooks( ListWebhooksRequest .builder() .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -14616,7 +15359,7 @@ client.webhooks().listWebhooks(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -14624,7 +15367,7 @@ client.webhooks().listWebhooks(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -14653,10 +15396,10 @@ client.webhooks().createWebhook( CreateWebhookRequestBody .builder() .name("name") + .url("url") .requestTypes( Arrays.asList(WebhookRequestType.SUBSCRIPTION_TRIAL_ENDED) ) - .url("url") .build() ); ``` @@ -14907,8 +15650,8 @@ client.webhooks().countWebhooks( CountWebhooksRequest .builder() .q("q") - .limit(1) - .offset(1) + .limit(1000000L) + .offset(1000000L) .build() ); ``` @@ -14933,7 +15676,7 @@ client.webhooks().countWebhooks(
-**limit:** `Optional` — Page limit (default 100) +**limit:** `Optional` — Page limit (default 100)
@@ -14941,7 +15684,7 @@ client.webhooks().countWebhooks(
-**offset:** `Optional` — Page offset (default 0) +**offset:** `Optional` — Page offset (default 0)
@@ -14952,3 +15695,4 @@ client.webhooks().countWebhooks(
+ diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematic.java b/src/main/java/com/schematic/api/AsyncBaseSchematic.java index f3f5133..77df3d5 100644 --- a/src/main/java/com/schematic/api/AsyncBaseSchematic.java +++ b/src/main/java/com/schematic/api/AsyncBaseSchematic.java @@ -12,6 +12,7 @@ import com.schematic.api.resources.checkout.AsyncCheckoutClient; import com.schematic.api.resources.companies.AsyncCompaniesClient; import com.schematic.api.resources.components.AsyncComponentsClient; +import com.schematic.api.resources.componentspublic.AsyncComponentspublicClient; import com.schematic.api.resources.credits.AsyncCreditsClient; import com.schematic.api.resources.dataexports.AsyncDataexportsClient; import com.schematic.api.resources.entitlements.AsyncEntitlementsClient; @@ -19,7 +20,9 @@ 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.planmigrations.AsyncPlanmigrationsClient; import com.schematic.api.resources.plans.AsyncPlansClient; +import com.schematic.api.resources.scheduledcheckout.AsyncScheduledcheckoutClient; import com.schematic.api.resources.webhooks.AsyncWebhooksClient; import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; @@ -55,6 +58,12 @@ public class AsyncBaseSchematic { protected final Supplier plangroupsClient; + protected final Supplier planmigrationsClient; + + protected final Supplier componentspublicClient; + + protected final Supplier scheduledcheckoutClient; + protected final Supplier accesstokensClient; protected final Supplier webhooksClient; @@ -75,6 +84,9 @@ public AsyncBaseSchematic(ClientOptions clientOptions) { this.featuresClient = Suppliers.memoize(() -> new AsyncFeaturesClient(clientOptions)); this.planbundleClient = Suppliers.memoize(() -> new AsyncPlanbundleClient(clientOptions)); this.plangroupsClient = Suppliers.memoize(() -> new AsyncPlangroupsClient(clientOptions)); + this.planmigrationsClient = Suppliers.memoize(() -> new AsyncPlanmigrationsClient(clientOptions)); + this.componentspublicClient = Suppliers.memoize(() -> new AsyncComponentspublicClient(clientOptions)); + this.scheduledcheckoutClient = Suppliers.memoize(() -> new AsyncScheduledcheckoutClient(clientOptions)); this.accesstokensClient = Suppliers.memoize(() -> new AsyncAccesstokensClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new AsyncWebhooksClient(clientOptions)); } @@ -160,6 +172,18 @@ public AsyncPlangroupsClient plangroups() { return this.plangroupsClient.get(); } + public AsyncPlanmigrationsClient planmigrations() { + return this.planmigrationsClient.get(); + } + + public AsyncComponentspublicClient componentspublic() { + return this.componentspublicClient.get(); + } + + public AsyncScheduledcheckoutClient scheduledcheckout() { + return this.scheduledcheckoutClient.get(); + } + public AsyncAccesstokensClient accesstokens() { return this.accesstokensClient.get(); } diff --git a/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java b/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java index 7b81183..d6a3436 100644 --- a/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java +++ b/src/main/java/com/schematic/api/AsyncBaseSchematicBuilder.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.Environment; +import com.schematic.api.core.LogConfig; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -23,6 +24,8 @@ public class AsyncBaseSchematicBuilder { private OkHttpClient httpClient; + private Optional logging = Optional.empty(); + /** * Sets apiKey */ @@ -65,6 +68,14 @@ public AsyncBaseSchematicBuilder httpClient(OkHttpClient httpClient) { return this; } + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public AsyncBaseSchematicBuilder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + /** * Add a custom header to be sent with all requests. * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead. @@ -85,6 +96,7 @@ protected ClientOptions buildClientOptions() { setHttpClient(builder); setTimeouts(builder); setRetries(builder); + setLogging(builder); for (Map.Entry header : this.customHeaders.entrySet()) { builder.addHeader(header.getKey(), header.getValue()); } @@ -157,6 +169,18 @@ protected void setHttpClient(ClientOptions.Builder builder) { } } + /** + * Sets the logging configuration for the SDK. + * Override this method to customize logging behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setLogging(ClientOptions.Builder builder) { + if (this.logging.isPresent()) { + builder.logging(this.logging.get()); + } + } + /** * Override this method to add any additional configuration to the client. * This method is called at the end of the configuration chain, allowing you to add diff --git a/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java b/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java index 1fb115f..03ac25b 100644 --- a/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java +++ b/src/main/java/com/schematic/api/AsyncRawBaseSchematic.java @@ -35,13 +35,17 @@ public CompletableFuture> putPlanAudiencesPlanAu public CompletableFuture> putPlanAudiencesPlanAudienceId( String planAudienceId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-audiences") - .addPathSegment(planAudienceId) - .build(); + .addPathSegment(planAudienceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", RequestBody.create("", null)) .headers(Headers.of(clientOptions.headers(requestOptions))) .build(); @@ -59,11 +63,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -84,13 +86,17 @@ public CompletableFuture> deletePlanAudiencesPla public CompletableFuture> deletePlanAudiencesPlanAudienceId( String planAudienceId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-audiences") - .addPathSegment(planAudienceId) - .build(); + .addPathSegment(planAudienceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .build(); @@ -108,11 +114,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/BaseSchematicBuilder.java b/src/main/java/com/schematic/api/BaseSchematicBuilder.java index 9410ba7..a3c398b 100644 --- a/src/main/java/com/schematic/api/BaseSchematicBuilder.java +++ b/src/main/java/com/schematic/api/BaseSchematicBuilder.java @@ -5,6 +5,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.Environment; +import com.schematic.api.core.LogConfig; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -23,6 +24,8 @@ public class BaseSchematicBuilder { private OkHttpClient httpClient; + private Optional logging = Optional.empty(); + /** * Sets apiKey */ @@ -65,6 +68,14 @@ public BaseSchematicBuilder httpClient(OkHttpClient httpClient) { return this; } + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public BaseSchematicBuilder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + /** * Add a custom header to be sent with all requests. * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead. @@ -85,6 +96,7 @@ protected ClientOptions buildClientOptions() { setHttpClient(builder); setTimeouts(builder); setRetries(builder); + setLogging(builder); for (Map.Entry header : this.customHeaders.entrySet()) { builder.addHeader(header.getKey(), header.getValue()); } @@ -157,6 +169,18 @@ protected void setHttpClient(ClientOptions.Builder builder) { } } + /** + * Sets the logging configuration for the SDK. + * Override this method to customize logging behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setLogging(ClientOptions.Builder builder) { + if (this.logging.isPresent()) { + builder.logging(this.logging.get()); + } + } + /** * Override this method to add any additional configuration to the client. * This method is called at the end of the configuration chain, allowing you to add diff --git a/src/main/java/com/schematic/api/RawBaseSchematic.java b/src/main/java/com/schematic/api/RawBaseSchematic.java index 803f99e..bd0be6c 100644 --- a/src/main/java/com/schematic/api/RawBaseSchematic.java +++ b/src/main/java/com/schematic/api/RawBaseSchematic.java @@ -31,13 +31,17 @@ public BaseSchematicHttpResponse putPlanAudiencesPlanAudienceId(String pla public BaseSchematicHttpResponse putPlanAudiencesPlanAudienceId( String planAudienceId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-audiences") - .addPathSegment(planAudienceId) - .build(); + .addPathSegment(planAudienceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", RequestBody.create("", null)) .headers(Headers.of(clientOptions.headers(requestOptions))) .build(); @@ -51,11 +55,9 @@ public BaseSchematicHttpResponse putPlanAudiencesPlanAudienceId( return new BaseSchematicHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -67,13 +69,17 @@ public BaseSchematicHttpResponse deletePlanAudiencesPlanAudienceId(String public BaseSchematicHttpResponse deletePlanAudiencesPlanAudienceId( String planAudienceId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-audiences") - .addPathSegment(planAudienceId) - .build(); + .addPathSegment(planAudienceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .build(); @@ -87,11 +93,9 @@ public BaseSchematicHttpResponse deletePlanAudiencesPlanAudienceId( return new BaseSchematicHttpResponse<>(null, response); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/core/BaseSchematicApiException.java b/src/main/java/com/schematic/api/core/BaseSchematicApiException.java index 067cd1f..60e03e4 100644 --- a/src/main/java/com/schematic/api/core/BaseSchematicApiException.java +++ b/src/main/java/com/schematic/api/core/BaseSchematicApiException.java @@ -65,9 +65,9 @@ public Map> headers() { return this.headers; } - @java.lang.Override + @Override public String toString() { return "BaseSchematicApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " - + body + "}"; + + ObjectMappers.stringify(body) + "}"; } } diff --git a/src/main/java/com/schematic/api/core/ClientOptions.java b/src/main/java/com/schematic/api/core/ClientOptions.java index 4c74d33..efb312f 100644 --- a/src/main/java/com/schematic/api/core/ClientOptions.java +++ b/src/main/java/com/schematic/api/core/ClientOptions.java @@ -21,26 +21,34 @@ public final class ClientOptions { private final int timeout; + private final int maxRetries; + + private final Optional logging; + private ClientOptions( Environment environment, Map headers, Map> headerSuppliers, OkHttpClient httpClient, - int timeout) { + int timeout, + int maxRetries, + Optional logging) { this.environment = environment; this.headers = new HashMap<>(); this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.schematichq:schematic-java/1.3.0"); + put("User-Agent", "com.schematichq:schematic-java/1.3.1"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.schematic.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.3.0"); + put("X-Fern-SDK-Version", "1.3.1"); } }); this.headerSuppliers = headerSuppliers; this.httpClient = httpClient; this.timeout = timeout; + this.maxRetries = maxRetries; + this.logging = logging; } public Environment environment() { @@ -82,6 +90,14 @@ public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { .build(); } + public int maxRetries() { + return this.maxRetries; + } + + public Optional logging() { + return this.logging; + } + public static Builder builder() { return new Builder(); } @@ -99,6 +115,8 @@ public static class Builder { private OkHttpClient httpClient = null; + private Optional logging = Optional.empty(); + public Builder environment(Environment environment) { this.environment = environment; return this; @@ -143,6 +161,14 @@ public Builder httpClient(OkHttpClient httpClient) { return this; } + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public Builder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + public ClientOptions build() { OkHttpClient.Builder httpClientBuilder = this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); @@ -162,10 +188,20 @@ public ClientOptions build() { .addInterceptor(new RetryInterceptor(this.maxRetries)); } + Logger logger = Logger.from(this.logging); + httpClientBuilder.addInterceptor(new LoggingInterceptor(logger)); + this.httpClient = httpClientBuilder.build(); this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); - return new ClientOptions(environment, headers, headerSuppliers, httpClient, this.timeout.get()); + return new ClientOptions( + environment, + headers, + headerSuppliers, + httpClient, + this.timeout.get(), + this.maxRetries, + this.logging); } /** @@ -176,6 +212,10 @@ public static Builder from(ClientOptions clientOptions) { builder.environment = clientOptions.environment(); builder.timeout = Optional.of(clientOptions.timeout(null)); builder.httpClient = clientOptions.httpClient(); + builder.headers.putAll(clientOptions.headers); + builder.headerSuppliers.putAll(clientOptions.headerSuppliers); + builder.maxRetries = clientOptions.maxRetries(); + builder.logging = clientOptions.logging(); return builder; } } diff --git a/src/main/java/com/schematic/api/core/ConsoleLogger.java b/src/main/java/com/schematic/api/core/ConsoleLogger.java new file mode 100644 index 0000000..89a22b6 --- /dev/null +++ b/src/main/java/com/schematic/api/core/ConsoleLogger.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import java.util.logging.Level; + +/** + * Default logger implementation that writes to the console using {@link java.util.logging.Logger}. + * + *

Uses the "fern" logger name with a simple format of "LEVEL - message". + */ +public final class ConsoleLogger implements ILogger { + + private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("fern"); + + static { + if (logger.getHandlers().length == 0) { + java.util.logging.ConsoleHandler handler = new java.util.logging.ConsoleHandler(); + handler.setFormatter(new java.util.logging.SimpleFormatter() { + @Override + public String format(java.util.logging.LogRecord record) { + return record.getLevel() + " - " + record.getMessage() + System.lineSeparator(); + } + }); + logger.addHandler(handler); + logger.setUseParentHandlers(false); + logger.setLevel(Level.ALL); + } + } + + @Override + public void debug(String message) { + logger.log(Level.FINE, message); + } + + @Override + public void info(String message) { + logger.log(Level.INFO, message); + } + + @Override + public void warn(String message) { + logger.log(Level.WARNING, message); + } + + @Override + public void error(String message) { + logger.log(Level.SEVERE, message); + } +} diff --git a/src/main/java/com/schematic/api/core/DoubleSerializer.java b/src/main/java/com/schematic/api/core/DoubleSerializer.java new file mode 100644 index 0000000..2b47145 --- /dev/null +++ b/src/main/java/com/schematic/api/core/DoubleSerializer.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; + +/** + * Custom serializer that writes integer-valued doubles without a decimal point. + * For example, {@code 24000.0} is serialized as {@code 24000} instead of {@code 24000.0}. + * Non-integer values like {@code 3.14} are serialized normally. + */ +class DoubleSerializer extends JsonSerializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule() + .addSerializer(Double.class, new DoubleSerializer()) + .addSerializer(double.class, new DoubleSerializer()); + } + + /** + * Gets a module wrapping this serializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value != null && value == Math.floor(value) && !Double.isInfinite(value) && !Double.isNaN(value)) { + gen.writeNumber(value.longValue()); + } else { + gen.writeNumber(value); + } + } +} diff --git a/src/main/java/com/schematic/api/core/ILogger.java b/src/main/java/com/schematic/api/core/ILogger.java new file mode 100644 index 0000000..b206f54 --- /dev/null +++ b/src/main/java/com/schematic/api/core/ILogger.java @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +/** + * Interface for custom logger implementations. + * + *

Implement this interface to provide a custom logging backend for the SDK. + * The SDK will call the appropriate method based on the log level. + * + *

Example: + *

{@code
+ * public class MyCustomLogger implements ILogger {
+ *     public void debug(String message) {
+ *         System.out.println("[DBG] " + message);
+ *     }
+ *     public void info(String message) {
+ *         System.out.println("[INF] " + message);
+ *     }
+ *     public void warn(String message) {
+ *         System.out.println("[WRN] " + message);
+ *     }
+ *     public void error(String message) {
+ *         System.out.println("[ERR] " + message);
+ *     }
+ * }
+ * }
+ */ +public interface ILogger { + void debug(String message); + + void info(String message); + + void warn(String message); + + void error(String message); +} diff --git a/src/main/java/com/schematic/api/core/LogConfig.java b/src/main/java/com/schematic/api/core/LogConfig.java new file mode 100644 index 0000000..64f39bd --- /dev/null +++ b/src/main/java/com/schematic/api/core/LogConfig.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +/** + * Configuration for SDK logging. + * + *

Use the builder to configure logging behavior: + *

{@code
+ * LogConfig config = LogConfig.builder()
+ *     .level(LogLevel.DEBUG)
+ *     .silent(false)
+ *     .build();
+ * }
+ * + *

Or with a custom logger: + *

{@code
+ * LogConfig config = LogConfig.builder()
+ *     .level(LogLevel.DEBUG)
+ *     .logger(new MyCustomLogger())
+ *     .silent(false)
+ *     .build();
+ * }
+ * + *

Defaults: + *

    + *
  • {@code level} — {@link LogLevel#INFO}
  • + *
  • {@code logger} — {@link ConsoleLogger} (writes to stderr via java.util.logging)
  • + *
  • {@code silent} — {@code true} (no output unless explicitly enabled)
  • + *
+ */ +public final class LogConfig { + + private final LogLevel level; + private final ILogger logger; + private final boolean silent; + + private LogConfig(LogLevel level, ILogger logger, boolean silent) { + this.level = level; + this.logger = logger; + this.silent = silent; + } + + public LogLevel level() { + return level; + } + + public ILogger logger() { + return logger; + } + + public boolean silent() { + return silent; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private LogLevel level = LogLevel.INFO; + private ILogger logger = new ConsoleLogger(); + private boolean silent = true; + + private Builder() {} + + /** + * Set the minimum log level. Only messages at this level or above will be logged. + * Defaults to {@link LogLevel#INFO}. + */ + public Builder level(LogLevel level) { + this.level = level; + return this; + } + + /** + * Set a custom logger implementation. Defaults to {@link ConsoleLogger}. + */ + public Builder logger(ILogger logger) { + this.logger = logger; + return this; + } + + /** + * Set whether logging is silent (disabled). Defaults to {@code true}. + * Set to {@code false} to enable log output. + */ + public Builder silent(boolean silent) { + this.silent = silent; + return this; + } + + public LogConfig build() { + return new LogConfig(level, logger, silent); + } + } +} diff --git a/src/main/java/com/schematic/api/core/LogLevel.java b/src/main/java/com/schematic/api/core/LogLevel.java new file mode 100644 index 0000000..f9f4ad4 --- /dev/null +++ b/src/main/java/com/schematic/api/core/LogLevel.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +/** + * Log levels for SDK logging configuration. + * Silent by default — no log output unless explicitly configured. + */ +public enum LogLevel { + DEBUG(1), + INFO(2), + WARN(3), + ERROR(4); + + private final int value; + + LogLevel(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + /** + * Parse a log level from a string (case-insensitive). + * + * @param level the level string (debug, info, warn, error) + * @return the corresponding LogLevel + * @throws IllegalArgumentException if the string does not match any level + */ + public static LogLevel fromString(String level) { + return LogLevel.valueOf(level.toUpperCase()); + } +} diff --git a/src/main/java/com/schematic/api/core/Logger.java b/src/main/java/com/schematic/api/core/Logger.java new file mode 100644 index 0000000..25e4696 --- /dev/null +++ b/src/main/java/com/schematic/api/core/Logger.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +/** + * SDK logger that filters messages based on level and silent mode. + * + *

Silent by default — no log output unless explicitly configured. + * Create via {@link LogConfig} or directly: + *

{@code
+ * Logger logger = new Logger(LogLevel.DEBUG, new ConsoleLogger(), false);
+ * logger.debug("request sent");
+ * }
+ */ +public final class Logger { + + private static final Logger DEFAULT = new Logger(LogLevel.INFO, new ConsoleLogger(), true); + + private final LogLevel level; + private final ILogger logger; + private final boolean silent; + + public Logger(LogLevel level, ILogger logger, boolean silent) { + this.level = level; + this.logger = logger; + this.silent = silent; + } + + /** + * Returns a default silent logger (no output). + */ + public static Logger getDefault() { + return DEFAULT; + } + + /** + * Creates a Logger from a {@link LogConfig}. If config is {@code null}, returns the default silent logger. + */ + public static Logger from(LogConfig config) { + if (config == null) { + return DEFAULT; + } + return new Logger(config.level(), config.logger(), config.silent()); + } + + /** + * Creates a Logger from an {@code Optional}. If empty, returns the default silent logger. + */ + public static Logger from(java.util.Optional config) { + return config.map(Logger::from).orElse(DEFAULT); + } + + private boolean shouldLog(LogLevel messageLevel) { + return !silent && level.getValue() <= messageLevel.getValue(); + } + + public boolean isDebug() { + return shouldLog(LogLevel.DEBUG); + } + + public boolean isInfo() { + return shouldLog(LogLevel.INFO); + } + + public boolean isWarn() { + return shouldLog(LogLevel.WARN); + } + + public boolean isError() { + return shouldLog(LogLevel.ERROR); + } + + public void debug(String message) { + if (isDebug()) { + logger.debug(message); + } + } + + public void info(String message) { + if (isInfo()) { + logger.info(message); + } + } + + public void warn(String message) { + if (isWarn()) { + logger.warn(message); + } + } + + public void error(String message) { + if (isError()) { + logger.error(message); + } + } +} diff --git a/src/main/java/com/schematic/api/core/LoggingInterceptor.java b/src/main/java/com/schematic/api/core/LoggingInterceptor.java new file mode 100644 index 0000000..c7d2dd5 --- /dev/null +++ b/src/main/java/com/schematic/api/core/LoggingInterceptor.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** + * OkHttp interceptor that logs HTTP requests and responses. + * + *

Logs request method, URL, and headers (with sensitive values redacted) at debug level. + * Logs response status at debug level, and 4xx/5xx responses at error level. + * Does nothing if the logger is silent. + */ +public final class LoggingInterceptor implements Interceptor { + + private static final Set SENSITIVE_HEADERS = new HashSet<>(Arrays.asList( + "authorization", + "www-authenticate", + "x-api-key", + "api-key", + "apikey", + "x-api-token", + "x-auth-token", + "auth-token", + "proxy-authenticate", + "proxy-authorization", + "cookie", + "set-cookie", + "x-csrf-token", + "x-xsrf-token", + "x-session-token", + "x-access-token")); + + private final Logger logger; + + public LoggingInterceptor(Logger logger) { + this.logger = logger; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + + if (logger.isDebug()) { + StringBuilder sb = new StringBuilder(); + sb.append("HTTP Request: ").append(request.method()).append(" ").append(request.url()); + sb.append(" headers={"); + boolean first = true; + for (String name : request.headers().names()) { + if (!first) { + sb.append(", "); + } + sb.append(name).append("="); + if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { + sb.append("[REDACTED]"); + } else { + sb.append(request.header(name)); + } + first = false; + } + sb.append("}"); + sb.append(" has_body=").append(request.body() != null); + logger.debug(sb.toString()); + } + + Response response = chain.proceed(request); + + if (logger.isDebug()) { + StringBuilder sb = new StringBuilder(); + sb.append("HTTP Response: status=").append(response.code()); + sb.append(" url=").append(response.request().url()); + sb.append(" headers={"); + boolean first = true; + for (String name : response.headers().names()) { + if (!first) { + sb.append(", "); + } + sb.append(name).append("="); + if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { + sb.append("[REDACTED]"); + } else { + sb.append(response.header(name)); + } + first = false; + } + sb.append("}"); + logger.debug(sb.toString()); + } + + if (response.code() >= 400 && logger.isError()) { + logger.error("HTTP Error: status=" + response.code() + " url=" + + response.request().url()); + } + + return response; + } +} diff --git a/src/main/java/com/schematic/api/core/NullableNonemptyFilter.java b/src/main/java/com/schematic/api/core/NullableNonemptyFilter.java index f230447..db75c3e 100644 --- a/src/main/java/com/schematic/api/core/NullableNonemptyFilter.java +++ b/src/main/java/com/schematic/api/core/NullableNonemptyFilter.java @@ -14,6 +14,9 @@ public boolean equals(Object o) { } private boolean isOptionalEmpty(Object o) { - return o instanceof Optional && !((Optional) o).isPresent(); + if (o instanceof Optional) { + return !((Optional) o).isPresent(); + } + return false; } } diff --git a/src/main/java/com/schematic/api/core/ObjectMappers.java b/src/main/java/com/schematic/api/core/ObjectMappers.java index fd6b153..245e74e 100644 --- a/src/main/java/com/schematic/api/core/ObjectMappers.java +++ b/src/main/java/com/schematic/api/core/ObjectMappers.java @@ -4,6 +4,7 @@ package com.schematic.api.core; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -17,6 +18,7 @@ public final class ObjectMappers { .addModule(new Jdk8Module()) .addModule(new JavaTimeModule()) .addModule(DateTimeDeserializer.getModule()) + .addModule(DoubleSerializer.getModule()) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .build(); @@ -33,4 +35,12 @@ public static String stringify(Object o) { return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); } } + + public static Object parseErrorBody(String responseBodyString) { + try { + return JSON_MAPPER.readValue(responseBodyString, Object.class); + } catch (JsonProcessingException ignored) { + return responseBodyString; + } + } } diff --git a/src/main/java/com/schematic/api/core/RequestOptions.java b/src/main/java/com/schematic/api/core/RequestOptions.java index 4618051..7249e3c 100644 --- a/src/main/java/com/schematic/api/core/RequestOptions.java +++ b/src/main/java/com/schematic/api/core/RequestOptions.java @@ -20,17 +20,25 @@ public final class RequestOptions { private final Map> headerSuppliers; + private final Map queryParameters; + + private final Map> queryParameterSuppliers; + private RequestOptions( String apiKey, Optional timeout, TimeUnit timeoutTimeUnit, Map headers, - Map> headerSuppliers) { + Map> headerSuppliers, + Map queryParameters, + Map> queryParameterSuppliers) { this.apiKey = apiKey; this.timeout = timeout; this.timeoutTimeUnit = timeoutTimeUnit; this.headers = headers; this.headerSuppliers = headerSuppliers; + this.queryParameters = queryParameters; + this.queryParameterSuppliers = queryParameterSuppliers; } public Optional getTimeout() { @@ -53,6 +61,14 @@ public Map getHeaders() { return headers; } + public Map getQueryParameters() { + Map queryParameters = new HashMap<>(this.queryParameters); + this.queryParameterSuppliers.forEach((key, supplier) -> { + queryParameters.put(key, supplier.get()); + }); + return queryParameters; + } + public static Builder builder() { return new Builder(); } @@ -68,6 +84,10 @@ public static class Builder { private final Map> headerSuppliers = new HashMap<>(); + private final Map queryParameters = new HashMap<>(); + + private final Map> queryParameterSuppliers = new HashMap<>(); + public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; @@ -94,8 +114,25 @@ public Builder addHeader(String key, Supplier value) { return this; } + public Builder addQueryParameter(String key, String value) { + this.queryParameters.put(key, value); + return this; + } + + public Builder addQueryParameter(String key, Supplier value) { + this.queryParameterSuppliers.put(key, value); + return this; + } + public RequestOptions build() { - return new RequestOptions(apiKey, timeout, timeoutTimeUnit, headers, headerSuppliers); + return new RequestOptions( + apiKey, + timeout, + timeoutTimeUnit, + headers, + headerSuppliers, + queryParameters, + queryParameterSuppliers); } } } diff --git a/src/main/java/com/schematic/api/core/Rfc2822DateTimeDeserializer.java b/src/main/java/com/schematic/api/core/Rfc2822DateTimeDeserializer.java new file mode 100644 index 0000000..ed0ff30 --- /dev/null +++ b/src/main/java/com/schematic/api/core/Rfc2822DateTimeDeserializer.java @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Custom deserializer that handles converting RFC 2822 (RFC 1123) dates into {@link OffsetDateTime} objects. + * This is used for fields with format "date-time-rfc-2822", such as Twilio's dateCreated, dateSent, dateUpdated. + */ +public class Rfc2822DateTimeDeserializer extends JsonDeserializer { + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + String raw = parser.getValueAsString(); + return ZonedDateTime.parse(raw, DateTimeFormatter.RFC_1123_DATE_TIME).toOffsetDateTime(); + } +} diff --git a/src/main/java/com/schematic/api/core/SseEvent.java b/src/main/java/com/schematic/api/core/SseEvent.java new file mode 100644 index 0000000..1640f67 --- /dev/null +++ b/src/main/java/com/schematic/api/core/SseEvent.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; +import java.util.Optional; + +/** + * Represents a Server-Sent Event with all standard fields. + * Used for event-level discrimination where the discriminator is at the SSE envelope level. + * + * @param The type of the data field + */ +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonIgnoreProperties(ignoreUnknown = true) +public final class SseEvent { + private final String event; + private final T data; + private final String id; + private final Long retry; + + private SseEvent(String event, T data, String id, Long retry) { + this.event = event; + this.data = data; + this.id = id; + this.retry = retry; + } + + @JsonProperty("event") + public Optional getEvent() { + return Optional.ofNullable(event); + } + + @JsonProperty("data") + public T getData() { + return data; + } + + @JsonProperty("id") + public Optional getId() { + return Optional.ofNullable(id); + } + + @JsonProperty("retry") + public Optional getRetry() { + return Optional.ofNullable(retry); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SseEvent sseEvent = (SseEvent) o; + return Objects.equals(event, sseEvent.event) + && Objects.equals(data, sseEvent.data) + && Objects.equals(id, sseEvent.id) + && Objects.equals(retry, sseEvent.retry); + } + + @Override + public int hashCode() { + return Objects.hash(event, data, id, retry); + } + + @Override + public String toString() { + return "SseEvent{" + "event='" + + event + '\'' + ", data=" + + data + ", id='" + + id + '\'' + ", retry=" + + retry + '}'; + } + + public static Builder builder() { + return new Builder<>(); + } + + public static final class Builder { + private String event; + private T data; + private String id; + private Long retry; + + private Builder() {} + + public Builder event(String event) { + this.event = event; + return this; + } + + public Builder data(T data) { + this.data = data; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder retry(Long retry) { + this.retry = retry; + return this; + } + + public SseEvent build() { + return new SseEvent<>(event, data, id, retry); + } + } +} diff --git a/src/main/java/com/schematic/api/core/SseEventParser.java b/src/main/java/com/schematic/api/core/SseEventParser.java new file mode 100644 index 0000000..eafd44d --- /dev/null +++ b/src/main/java/com/schematic/api/core/SseEventParser.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.core; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.core.type.TypeReference; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +/** + * Utility class for parsing Server-Sent Events with support for discriminated unions. + *

+ * Handles two discrimination patterns: + *

    + *
  1. Data-level discrimination: The discriminator (e.g., 'type') is inside the JSON data payload. + * Jackson's polymorphic deserialization handles this automatically.
  2. + *
  3. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE envelope level. + * This requires constructing the full SSE envelope for Jackson to process.
  4. + *
+ */ +public final class SseEventParser { + + private static final Set SSE_ENVELOPE_FIELDS = new HashSet<>(Arrays.asList("event", "data", "id", "retry")); + + private SseEventParser() { + // Utility class + } + + /** + * Parse an SSE event using event-level discrimination. + *

+ * Constructs the full SSE envelope object with event, data, id, and retry fields, + * then deserializes it to the target union type. + * + * @param eventType The SSE event type (from event: field) + * @param data The SSE data content (from data: field) + * @param id The SSE event ID (from id: field), may be null + * @param retry The SSE retry value (from retry: field), may be null + * @param unionClass The target union class + * @param discriminatorProperty The property name used for discrimination (e.g., "event") + * @param The target type + * @return The deserialized object + */ + public static T parseEventLevelUnion( + String eventType, String data, String id, Long retry, Class unionClass, String discriminatorProperty) { + try { + // Determine if data should be parsed as JSON based on the variant's expected type + Object parsedData = parseDataForVariant(eventType, data, unionClass, discriminatorProperty); + + // Construct the SSE envelope object + Map envelope = new HashMap<>(); + envelope.put(discriminatorProperty, eventType); + envelope.put("data", parsedData); + if (id != null) { + envelope.put("id", id); + } + if (retry != null) { + envelope.put("retry", retry); + } + + // Serialize to JSON and deserialize to target type + String envelopeJson = ObjectMappers.JSON_MAPPER.writeValueAsString(envelope); + return ObjectMappers.JSON_MAPPER.readValue(envelopeJson, unionClass); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SSE event with event-level discrimination", e); + } + } + + /** + * Parse an SSE event using data-level discrimination. + *

+ * Simply parses the data field as JSON and deserializes it to the target type. + * Jackson's polymorphic deserialization handles the discrimination automatically. + * + * @param data The SSE data content (from data: field) + * @param valueType The target type + * @param The target type + * @return The deserialized object + */ + public static T parseDataLevelUnion(String data, Class valueType) { + try { + return ObjectMappers.JSON_MAPPER.readValue(data, valueType); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SSE data with data-level discrimination", e); + } + } + + /** + * Determines if the given discriminator property indicates event-level discrimination. + * Event-level discrimination occurs when the discriminator is an SSE envelope field. + * + * @param discriminatorProperty The discriminator property name + * @return true if event-level discrimination, false otherwise + */ + public static boolean isEventLevelDiscrimination(String discriminatorProperty) { + return SSE_ENVELOPE_FIELDS.contains(discriminatorProperty); + } + + /** + * Attempts to find the discriminator property from the union class's Jackson annotations. + * + * @param unionClass The union class to inspect + * @return The discriminator property name, or empty if not found + */ + public static Optional findDiscriminatorProperty(Class unionClass) { + try { + // Look for JsonTypeInfo on the class itself + JsonTypeInfo typeInfo = unionClass.getAnnotation(JsonTypeInfo.class); + if (typeInfo != null && !typeInfo.property().isEmpty()) { + return Optional.of(typeInfo.property()); + } + + // Look for inner Value interface with JsonTypeInfo + for (Class innerClass : unionClass.getDeclaredClasses()) { + typeInfo = innerClass.getAnnotation(JsonTypeInfo.class); + if (typeInfo != null && !typeInfo.property().isEmpty()) { + return Optional.of(typeInfo.property()); + } + } + } catch (Exception e) { + // Ignore reflection errors + } + return Optional.empty(); + } + + /** + * Parse the data field based on what the matching variant expects. + * If the variant expects a String for its data field, returns the raw string. + * Otherwise, parses the data as JSON. + */ + private static Object parseDataForVariant( + String eventType, String data, Class unionClass, String discriminatorProperty) { + if (data == null || data.isEmpty()) { + return data; + } + + try { + // Try to find the variant class that matches this event type + Class variantClass = findVariantClass(unionClass, eventType, discriminatorProperty); + if (variantClass != null) { + // Check if the variant expects a String for the data field + Field dataField = findField(variantClass, "data"); + if (dataField != null && String.class.equals(dataField.getType())) { + // Variant expects String - return raw data + return data; + } + } + + // Try to parse as JSON + return ObjectMappers.JSON_MAPPER.readValue(data, new TypeReference>() {}); + } catch (Exception e) { + // If JSON parsing fails, return as string + return data; + } + } + + /** + * Find the variant class that matches the given discriminator value. + */ + private static Class findVariantClass( + Class unionClass, String discriminatorValue, String discriminatorProperty) { + try { + // Look for JsonSubTypes annotation + JsonSubTypes subTypes = findJsonSubTypes(unionClass); + if (subTypes == null) { + return null; + } + + for (JsonSubTypes.Type subType : subTypes.value()) { + JsonTypeName typeName = subType.value().getAnnotation(JsonTypeName.class); + if (typeName != null && typeName.value().equals(discriminatorValue)) { + return subType.value(); + } + // Also check the name attribute of @JsonSubTypes.Type + if (subType.name().equals(discriminatorValue)) { + return subType.value(); + } + } + } catch (Exception e) { + // Ignore reflection errors + } + return null; + } + + /** + * Find JsonSubTypes annotation on the class or its inner classes. + */ + private static JsonSubTypes findJsonSubTypes(Class unionClass) { + // Check the class itself + JsonSubTypes subTypes = unionClass.getAnnotation(JsonSubTypes.class); + if (subTypes != null) { + return subTypes; + } + + // Check inner classes (for Fern-style unions with inner Value interface) + for (Class innerClass : unionClass.getDeclaredClasses()) { + subTypes = innerClass.getAnnotation(JsonSubTypes.class); + if (subTypes != null) { + return subTypes; + } + } + return null; + } + + /** + * Find a field by name in a class, including private fields. + */ + private static Field findField(Class clazz, String fieldName) { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + // Check superclass + Class superClass = clazz.getSuperclass(); + if (superClass != null && superClass != Object.class) { + return findField(superClass, fieldName); + } + return null; + } + } +} diff --git a/src/main/java/com/schematic/api/core/Stream.java b/src/main/java/com/schematic/api/core/Stream.java index b4e9ab3..1fa4d2a 100644 --- a/src/main/java/com/schematic/api/core/Stream.java +++ b/src/main/java/com/schematic/api/core/Stream.java @@ -28,7 +28,8 @@ public final class Stream implements Iterable, Closeable { public enum StreamType { JSON, - SSE + SSE, + SSE_EVENT_DISCRIMINATED } private final Class valueType; @@ -37,6 +38,7 @@ public enum StreamType { private final String messageTerminator; private final String streamTerminator; private final Reader sseReader; + private final String discriminatorProperty; private boolean isClosed = false; /** @@ -53,11 +55,18 @@ public Stream(Class valueType, Reader reader, String delimiter) { this.messageTerminator = delimiter; this.streamTerminator = null; this.sseReader = null; + this.discriminatorProperty = null; } private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this(valueType, type, reader, terminator, null); + } + + private Stream( + Class valueType, StreamType type, Reader reader, String terminator, String discriminatorProperty) { this.valueType = valueType; this.streamType = type; + this.discriminatorProperty = discriminatorProperty; if (type == StreamType.JSON) { this.scanner = new Scanner(reader).useDelimiter(terminator); this.messageTerminator = terminator; @@ -87,6 +96,38 @@ public static Stream fromSse(Class valueType, Reader sseReader, String return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); } + /** + * Creates a stream from SSE data with event-level discrimination support. + * Use this when the SSE payload is a discriminated union where the discriminator + * is an SSE envelope field (e.g., 'event'). + * + * @param valueType The class of the objects in the stream. + * @param sseReader The reader that provides the SSE data. + * @param discriminatorProperty The property name used for discrimination (e.g., "event"). + * @param The type of objects in the stream. + * @return A new Stream instance configured for SSE with event-level discrimination. + */ + public static Stream fromSseWithEventDiscrimination( + Class valueType, Reader sseReader, String discriminatorProperty) { + return new Stream<>(valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, null, discriminatorProperty); + } + + /** + * Creates a stream from SSE data with event-level discrimination support and a stream terminator. + * + * @param valueType The class of the objects in the stream. + * @param sseReader The reader that provides the SSE data. + * @param discriminatorProperty The property name used for discrimination (e.g., "event"). + * @param streamTerminator The terminator string that signals end of stream (e.g., "[DONE]"). + * @param The type of objects in the stream. + * @return A new Stream instance configured for SSE with event-level discrimination. + */ + public static Stream fromSseWithEventDiscrimination( + Class valueType, Reader sseReader, String discriminatorProperty, String streamTerminator) { + return new Stream<>( + valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, streamTerminator, discriminatorProperty); + } + @Override public void close() throws IOException { if (!isClosed) { @@ -112,10 +153,14 @@ private boolean isStreamClosed() { */ @Override public Iterator iterator() { - if (streamType == StreamType.SSE) { - return new SSEIterator(); - } else { - return new JsonIterator(); + switch (streamType) { + case SSE: + return new SSEIterator(); + case SSE_EVENT_DISCRIMINATED: + return new SSEEventDiscriminatedIterator(); + case JSON: + default: + return new JsonIterator(); } } @@ -299,4 +344,170 @@ private boolean readNextMessage() { } } } + + /** + * Iterator for SSE streams with event-level discrimination. + * Uses SseEventParser to construct the full SSE envelope for Jackson deserialization. + */ + private final class SSEEventDiscriminatedIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder eventDataBuffer = new StringBuilder(); + private String currentEventType = null; + private String currentEventId = null; + private Long currentRetry = null; + + private SSEEventDiscriminatedIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String line = sseScanner.nextLine(); + + if (line.trim().isEmpty()) { + if (eventDataBuffer.length() > 0 || currentEventType != null) { + try { + // Use SseEventParser for event-level discrimination + nextItem = SseEventParser.parseEventLevelUnion( + currentEventType, + eventDataBuffer.toString(), + currentEventId, + currentRetry, + valueType, + discriminatorProperty); + hasNextItem = true; + resetEventState(); + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); + resetEventState(); + continue; + } + } + continue; + } + + if (line.startsWith(DATA_PREFIX)) { + String dataContent = line.substring(DATA_PREFIX.length()); + if (dataContent.startsWith(" ")) { + dataContent = dataContent.substring(1); + } + + if (eventDataBuffer.length() == 0 + && streamTerminator != null + && dataContent.trim().equals(streamTerminator)) { + endOfStream = true; + return false; + } + + if (eventDataBuffer.length() > 0) { + eventDataBuffer.append('\n'); + } + eventDataBuffer.append(dataContent); + } else if (line.startsWith("event:")) { + String eventValue = line.length() > 6 ? line.substring(6) : ""; + if (eventValue.startsWith(" ")) { + eventValue = eventValue.substring(1); + } + currentEventType = eventValue; + } else if (line.startsWith("id:")) { + String idValue = line.length() > 3 ? line.substring(3) : ""; + if (idValue.startsWith(" ")) { + idValue = idValue.substring(1); + } + currentEventId = idValue; + } else if (line.startsWith("retry:")) { + String retryValue = line.length() > 6 ? line.substring(6) : ""; + if (retryValue.startsWith(" ")) { + retryValue = retryValue.substring(1); + } + try { + currentRetry = Long.parseLong(retryValue.trim()); + } catch (NumberFormatException e) { + // Ignore invalid retry values + } + } else if (line.startsWith(":")) { + // Comment line (ignored) + } + } + + // Handle any remaining buffered data at end of stream + if (eventDataBuffer.length() > 0 || currentEventType != null) { + try { + nextItem = SseEventParser.parseEventLevelUnion( + currentEventType, + eventDataBuffer.toString(), + currentEventId, + currentRetry, + valueType, + discriminatorProperty); + hasNextItem = true; + resetEventState(); + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); + resetEventState(); + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + + private void resetEventState() { + eventDataBuffer.setLength(0); + currentEventType = null; + currentEventId = null; + currentRetry = null; + } + } } diff --git a/src/main/java/com/schematic/api/resources/accesstokens/AsyncRawAccesstokensClient.java b/src/main/java/com/schematic/api/resources/accesstokens/AsyncRawAccesstokensClient.java index 95f064e..66c0380 100644 --- a/src/main/java/com/schematic/api/resources/accesstokens/AsyncRawAccesstokensClient.java +++ b/src/main/java/com/schematic/api/resources/accesstokens/AsyncRawAccesstokensClient.java @@ -46,10 +46,14 @@ public CompletableFuture> issueTemporaryAccessToken( IssueTemporaryAccessTokenRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("temporary-access-tokens") - .build(); + .addPathSegments("temporary-access-tokens"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -58,7 +62,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), IssueTemporaryAccessTokenResponse.class), + responseBodyString, IssueTemporaryAccessTokenResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -113,11 +117,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/accesstokens/RawAccesstokensClient.java b/src/main/java/com/schematic/api/resources/accesstokens/RawAccesstokensClient.java index d9553c9..039327b 100644 --- a/src/main/java/com/schematic/api/resources/accesstokens/RawAccesstokensClient.java +++ b/src/main/java/com/schematic/api/resources/accesstokens/RawAccesstokensClient.java @@ -42,10 +42,14 @@ public BaseSchematicHttpResponse issueTempora public BaseSchematicHttpResponse issueTemporaryAccessToken( IssueTemporaryAccessTokenRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("temporary-access-tokens") - .build(); + .addPathSegments("temporary-access-tokens"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -54,7 +58,7 @@ public BaseSchematicHttpResponse issueTempora throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -66,13 +70,13 @@ public BaseSchematicHttpResponse issueTempora } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), IssueTemporaryAccessTokenResponse.class), + responseBodyString, IssueTemporaryAccessTokenResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -94,11 +98,9 @@ public BaseSchematicHttpResponse issueTempora } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/accesstokens/requests/IssueTemporaryAccessTokenRequestBody.java b/src/main/java/com/schematic/api/resources/accesstokens/requests/IssueTemporaryAccessTokenRequestBody.java index 9990e0d..b401613 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 @@ -83,6 +83,10 @@ public interface ResourceTypeStage { public interface _FinalStage { IssueTemporaryAccessTokenRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage lookup(Map lookup); _FinalStage putAllLookup(Map lookup); @@ -143,5 +147,17 @@ public _FinalStage lookup(Map lookup) { public IssueTemporaryAccessTokenRequestBody build() { return new IssueTemporaryAccessTokenRequestBody(lookup, resourceType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.java b/src/main/java/com/schematic/api/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.java index a2583ef..240c040 100644 --- a/src/main/java/com/schematic/api/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.java +++ b/src/main/java/com/schematic/api/resources/accesstokens/types/IssueTemporaryAccessTokenResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { IssueTemporaryAccessTokenResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public IssueTemporaryAccessTokenResponse build() { return new IssueTemporaryAccessTokenResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java index 45393d5..4ddb1f1 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AccountsClient.java @@ -6,29 +6,25 @@ import com.schematic.api.core.ClientOptions; 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.GetWhoAmIResponse; 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; @@ -80,6 +76,10 @@ public UpdateApiKeyResponse updateApiKey(String apiKeyId) { return this.rawClient.updateApiKey(apiKeyId).body(); } + public UpdateApiKeyResponse updateApiKey(String apiKeyId, RequestOptions requestOptions) { + return this.rawClient.updateApiKey(apiKeyId, requestOptions).body(); + } + public UpdateApiKeyResponse updateApiKey(String apiKeyId, UpdateApiKeyRequestBody request) { return this.rawClient.updateApiKey(apiKeyId, request).body(); } @@ -105,42 +105,14 @@ public CountApiKeysResponse countApiKeys(CountApiKeysRequest request, RequestOpt return this.rawClient.countApiKeys(request, requestOptions).body(); } - public ListApiRequestsResponse listApiRequests() { - return this.rawClient.listApiRequests().body(); - } - - public ListApiRequestsResponse listApiRequests(ListApiRequestsRequest request) { - return this.rawClient.listApiRequests(request).body(); - } - - public ListApiRequestsResponse listApiRequests(ListApiRequestsRequest request, RequestOptions requestOptions) { - return this.rawClient.listApiRequests(request, requestOptions).body(); - } - - public GetApiRequestResponse getApiRequest(String apiRequestId) { - return this.rawClient.getApiRequest(apiRequestId).body(); - } - - public GetApiRequestResponse getApiRequest(String apiRequestId, RequestOptions requestOptions) { - return this.rawClient.getApiRequest(apiRequestId, requestOptions).body(); - } - - public CountApiRequestsResponse countApiRequests() { - return this.rawClient.countApiRequests().body(); - } - - public CountApiRequestsResponse countApiRequests(CountApiRequestsRequest request) { - return this.rawClient.countApiRequests(request).body(); - } - - public CountApiRequestsResponse countApiRequests(CountApiRequestsRequest request, RequestOptions requestOptions) { - return this.rawClient.countApiRequests(request, requestOptions).body(); - } - public ListAuditLogsResponse listAuditLogs() { return this.rawClient.listAuditLogs().body(); } + public ListAuditLogsResponse listAuditLogs(RequestOptions requestOptions) { + return this.rawClient.listAuditLogs(requestOptions).body(); + } + public ListAuditLogsResponse listAuditLogs(ListAuditLogsRequest request) { return this.rawClient.listAuditLogs(request).body(); } @@ -161,6 +133,10 @@ public CountAuditLogsResponse countAuditLogs() { return this.rawClient.countAuditLogs().body(); } + public CountAuditLogsResponse countAuditLogs(RequestOptions requestOptions) { + return this.rawClient.countAuditLogs(requestOptions).body(); + } + public CountAuditLogsResponse countAuditLogs(CountAuditLogsRequest request) { return this.rawClient.countAuditLogs(request).body(); } @@ -173,6 +149,10 @@ public ListEnvironmentsResponse listEnvironments() { return this.rawClient.listEnvironments().body(); } + public ListEnvironmentsResponse listEnvironments(RequestOptions requestOptions) { + return this.rawClient.listEnvironments(requestOptions).body(); + } + public ListEnvironmentsResponse listEnvironments(ListEnvironmentsRequest request) { return this.rawClient.listEnvironments(request).body(); } @@ -202,6 +182,10 @@ public UpdateEnvironmentResponse updateEnvironment(String environmentId) { return this.rawClient.updateEnvironment(environmentId).body(); } + public UpdateEnvironmentResponse updateEnvironment(String environmentId, RequestOptions requestOptions) { + return this.rawClient.updateEnvironment(environmentId, requestOptions).body(); + } + public UpdateEnvironmentResponse updateEnvironment(String environmentId, UpdateEnvironmentRequestBody request) { return this.rawClient.updateEnvironment(environmentId, request).body(); } @@ -228,4 +212,12 @@ public QuickstartResponse quickstart() { public QuickstartResponse quickstart(RequestOptions requestOptions) { return this.rawClient.quickstart(requestOptions).body(); } + + public GetWhoAmIResponse getWhoAmI() { + return this.rawClient.getWhoAmI().body(); + } + + public GetWhoAmIResponse getWhoAmI(RequestOptions requestOptions) { + return this.rawClient.getWhoAmI(requestOptions).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 0e7b1a4..410c177 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncAccountsClient.java @@ -6,29 +6,25 @@ import com.schematic.api.core.ClientOptions; 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.GetWhoAmIResponse; 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; @@ -83,6 +79,10 @@ public CompletableFuture updateApiKey(String apiKeyId) { return this.rawClient.updateApiKey(apiKeyId).thenApply(response -> response.body()); } + public CompletableFuture updateApiKey(String apiKeyId, RequestOptions requestOptions) { + return this.rawClient.updateApiKey(apiKeyId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updateApiKey(String apiKeyId, UpdateApiKeyRequestBody request) { return this.rawClient.updateApiKey(apiKeyId, request).thenApply(response -> response.body()); } @@ -109,44 +109,14 @@ public CompletableFuture countApiKeys( return this.rawClient.countApiKeys(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture listApiRequests() { - return this.rawClient.listApiRequests().thenApply(response -> response.body()); - } - - public CompletableFuture listApiRequests(ListApiRequestsRequest request) { - return this.rawClient.listApiRequests(request).thenApply(response -> response.body()); - } - - public CompletableFuture listApiRequests( - ListApiRequestsRequest request, RequestOptions requestOptions) { - return this.rawClient.listApiRequests(request, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture getApiRequest(String apiRequestId) { - return this.rawClient.getApiRequest(apiRequestId).thenApply(response -> response.body()); - } - - public CompletableFuture getApiRequest(String apiRequestId, RequestOptions requestOptions) { - return this.rawClient.getApiRequest(apiRequestId, requestOptions).thenApply(response -> response.body()); - } - - public CompletableFuture countApiRequests() { - return this.rawClient.countApiRequests().thenApply(response -> response.body()); - } - - public CompletableFuture countApiRequests(CountApiRequestsRequest request) { - return this.rawClient.countApiRequests(request).thenApply(response -> response.body()); - } - - public CompletableFuture countApiRequests( - CountApiRequestsRequest request, RequestOptions requestOptions) { - return this.rawClient.countApiRequests(request, requestOptions).thenApply(response -> response.body()); - } - public CompletableFuture listAuditLogs() { return this.rawClient.listAuditLogs().thenApply(response -> response.body()); } + public CompletableFuture listAuditLogs(RequestOptions requestOptions) { + return this.rawClient.listAuditLogs(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listAuditLogs(ListAuditLogsRequest request) { return this.rawClient.listAuditLogs(request).thenApply(response -> response.body()); } @@ -168,6 +138,10 @@ public CompletableFuture countAuditLogs() { return this.rawClient.countAuditLogs().thenApply(response -> response.body()); } + public CompletableFuture countAuditLogs(RequestOptions requestOptions) { + return this.rawClient.countAuditLogs(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countAuditLogs(CountAuditLogsRequest request) { return this.rawClient.countAuditLogs(request).thenApply(response -> response.body()); } @@ -181,6 +155,10 @@ public CompletableFuture listEnvironments() { return this.rawClient.listEnvironments().thenApply(response -> response.body()); } + public CompletableFuture listEnvironments(RequestOptions requestOptions) { + return this.rawClient.listEnvironments(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listEnvironments(ListEnvironmentsRequest request) { return this.rawClient.listEnvironments(request).thenApply(response -> response.body()); } @@ -212,6 +190,11 @@ public CompletableFuture updateEnvironment(String env return this.rawClient.updateEnvironment(environmentId).thenApply(response -> response.body()); } + public CompletableFuture updateEnvironment( + String environmentId, RequestOptions requestOptions) { + return this.rawClient.updateEnvironment(environmentId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updateEnvironment( String environmentId, UpdateEnvironmentRequestBody request) { return this.rawClient.updateEnvironment(environmentId, request).thenApply(response -> response.body()); @@ -240,4 +223,12 @@ public CompletableFuture quickstart() { public CompletableFuture quickstart(RequestOptions requestOptions) { return this.rawClient.quickstart(requestOptions).thenApply(response -> response.body()); } + + public CompletableFuture getWhoAmI() { + return this.rawClient.getWhoAmI().thenApply(response -> response.body()); + } + + public CompletableFuture getWhoAmI(RequestOptions requestOptions) { + return this.rawClient.getWhoAmI(requestOptions).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 c951ef4..cf062f8 100644 --- a/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/AsyncRawAccountsClient.java @@ -18,29 +18,25 @@ import com.schematic.api.errors.NotFoundError; 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.GetWhoAmIResponse; 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; @@ -89,6 +85,11 @@ public CompletableFuture> listApi QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -104,13 +105,13 @@ public CompletableFuture> listApi @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListApiKeysResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListApiKeysResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -142,11 +143,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -168,10 +167,14 @@ public CompletableFuture> create public CompletableFuture> createApiKey( CreateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("api-keys") - .build(); + .addPathSegments("api-keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -180,7 +183,7 @@ public CompletableFuture> create throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -195,13 +198,13 @@ public CompletableFuture> create @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateApiKeyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateApiKeyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -233,11 +236,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -258,13 +259,17 @@ public CompletableFuture> getApiKey public CompletableFuture> getApiKey( String apiKeyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId) - .build(); + .addPathSegment(apiKeyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -278,13 +283,13 @@ public CompletableFuture> getApiKey @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetApiKeyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetApiKeyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -311,11 +316,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -334,6 +337,11 @@ public CompletableFuture> update return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build()); } + public CompletableFuture> updateApiKey( + String apiKeyId, RequestOptions requestOptions) { + return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> updateApiKey( String apiKeyId, UpdateApiKeyRequestBody request) { return updateApiKey(apiKeyId, request, null); @@ -341,11 +349,15 @@ public CompletableFuture> update public CompletableFuture> updateApiKey( String apiKeyId, UpdateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId) - .build(); + .addPathSegment(apiKeyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -354,7 +366,7 @@ public CompletableFuture> update throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -369,13 +381,13 @@ public CompletableFuture> update @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateApiKeyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateApiKeyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -407,11 +419,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -432,13 +442,17 @@ public CompletableFuture> delete public CompletableFuture> deleteApiKey( String apiKeyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId) - .build(); + .addPathSegment(apiKeyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -452,13 +466,13 @@ public CompletableFuture> delete @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteApiKeyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteApiKeyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -490,11 +504,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -532,110 +544,10 @@ public CompletableFuture> countA 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(), CountApiKeysResponse.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> listApiRequests() { - return listApiRequests(ListApiRequestsRequest.builder().build()); - } - - public CompletableFuture> listApiRequests( - ListApiRequestsRequest request) { - return listApiRequests(request, null); - } - - public CompletableFuture> listApiRequests( - ListApiRequestsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-requests"); - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getRequestType().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "request_type", request.getRequestType().get(), false); - } - if (request.getEnvironmentId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "environment_id", request.getEnvironmentId().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getOffset().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "offset", request.getOffset().get(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -647,203 +559,18 @@ public CompletableFuture> lis 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(), ListApiRequestsResponse.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> getApiRequest(String apiRequestId) { - return getApiRequest(apiRequestId, null); - } - - public CompletableFuture> getApiRequest( - String apiRequestId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-requests") - .addPathSegment(apiRequestId) - .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<>(); + 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(), GetApiRequestResponse.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> countApiRequests() { - return countApiRequests(CountApiRequestsRequest.builder().build()); - } - - public CompletableFuture> countApiRequests( - CountApiRequestsRequest request) { - return countApiRequests(request, null); - } - - public CompletableFuture> countApiRequests( - CountApiRequestsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-requests/count"); - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getRequestType().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "request_type", request.getRequestType().get(), false); - } - if (request.getEnvironmentId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "environment_id", request.getEnvironmentId().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(), CountApiRequestsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountApiKeysResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -875,11 +602,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -898,6 +623,11 @@ public CompletableFuture> listA return listAuditLogs(ListAuditLogsRequest.builder().build()); } + public CompletableFuture> listAuditLogs( + RequestOptions requestOptions) { + return listAuditLogs(ListAuditLogsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listAuditLogs( ListAuditLogsRequest request) { return listAuditLogs(request, null); @@ -912,6 +642,10 @@ public CompletableFuture> listA QueryStringMapper.addQueryParameter( httpUrl, "actor_type", request.getActorType().get(), false); } + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } if (request.getEnvironmentId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "environment_id", request.getEnvironmentId().get(), false); @@ -919,6 +653,10 @@ public CompletableFuture> listA if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -927,6 +665,11 @@ public CompletableFuture> listA QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -942,13 +685,13 @@ public CompletableFuture> listA @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAuditLogsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAuditLogsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -980,11 +723,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1005,13 +746,17 @@ public CompletableFuture> getAudi public CompletableFuture> getAuditLog( String auditLogId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("audit-log") - .addPathSegment(auditLogId) - .build(); + .addPathSegment(auditLogId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1025,13 +770,13 @@ public CompletableFuture> getAudi @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAuditLogResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAuditLogResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1058,11 +803,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1081,6 +824,11 @@ public CompletableFuture> coun return countAuditLogs(CountAuditLogsRequest.builder().build()); } + public CompletableFuture> countAuditLogs( + RequestOptions requestOptions) { + return countAuditLogs(CountAuditLogsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countAuditLogs( CountAuditLogsRequest request) { return countAuditLogs(request, null); @@ -1095,6 +843,10 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "actor_type", request.getActorType().get(), false); } + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } if (request.getEnvironmentId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "environment_id", request.getEnvironmentId().get(), false); @@ -1102,6 +854,10 @@ public CompletableFuture> coun if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -1110,6 +866,11 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1125,14 +886,13 @@ public CompletableFuture> coun @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountAuditLogsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountAuditLogsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1164,11 +924,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1187,6 +945,11 @@ public CompletableFuture> li return listEnvironments(ListEnvironmentsRequest.builder().build()); } + public CompletableFuture> listEnvironments( + RequestOptions requestOptions) { + return listEnvironments(ListEnvironmentsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listEnvironments( ListEnvironmentsRequest request) { return listEnvironments(request, null); @@ -1208,6 +971,11 @@ public CompletableFuture> li if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1223,14 +991,13 @@ public CompletableFuture> li @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListEnvironmentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEnvironmentsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1262,11 +1029,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1288,10 +1053,14 @@ public CompletableFuture> c public CompletableFuture> createEnvironment( CreateEnvironmentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("environments") - .build(); + .addPathSegments("environments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1300,7 +1069,7 @@ public CompletableFuture> c throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1315,14 +1084,14 @@ public CompletableFuture> c @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateEnvironmentResponse.class), + responseBodyString, CreateEnvironmentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1354,11 +1123,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1379,13 +1146,17 @@ public CompletableFuture> getE public CompletableFuture> getEnvironment( String environmentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId) - .build(); + .addPathSegment(environmentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1399,14 +1170,13 @@ public CompletableFuture> getE @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEnvironmentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1433,11 +1203,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1458,6 +1226,12 @@ public CompletableFuture> u environmentId, UpdateEnvironmentRequestBody.builder().build()); } + public CompletableFuture> updateEnvironment( + String environmentId, RequestOptions requestOptions) { + return updateEnvironment( + environmentId, UpdateEnvironmentRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> updateEnvironment( String environmentId, UpdateEnvironmentRequestBody request) { return updateEnvironment(environmentId, request, null); @@ -1465,11 +1239,15 @@ public CompletableFuture> u public CompletableFuture> updateEnvironment( String environmentId, UpdateEnvironmentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId) - .build(); + .addPathSegment(environmentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1478,7 +1256,7 @@ public CompletableFuture> u throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1493,14 +1271,14 @@ public CompletableFuture> u @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateEnvironmentResponse.class), + responseBodyString, UpdateEnvironmentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1532,11 +1310,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1558,13 +1334,17 @@ public CompletableFuture> d public CompletableFuture> deleteEnvironment( String environmentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId) - .build(); + .addPathSegment(environmentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1578,14 +1358,14 @@ public CompletableFuture> d @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteEnvironmentResponse.class), + responseBodyString, DeleteEnvironmentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1617,11 +1397,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1641,12 +1419,16 @@ public CompletableFuture> quicksta } public CompletableFuture> quickstart(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("quickstart") - .build(); + .addPathSegments("quickstart"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", RequestBody.create("", null)) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1660,13 +1442,13 @@ public CompletableFuture> quicksta @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), QuickstartResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, QuickstartResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1698,11 +1480,87 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> getWhoAmI() { + return getWhoAmI(null); + } + + public CompletableFuture> getWhoAmI(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("whoami"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWhoAmIResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 170a7d8..3a68cc6 100644 --- a/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java +++ b/src/main/java/com/schematic/api/resources/accounts/RawAccountsClient.java @@ -18,29 +18,25 @@ import com.schematic.api.errors.NotFoundError; 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.GetWhoAmIResponse; 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; @@ -85,6 +81,11 @@ public BaseSchematicHttpResponse listApiKeys( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -97,12 +98,11 @@ public BaseSchematicHttpResponse listApiKeys( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListApiKeysResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListApiKeysResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -124,11 +124,9 @@ public BaseSchematicHttpResponse listApiKeys( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -140,10 +138,14 @@ public BaseSchematicHttpResponse createApiKey(CreateApiKey public BaseSchematicHttpResponse createApiKey( CreateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("api-keys") - .build(); + .addPathSegments("api-keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -152,7 +154,7 @@ public BaseSchematicHttpResponse createApiKey( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -164,12 +166,11 @@ public BaseSchematicHttpResponse createApiKey( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateApiKeyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateApiKeyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -191,11 +192,9 @@ public BaseSchematicHttpResponse createApiKey( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -206,13 +205,17 @@ public BaseSchematicHttpResponse getApiKey(String apiKeyId) { } public BaseSchematicHttpResponse getApiKey(String apiKeyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId) - .build(); + .addPathSegment(apiKeyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -223,11 +226,11 @@ public BaseSchematicHttpResponse getApiKey(String apiKeyId, R } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetApiKeyResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetApiKeyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -246,11 +249,9 @@ public BaseSchematicHttpResponse getApiKey(String apiKeyId, R } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -260,6 +261,11 @@ public BaseSchematicHttpResponse updateApiKey(String apiKe return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build()); } + public BaseSchematicHttpResponse updateApiKey( + String apiKeyId, RequestOptions requestOptions) { + return updateApiKey(apiKeyId, UpdateApiKeyRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse updateApiKey( String apiKeyId, UpdateApiKeyRequestBody request) { return updateApiKey(apiKeyId, request, null); @@ -267,11 +273,15 @@ public BaseSchematicHttpResponse updateApiKey( public BaseSchematicHttpResponse updateApiKey( String apiKeyId, UpdateApiKeyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId) - .build(); + .addPathSegment(apiKeyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -280,7 +290,7 @@ public BaseSchematicHttpResponse updateApiKey( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -292,12 +302,11 @@ public BaseSchematicHttpResponse updateApiKey( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateApiKeyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateApiKeyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -319,11 +328,9 @@ public BaseSchematicHttpResponse updateApiKey( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -335,13 +342,17 @@ public BaseSchematicHttpResponse deleteApiKey(String apiKe public BaseSchematicHttpResponse deleteApiKey( String apiKeyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("api-keys") - .addPathSegment(apiKeyId) - .build(); + .addPathSegment(apiKeyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -352,12 +363,11 @@ public BaseSchematicHttpResponse deleteApiKey( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteApiKeyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteApiKeyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -379,11 +389,9 @@ public BaseSchematicHttpResponse deleteApiKey( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -411,86 +419,10 @@ public BaseSchematicHttpResponse countApiKeys( 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(), CountApiKeysResponse.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 listApiRequests() { - return listApiRequests(ListApiRequestsRequest.builder().build()); - } - - public BaseSchematicHttpResponse listApiRequests(ListApiRequestsRequest request) { - return listApiRequests(request, null); - } - - public BaseSchematicHttpResponse listApiRequests( - ListApiRequestsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-requests"); - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getRequestType().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "request_type", request.getRequestType().get(), false); - } - if (request.getEnvironmentId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "environment_id", request.getEnvironmentId().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getOffset().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "offset", request.getOffset().get(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -504,150 +436,11 @@ public BaseSchematicHttpResponse listApiRequests( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListApiRequestsResponse.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 getApiRequest(String apiRequestId) { - return getApiRequest(apiRequestId, null); - } - - public BaseSchematicHttpResponse getApiRequest( - String apiRequestId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-requests") - .addPathSegment(apiRequestId) - .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(), GetApiRequestResponse.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 countApiRequests() { - return countApiRequests(CountApiRequestsRequest.builder().build()); - } - - public BaseSchematicHttpResponse countApiRequests(CountApiRequestsRequest request) { - return countApiRequests(request, null); - } - - public BaseSchematicHttpResponse countApiRequests( - CountApiRequestsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api-requests/count"); - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getRequestType().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "request_type", request.getRequestType().get(), false); - } - if (request.getEnvironmentId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "environment_id", request.getEnvironmentId().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(), CountApiRequestsResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountApiKeysResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -669,11 +462,9 @@ public BaseSchematicHttpResponse countApiRequests( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -683,6 +474,10 @@ public BaseSchematicHttpResponse listAuditLogs() { return listAuditLogs(ListAuditLogsRequest.builder().build()); } + public BaseSchematicHttpResponse listAuditLogs(RequestOptions requestOptions) { + return listAuditLogs(ListAuditLogsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listAuditLogs(ListAuditLogsRequest request) { return listAuditLogs(request, null); } @@ -696,6 +491,10 @@ public BaseSchematicHttpResponse listAuditLogs( QueryStringMapper.addQueryParameter( httpUrl, "actor_type", request.getActorType().get(), false); } + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } if (request.getEnvironmentId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "environment_id", request.getEnvironmentId().get(), false); @@ -703,6 +502,10 @@ public BaseSchematicHttpResponse listAuditLogs( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -711,6 +514,11 @@ public BaseSchematicHttpResponse listAuditLogs( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -723,12 +531,11 @@ public BaseSchematicHttpResponse listAuditLogs( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAuditLogsResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListAuditLogsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -750,11 +557,9 @@ public BaseSchematicHttpResponse listAuditLogs( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -766,13 +571,17 @@ public BaseSchematicHttpResponse getAuditLog(String auditLo public BaseSchematicHttpResponse getAuditLog( String auditLogId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("audit-log") - .addPathSegment(auditLogId) - .build(); + .addPathSegment(auditLogId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -783,12 +592,11 @@ public BaseSchematicHttpResponse getAuditLog( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAuditLogResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetAuditLogResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -807,11 +615,9 @@ public BaseSchematicHttpResponse getAuditLog( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -821,6 +627,10 @@ public BaseSchematicHttpResponse countAuditLogs() { return countAuditLogs(CountAuditLogsRequest.builder().build()); } + public BaseSchematicHttpResponse countAuditLogs(RequestOptions requestOptions) { + return countAuditLogs(CountAuditLogsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countAuditLogs(CountAuditLogsRequest request) { return countAuditLogs(request, null); } @@ -834,6 +644,10 @@ public BaseSchematicHttpResponse countAuditLogs( QueryStringMapper.addQueryParameter( httpUrl, "actor_type", request.getActorType().get(), false); } + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } if (request.getEnvironmentId().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "environment_id", request.getEnvironmentId().get(), false); @@ -841,6 +655,10 @@ public BaseSchematicHttpResponse countAuditLogs( if (request.getQ().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } if (request.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -849,6 +667,11 @@ public BaseSchematicHttpResponse countAuditLogs( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -861,12 +684,12 @@ public BaseSchematicHttpResponse countAuditLogs( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountAuditLogsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountAuditLogsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -888,11 +711,9 @@ public BaseSchematicHttpResponse countAuditLogs( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -902,6 +723,10 @@ public BaseSchematicHttpResponse listEnvironments() { return listEnvironments(ListEnvironmentsRequest.builder().build()); } + public BaseSchematicHttpResponse listEnvironments(RequestOptions requestOptions) { + return listEnvironments(ListEnvironmentsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listEnvironments(ListEnvironmentsRequest request) { return listEnvironments(request, null); } @@ -922,6 +747,11 @@ public BaseSchematicHttpResponse listEnvironments( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -934,12 +764,12 @@ public BaseSchematicHttpResponse listEnvironments( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListEnvironmentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEnvironmentsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -961,11 +791,9 @@ public BaseSchematicHttpResponse listEnvironments( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -978,10 +806,14 @@ public BaseSchematicHttpResponse createEnvironment( public BaseSchematicHttpResponse createEnvironment( CreateEnvironmentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("environments") - .build(); + .addPathSegments("environments"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -990,7 +822,7 @@ public BaseSchematicHttpResponse createEnvironment( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1002,12 +834,12 @@ public BaseSchematicHttpResponse createEnvironment( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEnvironmentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1029,11 +861,9 @@ public BaseSchematicHttpResponse createEnvironment( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1045,13 +875,17 @@ public BaseSchematicHttpResponse getEnvironment(String e public BaseSchematicHttpResponse getEnvironment( String environmentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId) - .build(); + .addPathSegment(environmentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1062,12 +896,12 @@ public BaseSchematicHttpResponse getEnvironment( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEnvironmentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1086,11 +920,9 @@ public BaseSchematicHttpResponse getEnvironment( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1101,6 +933,12 @@ public BaseSchematicHttpResponse updateEnvironment(St environmentId, UpdateEnvironmentRequestBody.builder().build()); } + public BaseSchematicHttpResponse updateEnvironment( + String environmentId, RequestOptions requestOptions) { + return updateEnvironment( + environmentId, UpdateEnvironmentRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse updateEnvironment( String environmentId, UpdateEnvironmentRequestBody request) { return updateEnvironment(environmentId, request, null); @@ -1108,11 +946,15 @@ public BaseSchematicHttpResponse updateEnvironment( public BaseSchematicHttpResponse updateEnvironment( String environmentId, UpdateEnvironmentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId) - .build(); + .addPathSegment(environmentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1121,7 +963,7 @@ public BaseSchematicHttpResponse updateEnvironment( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1133,12 +975,12 @@ public BaseSchematicHttpResponse updateEnvironment( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateEnvironmentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1160,11 +1002,9 @@ public BaseSchematicHttpResponse updateEnvironment( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1176,13 +1016,17 @@ public BaseSchematicHttpResponse deleteEnvironment(St public BaseSchematicHttpResponse deleteEnvironment( String environmentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("environments") - .addPathSegment(environmentId) - .build(); + .addPathSegment(environmentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1193,12 +1037,12 @@ public BaseSchematicHttpResponse deleteEnvironment( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteEnvironmentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteEnvironmentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1220,11 +1064,9 @@ public BaseSchematicHttpResponse deleteEnvironment( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1235,12 +1077,16 @@ public BaseSchematicHttpResponse quickstart() { } public BaseSchematicHttpResponse quickstart(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("quickstart") - .build(); + .addPathSegments("quickstart"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", RequestBody.create("", null)) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1251,11 +1097,11 @@ public BaseSchematicHttpResponse quickstart(RequestOptions r } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), QuickstartResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, QuickstartResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1277,11 +1123,65 @@ public BaseSchematicHttpResponse quickstart(RequestOptions r } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getWhoAmI() { + return getWhoAmI(null); + } + + public BaseSchematicHttpResponse getWhoAmI(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("whoami"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWhoAmIResponse.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CountApiKeysRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/CountApiKeysRequest.java index 332acff..b1404d5 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CountApiKeysRequest.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CountApiKeysRequest.java @@ -24,17 +24,17 @@ public final class CountApiKeysRequest { private final boolean requireEnvironment; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountApiKeysRequest( Optional environmentId, boolean requireEnvironment, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.environmentId = environmentId; this.requireEnvironment = requireEnvironment; @@ -57,7 +57,7 @@ public boolean getRequireEnvironment() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -110,6 +110,10 @@ public interface RequireEnvironmentStage { public interface _FinalStage { CountApiKeysRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage environmentId(Optional environmentId); _FinalStage environmentId(String environmentId); @@ -117,25 +121,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements RequireEnvironmentStage, _FinalStage { private boolean requireEnvironment; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional environmentId = Optional.empty(); @@ -165,7 +169,7 @@ public _FinalStage requireEnvironment(boolean requireEnvironment) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -175,7 +179,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -185,7 +189,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -195,7 +199,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -217,5 +221,17 @@ public _FinalStage environmentId(Optional environmentId) { public CountApiKeysRequest build() { return new CountApiKeysRequest(environmentId, requireEnvironment, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java index 16adb04..ac71a48 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CountAuditLogsRequest.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.ActorType; +import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,26 +24,34 @@ public final class CountAuditLogsRequest { private final Optional actorType; + private final Optional endTime; + private final Optional environmentId; private final Optional q; - private final Optional limit; + private final Optional startTime; + + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountAuditLogsRequest( Optional actorType, + Optional endTime, Optional environmentId, Optional q, - Optional limit, - Optional offset, + Optional startTime, + Optional limit, + Optional offset, Map additionalProperties) { this.actorType = actorType; + this.endTime = endTime; this.environmentId = environmentId; this.q = q; + this.startTime = startTime; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -53,6 +62,11 @@ public Optional getActorType() { return actorType; } + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + @JsonProperty("environment_id") public Optional getEnvironmentId() { return environmentId; @@ -63,11 +77,16 @@ public Optional getQ() { return q; } + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -75,7 +94,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -92,15 +111,18 @@ public Map getAdditionalProperties() { private boolean equalTo(CountAuditLogsRequest other) { return actorType.equals(other.actorType) + && endTime.equals(other.endTime) && environmentId.equals(other.environmentId) && q.equals(other.q) + && startTime.equals(other.startTime) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.actorType, this.environmentId, this.q, this.limit, this.offset); + return Objects.hash( + this.actorType, this.endTime, this.environmentId, this.q, this.startTime, this.limit, this.offset); } @java.lang.Override @@ -116,13 +138,17 @@ public static Builder builder() { public static final class Builder { private Optional actorType = Optional.empty(); + private Optional endTime = Optional.empty(); + private Optional environmentId = Optional.empty(); private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional startTime = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -131,8 +157,10 @@ private Builder() {} public Builder from(CountAuditLogsRequest other) { actorType(other.getActorType()); + endTime(other.getEndTime()); environmentId(other.getEnvironmentId()); q(other.getQ()); + startTime(other.getStartTime()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -149,6 +177,17 @@ public Builder actorType(ActorType actorType) { 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 = "environment_id", nulls = Nulls.SKIP) public Builder environmentId(Optional environmentId) { this.environmentId = environmentId; @@ -171,16 +210,27 @@ public Builder q(String q) { 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; + } + /** *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } public CountAuditLogsRequest build() { - return new CountAuditLogsRequest(actorType, environmentId, q, limit, offset, additionalProperties); + return new CountAuditLogsRequest( + actorType, endTime, environmentId, q, startTime, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java index fc7830b..b05963c 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/CreateApiKeyRequestBody.java @@ -27,16 +27,20 @@ public final class CreateApiKeyRequestBody { private final String name; + private final Optional readonly; + private final Map additionalProperties; private CreateApiKeyRequestBody( Optional description, Optional environmentId, String name, + Optional readonly, Map additionalProperties) { this.description = description; this.environmentId = environmentId; this.name = name; + this.readonly = readonly; this.additionalProperties = additionalProperties; } @@ -55,6 +59,11 @@ public String getName() { return name; } + @JsonProperty("readonly") + public Optional getReadonly() { + return readonly; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -69,12 +78,13 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateApiKeyRequestBody other) { return description.equals(other.description) && environmentId.equals(other.environmentId) - && name.equals(other.name); + && name.equals(other.name) + && readonly.equals(other.readonly); } @java.lang.Override public int hashCode() { - return Objects.hash(this.description, this.environmentId, this.name); + return Objects.hash(this.description, this.environmentId, this.name, this.readonly); } @java.lang.Override @@ -95,6 +105,10 @@ public interface NameStage { public interface _FinalStage { CreateApiKeyRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -102,12 +116,18 @@ public interface _FinalStage { _FinalStage environmentId(Optional environmentId); _FinalStage environmentId(String environmentId); + + _FinalStage readonly(Optional readonly); + + _FinalStage readonly(Boolean readonly); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements NameStage, _FinalStage { private String name; + private Optional readonly = Optional.empty(); + private Optional environmentId = Optional.empty(); private Optional description = Optional.empty(); @@ -122,6 +142,7 @@ public Builder from(CreateApiKeyRequestBody other) { description(other.getDescription()); environmentId(other.getEnvironmentId()); name(other.getName()); + readonly(other.getReadonly()); return this; } @@ -132,6 +153,19 @@ public _FinalStage name(@NotNull String name) { return this; } + @java.lang.Override + public _FinalStage readonly(Boolean readonly) { + this.readonly = Optional.ofNullable(readonly); + return this; + } + + @java.lang.Override + @JsonSetter(value = "readonly", nulls = Nulls.SKIP) + public _FinalStage readonly(Optional readonly) { + this.readonly = readonly; + return this; + } + @java.lang.Override public _FinalStage environmentId(String environmentId) { this.environmentId = Optional.ofNullable(environmentId); @@ -160,7 +194,19 @@ public _FinalStage description(Optional description) { @java.lang.Override public CreateApiKeyRequestBody build() { - return new CreateApiKeyRequestBody(description, environmentId, name, additionalProperties); + return new CreateApiKeyRequestBody(description, environmentId, name, readonly, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/CreateEnvironmentRequestBody.java index b252591..4db6fc9 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 @@ -84,6 +84,10 @@ public interface NameStage { public interface _FinalStage { CreateEnvironmentRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -122,5 +126,17 @@ public _FinalStage name(@NotNull String name) { public CreateEnvironmentRequestBody build() { return new CreateEnvironmentRequestBody(environmentType, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/ListApiKeysRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/ListApiKeysRequest.java index 53be023..4973446 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/ListApiKeysRequest.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/ListApiKeysRequest.java @@ -24,17 +24,17 @@ public final class ListApiKeysRequest { private final boolean requireEnvironment; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListApiKeysRequest( Optional environmentId, boolean requireEnvironment, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.environmentId = environmentId; this.requireEnvironment = requireEnvironment; @@ -57,7 +57,7 @@ public boolean getRequireEnvironment() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -110,6 +110,10 @@ public interface RequireEnvironmentStage { public interface _FinalStage { ListApiKeysRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage environmentId(Optional environmentId); _FinalStage environmentId(String environmentId); @@ -117,25 +121,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements RequireEnvironmentStage, _FinalStage { private boolean requireEnvironment; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional environmentId = Optional.empty(); @@ -165,7 +169,7 @@ public _FinalStage requireEnvironment(boolean requireEnvironment) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -175,7 +179,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -185,7 +189,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -195,7 +199,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -217,5 +221,17 @@ public _FinalStage environmentId(Optional environmentId) { public ListApiKeysRequest build() { return new ListApiKeysRequest(environmentId, requireEnvironment, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java index a4577da..6fa6321 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/ListAuditLogsRequest.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.ActorType; +import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,26 +24,34 @@ public final class ListAuditLogsRequest { private final Optional actorType; + private final Optional endTime; + private final Optional environmentId; private final Optional q; - private final Optional limit; + private final Optional startTime; + + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListAuditLogsRequest( Optional actorType, + Optional endTime, Optional environmentId, Optional q, - Optional limit, - Optional offset, + Optional startTime, + Optional limit, + Optional offset, Map additionalProperties) { this.actorType = actorType; + this.endTime = endTime; this.environmentId = environmentId; this.q = q; + this.startTime = startTime; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; @@ -53,6 +62,11 @@ public Optional getActorType() { return actorType; } + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + @JsonProperty("environment_id") public Optional getEnvironmentId() { return environmentId; @@ -63,11 +77,16 @@ public Optional getQ() { return q; } + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -75,7 +94,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -92,15 +111,18 @@ public Map getAdditionalProperties() { private boolean equalTo(ListAuditLogsRequest other) { return actorType.equals(other.actorType) + && endTime.equals(other.endTime) && environmentId.equals(other.environmentId) && q.equals(other.q) + && startTime.equals(other.startTime) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.actorType, this.environmentId, this.q, this.limit, this.offset); + return Objects.hash( + this.actorType, this.endTime, this.environmentId, this.q, this.startTime, this.limit, this.offset); } @java.lang.Override @@ -116,13 +138,17 @@ public static Builder builder() { public static final class Builder { private Optional actorType = Optional.empty(); + private Optional endTime = Optional.empty(); + private Optional environmentId = Optional.empty(); private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional startTime = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -131,8 +157,10 @@ private Builder() {} public Builder from(ListAuditLogsRequest other) { actorType(other.getActorType()); + endTime(other.getEndTime()); environmentId(other.getEnvironmentId()); q(other.getQ()); + startTime(other.getStartTime()); limit(other.getLimit()); offset(other.getOffset()); return this; @@ -149,6 +177,17 @@ public Builder actorType(ActorType actorType) { 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 = "environment_id", nulls = Nulls.SKIP) public Builder environmentId(Optional environmentId) { this.environmentId = environmentId; @@ -171,16 +210,27 @@ public Builder q(String q) { 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; + } + /** *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } public ListAuditLogsRequest build() { - return new ListAuditLogsRequest(actorType, environmentId, q, limit, offset, additionalProperties); + return new ListAuditLogsRequest( + actorType, endTime, environmentId, q, startTime, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/ListEnvironmentsRequest.java b/src/main/java/com/schematic/api/resources/accounts/requests/ListEnvironmentsRequest.java index 7546910..26a0616 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/ListEnvironmentsRequest.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/ListEnvironmentsRequest.java @@ -24,16 +24,16 @@ public final class ListEnvironmentsRequest { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListEnvironmentsRequest( Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.limit = limit; @@ -50,7 +50,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -58,7 +58,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -95,9 +95,9 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -131,12 +131,12 @@ public Builder ids(String ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -158,5 +158,15 @@ public Builder offset(Integer offset) { public ListEnvironmentsRequest build() { return new ListEnvironmentsRequest(ids, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java index cbf5677..4da4e9d 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java +++ b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateApiKeyRequestBody.java @@ -114,5 +114,15 @@ public Builder name(String name) { public UpdateApiKeyRequestBody build() { return new UpdateApiKeyRequestBody(description, name, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java b/src/main/java/com/schematic/api/resources/accounts/requests/UpdateEnvironmentRequestBody.java index 65510f4..4fbae9c 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 @@ -117,5 +117,15 @@ public Builder name(String name) { public UpdateEnvironmentRequestBody build() { return new UpdateEnvironmentRequestBody(environmentType, name, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysParams.java b/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysParams.java index 6774dba..71f9ed4 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysParams.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysParams.java @@ -22,9 +22,9 @@ public final class CountApiKeysParams { private final Optional environmentId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional requireEnvironment; @@ -32,8 +32,8 @@ public final class CountApiKeysParams { private CountApiKeysParams( Optional environmentId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional requireEnvironment, Map additionalProperties) { this.environmentId = environmentId; @@ -52,7 +52,7 @@ public Optional getEnvironmentId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional environmentId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional requireEnvironment = Optional.empty(); @@ -139,12 +139,12 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder requireEnvironment(Boolean requireEnvironment) { public CountApiKeysParams build() { return new CountApiKeysParams(environmentId, limit, offset, requireEnvironment, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysResponse.java index c608cbd..8426363 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountApiKeysResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountApiKeysResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountApiKeysParams params) { public CountApiKeysResponse build() { return new CountApiKeysResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java index 0901ea8..6a30e91 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsParams.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.ActorType; +import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,28 +24,36 @@ public final class CountAuditLogsParams { private final Optional actorType; + private final Optional endTime; + private final Optional environmentId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; + private final Optional startTime; + private final Map additionalProperties; private CountAuditLogsParams( Optional actorType, + Optional endTime, Optional environmentId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, + Optional startTime, Map additionalProperties) { this.actorType = actorType; + this.endTime = endTime; this.environmentId = environmentId; this.limit = limit; this.offset = offset; this.q = q; + this.startTime = startTime; this.additionalProperties = additionalProperties; } @@ -53,6 +62,11 @@ public Optional getActorType() { return actorType; } + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + @JsonProperty("environment_id") public Optional getEnvironmentId() { return environmentId; @@ -62,7 +76,7 @@ public Optional getEnvironmentId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -70,7 +84,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -79,6 +93,11 @@ public Optional getQ() { return q; } + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -92,15 +111,18 @@ public Map getAdditionalProperties() { private boolean equalTo(CountAuditLogsParams other) { return actorType.equals(other.actorType) + && endTime.equals(other.endTime) && environmentId.equals(other.environmentId) && limit.equals(other.limit) && offset.equals(other.offset) - && q.equals(other.q); + && q.equals(other.q) + && startTime.equals(other.startTime); } @java.lang.Override public int hashCode() { - return Objects.hash(this.actorType, this.environmentId, this.limit, this.offset, this.q); + return Objects.hash( + this.actorType, this.endTime, this.environmentId, this.limit, this.offset, this.q, this.startTime); } @java.lang.Override @@ -116,14 +138,18 @@ public static Builder builder() { public static final class Builder { private Optional actorType = Optional.empty(); + private Optional endTime = Optional.empty(); + private Optional environmentId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); + private Optional startTime = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -131,10 +157,12 @@ private Builder() {} public Builder from(CountAuditLogsParams other) { actorType(other.getActorType()); + endTime(other.getEndTime()); environmentId(other.getEnvironmentId()); limit(other.getLimit()); offset(other.getOffset()); q(other.getQ()); + startTime(other.getStartTime()); return this; } @@ -149,6 +177,17 @@ public Builder actorType(ActorType actorType) { 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 = "environment_id", nulls = Nulls.SKIP) public Builder environmentId(Optional environmentId) { this.environmentId = environmentId; @@ -164,12 +203,12 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -199,8 +238,30 @@ public Builder q(String q) { 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 CountAuditLogsParams build() { - return new CountAuditLogsParams(actorType, environmentId, limit, offset, q, additionalProperties); + return new CountAuditLogsParams( + actorType, endTime, environmentId, limit, offset, q, startTime, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java index 719a9a1..2e05a86 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/CountAuditLogsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountAuditLogsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountAuditLogsParams params) { public CountAuditLogsResponse build() { return new CountAuditLogsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java index 2ea77c1..2bb7638 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/CreateApiKeyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateApiKeyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateApiKeyResponse build() { return new CreateApiKeyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java index 3a2fb8b..4443730 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/CreateEnvironmentResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { CreateEnvironmentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public CreateEnvironmentResponse build() { return new CreateEnvironmentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java index fcf304d..f7a372b 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/DeleteApiKeyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteApiKeyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteApiKeyResponse build() { return new DeleteApiKeyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java index d6605c2..df5528f 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/DeleteEnvironmentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteEnvironmentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteEnvironmentResponse build() { return new DeleteEnvironmentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/GetApiKeyResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetApiKeyResponse.java index 931d51d..fa60d07 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/GetApiKeyResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetApiKeyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetApiKeyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetApiKeyResponse build() { return new GetApiKeyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java index 23982de..a568c09 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetAuditLogResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetAuditLogResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetAuditLogResponse build() { return new GetAuditLogResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/GetEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetEnvironmentResponse.java index eac3b9f..0dfc939 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/GetEnvironmentResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetEnvironmentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetEnvironmentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetEnvironmentResponse build() { return new GetEnvironmentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/GetApiRequestResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/GetWhoAmIResponse.java similarity index 72% rename from src/main/java/com/schematic/api/resources/accounts/types/GetApiRequestResponse.java rename to src/main/java/com/schematic/api/resources/accounts/types/GetWhoAmIResponse.java index 64ae918..bf40b71 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/GetApiRequestResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/GetWhoAmIResponse.java @@ -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.ApiKeyRequestResponseData; +import com.schematic.api.types.WhoAmIResponseData; 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 = GetApiRequestResponse.Builder.class) -public final class GetApiRequestResponse { - private final ApiKeyRequestResponseData data; +@JsonDeserialize(builder = GetWhoAmIResponse.Builder.class) +public final class GetWhoAmIResponse { + private final WhoAmIResponseData data; private final Map params; private final Map additionalProperties; - private GetApiRequestResponse( - ApiKeyRequestResponseData data, Map params, Map additionalProperties) { + private GetWhoAmIResponse( + WhoAmIResponseData data, Map params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; } @JsonProperty("data") - public ApiKeyRequestResponseData getData() { + public WhoAmIResponseData 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 GetApiRequestResponse && equalTo((GetApiRequestResponse) other); + return other instanceof GetWhoAmIResponse && equalTo((GetWhoAmIResponse) other); } @JsonAnyGetter @@ -60,7 +60,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(GetApiRequestResponse other) { + private boolean equalTo(GetWhoAmIResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -79,13 +79,17 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull ApiKeyRequestResponseData data); + _FinalStage data(@NotNull WhoAmIResponseData data); - Builder from(GetApiRequestResponse other); + Builder from(GetWhoAmIResponse other); } public interface _FinalStage { - GetApiRequestResponse build(); + GetWhoAmIResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); /** *

Input parameters

@@ -99,7 +103,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, _FinalStage { - private ApiKeyRequestResponseData data; + private WhoAmIResponseData data; private Map params = new LinkedHashMap<>(); @@ -109,7 +113,7 @@ public static final class Builder implements DataStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(GetApiRequestResponse other) { + public Builder from(GetWhoAmIResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -117,7 +121,7 @@ public Builder from(GetApiRequestResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull ApiKeyRequestResponseData data) { + public _FinalStage data(@NotNull WhoAmIResponseData data) { this.data = Objects.requireNonNull(data, "data must not be null"); return this; } @@ -158,8 +162,20 @@ public _FinalStage params(Map params) { } @java.lang.Override - public GetApiRequestResponse build() { - return new GetApiRequestResponse(data, params, additionalProperties); + public GetWhoAmIResponse build() { + return new GetWhoAmIResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysParams.java b/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysParams.java index 9a6ee79..df2bd65 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysParams.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysParams.java @@ -22,9 +22,9 @@ public final class ListApiKeysParams { private final Optional environmentId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional requireEnvironment; @@ -32,8 +32,8 @@ public final class ListApiKeysParams { private ListApiKeysParams( Optional environmentId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional requireEnvironment, Map additionalProperties) { this.environmentId = environmentId; @@ -52,7 +52,7 @@ public Optional getEnvironmentId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional environmentId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional requireEnvironment = Optional.empty(); @@ -139,12 +139,12 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder requireEnvironment(Boolean requireEnvironment) { public ListApiKeysParams build() { return new ListApiKeysParams(environmentId, limit, offset, requireEnvironment, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysResponse.java index 2cc3051..e4de72a 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListApiKeysResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListApiKeysResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(ApiKeyResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListApiKeysResponse build() { return new ListApiKeysResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java index 2d7380e..acf0850 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsParams.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; import com.schematic.api.types.ActorType; +import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -23,28 +24,36 @@ public final class ListAuditLogsParams { private final Optional actorType; + private final Optional endTime; + private final Optional environmentId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; + private final Optional startTime; + private final Map additionalProperties; private ListAuditLogsParams( Optional actorType, + Optional endTime, Optional environmentId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, + Optional startTime, Map additionalProperties) { this.actorType = actorType; + this.endTime = endTime; this.environmentId = environmentId; this.limit = limit; this.offset = offset; this.q = q; + this.startTime = startTime; this.additionalProperties = additionalProperties; } @@ -53,6 +62,11 @@ public Optional getActorType() { return actorType; } + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + @JsonProperty("environment_id") public Optional getEnvironmentId() { return environmentId; @@ -62,7 +76,7 @@ public Optional getEnvironmentId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -70,7 +84,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -79,6 +93,11 @@ public Optional getQ() { return q; } + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -92,15 +111,18 @@ public Map getAdditionalProperties() { private boolean equalTo(ListAuditLogsParams other) { return actorType.equals(other.actorType) + && endTime.equals(other.endTime) && environmentId.equals(other.environmentId) && limit.equals(other.limit) && offset.equals(other.offset) - && q.equals(other.q); + && q.equals(other.q) + && startTime.equals(other.startTime); } @java.lang.Override public int hashCode() { - return Objects.hash(this.actorType, this.environmentId, this.limit, this.offset, this.q); + return Objects.hash( + this.actorType, this.endTime, this.environmentId, this.limit, this.offset, this.q, this.startTime); } @java.lang.Override @@ -116,14 +138,18 @@ public static Builder builder() { public static final class Builder { private Optional actorType = Optional.empty(); + private Optional endTime = Optional.empty(); + private Optional environmentId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); + private Optional startTime = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -131,10 +157,12 @@ private Builder() {} public Builder from(ListAuditLogsParams other) { actorType(other.getActorType()); + endTime(other.getEndTime()); environmentId(other.getEnvironmentId()); limit(other.getLimit()); offset(other.getOffset()); q(other.getQ()); + startTime(other.getStartTime()); return this; } @@ -149,6 +177,17 @@ public Builder actorType(ActorType actorType) { 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 = "environment_id", nulls = Nulls.SKIP) public Builder environmentId(Optional environmentId) { this.environmentId = environmentId; @@ -164,12 +203,12 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -199,8 +238,30 @@ public Builder q(String q) { 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 ListAuditLogsParams build() { - return new ListAuditLogsParams(actorType, environmentId, limit, offset, q, additionalProperties); + return new ListAuditLogsParams( + actorType, endTime, environmentId, limit, offset, q, startTime, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java index da1c515..996fba9 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListAuditLogsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListAuditLogsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(AuditLogListResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListAuditLogsResponse build() { return new ListAuditLogsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsParams.java b/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsParams.java index 12cf49c..3625bb2 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsParams.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsParams.java @@ -23,16 +23,16 @@ public final class ListEnvironmentsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListEnvironmentsParams( Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.limit = limit; @@ -49,7 +49,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -57,7 +57,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -94,9 +94,9 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -125,12 +125,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -152,5 +152,15 @@ public Builder offset(Integer offset) { public ListEnvironmentsParams build() { return new ListEnvironmentsParams(ids, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsResponse.java index c016816..c2aeb87 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/ListEnvironmentsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListEnvironmentsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(EnvironmentResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListEnvironmentsResponse build() { return new ListEnvironmentsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/QuickstartResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/QuickstartResponse.java index 3faae64..fee300d 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/QuickstartResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/QuickstartResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { QuickstartResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public QuickstartResponse build() { return new QuickstartResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java index cb6e1fa..52ad878 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/UpdateApiKeyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateApiKeyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateApiKeyResponse build() { return new UpdateApiKeyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java b/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java index 52444d0..30d6467 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java +++ b/src/main/java/com/schematic/api/resources/accounts/types/UpdateEnvironmentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateEnvironmentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateEnvironmentResponse build() { return new UpdateEnvironmentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java b/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java index df85784..7dbe364 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncBillingClient.java @@ -66,6 +66,10 @@ public CompletableFuture listCoupons() { return this.rawClient.listCoupons().thenApply(response -> response.body()); } + public CompletableFuture listCoupons(RequestOptions requestOptions) { + return this.rawClient.listCoupons(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCoupons(ListCouponsRequest request) { return this.rawClient.listCoupons(request).thenApply(response -> response.body()); } @@ -98,6 +102,11 @@ public CompletableFuture listCustomersWi return this.rawClient.listCustomersWithSubscriptions().thenApply(response -> response.body()); } + public CompletableFuture listCustomersWithSubscriptions( + RequestOptions requestOptions) { + return this.rawClient.listCustomersWithSubscriptions(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCustomersWithSubscriptions( ListCustomersWithSubscriptionsRequest request) { return this.rawClient.listCustomersWithSubscriptions(request).thenApply(response -> response.body()); @@ -114,6 +123,10 @@ public CompletableFuture countCustomers() { return this.rawClient.countCustomers().thenApply(response -> response.body()); } + public CompletableFuture countCustomers(RequestOptions requestOptions) { + return this.rawClient.countCustomers(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countCustomers(CountCustomersRequest request) { return this.rawClient.countCustomers(request).thenApply(response -> response.body()); } @@ -145,6 +158,10 @@ public CompletableFuture listMeters() { return this.rawClient.listMeters().thenApply(response -> response.body()); } + public CompletableFuture listMeters(RequestOptions requestOptions) { + return this.rawClient.listMeters(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listMeters(ListMetersRequest request) { return this.rawClient.listMeters(request).thenApply(response -> response.body()); } @@ -184,6 +201,10 @@ public CompletableFuture listBillingPrices() { return this.rawClient.listBillingPrices().thenApply(response -> response.body()); } + public CompletableFuture listBillingPrices(RequestOptions requestOptions) { + return this.rawClient.listBillingPrices(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listBillingPrices(ListBillingPricesRequest request) { return this.rawClient.listBillingPrices(request).thenApply(response -> response.body()); } @@ -215,6 +236,10 @@ public CompletableFuture listBillingProductPri return this.rawClient.listBillingProductPrices().thenApply(response -> response.body()); } + public CompletableFuture listBillingProductPrices(RequestOptions requestOptions) { + return this.rawClient.listBillingProductPrices(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listBillingProductPrices( ListBillingProductPricesRequest request) { return this.rawClient.listBillingProductPrices(request).thenApply(response -> response.body()); @@ -248,6 +273,10 @@ public CompletableFuture listBillingProducts() { return this.rawClient.listBillingProducts().thenApply(response -> response.body()); } + public CompletableFuture listBillingProducts(RequestOptions requestOptions) { + return this.rawClient.listBillingProducts(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listBillingProducts(ListBillingProductsRequest request) { return this.rawClient.listBillingProducts(request).thenApply(response -> response.body()); } @@ -261,6 +290,10 @@ public CompletableFuture countBillingProducts() { return this.rawClient.countBillingProducts().thenApply(response -> response.body()); } + public CompletableFuture countBillingProducts(RequestOptions requestOptions) { + return this.rawClient.countBillingProducts(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countBillingProducts(CountBillingProductsRequest request) { return this.rawClient.countBillingProducts(request).thenApply(response -> response.body()); } 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 44cda57..2dff4bb 100644 --- a/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/AsyncRawBillingClient.java @@ -80,6 +80,11 @@ public CompletableFuture> listCou return listCoupons(ListCouponsRequest.builder().build()); } + public CompletableFuture> listCoupons( + RequestOptions requestOptions) { + return listCoupons(ListCouponsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCoupons(ListCouponsRequest request) { return listCoupons(request, null); } @@ -104,6 +109,11 @@ public CompletableFuture> listCou QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -119,13 +129,13 @@ public CompletableFuture> listCou @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCouponsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCouponsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -157,11 +167,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -183,10 +191,14 @@ public CompletableFuture> public CompletableFuture> upsertBillingCoupon( CreateCouponRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/coupons") - .build(); + .addPathSegments("billing/coupons"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -195,7 +207,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -210,14 +222,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingCouponResponse.class), + responseBodyString, UpsertBillingCouponResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -249,11 +261,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -275,10 +285,14 @@ public CompletableFuture> upsertBillingCustomer( CreateBillingCustomerRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/customer/upsert") - .build(); + .addPathSegments("billing/customer/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -287,7 +301,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingCustomerResponse.class), + responseBodyString, UpsertBillingCustomerResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -341,11 +355,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -366,6 +378,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { ListCustomersWithSubscriptionsRequest.builder().build()); } + public CompletableFuture> + listCustomersWithSubscriptions(RequestOptions requestOptions) { + return listCustomersWithSubscriptions( + ListCustomersWithSubscriptionsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCustomersWithSubscriptions(ListCustomersWithSubscriptionsRequest request) { return listCustomersWithSubscriptions(request, null); @@ -400,6 +418,11 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -416,14 +439,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCustomersWithSubscriptionsResponse.class), + responseBodyString, ListCustomersWithSubscriptionsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -455,11 +478,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -478,6 +499,11 @@ public CompletableFuture> coun return countCustomers(CountCustomersRequest.builder().build()); } + public CompletableFuture> countCustomers( + RequestOptions requestOptions) { + return countCustomers(CountCustomersRequest.builder().build(), requestOptions); + } + public CompletableFuture> countCustomers( CountCustomersRequest request) { return countCustomers(request, null); @@ -511,6 +537,11 @@ public CompletableFuture> coun QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -526,14 +557,13 @@ public CompletableFuture> coun @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountCustomersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCustomersResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -565,11 +595,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -609,6 +637,11 @@ public CompletableFuture> listIn QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -624,13 +657,13 @@ public CompletableFuture> listIn @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListInvoicesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListInvoicesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -662,11 +695,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -688,10 +719,14 @@ public CompletableFuture> upser public CompletableFuture> upsertInvoice( CreateInvoiceRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/invoices") - .build(); + .addPathSegments("billing/invoices"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -700,7 +735,7 @@ public CompletableFuture> upser throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -715,13 +750,13 @@ public CompletableFuture> upser @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertInvoiceResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertInvoiceResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -753,11 +788,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -776,6 +809,10 @@ public CompletableFuture> listMete return listMeters(ListMetersRequest.builder().build()); } + public CompletableFuture> listMeters(RequestOptions requestOptions) { + return listMeters(ListMetersRequest.builder().build(), requestOptions); + } + public CompletableFuture> listMeters(ListMetersRequest request) { return listMeters(request, null); } @@ -797,6 +834,11 @@ public CompletableFuture> listMete QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -812,13 +854,13 @@ public CompletableFuture> listMete @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListMetersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMetersResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -850,11 +892,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -876,10 +916,14 @@ public CompletableFuture> public CompletableFuture> upsertBillingMeter( CreateMeterRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/meter/upsert") - .build(); + .addPathSegments("billing/meter/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -888,7 +932,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -903,14 +947,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingMeterResponse.class), + responseBodyString, UpsertBillingMeterResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -942,11 +986,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -984,6 +1026,11 @@ public CompletableFuture> QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -999,14 +1046,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListPaymentMethodsResponse.class), + responseBodyString, ListPaymentMethodsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1038,11 +1085,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1064,10 +1109,14 @@ public CompletableFuture> public CompletableFuture> upsertPaymentMethod( CreatePaymentMethodRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/payment-methods") - .build(); + .addPathSegments("billing/payment-methods"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1076,7 +1125,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1091,14 +1140,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertPaymentMethodResponse.class), + responseBodyString, UpsertPaymentMethodResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1130,11 +1179,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1153,6 +1200,11 @@ public CompletableFuture> l return listBillingPrices(ListBillingPricesRequest.builder().build()); } + public CompletableFuture> listBillingPrices( + RequestOptions requestOptions) { + return listBillingPrices(ListBillingPricesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listBillingPrices( ListBillingPricesRequest request) { return listBillingPrices(request, null); @@ -1163,6 +1215,10 @@ public CompletableFuture> l HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/price"); + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } if (request.getForInitialPlan().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "for_initial_plan", request.getForInitialPlan().get(), false); @@ -1224,6 +1280,11 @@ public CompletableFuture> l QueryStringMapper.addQueryParameter( httpUrl, "product_ids", request.getProductIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1239,14 +1300,14 @@ public CompletableFuture> l @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingPricesResponse.class), + responseBodyString, ListBillingPricesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1278,11 +1339,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1304,10 +1363,14 @@ public CompletableFuture> public CompletableFuture> upsertBillingPrice( CreateBillingPriceRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/price/upsert") - .build(); + .addPathSegments("billing/price/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1316,7 +1379,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1331,14 +1394,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingPriceResponse.class), + responseBodyString, UpsertBillingPriceResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1370,11 +1433,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1396,13 +1457,17 @@ public CompletableFuture public CompletableFuture> deleteBillingProduct( String billingId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product") - .addPathSegment(billingId) - .build(); + .addPathSegment(billingId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1416,14 +1481,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteBillingProductResponse.class), + responseBodyString, DeleteBillingProductResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1455,11 +1520,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1479,6 +1542,12 @@ public CompletableFuture> listBillingProductPrices( + RequestOptions requestOptions) { + return listBillingProductPrices( + ListBillingProductPricesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listBillingProductPrices( ListBillingProductPricesRequest request) { return listBillingProductPrices(request, null); @@ -1489,6 +1558,10 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1566,14 +1644,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingProductPricesResponse.class), + responseBodyString, ListBillingProductPricesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1605,11 +1683,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1631,13 +1707,17 @@ public CompletableFuture> public CompletableFuture> deleteProductPrice( String billingId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices") - .addPathSegment(billingId) - .build(); + .addPathSegment(billingId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1651,14 +1731,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteProductPriceResponse.class), + responseBodyString, DeleteProductPriceResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1690,11 +1770,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1716,10 +1794,14 @@ public CompletableFuture public CompletableFuture> upsertBillingProduct( CreateBillingProductRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/product/upsert") - .build(); + .addPathSegments("billing/product/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1728,7 +1810,7 @@ public CompletableFuture throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1743,14 +1825,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingProductResponse.class), + responseBodyString, UpsertBillingProductResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1782,11 +1864,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1805,6 +1885,11 @@ public CompletableFuture> return listBillingProducts(ListBillingProductsRequest.builder().build()); } + public CompletableFuture> listBillingProducts( + RequestOptions requestOptions) { + return listBillingProducts(ListBillingProductsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listBillingProducts( ListBillingProductsRequest request) { return listBillingProducts(request, null); @@ -1867,6 +1952,11 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1882,14 +1972,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingProductsResponse.class), + responseBodyString, ListBillingProductsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1921,11 +2011,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1944,6 +2032,11 @@ public CompletableFuture return countBillingProducts(CountBillingProductsRequest.builder().build()); } + public CompletableFuture> countBillingProducts( + RequestOptions requestOptions) { + return countBillingProducts(CountBillingProductsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countBillingProducts( CountBillingProductsRequest request) { return countBillingProducts(request, null); @@ -2006,6 +2099,11 @@ public CompletableFuture if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2021,14 +2119,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountBillingProductsResponse.class), + responseBodyString, CountBillingProductsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2060,11 +2158,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2086,10 +2182,14 @@ public CompletableFuture> upsertBillingSubscription( CreateBillingSubscriptionRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/subscription/upsert") - .build(); + .addPathSegments("billing/subscription/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2098,7 +2198,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingSubscriptionResponse.class), + responseBodyString, UpsertBillingSubscriptionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2153,11 +2253,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 e65d999..911e983 100644 --- a/src/main/java/com/schematic/api/resources/billing/BillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/BillingClient.java @@ -65,6 +65,10 @@ public ListCouponsResponse listCoupons() { return this.rawClient.listCoupons().body(); } + public ListCouponsResponse listCoupons(RequestOptions requestOptions) { + return this.rawClient.listCoupons(requestOptions).body(); + } + public ListCouponsResponse listCoupons(ListCouponsRequest request) { return this.rawClient.listCoupons(request).body(); } @@ -95,6 +99,10 @@ public ListCustomersWithSubscriptionsResponse listCustomersWithSubscriptions() { return this.rawClient.listCustomersWithSubscriptions().body(); } + public ListCustomersWithSubscriptionsResponse listCustomersWithSubscriptions(RequestOptions requestOptions) { + return this.rawClient.listCustomersWithSubscriptions(requestOptions).body(); + } + public ListCustomersWithSubscriptionsResponse listCustomersWithSubscriptions( ListCustomersWithSubscriptionsRequest request) { return this.rawClient.listCustomersWithSubscriptions(request).body(); @@ -111,6 +119,10 @@ public CountCustomersResponse countCustomers() { return this.rawClient.countCustomers().body(); } + public CountCustomersResponse countCustomers(RequestOptions requestOptions) { + return this.rawClient.countCustomers(requestOptions).body(); + } + public CountCustomersResponse countCustomers(CountCustomersRequest request) { return this.rawClient.countCustomers(request).body(); } @@ -139,6 +151,10 @@ public ListMetersResponse listMeters() { return this.rawClient.listMeters().body(); } + public ListMetersResponse listMeters(RequestOptions requestOptions) { + return this.rawClient.listMeters(requestOptions).body(); + } + public ListMetersResponse listMeters(ListMetersRequest request) { return this.rawClient.listMeters(request).body(); } @@ -178,6 +194,10 @@ public ListBillingPricesResponse listBillingPrices() { return this.rawClient.listBillingPrices().body(); } + public ListBillingPricesResponse listBillingPrices(RequestOptions requestOptions) { + return this.rawClient.listBillingPrices(requestOptions).body(); + } + public ListBillingPricesResponse listBillingPrices(ListBillingPricesRequest request) { return this.rawClient.listBillingPrices(request).body(); } @@ -208,6 +228,10 @@ public ListBillingProductPricesResponse listBillingProductPrices() { return this.rawClient.listBillingProductPrices().body(); } + public ListBillingProductPricesResponse listBillingProductPrices(RequestOptions requestOptions) { + return this.rawClient.listBillingProductPrices(requestOptions).body(); + } + public ListBillingProductPricesResponse listBillingProductPrices(ListBillingProductPricesRequest request) { return this.rawClient.listBillingProductPrices(request).body(); } @@ -238,6 +262,10 @@ public ListBillingProductsResponse listBillingProducts() { return this.rawClient.listBillingProducts().body(); } + public ListBillingProductsResponse listBillingProducts(RequestOptions requestOptions) { + return this.rawClient.listBillingProducts(requestOptions).body(); + } + public ListBillingProductsResponse listBillingProducts(ListBillingProductsRequest request) { return this.rawClient.listBillingProducts(request).body(); } @@ -251,6 +279,10 @@ public CountBillingProductsResponse countBillingProducts() { return this.rawClient.countBillingProducts().body(); } + public CountBillingProductsResponse countBillingProducts(RequestOptions requestOptions) { + return this.rawClient.countBillingProducts(requestOptions).body(); + } + public CountBillingProductsResponse countBillingProducts(CountBillingProductsRequest request) { return this.rawClient.countBillingProducts(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java b/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java index 52a949f..6dfbcc7 100644 --- a/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java +++ b/src/main/java/com/schematic/api/resources/billing/RawBillingClient.java @@ -76,6 +76,10 @@ public BaseSchematicHttpResponse listCoupons() { return listCoupons(ListCouponsRequest.builder().build()); } + public BaseSchematicHttpResponse listCoupons(RequestOptions requestOptions) { + return listCoupons(ListCouponsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCoupons(ListCouponsRequest request) { return listCoupons(request, null); } @@ -100,6 +104,11 @@ public BaseSchematicHttpResponse listCoupons( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -112,12 +121,11 @@ public BaseSchematicHttpResponse listCoupons( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCouponsResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCouponsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -139,11 +147,9 @@ public BaseSchematicHttpResponse listCoupons( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -155,10 +161,14 @@ public BaseSchematicHttpResponse upsertBillingCoupo public BaseSchematicHttpResponse upsertBillingCoupon( CreateCouponRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/coupons") - .build(); + .addPathSegments("billing/coupons"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -167,7 +177,7 @@ public BaseSchematicHttpResponse upsertBillingCoupo throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -179,12 +189,12 @@ public BaseSchematicHttpResponse upsertBillingCoupo } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertBillingCouponResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertBillingCouponResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -206,11 +216,9 @@ public BaseSchematicHttpResponse upsertBillingCoupo } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -223,10 +231,14 @@ public BaseSchematicHttpResponse upsertBillingCus public BaseSchematicHttpResponse upsertBillingCustomer( CreateBillingCustomerRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/customer/upsert") - .build(); + .addPathSegments("billing/customer/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -235,7 +247,7 @@ public BaseSchematicHttpResponse upsertBillingCus throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -247,12 +259,12 @@ public BaseSchematicHttpResponse upsertBillingCus } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertBillingCustomerResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertBillingCustomerResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -274,11 +286,9 @@ public BaseSchematicHttpResponse upsertBillingCus } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -289,6 +299,12 @@ public BaseSchematicHttpResponse listCus ListCustomersWithSubscriptionsRequest.builder().build()); } + public BaseSchematicHttpResponse listCustomersWithSubscriptions( + RequestOptions requestOptions) { + return listCustomersWithSubscriptions( + ListCustomersWithSubscriptionsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCustomersWithSubscriptions( ListCustomersWithSubscriptionsRequest request) { return listCustomersWithSubscriptions(request, null); @@ -322,6 +338,11 @@ public BaseSchematicHttpResponse listCus QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -334,13 +355,13 @@ public BaseSchematicHttpResponse listCus } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCustomersWithSubscriptionsResponse.class), + responseBodyString, ListCustomersWithSubscriptionsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -362,11 +383,9 @@ public BaseSchematicHttpResponse listCus } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -376,6 +395,10 @@ public BaseSchematicHttpResponse countCustomers() { return countCustomers(CountCustomersRequest.builder().build()); } + public BaseSchematicHttpResponse countCustomers(RequestOptions requestOptions) { + return countCustomers(CountCustomersRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countCustomers(CountCustomersRequest request) { return countCustomers(request, null); } @@ -408,6 +431,11 @@ public BaseSchematicHttpResponse countCustomers( QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -420,12 +448,12 @@ public BaseSchematicHttpResponse countCustomers( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountCustomersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCustomersResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -447,11 +475,9 @@ public BaseSchematicHttpResponse countCustomers( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -481,6 +507,11 @@ public BaseSchematicHttpResponse listInvoices( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -493,12 +524,11 @@ public BaseSchematicHttpResponse listInvoices( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListInvoicesResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListInvoicesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -520,11 +550,9 @@ public BaseSchematicHttpResponse listInvoices( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -536,10 +564,14 @@ public BaseSchematicHttpResponse upsertInvoice(CreateInvo public BaseSchematicHttpResponse upsertInvoice( CreateInvoiceRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/invoices") - .build(); + .addPathSegments("billing/invoices"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -548,7 +580,7 @@ public BaseSchematicHttpResponse upsertInvoice( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -560,12 +592,11 @@ public BaseSchematicHttpResponse upsertInvoice( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertInvoiceResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertInvoiceResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -587,11 +618,9 @@ public BaseSchematicHttpResponse upsertInvoice( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -601,6 +630,10 @@ public BaseSchematicHttpResponse listMeters() { return listMeters(ListMetersRequest.builder().build()); } + public BaseSchematicHttpResponse listMeters(RequestOptions requestOptions) { + return listMeters(ListMetersRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listMeters(ListMetersRequest request) { return listMeters(request, null); } @@ -622,6 +655,11 @@ public BaseSchematicHttpResponse listMeters( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -634,11 +672,11 @@ public BaseSchematicHttpResponse listMeters( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListMetersResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMetersResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -660,11 +698,9 @@ public BaseSchematicHttpResponse listMeters( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -676,10 +712,14 @@ public BaseSchematicHttpResponse upsertBillingMeter( public BaseSchematicHttpResponse upsertBillingMeter( CreateMeterRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/meter/upsert") - .build(); + .addPathSegments("billing/meter/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -688,7 +728,7 @@ public BaseSchematicHttpResponse upsertBillingMeter( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -700,12 +740,12 @@ public BaseSchematicHttpResponse upsertBillingMeter( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertBillingMeterResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertBillingMeterResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -727,11 +767,9 @@ public BaseSchematicHttpResponse upsertBillingMeter( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -759,6 +797,11 @@ public BaseSchematicHttpResponse listPaymentMethods( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -771,12 +814,12 @@ public BaseSchematicHttpResponse listPaymentMethods( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPaymentMethodsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPaymentMethodsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -798,11 +841,9 @@ public BaseSchematicHttpResponse listPaymentMethods( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -815,10 +856,14 @@ public BaseSchematicHttpResponse upsertPaymentMetho public BaseSchematicHttpResponse upsertPaymentMethod( CreatePaymentMethodRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/payment-methods") - .build(); + .addPathSegments("billing/payment-methods"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -827,7 +872,7 @@ public BaseSchematicHttpResponse upsertPaymentMetho throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -839,12 +884,12 @@ public BaseSchematicHttpResponse upsertPaymentMetho } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertPaymentMethodResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertPaymentMethodResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -866,11 +911,9 @@ public BaseSchematicHttpResponse upsertPaymentMetho } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -880,6 +923,10 @@ public BaseSchematicHttpResponse listBillingPrices() return listBillingPrices(ListBillingPricesRequest.builder().build()); } + public BaseSchematicHttpResponse listBillingPrices(RequestOptions requestOptions) { + return listBillingPrices(ListBillingPricesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listBillingPrices(ListBillingPricesRequest request) { return listBillingPrices(request, null); } @@ -889,6 +936,10 @@ public BaseSchematicHttpResponse listBillingPrices( HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/price"); + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } if (request.getForInitialPlan().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "for_initial_plan", request.getForInitialPlan().get(), false); @@ -950,6 +1001,11 @@ public BaseSchematicHttpResponse listBillingPrices( QueryStringMapper.addQueryParameter( httpUrl, "product_ids", request.getProductIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -962,12 +1018,12 @@ public BaseSchematicHttpResponse listBillingPrices( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListBillingPricesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBillingPricesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -989,11 +1045,9 @@ public BaseSchematicHttpResponse listBillingPrices( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1006,10 +1060,14 @@ public BaseSchematicHttpResponse upsertBillingPrice( public BaseSchematicHttpResponse upsertBillingPrice( CreateBillingPriceRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/price/upsert") - .build(); + .addPathSegments("billing/price/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1018,7 +1076,7 @@ public BaseSchematicHttpResponse upsertBillingPrice( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1030,12 +1088,12 @@ public BaseSchematicHttpResponse upsertBillingPrice( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertBillingPriceResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertBillingPriceResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1057,11 +1115,9 @@ public BaseSchematicHttpResponse upsertBillingPrice( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1073,13 +1129,17 @@ public BaseSchematicHttpResponse deleteBillingProd public BaseSchematicHttpResponse deleteBillingProduct( String billingId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product") - .addPathSegment(billingId) - .build(); + .addPathSegment(billingId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1090,12 +1150,12 @@ public BaseSchematicHttpResponse deleteBillingProd } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteBillingProductResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteBillingProductResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1117,11 +1177,9 @@ public BaseSchematicHttpResponse deleteBillingProd } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1132,6 +1190,12 @@ public BaseSchematicHttpResponse listBillingPr ListBillingProductPricesRequest.builder().build()); } + public BaseSchematicHttpResponse listBillingProductPrices( + RequestOptions requestOptions) { + return listBillingProductPrices( + ListBillingProductPricesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listBillingProductPrices( ListBillingProductPricesRequest request) { return listBillingProductPrices(request, null); @@ -1142,6 +1206,10 @@ public BaseSchematicHttpResponse listBillingPr HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices"); + if (request.getCurrency().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "currency", request.getCurrency().get(), false); + } if (request.getForInitialPlan().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "for_initial_plan", request.getForInitialPlan().get(), false); @@ -1203,6 +1271,11 @@ public BaseSchematicHttpResponse listBillingPr QueryStringMapper.addQueryParameter( httpUrl, "product_ids", request.getProductIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1215,13 +1288,12 @@ public BaseSchematicHttpResponse listBillingPr } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingProductPricesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBillingProductPricesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1243,11 +1315,9 @@ public BaseSchematicHttpResponse listBillingPr } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1259,13 +1329,17 @@ public BaseSchematicHttpResponse deleteProductPrice( public BaseSchematicHttpResponse deleteProductPrice( String billingId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/product/prices") - .addPathSegment(billingId) - .build(); + .addPathSegment(billingId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1276,12 +1350,12 @@ public BaseSchematicHttpResponse deleteProductPrice( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteProductPriceResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProductPriceResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1303,11 +1377,9 @@ public BaseSchematicHttpResponse deleteProductPrice( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1320,10 +1392,14 @@ public BaseSchematicHttpResponse upsertBillingProd public BaseSchematicHttpResponse upsertBillingProduct( CreateBillingProductRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/product/upsert") - .build(); + .addPathSegments("billing/product/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1332,7 +1408,7 @@ public BaseSchematicHttpResponse upsertBillingProd throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1344,12 +1420,12 @@ public BaseSchematicHttpResponse upsertBillingProd } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertBillingProductResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertBillingProductResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1371,11 +1447,9 @@ public BaseSchematicHttpResponse upsertBillingProd } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1385,6 +1459,10 @@ public BaseSchematicHttpResponse listBillingProduct return listBillingProducts(ListBillingProductsRequest.builder().build()); } + public BaseSchematicHttpResponse listBillingProducts(RequestOptions requestOptions) { + return listBillingProducts(ListBillingProductsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listBillingProducts( ListBillingProductsRequest request) { return listBillingProducts(request, null); @@ -1447,6 +1525,11 @@ public BaseSchematicHttpResponse listBillingProduct if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1459,12 +1542,12 @@ public BaseSchematicHttpResponse listBillingProduct } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListBillingProductsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBillingProductsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1486,11 +1569,9 @@ public BaseSchematicHttpResponse listBillingProduct } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1500,6 +1581,10 @@ public BaseSchematicHttpResponse countBillingProdu return countBillingProducts(CountBillingProductsRequest.builder().build()); } + public BaseSchematicHttpResponse countBillingProducts(RequestOptions requestOptions) { + return countBillingProducts(CountBillingProductsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countBillingProducts( CountBillingProductsRequest request) { return countBillingProducts(request, null); @@ -1562,6 +1647,11 @@ public BaseSchematicHttpResponse countBillingProdu if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1574,12 +1664,12 @@ public BaseSchematicHttpResponse countBillingProdu } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountBillingProductsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountBillingProductsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1601,11 +1691,9 @@ public BaseSchematicHttpResponse countBillingProdu } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1618,10 +1706,14 @@ public BaseSchematicHttpResponse upsertBillin public BaseSchematicHttpResponse upsertBillingSubscription( CreateBillingSubscriptionRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/subscription/upsert") - .build(); + .addPathSegments("billing/subscription/upsert"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1630,7 +1722,7 @@ public BaseSchematicHttpResponse upsertBillin throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1642,13 +1734,13 @@ public BaseSchematicHttpResponse upsertBillin } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingSubscriptionResponse.class), + responseBodyString, UpsertBillingSubscriptionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1670,11 +1762,9 @@ public BaseSchematicHttpResponse upsertBillin } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CountBillingProductsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/CountBillingProductsRequest.java index cbd5b7b..7e8550f 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 @@ -44,9 +44,9 @@ public final class CountBillingProductsRequest { private final Optional withoutLinkedToPlan; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -61,8 +61,8 @@ private CountBillingProductsRequest( Optional withPricesOnly, Optional withZeroPrice, Optional withoutLinkedToPlan, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.isActive = isActive; @@ -148,7 +148,7 @@ public Optional getWithoutLinkedToPlan() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -156,7 +156,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -234,9 +234,9 @@ public static final class Builder { private Optional withoutLinkedToPlan = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -393,12 +393,12 @@ public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -433,5 +433,15 @@ public CountBillingProductsRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CountCustomersRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/CountCustomersRequest.java index 6eb10dc..7b10283 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 @@ -31,9 +31,9 @@ public final class CountCustomersRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -42,8 +42,8 @@ private CountCustomersRequest( Optional name, Optional providerType, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.name = name; @@ -78,7 +78,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -86,7 +86,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -134,9 +134,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -206,12 +206,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -233,5 +233,15 @@ public Builder offset(Integer offset) { public CountCustomersRequest build() { return new CountCustomersRequest(companyIds, name, providerType, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingCustomerRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingCustomerRequestBody.java index 415b17f..33421b1 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 @@ -152,6 +152,10 @@ public interface NameStage { public interface _FinalStage { CreateBillingCustomerRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -300,5 +304,17 @@ public CreateBillingCustomerRequestBody build() { providerType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingPriceRequestBody.java index a9b977a..f5986b5 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 @@ -40,9 +40,9 @@ public final class CreateBillingPriceRequestBody { private final Optional meterId; - private final Optional packageSize; + private final Optional packageSize; - private final int price; + private final long price; private final Optional priceDecimal; @@ -67,8 +67,8 @@ private CreateBillingPriceRequestBody( String interval, boolean isActive, Optional meterId, - Optional packageSize, - int price, + Optional packageSize, + long price, Optional priceDecimal, String priceExternalId, List priceTiers, @@ -126,12 +126,12 @@ public Optional getMeterId() { } @JsonProperty("package_size") - public Optional getPackageSize() { + public Optional getPackageSize() { return packageSize; } @JsonProperty("price") - public int getPrice() { + public long getPrice() { return price; } @@ -251,7 +251,7 @@ public interface IsActiveStage { } public interface PriceStage { - PriceExternalIdStage price(int price); + PriceExternalIdStage price(long price); } public interface PriceExternalIdStage { @@ -269,13 +269,17 @@ public interface UsageTypeStage { public interface _FinalStage { CreateBillingPriceRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage meterId(Optional meterId); _FinalStage meterId(String meterId); - _FinalStage packageSize(Optional packageSize); + _FinalStage packageSize(Optional packageSize); - _FinalStage packageSize(Integer packageSize); + _FinalStage packageSize(Long packageSize); _FinalStage priceDecimal(Optional priceDecimal); @@ -318,7 +322,7 @@ public static final class Builder private boolean isActive; - private int price; + private long price; private String priceExternalId; @@ -334,7 +338,7 @@ public static final class Builder private Optional priceDecimal = Optional.empty(); - private Optional packageSize = Optional.empty(); + private Optional packageSize = Optional.empty(); private Optional meterId = Optional.empty(); @@ -400,7 +404,7 @@ public PriceStage isActive(boolean isActive) { @java.lang.Override @JsonSetter("price") - public PriceExternalIdStage price(int price) { + public PriceExternalIdStage price(long price) { this.price = price; return this; } @@ -490,14 +494,14 @@ public _FinalStage priceDecimal(Optional priceDecimal) { } @java.lang.Override - public _FinalStage packageSize(Integer packageSize) { + public _FinalStage packageSize(Long packageSize) { this.packageSize = Optional.ofNullable(packageSize); return this; } @java.lang.Override @JsonSetter(value = "package_size", nulls = Nulls.SKIP) - public _FinalStage packageSize(Optional packageSize) { + public _FinalStage packageSize(Optional packageSize) { this.packageSize = packageSize; return this; } @@ -535,5 +539,17 @@ public CreateBillingPriceRequestBody build() { usageType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingProductRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingProductRequestBody.java index 8ce4a0c..e437951 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 @@ -26,7 +26,7 @@ public final class CreateBillingProductRequestBody { private final Optional isActive; - private final String name; + private final Optional name; private final double price; @@ -37,7 +37,7 @@ public final class CreateBillingProductRequestBody { private CreateBillingProductRequestBody( String externalId, Optional isActive, - String name, + Optional name, double price, Optional providerType, Map additionalProperties) { @@ -60,7 +60,7 @@ public Optional getIsActive() { } @JsonProperty("name") - public String getName() { + public Optional getName() { return name; } @@ -108,15 +108,11 @@ public static ExternalIdStage builder() { } public interface ExternalIdStage { - NameStage externalId(@NotNull String externalId); + PriceStage externalId(@NotNull String externalId); Builder from(CreateBillingProductRequestBody other); } - public interface NameStage { - PriceStage name(@NotNull String name); - } - public interface PriceStage { _FinalStage price(double price); } @@ -124,25 +120,33 @@ public interface PriceStage { public interface _FinalStage { CreateBillingProductRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage isActive(Optional isActive); _FinalStage isActive(Boolean isActive); + _FinalStage name(Optional name); + + _FinalStage name(String name); + _FinalStage providerType(Optional providerType); _FinalStage providerType(BillingProviderType providerType); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ExternalIdStage, NameStage, PriceStage, _FinalStage { + public static final class Builder implements ExternalIdStage, PriceStage, _FinalStage { private String externalId; - private String name; - private double price; private Optional providerType = Optional.empty(); + private Optional name = Optional.empty(); + private Optional isActive = Optional.empty(); @JsonAnySetter @@ -162,18 +166,11 @@ public Builder from(CreateBillingProductRequestBody other) { @java.lang.Override @JsonSetter("external_id") - public NameStage externalId(@NotNull String externalId) { + public PriceStage externalId(@NotNull String externalId) { this.externalId = Objects.requireNonNull(externalId, "externalId 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 _FinalStage price(double price) { @@ -194,6 +191,19 @@ public _FinalStage providerType(Optional providerType) { 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 isActive(Boolean isActive) { this.isActive = Optional.ofNullable(isActive); @@ -212,5 +222,17 @@ public CreateBillingProductRequestBody build() { return new CreateBillingProductRequestBody( externalId, isActive, name, price, providerType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingSubscriptionRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateBillingSubscriptionRequestBody.java index 76167f9..f4b51ce 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 @@ -30,7 +30,7 @@ public final class CreateBillingSubscriptionRequestBody { private final Optional applicationId; - private final Optional cancelAt; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -50,9 +50,9 @@ public final class CreateBillingSubscriptionRequestBody { private final Optional> metadata; - private final Optional periodEnd; + private final Optional periodEnd; - private final Optional periodStart; + private final Optional periodStart; private final List productExternalIds; @@ -60,9 +60,9 @@ public final class CreateBillingSubscriptionRequestBody { private final String subscriptionExternalId; - private final int totalPrice; + private final long totalPrice; - private final Optional trialEnd; + private final Optional trialEnd; private final Optional trialEndSetting; @@ -70,7 +70,7 @@ public final class CreateBillingSubscriptionRequestBody { private CreateBillingSubscriptionRequestBody( Optional applicationId, - Optional cancelAt, + Optional cancelAt, boolean cancelAtPeriodEnd, String currency, String customerExternalId, @@ -80,13 +80,13 @@ private CreateBillingSubscriptionRequestBody( OffsetDateTime expiredAt, Optional interval, Optional> metadata, - Optional periodEnd, - Optional periodStart, + Optional periodEnd, + Optional periodStart, List productExternalIds, Optional status, String subscriptionExternalId, - int totalPrice, - Optional trialEnd, + long totalPrice, + Optional trialEnd, Optional trialEndSetting, Map additionalProperties) { this.applicationId = applicationId; @@ -117,7 +117,7 @@ public Optional getApplicationId() { } @JsonProperty("cancel_at") - public Optional getCancelAt() { + public Optional getCancelAt() { return cancelAt; } @@ -167,12 +167,12 @@ public Optional> getMetadata() { } @JsonProperty("period_end") - public Optional getPeriodEnd() { + public Optional getPeriodEnd() { return periodEnd; } @JsonProperty("period_start") - public Optional getPeriodStart() { + public Optional getPeriodStart() { return periodStart; } @@ -192,12 +192,12 @@ public String getSubscriptionExternalId() { } @JsonProperty("total_price") - public int getTotalPrice() { + public long getTotalPrice() { return totalPrice; } @JsonProperty("trial_end") - public Optional getTrialEnd() { + public Optional getTrialEnd() { return trialEnd; } @@ -296,19 +296,23 @@ public interface SubscriptionExternalIdStage { } public interface TotalPriceStage { - _FinalStage totalPrice(int totalPrice); + _FinalStage totalPrice(long totalPrice); } public interface _FinalStage { CreateBillingSubscriptionRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage applicationId(Optional applicationId); _FinalStage applicationId(String applicationId); - _FinalStage cancelAt(Optional cancelAt); + _FinalStage cancelAt(Optional cancelAt); - _FinalStage cancelAt(Integer cancelAt); + _FinalStage cancelAt(Long cancelAt); _FinalStage defaultPaymentMethodExternalId(Optional defaultPaymentMethodExternalId); @@ -332,13 +336,13 @@ public interface _FinalStage { _FinalStage metadata(Map metadata); - _FinalStage periodEnd(Optional periodEnd); + _FinalStage periodEnd(Optional periodEnd); - _FinalStage periodEnd(Integer periodEnd); + _FinalStage periodEnd(Long periodEnd); - _FinalStage periodStart(Optional periodStart); + _FinalStage periodStart(Optional periodStart); - _FinalStage periodStart(Integer periodStart); + _FinalStage periodStart(Long periodStart); _FinalStage productExternalIds(List productExternalIds); @@ -350,9 +354,9 @@ public interface _FinalStage { _FinalStage status(String status); - _FinalStage trialEnd(Optional trialEnd); + _FinalStage trialEnd(Optional trialEnd); - _FinalStage trialEnd(Integer trialEnd); + _FinalStage trialEnd(Long trialEnd); _FinalStage trialEndSetting(Optional trialEndSetting); @@ -378,19 +382,19 @@ public static final class Builder private String subscriptionExternalId; - private int totalPrice; + private long totalPrice; private Optional trialEndSetting = Optional.empty(); - private Optional trialEnd = Optional.empty(); + private Optional trialEnd = Optional.empty(); private Optional status = Optional.empty(); private List productExternalIds = new ArrayList<>(); - private Optional periodStart = Optional.empty(); + private Optional periodStart = Optional.empty(); - private Optional periodEnd = Optional.empty(); + private Optional periodEnd = Optional.empty(); private Optional> metadata = Optional.empty(); @@ -402,7 +406,7 @@ public static final class Builder private Optional defaultPaymentMethodExternalId = Optional.empty(); - private Optional cancelAt = Optional.empty(); + private Optional cancelAt = Optional.empty(); private Optional applicationId = Optional.empty(); @@ -473,7 +477,7 @@ public TotalPriceStage subscriptionExternalId(@NotNull String subscriptionExtern @java.lang.Override @JsonSetter("total_price") - public _FinalStage totalPrice(int totalPrice) { + public _FinalStage totalPrice(long totalPrice) { this.totalPrice = totalPrice; return this; } @@ -492,14 +496,14 @@ public _FinalStage trialEndSetting(Optional } @java.lang.Override - public _FinalStage trialEnd(Integer trialEnd) { + public _FinalStage trialEnd(Long trialEnd) { this.trialEnd = Optional.ofNullable(trialEnd); return this; } @java.lang.Override @JsonSetter(value = "trial_end", nulls = Nulls.SKIP) - public _FinalStage trialEnd(Optional trialEnd) { + public _FinalStage trialEnd(Optional trialEnd) { this.trialEnd = trialEnd; return this; } @@ -542,27 +546,27 @@ public _FinalStage productExternalIds(List productExterna } @java.lang.Override - public _FinalStage periodStart(Integer periodStart) { + public _FinalStage periodStart(Long periodStart) { this.periodStart = Optional.ofNullable(periodStart); return this; } @java.lang.Override @JsonSetter(value = "period_start", nulls = Nulls.SKIP) - public _FinalStage periodStart(Optional periodStart) { + public _FinalStage periodStart(Optional periodStart) { this.periodStart = periodStart; return this; } @java.lang.Override - public _FinalStage periodEnd(Integer periodEnd) { + public _FinalStage periodEnd(Long periodEnd) { this.periodEnd = Optional.ofNullable(periodEnd); return this; } @java.lang.Override @JsonSetter(value = "period_end", nulls = Nulls.SKIP) - public _FinalStage periodEnd(Optional periodEnd) { + public _FinalStage periodEnd(Optional periodEnd) { this.periodEnd = periodEnd; return this; } @@ -644,14 +648,14 @@ public _FinalStage defaultPaymentMethodExternalId(Optional defaultPaymen } @java.lang.Override - public _FinalStage cancelAt(Integer cancelAt) { + public _FinalStage cancelAt(Long cancelAt) { this.cancelAt = Optional.ofNullable(cancelAt); return this; } @java.lang.Override @JsonSetter(value = "cancel_at", nulls = Nulls.SKIP) - public _FinalStage cancelAt(Optional cancelAt) { + public _FinalStage cancelAt(Optional cancelAt) { this.cancelAt = cancelAt; return this; } @@ -693,5 +697,17 @@ public CreateBillingSubscriptionRequestBody build() { trialEndSetting, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateCouponRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateCouponRequestBody.java index bd7d4a5..c1fbf7d 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateCouponRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateCouponRequestBody.java @@ -21,36 +21,36 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateCouponRequestBody.Builder.class) public final class CreateCouponRequestBody { - private final int amountOff; + private final long amountOff; private final Optional currency; private final String duration; - private final int durationInMonths; + private final long durationInMonths; private final String externalId; - private final int maxRedemptions; + private final long maxRedemptions; private final String name; private final double percentOff; - private final int timesRedeemed; + private final long timesRedeemed; private final Map additionalProperties; private CreateCouponRequestBody( - int amountOff, + long amountOff, Optional currency, String duration, - int durationInMonths, + long durationInMonths, String externalId, - int maxRedemptions, + long maxRedemptions, String name, double percentOff, - int timesRedeemed, + long timesRedeemed, Map additionalProperties) { this.amountOff = amountOff; this.currency = currency; @@ -65,7 +65,7 @@ private CreateCouponRequestBody( } @JsonProperty("amount_off") - public int getAmountOff() { + public long getAmountOff() { return amountOff; } @@ -80,7 +80,7 @@ public String getDuration() { } @JsonProperty("duration_in_months") - public int getDurationInMonths() { + public long getDurationInMonths() { return durationInMonths; } @@ -90,7 +90,7 @@ public String getExternalId() { } @JsonProperty("max_redemptions") - public int getMaxRedemptions() { + public long getMaxRedemptions() { return maxRedemptions; } @@ -105,7 +105,7 @@ public double getPercentOff() { } @JsonProperty("times_redeemed") - public int getTimesRedeemed() { + public long getTimesRedeemed() { return timesRedeemed; } @@ -156,7 +156,7 @@ public static AmountOffStage builder() { } public interface AmountOffStage { - DurationStage amountOff(int amountOff); + DurationStage amountOff(long amountOff); Builder from(CreateCouponRequestBody other); } @@ -166,7 +166,7 @@ public interface DurationStage { } public interface DurationInMonthsStage { - ExternalIdStage durationInMonths(int durationInMonths); + ExternalIdStage durationInMonths(long durationInMonths); } public interface ExternalIdStage { @@ -174,7 +174,7 @@ public interface ExternalIdStage { } public interface MaxRedemptionsStage { - NameStage maxRedemptions(int maxRedemptions); + NameStage maxRedemptions(long maxRedemptions); } public interface NameStage { @@ -186,12 +186,16 @@ public interface PercentOffStage { } public interface TimesRedeemedStage { - _FinalStage timesRedeemed(int timesRedeemed); + _FinalStage timesRedeemed(long timesRedeemed); } public interface _FinalStage { CreateCouponRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage currency(Optional currency); _FinalStage currency(String currency); @@ -208,21 +212,21 @@ public static final class Builder PercentOffStage, TimesRedeemedStage, _FinalStage { - private int amountOff; + private long amountOff; private String duration; - private int durationInMonths; + private long durationInMonths; private String externalId; - private int maxRedemptions; + private long maxRedemptions; private String name; private double percentOff; - private int timesRedeemed; + private long timesRedeemed; private Optional currency = Optional.empty(); @@ -247,7 +251,7 @@ public Builder from(CreateCouponRequestBody other) { @java.lang.Override @JsonSetter("amount_off") - public DurationStage amountOff(int amountOff) { + public DurationStage amountOff(long amountOff) { this.amountOff = amountOff; return this; } @@ -261,7 +265,7 @@ public DurationInMonthsStage duration(@NotNull String duration) { @java.lang.Override @JsonSetter("duration_in_months") - public ExternalIdStage durationInMonths(int durationInMonths) { + public ExternalIdStage durationInMonths(long durationInMonths) { this.durationInMonths = durationInMonths; return this; } @@ -275,7 +279,7 @@ public MaxRedemptionsStage externalId(@NotNull String externalId) { @java.lang.Override @JsonSetter("max_redemptions") - public NameStage maxRedemptions(int maxRedemptions) { + public NameStage maxRedemptions(long maxRedemptions) { this.maxRedemptions = maxRedemptions; return this; } @@ -296,7 +300,7 @@ public TimesRedeemedStage percentOff(double percentOff) { @java.lang.Override @JsonSetter("times_redeemed") - public _FinalStage timesRedeemed(int timesRedeemed) { + public _FinalStage timesRedeemed(long timesRedeemed) { this.timesRedeemed = timesRedeemed; return this; } @@ -328,5 +332,17 @@ public CreateCouponRequestBody build() { timesRedeemed, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateInvoiceRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateInvoiceRequestBody.java index 24b5423..02d76e5 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateInvoiceRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateInvoiceRequestBody.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.InvoiceStatus; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; @@ -22,11 +23,11 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateInvoiceRequestBody.Builder.class) public final class CreateInvoiceRequestBody { - private final int amountDue; + private final long amountDue; - private final int amountPaid; + private final long amountPaid; - private final int amountRemaining; + private final long amountRemaining; private final String collectionMethod; @@ -40,26 +41,29 @@ public final class CreateInvoiceRequestBody { private final Optional paymentMethodExternalId; + private final Optional status; + private final Optional subscriptionExternalId; - private final int subtotal; + private final long subtotal; private final Optional url; private final Map additionalProperties; private CreateInvoiceRequestBody( - int amountDue, - int amountPaid, - int amountRemaining, + long amountDue, + long amountPaid, + long amountRemaining, String collectionMethod, String currency, String customerExternalId, Optional dueDate, Optional externalId, Optional paymentMethodExternalId, + Optional status, Optional subscriptionExternalId, - int subtotal, + long subtotal, Optional url, Map additionalProperties) { this.amountDue = amountDue; @@ -71,6 +75,7 @@ private CreateInvoiceRequestBody( this.dueDate = dueDate; this.externalId = externalId; this.paymentMethodExternalId = paymentMethodExternalId; + this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.subtotal = subtotal; this.url = url; @@ -78,17 +83,17 @@ private CreateInvoiceRequestBody( } @JsonProperty("amount_due") - public int getAmountDue() { + public long getAmountDue() { return amountDue; } @JsonProperty("amount_paid") - public int getAmountPaid() { + public long getAmountPaid() { return amountPaid; } @JsonProperty("amount_remaining") - public int getAmountRemaining() { + public long getAmountRemaining() { return amountRemaining; } @@ -122,13 +127,18 @@ public Optional getPaymentMethodExternalId() { return paymentMethodExternalId; } + @JsonProperty("status") + public Optional getStatus() { + return status; + } + @JsonProperty("subscription_external_id") public Optional getSubscriptionExternalId() { return subscriptionExternalId; } @JsonProperty("subtotal") - public int getSubtotal() { + public long getSubtotal() { return subtotal; } @@ -158,6 +168,7 @@ private boolean equalTo(CreateInvoiceRequestBody other) { && dueDate.equals(other.dueDate) && externalId.equals(other.externalId) && paymentMethodExternalId.equals(other.paymentMethodExternalId) + && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && subtotal == other.subtotal && url.equals(other.url); @@ -175,6 +186,7 @@ public int hashCode() { this.dueDate, this.externalId, this.paymentMethodExternalId, + this.status, this.subscriptionExternalId, this.subtotal, this.url); @@ -190,17 +202,17 @@ public static AmountDueStage builder() { } public interface AmountDueStage { - AmountPaidStage amountDue(int amountDue); + AmountPaidStage amountDue(long amountDue); Builder from(CreateInvoiceRequestBody other); } public interface AmountPaidStage { - AmountRemainingStage amountPaid(int amountPaid); + AmountRemainingStage amountPaid(long amountPaid); } public interface AmountRemainingStage { - CollectionMethodStage amountRemaining(int amountRemaining); + CollectionMethodStage amountRemaining(long amountRemaining); } public interface CollectionMethodStage { @@ -216,12 +228,16 @@ public interface CustomerExternalIdStage { } public interface SubtotalStage { - _FinalStage subtotal(int subtotal); + _FinalStage subtotal(long subtotal); } public interface _FinalStage { CreateInvoiceRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage dueDate(Optional dueDate); _FinalStage dueDate(OffsetDateTime dueDate); @@ -234,6 +250,10 @@ public interface _FinalStage { _FinalStage paymentMethodExternalId(String paymentMethodExternalId); + _FinalStage status(Optional status); + + _FinalStage status(InvoiceStatus status); + _FinalStage subscriptionExternalId(Optional subscriptionExternalId); _FinalStage subscriptionExternalId(String subscriptionExternalId); @@ -253,11 +273,11 @@ public static final class Builder CustomerExternalIdStage, SubtotalStage, _FinalStage { - private int amountDue; + private long amountDue; - private int amountPaid; + private long amountPaid; - private int amountRemaining; + private long amountRemaining; private String collectionMethod; @@ -265,12 +285,14 @@ public static final class Builder private String customerExternalId; - private int subtotal; + private long subtotal; private Optional url = Optional.empty(); private Optional subscriptionExternalId = Optional.empty(); + private Optional status = Optional.empty(); + private Optional paymentMethodExternalId = Optional.empty(); private Optional externalId = Optional.empty(); @@ -293,6 +315,7 @@ public Builder from(CreateInvoiceRequestBody other) { dueDate(other.getDueDate()); externalId(other.getExternalId()); paymentMethodExternalId(other.getPaymentMethodExternalId()); + status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); subtotal(other.getSubtotal()); url(other.getUrl()); @@ -301,21 +324,21 @@ public Builder from(CreateInvoiceRequestBody other) { @java.lang.Override @JsonSetter("amount_due") - public AmountPaidStage amountDue(int amountDue) { + public AmountPaidStage amountDue(long amountDue) { this.amountDue = amountDue; return this; } @java.lang.Override @JsonSetter("amount_paid") - public AmountRemainingStage amountPaid(int amountPaid) { + public AmountRemainingStage amountPaid(long amountPaid) { this.amountPaid = amountPaid; return this; } @java.lang.Override @JsonSetter("amount_remaining") - public CollectionMethodStage amountRemaining(int amountRemaining) { + public CollectionMethodStage amountRemaining(long amountRemaining) { this.amountRemaining = amountRemaining; return this; } @@ -343,7 +366,7 @@ public SubtotalStage customerExternalId(@NotNull String customerExternalId) { @java.lang.Override @JsonSetter("subtotal") - public _FinalStage subtotal(int subtotal) { + public _FinalStage subtotal(long subtotal) { this.subtotal = subtotal; return this; } @@ -374,6 +397,19 @@ public _FinalStage subscriptionExternalId(Optional subscriptionExternalI return this; } + @java.lang.Override + public _FinalStage status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + @java.lang.Override public _FinalStage paymentMethodExternalId(String paymentMethodExternalId) { this.paymentMethodExternalId = Optional.ofNullable(paymentMethodExternalId); @@ -425,10 +461,23 @@ public CreateInvoiceRequestBody build() { dueDate, externalId, paymentMethodExternalId, + status, subscriptionExternalId, subtotal, url, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java index 7cf32fb..bbfd54e 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreateMeterRequestBody.java @@ -114,6 +114,10 @@ public interface ExternalIdStage { public interface _FinalStage { CreateMeterRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -174,5 +178,17 @@ public CreateMeterRequestBody build() { return new CreateMeterRequestBody( displayName, eventName, eventPayloadKey, externalId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java b/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java index d14223a..542fd34 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/CreatePaymentMethodRequestBody.java @@ -33,9 +33,9 @@ public final class CreatePaymentMethodRequestBody { private final Optional cardBrand; - private final Optional cardExpMonth; + private final Optional cardExpMonth; - private final Optional cardExpYear; + private final Optional cardExpYear; private final Optional cardLast4; @@ -54,8 +54,8 @@ private CreatePaymentMethodRequestBody( Optional billingEmail, Optional billingName, Optional cardBrand, - Optional cardExpMonth, - Optional cardExpYear, + Optional cardExpMonth, + Optional cardExpYear, Optional cardLast4, String customerExternalId, String externalId, @@ -107,12 +107,12 @@ public Optional getCardBrand() { } @JsonProperty("card_exp_month") - public Optional getCardExpMonth() { + public Optional getCardExpMonth() { return cardExpMonth; } @JsonProperty("card_exp_year") - public Optional getCardExpYear() { + public Optional getCardExpYear() { return cardExpYear; } @@ -205,6 +205,10 @@ public interface PaymentMethodTypeStage { public interface _FinalStage { CreatePaymentMethodRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage accountLast4(Optional accountLast4); _FinalStage accountLast4(String accountLast4); @@ -229,13 +233,13 @@ public interface _FinalStage { _FinalStage cardBrand(String cardBrand); - _FinalStage cardExpMonth(Optional cardExpMonth); + _FinalStage cardExpMonth(Optional cardExpMonth); - _FinalStage cardExpMonth(Integer cardExpMonth); + _FinalStage cardExpMonth(Long cardExpMonth); - _FinalStage cardExpYear(Optional cardExpYear); + _FinalStage cardExpYear(Optional cardExpYear); - _FinalStage cardExpYear(Integer cardExpYear); + _FinalStage cardExpYear(Long cardExpYear); _FinalStage cardLast4(Optional cardLast4); @@ -253,9 +257,9 @@ public static final class Builder private Optional cardLast4 = Optional.empty(); - private Optional cardExpYear = Optional.empty(); + private Optional cardExpYear = Optional.empty(); - private Optional cardExpMonth = Optional.empty(); + private Optional cardExpMonth = Optional.empty(); private Optional cardBrand = Optional.empty(); @@ -326,27 +330,27 @@ public _FinalStage cardLast4(Optional cardLast4) { } @java.lang.Override - public _FinalStage cardExpYear(Integer cardExpYear) { + public _FinalStage cardExpYear(Long cardExpYear) { this.cardExpYear = Optional.ofNullable(cardExpYear); return this; } @java.lang.Override @JsonSetter(value = "card_exp_year", nulls = Nulls.SKIP) - public _FinalStage cardExpYear(Optional cardExpYear) { + public _FinalStage cardExpYear(Optional cardExpYear) { this.cardExpYear = cardExpYear; return this; } @java.lang.Override - public _FinalStage cardExpMonth(Integer cardExpMonth) { + public _FinalStage cardExpMonth(Long cardExpMonth) { this.cardExpMonth = Optional.ofNullable(cardExpMonth); return this; } @java.lang.Override @JsonSetter(value = "card_exp_month", nulls = Nulls.SKIP) - public _FinalStage cardExpMonth(Optional cardExpMonth) { + public _FinalStage cardExpMonth(Optional cardExpMonth) { this.cardExpMonth = cardExpMonth; return this; } @@ -446,5 +450,17 @@ public CreatePaymentMethodRequestBody build() { paymentMethodType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java index eb633ca..c438be3 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingPricesRequest.java @@ -29,6 +29,8 @@ public final class ListBillingPricesRequest { private final Optional> productIds; + private final Optional currency; + private final Optional forInitialPlan; private final Optional forTrialExpiryPlan; @@ -37,7 +39,7 @@ public final class ListBillingPricesRequest { private final Optional isActive; - private final Optional price; + private final Optional price; private final Optional productId; @@ -51,31 +53,33 @@ public final class ListBillingPricesRequest { private final Optional withMeter; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListBillingPricesRequest( Optional> ids, Optional> productIds, + Optional currency, Optional forInitialPlan, Optional forTrialExpiryPlan, Optional interval, Optional isActive, - Optional price, + Optional price, Optional productId, Optional providerType, Optional q, Optional tiersMode, Optional usageType, Optional withMeter, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.productIds = productIds; + this.currency = currency; this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.interval = interval; @@ -102,6 +106,14 @@ public Optional> getProductIds() { return productIds; } + /** + * @return Filter for prices in a specific currency (e.g. usd, eur) + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + /** * @return Filter for prices valid for initial plans (free prices only) */ @@ -132,7 +144,7 @@ public Optional getIsActive() { } @JsonProperty("price") - public Optional getPrice() { + public Optional getPrice() { return price; } @@ -173,7 +185,7 @@ public Optional getWithMeter() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -181,7 +193,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -199,6 +211,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ListBillingPricesRequest other) { return ids.equals(other.ids) && productIds.equals(other.productIds) + && currency.equals(other.currency) && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && interval.equals(other.interval) @@ -219,6 +232,7 @@ public int hashCode() { return Objects.hash( this.ids, this.productIds, + this.currency, this.forInitialPlan, this.forTrialExpiryPlan, this.interval, @@ -249,6 +263,8 @@ public static final class Builder { private Optional> productIds = Optional.empty(); + private Optional currency = Optional.empty(); + private Optional forInitialPlan = Optional.empty(); private Optional forTrialExpiryPlan = Optional.empty(); @@ -257,7 +273,7 @@ public static final class Builder { private Optional isActive = Optional.empty(); - private Optional price = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -271,9 +287,9 @@ public static final class Builder { private Optional withMeter = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -283,6 +299,7 @@ private Builder() {} public Builder from(ListBillingPricesRequest other) { ids(other.getIds()); productIds(other.getProductIds()); + currency(other.getCurrency()); forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); interval(other.getInterval()); @@ -331,6 +348,20 @@ public Builder productIds(String productIds) { return this; } + /** + *

Filter for prices in a specific currency (e.g. usd, eur)

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

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

*/ @@ -385,12 +416,12 @@ public Builder isActive(Boolean isActive) { } @JsonSetter(value = "price", nulls = Nulls.SKIP) - public Builder price(Optional price) { + public Builder price(Optional price) { this.price = price; return this; } - public Builder price(Integer price) { + public Builder price(Long price) { this.price = Optional.ofNullable(price); return this; } @@ -468,12 +499,12 @@ public Builder withMeter(Boolean withMeter) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -496,6 +527,7 @@ public ListBillingPricesRequest build() { return new ListBillingPricesRequest( ids, productIds, + currency, forInitialPlan, forTrialExpiryPlan, interval, @@ -511,5 +543,15 @@ public ListBillingPricesRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java index 27a0c07..a70372c 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductPricesRequest.java @@ -29,6 +29,8 @@ public final class ListBillingProductPricesRequest { private final Optional> productIds; + private final Optional currency; + private final Optional forInitialPlan; private final Optional forTrialExpiryPlan; @@ -37,7 +39,7 @@ public final class ListBillingProductPricesRequest { private final Optional isActive; - private final Optional price; + private final Optional price; private final Optional productId; @@ -51,31 +53,33 @@ public final class ListBillingProductPricesRequest { private final Optional withMeter; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListBillingProductPricesRequest( Optional> ids, Optional> productIds, + Optional currency, Optional forInitialPlan, Optional forTrialExpiryPlan, Optional interval, Optional isActive, - Optional price, + Optional price, Optional productId, Optional providerType, Optional q, Optional tiersMode, Optional usageType, Optional withMeter, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.productIds = productIds; + this.currency = currency; this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.interval = interval; @@ -102,6 +106,14 @@ public Optional> getProductIds() { return productIds; } + /** + * @return Filter for prices in a specific currency (e.g. usd, eur) + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + /** * @return Filter for prices valid for initial plans (free prices only) */ @@ -132,7 +144,7 @@ public Optional getIsActive() { } @JsonProperty("price") - public Optional getPrice() { + public Optional getPrice() { return price; } @@ -173,7 +185,7 @@ public Optional getWithMeter() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -181,7 +193,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -199,6 +211,7 @@ public Map getAdditionalProperties() { private boolean equalTo(ListBillingProductPricesRequest other) { return ids.equals(other.ids) && productIds.equals(other.productIds) + && currency.equals(other.currency) && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && interval.equals(other.interval) @@ -219,6 +232,7 @@ public int hashCode() { return Objects.hash( this.ids, this.productIds, + this.currency, this.forInitialPlan, this.forTrialExpiryPlan, this.interval, @@ -249,6 +263,8 @@ public static final class Builder { private Optional> productIds = Optional.empty(); + private Optional currency = Optional.empty(); + private Optional forInitialPlan = Optional.empty(); private Optional forTrialExpiryPlan = Optional.empty(); @@ -257,7 +273,7 @@ public static final class Builder { private Optional isActive = Optional.empty(); - private Optional price = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -271,9 +287,9 @@ public static final class Builder { private Optional withMeter = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -283,6 +299,7 @@ private Builder() {} public Builder from(ListBillingProductPricesRequest other) { ids(other.getIds()); productIds(other.getProductIds()); + currency(other.getCurrency()); forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); interval(other.getInterval()); @@ -331,6 +348,20 @@ public Builder productIds(String productIds) { return this; } + /** + *

Filter for prices in a specific currency (e.g. usd, eur)

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

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

*/ @@ -385,12 +416,12 @@ public Builder isActive(Boolean isActive) { } @JsonSetter(value = "price", nulls = Nulls.SKIP) - public Builder price(Optional price) { + public Builder price(Optional price) { this.price = price; return this; } - public Builder price(Integer price) { + public Builder price(Long price) { this.price = Optional.ofNullable(price); return this; } @@ -468,12 +499,12 @@ public Builder withMeter(Boolean withMeter) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -496,6 +527,7 @@ public ListBillingProductPricesRequest build() { return new ListBillingProductPricesRequest( ids, productIds, + currency, forInitialPlan, forTrialExpiryPlan, interval, @@ -511,5 +543,15 @@ public ListBillingProductPricesRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListBillingProductsRequest.java index 1d26af3..25d953b 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 @@ -44,9 +44,9 @@ public final class ListBillingProductsRequest { private final Optional withoutLinkedToPlan; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -61,8 +61,8 @@ private ListBillingProductsRequest( Optional withPricesOnly, Optional withZeroPrice, Optional withoutLinkedToPlan, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.isActive = isActive; @@ -148,7 +148,7 @@ public Optional getWithoutLinkedToPlan() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -156,7 +156,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -234,9 +234,9 @@ public static final class Builder { private Optional withoutLinkedToPlan = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -393,12 +393,12 @@ public Builder withoutLinkedToPlan(Boolean withoutLinkedToPlan) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -433,5 +433,15 @@ public ListBillingProductsRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListCouponsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListCouponsRequest.java index a66d099..d934e55 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListCouponsRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListCouponsRequest.java @@ -24,17 +24,17 @@ public final class ListCouponsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListCouponsRequest( Optional isActive, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.isActive = isActive; this.q = q; @@ -57,7 +57,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -107,9 +107,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -150,12 +150,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder offset(Integer offset) { public ListCouponsRequest build() { return new ListCouponsRequest(isActive, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListCustomersWithSubscriptionsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListCustomersWithSubscriptionsRequest.java index 355d88c..01643e6 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 @@ -31,9 +31,9 @@ public final class ListCustomersWithSubscriptionsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -42,8 +42,8 @@ private ListCustomersWithSubscriptionsRequest( Optional name, Optional providerType, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.name = name; @@ -78,7 +78,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -86,7 +86,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -135,9 +135,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -207,12 +207,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -235,5 +235,15 @@ public ListCustomersWithSubscriptionsRequest build() { return new ListCustomersWithSubscriptionsRequest( companyIds, name, providerType, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListInvoicesRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListInvoicesRequest.java index 824455d..66cb929 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListInvoicesRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListInvoicesRequest.java @@ -27,9 +27,9 @@ public final class ListInvoicesRequest { private final String subscriptionExternalId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -37,8 +37,8 @@ private ListInvoicesRequest( Optional companyId, String customerExternalId, String subscriptionExternalId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.customerExternalId = customerExternalId; @@ -67,7 +67,7 @@ public String getSubscriptionExternalId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -75,7 +75,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -126,6 +126,10 @@ public interface SubscriptionExternalIdStage { public interface _FinalStage { ListInvoicesRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -133,16 +137,16 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -151,9 +155,9 @@ public static final class Builder implements CustomerExternalIdStage, Subscripti private String subscriptionExternalId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional companyId = Optional.empty(); @@ -192,7 +196,7 @@ public _FinalStage subscriptionExternalId(@NotNull String subscriptionExternalId * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -202,7 +206,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -212,7 +216,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -222,7 +226,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -245,5 +249,17 @@ public ListInvoicesRequest build() { return new ListInvoicesRequest( companyId, customerExternalId, subscriptionExternalId, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListMetersRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListMetersRequest.java index 8ea5880..a8da457 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListMetersRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListMetersRequest.java @@ -22,16 +22,16 @@ public final class ListMetersRequest { private final Optional displayName; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListMetersRequest( Optional displayName, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.displayName = displayName; this.limit = limit; @@ -48,7 +48,7 @@ public Optional getDisplayName() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -56,7 +56,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -93,9 +93,9 @@ public static Builder builder() { public static final class Builder { private Optional displayName = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,12 +124,12 @@ public Builder displayName(String displayName) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +151,15 @@ public Builder offset(Integer offset) { public ListMetersRequest build() { return new ListMetersRequest(displayName, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/requests/ListPaymentMethodsRequest.java b/src/main/java/com/schematic/api/resources/billing/requests/ListPaymentMethodsRequest.java index e837895..e59a85c 100644 --- a/src/main/java/com/schematic/api/resources/billing/requests/ListPaymentMethodsRequest.java +++ b/src/main/java/com/schematic/api/resources/billing/requests/ListPaymentMethodsRequest.java @@ -25,17 +25,17 @@ public final class ListPaymentMethodsRequest { private final String customerExternalId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListPaymentMethodsRequest( Optional companyId, String customerExternalId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.customerExternalId = customerExternalId; @@ -58,7 +58,7 @@ public String getCustomerExternalId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -111,6 +111,10 @@ public interface CustomerExternalIdStage { public interface _FinalStage { ListPaymentMethodsRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -118,25 +122,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CustomerExternalIdStage, _FinalStage { private String customerExternalId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional companyId = Optional.empty(); @@ -166,7 +170,7 @@ public _FinalStage customerExternalId(@NotNull String customerExternalId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -176,7 +180,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -186,7 +190,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -196,7 +200,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -218,5 +222,17 @@ public _FinalStage companyId(Optional companyId) { public ListPaymentMethodsRequest build() { return new ListPaymentMethodsRequest(companyId, customerExternalId, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsParams.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsParams.java index 7204246..0800206 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 @@ -27,11 +27,11 @@ public final class CountBillingProductsParams { private final Optional isActive; - private final Optional limit; + private final Optional limit; private final Optional name; - private final Optional offset; + private final Optional offset; private final Optional priceUsageType; @@ -52,9 +52,9 @@ public final class CountBillingProductsParams { private CountBillingProductsParams( Optional> ids, Optional isActive, - Optional limit, + Optional limit, Optional name, - Optional offset, + Optional offset, Optional priceUsageType, Optional providerType, Optional q, @@ -95,7 +95,7 @@ public Optional getIsActive() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -108,7 +108,7 @@ public Optional getName() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -217,11 +217,11 @@ public static final class Builder { private Optional isActive = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional name = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional priceUsageType = Optional.empty(); @@ -287,12 +287,12 @@ public Builder isActive(Boolean isActive) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -427,5 +427,15 @@ public CountBillingProductsParams build() { withoutLinkedToPlan, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponse.java b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponse.java index 4670d23..2828798 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/CountBillingProductsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountBillingProductsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountBillingProductsParams params) { public CountBillingProductsResponse build() { return new CountBillingProductsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountCustomersParams.java b/src/main/java/com/schematic/api/resources/billing/types/CountCustomersParams.java index a8724db..705c9f7 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 @@ -24,11 +24,11 @@ public final class CountCustomersParams { private final Optional> companyIds; - private final Optional limit; + private final Optional limit; private final Optional name; - private final Optional offset; + private final Optional offset; private final Optional providerType; @@ -38,9 +38,9 @@ public final class CountCustomersParams { private CountCustomersParams( Optional> companyIds, - Optional limit, + Optional limit, Optional name, - Optional offset, + Optional offset, Optional providerType, Optional q, Map additionalProperties) { @@ -62,7 +62,7 @@ public Optional> getCompanyIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -75,7 +75,7 @@ public Optional getName() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -127,11 +127,11 @@ public static Builder builder() { public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional name = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional providerType = Optional.empty(); @@ -167,12 +167,12 @@ public Builder companyIds(List companyIds) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -227,5 +227,15 @@ public Builder q(String q) { public CountCustomersParams build() { return new CountCustomersParams(companyIds, limit, name, offset, providerType, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/CountCustomersResponse.java b/src/main/java/com/schematic/api/resources/billing/types/CountCustomersResponse.java index 080c19d..d0f55b8 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/CountCustomersResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/CountCustomersResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountCustomersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountCustomersParams params) { public CountCustomersResponse build() { return new CountCustomersResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/DeleteBillingProductResponse.java b/src/main/java/com/schematic/api/resources/billing/types/DeleteBillingProductResponse.java index e9f3953..f8d050c 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/DeleteBillingProductResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/DeleteBillingProductResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteBillingProductResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteBillingProductResponse build() { return new DeleteBillingProductResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/DeleteProductPriceResponse.java b/src/main/java/com/schematic/api/resources/billing/types/DeleteProductPriceResponse.java index f085f06..3f4e3f5 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/DeleteProductPriceResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/DeleteProductPriceResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteProductPriceResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteProductPriceResponse build() { return new DeleteProductPriceResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java index 601fe06..4c94058 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesParams.java @@ -24,6 +24,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListBillingPricesParams.Builder.class) public final class ListBillingPricesParams { + private final Optional currency; + private final Optional forInitialPlan; private final Optional forTrialExpiryPlan; @@ -34,11 +36,11 @@ public final class ListBillingPricesParams { private final Optional isActive; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; - private final Optional price; + private final Optional price; private final Optional productId; @@ -57,14 +59,15 @@ public final class ListBillingPricesParams { private final Map additionalProperties; private ListBillingPricesParams( + Optional currency, Optional forInitialPlan, Optional forTrialExpiryPlan, Optional> ids, Optional interval, Optional isActive, - Optional limit, - Optional offset, - Optional price, + Optional limit, + Optional offset, + Optional price, Optional productId, Optional> productIds, Optional providerType, @@ -73,6 +76,7 @@ private ListBillingPricesParams( Optional usageType, Optional withMeter, Map additionalProperties) { + this.currency = currency; this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.ids = ids; @@ -91,6 +95,14 @@ private ListBillingPricesParams( this.additionalProperties = additionalProperties; } + /** + * @return Filter for prices in a specific currency (e.g. usd, eur) + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + /** * @return Filter for prices valid for initial plans (free prices only) */ @@ -129,7 +141,7 @@ public Optional getIsActive() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -137,12 +149,12 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @JsonProperty("price") - public Optional getPrice() { + public Optional getPrice() { return price; } @@ -196,7 +208,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListBillingPricesParams other) { - return forInitialPlan.equals(other.forInitialPlan) + return currency.equals(other.currency) + && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && ids.equals(other.ids) && interval.equals(other.interval) @@ -216,6 +229,7 @@ private boolean equalTo(ListBillingPricesParams other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.currency, this.forInitialPlan, this.forTrialExpiryPlan, this.ids, @@ -244,6 +258,8 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional currency = Optional.empty(); + private Optional forInitialPlan = Optional.empty(); private Optional forTrialExpiryPlan = Optional.empty(); @@ -254,11 +270,11 @@ public static final class Builder { private Optional isActive = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional price = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -280,6 +296,7 @@ public static final class Builder { private Builder() {} public Builder from(ListBillingPricesParams other) { + currency(other.getCurrency()); forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); ids(other.getIds()); @@ -298,6 +315,20 @@ public Builder from(ListBillingPricesParams other) { return this; } + /** + *

Filter for prices in a specific currency (e.g. usd, eur)

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

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

*/ @@ -366,12 +397,12 @@ public Builder isActive(Boolean isActive) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @JsonSetter(value = "price", nulls = Nulls.SKIP) - public Builder price(Optional price) { + public Builder price(Optional price) { this.price = price; return this; } - public Builder price(Integer price) { + public Builder price(Long price) { this.price = Optional.ofNullable(price); return this; } @@ -483,6 +514,7 @@ public Builder withMeter(Boolean withMeter) { public ListBillingPricesParams build() { return new ListBillingPricesParams( + currency, forInitialPlan, forTrialExpiryPlan, ids, @@ -500,5 +532,15 @@ public ListBillingPricesParams build() { withMeter, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java index 86db514..493f337 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingPricesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListBillingPricesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingPriceView data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListBillingPricesResponse build() { return new ListBillingPricesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java index f2d6689..1684699 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesParams.java @@ -24,6 +24,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListBillingProductPricesParams.Builder.class) public final class ListBillingProductPricesParams { + private final Optional currency; + private final Optional forInitialPlan; private final Optional forTrialExpiryPlan; @@ -34,11 +36,11 @@ public final class ListBillingProductPricesParams { private final Optional isActive; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; - private final Optional price; + private final Optional price; private final Optional productId; @@ -57,14 +59,15 @@ public final class ListBillingProductPricesParams { private final Map additionalProperties; private ListBillingProductPricesParams( + Optional currency, Optional forInitialPlan, Optional forTrialExpiryPlan, Optional> ids, Optional interval, Optional isActive, - Optional limit, - Optional offset, - Optional price, + Optional limit, + Optional offset, + Optional price, Optional productId, Optional> productIds, Optional providerType, @@ -73,6 +76,7 @@ private ListBillingProductPricesParams( Optional usageType, Optional withMeter, Map additionalProperties) { + this.currency = currency; this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.ids = ids; @@ -91,6 +95,14 @@ private ListBillingProductPricesParams( this.additionalProperties = additionalProperties; } + /** + * @return Filter for prices in a specific currency (e.g. usd, eur) + */ + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + /** * @return Filter for prices valid for initial plans (free prices only) */ @@ -129,7 +141,7 @@ public Optional getIsActive() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -137,12 +149,12 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @JsonProperty("price") - public Optional getPrice() { + public Optional getPrice() { return price; } @@ -196,7 +208,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListBillingProductPricesParams other) { - return forInitialPlan.equals(other.forInitialPlan) + return currency.equals(other.currency) + && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && ids.equals(other.ids) && interval.equals(other.interval) @@ -216,6 +229,7 @@ private boolean equalTo(ListBillingProductPricesParams other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.currency, this.forInitialPlan, this.forTrialExpiryPlan, this.ids, @@ -244,6 +258,8 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { + private Optional currency = Optional.empty(); + private Optional forInitialPlan = Optional.empty(); private Optional forTrialExpiryPlan = Optional.empty(); @@ -254,11 +270,11 @@ public static final class Builder { private Optional isActive = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional price = Optional.empty(); + private Optional price = Optional.empty(); private Optional productId = Optional.empty(); @@ -280,6 +296,7 @@ public static final class Builder { private Builder() {} public Builder from(ListBillingProductPricesParams other) { + currency(other.getCurrency()); forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); ids(other.getIds()); @@ -298,6 +315,20 @@ public Builder from(ListBillingProductPricesParams other) { return this; } + /** + *

Filter for prices in a specific currency (e.g. usd, eur)

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

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

*/ @@ -366,12 +397,12 @@ public Builder isActive(Boolean isActive) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @JsonSetter(value = "price", nulls = Nulls.SKIP) - public Builder price(Optional price) { + public Builder price(Optional price) { this.price = price; return this; } - public Builder price(Integer price) { + public Builder price(Long price) { this.price = Optional.ofNullable(price); return this; } @@ -483,6 +514,7 @@ public Builder withMeter(Boolean withMeter) { public ListBillingProductPricesParams build() { return new ListBillingProductPricesParams( + currency, forInitialPlan, forTrialExpiryPlan, ids, @@ -500,5 +532,15 @@ public ListBillingProductPricesParams build() { withMeter, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java index e28cf04..893c33b 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductPricesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListBillingProductPricesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingPriceView data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListBillingProductPricesResponse build() { return new ListBillingProductPricesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsParams.java index d7a9286..d02b28f 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 @@ -27,11 +27,11 @@ public final class ListBillingProductsParams { private final Optional isActive; - private final Optional limit; + private final Optional limit; private final Optional name; - private final Optional offset; + private final Optional offset; private final Optional priceUsageType; @@ -52,9 +52,9 @@ public final class ListBillingProductsParams { private ListBillingProductsParams( Optional> ids, Optional isActive, - Optional limit, + Optional limit, Optional name, - Optional offset, + Optional offset, Optional priceUsageType, Optional providerType, Optional q, @@ -95,7 +95,7 @@ public Optional getIsActive() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -108,7 +108,7 @@ public Optional getName() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -217,11 +217,11 @@ public static final class Builder { private Optional isActive = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional name = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional priceUsageType = Optional.empty(); @@ -287,12 +287,12 @@ public Builder isActive(Boolean isActive) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -427,5 +427,15 @@ public ListBillingProductsParams build() { withoutLinkedToPlan, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponse.java index eddc6ec..7f5311e 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListBillingProductsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListBillingProductsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingProductDetailResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListBillingProductsResponse build() { return new ListBillingProductsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListCouponsParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListCouponsParams.java index 4a2c6a6..338f620 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListCouponsParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListCouponsParams.java @@ -22,9 +22,9 @@ public final class ListCouponsParams { private final Optional isActive; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -32,8 +32,8 @@ public final class ListCouponsParams { private ListCouponsParams( Optional isActive, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.isActive = isActive; @@ -52,7 +52,7 @@ public Optional getIsActive() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional isActive = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -139,12 +139,12 @@ public Builder isActive(Boolean isActive) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder q(String q) { public ListCouponsParams build() { return new ListCouponsParams(isActive, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListCouponsResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListCouponsResponse.java index dbf5b2a..7307a79 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListCouponsResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListCouponsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListCouponsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingCouponResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListCouponsResponse build() { return new ListCouponsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsParams.java index 2578b1e..a201a6c 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 @@ -24,11 +24,11 @@ public final class ListCustomersWithSubscriptionsParams { private final Optional> companyIds; - private final Optional limit; + private final Optional limit; private final Optional name; - private final Optional offset; + private final Optional offset; private final Optional providerType; @@ -38,9 +38,9 @@ public final class ListCustomersWithSubscriptionsParams { private ListCustomersWithSubscriptionsParams( Optional> companyIds, - Optional limit, + Optional limit, Optional name, - Optional offset, + Optional offset, Optional providerType, Optional q, Map additionalProperties) { @@ -62,7 +62,7 @@ public Optional> getCompanyIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -75,7 +75,7 @@ public Optional getName() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -128,11 +128,11 @@ public static Builder builder() { public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional name = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional providerType = Optional.empty(); @@ -168,12 +168,12 @@ public Builder companyIds(List companyIds) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -229,5 +229,15 @@ public ListCustomersWithSubscriptionsParams build() { return new ListCustomersWithSubscriptionsParams( companyIds, limit, name, offset, providerType, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsResponse.java index b6bcaa4..0a2e945 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListCustomersWithSubscriptionsResponse.java @@ -93,6 +93,10 @@ public interface ParamsStage { public interface _FinalStage { ListCustomersWithSubscriptionsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingCustomerWithSubscriptionsResponseData data); @@ -158,5 +162,17 @@ public _FinalStage data(List data) public ListCustomersWithSubscriptionsResponse build() { return new ListCustomersWithSubscriptionsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesParams.java index 4aba631..3199510 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesParams.java @@ -24,9 +24,9 @@ public final class ListInvoicesParams { private final Optional customerExternalId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional subscriptionExternalId; @@ -35,8 +35,8 @@ public final class ListInvoicesParams { private ListInvoicesParams( Optional companyId, Optional customerExternalId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional subscriptionExternalId, Map additionalProperties) { this.companyId = companyId; @@ -61,7 +61,7 @@ public Optional getCustomerExternalId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -69,7 +69,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -118,9 +118,9 @@ public static final class Builder { private Optional customerExternalId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional subscriptionExternalId = Optional.empty(); @@ -164,12 +164,12 @@ public Builder customerExternalId(String customerExternalId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public ListInvoicesParams build() { return new ListInvoicesParams( companyId, customerExternalId, limit, offset, subscriptionExternalId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesResponse.java index 691efc2..4183dde 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListInvoicesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListInvoicesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(InvoiceResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListInvoicesResponse build() { return new ListInvoicesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListMetersParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListMetersParams.java index 1aac646..daffba7 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListMetersParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListMetersParams.java @@ -22,16 +22,16 @@ public final class ListMetersParams { private final Optional displayName; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListMetersParams( Optional displayName, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.displayName = displayName; this.limit = limit; @@ -48,7 +48,7 @@ public Optional getDisplayName() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -56,7 +56,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -93,9 +93,9 @@ public static Builder builder() { public static final class Builder { private Optional displayName = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,12 +124,12 @@ public Builder displayName(String displayName) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +151,15 @@ public Builder offset(Integer offset) { public ListMetersParams build() { return new ListMetersParams(displayName, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListMetersResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListMetersResponse.java index d32f637..51409fe 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListMetersResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListMetersResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListMetersResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingMeterResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListMetersResponse build() { return new ListMetersResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsParams.java b/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsParams.java index 8d5b171..9a7e9f2 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsParams.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsParams.java @@ -24,17 +24,17 @@ public final class ListPaymentMethodsParams { private final Optional customerExternalId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListPaymentMethodsParams( Optional companyId, Optional customerExternalId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.customerExternalId = customerExternalId; @@ -57,7 +57,7 @@ public Optional getCustomerExternalId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -107,9 +107,9 @@ public static final class Builder { private Optional customerExternalId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -150,12 +150,12 @@ public Builder customerExternalId(String customerExternalId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder offset(Integer offset) { public ListPaymentMethodsParams build() { return new ListPaymentMethodsParams(companyId, customerExternalId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsResponse.java b/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsResponse.java index 0ad01a7..04c5afb 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/ListPaymentMethodsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListPaymentMethodsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(PaymentMethodResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListPaymentMethodsResponse build() { return new ListPaymentMethodsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCouponResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCouponResponse.java index 792f6fa..1a92d59 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCouponResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCouponResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingCouponResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertBillingCouponResponse build() { return new UpsertBillingCouponResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCustomerResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCustomerResponse.java index 39eb042..31fed72 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCustomerResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingCustomerResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingCustomerResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertBillingCustomerResponse build() { return new UpsertBillingCustomerResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingMeterResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingMeterResponse.java index 46f16fc..93d0fb8 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingMeterResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingMeterResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingMeterResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertBillingMeterResponse build() { return new UpsertBillingMeterResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingPriceResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingPriceResponse.java index 3327379..144960b 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingPriceResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingPriceResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingPriceResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertBillingPriceResponse build() { return new UpsertBillingPriceResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingProductResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingProductResponse.java index d6dc744..a24e241 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingProductResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingProductResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingProductResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertBillingProductResponse build() { return new UpsertBillingProductResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingSubscriptionResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingSubscriptionResponse.java index 7536296..63a3563 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingSubscriptionResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertBillingSubscriptionResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingSubscriptionResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public UpsertBillingSubscriptionResponse build() { return new UpsertBillingSubscriptionResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertInvoiceResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertInvoiceResponse.java index 8ac5365..897e0e5 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertInvoiceResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertInvoiceResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertInvoiceResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertInvoiceResponse build() { return new UpsertInvoiceResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/billing/types/UpsertPaymentMethodResponse.java b/src/main/java/com/schematic/api/resources/billing/types/UpsertPaymentMethodResponse.java index 5d8f8a6..cb8588b 100644 --- a/src/main/java/com/schematic/api/resources/billing/types/UpsertPaymentMethodResponse.java +++ b/src/main/java/com/schematic/api/resources/billing/types/UpsertPaymentMethodResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertPaymentMethodResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertPaymentMethodResponse build() { return new UpsertPaymentMethodResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java b/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java index 679c29a..b47818d 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncCheckoutClient.java @@ -95,6 +95,13 @@ public CompletableFuture updateCusto return this.rawClient.updateCustomerSubscriptionTrialEnd(subscriptionId).thenApply(response -> response.body()); } + public CompletableFuture updateCustomerSubscriptionTrialEnd( + String subscriptionId, RequestOptions requestOptions) { + return this.rawClient + .updateCustomerSubscriptionTrialEnd(subscriptionId, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture updateCustomerSubscriptionTrialEnd( String subscriptionId, UpdateTrialEndRequestBody request) { return this.rawClient 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 9e5d971..d2978c6 100644 --- a/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/AsyncRawCheckoutClient.java @@ -56,10 +56,14 @@ public CompletableFuture> in public CompletableFuture> internal( ChangeSubscriptionInternalRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("checkout-internal") - .build(); + .addPathSegments("checkout-internal"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -68,7 +72,7 @@ public CompletableFuture> in throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -83,14 +87,13 @@ public CompletableFuture> in @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CheckoutInternalResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckoutInternalResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -122,11 +125,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -148,10 +149,14 @@ public CompletableFuture> get public CompletableFuture> getCheckoutData( CheckoutDataRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("checkout-internal/data") - .build(); + .addPathSegments("checkout-internal/data"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -160,7 +165,7 @@ public CompletableFuture> get throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -175,14 +180,13 @@ public CompletableFuture> get @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetCheckoutDataResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCheckoutDataResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -214,11 +218,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -240,10 +242,14 @@ public CompletableFuture> previewCheckoutInternal( ChangeSubscriptionInternalRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("checkout-internal/preview") - .build(); + .addPathSegments("checkout-internal/preview"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -252,7 +258,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), PreviewCheckoutInternalResponse.class), + responseBodyString, PreviewCheckoutInternalResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -307,11 +313,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -332,10 +336,14 @@ public CompletableFuture> managePl public CompletableFuture> managePlan( ManagePlanRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("manage-plan") - .build(); + .addPathSegments("manage-plan"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -344,7 +352,7 @@ public CompletableFuture> managePl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -359,13 +367,13 @@ public CompletableFuture> managePl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ManagePlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ManagePlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -397,11 +405,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -423,10 +429,14 @@ public CompletableFuture> p public CompletableFuture> previewManagePlan( ManagePlanRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("manage-plan/preview") - .build(); + .addPathSegments("manage-plan/preview"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -435,7 +445,7 @@ public CompletableFuture> p throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -450,14 +460,14 @@ public CompletableFuture> p @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), PreviewManagePlanResponse.class), + responseBodyString, PreviewManagePlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -489,11 +499,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -515,10 +523,14 @@ public CompletableFuture> public CompletableFuture> cancelSubscription( CancelSubscriptionRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("manage-plan/subscription/cancel") - .build(); + .addPathSegments("manage-plan/subscription/cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -527,7 +539,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -542,14 +554,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CancelSubscriptionResponse.class), + responseBodyString, CancelSubscriptionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -581,11 +593,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -606,6 +616,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { subscriptionId, UpdateTrialEndRequestBody.builder().build()); } + public CompletableFuture> + updateCustomerSubscriptionTrialEnd(String subscriptionId, RequestOptions requestOptions) { + return updateCustomerSubscriptionTrialEnd( + subscriptionId, UpdateTrialEndRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> updateCustomerSubscriptionTrialEnd(String subscriptionId, UpdateTrialEndRequestBody request) { return updateCustomerSubscriptionTrialEnd(subscriptionId, request, null); @@ -614,12 +630,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { public CompletableFuture> updateCustomerSubscriptionTrialEnd( String subscriptionId, UpdateTrialEndRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("subscription") .addPathSegment(subscriptionId) - .addPathSegments("edit-trial-end") - .build(); + .addPathSegments("edit-trial-end"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -628,7 +648,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -644,14 +664,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateCustomerSubscriptionTrialEndResponse.class), + responseBodyString, UpdateCustomerSubscriptionTrialEndResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -683,11 +703,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 c1abb79..7ff3fe2 100644 --- a/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/CheckoutClient.java @@ -90,6 +90,13 @@ public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTria return this.rawClient.updateCustomerSubscriptionTrialEnd(subscriptionId).body(); } + public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTrialEnd( + String subscriptionId, RequestOptions requestOptions) { + return this.rawClient + .updateCustomerSubscriptionTrialEnd(subscriptionId, requestOptions) + .body(); + } + public UpdateCustomerSubscriptionTrialEndResponse updateCustomerSubscriptionTrialEnd( String subscriptionId, UpdateTrialEndRequestBody request) { return this.rawClient 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 3e1e04d..a1505b0 100644 --- a/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java +++ b/src/main/java/com/schematic/api/resources/checkout/RawCheckoutClient.java @@ -51,10 +51,14 @@ public BaseSchematicHttpResponse internal(ChangeSubscr public BaseSchematicHttpResponse internal( ChangeSubscriptionInternalRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("checkout-internal") - .build(); + .addPathSegments("checkout-internal"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -63,7 +67,7 @@ public BaseSchematicHttpResponse internal( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -75,12 +79,12 @@ public BaseSchematicHttpResponse internal( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckoutInternalResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckoutInternalResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -102,11 +106,9 @@ public BaseSchematicHttpResponse internal( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -118,10 +120,14 @@ public BaseSchematicHttpResponse getCheckoutData(Checko public BaseSchematicHttpResponse getCheckoutData( CheckoutDataRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("checkout-internal/data") - .build(); + .addPathSegments("checkout-internal/data"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -130,7 +136,7 @@ public BaseSchematicHttpResponse getCheckoutData( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -142,12 +148,12 @@ public BaseSchematicHttpResponse getCheckoutData( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCheckoutDataResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCheckoutDataResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -169,11 +175,9 @@ public BaseSchematicHttpResponse getCheckoutData( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -186,10 +190,14 @@ public BaseSchematicHttpResponse previewCheckou public BaseSchematicHttpResponse previewCheckoutInternal( ChangeSubscriptionInternalRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("checkout-internal/preview") - .build(); + .addPathSegments("checkout-internal/preview"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -198,7 +206,7 @@ public BaseSchematicHttpResponse previewCheckou throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -210,13 +218,12 @@ public BaseSchematicHttpResponse previewCheckou } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), PreviewCheckoutInternalResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PreviewCheckoutInternalResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -238,11 +245,9 @@ public BaseSchematicHttpResponse previewCheckou } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -254,10 +259,14 @@ public BaseSchematicHttpResponse managePlan(ManagePlanReques public BaseSchematicHttpResponse managePlan( ManagePlanRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("manage-plan") - .build(); + .addPathSegments("manage-plan"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -266,7 +275,7 @@ public BaseSchematicHttpResponse managePlan( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -278,11 +287,11 @@ public BaseSchematicHttpResponse managePlan( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ManagePlanResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ManagePlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -304,11 +313,9 @@ public BaseSchematicHttpResponse managePlan( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -320,10 +327,14 @@ public BaseSchematicHttpResponse previewManagePlan(Ma public BaseSchematicHttpResponse previewManagePlan( ManagePlanRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("manage-plan/preview") - .build(); + .addPathSegments("manage-plan/preview"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -332,7 +343,7 @@ public BaseSchematicHttpResponse previewManagePlan( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -344,12 +355,12 @@ public BaseSchematicHttpResponse previewManagePlan( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PreviewManagePlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PreviewManagePlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -371,11 +382,9 @@ public BaseSchematicHttpResponse previewManagePlan( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -387,10 +396,14 @@ public BaseSchematicHttpResponse cancelSubscription( public BaseSchematicHttpResponse cancelSubscription( CancelSubscriptionRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("manage-plan/subscription/cancel") - .build(); + .addPathSegments("manage-plan/subscription/cancel"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -399,7 +412,7 @@ public BaseSchematicHttpResponse cancelSubscription( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -411,12 +424,12 @@ public BaseSchematicHttpResponse cancelSubscription( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelSubscriptionResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CancelSubscriptionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -438,11 +451,9 @@ public BaseSchematicHttpResponse cancelSubscription( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -454,6 +465,12 @@ public BaseSchematicHttpResponse upd subscriptionId, UpdateTrialEndRequestBody.builder().build()); } + public BaseSchematicHttpResponse updateCustomerSubscriptionTrialEnd( + String subscriptionId, RequestOptions requestOptions) { + return updateCustomerSubscriptionTrialEnd( + subscriptionId, UpdateTrialEndRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse updateCustomerSubscriptionTrialEnd( String subscriptionId, UpdateTrialEndRequestBody request) { return updateCustomerSubscriptionTrialEnd(subscriptionId, request, null); @@ -461,12 +478,16 @@ public BaseSchematicHttpResponse upd public BaseSchematicHttpResponse updateCustomerSubscriptionTrialEnd( String subscriptionId, UpdateTrialEndRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("subscription") .addPathSegment(subscriptionId) - .addPathSegments("edit-trial-end") - .build(); + .addPathSegments("edit-trial-end"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -475,7 +496,7 @@ public BaseSchematicHttpResponse upd throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -487,13 +508,13 @@ public BaseSchematicHttpResponse upd } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateCustomerSubscriptionTrialEndResponse.class), + responseBodyString, UpdateCustomerSubscriptionTrialEndResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -515,11 +536,9 @@ public BaseSchematicHttpResponse upd } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java b/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java index 7639e29..fbfc6fa 100644 --- a/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java +++ b/src/main/java/com/schematic/api/resources/checkout/requests/CancelSubscriptionRequest.java @@ -101,6 +101,10 @@ public interface CompanyIdStage { public interface _FinalStage { CancelSubscriptionRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

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

*/ @@ -188,5 +192,17 @@ public _FinalStage cancelImmediately(Optional cancelImmediately) { public CancelSubscriptionRequest build() { return new CancelSubscriptionRequest(cancelImmediately, companyId, prorate, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/requests/CheckoutDataRequestBody.java b/src/main/java/com/schematic/api/resources/checkout/requests/CheckoutDataRequestBody.java index 8e9bc2e..92a936c 100644 --- a/src/main/java/com/schematic/api/resources/checkout/requests/CheckoutDataRequestBody.java +++ b/src/main/java/com/schematic/api/resources/checkout/requests/CheckoutDataRequestBody.java @@ -82,6 +82,10 @@ public interface CompanyIdStage { public interface _FinalStage { CheckoutDataRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage selectedPlanId(Optional selectedPlanId); _FinalStage selectedPlanId(String selectedPlanId); @@ -129,5 +133,17 @@ public _FinalStage selectedPlanId(Optional selectedPlanId) { public CheckoutDataRequestBody build() { return new CheckoutDataRequestBody(companyId, selectedPlanId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/requests/UpdateTrialEndRequestBody.java b/src/main/java/com/schematic/api/resources/checkout/requests/UpdateTrialEndRequestBody.java index 1e01657..0eb5e76 100644 --- a/src/main/java/com/schematic/api/resources/checkout/requests/UpdateTrialEndRequestBody.java +++ b/src/main/java/com/schematic/api/resources/checkout/requests/UpdateTrialEndRequestBody.java @@ -92,5 +92,15 @@ public Builder trialEnd(OffsetDateTime trialEnd) { public UpdateTrialEndRequestBody build() { return new UpdateTrialEndRequestBody(trialEnd, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java index cf0dd4d..53cac7d 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/CancelSubscriptionResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { CancelSubscriptionResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public CancelSubscriptionResponse build() { return new CancelSubscriptionResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/CheckoutInternalResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/CheckoutInternalResponse.java index e02d09b..afb3159 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/CheckoutInternalResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/CheckoutInternalResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CheckoutInternalResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CheckoutInternalResponse build() { return new CheckoutInternalResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java index 7ddcddc..ea0e451 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/GetCheckoutDataResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetCheckoutDataResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetCheckoutDataResponse build() { return new GetCheckoutDataResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/ManagePlanResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/ManagePlanResponse.java index 6fb75b7..737c553 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/ManagePlanResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/ManagePlanResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { ManagePlanResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public ManagePlanResponse build() { return new ManagePlanResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/PreviewCheckoutInternalResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/PreviewCheckoutInternalResponse.java index 2c0c27f..e7105af 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/PreviewCheckoutInternalResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/PreviewCheckoutInternalResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { PreviewCheckoutInternalResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public PreviewCheckoutInternalResponse build() { return new PreviewCheckoutInternalResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/PreviewManagePlanResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/PreviewManagePlanResponse.java index ad92c2b..e5bce3a 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/PreviewManagePlanResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/PreviewManagePlanResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { PreviewManagePlanResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public PreviewManagePlanResponse build() { return new PreviewManagePlanResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.java b/src/main/java/com/schematic/api/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.java index c809edf..22e529f 100644 --- a/src/main/java/com/schematic/api/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.java +++ b/src/main/java/com/schematic/api/resources/checkout/types/UpdateCustomerSubscriptionTrialEndResponse.java @@ -88,6 +88,10 @@ public interface DataStage { public interface _FinalStage { UpdateCustomerSubscriptionTrialEndResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -162,5 +166,17 @@ public _FinalStage params(Map params) { public UpdateCustomerSubscriptionTrialEndResponse build() { return new UpdateCustomerSubscriptionTrialEndResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java index cb5da48..17c0157 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncCompaniesClient.java @@ -5,7 +5,6 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; -import com.schematic.api.resources.companies.requests.CountCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.CountCompaniesRequest; import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; @@ -17,7 +16,6 @@ import com.schematic.api.resources.companies.requests.GetActiveCompanySubscriptionRequest; import com.schematic.api.resources.companies.requests.GetEntityTraitValuesRequest; import com.schematic.api.resources.companies.requests.GetOrCreateCompanyMembershipRequestBody; -import com.schematic.api.resources.companies.requests.ListCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.ListCompaniesRequest; import com.schematic.api.resources.companies.requests.ListCompanyMembershipsRequest; import com.schematic.api.resources.companies.requests.ListEntityKeyDefinitionsRequest; @@ -30,7 +28,6 @@ import com.schematic.api.resources.companies.requests.UpdateEntityTraitDefinitionRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitBulkRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitRequestBody; -import com.schematic.api.resources.companies.types.CountCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.CountCompaniesResponse; import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; @@ -54,7 +51,6 @@ import com.schematic.api.resources.companies.types.GetPlanChangeResponse; import com.schematic.api.resources.companies.types.GetPlanTraitResponse; import com.schematic.api.resources.companies.types.GetUserResponse; -import com.schematic.api.resources.companies.types.ListCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.ListCompaniesResponse; import com.schematic.api.resources.companies.types.ListCompanyMembershipsResponse; import com.schematic.api.resources.companies.types.ListEntityKeyDefinitionsResponse; @@ -98,6 +94,10 @@ public CompletableFuture listCompanies() { return this.rawClient.listCompanies().thenApply(response -> response.body()); } + public CompletableFuture listCompanies(RequestOptions requestOptions) { + return this.rawClient.listCompanies(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCompanies(ListCompaniesRequest request) { return this.rawClient.listCompanies(request).thenApply(response -> response.body()); } @@ -128,6 +128,10 @@ 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()); } @@ -141,6 +145,10 @@ public CompletableFuture countCompanies() { return this.rawClient.countCompanies().thenApply(response -> response.body()); } + public CompletableFuture countCompanies(RequestOptions requestOptions) { + return this.rawClient.countCompanies(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countCompanies(CountCompaniesRequest request) { return this.rawClient.countCompanies(request).thenApply(response -> response.body()); } @@ -150,22 +158,6 @@ public CompletableFuture countCompanies( return this.rawClient.countCompanies(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture countCompaniesForAdvancedFilter() { - return this.rawClient.countCompaniesForAdvancedFilter().thenApply(response -> response.body()); - } - - public CompletableFuture countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request) { - return this.rawClient.countCompaniesForAdvancedFilter(request).thenApply(response -> response.body()); - } - - public CompletableFuture countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - return this.rawClient - .countCompaniesForAdvancedFilter(request, requestOptions) - .thenApply(response -> response.body()); - } - public CompletableFuture createCompany(UpsertCompanyRequestBody request) { return this.rawClient.createCompany(request).thenApply(response -> response.body()); } @@ -184,26 +176,28 @@ public CompletableFuture deleteCompanyByKeys( return this.rawClient.deleteCompanyByKeys(request, requestOptions).thenApply(response -> response.body()); } - public CompletableFuture listCompaniesForAdvancedFilter() { - return this.rawClient.listCompaniesForAdvancedFilter().thenApply(response -> response.body()); - } - - public CompletableFuture listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request) { - return this.rawClient.listCompaniesForAdvancedFilter(request).thenApply(response -> response.body()); - } - - public CompletableFuture listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - return this.rawClient - .listCompaniesForAdvancedFilter(request, requestOptions) - .thenApply(response -> response.body()); - } - + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public CompletableFuture lookupCompany(LookupCompanyRequest request) { return this.rawClient.lookupCompany(request).thenApply(response -> response.body()); } + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public CompletableFuture lookupCompany( LookupCompanyRequest request, RequestOptions requestOptions) { return this.rawClient.lookupCompany(request, requestOptions).thenApply(response -> response.body()); @@ -213,6 +207,10 @@ public CompletableFuture listCompanyMemberships( return this.rawClient.listCompanyMemberships().thenApply(response -> response.body()); } + public CompletableFuture listCompanyMemberships(RequestOptions requestOptions) { + return this.rawClient.listCompanyMemberships(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCompanyMemberships( ListCompanyMembershipsRequest request) { return this.rawClient.listCompanyMemberships(request).thenApply(response -> response.body()); @@ -250,6 +248,11 @@ public CompletableFuture getActiveCompanyS return this.rawClient.getActiveCompanySubscription().thenApply(response -> response.body()); } + public CompletableFuture getActiveCompanySubscription( + RequestOptions requestOptions) { + return this.rawClient.getActiveCompanySubscription(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture getActiveCompanySubscription( GetActiveCompanySubscriptionRequest request) { return this.rawClient.getActiveCompanySubscription(request).thenApply(response -> response.body()); @@ -275,6 +278,10 @@ public CompletableFuture listEntityKeyDefiniti return this.rawClient.listEntityKeyDefinitions().thenApply(response -> response.body()); } + public CompletableFuture listEntityKeyDefinitions(RequestOptions requestOptions) { + return this.rawClient.listEntityKeyDefinitions(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listEntityKeyDefinitions( ListEntityKeyDefinitionsRequest request) { return this.rawClient.listEntityKeyDefinitions(request).thenApply(response -> response.body()); @@ -289,6 +296,11 @@ public CompletableFuture countEntityKeyDefini return this.rawClient.countEntityKeyDefinitions().thenApply(response -> response.body()); } + public CompletableFuture countEntityKeyDefinitions( + RequestOptions requestOptions) { + return this.rawClient.countEntityKeyDefinitions(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countEntityKeyDefinitions( CountEntityKeyDefinitionsRequest request) { return this.rawClient.countEntityKeyDefinitions(request).thenApply(response -> response.body()); @@ -303,6 +315,11 @@ public CompletableFuture listEntityTraitDefi return this.rawClient.listEntityTraitDefinitions().thenApply(response -> response.body()); } + public CompletableFuture listEntityTraitDefinitions( + RequestOptions requestOptions) { + return this.rawClient.listEntityTraitDefinitions(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listEntityTraitDefinitions( ListEntityTraitDefinitionsRequest request) { return this.rawClient.listEntityTraitDefinitions(request).thenApply(response -> response.body()); @@ -359,6 +376,11 @@ public CompletableFuture countEntityTraitDe return this.rawClient.countEntityTraitDefinitions().thenApply(response -> response.body()); } + public CompletableFuture countEntityTraitDefinitions( + RequestOptions requestOptions) { + return this.rawClient.countEntityTraitDefinitions(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countEntityTraitDefinitions( CountEntityTraitDefinitionsRequest request) { return this.rawClient.countEntityTraitDefinitions(request).thenApply(response -> response.body()); @@ -384,6 +406,10 @@ public CompletableFuture listPlanChanges() { return this.rawClient.listPlanChanges().thenApply(response -> response.body()); } + public CompletableFuture listPlanChanges(RequestOptions requestOptions) { + return this.rawClient.listPlanChanges(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listPlanChanges(ListPlanChangesRequest request) { return this.rawClient.listPlanChanges(request).thenApply(response -> response.body()); } @@ -405,6 +431,10 @@ public CompletableFuture listPlanTraits() { return this.rawClient.listPlanTraits().thenApply(response -> response.body()); } + public CompletableFuture listPlanTraits(RequestOptions requestOptions) { + return this.rawClient.listPlanTraits(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listPlanTraits(ListPlanTraitsRequest request) { return this.rawClient.listPlanTraits(request).thenApply(response -> response.body()); } @@ -466,6 +496,10 @@ public CompletableFuture countPlanTraits() { return this.rawClient.countPlanTraits().thenApply(response -> response.body()); } + public CompletableFuture countPlanTraits(RequestOptions requestOptions) { + return this.rawClient.countPlanTraits(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countPlanTraits(CountPlanTraitsRequest request) { return this.rawClient.countPlanTraits(request).thenApply(response -> response.body()); } @@ -488,6 +522,10 @@ public CompletableFuture listUsers() { return this.rawClient.listUsers().thenApply(response -> response.body()); } + public CompletableFuture listUsers(RequestOptions requestOptions) { + return this.rawClient.listUsers(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listUsers(ListUsersRequest request) { return this.rawClient.listUsers(request).thenApply(response -> response.body()); } @@ -525,6 +563,10 @@ public CompletableFuture countUsers() { return this.rawClient.countUsers().thenApply(response -> response.body()); } + public CompletableFuture countUsers(RequestOptions requestOptions) { + return this.rawClient.countUsers(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countUsers(CountUsersRequest request) { return this.rawClient.countUsers(request).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 a5d1dff..e9ca280 100644 --- a/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/AsyncRawCompaniesClient.java @@ -17,7 +17,6 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; -import com.schematic.api.resources.companies.requests.CountCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.CountCompaniesRequest; import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; @@ -29,7 +28,6 @@ import com.schematic.api.resources.companies.requests.GetActiveCompanySubscriptionRequest; import com.schematic.api.resources.companies.requests.GetEntityTraitValuesRequest; import com.schematic.api.resources.companies.requests.GetOrCreateCompanyMembershipRequestBody; -import com.schematic.api.resources.companies.requests.ListCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.ListCompaniesRequest; import com.schematic.api.resources.companies.requests.ListCompanyMembershipsRequest; import com.schematic.api.resources.companies.requests.ListEntityKeyDefinitionsRequest; @@ -42,7 +40,6 @@ import com.schematic.api.resources.companies.requests.UpdateEntityTraitDefinitionRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitBulkRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitRequestBody; -import com.schematic.api.resources.companies.types.CountCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.CountCompaniesResponse; import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; @@ -66,7 +63,6 @@ import com.schematic.api.resources.companies.types.GetPlanChangeResponse; import com.schematic.api.resources.companies.types.GetPlanTraitResponse; import com.schematic.api.resources.companies.types.GetUserResponse; -import com.schematic.api.resources.companies.types.ListCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.ListCompaniesResponse; import com.schematic.api.resources.companies.types.ListCompanyMembershipsResponse; import com.schematic.api.resources.companies.types.ListEntityKeyDefinitionsResponse; @@ -112,6 +108,11 @@ public CompletableFuture> listC return listCompanies(ListCompaniesRequest.builder().build()); } + public CompletableFuture> listCompanies( + RequestOptions requestOptions) { + return listCompanies(ListCompaniesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCompanies( ListCompaniesRequest request) { return listCompanies(request, null); @@ -133,6 +134,10 @@ public CompletableFuture> listC 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); } @@ -147,6 +152,13 @@ public CompletableFuture> listC request.getSortOrderDirection().get(), false); } + if (request.getWithEntitlementFor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "with_entitlement_for", + request.getWithEntitlementFor().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -202,6 +214,11 @@ public CompletableFuture> listC request.getSubscriptionTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -217,13 +234,13 @@ public CompletableFuture> listC @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCompaniesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompaniesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -255,11 +272,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -281,10 +296,14 @@ public CompletableFuture> upser public CompletableFuture> upsertCompany( UpsertCompanyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("companies") - .build(); + .addPathSegments("companies"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -293,7 +312,7 @@ public CompletableFuture> upser throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -308,13 +327,13 @@ public CompletableFuture> upser @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertCompanyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -346,11 +365,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -371,13 +388,17 @@ public CompletableFuture> getCompa public CompletableFuture> getCompany( String companyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) - .build(); + .addPathSegment(companyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -391,13 +412,13 @@ public CompletableFuture> getCompa @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCompanyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -424,11 +445,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -447,6 +466,11 @@ public CompletableFuture> delet return deleteCompany(companyId, DeleteCompanyRequest.builder().build()); } + public CompletableFuture> deleteCompany( + String companyId, RequestOptions requestOptions) { + return deleteCompany(companyId, DeleteCompanyRequest.builder().build(), requestOptions); + } + public CompletableFuture> deleteCompany( String companyId, DeleteCompanyRequest request) { return deleteCompany(companyId, request, null); @@ -469,6 +493,11 @@ public CompletableFuture> delet QueryStringMapper.addQueryParameter( httpUrl, "prorate", request.getProrate().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("DELETE", null) @@ -484,13 +513,13 @@ public CompletableFuture> delet @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteCompanyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -522,11 +551,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -545,6 +572,11 @@ public CompletableFuture> coun return countCompanies(CountCompaniesRequest.builder().build()); } + public CompletableFuture> countCompanies( + RequestOptions requestOptions) { + return countCompanies(CountCompaniesRequest.builder().build(), requestOptions); + } + public CompletableFuture> countCompanies( CountCompaniesRequest request) { return countCompanies(request, null); @@ -566,6 +598,10 @@ public CompletableFuture> coun 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); } @@ -580,6 +616,13 @@ public CompletableFuture> coun request.getSortOrderDirection().get(), false); } + if (request.getWithEntitlementFor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "with_entitlement_for", + request.getWithEntitlementFor().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -635,6 +678,11 @@ public CompletableFuture> coun request.getSubscriptionTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -650,181 +698,13 @@ public CompletableFuture> coun @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(), CountCompaniesResponse.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> - countCompaniesForAdvancedFilter() { - return countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest.builder().build()); - } - - public CompletableFuture> - countCompaniesForAdvancedFilter(CountCompaniesForAdvancedFilterRequest request) { - return countCompaniesForAdvancedFilter(request, null); - } - - public CompletableFuture> - countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("companies/count2"); - if (request.getMonetizedSubscriptions().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "monetized_subscriptions", - request.getMonetizedSubscriptions().get(), - false); - } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getWithoutPlan().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_plan", request.getWithoutPlan().get(), false); - } - if (request.getWithoutSubscription().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "without_subscription", - request.getWithoutSubscription().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.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getOffset().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "offset", request.getOffset().get(), false); - } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } - if (request.getPlanIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_ids", request.getPlanIds().get(), true); - } - if (request.getFeatureIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "feature_ids", request.getFeatureIds().get(), true); - } - if (request.getCreditTypeIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "credit_type_ids", request.getCreditTypeIds().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); - } - if (request.getDisplayProperties().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "display_properties", - request.getDisplayProperties().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(), CountCompaniesForAdvancedFilterResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCompaniesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -856,11 +736,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -882,10 +760,14 @@ public CompletableFuture> creat public CompletableFuture> createCompany( UpsertCompanyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("companies/create") - .build(); + .addPathSegments("companies/create"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -894,7 +776,7 @@ public CompletableFuture> creat throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -909,105 +791,13 @@ public CompletableFuture> creat @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(), CreateCompanyResponse.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> deleteCompanyByKeys( - KeysRequestBody request) { - return deleteCompanyByKeys(request, null); - } - - public CompletableFuture> deleteCompanyByKeys( - KeysRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("companies/delete") - .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(), DeleteCompanyByKeysResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1031,150 +821,77 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO 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> - listCompaniesForAdvancedFilter() { - return listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest.builder().build()); - } - - public CompletableFuture> - listCompaniesForAdvancedFilter(ListCompaniesForAdvancedFilterRequest request) { - return listCompaniesForAdvancedFilter(request, null); - } - - public CompletableFuture> - listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("companies/list2"); - if (request.getMonetizedSubscriptions().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "monetized_subscriptions", - request.getMonetizedSubscriptions().get(), - false); - } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getWithoutPlan().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_plan", request.getWithoutPlan().get(), false); - } - if (request.getWithoutSubscription().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "without_subscription", - request.getWithoutSubscription().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.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getOffset().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "offset", request.getOffset().get(), false); - } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } - if (request.getPlanIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_ids", request.getPlanIds().get(), true); - } - if (request.getFeatureIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "feature_ids", request.getFeatureIds().get(), true); - } - if (request.getCreditTypeIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "credit_type_ids", request.getCreditTypeIds().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); + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deleteCompanyByKeys( + KeysRequestBody request) { + return deleteCompanyByKeys(request, null); + } + + public CompletableFuture> deleteCompanyByKeys( + KeysRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("companies/delete"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } - if (request.getDisplayProperties().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "display_properties", - request.getDisplayProperties().get(), - true); + 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.Builder _requestBuilder = new Request.Builder() + Request okhttpRequest = new Request.Builder() .url(httpUrl.build()) - .method("GET", null) + .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); + .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<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCompaniesForAdvancedFilterResponse.class), + responseBodyString, DeleteCompanyByKeysResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1206,11 +923,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1225,17 +940,40 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public CompletableFuture> lookupCompany( LookupCompanyRequest request) { return lookupCompany(request, null); } + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public CompletableFuture> lookupCompany( LookupCompanyRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies/lookup"); QueryStringMapper.addQueryParameter(httpUrl, "keys", request.getKeys(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1251,13 +989,13 @@ public CompletableFuture> looku @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LookupCompanyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LookupCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1284,11 +1022,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1307,6 +1043,11 @@ public CompletableFuture> listCompanyMemberships( + RequestOptions requestOptions) { + return listCompanyMemberships(ListCompanyMembershipsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCompanyMemberships( ListCompanyMembershipsRequest request) { return listCompanyMemberships(request, null); @@ -1333,6 +1074,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1348,14 +1094,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCompanyMembershipsResponse.class), + responseBodyString, ListCompanyMembershipsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1387,11 +1133,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1414,10 +1158,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { public CompletableFuture> getOrCreateCompanyMembership( GetOrCreateCompanyMembershipRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("company-memberships") - .build(); + .addPathSegments("company-memberships"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1426,7 +1174,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1442,14 +1190,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetOrCreateCompanyMembershipResponse.class), + responseBodyString, GetOrCreateCompanyMembershipResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1481,11 +1229,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1507,13 +1253,17 @@ public CompletableFuture> deleteCompanyMembership( String companyMembershipId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-memberships") - .addPathSegment(companyMembershipId) - .build(); + .addPathSegment(companyMembershipId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1528,14 +1278,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteCompanyMembershipResponse.class), + responseBodyString, DeleteCompanyMembershipResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1567,11 +1317,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1592,6 +1340,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { GetActiveCompanySubscriptionRequest.builder().build()); } + public CompletableFuture> + getActiveCompanySubscription(RequestOptions requestOptions) { + return getActiveCompanySubscription( + GetActiveCompanySubscriptionRequest.builder().build(), requestOptions); + } + public CompletableFuture> getActiveCompanySubscription(GetActiveCompanySubscriptionRequest request) { return getActiveCompanySubscription(request, null); @@ -1618,6 +1372,11 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1634,14 +1393,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetActiveCompanySubscriptionResponse.class), + responseBodyString, GetActiveCompanySubscriptionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1673,11 +1432,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1699,10 +1456,14 @@ public CompletableFuture> public CompletableFuture> upsertCompanyTrait( UpsertTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("company-traits") - .build(); + .addPathSegments("company-traits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1711,7 +1472,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1726,14 +1487,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertCompanyTraitResponse.class), + responseBodyString, UpsertCompanyTraitResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1765,11 +1526,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1789,6 +1548,12 @@ public CompletableFuture> listEntityKeyDefinitions( + RequestOptions requestOptions) { + return listEntityKeyDefinitions( + ListEntityKeyDefinitionsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listEntityKeyDefinitions( ListEntityKeyDefinitionsRequest request) { return listEntityKeyDefinitions(request, null); @@ -1817,6 +1582,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1833,14 +1603,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListEntityKeyDefinitionsResponse.class), + responseBodyString, ListEntityKeyDefinitionsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1872,11 +1642,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1896,6 +1664,12 @@ public CompletableFuture> countEntityKeyDefinitions( + RequestOptions requestOptions) { + return countEntityKeyDefinitions( + CountEntityKeyDefinitionsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countEntityKeyDefinitions( CountEntityKeyDefinitionsRequest request) { return countEntityKeyDefinitions(request, null); @@ -1924,6 +1698,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1940,14 +1719,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountEntityKeyDefinitionsResponse.class), + responseBodyString, CountEntityKeyDefinitionsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1979,11 +1758,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2004,6 +1781,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { ListEntityTraitDefinitionsRequest.builder().build()); } + public CompletableFuture> listEntityTraitDefinitions( + RequestOptions requestOptions) { + return listEntityTraitDefinitions( + ListEntityTraitDefinitionsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listEntityTraitDefinitions( ListEntityTraitDefinitionsRequest request) { return listEntityTraitDefinitions(request, null); @@ -2040,6 +1823,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2056,14 +1844,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListEntityTraitDefinitionsResponse.class), + responseBodyString, ListEntityTraitDefinitionsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2095,11 +1883,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2122,10 +1908,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { public CompletableFuture> getOrCreateEntityTraitDefinition( CreateEntityTraitDefinitionRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("entity-trait-definitions") - .build(); + .addPathSegments("entity-trait-definitions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2134,7 +1924,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2150,14 +1940,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetOrCreateEntityTraitDefinitionResponse.class), + responseBodyString, GetOrCreateEntityTraitDefinitionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2189,11 +1979,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2215,13 +2003,17 @@ public CompletableFuture> getEntityTraitDefinition( String entityTraitDefinitionId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId) - .build(); + .addPathSegment(entityTraitDefinitionId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2236,14 +2028,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEntityTraitDefinitionResponse.class), + responseBodyString, GetEntityTraitDefinitionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -2270,11 +2062,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2300,11 +2090,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { String entityTraitDefinitionId, UpdateEntityTraitDefinitionRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId) - .build(); + .addPathSegment(entityTraitDefinitionId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2313,7 +2107,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2329,14 +2123,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateEntityTraitDefinitionResponse.class), + responseBodyString, UpdateEntityTraitDefinitionResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2368,11 +2162,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2393,6 +2185,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { CountEntityTraitDefinitionsRequest.builder().build()); } + public CompletableFuture> + countEntityTraitDefinitions(RequestOptions requestOptions) { + return countEntityTraitDefinitions( + CountEntityTraitDefinitionsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countEntityTraitDefinitions(CountEntityTraitDefinitionsRequest request) { return countEntityTraitDefinitions(request, null); @@ -2429,6 +2227,11 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "trait_types", request.getTraitTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2445,14 +2248,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountEntityTraitDefinitionsResponse.class), + responseBodyString, CountEntityTraitDefinitionsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2484,11 +2287,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2525,6 +2326,11 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2540,14 +2346,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEntityTraitValuesResponse.class), + responseBodyString, GetEntityTraitValuesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2579,11 +2385,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2602,6 +2406,11 @@ public CompletableFuture> lis return listPlanChanges(ListPlanChangesRequest.builder().build()); } + public CompletableFuture> listPlanChanges( + RequestOptions requestOptions) { + return listPlanChanges(ListPlanChangesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listPlanChanges( ListPlanChangesRequest request) { return listPlanChanges(request, null); @@ -2640,6 +2449,11 @@ public CompletableFuture> lis QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2655,14 +2469,13 @@ public CompletableFuture> lis @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListPlanChangesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanChangesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2694,11 +2507,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2719,13 +2530,17 @@ public CompletableFuture> getPl public CompletableFuture> getPlanChange( String planChangeId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-changes") - .addPathSegment(planChangeId) - .build(); + .addPathSegment(planChangeId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2739,13 +2554,13 @@ public CompletableFuture> getPl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanChangeResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanChangeResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -2772,11 +2587,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2795,6 +2608,11 @@ public CompletableFuture> list return listPlanTraits(ListPlanTraitsRequest.builder().build()); } + public CompletableFuture> listPlanTraits( + RequestOptions requestOptions) { + return listPlanTraits(ListPlanTraitsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listPlanTraits( ListPlanTraitsRequest request) { return listPlanTraits(request, null); @@ -2828,6 +2646,11 @@ public CompletableFuture> list QueryStringMapper.addQueryParameter( httpUrl, "trait_ids", request.getTraitIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2843,14 +2666,13 @@ public CompletableFuture> list @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListPlanTraitsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanTraitsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2882,11 +2704,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2908,10 +2728,14 @@ public CompletableFuture> cre public CompletableFuture> createPlanTrait( CreatePlanTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-traits") - .build(); + .addPathSegments("plan-traits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2920,7 +2744,7 @@ public CompletableFuture> cre throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2935,14 +2759,13 @@ public CompletableFuture> cre @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreatePlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanTraitResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2974,11 +2797,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2999,13 +2820,17 @@ public CompletableFuture> getPla public CompletableFuture> getPlanTrait( String planTraitId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId) - .build(); + .addPathSegment(planTraitId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -3019,13 +2844,13 @@ public CompletableFuture> getPla @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanTraitResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -3052,11 +2877,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3078,11 +2901,15 @@ public CompletableFuture> upd public CompletableFuture> updatePlanTrait( String planTraitId, UpdatePlanTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId) - .build(); + .addPathSegment(planTraitId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -3091,7 +2918,7 @@ public CompletableFuture> upd throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -3106,14 +2933,13 @@ public CompletableFuture> upd @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdatePlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanTraitResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3145,11 +2971,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3170,13 +2994,17 @@ public CompletableFuture> del public CompletableFuture> deletePlanTrait( String planTraitId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId) - .build(); + .addPathSegment(planTraitId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -3190,14 +3018,13 @@ public CompletableFuture> del @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeletePlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlanTraitResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3229,11 +3056,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3255,10 +3080,14 @@ public CompletableFuture public CompletableFuture> updatePlanTraitsBulk( UpdatePlanTraitBulkRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-traits/bulk") - .build(); + .addPathSegments("plan-traits/bulk"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -3267,7 +3096,7 @@ public CompletableFuture throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -3282,14 +3111,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdatePlanTraitsBulkResponse.class), + responseBodyString, UpdatePlanTraitsBulkResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3321,11 +3150,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3344,6 +3171,11 @@ public CompletableFuture> cou return countPlanTraits(CountPlanTraitsRequest.builder().build()); } + public CompletableFuture> countPlanTraits( + RequestOptions requestOptions) { + return countPlanTraits(CountPlanTraitsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countPlanTraits( CountPlanTraitsRequest request) { return countPlanTraits(request, null); @@ -3377,6 +3209,11 @@ public CompletableFuture> cou QueryStringMapper.addQueryParameter( httpUrl, "trait_ids", request.getTraitIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -3392,14 +3229,13 @@ public CompletableFuture> cou @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountPlanTraitsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountPlanTraitsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3431,11 +3267,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3457,10 +3291,14 @@ public CompletableFuture> ups public CompletableFuture> upsertUserTrait( UpsertTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("user-traits") - .build(); + .addPathSegments("user-traits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -3469,7 +3307,7 @@ public CompletableFuture> ups throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -3484,14 +3322,13 @@ public CompletableFuture> ups @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertUserTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertUserTraitResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3523,11 +3360,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3546,6 +3381,10 @@ public CompletableFuture> listUsers return listUsers(ListUsersRequest.builder().build()); } + public CompletableFuture> listUsers(RequestOptions requestOptions) { + return listUsers(ListUsersRequest.builder().build(), requestOptions); + } + public CompletableFuture> listUsers(ListUsersRequest request) { return listUsers(request, null); } @@ -3577,6 +3416,11 @@ public CompletableFuture> listUsers if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -3592,13 +3436,13 @@ public CompletableFuture> listUsers @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListUsersResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3630,11 +3474,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3655,10 +3497,14 @@ public CompletableFuture> upsertUs public CompletableFuture> upsertUser( UpsertUserRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("users") - .build(); + .addPathSegments("users"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -3667,7 +3513,7 @@ public CompletableFuture> upsertUs throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -3682,13 +3528,13 @@ public CompletableFuture> upsertUs @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertUserResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertUserResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3720,11 +3566,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3745,13 +3589,17 @@ public CompletableFuture> getUser(Str public CompletableFuture> getUser( String userId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId) - .build(); + .addPathSegment(userId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -3765,13 +3613,13 @@ public CompletableFuture> getUser( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetUserResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetUserResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -3798,11 +3646,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3823,13 +3669,17 @@ public CompletableFuture> deleteUs public CompletableFuture> deleteUser( String userId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId) - .build(); + .addPathSegment(userId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -3843,13 +3693,13 @@ public CompletableFuture> deleteUs @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteUserResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteUserResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3881,11 +3731,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -3904,6 +3752,10 @@ public CompletableFuture> countUse return countUsers(CountUsersRequest.builder().build()); } + public CompletableFuture> countUsers(RequestOptions requestOptions) { + return countUsers(CountUsersRequest.builder().build(), requestOptions); + } + public CompletableFuture> countUsers(CountUsersRequest request) { return countUsers(request, null); } @@ -3935,6 +3787,11 @@ public CompletableFuture> countUse if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -3950,13 +3807,13 @@ public CompletableFuture> countUse @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountUsersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountUsersResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3988,11 +3845,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -4013,10 +3868,14 @@ public CompletableFuture> createUs public CompletableFuture> createUser( UpsertUserRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("users/create") - .build(); + .addPathSegments("users/create"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -4025,7 +3884,7 @@ public CompletableFuture> createUs throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -4040,13 +3899,13 @@ public CompletableFuture> createUs @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateUserResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateUserResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -4078,11 +3937,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -4104,10 +3961,14 @@ public CompletableFuture> de public CompletableFuture> deleteUserByKeys( KeysRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("users/delete") - .build(); + .addPathSegments("users/delete"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -4116,7 +3977,7 @@ public CompletableFuture> de throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -4131,14 +3992,13 @@ public CompletableFuture> de @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteUserByKeysResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteUserByKeysResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -4170,11 +4030,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -4199,6 +4057,11 @@ public CompletableFuture> lookupUs .newBuilder() .addPathSegments("users/lookup"); QueryStringMapper.addQueryParameter(httpUrl, "keys", request.getKeys(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -4214,13 +4077,13 @@ public CompletableFuture> lookupUs @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LookupUserResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LookupUserResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -4247,11 +4110,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java index 21a029c..691f909 100644 --- a/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/CompaniesClient.java @@ -5,7 +5,6 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; -import com.schematic.api.resources.companies.requests.CountCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.CountCompaniesRequest; import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; @@ -17,7 +16,6 @@ import com.schematic.api.resources.companies.requests.GetActiveCompanySubscriptionRequest; import com.schematic.api.resources.companies.requests.GetEntityTraitValuesRequest; import com.schematic.api.resources.companies.requests.GetOrCreateCompanyMembershipRequestBody; -import com.schematic.api.resources.companies.requests.ListCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.ListCompaniesRequest; import com.schematic.api.resources.companies.requests.ListCompanyMembershipsRequest; import com.schematic.api.resources.companies.requests.ListEntityKeyDefinitionsRequest; @@ -30,7 +28,6 @@ import com.schematic.api.resources.companies.requests.UpdateEntityTraitDefinitionRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitBulkRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitRequestBody; -import com.schematic.api.resources.companies.types.CountCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.CountCompaniesResponse; import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; @@ -54,7 +51,6 @@ import com.schematic.api.resources.companies.types.GetPlanChangeResponse; import com.schematic.api.resources.companies.types.GetPlanTraitResponse; import com.schematic.api.resources.companies.types.GetUserResponse; -import com.schematic.api.resources.companies.types.ListCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.ListCompaniesResponse; import com.schematic.api.resources.companies.types.ListCompanyMembershipsResponse; import com.schematic.api.resources.companies.types.ListEntityKeyDefinitionsResponse; @@ -97,6 +93,10 @@ public ListCompaniesResponse listCompanies() { return this.rawClient.listCompanies().body(); } + public ListCompaniesResponse listCompanies(RequestOptions requestOptions) { + return this.rawClient.listCompanies(requestOptions).body(); + } + public ListCompaniesResponse listCompanies(ListCompaniesRequest request) { return this.rawClient.listCompanies(request).body(); } @@ -125,6 +125,10 @@ public DeleteCompanyResponse deleteCompany(String companyId) { return this.rawClient.deleteCompany(companyId).body(); } + public DeleteCompanyResponse deleteCompany(String companyId, RequestOptions requestOptions) { + return this.rawClient.deleteCompany(companyId, requestOptions).body(); + } + public DeleteCompanyResponse deleteCompany(String companyId, DeleteCompanyRequest request) { return this.rawClient.deleteCompany(companyId, request).body(); } @@ -138,6 +142,10 @@ public CountCompaniesResponse countCompanies() { return this.rawClient.countCompanies().body(); } + public CountCompaniesResponse countCompanies(RequestOptions requestOptions) { + return this.rawClient.countCompanies(requestOptions).body(); + } + public CountCompaniesResponse countCompanies(CountCompaniesRequest request) { return this.rawClient.countCompanies(request).body(); } @@ -146,22 +154,6 @@ public CountCompaniesResponse countCompanies(CountCompaniesRequest request, Requ return this.rawClient.countCompanies(request, requestOptions).body(); } - public CountCompaniesForAdvancedFilterResponse countCompaniesForAdvancedFilter() { - return this.rawClient.countCompaniesForAdvancedFilter().body(); - } - - public CountCompaniesForAdvancedFilterResponse countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request) { - return this.rawClient.countCompaniesForAdvancedFilter(request).body(); - } - - public CountCompaniesForAdvancedFilterResponse countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - return this.rawClient - .countCompaniesForAdvancedFilter(request, requestOptions) - .body(); - } - public CreateCompanyResponse createCompany(UpsertCompanyRequestBody request) { return this.rawClient.createCompany(request).body(); } @@ -178,26 +170,28 @@ public DeleteCompanyByKeysResponse deleteCompanyByKeys(KeysRequestBody request, return this.rawClient.deleteCompanyByKeys(request, requestOptions).body(); } - public ListCompaniesForAdvancedFilterResponse listCompaniesForAdvancedFilter() { - return this.rawClient.listCompaniesForAdvancedFilter().body(); - } - - public ListCompaniesForAdvancedFilterResponse listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request) { - return this.rawClient.listCompaniesForAdvancedFilter(request).body(); - } - - public ListCompaniesForAdvancedFilterResponse listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - return this.rawClient - .listCompaniesForAdvancedFilter(request, requestOptions) - .body(); - } - + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public LookupCompanyResponse lookupCompany(LookupCompanyRequest request) { return this.rawClient.lookupCompany(request).body(); } + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public LookupCompanyResponse lookupCompany(LookupCompanyRequest request, RequestOptions requestOptions) { return this.rawClient.lookupCompany(request, requestOptions).body(); } @@ -206,6 +200,10 @@ public ListCompanyMembershipsResponse listCompanyMemberships() { return this.rawClient.listCompanyMemberships().body(); } + public ListCompanyMembershipsResponse listCompanyMemberships(RequestOptions requestOptions) { + return this.rawClient.listCompanyMemberships(requestOptions).body(); + } + public ListCompanyMembershipsResponse listCompanyMemberships(ListCompanyMembershipsRequest request) { return this.rawClient.listCompanyMemberships(request).body(); } @@ -242,6 +240,10 @@ public GetActiveCompanySubscriptionResponse getActiveCompanySubscription() { return this.rawClient.getActiveCompanySubscription().body(); } + public GetActiveCompanySubscriptionResponse getActiveCompanySubscription(RequestOptions requestOptions) { + return this.rawClient.getActiveCompanySubscription(requestOptions).body(); + } + public GetActiveCompanySubscriptionResponse getActiveCompanySubscription( GetActiveCompanySubscriptionRequest request) { return this.rawClient.getActiveCompanySubscription(request).body(); @@ -267,6 +269,10 @@ public ListEntityKeyDefinitionsResponse listEntityKeyDefinitions() { return this.rawClient.listEntityKeyDefinitions().body(); } + public ListEntityKeyDefinitionsResponse listEntityKeyDefinitions(RequestOptions requestOptions) { + return this.rawClient.listEntityKeyDefinitions(requestOptions).body(); + } + public ListEntityKeyDefinitionsResponse listEntityKeyDefinitions(ListEntityKeyDefinitionsRequest request) { return this.rawClient.listEntityKeyDefinitions(request).body(); } @@ -280,6 +286,10 @@ public CountEntityKeyDefinitionsResponse countEntityKeyDefinitions() { return this.rawClient.countEntityKeyDefinitions().body(); } + public CountEntityKeyDefinitionsResponse countEntityKeyDefinitions(RequestOptions requestOptions) { + return this.rawClient.countEntityKeyDefinitions(requestOptions).body(); + } + public CountEntityKeyDefinitionsResponse countEntityKeyDefinitions(CountEntityKeyDefinitionsRequest request) { return this.rawClient.countEntityKeyDefinitions(request).body(); } @@ -293,6 +303,10 @@ public ListEntityTraitDefinitionsResponse listEntityTraitDefinitions() { return this.rawClient.listEntityTraitDefinitions().body(); } + public ListEntityTraitDefinitionsResponse listEntityTraitDefinitions(RequestOptions requestOptions) { + return this.rawClient.listEntityTraitDefinitions(requestOptions).body(); + } + public ListEntityTraitDefinitionsResponse listEntityTraitDefinitions(ListEntityTraitDefinitionsRequest request) { return this.rawClient.listEntityTraitDefinitions(request).body(); } @@ -347,6 +361,10 @@ public CountEntityTraitDefinitionsResponse countEntityTraitDefinitions() { return this.rawClient.countEntityTraitDefinitions().body(); } + public CountEntityTraitDefinitionsResponse countEntityTraitDefinitions(RequestOptions requestOptions) { + return this.rawClient.countEntityTraitDefinitions(requestOptions).body(); + } + public CountEntityTraitDefinitionsResponse countEntityTraitDefinitions(CountEntityTraitDefinitionsRequest request) { return this.rawClient.countEntityTraitDefinitions(request).body(); } @@ -371,6 +389,10 @@ public ListPlanChangesResponse listPlanChanges() { return this.rawClient.listPlanChanges().body(); } + public ListPlanChangesResponse listPlanChanges(RequestOptions requestOptions) { + return this.rawClient.listPlanChanges(requestOptions).body(); + } + public ListPlanChangesResponse listPlanChanges(ListPlanChangesRequest request) { return this.rawClient.listPlanChanges(request).body(); } @@ -391,6 +413,10 @@ public ListPlanTraitsResponse listPlanTraits() { return this.rawClient.listPlanTraits().body(); } + public ListPlanTraitsResponse listPlanTraits(RequestOptions requestOptions) { + return this.rawClient.listPlanTraits(requestOptions).body(); + } + public ListPlanTraitsResponse listPlanTraits(ListPlanTraitsRequest request) { return this.rawClient.listPlanTraits(request).body(); } @@ -447,6 +473,10 @@ public CountPlanTraitsResponse countPlanTraits() { return this.rawClient.countPlanTraits().body(); } + public CountPlanTraitsResponse countPlanTraits(RequestOptions requestOptions) { + return this.rawClient.countPlanTraits(requestOptions).body(); + } + public CountPlanTraitsResponse countPlanTraits(CountPlanTraitsRequest request) { return this.rawClient.countPlanTraits(request).body(); } @@ -467,6 +497,10 @@ public ListUsersResponse listUsers() { return this.rawClient.listUsers().body(); } + public ListUsersResponse listUsers(RequestOptions requestOptions) { + return this.rawClient.listUsers(requestOptions).body(); + } + public ListUsersResponse listUsers(ListUsersRequest request) { return this.rawClient.listUsers(request).body(); } @@ -503,6 +537,10 @@ public CountUsersResponse countUsers() { return this.rawClient.countUsers().body(); } + public CountUsersResponse countUsers(RequestOptions requestOptions) { + return this.rawClient.countUsers(requestOptions).body(); + } + public CountUsersResponse countUsers(CountUsersRequest request) { return this.rawClient.countUsers(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java index 5040499..a373c48 100644 --- a/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java +++ b/src/main/java/com/schematic/api/resources/companies/RawCompaniesClient.java @@ -17,7 +17,6 @@ import com.schematic.api.errors.InternalServerError; import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; -import com.schematic.api.resources.companies.requests.CountCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.CountCompaniesRequest; import com.schematic.api.resources.companies.requests.CountEntityKeyDefinitionsRequest; import com.schematic.api.resources.companies.requests.CountEntityTraitDefinitionsRequest; @@ -29,7 +28,6 @@ import com.schematic.api.resources.companies.requests.GetActiveCompanySubscriptionRequest; import com.schematic.api.resources.companies.requests.GetEntityTraitValuesRequest; import com.schematic.api.resources.companies.requests.GetOrCreateCompanyMembershipRequestBody; -import com.schematic.api.resources.companies.requests.ListCompaniesForAdvancedFilterRequest; import com.schematic.api.resources.companies.requests.ListCompaniesRequest; import com.schematic.api.resources.companies.requests.ListCompanyMembershipsRequest; import com.schematic.api.resources.companies.requests.ListEntityKeyDefinitionsRequest; @@ -42,7 +40,6 @@ import com.schematic.api.resources.companies.requests.UpdateEntityTraitDefinitionRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitBulkRequestBody; import com.schematic.api.resources.companies.requests.UpdatePlanTraitRequestBody; -import com.schematic.api.resources.companies.types.CountCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.CountCompaniesResponse; import com.schematic.api.resources.companies.types.CountEntityKeyDefinitionsResponse; import com.schematic.api.resources.companies.types.CountEntityTraitDefinitionsResponse; @@ -66,7 +63,6 @@ import com.schematic.api.resources.companies.types.GetPlanChangeResponse; import com.schematic.api.resources.companies.types.GetPlanTraitResponse; import com.schematic.api.resources.companies.types.GetUserResponse; -import com.schematic.api.resources.companies.types.ListCompaniesForAdvancedFilterResponse; import com.schematic.api.resources.companies.types.ListCompaniesResponse; import com.schematic.api.resources.companies.types.ListCompanyMembershipsResponse; import com.schematic.api.resources.companies.types.ListEntityKeyDefinitionsResponse; @@ -108,6 +104,10 @@ public BaseSchematicHttpResponse listCompanies() { return listCompanies(ListCompaniesRequest.builder().build()); } + public BaseSchematicHttpResponse listCompanies(RequestOptions requestOptions) { + return listCompanies(ListCompaniesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCompanies(ListCompaniesRequest request) { return listCompanies(request, null); } @@ -128,6 +128,10 @@ public BaseSchematicHttpResponse listCompanies( 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); } @@ -142,6 +146,13 @@ public BaseSchematicHttpResponse listCompanies( request.getSortOrderDirection().get(), false); } + if (request.getWithEntitlementFor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "with_entitlement_for", + request.getWithEntitlementFor().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -197,6 +208,11 @@ public BaseSchematicHttpResponse listCompanies( request.getSubscriptionTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -209,12 +225,11 @@ public BaseSchematicHttpResponse listCompanies( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCompaniesResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompaniesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -236,11 +251,9 @@ public BaseSchematicHttpResponse listCompanies( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -252,10 +265,14 @@ public BaseSchematicHttpResponse upsertCompany(UpsertComp public BaseSchematicHttpResponse upsertCompany( UpsertCompanyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("companies") - .build(); + .addPathSegments("companies"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -264,7 +281,7 @@ public BaseSchematicHttpResponse upsertCompany( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -276,12 +293,11 @@ public BaseSchematicHttpResponse upsertCompany( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertCompanyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -303,11 +319,9 @@ public BaseSchematicHttpResponse upsertCompany( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -318,13 +332,17 @@ public BaseSchematicHttpResponse getCompany(String companyId } public BaseSchematicHttpResponse getCompany(String companyId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies") - .addPathSegment(companyId) - .build(); + .addPathSegment(companyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -335,11 +353,11 @@ public BaseSchematicHttpResponse getCompany(String companyId } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCompanyResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -358,11 +376,9 @@ public BaseSchematicHttpResponse getCompany(String companyId } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -372,6 +388,11 @@ public BaseSchematicHttpResponse deleteCompany(String com return deleteCompany(companyId, DeleteCompanyRequest.builder().build()); } + public BaseSchematicHttpResponse deleteCompany( + String companyId, RequestOptions requestOptions) { + return deleteCompany(companyId, DeleteCompanyRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse deleteCompany( String companyId, DeleteCompanyRequest request) { return deleteCompany(companyId, request, null); @@ -394,6 +415,11 @@ public BaseSchematicHttpResponse deleteCompany( QueryStringMapper.addQueryParameter( httpUrl, "prorate", request.getProrate().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("DELETE", null) @@ -406,12 +432,11 @@ public BaseSchematicHttpResponse deleteCompany( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteCompanyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -433,11 +458,9 @@ public BaseSchematicHttpResponse deleteCompany( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -447,6 +470,10 @@ public BaseSchematicHttpResponse countCompanies() { return countCompanies(CountCompaniesRequest.builder().build()); } + public BaseSchematicHttpResponse countCompanies(RequestOptions requestOptions) { + return countCompanies(CountCompaniesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countCompanies(CountCompaniesRequest request) { return countCompanies(request, null); } @@ -467,6 +494,10 @@ public BaseSchematicHttpResponse countCompanies( 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); } @@ -481,6 +512,13 @@ public BaseSchematicHttpResponse countCompanies( request.getSortOrderDirection().get(), false); } + if (request.getWithEntitlementFor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "with_entitlement_for", + request.getWithEntitlementFor().get(), + false); + } if (request.getWithoutFeatureOverrideFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -536,145 +574,10 @@ public BaseSchematicHttpResponse countCompanies( request.getSubscriptionTypes().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(), CountCompaniesResponse.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 countCompaniesForAdvancedFilter() { - return countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest.builder().build()); - } - - public BaseSchematicHttpResponse countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request) { - return countCompaniesForAdvancedFilter(request, null); - } - - public BaseSchematicHttpResponse countCompaniesForAdvancedFilter( - CountCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("companies/count2"); - if (request.getMonetizedSubscriptions().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "monetized_subscriptions", - request.getMonetizedSubscriptions().get(), - false); - } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getWithoutPlan().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_plan", request.getWithoutPlan().get(), false); - } - if (request.getWithoutSubscription().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "without_subscription", - request.getWithoutSubscription().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.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getOffset().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "offset", request.getOffset().get(), false); - } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } - if (request.getPlanIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_ids", request.getPlanIds().get(), true); - } - if (request.getFeatureIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "feature_ids", request.getFeatureIds().get(), true); - } - if (request.getCreditTypeIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "credit_type_ids", request.getCreditTypeIds().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); - } - if (request.getDisplayProperties().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "display_properties", - request.getDisplayProperties().get(), - true); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -688,13 +591,12 @@ public BaseSchematicHttpResponse countC } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountCompaniesForAdvancedFilterResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCompaniesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -716,11 +618,9 @@ public BaseSchematicHttpResponse countC } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -732,10 +632,14 @@ public BaseSchematicHttpResponse createCompany(UpsertComp public BaseSchematicHttpResponse createCompany( UpsertCompanyRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("companies/create") - .build(); + .addPathSegments("companies/create"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -744,7 +648,7 @@ public BaseSchematicHttpResponse createCompany( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -756,12 +660,11 @@ public BaseSchematicHttpResponse createCompany( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateCompanyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -783,11 +686,9 @@ public BaseSchematicHttpResponse createCompany( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -799,10 +700,14 @@ public BaseSchematicHttpResponse deleteCompanyByKey public BaseSchematicHttpResponse deleteCompanyByKeys( KeysRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("companies/delete") - .build(); + .addPathSegments("companies/delete"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -811,7 +716,7 @@ public BaseSchematicHttpResponse deleteCompanyByKey throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -823,153 +728,12 @@ public BaseSchematicHttpResponse deleteCompanyByKey } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteCompanyByKeysResponse.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 listCompaniesForAdvancedFilter() { - return listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest.builder().build()); - } - - public BaseSchematicHttpResponse listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request) { - return listCompaniesForAdvancedFilter(request, null); - } - - public BaseSchematicHttpResponse listCompaniesForAdvancedFilter( - ListCompaniesForAdvancedFilterRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("companies/list2"); - if (request.getMonetizedSubscriptions().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "monetized_subscriptions", - request.getMonetizedSubscriptions().get(), - false); - } - if (request.getQ().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); - } - if (request.getWithoutPlan().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "without_plan", request.getWithoutPlan().get(), false); - } - if (request.getWithoutSubscription().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "without_subscription", - request.getWithoutSubscription().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.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getOffset().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "offset", request.getOffset().get(), false); - } - if (request.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); - } - if (request.getPlanIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "plan_ids", request.getPlanIds().get(), true); - } - if (request.getFeatureIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "feature_ids", request.getFeatureIds().get(), true); - } - if (request.getCreditTypeIds().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "credit_type_ids", request.getCreditTypeIds().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); - } - if (request.getDisplayProperties().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, - "display_properties", - request.getDisplayProperties().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(), ListCompaniesForAdvancedFilterResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCompanyByKeysResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -991,26 +755,47 @@ public BaseSchematicHttpResponse listCom } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } } + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public BaseSchematicHttpResponse lookupCompany(LookupCompanyRequest request) { return lookupCompany(request, null); } + /** + * Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. + * The following approaches will all work to resolve a company and any of them are appropriate: + *
    + *
  1. /companies/lookup?keys={"foo": "bar", "fizz": "buzz"}
  2. + *
  3. /companies/lookup?keys[foo]=bar&keys[fizz]=buzz
  4. + *
  5. /companies/lookup?foo=bar&fizz=buzz
  6. + *
+ */ public BaseSchematicHttpResponse lookupCompany( LookupCompanyRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("companies/lookup"); QueryStringMapper.addQueryParameter(httpUrl, "keys", request.getKeys(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1023,12 +808,11 @@ public BaseSchematicHttpResponse lookupCompany( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LookupCompanyResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LookupCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1047,11 +831,9 @@ public BaseSchematicHttpResponse lookupCompany( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1061,6 +843,11 @@ public BaseSchematicHttpResponse listCompanyMemb return listCompanyMemberships(ListCompanyMembershipsRequest.builder().build()); } + public BaseSchematicHttpResponse listCompanyMemberships( + RequestOptions requestOptions) { + return listCompanyMemberships(ListCompanyMembershipsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCompanyMemberships( ListCompanyMembershipsRequest request) { return listCompanyMemberships(request, null); @@ -1087,6 +874,11 @@ public BaseSchematicHttpResponse listCompanyMemb QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1099,13 +891,12 @@ public BaseSchematicHttpResponse listCompanyMemb } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCompanyMembershipsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompanyMembershipsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1127,11 +918,9 @@ public BaseSchematicHttpResponse listCompanyMemb } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1144,10 +933,14 @@ public BaseSchematicHttpResponse getOrCrea public BaseSchematicHttpResponse getOrCreateCompanyMembership( GetOrCreateCompanyMembershipRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("company-memberships") - .build(); + .addPathSegments("company-memberships"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1156,7 +949,7 @@ public BaseSchematicHttpResponse getOrCrea throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1168,13 +961,13 @@ public BaseSchematicHttpResponse getOrCrea } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetOrCreateCompanyMembershipResponse.class), + responseBodyString, GetOrCreateCompanyMembershipResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1196,11 +989,9 @@ public BaseSchematicHttpResponse getOrCrea } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1213,13 +1004,17 @@ public BaseSchematicHttpResponse deleteCompanyM public BaseSchematicHttpResponse deleteCompanyMembership( String companyMembershipId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-memberships") - .addPathSegment(companyMembershipId) - .build(); + .addPathSegment(companyMembershipId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1230,13 +1025,12 @@ public BaseSchematicHttpResponse deleteCompanyM } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteCompanyMembershipResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCompanyMembershipResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1258,11 +1052,9 @@ public BaseSchematicHttpResponse deleteCompanyM } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1273,6 +1065,12 @@ public BaseSchematicHttpResponse getActive GetActiveCompanySubscriptionRequest.builder().build()); } + public BaseSchematicHttpResponse getActiveCompanySubscription( + RequestOptions requestOptions) { + return getActiveCompanySubscription( + GetActiveCompanySubscriptionRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse getActiveCompanySubscription( GetActiveCompanySubscriptionRequest request) { return getActiveCompanySubscription(request, null); @@ -1299,6 +1097,11 @@ public BaseSchematicHttpResponse getActive QueryStringMapper.addQueryParameter( httpUrl, "company_ids", request.getCompanyIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1311,13 +1114,13 @@ public BaseSchematicHttpResponse getActive } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetActiveCompanySubscriptionResponse.class), + responseBodyString, GetActiveCompanySubscriptionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1339,11 +1142,9 @@ public BaseSchematicHttpResponse getActive } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1355,10 +1156,14 @@ public BaseSchematicHttpResponse upsertCompanyTrait( public BaseSchematicHttpResponse upsertCompanyTrait( UpsertTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("company-traits") - .build(); + .addPathSegments("company-traits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1367,7 +1172,7 @@ public BaseSchematicHttpResponse upsertCompanyTrait( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1379,12 +1184,12 @@ public BaseSchematicHttpResponse upsertCompanyTrait( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertCompanyTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertCompanyTraitResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1406,11 +1211,9 @@ public BaseSchematicHttpResponse upsertCompanyTrait( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1421,6 +1224,12 @@ public BaseSchematicHttpResponse listEntityKey ListEntityKeyDefinitionsRequest.builder().build()); } + public BaseSchematicHttpResponse listEntityKeyDefinitions( + RequestOptions requestOptions) { + return listEntityKeyDefinitions( + ListEntityKeyDefinitionsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listEntityKeyDefinitions( ListEntityKeyDefinitionsRequest request) { return listEntityKeyDefinitions(request, null); @@ -1449,6 +1258,11 @@ public BaseSchematicHttpResponse listEntityKey if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1461,13 +1275,12 @@ public BaseSchematicHttpResponse listEntityKey } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListEntityKeyDefinitionsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEntityKeyDefinitionsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1489,11 +1302,9 @@ public BaseSchematicHttpResponse listEntityKey } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1504,6 +1315,12 @@ public BaseSchematicHttpResponse countEntityK CountEntityKeyDefinitionsRequest.builder().build()); } + public BaseSchematicHttpResponse countEntityKeyDefinitions( + RequestOptions requestOptions) { + return countEntityKeyDefinitions( + CountEntityKeyDefinitionsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countEntityKeyDefinitions( CountEntityKeyDefinitionsRequest request) { return countEntityKeyDefinitions(request, null); @@ -1532,6 +1349,11 @@ public BaseSchematicHttpResponse countEntityK if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1544,13 +1366,13 @@ public BaseSchematicHttpResponse countEntityK } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountEntityKeyDefinitionsResponse.class), + responseBodyString, CountEntityKeyDefinitionsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1572,11 +1394,9 @@ public BaseSchematicHttpResponse countEntityK } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1587,6 +1407,12 @@ public BaseSchematicHttpResponse listEntityT ListEntityTraitDefinitionsRequest.builder().build()); } + public BaseSchematicHttpResponse listEntityTraitDefinitions( + RequestOptions requestOptions) { + return listEntityTraitDefinitions( + ListEntityTraitDefinitionsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listEntityTraitDefinitions( ListEntityTraitDefinitionsRequest request) { return listEntityTraitDefinitions(request, null); @@ -1623,6 +1449,11 @@ public BaseSchematicHttpResponse listEntityT QueryStringMapper.addQueryParameter( httpUrl, "trait_types", request.getTraitTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1635,13 +1466,13 @@ public BaseSchematicHttpResponse listEntityT } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListEntityTraitDefinitionsResponse.class), + responseBodyString, ListEntityTraitDefinitionsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1663,11 +1494,9 @@ public BaseSchematicHttpResponse listEntityT } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1680,10 +1509,14 @@ public BaseSchematicHttpResponse getOr public BaseSchematicHttpResponse getOrCreateEntityTraitDefinition( CreateEntityTraitDefinitionRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("entity-trait-definitions") - .build(); + .addPathSegments("entity-trait-definitions"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1692,7 +1525,7 @@ public BaseSchematicHttpResponse getOr throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1704,13 +1537,13 @@ public BaseSchematicHttpResponse getOr } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetOrCreateEntityTraitDefinitionResponse.class), + responseBodyString, GetOrCreateEntityTraitDefinitionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1732,11 +1565,9 @@ public BaseSchematicHttpResponse getOr } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1749,13 +1580,17 @@ public BaseSchematicHttpResponse getEntityTrai public BaseSchematicHttpResponse getEntityTraitDefinition( String entityTraitDefinitionId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId) - .build(); + .addPathSegment(entityTraitDefinitionId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1766,13 +1601,12 @@ public BaseSchematicHttpResponse getEntityTrai } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEntityTraitDefinitionResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEntityTraitDefinitionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1791,11 +1625,9 @@ public BaseSchematicHttpResponse getEntityTrai } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1810,11 +1642,15 @@ public BaseSchematicHttpResponse updateEnti String entityTraitDefinitionId, UpdateEntityTraitDefinitionRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("entity-trait-definitions") - .addPathSegment(entityTraitDefinitionId) - .build(); + .addPathSegment(entityTraitDefinitionId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1823,7 +1659,7 @@ public BaseSchematicHttpResponse updateEnti throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1835,13 +1671,13 @@ public BaseSchematicHttpResponse updateEnti } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateEntityTraitDefinitionResponse.class), + responseBodyString, UpdateEntityTraitDefinitionResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1863,11 +1699,9 @@ public BaseSchematicHttpResponse updateEnti } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1878,6 +1712,12 @@ public BaseSchematicHttpResponse countEntit CountEntityTraitDefinitionsRequest.builder().build()); } + public BaseSchematicHttpResponse countEntityTraitDefinitions( + RequestOptions requestOptions) { + return countEntityTraitDefinitions( + CountEntityTraitDefinitionsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countEntityTraitDefinitions( CountEntityTraitDefinitionsRequest request) { return countEntityTraitDefinitions(request, null); @@ -1914,6 +1754,11 @@ public BaseSchematicHttpResponse countEntit QueryStringMapper.addQueryParameter( httpUrl, "trait_types", request.getTraitTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1926,13 +1771,13 @@ public BaseSchematicHttpResponse countEntit } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountEntityTraitDefinitionsResponse.class), + responseBodyString, CountEntityTraitDefinitionsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1954,11 +1799,9 @@ public BaseSchematicHttpResponse countEntit } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1986,6 +1829,11 @@ public BaseSchematicHttpResponse getEntityTraitVal QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1998,12 +1846,12 @@ public BaseSchematicHttpResponse getEntityTraitVal } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetEntityTraitValuesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEntityTraitValuesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2025,11 +1873,9 @@ public BaseSchematicHttpResponse getEntityTraitVal } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2039,6 +1885,10 @@ public BaseSchematicHttpResponse listPlanChanges() { return listPlanChanges(ListPlanChangesRequest.builder().build()); } + public BaseSchematicHttpResponse listPlanChanges(RequestOptions requestOptions) { + return listPlanChanges(ListPlanChangesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listPlanChanges(ListPlanChangesRequest request) { return listPlanChanges(request, null); } @@ -2076,6 +1926,11 @@ public BaseSchematicHttpResponse listPlanChanges( QueryStringMapper.addQueryParameter( httpUrl, "plan_ids", request.getPlanIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2088,12 +1943,12 @@ public BaseSchematicHttpResponse listPlanChanges( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPlanChangesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanChangesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2115,11 +1970,9 @@ public BaseSchematicHttpResponse listPlanChanges( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2131,13 +1984,17 @@ public BaseSchematicHttpResponse getPlanChange(String pla public BaseSchematicHttpResponse getPlanChange( String planChangeId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-changes") - .addPathSegment(planChangeId) - .build(); + .addPathSegment(planChangeId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2148,12 +2005,11 @@ public BaseSchematicHttpResponse getPlanChange( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanChangeResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanChangeResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -2172,11 +2028,9 @@ public BaseSchematicHttpResponse getPlanChange( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2186,6 +2040,10 @@ public BaseSchematicHttpResponse listPlanTraits() { return listPlanTraits(ListPlanTraitsRequest.builder().build()); } + public BaseSchematicHttpResponse listPlanTraits(RequestOptions requestOptions) { + return listPlanTraits(ListPlanTraitsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listPlanTraits(ListPlanTraitsRequest request) { return listPlanTraits(request, null); } @@ -2218,6 +2076,11 @@ public BaseSchematicHttpResponse listPlanTraits( QueryStringMapper.addQueryParameter( httpUrl, "trait_ids", request.getTraitIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2230,12 +2093,12 @@ public BaseSchematicHttpResponse listPlanTraits( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPlanTraitsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanTraitsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2257,11 +2120,9 @@ public BaseSchematicHttpResponse listPlanTraits( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2273,10 +2134,14 @@ public BaseSchematicHttpResponse createPlanTrait(Create public BaseSchematicHttpResponse createPlanTrait( CreatePlanTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-traits") - .build(); + .addPathSegments("plan-traits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2285,7 +2150,7 @@ public BaseSchematicHttpResponse createPlanTrait( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2297,12 +2162,12 @@ public BaseSchematicHttpResponse createPlanTrait( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanTraitResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2324,11 +2189,9 @@ public BaseSchematicHttpResponse createPlanTrait( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2340,13 +2203,17 @@ public BaseSchematicHttpResponse getPlanTrait(String planT public BaseSchematicHttpResponse getPlanTrait( String planTraitId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId) - .build(); + .addPathSegment(planTraitId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2357,12 +2224,11 @@ public BaseSchematicHttpResponse getPlanTrait( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanTraitResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanTraitResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -2381,11 +2247,9 @@ public BaseSchematicHttpResponse getPlanTrait( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2398,11 +2262,15 @@ public BaseSchematicHttpResponse updatePlanTrait( public BaseSchematicHttpResponse updatePlanTrait( String planTraitId, UpdatePlanTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId) - .build(); + .addPathSegment(planTraitId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2411,7 +2279,7 @@ public BaseSchematicHttpResponse updatePlanTrait( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2423,12 +2291,12 @@ public BaseSchematicHttpResponse updatePlanTrait( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanTraitResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2450,11 +2318,9 @@ public BaseSchematicHttpResponse updatePlanTrait( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2466,13 +2332,17 @@ public BaseSchematicHttpResponse deletePlanTrait(String public BaseSchematicHttpResponse deletePlanTrait( String planTraitId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-traits") - .addPathSegment(planTraitId) - .build(); + .addPathSegment(planTraitId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2483,12 +2353,12 @@ public BaseSchematicHttpResponse deletePlanTrait( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePlanTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlanTraitResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2510,11 +2380,9 @@ public BaseSchematicHttpResponse deletePlanTrait( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2527,10 +2395,14 @@ public BaseSchematicHttpResponse updatePlanTraitsB public BaseSchematicHttpResponse updatePlanTraitsBulk( UpdatePlanTraitBulkRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-traits/bulk") - .build(); + .addPathSegments("plan-traits/bulk"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2539,7 +2411,7 @@ public BaseSchematicHttpResponse updatePlanTraitsB throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2551,12 +2423,12 @@ public BaseSchematicHttpResponse updatePlanTraitsB } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanTraitsBulkResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanTraitsBulkResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2578,11 +2450,9 @@ public BaseSchematicHttpResponse updatePlanTraitsB } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2592,6 +2462,10 @@ public BaseSchematicHttpResponse countPlanTraits() { return countPlanTraits(CountPlanTraitsRequest.builder().build()); } + public BaseSchematicHttpResponse countPlanTraits(RequestOptions requestOptions) { + return countPlanTraits(CountPlanTraitsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countPlanTraits(CountPlanTraitsRequest request) { return countPlanTraits(request, null); } @@ -2624,6 +2498,11 @@ public BaseSchematicHttpResponse countPlanTraits( QueryStringMapper.addQueryParameter( httpUrl, "trait_ids", request.getTraitIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2636,12 +2515,12 @@ public BaseSchematicHttpResponse countPlanTraits( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountPlanTraitsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountPlanTraitsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2663,11 +2542,9 @@ public BaseSchematicHttpResponse countPlanTraits( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2679,10 +2556,14 @@ public BaseSchematicHttpResponse upsertUserTrait(Upsert public BaseSchematicHttpResponse upsertUserTrait( UpsertTraitRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("user-traits") - .build(); + .addPathSegments("user-traits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2691,7 +2572,7 @@ public BaseSchematicHttpResponse upsertUserTrait( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2703,12 +2584,12 @@ public BaseSchematicHttpResponse upsertUserTrait( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertUserTraitResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertUserTraitResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2730,11 +2611,9 @@ public BaseSchematicHttpResponse upsertUserTrait( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2744,6 +2623,10 @@ public BaseSchematicHttpResponse listUsers() { return listUsers(ListUsersRequest.builder().build()); } + public BaseSchematicHttpResponse listUsers(RequestOptions requestOptions) { + return listUsers(ListUsersRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listUsers(ListUsersRequest request) { return listUsers(request, null); } @@ -2775,6 +2658,11 @@ public BaseSchematicHttpResponse listUsers( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2787,11 +2675,11 @@ public BaseSchematicHttpResponse listUsers( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListUsersResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2813,11 +2701,9 @@ public BaseSchematicHttpResponse listUsers( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2829,10 +2715,14 @@ public BaseSchematicHttpResponse upsertUser(UpsertUserReques public BaseSchematicHttpResponse upsertUser( UpsertUserRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("users") - .build(); + .addPathSegments("users"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2841,7 +2731,7 @@ public BaseSchematicHttpResponse upsertUser( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2853,11 +2743,11 @@ public BaseSchematicHttpResponse upsertUser( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpsertUserResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertUserResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2879,11 +2769,9 @@ public BaseSchematicHttpResponse upsertUser( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2894,13 +2782,17 @@ public BaseSchematicHttpResponse getUser(String userId) { } public BaseSchematicHttpResponse getUser(String userId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId) - .build(); + .addPathSegment(userId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2911,11 +2803,11 @@ public BaseSchematicHttpResponse getUser(String userId, Request } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetUserResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetUserResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -2934,11 +2826,9 @@ public BaseSchematicHttpResponse getUser(String userId, Request } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -2949,13 +2839,17 @@ public BaseSchematicHttpResponse deleteUser(String userId) { } public BaseSchematicHttpResponse deleteUser(String userId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("users") - .addPathSegment(userId) - .build(); + .addPathSegment(userId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -2966,11 +2860,11 @@ public BaseSchematicHttpResponse deleteUser(String userId, R } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteUserResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteUserResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2992,11 +2886,9 @@ public BaseSchematicHttpResponse deleteUser(String userId, R } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -3006,6 +2898,10 @@ public BaseSchematicHttpResponse countUsers() { return countUsers(CountUsersRequest.builder().build()); } + public BaseSchematicHttpResponse countUsers(RequestOptions requestOptions) { + return countUsers(CountUsersRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countUsers(CountUsersRequest request) { return countUsers(request, null); } @@ -3037,6 +2933,11 @@ public BaseSchematicHttpResponse countUsers( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -3049,11 +2950,11 @@ public BaseSchematicHttpResponse countUsers( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountUsersResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountUsersResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3075,11 +2976,9 @@ public BaseSchematicHttpResponse countUsers( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -3091,10 +2990,14 @@ public BaseSchematicHttpResponse createUser(UpsertUserReques public BaseSchematicHttpResponse createUser( UpsertUserRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("users/create") - .build(); + .addPathSegments("users/create"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -3103,7 +3006,7 @@ public BaseSchematicHttpResponse createUser( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -3115,11 +3018,11 @@ public BaseSchematicHttpResponse createUser( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateUserResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateUserResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3141,11 +3044,9 @@ public BaseSchematicHttpResponse createUser( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -3157,10 +3058,14 @@ public BaseSchematicHttpResponse deleteUserByKeys(Keys public BaseSchematicHttpResponse deleteUserByKeys( KeysRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("users/delete") - .build(); + .addPathSegments("users/delete"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -3169,7 +3074,7 @@ public BaseSchematicHttpResponse deleteUserByKeys( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -3181,12 +3086,12 @@ public BaseSchematicHttpResponse deleteUserByKeys( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteUserByKeysResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteUserByKeysResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -3208,11 +3113,9 @@ public BaseSchematicHttpResponse deleteUserByKeys( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -3228,6 +3131,11 @@ public BaseSchematicHttpResponse lookupUser( .newBuilder() .addPathSegments("users/lookup"); QueryStringMapper.addQueryParameter(httpUrl, "keys", request.getKeys(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -3240,11 +3148,11 @@ public BaseSchematicHttpResponse lookupUser( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LookupUserResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LookupUserResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -3263,11 +3171,9 @@ public BaseSchematicHttpResponse lookupUser( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java deleted file mode 100644 index d220291..0000000 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountCompaniesForAdvancedFilterRequest.java +++ /dev/null @@ -1,595 +0,0 @@ -/** - * 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 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; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountCompaniesForAdvancedFilterRequest.Builder.class) -public final class CountCompaniesForAdvancedFilterRequest { - private final Optional> ids; - - private final Optional> planIds; - - private final Optional> featureIds; - - private final Optional> creditTypeIds; - - private final Optional> subscriptionStatuses; - - private final Optional> subscriptionTypes; - - private final Optional> displayProperties; - - private final Optional monetizedSubscriptions; - - private final Optional q; - - private final Optional withoutPlan; - - private final Optional withoutSubscription; - - private final Optional sortOrderColumn; - - private final Optional sortOrderDirection; - - private final Optional limit; - - private final Optional offset; - - private final Map additionalProperties; - - private CountCompaniesForAdvancedFilterRequest( - Optional> ids, - Optional> planIds, - Optional> featureIds, - Optional> creditTypeIds, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, - Optional> displayProperties, - Optional monetizedSubscriptions, - Optional q, - Optional withoutPlan, - Optional withoutSubscription, - Optional sortOrderColumn, - Optional sortOrderDirection, - Optional limit, - Optional offset, - Map additionalProperties) { - this.ids = ids; - this.planIds = planIds; - this.featureIds = featureIds; - this.creditTypeIds = creditTypeIds; - this.subscriptionStatuses = subscriptionStatuses; - this.subscriptionTypes = subscriptionTypes; - this.displayProperties = displayProperties; - this.monetizedSubscriptions = monetizedSubscriptions; - this.q = q; - this.withoutPlan = withoutPlan; - this.withoutSubscription = withoutSubscription; - this.sortOrderColumn = sortOrderColumn; - this.sortOrderDirection = sortOrderDirection; - this.limit = limit; - this.offset = offset; - this.additionalProperties = additionalProperties; - } - - /** - * @return Filter companies by multiple company IDs (starts with comp_) - */ - @JsonProperty("ids") - 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 feature IDs (each ID starts with feat_) - */ - @JsonProperty("feature_ids") - public Optional> getFeatureIds() { - return featureIds; - } - - /** - * @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 one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) - */ - @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { - return subscriptionStatuses; - } - - /** - * @return Filter companies by one or more subscription types (paid, free, trial) - */ - @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { - return subscriptionTypes; - } - - /** - * @return Select the display columns to return (e.g. plan, subscription, users, last_seen_at) - */ - @JsonProperty("display_properties") - public Optional> getDisplayProperties() { - return displayProperties; - } - - /** - * @return Filter companies that have monetized subscriptions - */ - @JsonProperty("monetized_subscriptions") - public Optional getMonetizedSubscriptions() { - return monetizedSubscriptions; - } - - /** - * @return Search for companies by name, keys or string traits - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Filter out companies that have a plan - */ - @JsonProperty("without_plan") - public Optional getWithoutPlan() { - return withoutPlan; - } - - /** - * @return Filter out companies that have a subscription - */ - @JsonProperty("without_subscription") - public Optional getWithoutSubscription() { - return withoutSubscription; - } - - /** - * @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 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 CountCompaniesForAdvancedFilterRequest - && equalTo((CountCompaniesForAdvancedFilterRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CountCompaniesForAdvancedFilterRequest other) { - return ids.equals(other.ids) - && planIds.equals(other.planIds) - && featureIds.equals(other.featureIds) - && creditTypeIds.equals(other.creditTypeIds) - && subscriptionStatuses.equals(other.subscriptionStatuses) - && subscriptionTypes.equals(other.subscriptionTypes) - && displayProperties.equals(other.displayProperties) - && monetizedSubscriptions.equals(other.monetizedSubscriptions) - && q.equals(other.q) - && withoutPlan.equals(other.withoutPlan) - && withoutSubscription.equals(other.withoutSubscription) - && sortOrderColumn.equals(other.sortOrderColumn) - && sortOrderDirection.equals(other.sortOrderDirection) - && limit.equals(other.limit) - && offset.equals(other.offset); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.ids, - this.planIds, - this.featureIds, - this.creditTypeIds, - this.subscriptionStatuses, - this.subscriptionTypes, - this.displayProperties, - this.monetizedSubscriptions, - this.q, - this.withoutPlan, - this.withoutSubscription, - this.sortOrderColumn, - this.sortOrderDirection, - 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> planIds = Optional.empty(); - - private Optional> featureIds = Optional.empty(); - - private Optional> creditTypeIds = Optional.empty(); - - private Optional> subscriptionStatuses = Optional.empty(); - - private Optional> subscriptionTypes = Optional.empty(); - - private Optional> displayProperties = Optional.empty(); - - private Optional monetizedSubscriptions = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional withoutPlan = Optional.empty(); - - private Optional withoutSubscription = Optional.empty(); - - private Optional sortOrderColumn = Optional.empty(); - - private Optional sortOrderDirection = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional offset = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CountCompaniesForAdvancedFilterRequest other) { - ids(other.getIds()); - planIds(other.getPlanIds()); - featureIds(other.getFeatureIds()); - creditTypeIds(other.getCreditTypeIds()); - subscriptionStatuses(other.getSubscriptionStatuses()); - subscriptionTypes(other.getSubscriptionTypes()); - displayProperties(other.getDisplayProperties()); - monetizedSubscriptions(other.getMonetizedSubscriptions()); - q(other.getQ()); - withoutPlan(other.getWithoutPlan()); - withoutSubscription(other.getWithoutSubscription()); - sortOrderColumn(other.getSortOrderColumn()); - sortOrderDirection(other.getSortOrderDirection()); - limit(other.getLimit()); - offset(other.getOffset()); - return this; - } - - /** - *

Filter companies by multiple company IDs (starts with comp_)

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

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 feature IDs (each ID starts with feat_)

- */ - @JsonSetter(value = "feature_ids", nulls = Nulls.SKIP) - public Builder featureIds(Optional> featureIds) { - this.featureIds = featureIds; - return this; - } - - public Builder featureIds(List featureIds) { - this.featureIds = Optional.ofNullable(featureIds); - return this; - } - - public Builder featureIds(String featureIds) { - this.featureIds = Optional.of(Collections.singletonList(featureIds)); - 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 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) { - 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 (paid, free, trial)

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

Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

- */ - @JsonSetter(value = "display_properties", nulls = Nulls.SKIP) - public Builder displayProperties(Optional> displayProperties) { - this.displayProperties = displayProperties; - return this; - } - - public Builder displayProperties(List displayProperties) { - this.displayProperties = Optional.ofNullable(displayProperties); - return this; - } - - public Builder displayProperties(String displayProperties) { - this.displayProperties = Optional.of(Collections.singletonList(displayProperties)); - 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; - } - - /** - *

Search for companies by name, keys or string traits

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

Filter out companies that have a plan

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

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

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 CountCompaniesForAdvancedFilterRequest build() { - return new CountCompaniesForAdvancedFilterRequest( - ids, - planIds, - featureIds, - creditTypeIds, - subscriptionStatuses, - subscriptionTypes, - displayProperties, - monetizedSubscriptions, - q, - withoutPlan, - withoutSubscription, - sortOrderColumn, - sortOrderDirection, - limit, - offset, - additionalProperties); - } - } -} 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 454e002..3c6ca03 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 @@ -39,12 +39,16 @@ public final class CountCompaniesRequest { private final Optional planId; + private final Optional planVersionId; + private final Optional q; private final Optional sortOrderColumn; private final Optional sortOrderDirection; + private final Optional withEntitlementFor; + private final Optional withoutFeatureOverrideFor; private final Optional withoutPlan; @@ -53,9 +57,9 @@ public final class CountCompaniesRequest { private final Optional withSubscription; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -67,15 +71,17 @@ private CountCompaniesRequest( Optional> subscriptionTypes, Optional monetizedSubscriptions, Optional planId, + Optional planVersionId, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, + Optional withEntitlementFor, Optional withoutFeatureOverrideFor, Optional withoutPlan, Optional withoutSubscription, Optional withSubscription, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.creditTypeIds = creditTypeIds; this.ids = ids; @@ -84,9 +90,11 @@ private CountCompaniesRequest( this.subscriptionTypes = subscriptionTypes; this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; + this.planVersionId = planVersionId; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; + this.withEntitlementFor = withEntitlementFor; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; this.withoutSubscription = withoutSubscription; @@ -152,6 +160,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter companies by plan version ID (starts with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search for companies by name, keys or string traits */ @@ -176,6 +192,14 @@ public Optional getSortOrderDirection() { return sortOrderDirection; } + /** + * @return Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID + */ + @JsonProperty("with_entitlement_for") + public Optional getWithEntitlementFor() { + return withEntitlementFor; + } + /** * @return Filter out companies that already have a company override for the specified feature ID */ @@ -212,7 +236,7 @@ public Optional getWithSubscription() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -220,7 +244,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -243,9 +267,11 @@ private boolean equalTo(CountCompaniesRequest other) { && subscriptionTypes.equals(other.subscriptionTypes) && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) + && withEntitlementFor.equals(other.withEntitlementFor) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) && withoutPlan.equals(other.withoutPlan) && withoutSubscription.equals(other.withoutSubscription) @@ -264,9 +290,11 @@ public int hashCode() { this.subscriptionTypes, this.monetizedSubscriptions, this.planId, + this.planVersionId, this.q, this.sortOrderColumn, this.sortOrderDirection, + this.withEntitlementFor, this.withoutFeatureOverrideFor, this.withoutPlan, this.withoutSubscription, @@ -300,12 +328,16 @@ public static final class Builder { private Optional planId = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); private Optional sortOrderDirection = Optional.empty(); + private Optional withEntitlementFor = Optional.empty(); + private Optional withoutFeatureOverrideFor = Optional.empty(); private Optional withoutPlan = Optional.empty(); @@ -314,9 +346,9 @@ public static final class Builder { private Optional withSubscription = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -331,9 +363,11 @@ public Builder from(CountCompaniesRequest other) { subscriptionTypes(other.getSubscriptionTypes()); monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); + withEntitlementFor(other.getWithEntitlementFor()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); withoutSubscription(other.getWithoutSubscription()); @@ -466,6 +500,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter companies by plan version ID (starts 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 companies by name, keys or string traits

*/ @@ -508,6 +556,20 @@ public Builder sortOrderDirection(SortDirection sortOrderDirection) { return this; } + /** + *

Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID

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

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

*/ @@ -568,12 +630,12 @@ public Builder withSubscription(Boolean withSubscription) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -601,9 +663,11 @@ public CountCompaniesRequest build() { subscriptionTypes, monetizedSubscriptions, planId, + planVersionId, q, sortOrderColumn, sortOrderDirection, + withEntitlementFor, withoutFeatureOverrideFor, withoutPlan, withoutSubscription, @@ -612,5 +676,15 @@ public CountCompaniesRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityKeyDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityKeyDefinitionsRequest.java index a72510e..bcf453c 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 @@ -29,9 +29,9 @@ public final class CountEntityKeyDefinitionsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -39,8 +39,8 @@ private CountEntityKeyDefinitionsRequest( Optional> ids, Optional entityType, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.entityType = entityType; @@ -69,7 +69,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -77,7 +77,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -122,9 +122,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -182,12 +182,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -209,5 +209,15 @@ public Builder offset(Integer offset) { public CountEntityKeyDefinitionsRequest build() { return new CountEntityKeyDefinitionsRequest(ids, entityType, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountEntityTraitDefinitionsRequest.java index 4bb341e..9102e4c 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 @@ -34,9 +34,9 @@ public final class CountEntityTraitDefinitionsRequest { private final Optional traitType; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -46,8 +46,8 @@ private CountEntityTraitDefinitionsRequest( Optional entityType, Optional q, Optional traitType, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.traitTypes = traitTypes; @@ -88,7 +88,7 @@ public Optional getTraitType() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -96,7 +96,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -149,9 +149,9 @@ public static final class Builder { private Optional traitType = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -238,12 +238,12 @@ public Builder traitType(TraitType traitType) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -266,5 +266,15 @@ public CountEntityTraitDefinitionsRequest build() { return new CountEntityTraitDefinitionsRequest( ids, traitTypes, entityType, q, traitType, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountPlanTraitsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountPlanTraitsRequest.java index bf1ecca..3af7630 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountPlanTraitsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountPlanTraitsRequest.java @@ -30,9 +30,9 @@ public final class CountPlanTraitsRequest { private final Optional traitId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -41,8 +41,8 @@ private CountPlanTraitsRequest( Optional> traitIds, Optional planId, Optional traitId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.traitIds = traitIds; @@ -77,7 +77,7 @@ public Optional getTraitId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -85,7 +85,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -133,9 +133,9 @@ public static final class Builder { private Optional traitId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -210,12 +210,12 @@ public Builder traitId(String traitId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -237,5 +237,15 @@ public Builder offset(Integer offset) { public CountPlanTraitsRequest build() { return new CountPlanTraitsRequest(ids, traitIds, planId, traitId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CountUsersRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/CountUsersRequest.java index 63aaeb7..5954844 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CountUsersRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CountUsersRequest.java @@ -30,9 +30,9 @@ public final class CountUsersRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -41,8 +41,8 @@ private CountUsersRequest( Optional companyId, Optional planId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.companyId = companyId; @@ -89,7 +89,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -97,7 +97,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -145,9 +145,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -229,12 +229,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -256,5 +256,15 @@ public Builder offset(Integer offset) { public CountUsersRequest build() { return new CountUsersRequest(ids, companyId, planId, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CreateEntityTraitDefinitionRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/CreateEntityTraitDefinitionRequestBody.java index 6a66256..ef36ee0 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 @@ -114,6 +114,10 @@ public interface TraitTypeStage { public interface _FinalStage { CreateEntityTraitDefinitionRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage displayName(Optional displayName); _FinalStage displayName(String displayName); @@ -205,5 +209,17 @@ public CreateEntityTraitDefinitionRequestBody build() { return new CreateEntityTraitDefinitionRequestBody( displayName, entityType, hierarchy, traitType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/CreatePlanTraitRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/CreatePlanTraitRequestBody.java index 60b2a52..7fcca3b 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/CreatePlanTraitRequestBody.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/CreatePlanTraitRequestBody.java @@ -95,6 +95,10 @@ public interface TraitValueStage { public interface _FinalStage { CreatePlanTraitRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -143,5 +147,17 @@ public _FinalStage traitValue(@NotNull String traitValue) { public CreatePlanTraitRequestBody build() { return new CreatePlanTraitRequestBody(planId, traitId, traitValue, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java index a56caf1..2767940 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/DeleteCompanyRequest.java @@ -114,5 +114,15 @@ public Builder prorate(Boolean prorate) { public DeleteCompanyRequest build() { return new DeleteCompanyRequest(cancelSubscription, prorate, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/GetActiveCompanySubscriptionRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/GetActiveCompanySubscriptionRequest.java index 66dc2de..c7a08cf 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/GetActiveCompanySubscriptionRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/GetActiveCompanySubscriptionRequest.java @@ -26,17 +26,17 @@ public final class GetActiveCompanySubscriptionRequest { private final Optional companyId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private GetActiveCompanySubscriptionRequest( Optional> companyIds, Optional companyId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.companyId = companyId; @@ -59,7 +59,7 @@ public Optional getCompanyId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -67,7 +67,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -110,9 +110,9 @@ public static final class Builder { private Optional companyId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -158,12 +158,12 @@ public Builder companyId(String companyId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -185,5 +185,15 @@ public Builder offset(Integer offset) { public GetActiveCompanySubscriptionRequest build() { return new GetActiveCompanySubscriptionRequest(companyIds, companyId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/GetEntityTraitValuesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/GetEntityTraitValuesRequest.java index ac4430a..2aa9f6d 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/GetEntityTraitValuesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/GetEntityTraitValuesRequest.java @@ -25,17 +25,17 @@ public final class GetEntityTraitValuesRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private GetEntityTraitValuesRequest( String definitionId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.definitionId = definitionId; this.q = q; @@ -58,7 +58,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -111,6 +111,10 @@ public interface DefinitionIdStage { public interface _FinalStage { GetEntityTraitValuesRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage q(Optional q); _FinalStage q(String q); @@ -118,25 +122,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DefinitionIdStage, _FinalStage { private String definitionId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional q = Optional.empty(); @@ -166,7 +170,7 @@ public _FinalStage definitionId(@NotNull String definitionId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -176,7 +180,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -186,7 +190,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -196,7 +200,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -218,5 +222,17 @@ public _FinalStage q(Optional q) { public GetEntityTraitValuesRequest build() { return new GetEntityTraitValuesRequest(definitionId, q, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/GetOrCreateCompanyMembershipRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/GetOrCreateCompanyMembershipRequestBody.java index bd7ac6d..9ce6a61 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/GetOrCreateCompanyMembershipRequestBody.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/GetOrCreateCompanyMembershipRequestBody.java @@ -84,6 +84,10 @@ public interface UserIdStage { public interface _FinalStage { GetOrCreateCompanyMembershipRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -122,5 +126,17 @@ public _FinalStage userId(@NotNull String userId) { public GetOrCreateCompanyMembershipRequestBody build() { return new GetOrCreateCompanyMembershipRequestBody(companyId, userId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java deleted file mode 100644 index 3377ecd..0000000 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListCompaniesForAdvancedFilterRequest.java +++ /dev/null @@ -1,595 +0,0 @@ -/** - * 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 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; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListCompaniesForAdvancedFilterRequest.Builder.class) -public final class ListCompaniesForAdvancedFilterRequest { - private final Optional> ids; - - private final Optional> planIds; - - private final Optional> featureIds; - - private final Optional> creditTypeIds; - - private final Optional> subscriptionStatuses; - - private final Optional> subscriptionTypes; - - private final Optional> displayProperties; - - private final Optional monetizedSubscriptions; - - private final Optional q; - - private final Optional withoutPlan; - - private final Optional withoutSubscription; - - private final Optional sortOrderColumn; - - private final Optional sortOrderDirection; - - private final Optional limit; - - private final Optional offset; - - private final Map additionalProperties; - - private ListCompaniesForAdvancedFilterRequest( - Optional> ids, - Optional> planIds, - Optional> featureIds, - Optional> creditTypeIds, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, - Optional> displayProperties, - Optional monetizedSubscriptions, - Optional q, - Optional withoutPlan, - Optional withoutSubscription, - Optional sortOrderColumn, - Optional sortOrderDirection, - Optional limit, - Optional offset, - Map additionalProperties) { - this.ids = ids; - this.planIds = planIds; - this.featureIds = featureIds; - this.creditTypeIds = creditTypeIds; - this.subscriptionStatuses = subscriptionStatuses; - this.subscriptionTypes = subscriptionTypes; - this.displayProperties = displayProperties; - this.monetizedSubscriptions = monetizedSubscriptions; - this.q = q; - this.withoutPlan = withoutPlan; - this.withoutSubscription = withoutSubscription; - this.sortOrderColumn = sortOrderColumn; - this.sortOrderDirection = sortOrderDirection; - this.limit = limit; - this.offset = offset; - this.additionalProperties = additionalProperties; - } - - /** - * @return Filter companies by multiple company IDs (starts with comp_) - */ - @JsonProperty("ids") - 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 feature IDs (each ID starts with feat_) - */ - @JsonProperty("feature_ids") - public Optional> getFeatureIds() { - return featureIds; - } - - /** - * @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 one or more subscription statuses (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) - */ - @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { - return subscriptionStatuses; - } - - /** - * @return Filter companies by one or more subscription types (paid, free, trial) - */ - @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { - return subscriptionTypes; - } - - /** - * @return Select the display columns to return (e.g. plan, subscription, users, last_seen_at) - */ - @JsonProperty("display_properties") - public Optional> getDisplayProperties() { - return displayProperties; - } - - /** - * @return Filter companies that have monetized subscriptions - */ - @JsonProperty("monetized_subscriptions") - public Optional getMonetizedSubscriptions() { - return monetizedSubscriptions; - } - - /** - * @return Search for companies by name, keys or string traits - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Filter out companies that have a plan - */ - @JsonProperty("without_plan") - public Optional getWithoutPlan() { - return withoutPlan; - } - - /** - * @return Filter out companies that have a subscription - */ - @JsonProperty("without_subscription") - public Optional getWithoutSubscription() { - return withoutSubscription; - } - - /** - * @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 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 ListCompaniesForAdvancedFilterRequest - && equalTo((ListCompaniesForAdvancedFilterRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListCompaniesForAdvancedFilterRequest other) { - return ids.equals(other.ids) - && planIds.equals(other.planIds) - && featureIds.equals(other.featureIds) - && creditTypeIds.equals(other.creditTypeIds) - && subscriptionStatuses.equals(other.subscriptionStatuses) - && subscriptionTypes.equals(other.subscriptionTypes) - && displayProperties.equals(other.displayProperties) - && monetizedSubscriptions.equals(other.monetizedSubscriptions) - && q.equals(other.q) - && withoutPlan.equals(other.withoutPlan) - && withoutSubscription.equals(other.withoutSubscription) - && sortOrderColumn.equals(other.sortOrderColumn) - && sortOrderDirection.equals(other.sortOrderDirection) - && limit.equals(other.limit) - && offset.equals(other.offset); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.ids, - this.planIds, - this.featureIds, - this.creditTypeIds, - this.subscriptionStatuses, - this.subscriptionTypes, - this.displayProperties, - this.monetizedSubscriptions, - this.q, - this.withoutPlan, - this.withoutSubscription, - this.sortOrderColumn, - this.sortOrderDirection, - 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> planIds = Optional.empty(); - - private Optional> featureIds = Optional.empty(); - - private Optional> creditTypeIds = Optional.empty(); - - private Optional> subscriptionStatuses = Optional.empty(); - - private Optional> subscriptionTypes = Optional.empty(); - - private Optional> displayProperties = Optional.empty(); - - private Optional monetizedSubscriptions = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional withoutPlan = Optional.empty(); - - private Optional withoutSubscription = Optional.empty(); - - private Optional sortOrderColumn = Optional.empty(); - - private Optional sortOrderDirection = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional offset = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListCompaniesForAdvancedFilterRequest other) { - ids(other.getIds()); - planIds(other.getPlanIds()); - featureIds(other.getFeatureIds()); - creditTypeIds(other.getCreditTypeIds()); - subscriptionStatuses(other.getSubscriptionStatuses()); - subscriptionTypes(other.getSubscriptionTypes()); - displayProperties(other.getDisplayProperties()); - monetizedSubscriptions(other.getMonetizedSubscriptions()); - q(other.getQ()); - withoutPlan(other.getWithoutPlan()); - withoutSubscription(other.getWithoutSubscription()); - sortOrderColumn(other.getSortOrderColumn()); - sortOrderDirection(other.getSortOrderDirection()); - limit(other.getLimit()); - offset(other.getOffset()); - return this; - } - - /** - *

Filter companies by multiple company IDs (starts with comp_)

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

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 feature IDs (each ID starts with feat_)

- */ - @JsonSetter(value = "feature_ids", nulls = Nulls.SKIP) - public Builder featureIds(Optional> featureIds) { - this.featureIds = featureIds; - return this; - } - - public Builder featureIds(List featureIds) { - this.featureIds = Optional.ofNullable(featureIds); - return this; - } - - public Builder featureIds(String featureIds) { - this.featureIds = Optional.of(Collections.singletonList(featureIds)); - 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 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) { - 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 (paid, free, trial)

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

Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

- */ - @JsonSetter(value = "display_properties", nulls = Nulls.SKIP) - public Builder displayProperties(Optional> displayProperties) { - this.displayProperties = displayProperties; - return this; - } - - public Builder displayProperties(List displayProperties) { - this.displayProperties = Optional.ofNullable(displayProperties); - return this; - } - - public Builder displayProperties(String displayProperties) { - this.displayProperties = Optional.of(Collections.singletonList(displayProperties)); - 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; - } - - /** - *

Search for companies by name, keys or string traits

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

Filter out companies that have a plan

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

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

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 ListCompaniesForAdvancedFilterRequest build() { - return new ListCompaniesForAdvancedFilterRequest( - ids, - planIds, - featureIds, - creditTypeIds, - subscriptionStatuses, - subscriptionTypes, - displayProperties, - monetizedSubscriptions, - q, - withoutPlan, - withoutSubscription, - sortOrderColumn, - sortOrderDirection, - limit, - offset, - additionalProperties); - } - } -} 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 a2253c1..5708dc3 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 @@ -39,12 +39,16 @@ public final class ListCompaniesRequest { private final Optional planId; + private final Optional planVersionId; + private final Optional q; private final Optional sortOrderColumn; private final Optional sortOrderDirection; + private final Optional withEntitlementFor; + private final Optional withoutFeatureOverrideFor; private final Optional withoutPlan; @@ -53,9 +57,9 @@ public final class ListCompaniesRequest { private final Optional withSubscription; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -67,15 +71,17 @@ private ListCompaniesRequest( Optional> subscriptionTypes, Optional monetizedSubscriptions, Optional planId, + Optional planVersionId, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, + Optional withEntitlementFor, Optional withoutFeatureOverrideFor, Optional withoutPlan, Optional withoutSubscription, Optional withSubscription, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.creditTypeIds = creditTypeIds; this.ids = ids; @@ -84,9 +90,11 @@ private ListCompaniesRequest( this.subscriptionTypes = subscriptionTypes; this.monetizedSubscriptions = monetizedSubscriptions; this.planId = planId; + this.planVersionId = planVersionId; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; + this.withEntitlementFor = withEntitlementFor; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; this.withoutSubscription = withoutSubscription; @@ -152,6 +160,14 @@ public Optional getPlanId() { return planId; } + /** + * @return Filter companies by plan version ID (starts with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search for companies by name, keys or string traits */ @@ -176,6 +192,14 @@ public Optional getSortOrderDirection() { return sortOrderDirection; } + /** + * @return Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID + */ + @JsonProperty("with_entitlement_for") + public Optional getWithEntitlementFor() { + return withEntitlementFor; + } + /** * @return Filter out companies that already have a company override for the specified feature ID */ @@ -212,7 +236,7 @@ public Optional getWithSubscription() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -220,7 +244,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -243,9 +267,11 @@ private boolean equalTo(ListCompaniesRequest other) { && subscriptionTypes.equals(other.subscriptionTypes) && monetizedSubscriptions.equals(other.monetizedSubscriptions) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) + && withEntitlementFor.equals(other.withEntitlementFor) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) && withoutPlan.equals(other.withoutPlan) && withoutSubscription.equals(other.withoutSubscription) @@ -264,9 +290,11 @@ public int hashCode() { this.subscriptionTypes, this.monetizedSubscriptions, this.planId, + this.planVersionId, this.q, this.sortOrderColumn, this.sortOrderDirection, + this.withEntitlementFor, this.withoutFeatureOverrideFor, this.withoutPlan, this.withoutSubscription, @@ -300,12 +328,16 @@ public static final class Builder { private Optional planId = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); private Optional sortOrderDirection = Optional.empty(); + private Optional withEntitlementFor = Optional.empty(); + private Optional withoutFeatureOverrideFor = Optional.empty(); private Optional withoutPlan = Optional.empty(); @@ -314,9 +346,9 @@ public static final class Builder { private Optional withSubscription = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -331,9 +363,11 @@ public Builder from(ListCompaniesRequest other) { subscriptionTypes(other.getSubscriptionTypes()); monetizedSubscriptions(other.getMonetizedSubscriptions()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); + withEntitlementFor(other.getWithEntitlementFor()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); withoutSubscription(other.getWithoutSubscription()); @@ -466,6 +500,20 @@ public Builder planId(String planId) { return this; } + /** + *

Filter companies by plan version ID (starts 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 companies by name, keys or string traits

*/ @@ -508,6 +556,20 @@ public Builder sortOrderDirection(SortDirection sortOrderDirection) { return this; } + /** + *

Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID

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

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

*/ @@ -568,12 +630,12 @@ public Builder withSubscription(Boolean withSubscription) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -601,9 +663,11 @@ public ListCompaniesRequest build() { subscriptionTypes, monetizedSubscriptions, planId, + planVersionId, q, sortOrderColumn, sortOrderDirection, + withEntitlementFor, withoutFeatureOverrideFor, withoutPlan, withoutSubscription, @@ -612,5 +676,15 @@ public ListCompaniesRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListCompanyMembershipsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListCompanyMembershipsRequest.java index 528c711..da2ab3d 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListCompanyMembershipsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListCompanyMembershipsRequest.java @@ -24,17 +24,17 @@ public final class ListCompanyMembershipsRequest { private final Optional userId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListCompanyMembershipsRequest( Optional companyId, Optional userId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.userId = userId; @@ -57,7 +57,7 @@ public Optional getUserId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -107,9 +107,9 @@ public static final class Builder { private Optional userId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -150,12 +150,12 @@ public Builder userId(String userId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder offset(Integer offset) { public ListCompanyMembershipsRequest build() { return new ListCompanyMembershipsRequest(companyId, userId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListEntityKeyDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListEntityKeyDefinitionsRequest.java index e3f3ff5..daecd29 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 @@ -29,9 +29,9 @@ public final class ListEntityKeyDefinitionsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -39,8 +39,8 @@ private ListEntityKeyDefinitionsRequest( Optional> ids, Optional entityType, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.entityType = entityType; @@ -69,7 +69,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -77,7 +77,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -122,9 +122,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -182,12 +182,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -209,5 +209,15 @@ public Builder offset(Integer offset) { public ListEntityKeyDefinitionsRequest build() { return new ListEntityKeyDefinitionsRequest(ids, entityType, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListEntityTraitDefinitionsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListEntityTraitDefinitionsRequest.java index 160940a..6bfafbe 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 @@ -34,9 +34,9 @@ public final class ListEntityTraitDefinitionsRequest { private final Optional traitType; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -46,8 +46,8 @@ private ListEntityTraitDefinitionsRequest( Optional entityType, Optional q, Optional traitType, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.traitTypes = traitTypes; @@ -88,7 +88,7 @@ public Optional getTraitType() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -96,7 +96,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -148,9 +148,9 @@ public static final class Builder { private Optional traitType = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -237,12 +237,12 @@ public Builder traitType(TraitType traitType) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -265,5 +265,15 @@ public ListEntityTraitDefinitionsRequest build() { return new ListEntityTraitDefinitionsRequest( ids, traitTypes, entityType, q, traitType, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java index a69b17a..e004aea 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanChangesRequest.java @@ -32,9 +32,9 @@ public final class ListPlanChangesRequest { private final Optional companyId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -44,8 +44,8 @@ private ListPlanChangesRequest( Optional action, Optional basePlanAction, Optional companyId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.planIds = planIds; @@ -86,7 +86,7 @@ public Optional getCompanyId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -94,7 +94,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -152,9 +152,9 @@ public static final class Builder { private Optional companyId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -241,12 +241,12 @@ public Builder companyId(String companyId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -269,5 +269,15 @@ public ListPlanChangesRequest build() { return new ListPlanChangesRequest( companyIds, planIds, action, basePlanAction, companyId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanTraitsRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanTraitsRequest.java index 98e6b92..6178385 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListPlanTraitsRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListPlanTraitsRequest.java @@ -30,9 +30,9 @@ public final class ListPlanTraitsRequest { private final Optional traitId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -41,8 +41,8 @@ private ListPlanTraitsRequest( Optional> traitIds, Optional planId, Optional traitId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.traitIds = traitIds; @@ -77,7 +77,7 @@ public Optional getTraitId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -85,7 +85,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -133,9 +133,9 @@ public static final class Builder { private Optional traitId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -210,12 +210,12 @@ public Builder traitId(String traitId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -237,5 +237,15 @@ public Builder offset(Integer offset) { public ListPlanTraitsRequest build() { return new ListPlanTraitsRequest(ids, traitIds, planId, traitId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/ListUsersRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/ListUsersRequest.java index 7a5a367..2cb70c6 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/ListUsersRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/ListUsersRequest.java @@ -30,9 +30,9 @@ public final class ListUsersRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -41,8 +41,8 @@ private ListUsersRequest( Optional companyId, Optional planId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.companyId = companyId; @@ -89,7 +89,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -97,7 +97,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -145,9 +145,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -229,12 +229,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -256,5 +256,15 @@ public Builder offset(Integer offset) { public ListUsersRequest build() { return new ListUsersRequest(ids, companyId, planId, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/LookupCompanyRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/LookupCompanyRequest.java index 84280b3..a0a1f94 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/LookupCompanyRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/LookupCompanyRequest.java @@ -107,5 +107,15 @@ public Builder keys(String key, String value) { public LookupCompanyRequest build() { return new LookupCompanyRequest(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/LookupUserRequest.java b/src/main/java/com/schematic/api/resources/companies/requests/LookupUserRequest.java index 3dfb734..99ec230 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/LookupUserRequest.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/LookupUserRequest.java @@ -107,5 +107,15 @@ public Builder keys(String key, String value) { public LookupUserRequest build() { return new LookupUserRequest(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/UpdateEntityTraitDefinitionRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/UpdateEntityTraitDefinitionRequestBody.java index ec8e910..0791ed1 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 @@ -84,6 +84,10 @@ public interface TraitTypeStage { public interface _FinalStage { UpdateEntityTraitDefinitionRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage displayName(Optional displayName); _FinalStage displayName(String displayName); @@ -131,5 +135,17 @@ public _FinalStage displayName(Optional displayName) { public UpdateEntityTraitDefinitionRequestBody build() { return new UpdateEntityTraitDefinitionRequestBody(displayName, traitType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitBulkRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitBulkRequestBody.java index 93f027d..0709e27 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 @@ -101,6 +101,10 @@ public interface PlanIdStage { public interface _FinalStage { UpdatePlanTraitBulkRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage traits(List traits); _FinalStage addTraits(UpdatePlanTraitTraitRequestBody traits); @@ -171,5 +175,17 @@ public _FinalStage traits(List traits) { public UpdatePlanTraitBulkRequestBody build() { return new UpdatePlanTraitBulkRequestBody(applyToExistingCompanies, planId, traits, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitRequestBody.java b/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitRequestBody.java index 243e967..03cdd73 100644 --- a/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitRequestBody.java +++ b/src/main/java/com/schematic/api/resources/companies/requests/UpdatePlanTraitRequestBody.java @@ -82,6 +82,10 @@ public interface TraitValueStage { public interface _FinalStage { UpdatePlanTraitRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -120,5 +124,17 @@ public _FinalStage traitValue(@NotNull String traitValue) { public UpdatePlanTraitRequestBody build() { return new UpdatePlanTraitRequestBody(planId, traitValue, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java deleted file mode 100644 index c08ad69..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterParams.java +++ /dev/null @@ -1,553 +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.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.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; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountCompaniesForAdvancedFilterParams.Builder.class) -public final class CountCompaniesForAdvancedFilterParams { - private final Optional> creditTypeIds; - - private final Optional> displayProperties; - - private final Optional> featureIds; - - private final Optional> ids; - - private final Optional limit; - - private final Optional monetizedSubscriptions; - - private final Optional offset; - - 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 withoutPlan; - - private final Optional withoutSubscription; - - private final Map additionalProperties; - - private CountCompaniesForAdvancedFilterParams( - Optional> creditTypeIds, - Optional> displayProperties, - Optional> featureIds, - Optional> ids, - Optional limit, - Optional monetizedSubscriptions, - Optional offset, - Optional> planIds, - Optional q, - Optional sortOrderColumn, - Optional sortOrderDirection, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, - Optional withoutPlan, - Optional withoutSubscription, - Map additionalProperties) { - this.creditTypeIds = creditTypeIds; - this.displayProperties = displayProperties; - this.featureIds = featureIds; - this.ids = ids; - this.limit = limit; - this.monetizedSubscriptions = monetizedSubscriptions; - this.offset = offset; - this.planIds = planIds; - this.q = q; - this.sortOrderColumn = sortOrderColumn; - this.sortOrderDirection = sortOrderDirection; - this.subscriptionStatuses = subscriptionStatuses; - this.subscriptionTypes = subscriptionTypes; - 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 Select the display columns to return (e.g. plan, subscription, users, last_seen_at) - */ - @JsonProperty("display_properties") - public Optional> getDisplayProperties() { - return displayProperties; - } - - /** - * @return Filter companies by one or more feature IDs (each ID starts with feat_) - */ - @JsonProperty("feature_ids") - public Optional> getFeatureIds() { - return featureIds; - } - - /** - * @return Filter companies by multiple company IDs (starts with comp_) - */ - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - /** - * @return Page limit (default 100) - */ - @JsonProperty("limit") - 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) - */ - @JsonProperty("offset") - public Optional getOffset() { - return offset; - } - - /** - * @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 - */ - @JsonProperty("q") - 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 (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) - */ - @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { - return subscriptionStatuses; - } - - /** - * @return Filter companies by one or more subscription types (paid, free, trial) - */ - @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { - return subscriptionTypes; - } - - /** - * @return Filter out companies that have a plan - */ - @JsonProperty("without_plan") - 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; - return other instanceof CountCompaniesForAdvancedFilterParams - && equalTo((CountCompaniesForAdvancedFilterParams) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CountCompaniesForAdvancedFilterParams other) { - return creditTypeIds.equals(other.creditTypeIds) - && displayProperties.equals(other.displayProperties) - && featureIds.equals(other.featureIds) - && ids.equals(other.ids) - && limit.equals(other.limit) - && monetizedSubscriptions.equals(other.monetizedSubscriptions) - && offset.equals(other.offset) - && planIds.equals(other.planIds) - && q.equals(other.q) - && sortOrderColumn.equals(other.sortOrderColumn) - && sortOrderDirection.equals(other.sortOrderDirection) - && subscriptionStatuses.equals(other.subscriptionStatuses) - && subscriptionTypes.equals(other.subscriptionTypes) - && withoutPlan.equals(other.withoutPlan) - && withoutSubscription.equals(other.withoutSubscription); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.creditTypeIds, - this.displayProperties, - this.featureIds, - this.ids, - this.limit, - this.monetizedSubscriptions, - this.offset, - this.planIds, - this.q, - this.sortOrderColumn, - this.sortOrderDirection, - this.subscriptionStatuses, - this.subscriptionTypes, - this.withoutPlan, - this.withoutSubscription); - } - - @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> creditTypeIds = Optional.empty(); - - private Optional> displayProperties = Optional.empty(); - - private Optional> featureIds = Optional.empty(); - - private Optional> ids = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional monetizedSubscriptions = Optional.empty(); - - private Optional offset = 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 withoutPlan = Optional.empty(); - - private Optional withoutSubscription = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CountCompaniesForAdvancedFilterParams other) { - creditTypeIds(other.getCreditTypeIds()); - displayProperties(other.getDisplayProperties()); - featureIds(other.getFeatureIds()); - ids(other.getIds()); - limit(other.getLimit()); - monetizedSubscriptions(other.getMonetizedSubscriptions()); - offset(other.getOffset()); - planIds(other.getPlanIds()); - q(other.getQ()); - sortOrderColumn(other.getSortOrderColumn()); - sortOrderDirection(other.getSortOrderDirection()); - subscriptionStatuses(other.getSubscriptionStatuses()); - subscriptionTypes(other.getSubscriptionTypes()); - 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; - } - - /** - *

Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

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

Filter companies by one or more feature IDs (each ID starts with feat_)

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

Filter companies by multiple company IDs (starts with comp_)

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

Page limit (default 100)

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

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

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

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

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 (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

- */ - @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 (paid, free, trial)

- */ - @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 out companies that have a plan

- */ - @JsonSetter(value = "without_plan", nulls = Nulls.SKIP) - public Builder withoutPlan(Optional withoutPlan) { - this.withoutPlan = withoutPlan; - return this; - } - - public Builder withoutPlan(Boolean withoutPlan) { - this.withoutPlan = Optional.ofNullable(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 CountCompaniesForAdvancedFilterParams build() { - return new CountCompaniesForAdvancedFilterParams( - creditTypeIds, - displayProperties, - featureIds, - ids, - limit, - monetizedSubscriptions, - offset, - planIds, - q, - sortOrderColumn, - sortOrderDirection, - subscriptionStatuses, - subscriptionTypes, - withoutPlan, - withoutSubscription, - additionalProperties); - } - } -} 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 977f9bd..8fb4650 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 @@ -28,16 +28,18 @@ public final class CountCompaniesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; private final Optional monetizedSubscriptions; - private final Optional offset; + private final Optional offset; private final Optional planId; private final Optional> planIds; + private final Optional planVersionId; + private final Optional q; private final Optional sortOrderColumn; @@ -48,6 +50,8 @@ public final class CountCompaniesParams { private final Optional> subscriptionTypes; + private final Optional withEntitlementFor; + private final Optional withSubscription; private final Optional withoutFeatureOverrideFor; @@ -61,16 +65,18 @@ public final class CountCompaniesParams { private CountCompaniesParams( Optional> creditTypeIds, Optional> ids, - Optional limit, + Optional limit, Optional monetizedSubscriptions, - Optional offset, + Optional offset, Optional planId, Optional> planIds, + Optional planVersionId, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, Optional> subscriptionStatuses, Optional> subscriptionTypes, + Optional withEntitlementFor, Optional withSubscription, Optional withoutFeatureOverrideFor, Optional withoutPlan, @@ -83,11 +89,13 @@ private CountCompaniesParams( this.offset = offset; this.planId = planId; this.planIds = planIds; + this.planVersionId = planVersionId; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; this.subscriptionStatuses = subscriptionStatuses; this.subscriptionTypes = subscriptionTypes; + this.withEntitlementFor = withEntitlementFor; this.withSubscription = withSubscription; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; @@ -115,7 +123,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -131,7 +139,7 @@ public Optional getMonetizedSubscriptions() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -151,6 +159,14 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter companies by plan version ID (starts with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search for companies by name, keys or string traits */ @@ -167,6 +183,9 @@ public Optional getSortOrderColumn() { return sortOrderColumn; } + /** + * @return Direction to sort by (asc or desc) + */ @JsonProperty("sort_order_direction") public Optional getSortOrderDirection() { return sortOrderDirection; @@ -188,6 +207,14 @@ public Optional> getSubscriptionTypes() { return subscriptionTypes; } + /** + * @return Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID + */ + @JsonProperty("with_entitlement_for") + public Optional getWithEntitlementFor() { + return withEntitlementFor; + } + /** * @return Filter companies that have a subscription */ @@ -239,11 +266,13 @@ private boolean equalTo(CountCompaniesParams other) { && offset.equals(other.offset) && planId.equals(other.planId) && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) && subscriptionStatuses.equals(other.subscriptionStatuses) && subscriptionTypes.equals(other.subscriptionTypes) + && withEntitlementFor.equals(other.withEntitlementFor) && withSubscription.equals(other.withSubscription) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) && withoutPlan.equals(other.withoutPlan) @@ -260,11 +289,13 @@ public int hashCode() { this.offset, this.planId, this.planIds, + this.planVersionId, this.q, this.sortOrderColumn, this.sortOrderDirection, this.subscriptionStatuses, this.subscriptionTypes, + this.withEntitlementFor, this.withSubscription, this.withoutFeatureOverrideFor, this.withoutPlan, @@ -286,16 +317,18 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional monetizedSubscriptions = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); private Optional> planIds = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -306,6 +339,8 @@ public static final class Builder { private Optional> subscriptionTypes = Optional.empty(); + private Optional withEntitlementFor = Optional.empty(); + private Optional withSubscription = Optional.empty(); private Optional withoutFeatureOverrideFor = Optional.empty(); @@ -327,11 +362,13 @@ public Builder from(CountCompaniesParams other) { offset(other.getOffset()); planId(other.getPlanId()); planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); subscriptionStatuses(other.getSubscriptionStatuses()); subscriptionTypes(other.getSubscriptionTypes()); + withEntitlementFor(other.getWithEntitlementFor()); withSubscription(other.getWithSubscription()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); @@ -371,12 +408,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

*/ @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public Builder limit(Optional limit) { + public Builder limit(Optional limit) { this.limit = limit; return this; } - public Builder limit(Integer limit) { + public Builder limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -399,12 +436,12 @@ public Builder monetizedSubscriptions(Boolean monetizedSubscriptions) { *

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -437,6 +474,20 @@ public Builder planIds(List planIds) { return this; } + /** + *

Filter companies by plan version ID (starts 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 companies by name, keys or string traits

*/ @@ -465,6 +516,9 @@ 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) { this.sortOrderDirection = sortOrderDirection; @@ -504,6 +558,20 @@ public Builder subscriptionTypes(List subscriptionTypes) { return this; } + /** + *

Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID

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

Filter companies that have a subscription

*/ @@ -569,16 +637,28 @@ public CountCompaniesParams build() { offset, planId, planIds, + planVersionId, q, sortOrderColumn, sortOrderDirection, subscriptionStatuses, subscriptionTypes, + withEntitlementFor, withSubscription, withoutFeatureOverrideFor, withoutPlan, withoutSubscription, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesResponse.java index 05d3333..80a3867 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountCompaniesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountCompaniesParams params) { public CountCompaniesResponse build() { return new CountCompaniesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsParams.java index a71dbac..8265e52 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 @@ -26,9 +26,9 @@ public final class CountEntityKeyDefinitionsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -37,8 +37,8 @@ public final class CountEntityKeyDefinitionsParams { private CountEntityKeyDefinitionsParams( Optional entityType, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.entityType = entityType; @@ -63,7 +63,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -71,7 +71,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -119,9 +119,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -165,12 +165,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public Builder q(String q) { public CountEntityKeyDefinitionsParams build() { return new CountEntityKeyDefinitionsParams(entityType, ids, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponse.java index 7e61659..f4a825d 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountEntityKeyDefinitionsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountEntityKeyDefinitionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountEntityKeyDefinitionsParams params) { public CountEntityKeyDefinitionsResponse build() { return new CountEntityKeyDefinitionsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsParams.java index aeced1a..d7eaf13 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 @@ -27,9 +27,9 @@ public final class CountEntityTraitDefinitionsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -42,8 +42,8 @@ public final class CountEntityTraitDefinitionsParams { private CountEntityTraitDefinitionsParams( Optional entityType, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional traitType, Optional> traitTypes, @@ -72,7 +72,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -80,7 +80,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -141,9 +141,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -193,12 +193,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -254,5 +254,15 @@ public CountEntityTraitDefinitionsParams build() { return new CountEntityTraitDefinitionsParams( entityType, ids, limit, offset, q, traitType, traitTypes, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponse.java index 916d285..e7a3b4e 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountEntityTraitDefinitionsResponse.java @@ -91,6 +91,10 @@ public interface ParamsStage { public interface _FinalStage { CountEntityTraitDefinitionsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -134,5 +138,17 @@ public _FinalStage params(@NotNull CountEntityTraitDefinitionsParams params) { public CountEntityTraitDefinitionsResponse build() { return new CountEntityTraitDefinitionsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsParams.java index 59e26a5..e343957 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsParams.java @@ -23,9 +23,9 @@ public final class CountPlanTraitsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; @@ -37,8 +37,8 @@ public final class CountPlanTraitsParams { private CountPlanTraitsParams( Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional traitId, Optional> traitIds, @@ -61,7 +61,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -69,7 +69,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -126,9 +126,9 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); @@ -166,12 +166,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -226,5 +226,15 @@ public Builder traitIds(List traitIds) { public CountPlanTraitsParams build() { return new CountPlanTraitsParams(ids, limit, offset, planId, traitId, traitIds, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsResponse.java index d258c46..e64e87c 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountPlanTraitsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountPlanTraitsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountPlanTraitsParams params) { public CountPlanTraitsResponse build() { return new CountPlanTraitsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountUsersParams.java b/src/main/java/com/schematic/api/resources/companies/types/CountUsersParams.java index 070d3b9..83248e5 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountUsersParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountUsersParams.java @@ -25,9 +25,9 @@ public final class CountUsersParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; @@ -38,8 +38,8 @@ public final class CountUsersParams { private CountUsersParams( Optional companyId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional q, Map additionalProperties) { @@ -72,7 +72,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -80,7 +80,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -140,9 +140,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); @@ -195,12 +195,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -250,5 +250,15 @@ public Builder q(String q) { public CountUsersParams build() { return new CountUsersParams(companyId, ids, limit, offset, planId, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountUsersResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CountUsersResponse.java index 3a068e8..e938d21 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountUsersResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CountUsersResponse.java @@ -89,6 +89,10 @@ public interface ParamsStage { public interface _FinalStage { CountUsersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -132,5 +136,17 @@ public _FinalStage params(@NotNull CountUsersParams params) { public CountUsersResponse build() { return new CountUsersResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CreateCompanyResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CreateCompanyResponse.java index bb4d742..5c74c50 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CreateCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CreateCompanyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateCompanyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateCompanyResponse build() { return new CreateCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CreatePlanTraitResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CreatePlanTraitResponse.java index 0dfc239..cfbafa4 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CreatePlanTraitResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CreatePlanTraitResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreatePlanTraitResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreatePlanTraitResponse build() { return new CreatePlanTraitResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/CreateUserResponse.java b/src/main/java/com/schematic/api/resources/companies/types/CreateUserResponse.java index 41c3f83..597c191 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CreateUserResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/CreateUserResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateUserResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateUserResponse build() { return new CreateUserResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyByKeysResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyByKeysResponse.java index 5fa1946..fc9bdbc 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyByKeysResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyByKeysResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteCompanyByKeysResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteCompanyByKeysResponse build() { return new DeleteCompanyByKeysResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyMembershipResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyMembershipResponse.java index ec1849e..212ad7e 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyMembershipResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyMembershipResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteCompanyMembershipResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteCompanyMembershipResponse build() { return new DeleteCompanyMembershipResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java index b1d7c6e..514d243 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyParams.java @@ -114,5 +114,15 @@ public Builder prorate(Boolean prorate) { public DeleteCompanyParams build() { return new DeleteCompanyParams(cancelSubscription, prorate, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteCompanyResponse.java index b6df20d..fa5866c 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 @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { DeleteCompanyResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull DeleteCompanyParams params) { public DeleteCompanyResponse build() { return new DeleteCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeletePlanTraitResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeletePlanTraitResponse.java index fd00396..14531ed 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeletePlanTraitResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeletePlanTraitResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeletePlanTraitResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeletePlanTraitResponse build() { return new DeletePlanTraitResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteUserByKeysResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteUserByKeysResponse.java index 055a184..bf005f6 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeleteUserByKeysResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteUserByKeysResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteUserByKeysResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteUserByKeysResponse build() { return new DeleteUserByKeysResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/DeleteUserResponse.java b/src/main/java/com/schematic/api/resources/companies/types/DeleteUserResponse.java index 76e25b0..1bc9422 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/DeleteUserResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/DeleteUserResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteUserResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteUserResponse build() { return new DeleteUserResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionParams.java b/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionParams.java index 4fdd985..d157576 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionParams.java @@ -25,17 +25,17 @@ public final class GetActiveCompanySubscriptionParams { private final Optional> companyIds; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private GetActiveCompanySubscriptionParams( Optional companyId, Optional> companyIds, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.companyIds = companyIds; @@ -58,7 +58,7 @@ public Optional> getCompanyIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -109,9 +109,9 @@ public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -152,12 +152,12 @@ public Builder companyIds(List companyIds) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -179,5 +179,15 @@ public Builder offset(Integer offset) { public GetActiveCompanySubscriptionParams build() { return new GetActiveCompanySubscriptionParams(companyId, companyIds, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionResponse.java index 255ee96..df41c20 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetActiveCompanySubscriptionResponse.java @@ -93,6 +93,10 @@ public interface ParamsStage { public interface _FinalStage { GetActiveCompanySubscriptionResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(CompanySubscriptionResponseData data); @@ -158,5 +162,17 @@ public _FinalStage data(List data) { public GetActiveCompanySubscriptionResponse build() { return new GetActiveCompanySubscriptionResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetCompanyResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetCompanyResponse.java index cbb2968..1861fa7 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetCompanyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetCompanyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetCompanyResponse build() { return new GetCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitDefinitionResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitDefinitionResponse.java index 2d4916e..3a9eb72 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitDefinitionResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitDefinitionResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { GetEntityTraitDefinitionResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public GetEntityTraitDefinitionResponse build() { return new GetEntityTraitDefinitionResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesParams.java b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesParams.java index 8e5b495..f899896 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesParams.java @@ -22,9 +22,9 @@ public final class GetEntityTraitValuesParams { private final Optional definitionId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -32,8 +32,8 @@ public final class GetEntityTraitValuesParams { private GetEntityTraitValuesParams( Optional definitionId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.definitionId = definitionId; @@ -52,7 +52,7 @@ public Optional getDefinitionId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional definitionId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -139,12 +139,12 @@ public Builder definitionId(String definitionId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder q(String q) { public GetEntityTraitValuesParams build() { return new GetEntityTraitValuesParams(definitionId, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesResponse.java index ac604f1..4d22c02 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetEntityTraitValuesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { GetEntityTraitValuesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(EntityTraitValue data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public GetEntityTraitValuesResponse build() { return new GetEntityTraitValuesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateCompanyMembershipResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateCompanyMembershipResponse.java index d1ff370..85c50b6 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateCompanyMembershipResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateCompanyMembershipResponse.java @@ -90,6 +90,10 @@ public interface DataStage { public interface _FinalStage { GetOrCreateCompanyMembershipResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -164,5 +168,17 @@ public _FinalStage params(Map params) { public GetOrCreateCompanyMembershipResponse build() { return new GetOrCreateCompanyMembershipResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.java index 9520612..7503fd5 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetOrCreateEntityTraitDefinitionResponse.java @@ -90,6 +90,10 @@ public interface DataStage { public interface _FinalStage { GetOrCreateEntityTraitDefinitionResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -164,5 +168,17 @@ public _FinalStage params(Map params) { public GetOrCreateEntityTraitDefinitionResponse build() { return new GetOrCreateEntityTraitDefinitionResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetPlanChangeResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetPlanChangeResponse.java index 82e7b21..727781a 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetPlanChangeResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetPlanChangeResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetPlanChangeResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetPlanChangeResponse build() { return new GetPlanChangeResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetPlanTraitResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetPlanTraitResponse.java index 68b0e26..d3e0566 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetPlanTraitResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetPlanTraitResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetPlanTraitResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetPlanTraitResponse build() { return new GetPlanTraitResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/GetUserResponse.java b/src/main/java/com/schematic/api/resources/companies/types/GetUserResponse.java index af65346..11090c0 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/GetUserResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/GetUserResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetUserResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetUserResponse build() { return new GetUserResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java deleted file mode 100644 index 7466b19..0000000 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterParams.java +++ /dev/null @@ -1,553 +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.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.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; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListCompaniesForAdvancedFilterParams.Builder.class) -public final class ListCompaniesForAdvancedFilterParams { - private final Optional> creditTypeIds; - - private final Optional> displayProperties; - - private final Optional> featureIds; - - private final Optional> ids; - - private final Optional limit; - - private final Optional monetizedSubscriptions; - - private final Optional offset; - - 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 withoutPlan; - - private final Optional withoutSubscription; - - private final Map additionalProperties; - - private ListCompaniesForAdvancedFilterParams( - Optional> creditTypeIds, - Optional> displayProperties, - Optional> featureIds, - Optional> ids, - Optional limit, - Optional monetizedSubscriptions, - Optional offset, - Optional> planIds, - Optional q, - Optional sortOrderColumn, - Optional sortOrderDirection, - Optional> subscriptionStatuses, - Optional> subscriptionTypes, - Optional withoutPlan, - Optional withoutSubscription, - Map additionalProperties) { - this.creditTypeIds = creditTypeIds; - this.displayProperties = displayProperties; - this.featureIds = featureIds; - this.ids = ids; - this.limit = limit; - this.monetizedSubscriptions = monetizedSubscriptions; - this.offset = offset; - this.planIds = planIds; - this.q = q; - this.sortOrderColumn = sortOrderColumn; - this.sortOrderDirection = sortOrderDirection; - this.subscriptionStatuses = subscriptionStatuses; - this.subscriptionTypes = subscriptionTypes; - 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 Select the display columns to return (e.g. plan, subscription, users, last_seen_at) - */ - @JsonProperty("display_properties") - public Optional> getDisplayProperties() { - return displayProperties; - } - - /** - * @return Filter companies by one or more feature IDs (each ID starts with feat_) - */ - @JsonProperty("feature_ids") - public Optional> getFeatureIds() { - return featureIds; - } - - /** - * @return Filter companies by multiple company IDs (starts with comp_) - */ - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - /** - * @return Page limit (default 100) - */ - @JsonProperty("limit") - 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) - */ - @JsonProperty("offset") - public Optional getOffset() { - return offset; - } - - /** - * @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 - */ - @JsonProperty("q") - 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 (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid) - */ - @JsonProperty("subscription_statuses") - public Optional> getSubscriptionStatuses() { - return subscriptionStatuses; - } - - /** - * @return Filter companies by one or more subscription types (paid, free, trial) - */ - @JsonProperty("subscription_types") - public Optional> getSubscriptionTypes() { - return subscriptionTypes; - } - - /** - * @return Filter out companies that have a plan - */ - @JsonProperty("without_plan") - 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; - return other instanceof ListCompaniesForAdvancedFilterParams - && equalTo((ListCompaniesForAdvancedFilterParams) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListCompaniesForAdvancedFilterParams other) { - return creditTypeIds.equals(other.creditTypeIds) - && displayProperties.equals(other.displayProperties) - && featureIds.equals(other.featureIds) - && ids.equals(other.ids) - && limit.equals(other.limit) - && monetizedSubscriptions.equals(other.monetizedSubscriptions) - && offset.equals(other.offset) - && planIds.equals(other.planIds) - && q.equals(other.q) - && sortOrderColumn.equals(other.sortOrderColumn) - && sortOrderDirection.equals(other.sortOrderDirection) - && subscriptionStatuses.equals(other.subscriptionStatuses) - && subscriptionTypes.equals(other.subscriptionTypes) - && withoutPlan.equals(other.withoutPlan) - && withoutSubscription.equals(other.withoutSubscription); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.creditTypeIds, - this.displayProperties, - this.featureIds, - this.ids, - this.limit, - this.monetizedSubscriptions, - this.offset, - this.planIds, - this.q, - this.sortOrderColumn, - this.sortOrderDirection, - this.subscriptionStatuses, - this.subscriptionTypes, - this.withoutPlan, - this.withoutSubscription); - } - - @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> creditTypeIds = Optional.empty(); - - private Optional> displayProperties = Optional.empty(); - - private Optional> featureIds = Optional.empty(); - - private Optional> ids = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional monetizedSubscriptions = Optional.empty(); - - private Optional offset = 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 withoutPlan = Optional.empty(); - - private Optional withoutSubscription = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListCompaniesForAdvancedFilterParams other) { - creditTypeIds(other.getCreditTypeIds()); - displayProperties(other.getDisplayProperties()); - featureIds(other.getFeatureIds()); - ids(other.getIds()); - limit(other.getLimit()); - monetizedSubscriptions(other.getMonetizedSubscriptions()); - offset(other.getOffset()); - planIds(other.getPlanIds()); - q(other.getQ()); - sortOrderColumn(other.getSortOrderColumn()); - sortOrderDirection(other.getSortOrderDirection()); - subscriptionStatuses(other.getSubscriptionStatuses()); - subscriptionTypes(other.getSubscriptionTypes()); - 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; - } - - /** - *

Select the display columns to return (e.g. plan, subscription, users, last_seen_at)

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

Filter companies by one or more feature IDs (each ID starts with feat_)

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

Filter companies by multiple company IDs (starts with comp_)

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

Page limit (default 100)

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

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

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

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

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 (active, canceled, expired, incomplete, incomplete_expired, past_due, paused, trialing, unpaid)

- */ - @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 (paid, free, trial)

- */ - @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 out companies that have a plan

- */ - @JsonSetter(value = "without_plan", nulls = Nulls.SKIP) - public Builder withoutPlan(Optional withoutPlan) { - this.withoutPlan = withoutPlan; - return this; - } - - public Builder withoutPlan(Boolean withoutPlan) { - this.withoutPlan = Optional.ofNullable(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 ListCompaniesForAdvancedFilterParams build() { - return new ListCompaniesForAdvancedFilterParams( - creditTypeIds, - displayProperties, - featureIds, - ids, - limit, - monetizedSubscriptions, - offset, - planIds, - q, - sortOrderColumn, - sortOrderDirection, - subscriptionStatuses, - subscriptionTypes, - withoutPlan, - withoutSubscription, - additionalProperties); - } - } -} 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 cda01d0..e891234 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 @@ -28,16 +28,18 @@ public final class ListCompaniesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; private final Optional monetizedSubscriptions; - private final Optional offset; + private final Optional offset; private final Optional planId; private final Optional> planIds; + private final Optional planVersionId; + private final Optional q; private final Optional sortOrderColumn; @@ -48,6 +50,8 @@ public final class ListCompaniesParams { private final Optional> subscriptionTypes; + private final Optional withEntitlementFor; + private final Optional withSubscription; private final Optional withoutFeatureOverrideFor; @@ -61,16 +65,18 @@ public final class ListCompaniesParams { private ListCompaniesParams( Optional> creditTypeIds, Optional> ids, - Optional limit, + Optional limit, Optional monetizedSubscriptions, - Optional offset, + Optional offset, Optional planId, Optional> planIds, + Optional planVersionId, Optional q, Optional sortOrderColumn, Optional sortOrderDirection, Optional> subscriptionStatuses, Optional> subscriptionTypes, + Optional withEntitlementFor, Optional withSubscription, Optional withoutFeatureOverrideFor, Optional withoutPlan, @@ -83,11 +89,13 @@ private ListCompaniesParams( this.offset = offset; this.planId = planId; this.planIds = planIds; + this.planVersionId = planVersionId; this.q = q; this.sortOrderColumn = sortOrderColumn; this.sortOrderDirection = sortOrderDirection; this.subscriptionStatuses = subscriptionStatuses; this.subscriptionTypes = subscriptionTypes; + this.withEntitlementFor = withEntitlementFor; this.withSubscription = withSubscription; this.withoutFeatureOverrideFor = withoutFeatureOverrideFor; this.withoutPlan = withoutPlan; @@ -115,7 +123,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -131,7 +139,7 @@ public Optional getMonetizedSubscriptions() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -151,6 +159,14 @@ public Optional> getPlanIds() { return planIds; } + /** + * @return Filter companies by plan version ID (starts with plvr_) + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search for companies by name, keys or string traits */ @@ -167,6 +183,9 @@ public Optional getSortOrderColumn() { return sortOrderColumn; } + /** + * @return Direction to sort by (asc or desc) + */ @JsonProperty("sort_order_direction") public Optional getSortOrderDirection() { return sortOrderDirection; @@ -188,6 +207,14 @@ public Optional> getSubscriptionTypes() { return subscriptionTypes; } + /** + * @return Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID + */ + @JsonProperty("with_entitlement_for") + public Optional getWithEntitlementFor() { + return withEntitlementFor; + } + /** * @return Filter companies that have a subscription */ @@ -239,11 +266,13 @@ private boolean equalTo(ListCompaniesParams other) { && offset.equals(other.offset) && planId.equals(other.planId) && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && sortOrderColumn.equals(other.sortOrderColumn) && sortOrderDirection.equals(other.sortOrderDirection) && subscriptionStatuses.equals(other.subscriptionStatuses) && subscriptionTypes.equals(other.subscriptionTypes) + && withEntitlementFor.equals(other.withEntitlementFor) && withSubscription.equals(other.withSubscription) && withoutFeatureOverrideFor.equals(other.withoutFeatureOverrideFor) && withoutPlan.equals(other.withoutPlan) @@ -260,11 +289,13 @@ public int hashCode() { this.offset, this.planId, this.planIds, + this.planVersionId, this.q, this.sortOrderColumn, this.sortOrderDirection, this.subscriptionStatuses, this.subscriptionTypes, + this.withEntitlementFor, this.withSubscription, this.withoutFeatureOverrideFor, this.withoutPlan, @@ -286,16 +317,18 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional monetizedSubscriptions = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); private Optional> planIds = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional q = Optional.empty(); private Optional sortOrderColumn = Optional.empty(); @@ -306,6 +339,8 @@ public static final class Builder { private Optional> subscriptionTypes = Optional.empty(); + private Optional withEntitlementFor = Optional.empty(); + private Optional withSubscription = Optional.empty(); private Optional withoutFeatureOverrideFor = Optional.empty(); @@ -327,11 +362,13 @@ public Builder from(ListCompaniesParams other) { offset(other.getOffset()); planId(other.getPlanId()); planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); sortOrderColumn(other.getSortOrderColumn()); sortOrderDirection(other.getSortOrderDirection()); subscriptionStatuses(other.getSubscriptionStatuses()); subscriptionTypes(other.getSubscriptionTypes()); + withEntitlementFor(other.getWithEntitlementFor()); withSubscription(other.getWithSubscription()); withoutFeatureOverrideFor(other.getWithoutFeatureOverrideFor()); withoutPlan(other.getWithoutPlan()); @@ -371,12 +408,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

*/ @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public Builder limit(Optional limit) { + public Builder limit(Optional limit) { this.limit = limit; return this; } - public Builder limit(Integer limit) { + public Builder limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -399,12 +436,12 @@ public Builder monetizedSubscriptions(Boolean monetizedSubscriptions) { *

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -437,6 +474,20 @@ public Builder planIds(List planIds) { return this; } + /** + *

Filter companies by plan version ID (starts 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 companies by name, keys or string traits

*/ @@ -465,6 +516,9 @@ 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) { this.sortOrderDirection = sortOrderDirection; @@ -504,6 +558,20 @@ public Builder subscriptionTypes(List subscriptionTypes) { return this; } + /** + *

Filter companies that have an entitlement (plan entitlement or company override) for the specified feature ID

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

Filter companies that have a subscription

*/ @@ -569,16 +637,28 @@ public ListCompaniesParams build() { offset, planId, planIds, + planVersionId, q, sortOrderColumn, sortOrderDirection, subscriptionStatuses, subscriptionTypes, + withEntitlementFor, withSubscription, withoutFeatureOverrideFor, withoutPlan, withoutSubscription, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesResponse.java index af8a83e..ef54a8a 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListCompaniesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(CompanyDetailResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListCompaniesResponse build() { return new ListCompaniesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsParams.java index e49f151..4965999 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsParams.java @@ -22,9 +22,9 @@ public final class ListCompanyMembershipsParams { private final Optional companyId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional userId; @@ -32,8 +32,8 @@ public final class ListCompanyMembershipsParams { private ListCompanyMembershipsParams( Optional companyId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional userId, Map additionalProperties) { this.companyId = companyId; @@ -52,7 +52,7 @@ public Optional getCompanyId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional companyId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional userId = Optional.empty(); @@ -139,12 +139,12 @@ public Builder companyId(String companyId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder userId(String userId) { public ListCompanyMembershipsParams build() { return new ListCompanyMembershipsParams(companyId, limit, offset, userId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsResponse.java index 3b8a1b2..77f8e5c 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListCompanyMembershipsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListCompanyMembershipsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(CompanyMembershipDetailResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListCompanyMembershipsResponse build() { return new ListCompanyMembershipsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsParams.java index 7928b91..e5eac3c 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 @@ -26,9 +26,9 @@ public final class ListEntityKeyDefinitionsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -37,8 +37,8 @@ public final class ListEntityKeyDefinitionsParams { private ListEntityKeyDefinitionsParams( Optional entityType, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.entityType = entityType; @@ -63,7 +63,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -71,7 +71,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -119,9 +119,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -165,12 +165,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public Builder q(String q) { public ListEntityKeyDefinitionsParams build() { return new ListEntityKeyDefinitionsParams(entityType, ids, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponse.java index eaf66ff..540a9ce 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListEntityKeyDefinitionsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListEntityKeyDefinitionsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(EntityKeyDefinitionResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListEntityKeyDefinitionsResponse build() { return new ListEntityKeyDefinitionsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsParams.java index 6a894b6..1e4e3a8 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 @@ -27,9 +27,9 @@ public final class ListEntityTraitDefinitionsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -42,8 +42,8 @@ public final class ListEntityTraitDefinitionsParams { private ListEntityTraitDefinitionsParams( Optional entityType, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional traitType, Optional> traitTypes, @@ -72,7 +72,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -80,7 +80,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -141,9 +141,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -193,12 +193,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -254,5 +254,15 @@ public ListEntityTraitDefinitionsParams build() { return new ListEntityTraitDefinitionsParams( entityType, ids, limit, offset, q, traitType, traitTypes, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponse.java index f1e2a41..945f081 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListEntityTraitDefinitionsResponse.java @@ -93,6 +93,10 @@ public interface ParamsStage { public interface _FinalStage { ListEntityTraitDefinitionsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(EntityTraitDefinitionResponseData data); @@ -158,5 +162,17 @@ public _FinalStage data(List data) { public ListEntityTraitDefinitionsResponse build() { return new ListEntityTraitDefinitionsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java index 2ff1fb9..4132ac5 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesParams.java @@ -29,9 +29,9 @@ public final class ListPlanChangesParams { private final Optional> companyIds; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional> planIds; @@ -42,8 +42,8 @@ private ListPlanChangesParams( Optional basePlanAction, Optional companyId, Optional> companyIds, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional> planIds, Map additionalProperties) { this.action = action; @@ -80,7 +80,7 @@ public Optional> getCompanyIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -88,7 +88,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -149,9 +149,9 @@ public static final class Builder { private Optional> companyIds = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional> planIds = Optional.empty(); @@ -219,12 +219,12 @@ public Builder companyIds(List companyIds) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -258,5 +258,15 @@ public ListPlanChangesParams build() { return new ListPlanChangesParams( action, basePlanAction, companyId, companyIds, limit, offset, planIds, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesResponse.java index 3a88339..b0bde3d 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListPlanChangesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListPlanChangesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(PlanChangeResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListPlanChangesResponse build() { return new ListPlanChangesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsParams.java index 502e65a..9e8c883 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsParams.java @@ -23,9 +23,9 @@ public final class ListPlanTraitsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; @@ -37,8 +37,8 @@ public final class ListPlanTraitsParams { private ListPlanTraitsParams( Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional traitId, Optional> traitIds, @@ -61,7 +61,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -69,7 +69,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -126,9 +126,9 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); @@ -166,12 +166,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -226,5 +226,15 @@ public Builder traitIds(List traitIds) { public ListPlanTraitsParams build() { return new ListPlanTraitsParams(ids, limit, offset, planId, traitId, traitIds, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsResponse.java index 05040aa..f9e116f 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListPlanTraitsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListPlanTraitsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(PlanTraitResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListPlanTraitsResponse build() { return new ListPlanTraitsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListUsersParams.java b/src/main/java/com/schematic/api/resources/companies/types/ListUsersParams.java index fe12e81..9221259 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListUsersParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListUsersParams.java @@ -25,9 +25,9 @@ public final class ListUsersParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; @@ -38,8 +38,8 @@ public final class ListUsersParams { private ListUsersParams( Optional companyId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional q, Map additionalProperties) { @@ -72,7 +72,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -80,7 +80,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -140,9 +140,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); @@ -195,12 +195,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -250,5 +250,15 @@ public Builder q(String q) { public ListUsersParams build() { return new ListUsersParams(companyId, ids, limit, offset, planId, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListUsersResponse.java b/src/main/java/com/schematic/api/resources/companies/types/ListUsersResponse.java index 7cb60ae..d854710 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListUsersResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/ListUsersResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListUsersResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(UserDetailResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListUsersResponse build() { return new ListUsersResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyParams.java b/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyParams.java index e197483..c66e39c 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyParams.java @@ -91,5 +91,15 @@ public Builder keys(Map keys) { public LookupCompanyParams build() { return new LookupCompanyParams(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyResponse.java b/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyResponse.java index f949c96..a6376e1 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/LookupCompanyResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { LookupCompanyResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull LookupCompanyParams params) { public LookupCompanyResponse build() { return new LookupCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/LookupUserParams.java b/src/main/java/com/schematic/api/resources/companies/types/LookupUserParams.java index e3386bf..fced36a 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/LookupUserParams.java +++ b/src/main/java/com/schematic/api/resources/companies/types/LookupUserParams.java @@ -91,5 +91,15 @@ public Builder keys(Map keys) { public LookupUserParams build() { return new LookupUserParams(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/LookupUserResponse.java b/src/main/java/com/schematic/api/resources/companies/types/LookupUserResponse.java index f1a4520..ed63fe7 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/LookupUserResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/LookupUserResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { LookupUserResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull LookupUserParams params) { public LookupUserResponse build() { return new LookupUserResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionResponse.java index d779677..4a9e1da 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpdateEntityTraitDefinitionResponse.java @@ -90,6 +90,10 @@ public interface DataStage { public interface _FinalStage { UpdateEntityTraitDefinitionResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -164,5 +168,17 @@ public _FinalStage params(Map params) { public UpdateEntityTraitDefinitionResponse build() { return new UpdateEntityTraitDefinitionResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitResponse.java index 1b8fe94..f2a9bac 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdatePlanTraitResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdatePlanTraitResponse build() { return new UpdatePlanTraitResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitsBulkResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitsBulkResponse.java index 3471e94..36152d9 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitsBulkResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpdatePlanTraitsBulkResponse.java @@ -144,5 +144,15 @@ public Builder params(String key, JsonNode value) { public UpdatePlanTraitsBulkResponse build() { return new UpdatePlanTraitsBulkResponse(data, params, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyResponse.java index d70c0bb..3cab35c 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertCompanyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertCompanyResponse build() { return new UpsertCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyTraitResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyTraitResponse.java index 8b35a1d..c339933 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyTraitResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpsertCompanyTraitResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertCompanyTraitResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertCompanyTraitResponse build() { return new UpsertCompanyTraitResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpsertUserResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpsertUserResponse.java index 8ffaf1e..410fe31 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpsertUserResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpsertUserResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertUserResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertUserResponse build() { return new UpsertUserResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/UpsertUserTraitResponse.java b/src/main/java/com/schematic/api/resources/companies/types/UpsertUserTraitResponse.java index 42b9b25..4215beb 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/UpsertUserTraitResponse.java +++ b/src/main/java/com/schematic/api/resources/companies/types/UpsertUserTraitResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpsertUserTraitResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpsertUserTraitResponse build() { return new UpsertUserTraitResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java b/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java index c221b61..b4a88ae 100644 --- a/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/AsyncComponentsClient.java @@ -40,6 +40,10 @@ public CompletableFuture listComponents() { return this.rawClient.listComponents().thenApply(response -> response.body()); } + public CompletableFuture listComponents(RequestOptions requestOptions) { + return this.rawClient.listComponents(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listComponents(ListComponentsRequest request) { return this.rawClient.listComponents(request).thenApply(response -> response.body()); } @@ -70,6 +74,11 @@ public CompletableFuture updateComponent(String compone return this.rawClient.updateComponent(componentId).thenApply(response -> response.body()); } + public CompletableFuture updateComponent( + String componentId, RequestOptions requestOptions) { + return this.rawClient.updateComponent(componentId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updateComponent( String componentId, UpdateComponentRequestBody request) { return this.rawClient.updateComponent(componentId, request).thenApply(response -> response.body()); @@ -95,6 +104,10 @@ public CompletableFuture countComponents() { return this.rawClient.countComponents().thenApply(response -> response.body()); } + public CompletableFuture countComponents(RequestOptions requestOptions) { + return this.rawClient.countComponents(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countComponents(CountComponentsRequest request) { return this.rawClient.countComponents(request).thenApply(response -> response.body()); } @@ -108,6 +121,10 @@ public CompletableFuture previewComponentData() { return this.rawClient.previewComponentData().thenApply(response -> response.body()); } + public CompletableFuture previewComponentData(RequestOptions requestOptions) { + return this.rawClient.previewComponentData(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture previewComponentData(PreviewComponentDataRequest request) { return this.rawClient.previewComponentData(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java index f64e026..c371371 100644 --- a/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/AsyncRawComponentsClient.java @@ -54,6 +54,11 @@ public CompletableFuture> list return listComponents(ListComponentsRequest.builder().build()); } + public CompletableFuture> listComponents( + RequestOptions requestOptions) { + return listComponents(ListComponentsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listComponents( ListComponentsRequest request) { return listComponents(request, null); @@ -75,6 +80,11 @@ public CompletableFuture> list QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -90,14 +100,13 @@ public CompletableFuture> list @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListComponentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListComponentsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -129,11 +138,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -155,10 +162,14 @@ public CompletableFuture> cre public CompletableFuture> createComponent( CreateComponentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("components") - .build(); + .addPathSegments("components"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -167,7 +178,7 @@ public CompletableFuture> cre throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -182,14 +193,13 @@ public CompletableFuture> cre @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateComponentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -221,11 +231,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -246,13 +254,17 @@ public CompletableFuture> getCom public CompletableFuture> getComponent( String componentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) - .build(); + .addPathSegment(componentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -266,13 +278,13 @@ public CompletableFuture> getCom @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -299,11 +311,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -322,6 +332,11 @@ public CompletableFuture> upd return updateComponent(componentId, UpdateComponentRequestBody.builder().build()); } + public CompletableFuture> updateComponent( + String componentId, RequestOptions requestOptions) { + return updateComponent(componentId, UpdateComponentRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> updateComponent( String componentId, UpdateComponentRequestBody request) { return updateComponent(componentId, request, null); @@ -329,11 +344,15 @@ public CompletableFuture> upd public CompletableFuture> updateComponent( String componentId, UpdateComponentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) - .build(); + .addPathSegment(componentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -342,7 +361,7 @@ public CompletableFuture> upd throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -357,14 +376,13 @@ public CompletableFuture> upd @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateComponentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -396,11 +414,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -421,13 +437,17 @@ public CompletableFuture> del public CompletableFuture> deleteComponent( String componentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) - .build(); + .addPathSegment(componentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -441,14 +461,13 @@ public CompletableFuture> del @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteComponentResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -480,11 +499,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -503,6 +520,11 @@ public CompletableFuture> cou return countComponents(CountComponentsRequest.builder().build()); } + public CompletableFuture> countComponents( + RequestOptions requestOptions) { + return countComponents(CountComponentsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countComponents( CountComponentsRequest request) { return countComponents(request, null); @@ -524,6 +546,11 @@ public CompletableFuture> cou QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -539,14 +566,13 @@ public CompletableFuture> cou @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountComponentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountComponentsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -578,11 +604,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -601,6 +625,11 @@ public CompletableFuture return previewComponentData(PreviewComponentDataRequest.builder().build()); } + public CompletableFuture> previewComponentData( + RequestOptions requestOptions) { + return previewComponentData(PreviewComponentDataRequest.builder().build(), requestOptions); + } + public CompletableFuture> previewComponentData( PreviewComponentDataRequest request) { return previewComponentData(request, null); @@ -619,6 +648,11 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "component_id", request.getComponentId().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -634,14 +668,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), PreviewComponentDataResponse.class), + responseBodyString, PreviewComponentDataResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -668,11 +702,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/components/ComponentsClient.java b/src/main/java/com/schematic/api/resources/components/ComponentsClient.java index 4710500..b74cc6e 100644 --- a/src/main/java/com/schematic/api/resources/components/ComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/ComponentsClient.java @@ -39,6 +39,10 @@ public ListComponentsResponse listComponents() { return this.rawClient.listComponents().body(); } + public ListComponentsResponse listComponents(RequestOptions requestOptions) { + return this.rawClient.listComponents(requestOptions).body(); + } + public ListComponentsResponse listComponents(ListComponentsRequest request) { return this.rawClient.listComponents(request).body(); } @@ -67,6 +71,10 @@ public UpdateComponentResponse updateComponent(String componentId) { return this.rawClient.updateComponent(componentId).body(); } + public UpdateComponentResponse updateComponent(String componentId, RequestOptions requestOptions) { + return this.rawClient.updateComponent(componentId, requestOptions).body(); + } + public UpdateComponentResponse updateComponent(String componentId, UpdateComponentRequestBody request) { return this.rawClient.updateComponent(componentId, request).body(); } @@ -90,6 +98,10 @@ public CountComponentsResponse countComponents() { return this.rawClient.countComponents().body(); } + public CountComponentsResponse countComponents(RequestOptions requestOptions) { + return this.rawClient.countComponents(requestOptions).body(); + } + public CountComponentsResponse countComponents(CountComponentsRequest request) { return this.rawClient.countComponents(request).body(); } @@ -102,6 +114,10 @@ public PreviewComponentDataResponse previewComponentData() { return this.rawClient.previewComponentData().body(); } + public PreviewComponentDataResponse previewComponentData(RequestOptions requestOptions) { + return this.rawClient.previewComponentData(requestOptions).body(); + } + public PreviewComponentDataResponse previewComponentData(PreviewComponentDataRequest request) { return this.rawClient.previewComponentData(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java b/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java index c1f1249..27cbb40 100644 --- a/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java +++ b/src/main/java/com/schematic/api/resources/components/RawComponentsClient.java @@ -50,6 +50,10 @@ public BaseSchematicHttpResponse listComponents() { return listComponents(ListComponentsRequest.builder().build()); } + public BaseSchematicHttpResponse listComponents(RequestOptions requestOptions) { + return listComponents(ListComponentsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listComponents(ListComponentsRequest request) { return listComponents(request, null); } @@ -70,6 +74,11 @@ public BaseSchematicHttpResponse listComponents( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -82,12 +91,12 @@ public BaseSchematicHttpResponse listComponents( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListComponentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListComponentsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -109,11 +118,9 @@ public BaseSchematicHttpResponse listComponents( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -125,10 +132,14 @@ public BaseSchematicHttpResponse createComponent(Create public BaseSchematicHttpResponse createComponent( CreateComponentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("components") - .build(); + .addPathSegments("components"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -137,7 +148,7 @@ public BaseSchematicHttpResponse createComponent( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -149,12 +160,12 @@ public BaseSchematicHttpResponse createComponent( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateComponentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -176,11 +187,9 @@ public BaseSchematicHttpResponse createComponent( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -192,13 +201,17 @@ public BaseSchematicHttpResponse getComponent(String compo public BaseSchematicHttpResponse getComponent( String componentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) - .build(); + .addPathSegment(componentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -209,12 +222,11 @@ public BaseSchematicHttpResponse getComponent( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetComponentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -233,11 +245,9 @@ public BaseSchematicHttpResponse getComponent( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -247,6 +257,11 @@ public BaseSchematicHttpResponse updateComponent(String return updateComponent(componentId, UpdateComponentRequestBody.builder().build()); } + public BaseSchematicHttpResponse updateComponent( + String componentId, RequestOptions requestOptions) { + return updateComponent(componentId, UpdateComponentRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse updateComponent( String componentId, UpdateComponentRequestBody request) { return updateComponent(componentId, request, null); @@ -254,11 +269,15 @@ public BaseSchematicHttpResponse updateComponent( public BaseSchematicHttpResponse updateComponent( String componentId, UpdateComponentRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) - .build(); + .addPathSegment(componentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -267,7 +286,7 @@ public BaseSchematicHttpResponse updateComponent( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -279,12 +298,12 @@ public BaseSchematicHttpResponse updateComponent( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateComponentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -306,11 +325,9 @@ public BaseSchematicHttpResponse updateComponent( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -322,13 +339,17 @@ public BaseSchematicHttpResponse deleteComponent(String public BaseSchematicHttpResponse deleteComponent( String componentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("components") - .addPathSegment(componentId) - .build(); + .addPathSegment(componentId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -339,12 +360,12 @@ public BaseSchematicHttpResponse deleteComponent( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteComponentResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteComponentResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -366,11 +387,9 @@ public BaseSchematicHttpResponse deleteComponent( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -380,6 +399,10 @@ public BaseSchematicHttpResponse countComponents() { return countComponents(CountComponentsRequest.builder().build()); } + public BaseSchematicHttpResponse countComponents(RequestOptions requestOptions) { + return countComponents(CountComponentsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countComponents(CountComponentsRequest request) { return countComponents(request, null); } @@ -400,6 +423,11 @@ public BaseSchematicHttpResponse countComponents( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -412,12 +440,12 @@ public BaseSchematicHttpResponse countComponents( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountComponentsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountComponentsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -439,11 +467,9 @@ public BaseSchematicHttpResponse countComponents( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -453,6 +479,10 @@ public BaseSchematicHttpResponse previewComponentD return previewComponentData(PreviewComponentDataRequest.builder().build()); } + public BaseSchematicHttpResponse previewComponentData(RequestOptions requestOptions) { + return previewComponentData(PreviewComponentDataRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse previewComponentData( PreviewComponentDataRequest request) { return previewComponentData(request, null); @@ -471,6 +501,11 @@ public BaseSchematicHttpResponse previewComponentD QueryStringMapper.addQueryParameter( httpUrl, "component_id", request.getComponentId().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -483,12 +518,12 @@ public BaseSchematicHttpResponse previewComponentD } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PreviewComponentDataResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PreviewComponentDataResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -507,11 +542,9 @@ public BaseSchematicHttpResponse previewComponentD } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/components/requests/CountComponentsRequest.java b/src/main/java/com/schematic/api/resources/components/requests/CountComponentsRequest.java index 4c4ffdb..9553ad2 100644 --- a/src/main/java/com/schematic/api/resources/components/requests/CountComponentsRequest.java +++ b/src/main/java/com/schematic/api/resources/components/requests/CountComponentsRequest.java @@ -22,17 +22,14 @@ public final class CountComponentsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountComponentsRequest( - Optional q, - Optional limit, - Optional offset, - Map additionalProperties) { + Optional q, Optional limit, Optional offset, Map additionalProperties) { this.q = q; this.limit = limit; this.offset = offset; @@ -48,7 +45,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -56,7 +53,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -93,9 +90,9 @@ public static Builder builder() { public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,12 +121,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder offset(Integer offset) { public CountComponentsRequest build() { return new CountComponentsRequest(q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/requests/CreateComponentRequestBody.java b/src/main/java/com/schematic/api/resources/components/requests/CreateComponentRequestBody.java index 02d9a0a..92cbfe5 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 @@ -98,6 +98,10 @@ public interface NameStage { public interface _FinalStage { CreateComponentRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage ast(Optional> ast); _FinalStage ast(Map ast); @@ -155,5 +159,17 @@ public _FinalStage ast(Optional> ast) { public CreateComponentRequestBody build() { return new CreateComponentRequestBody(ast, entityType, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/requests/ListComponentsRequest.java b/src/main/java/com/schematic/api/resources/components/requests/ListComponentsRequest.java index a3dde72..9f45256 100644 --- a/src/main/java/com/schematic/api/resources/components/requests/ListComponentsRequest.java +++ b/src/main/java/com/schematic/api/resources/components/requests/ListComponentsRequest.java @@ -22,17 +22,14 @@ public final class ListComponentsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListComponentsRequest( - Optional q, - Optional limit, - Optional offset, - Map additionalProperties) { + Optional q, Optional limit, Optional offset, Map additionalProperties) { this.q = q; this.limit = limit; this.offset = offset; @@ -48,7 +45,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -56,7 +53,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -93,9 +90,9 @@ public static Builder builder() { public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,12 +121,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder offset(Integer offset) { public ListComponentsRequest build() { return new ListComponentsRequest(q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/requests/PreviewComponentDataRequest.java b/src/main/java/com/schematic/api/resources/components/requests/PreviewComponentDataRequest.java index e3aef92..7b1ff0f 100644 --- a/src/main/java/com/schematic/api/resources/components/requests/PreviewComponentDataRequest.java +++ b/src/main/java/com/schematic/api/resources/components/requests/PreviewComponentDataRequest.java @@ -114,5 +114,15 @@ public Builder componentId(String componentId) { public PreviewComponentDataRequest build() { return new PreviewComponentDataRequest(companyId, componentId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/requests/UpdateComponentRequestBody.java b/src/main/java/com/schematic/api/resources/components/requests/UpdateComponentRequestBody.java index d0078a7..aa2902d 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 @@ -167,5 +167,15 @@ public Builder state(ComponentState state) { public UpdateComponentRequestBody build() { return new UpdateComponentRequestBody(ast, entityType, name, state, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/CountComponentsParams.java b/src/main/java/com/schematic/api/resources/components/types/CountComponentsParams.java index cf846a7..a81ce8d 100644 --- a/src/main/java/com/schematic/api/resources/components/types/CountComponentsParams.java +++ b/src/main/java/com/schematic/api/resources/components/types/CountComponentsParams.java @@ -20,19 +20,16 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountComponentsParams.Builder.class) public final class CountComponentsParams { - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; private final Map additionalProperties; private CountComponentsParams( - Optional limit, - Optional offset, - Optional q, - Map additionalProperties) { + Optional limit, Optional offset, Optional q, Map additionalProperties) { this.limit = limit; this.offset = offset; this.q = q; @@ -43,7 +40,7 @@ private CountComponentsParams( * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -51,7 +48,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -91,9 +88,9 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -113,12 +110,12 @@ public Builder from(CountComponentsParams other) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder q(String q) { public CountComponentsParams build() { return new CountComponentsParams(limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/CountComponentsResponse.java b/src/main/java/com/schematic/api/resources/components/types/CountComponentsResponse.java index 3c0b122..e90d21e 100644 --- a/src/main/java/com/schematic/api/resources/components/types/CountComponentsResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/CountComponentsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountComponentsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountComponentsParams params) { public CountComponentsResponse build() { return new CountComponentsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/CreateComponentResponse.java b/src/main/java/com/schematic/api/resources/components/types/CreateComponentResponse.java index 4252eab..489b436 100644 --- a/src/main/java/com/schematic/api/resources/components/types/CreateComponentResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/CreateComponentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateComponentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateComponentResponse build() { return new CreateComponentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/DeleteComponentResponse.java b/src/main/java/com/schematic/api/resources/components/types/DeleteComponentResponse.java index c059941..745e666 100644 --- a/src/main/java/com/schematic/api/resources/components/types/DeleteComponentResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/DeleteComponentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteComponentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteComponentResponse build() { return new DeleteComponentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/GetComponentResponse.java b/src/main/java/com/schematic/api/resources/components/types/GetComponentResponse.java index 89a859d..b1cfb86 100644 --- a/src/main/java/com/schematic/api/resources/components/types/GetComponentResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/GetComponentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetComponentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetComponentResponse build() { return new GetComponentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/ListComponentsParams.java b/src/main/java/com/schematic/api/resources/components/types/ListComponentsParams.java index 60132f1..1064cee 100644 --- a/src/main/java/com/schematic/api/resources/components/types/ListComponentsParams.java +++ b/src/main/java/com/schematic/api/resources/components/types/ListComponentsParams.java @@ -20,19 +20,16 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListComponentsParams.Builder.class) public final class ListComponentsParams { - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; private final Map additionalProperties; private ListComponentsParams( - Optional limit, - Optional offset, - Optional q, - Map additionalProperties) { + Optional limit, Optional offset, Optional q, Map additionalProperties) { this.limit = limit; this.offset = offset; this.q = q; @@ -43,7 +40,7 @@ private ListComponentsParams( * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -51,7 +48,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -91,9 +88,9 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -113,12 +110,12 @@ public Builder from(ListComponentsParams other) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder q(String q) { public ListComponentsParams build() { return new ListComponentsParams(limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/ListComponentsResponse.java b/src/main/java/com/schematic/api/resources/components/types/ListComponentsResponse.java index 8b69d69..2497898 100644 --- a/src/main/java/com/schematic/api/resources/components/types/ListComponentsResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/ListComponentsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListComponentsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(ComponentResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListComponentsResponse build() { return new ListComponentsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataParams.java b/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataParams.java index 9a7d4b6..30d7470 100644 --- a/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataParams.java +++ b/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataParams.java @@ -114,5 +114,15 @@ public Builder componentId(String componentId) { public PreviewComponentDataParams build() { return new PreviewComponentDataParams(companyId, componentId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataResponse.java b/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataResponse.java index 4e404c3..187fdae 100644 --- a/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/PreviewComponentDataResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { PreviewComponentDataResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -135,5 +139,17 @@ public _FinalStage params(@NotNull PreviewComponentDataParams params) { public PreviewComponentDataResponse build() { return new PreviewComponentDataResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/components/types/UpdateComponentResponse.java b/src/main/java/com/schematic/api/resources/components/types/UpdateComponentResponse.java index e53a3d3..99a7caf 100644 --- a/src/main/java/com/schematic/api/resources/components/types/UpdateComponentResponse.java +++ b/src/main/java/com/schematic/api/resources/components/types/UpdateComponentResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateComponentResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateComponentResponse build() { return new UpdateComponentResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/componentspublic/AsyncComponentspublicClient.java b/src/main/java/com/schematic/api/resources/componentspublic/AsyncComponentspublicClient.java new file mode 100644 index 0000000..368418f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/componentspublic/AsyncComponentspublicClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.componentspublic; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.componentspublic.types.GetPublicPlansResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncComponentspublicClient { + protected final ClientOptions clientOptions; + + private final AsyncRawComponentspublicClient rawClient; + + public AsyncComponentspublicClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawComponentspublicClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawComponentspublicClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture getPublicPlans() { + return this.rawClient.getPublicPlans().thenApply(response -> response.body()); + } + + public CompletableFuture getPublicPlans(RequestOptions requestOptions) { + return this.rawClient.getPublicPlans(requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/schematic/api/resources/componentspublic/AsyncRawComponentspublicClient.java b/src/main/java/com/schematic/api/resources/componentspublic/AsyncRawComponentspublicClient.java new file mode 100644 index 0000000..82d2b18 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/componentspublic/AsyncRawComponentspublicClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.componentspublic; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.schematic.api.core.BaseSchematicApiException; +import com.schematic.api.core.BaseSchematicException; +import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.errors.ForbiddenError; +import com.schematic.api.errors.InternalServerError; +import com.schematic.api.errors.NotFoundError; +import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.componentspublic.types.GetPublicPlansResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawComponentspublicClient { + protected final ClientOptions clientOptions; + + public AsyncRawComponentspublicClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> getPublicPlans() { + return getPublicPlans(null); + } + + public CompletableFuture> getPublicPlans( + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("public/plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPublicPlansResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/schematic/api/resources/componentspublic/ComponentspublicClient.java b/src/main/java/com/schematic/api/resources/componentspublic/ComponentspublicClient.java new file mode 100644 index 0000000..e7d7776 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/componentspublic/ComponentspublicClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.componentspublic; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.componentspublic.types.GetPublicPlansResponse; + +public class ComponentspublicClient { + protected final ClientOptions clientOptions; + + private final RawComponentspublicClient rawClient; + + public ComponentspublicClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawComponentspublicClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawComponentspublicClient withRawResponse() { + return this.rawClient; + } + + public GetPublicPlansResponse getPublicPlans() { + return this.rawClient.getPublicPlans().body(); + } + + public GetPublicPlansResponse getPublicPlans(RequestOptions requestOptions) { + return this.rawClient.getPublicPlans(requestOptions).body(); + } +} diff --git a/src/main/java/com/schematic/api/resources/componentspublic/RawComponentspublicClient.java b/src/main/java/com/schematic/api/resources/componentspublic/RawComponentspublicClient.java new file mode 100644 index 0000000..d978ad2 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/componentspublic/RawComponentspublicClient.java @@ -0,0 +1,90 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.componentspublic; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.schematic.api.core.BaseSchematicApiException; +import com.schematic.api.core.BaseSchematicException; +import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.errors.ForbiddenError; +import com.schematic.api.errors.InternalServerError; +import com.schematic.api.errors.NotFoundError; +import com.schematic.api.errors.UnauthorizedError; +import com.schematic.api.resources.componentspublic.types.GetPublicPlansResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawComponentspublicClient { + protected final ClientOptions clientOptions; + + public RawComponentspublicClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public BaseSchematicHttpResponse getPublicPlans() { + return getPublicPlans(null); + } + + public BaseSchematicHttpResponse getPublicPlans(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("public/plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPublicPlansResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/componentspublic/types/GetPublicPlansResponse.java b/src/main/java/com/schematic/api/resources/componentspublic/types/GetPublicPlansResponse.java new file mode 100644 index 0000000..8b8918b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/componentspublic/types/GetPublicPlansResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.componentspublic.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.PublicPlansResponseData; +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 = GetPublicPlansResponse.Builder.class) +public final class GetPublicPlansResponse { + private final PublicPlansResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetPublicPlansResponse( + PublicPlansResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PublicPlansResponseData 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 GetPublicPlansResponse && equalTo((GetPublicPlansResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetPublicPlansResponse 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 PublicPlansResponseData data); + + Builder from(GetPublicPlansResponse other); + } + + public interface _FinalStage { + GetPublicPlansResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PublicPlansResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetPublicPlansResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PublicPlansResponseData 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 GetPublicPlansResponse build() { + return new GetPublicPlansResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java index e23ea13..dd44ffd 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncCreditsClient.java @@ -10,6 +10,7 @@ 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.CountCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; @@ -20,6 +21,7 @@ import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; import com.schematic.api.resources.credits.requests.ListCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; +import com.schematic.api.resources.credits.requests.ListCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; @@ -29,6 +31,7 @@ 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.CountCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantResponse; @@ -43,6 +46,7 @@ import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; import com.schematic.api.resources.credits.types.ListCompanyGrantsResponse; import com.schematic.api.resources.credits.types.ListCreditBundlesResponse; +import com.schematic.api.resources.credits.types.ListCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; @@ -74,6 +78,10 @@ public CompletableFuture listBillingCredits() { return this.rawClient.listBillingCredits().thenApply(response -> response.body()); } + public CompletableFuture listBillingCredits(RequestOptions requestOptions) { + return this.rawClient.listBillingCredits(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listBillingCredits(ListBillingCreditsRequest request) { return this.rawClient.listBillingCredits(request).thenApply(response -> response.body()); } @@ -126,6 +134,10 @@ public CompletableFuture listCreditBundles() { return this.rawClient.listCreditBundles().thenApply(response -> response.body()); } + public CompletableFuture listCreditBundles(RequestOptions requestOptions) { + return this.rawClient.listCreditBundles(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCreditBundles(ListCreditBundlesRequest request) { return this.rawClient.listCreditBundles(request).thenApply(response -> response.body()); } @@ -177,6 +189,10 @@ public CompletableFuture countCreditBundles() { return this.rawClient.countCreditBundles().thenApply(response -> response.body()); } + public CompletableFuture countCreditBundles(RequestOptions requestOptions) { + return this.rawClient.countCreditBundles(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countCreditBundles(CountCreditBundlesRequest request) { return this.rawClient.countCreditBundles(request).thenApply(response -> response.body()); } @@ -190,6 +206,10 @@ public CompletableFuture countBillingCredits() { return this.rawClient.countBillingCredits().thenApply(response -> response.body()); } + public CompletableFuture countBillingCredits(RequestOptions requestOptions) { + return this.rawClient.countBillingCredits(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countBillingCredits(CountBillingCreditsRequest request) { return this.rawClient.countBillingCredits(request).thenApply(response -> response.body()); } @@ -203,6 +223,10 @@ public CompletableFuture zeroOutGrant(String grantId) { return this.rawClient.zeroOutGrant(grantId).thenApply(response -> response.body()); } + public CompletableFuture zeroOutGrant(String grantId, RequestOptions requestOptions) { + return this.rawClient.zeroOutGrant(grantId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture zeroOutGrant(String grantId, ZeroOutGrantRequestBody request) { return this.rawClient.zeroOutGrant(grantId, request).thenApply(response -> response.body()); } @@ -228,6 +252,10 @@ public CompletableFuture countCompanyGrants() { return this.rawClient.countCompanyGrants().thenApply(response -> response.body()); } + public CompletableFuture countCompanyGrants(RequestOptions requestOptions) { + return this.rawClient.countCompanyGrants(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countCompanyGrants(CountCompanyGrantsRequest request) { return this.rawClient.countCompanyGrants(request).thenApply(response -> response.body()); } @@ -241,6 +269,10 @@ public CompletableFuture listCompanyGrants() { return this.rawClient.listCompanyGrants().thenApply(response -> response.body()); } + public CompletableFuture listCompanyGrants(RequestOptions requestOptions) { + return this.rawClient.listCompanyGrants(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCompanyGrants(ListCompanyGrantsRequest request) { return this.rawClient.listCompanyGrants(request).thenApply(response -> response.body()); } @@ -254,6 +286,11 @@ public CompletableFuture countBillingCreditsG return this.rawClient.countBillingCreditsGrants().thenApply(response -> response.body()); } + public CompletableFuture countBillingCreditsGrants( + RequestOptions requestOptions) { + return this.rawClient.countBillingCreditsGrants(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countBillingCreditsGrants( CountBillingCreditsGrantsRequest request) { return this.rawClient.countBillingCreditsGrants(request).thenApply(response -> response.body()); @@ -268,6 +305,10 @@ public CompletableFuture listGrantsForCredit() { return this.rawClient.listGrantsForCredit().thenApply(response -> response.body()); } + public CompletableFuture listGrantsForCredit(RequestOptions requestOptions) { + return this.rawClient.listGrantsForCredit(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listGrantsForCredit(ListGrantsForCreditRequest request) { return this.rawClient.listGrantsForCredit(request).thenApply(response -> response.body()); } @@ -300,6 +341,11 @@ public CompletableFuture listBillingPlanCre return this.rawClient.listBillingPlanCreditGrants().thenApply(response -> response.body()); } + public CompletableFuture listBillingPlanCreditGrants( + RequestOptions requestOptions) { + return this.rawClient.listBillingPlanCreditGrants(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listBillingPlanCreditGrants( ListBillingPlanCreditGrantsRequest request) { return this.rawClient.listBillingPlanCreditGrants(request).thenApply(response -> response.body()); @@ -340,6 +386,13 @@ public CompletableFuture deleteBillingPlan return this.rawClient.deleteBillingPlanCreditGrant(planGrantId).thenApply(response -> response.body()); } + public CompletableFuture deleteBillingPlanCreditGrant( + String planGrantId, RequestOptions requestOptions) { + return this.rawClient + .deleteBillingPlanCreditGrant(planGrantId, requestOptions) + .thenApply(response -> response.body()); + } + public CompletableFuture deleteBillingPlanCreditGrant( String planGrantId, DeleteBillingPlanCreditGrantRequest request) { return this.rawClient.deleteBillingPlanCreditGrant(planGrantId, request).thenApply(response -> response.body()); @@ -356,6 +409,11 @@ public CompletableFuture countBillingPlanC return this.rawClient.countBillingPlanCreditGrants().thenApply(response -> response.body()); } + public CompletableFuture countBillingPlanCreditGrants( + RequestOptions requestOptions) { + return this.rawClient.countBillingPlanCreditGrants(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countBillingPlanCreditGrants( CountBillingPlanCreditGrantsRequest request) { return this.rawClient.countBillingPlanCreditGrants(request).thenApply(response -> response.body()); @@ -367,4 +425,24 @@ public CompletableFuture countBillingPlanC .countBillingPlanCreditGrants(request, requestOptions) .thenApply(response -> response.body()); } + + public CompletableFuture listCreditEventLedger( + ListCreditEventLedgerRequest request) { + return this.rawClient.listCreditEventLedger(request).thenApply(response -> response.body()); + } + + public CompletableFuture listCreditEventLedger( + ListCreditEventLedgerRequest request, RequestOptions requestOptions) { + return this.rawClient.listCreditEventLedger(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countCreditEventLedger( + CountCreditEventLedgerRequest request) { + return this.rawClient.countCreditEventLedger(request).thenApply(response -> response.body()); + } + + public CompletableFuture countCreditEventLedger( + CountCreditEventLedgerRequest request, RequestOptions requestOptions) { + return this.rawClient.countCreditEventLedger(request, requestOptions).thenApply(response -> response.body()); + } } diff --git a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java index 3269a4c..63e584a 100644 --- a/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/AsyncRawCreditsClient.java @@ -22,6 +22,7 @@ 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.CountCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; @@ -32,6 +33,7 @@ import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; import com.schematic.api.resources.credits.requests.ListCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; +import com.schematic.api.resources.credits.requests.ListCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; @@ -41,6 +43,7 @@ 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.CountCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantResponse; @@ -55,6 +58,7 @@ import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; import com.schematic.api.resources.credits.types.ListCompanyGrantsResponse; import com.schematic.api.resources.credits.types.ListCreditBundlesResponse; +import com.schematic.api.resources.credits.types.ListCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; @@ -88,6 +92,11 @@ public CompletableFuture> return listBillingCredits(ListBillingCreditsRequest.builder().build()); } + public CompletableFuture> listBillingCredits( + RequestOptions requestOptions) { + return listBillingCredits(ListBillingCreditsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listBillingCredits( ListBillingCreditsRequest request) { return listBillingCredits(request, null); @@ -113,6 +122,11 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -128,14 +142,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingCreditsResponse.class), + responseBodyString, ListBillingCreditsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -167,11 +181,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -193,10 +205,14 @@ public CompletableFuture> public CompletableFuture> createBillingCredit( CreateBillingCreditRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits") - .build(); + .addPathSegments("billing/credits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -205,7 +221,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -220,14 +236,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateBillingCreditResponse.class), + responseBodyString, CreateBillingCreditResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -259,11 +275,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -285,13 +299,17 @@ public CompletableFuture> getSingleBillingCredit( String creditId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId) - .build(); + .addPathSegment(creditId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -305,14 +323,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetSingleBillingCreditResponse.class), + responseBodyString, GetSingleBillingCreditResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -339,11 +357,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -365,11 +381,15 @@ public CompletableFuture> public CompletableFuture> updateBillingCredit( String creditId, UpdateBillingCreditRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId) - .build(); + .addPathSegment(creditId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -378,7 +398,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -393,14 +413,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateBillingCreditResponse.class), + responseBodyString, UpdateBillingCreditResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -432,11 +452,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -458,13 +476,17 @@ public CompletableFuture> softDeleteBillingCredit( String creditId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId) - .build(); + .addPathSegment(creditId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -479,14 +501,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), SoftDeleteBillingCreditResponse.class), + responseBodyString, SoftDeleteBillingCreditResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -518,11 +540,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -541,6 +561,11 @@ public CompletableFuture> l return listCreditBundles(ListCreditBundlesRequest.builder().build()); } + public CompletableFuture> listCreditBundles( + RequestOptions requestOptions) { + return listCreditBundles(ListCreditBundlesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCreditBundles( ListCreditBundlesRequest request) { return listCreditBundles(request, null); @@ -574,6 +599,11 @@ public CompletableFuture> l if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -589,14 +619,14 @@ public CompletableFuture> l @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCreditBundlesResponse.class), + responseBodyString, ListCreditBundlesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -628,11 +658,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -654,10 +682,14 @@ public CompletableFuture> public CompletableFuture> createCreditBundle( CreateCreditBundleRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits/bundles") - .build(); + .addPathSegments("billing/credits/bundles"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -666,7 +698,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -681,14 +713,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateCreditBundleResponse.class), + responseBodyString, CreateCreditBundleResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -720,11 +752,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -745,13 +775,17 @@ public CompletableFuture> get public CompletableFuture> getCreditBundle( String bundleId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId) - .build(); + .addPathSegment(bundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -765,14 +799,13 @@ public CompletableFuture> get @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetCreditBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCreditBundleResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -799,11 +832,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -825,11 +856,15 @@ public CompletableFuture> updateCreditBundleDetails( String bundleId, UpdateCreditBundleDetailsRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId) - .build(); + .addPathSegment(bundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -838,7 +873,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateCreditBundleDetailsResponse.class), + responseBodyString, UpdateCreditBundleDetailsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -893,11 +928,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -919,13 +952,17 @@ public CompletableFuture> public CompletableFuture> deleteCreditBundle( String bundleId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId) - .build(); + .addPathSegment(bundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -939,14 +976,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteCreditBundleResponse.class), + responseBodyString, DeleteCreditBundleResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -978,11 +1015,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1001,6 +1036,11 @@ public CompletableFuture> return countCreditBundles(CountCreditBundlesRequest.builder().build()); } + public CompletableFuture> countCreditBundles( + RequestOptions requestOptions) { + return countCreditBundles(CountCreditBundlesRequest.builder().build(), requestOptions); + } + public CompletableFuture> countCreditBundles( CountCreditBundlesRequest request) { return countCreditBundles(request, null); @@ -1034,6 +1074,11 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1049,14 +1094,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountCreditBundlesResponse.class), + responseBodyString, CountCreditBundlesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1088,11 +1133,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1111,6 +1154,11 @@ public CompletableFuture> return countBillingCredits(CountBillingCreditsRequest.builder().build()); } + public CompletableFuture> countBillingCredits( + RequestOptions requestOptions) { + return countBillingCredits(CountBillingCreditsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countBillingCredits( CountBillingCreditsRequest request) { return countBillingCredits(request, null); @@ -1136,6 +1184,11 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1151,14 +1204,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountBillingCreditsResponse.class), + responseBodyString, CountBillingCreditsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1190,11 +1243,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1213,6 +1264,11 @@ public CompletableFuture> zeroOu return zeroOutGrant(grantId, ZeroOutGrantRequestBody.builder().build()); } + public CompletableFuture> zeroOutGrant( + String grantId, RequestOptions requestOptions) { + return zeroOutGrant(grantId, ZeroOutGrantRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> zeroOutGrant( String grantId, ZeroOutGrantRequestBody request) { return zeroOutGrant(grantId, request, null); @@ -1220,12 +1276,16 @@ public CompletableFuture> zeroOu public CompletableFuture> zeroOutGrant( String grantId, ZeroOutGrantRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants") .addPathSegment(grantId) - .addPathSegments("zero-out") - .build(); + .addPathSegments("zero-out"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1234,7 +1294,7 @@ public CompletableFuture> zeroOu throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1249,13 +1309,13 @@ public CompletableFuture> zeroOu @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ZeroOutGrantResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ZeroOutGrantResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1287,11 +1347,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1313,10 +1371,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { public CompletableFuture> grantBillingCreditsToCompany(CreateCompanyCreditGrant request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits/grants/company") - .build(); + .addPathSegments("billing/credits/grants/company"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1325,7 +1387,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1341,14 +1403,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GrantBillingCreditsToCompanyResponse.class), + responseBodyString, GrantBillingCreditsToCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1380,11 +1442,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1403,6 +1463,11 @@ public CompletableFuture> return countCompanyGrants(CountCompanyGrantsRequest.builder().build()); } + public CompletableFuture> countCompanyGrants( + RequestOptions requestOptions) { + return countCompanyGrants(CountCompanyGrantsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countCompanyGrants( CountCompanyGrantsRequest request) { return countCompanyGrants(request, null); @@ -1432,6 +1497,11 @@ public CompletableFuture> QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1447,14 +1517,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountCompanyGrantsResponse.class), + responseBodyString, CountCompanyGrantsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1486,11 +1556,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1509,6 +1577,11 @@ public CompletableFuture> l return listCompanyGrants(ListCompanyGrantsRequest.builder().build()); } + public CompletableFuture> listCompanyGrants( + RequestOptions requestOptions) { + return listCompanyGrants(ListCompanyGrantsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCompanyGrants( ListCompanyGrantsRequest request) { return listCompanyGrants(request, null); @@ -1538,6 +1611,11 @@ public CompletableFuture> l QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1553,14 +1631,14 @@ public CompletableFuture> l @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCompanyGrantsResponse.class), + responseBodyString, ListCompanyGrantsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1592,11 +1670,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1616,6 +1692,12 @@ public CompletableFuture> countBillingCreditsGrants( + RequestOptions requestOptions) { + return countBillingCreditsGrants( + CountBillingCreditsGrantsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countBillingCreditsGrants( CountBillingCreditsGrantsRequest request) { return countBillingCreditsGrants(request, null); @@ -1641,6 +1723,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1657,14 +1744,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountBillingCreditsGrantsResponse.class), + responseBodyString, CountBillingCreditsGrantsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1696,11 +1783,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1719,6 +1804,11 @@ public CompletableFuture> return listGrantsForCredit(ListGrantsForCreditRequest.builder().build()); } + public CompletableFuture> listGrantsForCredit( + RequestOptions requestOptions) { + return listGrantsForCredit(ListGrantsForCreditRequest.builder().build(), requestOptions); + } + public CompletableFuture> listGrantsForCredit( ListGrantsForCreditRequest request) { return listGrantsForCredit(request, null); @@ -1744,6 +1834,11 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1759,14 +1854,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListGrantsForCreditResponse.class), + responseBodyString, ListGrantsForCreditResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1798,11 +1893,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1853,6 +1946,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1869,14 +1967,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEnrichedCreditLedgerResponse.class), + responseBodyString, GetEnrichedCreditLedgerResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1908,11 +2006,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1963,6 +2059,11 @@ public CompletableFuture> c QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1978,14 +2079,14 @@ public CompletableFuture> c @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountCreditLedgerResponse.class), + responseBodyString, CountCreditLedgerResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2017,11 +2118,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2042,6 +2141,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { ListBillingPlanCreditGrantsRequest.builder().build()); } + public CompletableFuture> + listBillingPlanCreditGrants(RequestOptions requestOptions) { + return listBillingPlanCreditGrants( + ListBillingPlanCreditGrantsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listBillingPlanCreditGrants(ListBillingPlanCreditGrantsRequest request) { return listBillingPlanCreditGrants(request, null); @@ -2060,6 +2165,10 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { 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.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -2068,12 +2177,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + 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.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -2091,14 +2205,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingPlanCreditGrantsResponse.class), + responseBodyString, ListBillingPlanCreditGrantsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2130,11 +2244,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2157,10 +2269,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { public CompletableFuture> createBillingPlanCreditGrant( CreateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits/plan-grants") - .build(); + .addPathSegments("billing/credits/plan-grants"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2169,7 +2285,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2185,14 +2301,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateBillingPlanCreditGrantResponse.class), + responseBodyString, CreateBillingPlanCreditGrantResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2224,11 +2340,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2253,11 +2367,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { String planGrantId, UpdateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId) - .build(); + .addPathSegment(planGrantId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2266,7 +2384,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -2282,14 +2400,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateBillingPlanCreditGrantResponse.class), + responseBodyString, UpdateBillingPlanCreditGrantResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2321,11 +2439,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2346,6 +2462,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { planGrantId, DeleteBillingPlanCreditGrantRequest.builder().build()); } + public CompletableFuture> + deleteBillingPlanCreditGrant(String planGrantId, RequestOptions requestOptions) { + return deleteBillingPlanCreditGrant( + planGrantId, DeleteBillingPlanCreditGrantRequest.builder().build(), requestOptions); + } + public CompletableFuture> deleteBillingPlanCreditGrant(String planGrantId, DeleteBillingPlanCreditGrantRequest request) { return deleteBillingPlanCreditGrant(planGrantId, request, null); @@ -2362,6 +2484,11 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "apply_to_existing", request.getApplyToExisting().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("DELETE", null) @@ -2378,14 +2505,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteBillingPlanCreditGrantResponse.class), + responseBodyString, DeleteBillingPlanCreditGrantResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2417,11 +2544,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2442,6 +2567,12 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { CountBillingPlanCreditGrantsRequest.builder().build()); } + public CompletableFuture> + countBillingPlanCreditGrants(RequestOptions requestOptions) { + return countBillingPlanCreditGrants( + CountBillingPlanCreditGrantsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countBillingPlanCreditGrants(CountBillingPlanCreditGrantsRequest request) { return countBillingPlanCreditGrants(request, null); @@ -2460,6 +2591,10 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { 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.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -2468,12 +2603,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + 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.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -2491,14 +2631,244 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountBillingPlanCreditGrantsResponse.class), + responseBodyString, CountBillingPlanCreditGrantsResponse.class), response)); return; } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listCreditEventLedger( + ListCreditEventLedgerRequest request) { + return listCreditEventLedger(request, null); + } + + public CompletableFuture> listCreditEventLedger( + ListCreditEventLedgerRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/billing/credits/ledger"); + if (request.getBillingCreditId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "billing_credit_id", request.getBillingCreditId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getEventType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_type", request.getEventType().get(), false); + } + if (request.getFeatureId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_id", request.getFeatureId().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCreditEventLedgerResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> countCreditEventLedger( + CountCreditEventLedgerRequest request) { + return countCreditEventLedger(request, null); + } + + public CompletableFuture> countCreditEventLedger( + CountCreditEventLedgerRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/billing/credits/ledger/count"); + if (request.getBillingCreditId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "billing_credit_id", request.getBillingCreditId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getEventType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_type", request.getEventType().get(), false); + } + if (request.getFeatureId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_id", request.getFeatureId().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CountCreditEventLedgerResponse.class), + response)); + return; + } try { switch (response.code()) { case 400: @@ -2530,11 +2900,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 546a213..d48c4d4 100644 --- a/src/main/java/com/schematic/api/resources/credits/CreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/CreditsClient.java @@ -10,6 +10,7 @@ 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.CountCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; @@ -20,6 +21,7 @@ import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; import com.schematic.api.resources.credits.requests.ListCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; +import com.schematic.api.resources.credits.requests.ListCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; @@ -29,6 +31,7 @@ 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.CountCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantResponse; @@ -43,6 +46,7 @@ import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; import com.schematic.api.resources.credits.types.ListCompanyGrantsResponse; import com.schematic.api.resources.credits.types.ListCreditBundlesResponse; +import com.schematic.api.resources.credits.types.ListCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; @@ -73,6 +77,10 @@ public ListBillingCreditsResponse listBillingCredits() { return this.rawClient.listBillingCredits().body(); } + public ListBillingCreditsResponse listBillingCredits(RequestOptions requestOptions) { + return this.rawClient.listBillingCredits(requestOptions).body(); + } + public ListBillingCreditsResponse listBillingCredits(ListBillingCreditsRequest request) { return this.rawClient.listBillingCredits(request).body(); } @@ -122,6 +130,10 @@ public ListCreditBundlesResponse listCreditBundles() { return this.rawClient.listCreditBundles().body(); } + public ListCreditBundlesResponse listCreditBundles(RequestOptions requestOptions) { + return this.rawClient.listCreditBundles(requestOptions).body(); + } + public ListCreditBundlesResponse listCreditBundles(ListCreditBundlesRequest request) { return this.rawClient.listCreditBundles(request).body(); } @@ -172,6 +184,10 @@ public CountCreditBundlesResponse countCreditBundles() { return this.rawClient.countCreditBundles().body(); } + public CountCreditBundlesResponse countCreditBundles(RequestOptions requestOptions) { + return this.rawClient.countCreditBundles(requestOptions).body(); + } + public CountCreditBundlesResponse countCreditBundles(CountCreditBundlesRequest request) { return this.rawClient.countCreditBundles(request).body(); } @@ -185,6 +201,10 @@ public CountBillingCreditsResponse countBillingCredits() { return this.rawClient.countBillingCredits().body(); } + public CountBillingCreditsResponse countBillingCredits(RequestOptions requestOptions) { + return this.rawClient.countBillingCredits(requestOptions).body(); + } + public CountBillingCreditsResponse countBillingCredits(CountBillingCreditsRequest request) { return this.rawClient.countBillingCredits(request).body(); } @@ -198,6 +218,10 @@ public ZeroOutGrantResponse zeroOutGrant(String grantId) { return this.rawClient.zeroOutGrant(grantId).body(); } + public ZeroOutGrantResponse zeroOutGrant(String grantId, RequestOptions requestOptions) { + return this.rawClient.zeroOutGrant(grantId, requestOptions).body(); + } + public ZeroOutGrantResponse zeroOutGrant(String grantId, ZeroOutGrantRequestBody request) { return this.rawClient.zeroOutGrant(grantId, request).body(); } @@ -222,6 +246,10 @@ public CountCompanyGrantsResponse countCompanyGrants() { return this.rawClient.countCompanyGrants().body(); } + public CountCompanyGrantsResponse countCompanyGrants(RequestOptions requestOptions) { + return this.rawClient.countCompanyGrants(requestOptions).body(); + } + public CountCompanyGrantsResponse countCompanyGrants(CountCompanyGrantsRequest request) { return this.rawClient.countCompanyGrants(request).body(); } @@ -235,6 +263,10 @@ public ListCompanyGrantsResponse listCompanyGrants() { return this.rawClient.listCompanyGrants().body(); } + public ListCompanyGrantsResponse listCompanyGrants(RequestOptions requestOptions) { + return this.rawClient.listCompanyGrants(requestOptions).body(); + } + public ListCompanyGrantsResponse listCompanyGrants(ListCompanyGrantsRequest request) { return this.rawClient.listCompanyGrants(request).body(); } @@ -248,6 +280,10 @@ public CountBillingCreditsGrantsResponse countBillingCreditsGrants() { return this.rawClient.countBillingCreditsGrants().body(); } + public CountBillingCreditsGrantsResponse countBillingCreditsGrants(RequestOptions requestOptions) { + return this.rawClient.countBillingCreditsGrants(requestOptions).body(); + } + public CountBillingCreditsGrantsResponse countBillingCreditsGrants(CountBillingCreditsGrantsRequest request) { return this.rawClient.countBillingCreditsGrants(request).body(); } @@ -261,6 +297,10 @@ public ListGrantsForCreditResponse listGrantsForCredit() { return this.rawClient.listGrantsForCredit().body(); } + public ListGrantsForCreditResponse listGrantsForCredit(RequestOptions requestOptions) { + return this.rawClient.listGrantsForCredit(requestOptions).body(); + } + public ListGrantsForCreditResponse listGrantsForCredit(ListGrantsForCreditRequest request) { return this.rawClient.listGrantsForCredit(request).body(); } @@ -292,6 +332,10 @@ public ListBillingPlanCreditGrantsResponse listBillingPlanCreditGrants() { return this.rawClient.listBillingPlanCreditGrants().body(); } + public ListBillingPlanCreditGrantsResponse listBillingPlanCreditGrants(RequestOptions requestOptions) { + return this.rawClient.listBillingPlanCreditGrants(requestOptions).body(); + } + public ListBillingPlanCreditGrantsResponse listBillingPlanCreditGrants(ListBillingPlanCreditGrantsRequest request) { return this.rawClient.listBillingPlanCreditGrants(request).body(); } @@ -331,6 +375,13 @@ public DeleteBillingPlanCreditGrantResponse deleteBillingPlanCreditGrant(String return this.rawClient.deleteBillingPlanCreditGrant(planGrantId).body(); } + public DeleteBillingPlanCreditGrantResponse deleteBillingPlanCreditGrant( + String planGrantId, RequestOptions requestOptions) { + return this.rawClient + .deleteBillingPlanCreditGrant(planGrantId, requestOptions) + .body(); + } + public DeleteBillingPlanCreditGrantResponse deleteBillingPlanCreditGrant( String planGrantId, DeleteBillingPlanCreditGrantRequest request) { return this.rawClient.deleteBillingPlanCreditGrant(planGrantId, request).body(); @@ -347,6 +398,10 @@ public CountBillingPlanCreditGrantsResponse countBillingPlanCreditGrants() { return this.rawClient.countBillingPlanCreditGrants().body(); } + public CountBillingPlanCreditGrantsResponse countBillingPlanCreditGrants(RequestOptions requestOptions) { + return this.rawClient.countBillingPlanCreditGrants(requestOptions).body(); + } + public CountBillingPlanCreditGrantsResponse countBillingPlanCreditGrants( CountBillingPlanCreditGrantsRequest request) { return this.rawClient.countBillingPlanCreditGrants(request).body(); @@ -358,4 +413,22 @@ public CountBillingPlanCreditGrantsResponse countBillingPlanCreditGrants( .countBillingPlanCreditGrants(request, requestOptions) .body(); } + + public ListCreditEventLedgerResponse listCreditEventLedger(ListCreditEventLedgerRequest request) { + return this.rawClient.listCreditEventLedger(request).body(); + } + + public ListCreditEventLedgerResponse listCreditEventLedger( + ListCreditEventLedgerRequest request, RequestOptions requestOptions) { + return this.rawClient.listCreditEventLedger(request, requestOptions).body(); + } + + public CountCreditEventLedgerResponse countCreditEventLedger(CountCreditEventLedgerRequest request) { + return this.rawClient.countCreditEventLedger(request).body(); + } + + public CountCreditEventLedgerResponse countCreditEventLedger( + CountCreditEventLedgerRequest request, RequestOptions requestOptions) { + return this.rawClient.countCreditEventLedger(request, requestOptions).body(); + } } diff --git a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java index 40c8014..d44a40d 100644 --- a/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java +++ b/src/main/java/com/schematic/api/resources/credits/RawCreditsClient.java @@ -22,6 +22,7 @@ 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.CountCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.CountCreditLedgerRequest; import com.schematic.api.resources.credits.requests.CreateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.CreateCompanyCreditGrant; @@ -32,6 +33,7 @@ import com.schematic.api.resources.credits.requests.ListBillingPlanCreditGrantsRequest; import com.schematic.api.resources.credits.requests.ListCompanyGrantsRequest; import com.schematic.api.resources.credits.requests.ListCreditBundlesRequest; +import com.schematic.api.resources.credits.requests.ListCreditEventLedgerRequest; import com.schematic.api.resources.credits.requests.ListGrantsForCreditRequest; import com.schematic.api.resources.credits.requests.UpdateBillingCreditRequestBody; import com.schematic.api.resources.credits.requests.UpdateCreditBundleDetailsRequestBody; @@ -41,6 +43,7 @@ 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.CountCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.CountCreditLedgerResponse; import com.schematic.api.resources.credits.types.CreateBillingCreditResponse; import com.schematic.api.resources.credits.types.CreateBillingPlanCreditGrantResponse; @@ -55,6 +58,7 @@ import com.schematic.api.resources.credits.types.ListBillingPlanCreditGrantsResponse; import com.schematic.api.resources.credits.types.ListCompanyGrantsResponse; import com.schematic.api.resources.credits.types.ListCreditBundlesResponse; +import com.schematic.api.resources.credits.types.ListCreditEventLedgerResponse; import com.schematic.api.resources.credits.types.ListGrantsForCreditResponse; import com.schematic.api.resources.credits.types.SoftDeleteBillingCreditResponse; import com.schematic.api.resources.credits.types.UpdateBillingCreditResponse; @@ -84,6 +88,10 @@ public BaseSchematicHttpResponse listBillingCredits( return listBillingCredits(ListBillingCreditsRequest.builder().build()); } + public BaseSchematicHttpResponse listBillingCredits(RequestOptions requestOptions) { + return listBillingCredits(ListBillingCreditsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listBillingCredits(ListBillingCreditsRequest request) { return listBillingCredits(request, null); } @@ -108,6 +116,11 @@ public BaseSchematicHttpResponse listBillingCredits( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -120,12 +133,12 @@ public BaseSchematicHttpResponse listBillingCredits( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListBillingCreditsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBillingCreditsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -147,11 +160,9 @@ public BaseSchematicHttpResponse listBillingCredits( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -164,10 +175,14 @@ public BaseSchematicHttpResponse createBillingCredi public BaseSchematicHttpResponse createBillingCredit( CreateBillingCreditRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits") - .build(); + .addPathSegments("billing/credits"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -176,7 +191,7 @@ public BaseSchematicHttpResponse createBillingCredi throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -188,12 +203,12 @@ public BaseSchematicHttpResponse createBillingCredi } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateBillingCreditResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateBillingCreditResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -215,11 +230,9 @@ public BaseSchematicHttpResponse createBillingCredi } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -231,13 +244,17 @@ public BaseSchematicHttpResponse getSingleBillin public BaseSchematicHttpResponse getSingleBillingCredit( String creditId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId) - .build(); + .addPathSegment(creditId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -248,13 +265,12 @@ public BaseSchematicHttpResponse getSingleBillin } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetSingleBillingCreditResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetSingleBillingCreditResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -273,11 +289,9 @@ public BaseSchematicHttpResponse getSingleBillin } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -290,11 +304,15 @@ public BaseSchematicHttpResponse updateBillingCredi public BaseSchematicHttpResponse updateBillingCredit( String creditId, UpdateBillingCreditRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId) - .build(); + .addPathSegment(creditId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -303,7 +321,7 @@ public BaseSchematicHttpResponse updateBillingCredi throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -315,12 +333,12 @@ public BaseSchematicHttpResponse updateBillingCredi } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateBillingCreditResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateBillingCreditResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -342,11 +360,9 @@ public BaseSchematicHttpResponse updateBillingCredi } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -358,13 +374,17 @@ public BaseSchematicHttpResponse softDeleteBill public BaseSchematicHttpResponse softDeleteBillingCredit( String creditId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits") - .addPathSegment(creditId) - .build(); + .addPathSegment(creditId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -375,13 +395,12 @@ public BaseSchematicHttpResponse softDeleteBill } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), SoftDeleteBillingCreditResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SoftDeleteBillingCreditResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -403,11 +422,9 @@ public BaseSchematicHttpResponse softDeleteBill } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -417,6 +434,10 @@ public BaseSchematicHttpResponse listCreditBundles() return listCreditBundles(ListCreditBundlesRequest.builder().build()); } + public BaseSchematicHttpResponse listCreditBundles(RequestOptions requestOptions) { + return listCreditBundles(ListCreditBundlesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCreditBundles(ListCreditBundlesRequest request) { return listCreditBundles(request, null); } @@ -449,6 +470,11 @@ public BaseSchematicHttpResponse listCreditBundles( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -461,12 +487,12 @@ public BaseSchematicHttpResponse listCreditBundles( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCreditBundlesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCreditBundlesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -488,11 +514,9 @@ public BaseSchematicHttpResponse listCreditBundles( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -505,10 +529,14 @@ public BaseSchematicHttpResponse createCreditBundle( public BaseSchematicHttpResponse createCreditBundle( CreateCreditBundleRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits/bundles") - .build(); + .addPathSegments("billing/credits/bundles"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -517,7 +545,7 @@ public BaseSchematicHttpResponse createCreditBundle( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -529,12 +557,12 @@ public BaseSchematicHttpResponse createCreditBundle( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateCreditBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCreditBundleResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -556,11 +584,9 @@ public BaseSchematicHttpResponse createCreditBundle( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -572,13 +598,17 @@ public BaseSchematicHttpResponse getCreditBundle(String public BaseSchematicHttpResponse getCreditBundle( String bundleId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId) - .build(); + .addPathSegment(bundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -589,12 +619,12 @@ public BaseSchematicHttpResponse getCreditBundle( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCreditBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCreditBundleResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -613,11 +643,9 @@ public BaseSchematicHttpResponse getCreditBundle( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -630,11 +658,15 @@ public BaseSchematicHttpResponse updateCredit public BaseSchematicHttpResponse updateCreditBundleDetails( String bundleId, UpdateCreditBundleDetailsRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId) - .build(); + .addPathSegment(bundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -643,7 +675,7 @@ public BaseSchematicHttpResponse updateCredit throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -655,13 +687,13 @@ public BaseSchematicHttpResponse updateCredit } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateCreditBundleDetailsResponse.class), + responseBodyString, UpdateCreditBundleDetailsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -683,11 +715,9 @@ public BaseSchematicHttpResponse updateCredit } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -699,13 +729,17 @@ public BaseSchematicHttpResponse deleteCreditBundle( public BaseSchematicHttpResponse deleteCreditBundle( String bundleId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/bundles") - .addPathSegment(bundleId) - .build(); + .addPathSegment(bundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -716,12 +750,12 @@ public BaseSchematicHttpResponse deleteCreditBundle( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteCreditBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCreditBundleResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -743,11 +777,9 @@ public BaseSchematicHttpResponse deleteCreditBundle( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -757,6 +789,10 @@ public BaseSchematicHttpResponse countCreditBundles( return countCreditBundles(CountCreditBundlesRequest.builder().build()); } + public BaseSchematicHttpResponse countCreditBundles(RequestOptions requestOptions) { + return countCreditBundles(CountCreditBundlesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countCreditBundles(CountCreditBundlesRequest request) { return countCreditBundles(request, null); } @@ -789,6 +825,11 @@ public BaseSchematicHttpResponse countCreditBundles( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -801,12 +842,12 @@ public BaseSchematicHttpResponse countCreditBundles( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountCreditBundlesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCreditBundlesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -828,11 +869,9 @@ public BaseSchematicHttpResponse countCreditBundles( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -842,6 +881,10 @@ public BaseSchematicHttpResponse countBillingCredit return countBillingCredits(CountBillingCreditsRequest.builder().build()); } + public BaseSchematicHttpResponse countBillingCredits(RequestOptions requestOptions) { + return countBillingCredits(CountBillingCreditsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countBillingCredits( CountBillingCreditsRequest request) { return countBillingCredits(request, null); @@ -867,6 +910,11 @@ public BaseSchematicHttpResponse countBillingCredit if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -879,12 +927,12 @@ public BaseSchematicHttpResponse countBillingCredit } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountBillingCreditsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountBillingCreditsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -906,11 +954,9 @@ public BaseSchematicHttpResponse countBillingCredit } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -920,6 +966,10 @@ public BaseSchematicHttpResponse zeroOutGrant(String grant return zeroOutGrant(grantId, ZeroOutGrantRequestBody.builder().build()); } + public BaseSchematicHttpResponse zeroOutGrant(String grantId, RequestOptions requestOptions) { + return zeroOutGrant(grantId, ZeroOutGrantRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse zeroOutGrant( String grantId, ZeroOutGrantRequestBody request) { return zeroOutGrant(grantId, request, null); @@ -927,12 +977,16 @@ public BaseSchematicHttpResponse zeroOutGrant( public BaseSchematicHttpResponse zeroOutGrant( String grantId, ZeroOutGrantRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/grants") .addPathSegment(grantId) - .addPathSegments("zero-out") - .build(); + .addPathSegments("zero-out"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -941,7 +995,7 @@ public BaseSchematicHttpResponse zeroOutGrant( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -953,12 +1007,11 @@ public BaseSchematicHttpResponse zeroOutGrant( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ZeroOutGrantResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ZeroOutGrantResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -980,11 +1033,9 @@ public BaseSchematicHttpResponse zeroOutGrant( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -997,10 +1048,14 @@ public BaseSchematicHttpResponse grantBill public BaseSchematicHttpResponse grantBillingCreditsToCompany( CreateCompanyCreditGrant request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits/grants/company") - .build(); + .addPathSegments("billing/credits/grants/company"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1009,7 +1064,7 @@ public BaseSchematicHttpResponse grantBill throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1021,13 +1076,13 @@ public BaseSchematicHttpResponse grantBill } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GrantBillingCreditsToCompanyResponse.class), + responseBodyString, GrantBillingCreditsToCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1049,11 +1104,9 @@ public BaseSchematicHttpResponse grantBill } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1063,6 +1116,10 @@ public BaseSchematicHttpResponse countCompanyGrants( return countCompanyGrants(CountCompanyGrantsRequest.builder().build()); } + public BaseSchematicHttpResponse countCompanyGrants(RequestOptions requestOptions) { + return countCompanyGrants(CountCompanyGrantsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countCompanyGrants(CountCompanyGrantsRequest request) { return countCompanyGrants(request, null); } @@ -1091,6 +1148,11 @@ public BaseSchematicHttpResponse countCompanyGrants( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1103,12 +1165,12 @@ public BaseSchematicHttpResponse countCompanyGrants( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountCompanyGrantsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCompanyGrantsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1130,11 +1192,9 @@ public BaseSchematicHttpResponse countCompanyGrants( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1144,6 +1204,10 @@ public BaseSchematicHttpResponse listCompanyGrants() return listCompanyGrants(ListCompanyGrantsRequest.builder().build()); } + public BaseSchematicHttpResponse listCompanyGrants(RequestOptions requestOptions) { + return listCompanyGrants(ListCompanyGrantsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCompanyGrants(ListCompanyGrantsRequest request) { return listCompanyGrants(request, null); } @@ -1172,6 +1236,11 @@ public BaseSchematicHttpResponse listCompanyGrants( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1184,12 +1253,12 @@ public BaseSchematicHttpResponse listCompanyGrants( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCompanyGrantsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompanyGrantsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1211,11 +1280,9 @@ public BaseSchematicHttpResponse listCompanyGrants( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1226,6 +1293,12 @@ public BaseSchematicHttpResponse countBilling CountBillingCreditsGrantsRequest.builder().build()); } + public BaseSchematicHttpResponse countBillingCreditsGrants( + RequestOptions requestOptions) { + return countBillingCreditsGrants( + CountBillingCreditsGrantsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countBillingCreditsGrants( CountBillingCreditsGrantsRequest request) { return countBillingCreditsGrants(request, null); @@ -1251,6 +1324,11 @@ public BaseSchematicHttpResponse countBilling if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1263,13 +1341,13 @@ public BaseSchematicHttpResponse countBilling } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountBillingCreditsGrantsResponse.class), + responseBodyString, CountBillingCreditsGrantsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1291,11 +1369,9 @@ public BaseSchematicHttpResponse countBilling } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1305,6 +1381,10 @@ public BaseSchematicHttpResponse listGrantsForCredi return listGrantsForCredit(ListGrantsForCreditRequest.builder().build()); } + public BaseSchematicHttpResponse listGrantsForCredit(RequestOptions requestOptions) { + return listGrantsForCredit(ListGrantsForCreditRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listGrantsForCredit( ListGrantsForCreditRequest request) { return listGrantsForCredit(request, null); @@ -1330,6 +1410,11 @@ public BaseSchematicHttpResponse listGrantsForCredi if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1342,12 +1427,12 @@ public BaseSchematicHttpResponse listGrantsForCredi } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListGrantsForCreditResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListGrantsForCreditResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1369,11 +1454,9 @@ public BaseSchematicHttpResponse listGrantsForCredi } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1415,6 +1498,11 @@ public BaseSchematicHttpResponse getEnrichedCre QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1427,13 +1515,12 @@ public BaseSchematicHttpResponse getEnrichedCre } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEnrichedCreditLedgerResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEnrichedCreditLedgerResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1455,11 +1542,9 @@ public BaseSchematicHttpResponse getEnrichedCre } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1500,6 +1585,11 @@ public BaseSchematicHttpResponse countCreditLedger( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1512,12 +1602,12 @@ public BaseSchematicHttpResponse countCreditLedger( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountCreditLedgerResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCreditLedgerResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1539,11 +1629,9 @@ public BaseSchematicHttpResponse countCreditLedger( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1554,6 +1642,12 @@ public BaseSchematicHttpResponse listBillin ListBillingPlanCreditGrantsRequest.builder().build()); } + public BaseSchematicHttpResponse listBillingPlanCreditGrants( + RequestOptions requestOptions) { + return listBillingPlanCreditGrants( + ListBillingPlanCreditGrantsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listBillingPlanCreditGrants( ListBillingPlanCreditGrantsRequest request) { return listBillingPlanCreditGrants(request, null); @@ -1572,6 +1666,10 @@ public BaseSchematicHttpResponse listBillin 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.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -1580,12 +1678,17 @@ public BaseSchematicHttpResponse listBillin QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + 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.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -1599,13 +1702,13 @@ public BaseSchematicHttpResponse listBillin } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListBillingPlanCreditGrantsResponse.class), + responseBodyString, ListBillingPlanCreditGrantsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1627,11 +1730,9 @@ public BaseSchematicHttpResponse listBillin } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1644,10 +1745,14 @@ public BaseSchematicHttpResponse createBil public BaseSchematicHttpResponse createBillingPlanCreditGrant( CreateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("billing/credits/plan-grants") - .build(); + .addPathSegments("billing/credits/plan-grants"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1656,7 +1761,7 @@ public BaseSchematicHttpResponse createBil throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1668,13 +1773,13 @@ public BaseSchematicHttpResponse createBil } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateBillingPlanCreditGrantResponse.class), + responseBodyString, CreateBillingPlanCreditGrantResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1696,11 +1801,9 @@ public BaseSchematicHttpResponse createBil } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1713,11 +1816,15 @@ public BaseSchematicHttpResponse updateBil public BaseSchematicHttpResponse updateBillingPlanCreditGrant( String planGrantId, UpdateBillingPlanCreditGrantRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("billing/credits/plan-grants") - .addPathSegment(planGrantId) - .build(); + .addPathSegment(planGrantId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1726,7 +1833,7 @@ public BaseSchematicHttpResponse updateBil throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1738,13 +1845,13 @@ public BaseSchematicHttpResponse updateBil } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateBillingPlanCreditGrantResponse.class), + responseBodyString, UpdateBillingPlanCreditGrantResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1766,11 +1873,9 @@ public BaseSchematicHttpResponse updateBil } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1782,6 +1887,12 @@ public BaseSchematicHttpResponse deleteBil planGrantId, DeleteBillingPlanCreditGrantRequest.builder().build()); } + public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( + String planGrantId, RequestOptions requestOptions) { + return deleteBillingPlanCreditGrant( + planGrantId, DeleteBillingPlanCreditGrantRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse deleteBillingPlanCreditGrant( String planGrantId, DeleteBillingPlanCreditGrantRequest request) { return deleteBillingPlanCreditGrant(planGrantId, request, null); @@ -1797,6 +1908,11 @@ public BaseSchematicHttpResponse deleteBil QueryStringMapper.addQueryParameter( httpUrl, "apply_to_existing", request.getApplyToExisting().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("DELETE", null) @@ -1809,13 +1925,13 @@ public BaseSchematicHttpResponse deleteBil } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteBillingPlanCreditGrantResponse.class), + responseBodyString, DeleteBillingPlanCreditGrantResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1837,11 +1953,9 @@ public BaseSchematicHttpResponse deleteBil } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1852,6 +1966,12 @@ public BaseSchematicHttpResponse countBill CountBillingPlanCreditGrantsRequest.builder().build()); } + public BaseSchematicHttpResponse countBillingPlanCreditGrants( + RequestOptions requestOptions) { + return countBillingPlanCreditGrants( + CountBillingPlanCreditGrantsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countBillingPlanCreditGrants( CountBillingPlanCreditGrantsRequest request) { return countBillingPlanCreditGrants(request, null); @@ -1870,6 +1990,10 @@ public BaseSchematicHttpResponse countBill 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.getLimit().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "limit", request.getLimit().get(), false); @@ -1878,12 +2002,17 @@ public BaseSchematicHttpResponse countBill QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + 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.getIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) @@ -1897,13 +2026,195 @@ public BaseSchematicHttpResponse countBill } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountBillingPlanCreditGrantsResponse.class), + responseBodyString, CountBillingPlanCreditGrantsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse listCreditEventLedger( + ListCreditEventLedgerRequest request) { + return listCreditEventLedger(request, null); + } + + public BaseSchematicHttpResponse listCreditEventLedger( + ListCreditEventLedgerRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/billing/credits/ledger"); + if (request.getBillingCreditId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "billing_credit_id", request.getBillingCreditId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getEventType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_type", request.getEventType().get(), false); + } + if (request.getFeatureId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_id", request.getFeatureId().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCreditEventLedgerResponse.class), response); } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse countCreditEventLedger( + CountCreditEventLedgerRequest request) { + return countCreditEventLedger(request, null); + } + + public BaseSchematicHttpResponse countCreditEventLedger( + CountCreditEventLedgerRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/billing/credits/ledger/count"); + if (request.getBillingCreditId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "billing_credit_id", request.getBillingCreditId().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "company_id", request.getCompanyId(), false); + if (request.getEndTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "end_time", request.getEndTime().get(), false); + } + if (request.getEventType().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "event_type", request.getEventType().get(), false); + } + if (request.getFeatureId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "feature_id", request.getFeatureId().get(), false); + } + if (request.getStartTime().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start_time", request.getStartTime().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCreditEventLedgerResponse.class), + response); + } try { switch (response.code()) { case 400: @@ -1925,11 +2236,9 @@ public BaseSchematicHttpResponse countBill } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsGrantsRequest.java index 9ef4935..7c2cb54 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsGrantsRequest.java @@ -26,17 +26,17 @@ public final class CountBillingCreditsGrantsRequest { private final Optional creditId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountBillingCreditsGrantsRequest( Optional> ids, Optional creditId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.creditId = creditId; @@ -59,7 +59,7 @@ public Optional getCreditId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -67,7 +67,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -109,9 +109,9 @@ public static final class Builder { private Optional creditId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -157,12 +157,12 @@ public Builder creditId(String creditId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -184,5 +184,15 @@ public Builder offset(Integer offset) { public CountBillingCreditsGrantsRequest build() { return new CountBillingCreditsGrantsRequest(ids, creditId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsRequest.java index efa88dd..2d4975b 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountBillingCreditsRequest.java @@ -26,17 +26,17 @@ public final class CountBillingCreditsRequest { private final Optional name; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountBillingCreditsRequest( Optional> ids, Optional name, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.name = name; @@ -59,7 +59,7 @@ public Optional getName() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -67,7 +67,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -109,9 +109,9 @@ public static final class Builder { private Optional name = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -157,12 +157,12 @@ public Builder name(String name) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -184,5 +184,15 @@ public Builder offset(Integer offset) { public CountBillingCreditsRequest build() { return new CountBillingCreditsRequest(ids, name, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountBillingPlanCreditGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountBillingPlanCreditGrantsRequest.java index 796dfc9..e86801a 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountBillingPlanCreditGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountBillingPlanCreditGrantsRequest.java @@ -22,47 +22,51 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountBillingPlanCreditGrantsRequest.Builder.class) public final class CountBillingPlanCreditGrantsRequest { - private final Optional> planIds; - private final Optional> ids; + private final Optional> planIds; + private final Optional creditId; private final Optional planId; - private final Optional limit; + private final Optional planVersionId; + + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountBillingPlanCreditGrantsRequest( - Optional> planIds, Optional> ids, + Optional> planIds, Optional creditId, Optional planId, - Optional limit, - Optional offset, + Optional planVersionId, + Optional limit, + Optional offset, Map additionalProperties) { - this.planIds = planIds; this.ids = ids; + this.planIds = planIds; this.creditId = creditId; this.planId = planId; + this.planVersionId = planVersionId; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } - @JsonProperty("plan_ids") - public Optional> getPlanIds() { - return planIds; - } - @JsonProperty("ids") public Optional> getIds() { return ids; } + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + @JsonProperty("credit_id") public Optional getCreditId() { return creditId; @@ -73,11 +77,16 @@ public Optional getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -85,7 +94,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -102,17 +111,19 @@ public Map getAdditionalProperties() { } private boolean equalTo(CountBillingPlanCreditGrantsRequest other) { - return planIds.equals(other.planIds) - && ids.equals(other.ids) + return ids.equals(other.ids) + && planIds.equals(other.planIds) && creditId.equals(other.creditId) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planIds, this.ids, this.creditId, this.planId, this.limit, this.offset); + return Objects.hash( + this.ids, this.planIds, this.creditId, this.planId, this.planVersionId, this.limit, this.offset); } @java.lang.Override @@ -126,17 +137,19 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> planIds = Optional.empty(); - private Optional> ids = Optional.empty(); + private Optional> planIds = Optional.empty(); + private Optional creditId = Optional.empty(); private Optional planId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional planVersionId = Optional.empty(); + + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -144,44 +157,45 @@ public static final class Builder { private Builder() {} public Builder from(CountBillingPlanCreditGrantsRequest other) { - planIds(other.getPlanIds()); ids(other.getIds()); + planIds(other.getPlanIds()); creditId(other.getCreditId()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); limit(other.getLimit()); offset(other.getOffset()); return this; } - @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) - public Builder planIds(Optional> planIds) { - this.planIds = planIds; + @JsonSetter(value = "ids", nulls = Nulls.SKIP) + public Builder ids(Optional> ids) { + this.ids = ids; return this; } - public Builder planIds(List planIds) { - this.planIds = Optional.ofNullable(planIds); + public Builder ids(List ids) { + this.ids = Optional.ofNullable(ids); return this; } - public Builder planIds(String planIds) { - this.planIds = Optional.of(Collections.singletonList(planIds)); + public Builder ids(String ids) { + this.ids = Optional.of(Collections.singletonList(ids)); return this; } - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(Optional> planIds) { + this.planIds = planIds; return this; } - public Builder ids(List ids) { - this.ids = Optional.ofNullable(ids); + public Builder planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); return this; } - public Builder ids(String ids) { - this.ids = Optional.of(Collections.singletonList(ids)); + public Builder planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); return this; } @@ -207,16 +221,27 @@ public Builder planId(String planId) { return this; } + @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; + } + /** *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } public CountBillingPlanCreditGrantsRequest build() { return new CountBillingPlanCreditGrantsRequest( - planIds, ids, creditId, planId, limit, offset, additionalProperties); + ids, planIds, creditId, planId, planVersionId, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java index bfb17dc..8a7a48d 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCompanyGrantsRequest.java @@ -28,9 +28,9 @@ public final class CountCompanyGrantsRequest { private final Optional dir; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -38,8 +38,8 @@ private CountCompanyGrantsRequest( Optional companyId, Optional order, Optional dir, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.order = order; @@ -68,7 +68,7 @@ public Optional getDir() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -76,7 +76,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -121,9 +121,9 @@ public static final class Builder { private Optional dir = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -176,12 +176,12 @@ public Builder dir(SortDirection dir) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public Builder offset(Integer offset) { public CountCompanyGrantsRequest build() { return new CountCompanyGrantsRequest(companyId, order, dir, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditBundlesRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditBundlesRequest.java index 6c6bfa3..823732e 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 @@ -31,9 +31,9 @@ public final class CountCreditBundlesRequest { private final Optional bundleType; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -42,8 +42,8 @@ private CountCreditBundlesRequest( Optional creditId, Optional status, Optional bundleType, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.creditId = creditId; @@ -78,7 +78,7 @@ public Optional getBundleType() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -86,7 +86,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -134,9 +134,9 @@ public static final class Builder { private Optional bundleType = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -206,12 +206,12 @@ public Builder bundleType(String bundleType) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -234,5 +234,15 @@ public CountCreditBundlesRequest build() { return new CountCreditBundlesRequest( ids, creditId, status, bundleType, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java new file mode 100644 index 0000000..58cfa57 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditEventLedgerRequest.java @@ -0,0 +1,376 @@ +/** + * 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.types.CreditEventType; +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 = CountCreditEventLedgerRequest.Builder.class) +public final class CountCreditEventLedgerRequest { + private final Optional billingCreditId; + + private final String companyId; + + private final Optional endTime; + + private final Optional eventType; + + private final Optional featureId; + + private final Optional startTime; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private CountCreditEventLedgerRequest( + Optional billingCreditId, + String companyId, + Optional endTime, + Optional eventType, + Optional featureId, + Optional startTime, + Optional limit, + Optional offset, + Map additionalProperties) { + this.billingCreditId = billingCreditId; + this.companyId = companyId; + this.endTime = endTime; + this.eventType = eventType; + this.featureId = featureId; + this.startTime = startTime; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_credit_id") + public Optional getBillingCreditId() { + return billingCreditId; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + @JsonProperty("event_type") + public Optional getEventType() { + return eventType; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + /** + * @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 CountCreditEventLedgerRequest && equalTo((CountCreditEventLedgerRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountCreditEventLedgerRequest other) { + return billingCreditId.equals(other.billingCreditId) + && companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && eventType.equals(other.eventType) + && featureId.equals(other.featureId) + && startTime.equals(other.startTime) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingCreditId, + this.companyId, + this.endTime, + this.eventType, + this.featureId, + this.startTime, + this.limit, + this.offset); + } + + @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(CountCreditEventLedgerRequest other); + } + + public interface _FinalStage { + CountCreditEventLedgerRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingCreditId(Optional billingCreditId); + + _FinalStage billingCreditId(String billingCreditId); + + _FinalStage endTime(Optional endTime); + + _FinalStage endTime(String endTime); + + _FinalStage eventType(Optional eventType); + + _FinalStage eventType(CreditEventType eventType); + + _FinalStage featureId(Optional featureId); + + _FinalStage featureId(String featureId); + + _FinalStage startTime(Optional startTime); + + _FinalStage startTime(String startTime); + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional startTime = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional eventType = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional billingCreditId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountCreditEventLedgerRequest other) { + billingCreditId(other.getBillingCreditId()); + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + eventType(other.getEventType()); + featureId(other.getFeatureId()); + startTime(other.getStartTime()); + limit(other.getLimit()); + offset(other.getOffset()); + 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; + } + + /** + *

Page offset (default 0)

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

Page offset (default 0)

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

Page limit (default 100)

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

Page limit (default 100)

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + @java.lang.Override + public _FinalStage startTime(String startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public _FinalStage startTime(Optional startTime) { + this.startTime = startTime; + 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 eventType(CreditEventType eventType) { + this.eventType = Optional.ofNullable(eventType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "event_type", nulls = Nulls.SKIP) + public _FinalStage eventType(Optional eventType) { + this.eventType = eventType; + return this; + } + + @java.lang.Override + public _FinalStage endTime(String endTime) { + this.endTime = Optional.ofNullable(endTime); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_time", nulls = Nulls.SKIP) + public _FinalStage endTime(Optional endTime) { + this.endTime = endTime; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditId(String billingCreditId) { + this.billingCreditId = Optional.ofNullable(billingCreditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_id", nulls = Nulls.SKIP) + public _FinalStage billingCreditId(Optional billingCreditId) { + this.billingCreditId = billingCreditId; + return this; + } + + @java.lang.Override + public CountCreditEventLedgerRequest build() { + return new CountCreditEventLedgerRequest( + billingCreditId, + companyId, + endTime, + eventType, + featureId, + startTime, + limit, + offset, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CountCreditLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/CountCreditLedgerRequest.java index c309efa..32fb794 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 @@ -34,9 +34,9 @@ public final class CountCreditLedgerRequest { private final Optional endTime; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -47,8 +47,8 @@ private CountCreditLedgerRequest( CreditLedgerPeriod period, Optional startTime, Optional endTime, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.billingCreditId = billingCreditId; @@ -95,7 +95,7 @@ public Optional getEndTime() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -103,7 +103,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -164,6 +164,10 @@ public interface PeriodStage { public interface _FinalStage { CountCreditLedgerRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingCreditId(Optional billingCreditId); _FinalStage billingCreditId(String billingCreditId); @@ -183,16 +187,16 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -201,9 +205,9 @@ public static final class Builder implements CompanyIdStage, PeriodStage, _Final private CreditLedgerPeriod period; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional endTime = Optional.empty(); @@ -250,7 +254,7 @@ public _FinalStage period(@NotNull CreditLedgerPeriod period) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -260,7 +264,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -270,7 +274,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -280,7 +284,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -350,5 +354,17 @@ public CountCreditLedgerRequest build() { offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingCreditRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateBillingCreditRequestBody.java index 3c072e9..52f0954 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 @@ -15,7 +15,9 @@ import com.schematic.api.types.BillingCreditBurnStrategy; import com.schematic.api.types.BillingCreditExpiryUnit; import com.schematic.api.types.BillingCreditRolloverPolicy; +import com.schematic.api.types.CreditCurrencyPriceRequestBody; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -28,9 +30,11 @@ public final class CreateBillingCreditRequestBody { private final String currency; + private final Optional> currencyPrices; + private final Optional defaultExpiryUnit; - private final Optional defaultExpiryUnitCount; + private final Optional defaultExpiryUnitCount; private final Optional defaultRolloverPolicy; @@ -40,7 +44,7 @@ public final class CreateBillingCreditRequestBody { private final String name; - private final Optional perUnitPrice; + private final Optional perUnitPrice; private final Optional perUnitPriceDecimal; @@ -53,19 +57,21 @@ public final class CreateBillingCreditRequestBody { private CreateBillingCreditRequestBody( Optional burnStrategy, String currency, + Optional> currencyPrices, Optional defaultExpiryUnit, - Optional defaultExpiryUnitCount, + Optional defaultExpiryUnitCount, Optional defaultRolloverPolicy, String description, Optional icon, String name, - Optional perUnitPrice, + Optional perUnitPrice, Optional perUnitPriceDecimal, Optional pluralName, Optional singularName, Map additionalProperties) { this.burnStrategy = burnStrategy; this.currency = currency; + this.currencyPrices = currencyPrices; this.defaultExpiryUnit = defaultExpiryUnit; this.defaultExpiryUnitCount = defaultExpiryUnitCount; this.defaultRolloverPolicy = defaultRolloverPolicy; @@ -89,13 +95,18 @@ public String getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("default_expiry_unit") public Optional getDefaultExpiryUnit() { return defaultExpiryUnit; } @JsonProperty("default_expiry_unit_count") - public Optional getDefaultExpiryUnitCount() { + public Optional getDefaultExpiryUnitCount() { return defaultExpiryUnitCount; } @@ -120,7 +131,7 @@ public String getName() { } @JsonProperty("per_unit_price") - public Optional getPerUnitPrice() { + public Optional getPerUnitPrice() { return perUnitPrice; } @@ -153,6 +164,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateBillingCreditRequestBody other) { return burnStrategy.equals(other.burnStrategy) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && defaultExpiryUnit.equals(other.defaultExpiryUnit) && defaultExpiryUnitCount.equals(other.defaultExpiryUnitCount) && defaultRolloverPolicy.equals(other.defaultRolloverPolicy) @@ -170,6 +182,7 @@ public int hashCode() { return Objects.hash( this.burnStrategy, this.currency, + this.currencyPrices, this.defaultExpiryUnit, this.defaultExpiryUnitCount, this.defaultRolloverPolicy, @@ -208,17 +221,25 @@ public interface NameStage { public interface _FinalStage { CreateBillingCreditRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage burnStrategy(Optional burnStrategy); _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit); _FinalStage defaultExpiryUnit(BillingCreditExpiryUnit defaultExpiryUnit); - _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); + _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); - _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount); + _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount); _FinalStage defaultRolloverPolicy(Optional defaultRolloverPolicy); @@ -228,9 +249,9 @@ public interface _FinalStage { _FinalStage icon(String icon); - _FinalStage perUnitPrice(Optional perUnitPrice); + _FinalStage perUnitPrice(Optional perUnitPrice); - _FinalStage perUnitPrice(Integer perUnitPrice); + _FinalStage perUnitPrice(Long perUnitPrice); _FinalStage perUnitPriceDecimal(Optional perUnitPriceDecimal); @@ -259,16 +280,18 @@ public static final class Builder implements CurrencyStage, DescriptionStage, Na private Optional perUnitPriceDecimal = Optional.empty(); - private Optional perUnitPrice = Optional.empty(); + private Optional perUnitPrice = Optional.empty(); private Optional icon = Optional.empty(); private Optional defaultRolloverPolicy = Optional.empty(); - private Optional defaultExpiryUnitCount = Optional.empty(); + private Optional defaultExpiryUnitCount = Optional.empty(); private Optional defaultExpiryUnit = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional burnStrategy = Optional.empty(); @JsonAnySetter @@ -280,6 +303,7 @@ private Builder() {} public Builder from(CreateBillingCreditRequestBody other) { burnStrategy(other.getBurnStrategy()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); defaultExpiryUnit(other.getDefaultExpiryUnit()); defaultExpiryUnitCount(other.getDefaultExpiryUnitCount()); defaultRolloverPolicy(other.getDefaultRolloverPolicy()); @@ -354,14 +378,14 @@ public _FinalStage perUnitPriceDecimal(Optional perUnitPriceDecimal) { } @java.lang.Override - public _FinalStage perUnitPrice(Integer perUnitPrice) { + public _FinalStage perUnitPrice(Long perUnitPrice) { this.perUnitPrice = Optional.ofNullable(perUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "per_unit_price", nulls = Nulls.SKIP) - public _FinalStage perUnitPrice(Optional perUnitPrice) { + public _FinalStage perUnitPrice(Optional perUnitPrice) { this.perUnitPrice = perUnitPrice; return this; } @@ -393,14 +417,14 @@ public _FinalStage defaultRolloverPolicy(Optional d } @java.lang.Override - public _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount) { + public _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount) { this.defaultExpiryUnitCount = Optional.ofNullable(defaultExpiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "default_expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { + public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { this.defaultExpiryUnitCount = defaultExpiryUnitCount; return this; } @@ -418,6 +442,19 @@ public _FinalStage defaultExpiryUnit(Optional defaultEx return this; } + @java.lang.Override + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy) { this.burnStrategy = Optional.ofNullable(burnStrategy); @@ -436,6 +473,7 @@ public CreateBillingCreditRequestBody build() { return new CreateBillingCreditRequestBody( burnStrategy, currency, + currencyPrices, defaultExpiryUnit, defaultExpiryUnitCount, defaultRolloverPolicy, @@ -448,5 +486,17 @@ public CreateBillingCreditRequestBody build() { singularName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateCompanyCreditGrant.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateCompanyCreditGrant.java index d675397..07cab67 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 @@ -26,21 +26,23 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateCompanyCreditGrant.Builder.class) public final class CreateCompanyCreditGrant { - private final Optional billingPeriodsCount; + private final Optional billingPeriodsCount; private final String companyId; private final String creditId; + private final Optional currency; + private final Optional expiresAt; private final Optional expiryType; private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; - private final int quantity; + private final long quantity; private final BillingCreditGrantReason reason; @@ -51,14 +53,15 @@ public final class CreateCompanyCreditGrant { private final Map additionalProperties; private CreateCompanyCreditGrant( - Optional billingPeriodsCount, + Optional billingPeriodsCount, String companyId, String creditId, + Optional currency, Optional expiresAt, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, - int quantity, + Optional expiryUnitCount, + long quantity, BillingCreditGrantReason reason, Optional renewalEnabled, Optional renewalPeriod, @@ -66,6 +69,7 @@ private CreateCompanyCreditGrant( this.billingPeriodsCount = billingPeriodsCount; this.companyId = companyId; this.creditId = creditId; + this.currency = currency; this.expiresAt = expiresAt; this.expiryType = expiryType; this.expiryUnit = expiryUnit; @@ -78,7 +82,7 @@ private CreateCompanyCreditGrant( } @JsonProperty("billing_periods_count") - public Optional getBillingPeriodsCount() { + public Optional getBillingPeriodsCount() { return billingPeriodsCount; } @@ -92,6 +96,11 @@ public String getCreditId() { return creditId; } + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + @JsonProperty("expires_at") public Optional getExpiresAt() { return expiresAt; @@ -108,12 +117,12 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -147,6 +156,7 @@ private boolean equalTo(CreateCompanyCreditGrant other) { return billingPeriodsCount.equals(other.billingPeriodsCount) && companyId.equals(other.companyId) && creditId.equals(other.creditId) + && currency.equals(other.currency) && expiresAt.equals(other.expiresAt) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) @@ -163,6 +173,7 @@ public int hashCode() { this.billingPeriodsCount, this.companyId, this.creditId, + this.currency, this.expiresAt, this.expiryType, this.expiryUnit, @@ -193,7 +204,7 @@ public interface CreditIdStage { } public interface QuantityStage { - ReasonStage quantity(int quantity); + ReasonStage quantity(long quantity); } public interface ReasonStage { @@ -203,9 +214,17 @@ public interface ReasonStage { public interface _FinalStage { CreateCompanyCreditGrant build(); - _FinalStage billingPeriodsCount(Optional billingPeriodsCount); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingPeriodsCount(Optional billingPeriodsCount); + + _FinalStage billingPeriodsCount(Long billingPeriodsCount); - _FinalStage billingPeriodsCount(Integer billingPeriodsCount); + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); _FinalStage expiresAt(Optional expiresAt); @@ -219,9 +238,9 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage renewalEnabled(Optional renewalEnabled); @@ -239,7 +258,7 @@ public static final class Builder private String creditId; - private int quantity; + private long quantity; private BillingCreditGrantReason reason; @@ -247,7 +266,7 @@ public static final class Builder private Optional renewalEnabled = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -255,7 +274,9 @@ public static final class Builder private Optional expiresAt = Optional.empty(); - private Optional billingPeriodsCount = Optional.empty(); + private Optional currency = Optional.empty(); + + private Optional billingPeriodsCount = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -267,6 +288,7 @@ public Builder from(CreateCompanyCreditGrant other) { billingPeriodsCount(other.getBillingPeriodsCount()); companyId(other.getCompanyId()); creditId(other.getCreditId()); + currency(other.getCurrency()); expiresAt(other.getExpiresAt()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); @@ -294,7 +316,7 @@ public QuantityStage creditId(@NotNull String creditId) { @java.lang.Override @JsonSetter("quantity") - public ReasonStage quantity(int quantity) { + public ReasonStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -333,14 +355,14 @@ public _FinalStage renewalEnabled(Optional renewalEnabled) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -385,14 +407,27 @@ public _FinalStage expiresAt(Optional expiresAt) { } @java.lang.Override - public _FinalStage billingPeriodsCount(Integer billingPeriodsCount) { + 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 billingPeriodsCount(Long billingPeriodsCount) { this.billingPeriodsCount = Optional.ofNullable(billingPeriodsCount); return this; } @java.lang.Override @JsonSetter(value = "billing_periods_count", nulls = Nulls.SKIP) - public _FinalStage billingPeriodsCount(Optional billingPeriodsCount) { + public _FinalStage billingPeriodsCount(Optional billingPeriodsCount) { this.billingPeriodsCount = billingPeriodsCount; return this; } @@ -403,6 +438,7 @@ public CreateCompanyCreditGrant build() { billingPeriodsCount, companyId, creditId, + currency, expiresAt, expiryType, expiryUnit, @@ -413,5 +449,17 @@ public CreateCompanyCreditGrant build() { renewalPeriod, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/CreateCreditBundleRequestBody.java index d2e5dde..efa78b1 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 @@ -15,7 +15,9 @@ import com.schematic.api.types.BillingCreditBundleStatus; import com.schematic.api.types.BillingCreditExpiryType; import com.schematic.api.types.BillingCreditExpiryUnit; +import com.schematic.api.types.CreditBundleCurrencyPriceRequestBody; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -32,17 +34,19 @@ public final class CreateCreditBundleRequestBody { private final String currency; + private final Optional> currencyPrices; + private final Optional expiryType; private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; - private final int pricePerUnit; + private final long pricePerUnit; private final Optional pricePerUnitDecimal; - private final Optional quantity; + private final Optional quantity; private final Optional status; @@ -53,18 +57,20 @@ private CreateCreditBundleRequestBody( Optional bundleType, String creditId, String currency, + Optional> currencyPrices, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, - int pricePerUnit, + Optional expiryUnitCount, + long pricePerUnit, Optional pricePerUnitDecimal, - Optional quantity, + Optional quantity, Optional status, Map additionalProperties) { this.bundleName = bundleName; this.bundleType = bundleType; this.creditId = creditId; this.currency = currency; + this.currencyPrices = currencyPrices; this.expiryType = expiryType; this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; @@ -95,6 +101,11 @@ public String getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("expiry_type") public Optional getExpiryType() { return expiryType; @@ -106,12 +117,12 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @JsonProperty("price_per_unit") - public int getPricePerUnit() { + public long getPricePerUnit() { return pricePerUnit; } @@ -121,7 +132,7 @@ public Optional getPricePerUnitDecimal() { } @JsonProperty("quantity") - public Optional getQuantity() { + public Optional getQuantity() { return quantity; } @@ -146,6 +157,7 @@ private boolean equalTo(CreateCreditBundleRequestBody other) { && bundleType.equals(other.bundleType) && creditId.equals(other.creditId) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) @@ -162,6 +174,7 @@ public int hashCode() { this.bundleType, this.creditId, this.currency, + this.currencyPrices, this.expiryType, this.expiryUnit, this.expiryUnitCount, @@ -195,16 +208,24 @@ public interface CurrencyStage { } public interface PricePerUnitStage { - _FinalStage pricePerUnit(int pricePerUnit); + _FinalStage pricePerUnit(long pricePerUnit); } public interface _FinalStage { CreateCreditBundleRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage bundleType(Optional bundleType); _FinalStage bundleType(String bundleType); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage expiryType(Optional expiryType); _FinalStage expiryType(BillingCreditExpiryType expiryType); @@ -213,17 +234,17 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal); _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal); - _FinalStage quantity(Optional quantity); + _FinalStage quantity(Optional quantity); - _FinalStage quantity(Integer quantity); + _FinalStage quantity(Long quantity); _FinalStage status(Optional status); @@ -239,20 +260,22 @@ public static final class Builder private String currency; - private int pricePerUnit; + private long pricePerUnit; private Optional status = Optional.empty(); - private Optional quantity = Optional.empty(); + private Optional quantity = Optional.empty(); private Optional pricePerUnitDecimal = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); private Optional expiryType = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional bundleType = Optional.empty(); @JsonAnySetter @@ -266,6 +289,7 @@ public Builder from(CreateCreditBundleRequestBody other) { bundleType(other.getBundleType()); creditId(other.getCreditId()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); @@ -299,7 +323,7 @@ public PricePerUnitStage currency(@NotNull String currency) { @java.lang.Override @JsonSetter("price_per_unit") - public _FinalStage pricePerUnit(int pricePerUnit) { + public _FinalStage pricePerUnit(long pricePerUnit) { this.pricePerUnit = pricePerUnit; return this; } @@ -318,14 +342,14 @@ public _FinalStage status(Optional status) { } @java.lang.Override - public _FinalStage quantity(Integer quantity) { + public _FinalStage quantity(Long quantity) { this.quantity = Optional.ofNullable(quantity); return this; } @java.lang.Override @JsonSetter(value = "quantity", nulls = Nulls.SKIP) - public _FinalStage quantity(Optional quantity) { + public _FinalStage quantity(Optional quantity) { this.quantity = quantity; return this; } @@ -344,14 +368,14 @@ public _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -382,6 +406,19 @@ public _FinalStage expiryType(Optional expiryType) { return this; } + @java.lang.Override + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage bundleType(String bundleType) { this.bundleType = Optional.ofNullable(bundleType); @@ -402,6 +439,7 @@ public CreateCreditBundleRequestBody build() { bundleType, creditId, currency, + currencyPrices, expiryType, expiryUnit, expiryUnitCount, @@ -411,5 +449,17 @@ public CreateCreditBundleRequestBody build() { status, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java index f81850f..e44c61b 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/DeleteBillingPlanCreditGrantRequest.java @@ -93,5 +93,15 @@ public Builder applyToExisting(Boolean applyToExisting) { public DeleteBillingPlanCreditGrantRequest build() { return new DeleteBillingPlanCreditGrantRequest(applyToExisting, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/GetEnrichedCreditLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/GetEnrichedCreditLedgerRequest.java index f153410..4b10bb1 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 @@ -34,9 +34,9 @@ public final class GetEnrichedCreditLedgerRequest { private final Optional endTime; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -47,8 +47,8 @@ private GetEnrichedCreditLedgerRequest( CreditLedgerPeriod period, Optional startTime, Optional endTime, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.billingCreditId = billingCreditId; @@ -95,7 +95,7 @@ public Optional getEndTime() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -103,7 +103,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -164,6 +164,10 @@ public interface PeriodStage { public interface _FinalStage { GetEnrichedCreditLedgerRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingCreditId(Optional billingCreditId); _FinalStage billingCreditId(String billingCreditId); @@ -183,16 +187,16 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -201,9 +205,9 @@ public static final class Builder implements CompanyIdStage, PeriodStage, _Final private CreditLedgerPeriod period; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional endTime = Optional.empty(); @@ -250,7 +254,7 @@ public _FinalStage period(@NotNull CreditLedgerPeriod period) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -260,7 +264,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -270,7 +274,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -280,7 +284,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -350,5 +354,17 @@ public GetEnrichedCreditLedgerRequest build() { offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListBillingCreditsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListBillingCreditsRequest.java index f30eda9..46df3fa 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListBillingCreditsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListBillingCreditsRequest.java @@ -26,17 +26,17 @@ public final class ListBillingCreditsRequest { private final Optional name; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListBillingCreditsRequest( Optional> ids, Optional name, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.name = name; @@ -59,7 +59,7 @@ public Optional getName() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -67,7 +67,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -109,9 +109,9 @@ public static final class Builder { private Optional name = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -157,12 +157,12 @@ public Builder name(String name) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -184,5 +184,15 @@ public Builder offset(Integer offset) { public ListBillingCreditsRequest build() { return new ListBillingCreditsRequest(ids, name, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListBillingPlanCreditGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListBillingPlanCreditGrantsRequest.java index f5c0273..05c67d7 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListBillingPlanCreditGrantsRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListBillingPlanCreditGrantsRequest.java @@ -22,47 +22,51 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListBillingPlanCreditGrantsRequest.Builder.class) public final class ListBillingPlanCreditGrantsRequest { - private final Optional> planIds; - private final Optional> ids; + private final Optional> planIds; + private final Optional creditId; private final Optional planId; - private final Optional limit; + private final Optional planVersionId; + + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListBillingPlanCreditGrantsRequest( - Optional> planIds, Optional> ids, + Optional> planIds, Optional creditId, Optional planId, - Optional limit, - Optional offset, + Optional planVersionId, + Optional limit, + Optional offset, Map additionalProperties) { - this.planIds = planIds; this.ids = ids; + this.planIds = planIds; this.creditId = creditId; this.planId = planId; + this.planVersionId = planVersionId; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } - @JsonProperty("plan_ids") - public Optional> getPlanIds() { - return planIds; - } - @JsonProperty("ids") public Optional> getIds() { return ids; } + @JsonProperty("plan_ids") + public Optional> getPlanIds() { + return planIds; + } + @JsonProperty("credit_id") public Optional getCreditId() { return creditId; @@ -73,11 +77,16 @@ public Optional getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -85,7 +94,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -102,17 +111,19 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListBillingPlanCreditGrantsRequest other) { - return planIds.equals(other.planIds) - && ids.equals(other.ids) + return ids.equals(other.ids) + && planIds.equals(other.planIds) && creditId.equals(other.creditId) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planIds, this.ids, this.creditId, this.planId, this.limit, this.offset); + return Objects.hash( + this.ids, this.planIds, this.creditId, this.planId, this.planVersionId, this.limit, this.offset); } @java.lang.Override @@ -126,17 +137,19 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> planIds = Optional.empty(); - private Optional> ids = Optional.empty(); + private Optional> planIds = Optional.empty(); + private Optional creditId = Optional.empty(); private Optional planId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional planVersionId = Optional.empty(); + + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -144,44 +157,45 @@ public static final class Builder { private Builder() {} public Builder from(ListBillingPlanCreditGrantsRequest other) { - planIds(other.getPlanIds()); ids(other.getIds()); + planIds(other.getPlanIds()); creditId(other.getCreditId()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); limit(other.getLimit()); offset(other.getOffset()); return this; } - @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) - public Builder planIds(Optional> planIds) { - this.planIds = planIds; + @JsonSetter(value = "ids", nulls = Nulls.SKIP) + public Builder ids(Optional> ids) { + this.ids = ids; return this; } - public Builder planIds(List planIds) { - this.planIds = Optional.ofNullable(planIds); + public Builder ids(List ids) { + this.ids = Optional.ofNullable(ids); return this; } - public Builder planIds(String planIds) { - this.planIds = Optional.of(Collections.singletonList(planIds)); + public Builder ids(String ids) { + this.ids = Optional.of(Collections.singletonList(ids)); return this; } - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; + @JsonSetter(value = "plan_ids", nulls = Nulls.SKIP) + public Builder planIds(Optional> planIds) { + this.planIds = planIds; return this; } - public Builder ids(List ids) { - this.ids = Optional.ofNullable(ids); + public Builder planIds(List planIds) { + this.planIds = Optional.ofNullable(planIds); return this; } - public Builder ids(String ids) { - this.ids = Optional.of(Collections.singletonList(ids)); + public Builder planIds(String planIds) { + this.planIds = Optional.of(Collections.singletonList(planIds)); return this; } @@ -207,16 +221,27 @@ public Builder planId(String planId) { return this; } + @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; + } + /** *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } public ListBillingPlanCreditGrantsRequest build() { return new ListBillingPlanCreditGrantsRequest( - planIds, ids, creditId, planId, limit, offset, additionalProperties); + ids, planIds, creditId, planId, planVersionId, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCompanyGrantsRequest.java index d84e693..9942d53 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 @@ -28,9 +28,9 @@ public final class ListCompanyGrantsRequest { private final Optional dir; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -38,8 +38,8 @@ private ListCompanyGrantsRequest( Optional companyId, Optional order, Optional dir, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyId = companyId; this.order = order; @@ -68,7 +68,7 @@ public Optional getDir() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -76,7 +76,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -121,9 +121,9 @@ public static final class Builder { private Optional dir = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -176,12 +176,12 @@ public Builder dir(SortDirection dir) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public Builder offset(Integer offset) { public ListCompanyGrantsRequest build() { return new ListCompanyGrantsRequest(companyId, order, dir, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListCreditBundlesRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditBundlesRequest.java index 1e281c7..cd2a45a 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 @@ -31,9 +31,9 @@ public final class ListCreditBundlesRequest { private final Optional bundleType; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -42,8 +42,8 @@ private ListCreditBundlesRequest( Optional creditId, Optional status, Optional bundleType, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.creditId = creditId; @@ -78,7 +78,7 @@ public Optional getBundleType() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -86,7 +86,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -134,9 +134,9 @@ public static final class Builder { private Optional bundleType = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -206,12 +206,12 @@ public Builder bundleType(String bundleType) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -233,5 +233,15 @@ public Builder offset(Integer offset) { public ListCreditBundlesRequest build() { return new ListCreditBundlesRequest(ids, creditId, status, bundleType, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java new file mode 100644 index 0000000..10baedd --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListCreditEventLedgerRequest.java @@ -0,0 +1,376 @@ +/** + * 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.types.CreditEventType; +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 = ListCreditEventLedgerRequest.Builder.class) +public final class ListCreditEventLedgerRequest { + private final Optional billingCreditId; + + private final String companyId; + + private final Optional endTime; + + private final Optional eventType; + + private final Optional featureId; + + private final Optional startTime; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListCreditEventLedgerRequest( + Optional billingCreditId, + String companyId, + Optional endTime, + Optional eventType, + Optional featureId, + Optional startTime, + Optional limit, + Optional offset, + Map additionalProperties) { + this.billingCreditId = billingCreditId; + this.companyId = companyId; + this.endTime = endTime; + this.eventType = eventType; + this.featureId = featureId; + this.startTime = startTime; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_credit_id") + public Optional getBillingCreditId() { + return billingCreditId; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + @JsonProperty("event_type") + public Optional getEventType() { + return eventType; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + @JsonProperty("start_time") + public Optional getStartTime() { + return startTime; + } + + /** + * @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 ListCreditEventLedgerRequest && equalTo((ListCreditEventLedgerRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCreditEventLedgerRequest other) { + return billingCreditId.equals(other.billingCreditId) + && companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && eventType.equals(other.eventType) + && featureId.equals(other.featureId) + && startTime.equals(other.startTime) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingCreditId, + this.companyId, + this.endTime, + this.eventType, + this.featureId, + this.startTime, + this.limit, + this.offset); + } + + @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(ListCreditEventLedgerRequest other); + } + + public interface _FinalStage { + ListCreditEventLedgerRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingCreditId(Optional billingCreditId); + + _FinalStage billingCreditId(String billingCreditId); + + _FinalStage endTime(Optional endTime); + + _FinalStage endTime(String endTime); + + _FinalStage eventType(Optional eventType); + + _FinalStage eventType(CreditEventType eventType); + + _FinalStage featureId(Optional featureId); + + _FinalStage featureId(String featureId); + + _FinalStage startTime(Optional startTime); + + _FinalStage startTime(String startTime); + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + _FinalStage offset(Optional offset); + + _FinalStage offset(Long offset); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CompanyIdStage, _FinalStage { + private String companyId; + + private Optional offset = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional startTime = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional eventType = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional billingCreditId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListCreditEventLedgerRequest other) { + billingCreditId(other.getBillingCreditId()); + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + eventType(other.getEventType()); + featureId(other.getFeatureId()); + startTime(other.getStartTime()); + limit(other.getLimit()); + offset(other.getOffset()); + 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; + } + + /** + *

Page offset (default 0)

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

Page offset (default 0)

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

Page limit (default 100)

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

Page limit (default 100)

+ */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + @java.lang.Override + public _FinalStage startTime(String startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + @java.lang.Override + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public _FinalStage startTime(Optional startTime) { + this.startTime = startTime; + 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 eventType(CreditEventType eventType) { + this.eventType = Optional.ofNullable(eventType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "event_type", nulls = Nulls.SKIP) + public _FinalStage eventType(Optional eventType) { + this.eventType = eventType; + return this; + } + + @java.lang.Override + public _FinalStage endTime(String endTime) { + this.endTime = Optional.ofNullable(endTime); + return this; + } + + @java.lang.Override + @JsonSetter(value = "end_time", nulls = Nulls.SKIP) + public _FinalStage endTime(Optional endTime) { + this.endTime = endTime; + return this; + } + + @java.lang.Override + public _FinalStage billingCreditId(String billingCreditId) { + this.billingCreditId = Optional.ofNullable(billingCreditId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_id", nulls = Nulls.SKIP) + public _FinalStage billingCreditId(Optional billingCreditId) { + this.billingCreditId = billingCreditId; + return this; + } + + @java.lang.Override + public ListCreditEventLedgerRequest build() { + return new ListCreditEventLedgerRequest( + billingCreditId, + companyId, + endTime, + eventType, + featureId, + startTime, + limit, + offset, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ListGrantsForCreditRequest.java b/src/main/java/com/schematic/api/resources/credits/requests/ListGrantsForCreditRequest.java index 36ac8bb..fbd26d6 100644 --- a/src/main/java/com/schematic/api/resources/credits/requests/ListGrantsForCreditRequest.java +++ b/src/main/java/com/schematic/api/resources/credits/requests/ListGrantsForCreditRequest.java @@ -26,17 +26,17 @@ public final class ListGrantsForCreditRequest { private final Optional creditId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListGrantsForCreditRequest( Optional> ids, Optional creditId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.creditId = creditId; @@ -59,7 +59,7 @@ public Optional getCreditId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -67,7 +67,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -109,9 +109,9 @@ public static final class Builder { private Optional creditId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -157,12 +157,12 @@ public Builder creditId(String creditId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -184,5 +184,15 @@ public Builder offset(Integer offset) { public ListGrantsForCreditRequest build() { return new ListGrantsForCreditRequest(ids, creditId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingCreditRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateBillingCreditRequestBody.java index 35b8c5b..399d171 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 @@ -15,7 +15,9 @@ import com.schematic.api.types.BillingCreditBurnStrategy; import com.schematic.api.types.BillingCreditExpiryUnit; import com.schematic.api.types.BillingCreditRolloverPolicy; +import com.schematic.api.types.CreditCurrencyPriceRequestBody; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -26,9 +28,11 @@ public final class UpdateBillingCreditRequestBody { private final Optional burnStrategy; + private final Optional> currencyPrices; + private final Optional defaultExpiryUnit; - private final Optional defaultExpiryUnitCount; + private final Optional defaultExpiryUnitCount; private final Optional defaultRolloverPolicy; @@ -38,7 +42,7 @@ public final class UpdateBillingCreditRequestBody { private final String name; - private final Optional perUnitPrice; + private final Optional perUnitPrice; private final Optional perUnitPriceDecimal; @@ -50,18 +54,20 @@ public final class UpdateBillingCreditRequestBody { private UpdateBillingCreditRequestBody( Optional burnStrategy, + Optional> currencyPrices, Optional defaultExpiryUnit, - Optional defaultExpiryUnitCount, + Optional defaultExpiryUnitCount, Optional defaultRolloverPolicy, String description, Optional icon, String name, - Optional perUnitPrice, + Optional perUnitPrice, Optional perUnitPriceDecimal, Optional pluralName, Optional singularName, Map additionalProperties) { this.burnStrategy = burnStrategy; + this.currencyPrices = currencyPrices; this.defaultExpiryUnit = defaultExpiryUnit; this.defaultExpiryUnitCount = defaultExpiryUnitCount; this.defaultRolloverPolicy = defaultRolloverPolicy; @@ -80,13 +86,18 @@ public Optional getBurnStrategy() { return burnStrategy; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("default_expiry_unit") public Optional getDefaultExpiryUnit() { return defaultExpiryUnit; } @JsonProperty("default_expiry_unit_count") - public Optional getDefaultExpiryUnitCount() { + public Optional getDefaultExpiryUnitCount() { return defaultExpiryUnitCount; } @@ -111,7 +122,7 @@ public String getName() { } @JsonProperty("per_unit_price") - public Optional getPerUnitPrice() { + public Optional getPerUnitPrice() { return perUnitPrice; } @@ -143,6 +154,7 @@ public Map getAdditionalProperties() { private boolean equalTo(UpdateBillingCreditRequestBody other) { return burnStrategy.equals(other.burnStrategy) + && currencyPrices.equals(other.currencyPrices) && defaultExpiryUnit.equals(other.defaultExpiryUnit) && defaultExpiryUnitCount.equals(other.defaultExpiryUnitCount) && defaultRolloverPolicy.equals(other.defaultRolloverPolicy) @@ -159,6 +171,7 @@ private boolean equalTo(UpdateBillingCreditRequestBody other) { public int hashCode() { return Objects.hash( this.burnStrategy, + this.currencyPrices, this.defaultExpiryUnit, this.defaultExpiryUnitCount, this.defaultRolloverPolicy, @@ -193,17 +206,25 @@ public interface NameStage { public interface _FinalStage { UpdateBillingCreditRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage burnStrategy(Optional burnStrategy); _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage defaultExpiryUnit(Optional defaultExpiryUnit); _FinalStage defaultExpiryUnit(BillingCreditExpiryUnit defaultExpiryUnit); - _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); + _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); - _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount); + _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount); _FinalStage defaultRolloverPolicy(Optional defaultRolloverPolicy); @@ -213,9 +234,9 @@ public interface _FinalStage { _FinalStage icon(String icon); - _FinalStage perUnitPrice(Optional perUnitPrice); + _FinalStage perUnitPrice(Optional perUnitPrice); - _FinalStage perUnitPrice(Integer perUnitPrice); + _FinalStage perUnitPrice(Long perUnitPrice); _FinalStage perUnitPriceDecimal(Optional perUnitPriceDecimal); @@ -242,16 +263,18 @@ public static final class Builder implements DescriptionStage, NameStage, _Final private Optional perUnitPriceDecimal = Optional.empty(); - private Optional perUnitPrice = Optional.empty(); + private Optional perUnitPrice = Optional.empty(); private Optional icon = Optional.empty(); private Optional defaultRolloverPolicy = Optional.empty(); - private Optional defaultExpiryUnitCount = Optional.empty(); + private Optional defaultExpiryUnitCount = Optional.empty(); private Optional defaultExpiryUnit = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + private Optional burnStrategy = Optional.empty(); @JsonAnySetter @@ -262,6 +285,7 @@ private Builder() {} @java.lang.Override public Builder from(UpdateBillingCreditRequestBody other) { burnStrategy(other.getBurnStrategy()); + currencyPrices(other.getCurrencyPrices()); defaultExpiryUnit(other.getDefaultExpiryUnit()); defaultExpiryUnitCount(other.getDefaultExpiryUnitCount()); defaultRolloverPolicy(other.getDefaultRolloverPolicy()); @@ -329,14 +353,14 @@ public _FinalStage perUnitPriceDecimal(Optional perUnitPriceDecimal) { } @java.lang.Override - public _FinalStage perUnitPrice(Integer perUnitPrice) { + public _FinalStage perUnitPrice(Long perUnitPrice) { this.perUnitPrice = Optional.ofNullable(perUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "per_unit_price", nulls = Nulls.SKIP) - public _FinalStage perUnitPrice(Optional perUnitPrice) { + public _FinalStage perUnitPrice(Optional perUnitPrice) { this.perUnitPrice = perUnitPrice; return this; } @@ -368,14 +392,14 @@ public _FinalStage defaultRolloverPolicy(Optional d } @java.lang.Override - public _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount) { + public _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount) { this.defaultExpiryUnitCount = Optional.ofNullable(defaultExpiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "default_expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { + public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { this.defaultExpiryUnitCount = defaultExpiryUnitCount; return this; } @@ -393,6 +417,19 @@ public _FinalStage defaultExpiryUnit(Optional defaultEx return this; } + @java.lang.Override + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage burnStrategy(BillingCreditBurnStrategy burnStrategy) { this.burnStrategy = Optional.ofNullable(burnStrategy); @@ -410,6 +447,7 @@ public _FinalStage burnStrategy(Optional burnStrategy public UpdateBillingCreditRequestBody build() { return new UpdateBillingCreditRequestBody( burnStrategy, + currencyPrices, defaultExpiryUnit, defaultExpiryUnitCount, defaultRolloverPolicy, @@ -422,5 +460,17 @@ public UpdateBillingCreditRequestBody build() { singularName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/UpdateCreditBundleDetailsRequestBody.java index ac3d40d..2f78a62 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 @@ -15,7 +15,9 @@ import com.schematic.api.types.BillingCreditBundleStatus; import com.schematic.api.types.BillingCreditExpiryType; import com.schematic.api.types.BillingCreditExpiryUnit; +import com.schematic.api.types.CreditBundleCurrencyPriceRequestBody; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -26,17 +28,19 @@ public final class UpdateCreditBundleDetailsRequestBody { private final String bundleName; + private final Optional> currencyPrices; + private final Optional expiryType; private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; - private final int pricePerUnit; + private final long pricePerUnit; private final Optional pricePerUnitDecimal; - private final Optional quantity; + private final Optional quantity; private final Optional status; @@ -44,15 +48,17 @@ public final class UpdateCreditBundleDetailsRequestBody { private UpdateCreditBundleDetailsRequestBody( String bundleName, + Optional> currencyPrices, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, - int pricePerUnit, + Optional expiryUnitCount, + long pricePerUnit, Optional pricePerUnitDecimal, - Optional quantity, + Optional quantity, Optional status, Map additionalProperties) { this.bundleName = bundleName; + this.currencyPrices = currencyPrices; this.expiryType = expiryType; this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; @@ -68,6 +74,11 @@ public String getBundleName() { return bundleName; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("expiry_type") public Optional getExpiryType() { return expiryType; @@ -79,12 +90,12 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @JsonProperty("price_per_unit") - public int getPricePerUnit() { + public long getPricePerUnit() { return pricePerUnit; } @@ -94,7 +105,7 @@ public Optional getPricePerUnitDecimal() { } @JsonProperty("quantity") - public Optional getQuantity() { + public Optional getQuantity() { return quantity; } @@ -117,6 +128,7 @@ public Map getAdditionalProperties() { private boolean equalTo(UpdateCreditBundleDetailsRequestBody other) { return bundleName.equals(other.bundleName) + && currencyPrices.equals(other.currencyPrices) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) @@ -130,6 +142,7 @@ private boolean equalTo(UpdateCreditBundleDetailsRequestBody other) { public int hashCode() { return Objects.hash( this.bundleName, + this.currencyPrices, this.expiryType, this.expiryUnit, this.expiryUnitCount, @@ -155,12 +168,20 @@ public interface BundleNameStage { } public interface PricePerUnitStage { - _FinalStage pricePerUnit(int pricePerUnit); + _FinalStage pricePerUnit(long pricePerUnit); } public interface _FinalStage { UpdateCreditBundleDetailsRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); + _FinalStage expiryType(Optional expiryType); _FinalStage expiryType(BillingCreditExpiryType expiryType); @@ -169,17 +190,17 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal); _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal); - _FinalStage quantity(Optional quantity); + _FinalStage quantity(Optional quantity); - _FinalStage quantity(Integer quantity); + _FinalStage quantity(Long quantity); _FinalStage status(Optional status); @@ -190,20 +211,22 @@ public interface _FinalStage { public static final class Builder implements BundleNameStage, PricePerUnitStage, _FinalStage { private String bundleName; - private int pricePerUnit; + private long pricePerUnit; private Optional status = Optional.empty(); - private Optional quantity = Optional.empty(); + private Optional quantity = Optional.empty(); private Optional pricePerUnitDecimal = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); private Optional expiryType = Optional.empty(); + private Optional> currencyPrices = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -212,6 +235,7 @@ private Builder() {} @java.lang.Override public Builder from(UpdateCreditBundleDetailsRequestBody other) { bundleName(other.getBundleName()); + currencyPrices(other.getCurrencyPrices()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); @@ -231,7 +255,7 @@ public PricePerUnitStage bundleName(@NotNull String bundleName) { @java.lang.Override @JsonSetter("price_per_unit") - public _FinalStage pricePerUnit(int pricePerUnit) { + public _FinalStage pricePerUnit(long pricePerUnit) { this.pricePerUnit = pricePerUnit; return this; } @@ -250,14 +274,14 @@ public _FinalStage status(Optional status) { } @java.lang.Override - public _FinalStage quantity(Integer quantity) { + public _FinalStage quantity(Long quantity) { this.quantity = Optional.ofNullable(quantity); return this; } @java.lang.Override @JsonSetter(value = "quantity", nulls = Nulls.SKIP) - public _FinalStage quantity(Optional quantity) { + public _FinalStage quantity(Optional quantity) { this.quantity = quantity; return this; } @@ -276,14 +300,14 @@ public _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -314,10 +338,24 @@ public _FinalStage expiryType(Optional expiryType) { return this; } + @java.lang.Override + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public UpdateCreditBundleDetailsRequestBody build() { return new UpdateCreditBundleDetailsRequestBody( bundleName, + currencyPrices, expiryType, expiryUnit, expiryUnitCount, @@ -327,5 +365,17 @@ public UpdateCreditBundleDetailsRequestBody build() { status, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/requests/ZeroOutGrantRequestBody.java b/src/main/java/com/schematic/api/resources/credits/requests/ZeroOutGrantRequestBody.java index 8ce5ebd..7481553 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 @@ -93,5 +93,15 @@ public Builder reason(BillingCreditGrantZeroedOutReason reason) { public ZeroOutGrantRequestBody build() { return new ZeroOutGrantRequestBody(reason, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsParams.java index fa25bc8..6ca5ccf 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsParams.java @@ -25,17 +25,17 @@ public final class CountBillingCreditsGrantsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountBillingCreditsGrantsParams( Optional creditId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.creditId = creditId; this.ids = ids; @@ -58,7 +58,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -108,9 +108,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -151,12 +151,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -178,5 +178,15 @@ public Builder offset(Integer offset) { public CountBillingCreditsGrantsParams build() { return new CountBillingCreditsGrantsParams(creditId, ids, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsResponse.java index 010cede..7becf6b 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsGrantsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountBillingCreditsGrantsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountBillingCreditsGrantsParams params) { public CountBillingCreditsGrantsResponse build() { return new CountBillingCreditsGrantsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsParams.java index 1fdb843..4e8ace4 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsParams.java @@ -23,19 +23,19 @@ public final class CountBillingCreditsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; private final Optional name; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountBillingCreditsParams( Optional> ids, - Optional limit, + Optional limit, Optional name, - Optional offset, + Optional offset, Map additionalProperties) { this.ids = ids; this.limit = limit; @@ -53,7 +53,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getName() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -106,11 +106,11 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional name = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -140,12 +140,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -178,5 +178,15 @@ public Builder offset(Integer offset) { public CountBillingCreditsParams build() { return new CountBillingCreditsParams(ids, limit, name, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsResponse.java index e9304a0..330da2e 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountBillingCreditsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountBillingCreditsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountBillingCreditsParams params) { public CountBillingCreditsResponse build() { return new CountBillingCreditsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsParams.java index 1be80aa..99751f4 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsParams.java @@ -25,23 +25,26 @@ public final class CountBillingPlanCreditGrantsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; private final Optional> planIds; + private final Optional planVersionId; + private final Map additionalProperties; private CountBillingPlanCreditGrantsParams( Optional creditId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional> planIds, + Optional planVersionId, Map additionalProperties) { this.creditId = creditId; this.ids = ids; @@ -49,6 +52,7 @@ private CountBillingPlanCreditGrantsParams( this.offset = offset; this.planId = planId; this.planIds = planIds; + this.planVersionId = planVersionId; this.additionalProperties = additionalProperties; } @@ -66,7 +70,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -74,7 +78,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -88,6 +92,11 @@ public Optional> getPlanIds() { return planIds; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -106,12 +115,14 @@ private boolean equalTo(CountBillingPlanCreditGrantsParams other) { && limit.equals(other.limit) && offset.equals(other.offset) && planId.equals(other.planId) - && planIds.equals(other.planIds); + && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.creditId, this.ids, this.limit, this.offset, this.planId, this.planIds); + return Objects.hash( + this.creditId, this.ids, this.limit, this.offset, this.planId, this.planIds, this.planVersionId); } @java.lang.Override @@ -129,14 +140,16 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); private Optional> planIds = Optional.empty(); + private Optional planVersionId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -149,6 +162,7 @@ public Builder from(CountBillingPlanCreditGrantsParams other) { offset(other.getOffset()); planId(other.getPlanId()); planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); return this; } @@ -178,12 +192,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -224,9 +238,30 @@ public Builder planIds(List planIds) { return this; } + @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; + } + public CountBillingPlanCreditGrantsParams build() { return new CountBillingPlanCreditGrantsParams( - creditId, ids, limit, offset, planId, planIds, additionalProperties); + creditId, ids, limit, offset, planId, planIds, planVersionId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsResponse.java index 683c5ba..5306b60 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountBillingPlanCreditGrantsResponse.java @@ -91,6 +91,10 @@ public interface ParamsStage { public interface _FinalStage { CountBillingPlanCreditGrantsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -134,5 +138,17 @@ public _FinalStage params(@NotNull CountBillingPlanCreditGrantsParams params) { public CountBillingPlanCreditGrantsResponse build() { return new CountBillingPlanCreditGrantsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java index 945c7cf..175df6d 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsParams.java @@ -26,9 +26,9 @@ public final class CountCompanyGrantsParams { private final Optional dir; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional order; @@ -37,8 +37,8 @@ public final class CountCompanyGrantsParams { private CountCompanyGrantsParams( Optional companyId, Optional dir, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional order, Map additionalProperties) { this.companyId = companyId; @@ -63,7 +63,7 @@ public Optional getDir() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -71,7 +71,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -119,9 +119,9 @@ public static final class Builder { private Optional dir = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional order = Optional.empty(); @@ -165,12 +165,12 @@ public Builder dir(SortDirection dir) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public Builder order(CreditGrantSortOrder order) { public CountCompanyGrantsParams build() { return new CountCompanyGrantsParams(companyId, dir, limit, offset, order, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java index 3b4da2f..000f532 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCompanyGrantsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountCompanyGrantsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountCompanyGrantsParams params) { public CountCompanyGrantsResponse build() { return new CountCompanyGrantsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesParams.java index 1b39a73..1260d1a 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 @@ -28,9 +28,9 @@ public final class CountCreditBundlesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional status; @@ -40,8 +40,8 @@ private CountCreditBundlesParams( Optional bundleType, Optional creditId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional status, Map additionalProperties) { this.bundleType = bundleType; @@ -72,7 +72,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -80,7 +80,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -131,9 +131,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional status = Optional.empty(); @@ -189,12 +189,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -227,5 +227,15 @@ public Builder status(BillingCreditBundleStatus status) { public CountCreditBundlesParams build() { return new CountCreditBundlesParams(bundleType, creditId, ids, limit, offset, status, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponse.java index 99f11cb..34ad3a7 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditBundlesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountCreditBundlesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountCreditBundlesParams params) { public CountCreditBundlesResponse build() { return new CountCreditBundlesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java new file mode 100644 index 0000000..e949e1e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerParams.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CreditEventType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountCreditEventLedgerParams.Builder.class) +public final class CountCreditEventLedgerParams { + private final Optional billingCreditId; + + private final Optional companyId; + + private final Optional endTime; + + private final Optional eventType; + + private final Optional featureId; + + private final Optional limit; + + private final Optional offset; + + private final Optional startTime; + + private final Map additionalProperties; + + private CountCreditEventLedgerParams( + Optional billingCreditId, + Optional companyId, + Optional endTime, + Optional eventType, + Optional featureId, + Optional limit, + Optional offset, + Optional startTime, + Map additionalProperties) { + this.billingCreditId = billingCreditId; + this.companyId = companyId; + this.endTime = endTime; + this.eventType = eventType; + this.featureId = featureId; + this.limit = limit; + this.offset = offset; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_credit_id") + public Optional getBillingCreditId() { + return billingCreditId; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + @JsonProperty("event_type") + public Optional getEventType() { + return eventType; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + /** + * @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("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountCreditEventLedgerParams && equalTo((CountCreditEventLedgerParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountCreditEventLedgerParams other) { + return billingCreditId.equals(other.billingCreditId) + && companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && eventType.equals(other.eventType) + && featureId.equals(other.featureId) + && limit.equals(other.limit) + && offset.equals(other.offset) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingCreditId, + this.companyId, + this.endTime, + this.eventType, + this.featureId, + this.limit, + this.offset, + 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 billingCreditId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional eventType = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional startTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountCreditEventLedgerParams other) { + billingCreditId(other.getBillingCreditId()); + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + eventType(other.getEventType()); + featureId(other.getFeatureId()); + limit(other.getLimit()); + offset(other.getOffset()); + startTime(other.getStartTime()); + return this; + } + + @JsonSetter(value = "billing_credit_id", nulls = Nulls.SKIP) + public Builder billingCreditId(Optional billingCreditId) { + this.billingCreditId = billingCreditId; + return this; + } + + public Builder billingCreditId(String billingCreditId) { + this.billingCreditId = Optional.ofNullable(billingCreditId); + 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(String endTime) { + this.endTime = Optional.ofNullable(endTime); + return this; + } + + @JsonSetter(value = "event_type", nulls = Nulls.SKIP) + public Builder eventType(Optional eventType) { + this.eventType = eventType; + return this; + } + + public Builder eventType(CreditEventType eventType) { + this.eventType = Optional.ofNullable(eventType); + 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; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public Builder startTime(Optional startTime) { + this.startTime = startTime; + return this; + } + + public Builder startTime(String startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + public CountCreditEventLedgerParams build() { + return new CountCreditEventLedgerParams( + billingCreditId, + companyId, + endTime, + eventType, + featureId, + limit, + offset, + startTime, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerResponse.java similarity index 64% rename from src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterResponse.java rename to src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerResponse.java index cf08811..190b6ba 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/CountCompaniesForAdvancedFilterResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditEventLedgerResponse.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.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -18,18 +18,16 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountCompaniesForAdvancedFilterResponse.Builder.class) -public final class CountCompaniesForAdvancedFilterResponse { +@JsonDeserialize(builder = CountCreditEventLedgerResponse.Builder.class) +public final class CountCreditEventLedgerResponse { private final CountResponse data; - private final CountCompaniesForAdvancedFilterParams params; + private final CountCreditEventLedgerParams params; private final Map additionalProperties; - private CountCompaniesForAdvancedFilterResponse( - CountResponse data, - CountCompaniesForAdvancedFilterParams params, - Map additionalProperties) { + private CountCreditEventLedgerResponse( + CountResponse data, CountCreditEventLedgerParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -44,15 +42,14 @@ public CountResponse getData() { * @return Input parameters */ @JsonProperty("params") - public CountCompaniesForAdvancedFilterParams getParams() { + public CountCreditEventLedgerParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountCompaniesForAdvancedFilterResponse - && equalTo((CountCompaniesForAdvancedFilterResponse) other); + return other instanceof CountCreditEventLedgerResponse && equalTo((CountCreditEventLedgerResponse) other); } @JsonAnyGetter @@ -60,7 +57,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountCompaniesForAdvancedFilterResponse other) { + private boolean equalTo(CountCreditEventLedgerResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -81,25 +78,29 @@ public static DataStage builder() { public interface DataStage { ParamsStage data(@NotNull CountResponse data); - Builder from(CountCompaniesForAdvancedFilterResponse other); + Builder from(CountCreditEventLedgerResponse other); } public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull CountCompaniesForAdvancedFilterParams params); + _FinalStage params(@NotNull CountCreditEventLedgerParams params); } public interface _FinalStage { - CountCompaniesForAdvancedFilterResponse build(); + CountCreditEventLedgerResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, ParamsStage, _FinalStage { private CountResponse data; - private CountCompaniesForAdvancedFilterParams params; + private CountCreditEventLedgerParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -107,7 +108,7 @@ public static final class Builder implements DataStage, ParamsStage, _FinalStage private Builder() {} @java.lang.Override - public Builder from(CountCompaniesForAdvancedFilterResponse other) { + public Builder from(CountCreditEventLedgerResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -127,14 +128,26 @@ public ParamsStage data(@NotNull CountResponse data) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull CountCompaniesForAdvancedFilterParams params) { + public _FinalStage params(@NotNull CountCreditEventLedgerParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @java.lang.Override - public CountCompaniesForAdvancedFilterResponse build() { - return new CountCompaniesForAdvancedFilterResponse(data, params, additionalProperties); + public CountCreditEventLedgerResponse build() { + return new CountCreditEventLedgerResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerParams.java index c2f6b64..649986c 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 @@ -29,9 +29,9 @@ public final class CountCreditLedgerParams { private final Optional featureId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional period; @@ -44,8 +44,8 @@ private CountCreditLedgerParams( Optional companyId, Optional endTime, Optional featureId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional period, Optional startTime, Map additionalProperties) { @@ -84,7 +84,7 @@ public Optional getFeatureId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -92,7 +92,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -160,9 +160,9 @@ public static final class Builder { private Optional featureId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional period = Optional.empty(); @@ -233,12 +233,12 @@ public Builder featureId(String featureId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -291,5 +291,15 @@ public CountCreditLedgerParams build() { startTime, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponse.java index a0e67b4..0691a0e 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CountCreditLedgerResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountCreditLedgerResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountCreditLedgerParams params) { public CountCreditLedgerResponse build() { return new CountCreditLedgerResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditResponse.java index 8f4786f..7ffdfcf 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingCreditResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateBillingCreditResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateBillingCreditResponse build() { return new CreateBillingCreditResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantResponse.java index 50b36a4..643d798 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CreateBillingPlanCreditGrantResponse.java @@ -90,6 +90,10 @@ public interface DataStage { public interface _FinalStage { CreateBillingPlanCreditGrantResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -164,5 +168,17 @@ public _FinalStage params(Map params) { public CreateBillingPlanCreditGrantResponse build() { return new CreateBillingPlanCreditGrantResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleResponse.java b/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleResponse.java index c5bbf4c..634dcd1 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/CreateCreditBundleResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { CreateCreditBundleResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public CreateCreditBundleResponse build() { return new CreateCreditBundleResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java index c2aaab4..429ed04 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantParams.java @@ -93,5 +93,15 @@ public Builder applyToExisting(Boolean applyToExisting) { public DeleteBillingPlanCreditGrantParams build() { return new DeleteBillingPlanCreditGrantParams(applyToExisting, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java index 03ed5d8..28a76bd 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/DeleteBillingPlanCreditGrantResponse.java @@ -91,6 +91,10 @@ public interface ParamsStage { public interface _FinalStage { DeleteBillingPlanCreditGrantResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -134,5 +138,17 @@ public _FinalStage params(@NotNull DeleteBillingPlanCreditGrantParams params) { public DeleteBillingPlanCreditGrantResponse build() { return new DeleteBillingPlanCreditGrantResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/DeleteCreditBundleResponse.java b/src/main/java/com/schematic/api/resources/credits/types/DeleteCreditBundleResponse.java index 1d9a2f4..476a359 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/DeleteCreditBundleResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/DeleteCreditBundleResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteCreditBundleResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteCreditBundleResponse build() { return new DeleteCreditBundleResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetCreditBundleResponse.java b/src/main/java/com/schematic/api/resources/credits/types/GetCreditBundleResponse.java index 94b439e..df1370d 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/GetCreditBundleResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/GetCreditBundleResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { GetCreditBundleResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public GetCreditBundleResponse build() { return new GetCreditBundleResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerParams.java index 8918124..c0841ef 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 @@ -29,9 +29,9 @@ public final class GetEnrichedCreditLedgerParams { private final Optional featureId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional period; @@ -44,8 +44,8 @@ private GetEnrichedCreditLedgerParams( Optional companyId, Optional endTime, Optional featureId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional period, Optional startTime, Map additionalProperties) { @@ -84,7 +84,7 @@ public Optional getFeatureId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -92,7 +92,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -160,9 +160,9 @@ public static final class Builder { private Optional featureId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional period = Optional.empty(); @@ -233,12 +233,12 @@ public Builder featureId(String featureId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -291,5 +291,15 @@ public GetEnrichedCreditLedgerParams build() { startTime, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponse.java b/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponse.java index 36c97fa..475c367 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/GetEnrichedCreditLedgerResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { GetEnrichedCreditLedgerResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(CreditLedgerEnrichedEntryResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public GetEnrichedCreditLedgerResponse build() { return new GetEnrichedCreditLedgerResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingCreditResponse.java b/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingCreditResponse.java index d3c5985..2a9f2e0 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingCreditResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/GetSingleBillingCreditResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetSingleBillingCreditResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetSingleBillingCreditResponse build() { return new GetSingleBillingCreditResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/GrantBillingCreditsToCompanyResponse.java b/src/main/java/com/schematic/api/resources/credits/types/GrantBillingCreditsToCompanyResponse.java index 330672f..36f46b1 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/GrantBillingCreditsToCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/GrantBillingCreditsToCompanyResponse.java @@ -90,6 +90,10 @@ public interface DataStage { public interface _FinalStage { GrantBillingCreditsToCompanyResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -164,5 +168,17 @@ public _FinalStage params(Map params) { public GrantBillingCreditsToCompanyResponse build() { return new GrantBillingCreditsToCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsParams.java index bb8fa95..cf87b15 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsParams.java @@ -23,19 +23,19 @@ public final class ListBillingCreditsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; private final Optional name; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListBillingCreditsParams( Optional> ids, - Optional limit, + Optional limit, Optional name, - Optional offset, + Optional offset, Map additionalProperties) { this.ids = ids; this.limit = limit; @@ -53,7 +53,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getName() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -106,11 +106,11 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional name = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -140,12 +140,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -178,5 +178,15 @@ public Builder offset(Integer offset) { public ListBillingCreditsParams build() { return new ListBillingCreditsParams(ids, limit, name, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsResponse.java index bbdb9f6..67e67a6 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListBillingCreditsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListBillingCreditsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingCreditResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListBillingCreditsResponse build() { return new ListBillingCreditsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsParams.java index bee24ad..d20df6e 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsParams.java @@ -25,23 +25,26 @@ public final class ListBillingPlanCreditGrantsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; private final Optional> planIds; + private final Optional planVersionId; + private final Map additionalProperties; private ListBillingPlanCreditGrantsParams( Optional creditId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional> planIds, + Optional planVersionId, Map additionalProperties) { this.creditId = creditId; this.ids = ids; @@ -49,6 +52,7 @@ private ListBillingPlanCreditGrantsParams( this.offset = offset; this.planId = planId; this.planIds = planIds; + this.planVersionId = planVersionId; this.additionalProperties = additionalProperties; } @@ -66,7 +70,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -74,7 +78,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -88,6 +92,11 @@ public Optional> getPlanIds() { return planIds; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -105,12 +114,14 @@ private boolean equalTo(ListBillingPlanCreditGrantsParams other) { && limit.equals(other.limit) && offset.equals(other.offset) && planId.equals(other.planId) - && planIds.equals(other.planIds); + && planIds.equals(other.planIds) + && planVersionId.equals(other.planVersionId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.creditId, this.ids, this.limit, this.offset, this.planId, this.planIds); + return Objects.hash( + this.creditId, this.ids, this.limit, this.offset, this.planId, this.planIds, this.planVersionId); } @java.lang.Override @@ -128,14 +139,16 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); private Optional> planIds = Optional.empty(); + private Optional planVersionId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -148,6 +161,7 @@ public Builder from(ListBillingPlanCreditGrantsParams other) { offset(other.getOffset()); planId(other.getPlanId()); planIds(other.getPlanIds()); + planVersionId(other.getPlanVersionId()); return this; } @@ -177,12 +191,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -223,9 +237,30 @@ public Builder planIds(List planIds) { return this; } + @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; + } + public ListBillingPlanCreditGrantsParams build() { return new ListBillingPlanCreditGrantsParams( - creditId, ids, limit, offset, planId, planIds, additionalProperties); + creditId, ids, limit, offset, planId, planIds, planVersionId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsResponse.java index 41cc9f3..b9d19a7 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListBillingPlanCreditGrantsResponse.java @@ -93,6 +93,10 @@ public interface ParamsStage { public interface _FinalStage { ListBillingPlanCreditGrantsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingPlanCreditGrantResponseData data); @@ -158,5 +162,17 @@ public _FinalStage data(List data) { public ListBillingPlanCreditGrantsResponse build() { return new ListBillingPlanCreditGrantsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsParams.java index 30b4032..7d27a7e 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 @@ -26,9 +26,9 @@ public final class ListCompanyGrantsParams { private final Optional dir; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional order; @@ -37,8 +37,8 @@ public final class ListCompanyGrantsParams { private ListCompanyGrantsParams( Optional companyId, Optional dir, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional order, Map additionalProperties) { this.companyId = companyId; @@ -63,7 +63,7 @@ public Optional getDir() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -71,7 +71,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -119,9 +119,9 @@ public static final class Builder { private Optional dir = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional order = Optional.empty(); @@ -165,12 +165,12 @@ public Builder dir(SortDirection dir) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -203,5 +203,15 @@ public Builder order(CreditGrantSortOrder order) { public ListCompanyGrantsParams build() { return new ListCompanyGrantsParams(companyId, dir, limit, offset, order, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponse.java index faf91f9..0d2238c 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCompanyGrantsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListCompanyGrantsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingCreditGrantResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListCompanyGrantsResponse build() { return new ListCompanyGrantsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesParams.java index 4459a60..9e3dd84 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 @@ -28,9 +28,9 @@ public final class ListCreditBundlesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional status; @@ -40,8 +40,8 @@ private ListCreditBundlesParams( Optional bundleType, Optional creditId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional status, Map additionalProperties) { this.bundleType = bundleType; @@ -72,7 +72,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -80,7 +80,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -131,9 +131,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional status = Optional.empty(); @@ -189,12 +189,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -227,5 +227,15 @@ public Builder status(BillingCreditBundleStatus status) { public ListCreditBundlesParams build() { return new ListCreditBundlesParams(bundleType, creditId, ids, limit, offset, status, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponse.java index b3c9799..2f4d47b 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCreditBundlesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListCreditBundlesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingCreditBundleResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListCreditBundlesResponse build() { return new ListCreditBundlesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java new file mode 100644 index 0000000..1b787ff --- /dev/null +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerParams.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.credits.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.CreditEventType; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListCreditEventLedgerParams.Builder.class) +public final class ListCreditEventLedgerParams { + private final Optional billingCreditId; + + private final Optional companyId; + + private final Optional endTime; + + private final Optional eventType; + + private final Optional featureId; + + private final Optional limit; + + private final Optional offset; + + private final Optional startTime; + + private final Map additionalProperties; + + private ListCreditEventLedgerParams( + Optional billingCreditId, + Optional companyId, + Optional endTime, + Optional eventType, + Optional featureId, + Optional limit, + Optional offset, + Optional startTime, + Map additionalProperties) { + this.billingCreditId = billingCreditId; + this.companyId = companyId; + this.endTime = endTime; + this.eventType = eventType; + this.featureId = featureId; + this.limit = limit; + this.offset = offset; + this.startTime = startTime; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("billing_credit_id") + public Optional getBillingCreditId() { + return billingCreditId; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("end_time") + public Optional getEndTime() { + return endTime; + } + + @JsonProperty("event_type") + public Optional getEventType() { + return eventType; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + /** + * @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("start_time") + public Optional getStartTime() { + return startTime; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListCreditEventLedgerParams && equalTo((ListCreditEventLedgerParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListCreditEventLedgerParams other) { + return billingCreditId.equals(other.billingCreditId) + && companyId.equals(other.companyId) + && endTime.equals(other.endTime) + && eventType.equals(other.eventType) + && featureId.equals(other.featureId) + && limit.equals(other.limit) + && offset.equals(other.offset) + && startTime.equals(other.startTime); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.billingCreditId, + this.companyId, + this.endTime, + this.eventType, + this.featureId, + this.limit, + this.offset, + 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 billingCreditId = Optional.empty(); + + private Optional companyId = Optional.empty(); + + private Optional endTime = Optional.empty(); + + private Optional eventType = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional startTime = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListCreditEventLedgerParams other) { + billingCreditId(other.getBillingCreditId()); + companyId(other.getCompanyId()); + endTime(other.getEndTime()); + eventType(other.getEventType()); + featureId(other.getFeatureId()); + limit(other.getLimit()); + offset(other.getOffset()); + startTime(other.getStartTime()); + return this; + } + + @JsonSetter(value = "billing_credit_id", nulls = Nulls.SKIP) + public Builder billingCreditId(Optional billingCreditId) { + this.billingCreditId = billingCreditId; + return this; + } + + public Builder billingCreditId(String billingCreditId) { + this.billingCreditId = Optional.ofNullable(billingCreditId); + 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(String endTime) { + this.endTime = Optional.ofNullable(endTime); + return this; + } + + @JsonSetter(value = "event_type", nulls = Nulls.SKIP) + public Builder eventType(Optional eventType) { + this.eventType = eventType; + return this; + } + + public Builder eventType(CreditEventType eventType) { + this.eventType = Optional.ofNullable(eventType); + 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; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @JsonSetter(value = "start_time", nulls = Nulls.SKIP) + public Builder startTime(Optional startTime) { + this.startTime = startTime; + return this; + } + + public Builder startTime(String startTime) { + this.startTime = Optional.ofNullable(startTime); + return this; + } + + public ListCreditEventLedgerParams build() { + return new ListCreditEventLedgerParams( + billingCreditId, + companyId, + endTime, + eventType, + featureId, + limit, + offset, + startTime, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListApiRequestsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerResponse.java similarity index 59% rename from src/main/java/com/schematic/api/resources/accounts/types/ListApiRequestsResponse.java rename to src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerResponse.java index 33c4c17..4fd4df1 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListApiRequestsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListCreditEventLedgerResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.credits.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -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.ApiKeyRequestListResponseData; +import com.schematic.api.types.CreditEventLedgerResponseData; 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 = ListApiRequestsResponse.Builder.class) -public final class ListApiRequestsResponse { - private final List data; +@JsonDeserialize(builder = ListCreditEventLedgerResponse.Builder.class) +public final class ListCreditEventLedgerResponse { + private final List data; - private final ListApiRequestsParams params; + private final ListCreditEventLedgerParams params; private final Map additionalProperties; - private ListApiRequestsResponse( - List data, - ListApiRequestsParams params, + private ListCreditEventLedgerResponse( + List data, + ListCreditEventLedgerParams params, Map additionalProperties) { this.data = data; this.params = params; @@ -39,7 +39,7 @@ private ListApiRequestsResponse( } @JsonProperty("data") - public List getData() { + public List getData() { return data; } @@ -47,14 +47,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public ListApiRequestsParams getParams() { + public ListCreditEventLedgerParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListApiRequestsResponse && equalTo((ListApiRequestsResponse) other); + return other instanceof ListCreditEventLedgerResponse && equalTo((ListCreditEventLedgerResponse) other); } @JsonAnyGetter @@ -62,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListApiRequestsResponse other) { + private boolean equalTo(ListCreditEventLedgerResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -84,26 +84,30 @@ public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull ListApiRequestsParams params); + _FinalStage params(@NotNull ListCreditEventLedgerParams params); - Builder from(ListApiRequestsResponse other); + Builder from(ListCreditEventLedgerResponse other); } public interface _FinalStage { - ListApiRequestsResponse build(); + ListCreditEventLedgerResponse build(); - _FinalStage data(List data); + _FinalStage additionalProperty(String key, Object value); - _FinalStage addData(ApiKeyRequestListResponseData data); + _FinalStage additionalProperties(Map additionalProperties); - _FinalStage addAllData(List data); + _FinalStage data(List data); + + _FinalStage addData(CreditEventLedgerResponseData data); + + _FinalStage addAllData(List data); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ParamsStage, _FinalStage { - private ListApiRequestsParams params; + private ListCreditEventLedgerParams params; - private List data = new ArrayList<>(); + private List data = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -111,7 +115,7 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(ListApiRequestsResponse other) { + public Builder from(ListCreditEventLedgerResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -124,13 +128,13 @@ public Builder from(ListApiRequestsResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull ListApiRequestsParams params) { + public _FinalStage params(@NotNull ListCreditEventLedgerParams 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 +142,14 @@ public _FinalStage addAllData(List data) { } @java.lang.Override - public _FinalStage addData(ApiKeyRequestListResponseData data) { + public _FinalStage addData(CreditEventLedgerResponseData 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 +158,20 @@ public _FinalStage data(List data) { } @java.lang.Override - public ListApiRequestsResponse build() { - return new ListApiRequestsResponse(data, params, additionalProperties); + public ListCreditEventLedgerResponse build() { + return new ListCreditEventLedgerResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditParams.java b/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditParams.java index 69a753d..c2248b5 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditParams.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditParams.java @@ -25,17 +25,17 @@ public final class ListGrantsForCreditParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListGrantsForCreditParams( Optional creditId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.creditId = creditId; this.ids = ids; @@ -58,7 +58,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -108,9 +108,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -151,12 +151,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -178,5 +178,15 @@ public Builder offset(Integer offset) { public ListGrantsForCreditParams build() { return new ListGrantsForCreditParams(creditId, ids, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditResponse.java index e9ebfb7..9e2a14e 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ListGrantsForCreditResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListGrantsForCreditResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(BillingCreditGrantResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListGrantsForCreditResponse build() { return new ListGrantsForCreditResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/SoftDeleteBillingCreditResponse.java b/src/main/java/com/schematic/api/resources/credits/types/SoftDeleteBillingCreditResponse.java index 80e8e8a..2081417 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/SoftDeleteBillingCreditResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/SoftDeleteBillingCreditResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { SoftDeleteBillingCreditResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public SoftDeleteBillingCreditResponse build() { return new SoftDeleteBillingCreditResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditResponse.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditResponse.java index 103f6ab..175db85 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingCreditResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateBillingCreditResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateBillingCreditResponse build() { return new UpdateBillingCreditResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java index 953ead3..d8d13c4 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateBillingPlanCreditGrantResponse.java @@ -90,6 +90,10 @@ public interface DataStage { public interface _FinalStage { UpdateBillingPlanCreditGrantResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -164,5 +168,17 @@ public _FinalStage params(Map params) { public UpdateBillingPlanCreditGrantResponse build() { return new UpdateBillingPlanCreditGrantResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsResponse.java b/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsResponse.java index c696093..f997800 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/UpdateCreditBundleDetailsResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { UpdateCreditBundleDetailsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public UpdateCreditBundleDetailsResponse build() { return new UpdateCreditBundleDetailsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantResponse.java b/src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantResponse.java index 7ee3e07..f454a56 100644 --- a/src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantResponse.java +++ b/src/main/java/com/schematic/api/resources/credits/types/ZeroOutGrantResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { ZeroOutGrantResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public ZeroOutGrantResponse build() { return new ZeroOutGrantResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java index 3ab183b..64821dd 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/AsyncRawDataexportsClient.java @@ -48,10 +48,14 @@ public CompletableFuture> cr public CompletableFuture> createDataExport( CreateDataExportRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("data-exports") - .build(); + .addPathSegments("data-exports"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -60,7 +64,7 @@ public CompletableFuture> cr throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -75,14 +79,13 @@ public CompletableFuture> cr @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateDataExportResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateDataExportResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -114,11 +117,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -139,14 +140,18 @@ public CompletableFuture> getDataExportAr public CompletableFuture> getDataExportArtifact( String dataExportId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("data-exports") .addPathSegment(dataExportId) - .addPathSegments("artifact") - .build(); + .addPathSegments("artifact"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -193,11 +198,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java b/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java index 0db7273..a876e7d 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java +++ b/src/main/java/com/schematic/api/resources/dataexports/RawDataexportsClient.java @@ -43,10 +43,14 @@ public BaseSchematicHttpResponse createDataExport(Crea public BaseSchematicHttpResponse createDataExport( CreateDataExportRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("data-exports") - .build(); + .addPathSegments("data-exports"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -55,7 +59,7 @@ public BaseSchematicHttpResponse createDataExport( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -67,12 +71,12 @@ public BaseSchematicHttpResponse createDataExport( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateDataExportResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateDataExportResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -94,11 +98,9 @@ public BaseSchematicHttpResponse createDataExport( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -110,14 +112,18 @@ public BaseSchematicHttpResponse getDataExportArtifact(String dataE public BaseSchematicHttpResponse getDataExportArtifact( String dataExportId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("data-exports") .addPathSegment(dataExportId) - .addPathSegments("artifact") - .build(); + .addPathSegments("artifact"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -151,11 +157,9 @@ public BaseSchematicHttpResponse getDataExportArtifact( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java b/src/main/java/com/schematic/api/resources/dataexports/requests/CreateDataExportRequestBody.java index 34c8b3b..0602b6a 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 @@ -97,6 +97,10 @@ public interface OutputFileTypeStage { public interface _FinalStage { CreateDataExportRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -145,5 +149,17 @@ public _FinalStage outputFileType(@NotNull String outputFileType) { public CreateDataExportRequestBody build() { return new CreateDataExportRequestBody(exportType, metadata, outputFileType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/dataexports/types/CreateDataExportResponse.java b/src/main/java/com/schematic/api/resources/dataexports/types/CreateDataExportResponse.java index 08e6bf5..04f8573 100644 --- a/src/main/java/com/schematic/api/resources/dataexports/types/CreateDataExportResponse.java +++ b/src/main/java/com/schematic/api/resources/dataexports/types/CreateDataExportResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateDataExportResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateDataExportResponse build() { return new CreateDataExportResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java index 3e2b0a6..8e0d820 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncEntitlementsClient.java @@ -66,6 +66,10 @@ public CompletableFuture listCompanyOverrides() { return this.rawClient.listCompanyOverrides().thenApply(response -> response.body()); } + public CompletableFuture listCompanyOverrides(RequestOptions requestOptions) { + return this.rawClient.listCompanyOverrides(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listCompanyOverrides(ListCompanyOverridesRequest request) { return this.rawClient.listCompanyOverrides(request).thenApply(response -> response.body()); } @@ -123,6 +127,10 @@ public CompletableFuture countCompanyOverrides() return this.rawClient.countCompanyOverrides().thenApply(response -> response.body()); } + public CompletableFuture countCompanyOverrides(RequestOptions requestOptions) { + return this.rawClient.countCompanyOverrides(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countCompanyOverrides( CountCompanyOverridesRequest request) { return this.rawClient.countCompanyOverrides(request).thenApply(response -> response.body()); @@ -156,6 +164,10 @@ public CompletableFuture listFeatureUsage() { return this.rawClient.listFeatureUsage().thenApply(response -> response.body()); } + public CompletableFuture listFeatureUsage(RequestOptions requestOptions) { + return this.rawClient.listFeatureUsage(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listFeatureUsage(ListFeatureUsageRequest request) { return this.rawClient.listFeatureUsage(request).thenApply(response -> response.body()); } @@ -179,6 +191,10 @@ public CompletableFuture countFeatureUsage() { return this.rawClient.countFeatureUsage().thenApply(response -> response.body()); } + public CompletableFuture countFeatureUsage(RequestOptions requestOptions) { + return this.rawClient.countFeatureUsage(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countFeatureUsage(CountFeatureUsageRequest request) { return this.rawClient.countFeatureUsage(request).thenApply(response -> response.body()); } @@ -210,6 +226,10 @@ public CompletableFuture listPlanEntitlements() { return this.rawClient.listPlanEntitlements().thenApply(response -> response.body()); } + public CompletableFuture listPlanEntitlements(RequestOptions requestOptions) { + return this.rawClient.listPlanEntitlements(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listPlanEntitlements(ListPlanEntitlementsRequest request) { return this.rawClient.listPlanEntitlements(request).thenApply(response -> response.body()); } @@ -267,6 +287,10 @@ public CompletableFuture countPlanEntitlements() return this.rawClient.countPlanEntitlements().thenApply(response -> response.body()); } + public CompletableFuture countPlanEntitlements(RequestOptions requestOptions) { + return this.rawClient.countPlanEntitlements(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countPlanEntitlements( CountPlanEntitlementsRequest request) { return this.rawClient.countPlanEntitlements(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 e19175a..18191ec 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/AsyncRawEntitlementsClient.java @@ -80,6 +80,11 @@ public CompletableFuture return listCompanyOverrides(ListCompanyOverridesRequest.builder().build()); } + public CompletableFuture> listCompanyOverrides( + RequestOptions requestOptions) { + return listCompanyOverrides(ListCompanyOverridesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listCompanyOverrides( ListCompanyOverridesRequest request) { return listCompanyOverrides(request, null); @@ -124,6 +129,11 @@ public CompletableFuture if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -139,14 +149,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListCompanyOverridesResponse.class), + responseBodyString, ListCompanyOverridesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -178,11 +188,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -204,10 +212,14 @@ public CompletableFuture> createCompanyOverride( CreateCompanyOverrideRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("company-overrides") - .build(); + .addPathSegments("company-overrides"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -216,7 +228,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateCompanyOverrideResponse.class), + responseBodyString, CreateCompanyOverrideResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -270,11 +282,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -296,13 +306,17 @@ public CompletableFuture> public CompletableFuture> getCompanyOverride( String companyOverrideId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId) - .build(); + .addPathSegment(companyOverrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -316,14 +330,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetCompanyOverrideResponse.class), + responseBodyString, GetCompanyOverrideResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -350,11 +364,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -376,11 +388,15 @@ public CompletableFuture> updateCompanyOverride( String companyOverrideId, UpdateCompanyOverrideRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId) - .build(); + .addPathSegment(companyOverrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -389,7 +405,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateCompanyOverrideResponse.class), + responseBodyString, UpdateCompanyOverrideResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -443,11 +459,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -469,13 +483,17 @@ public CompletableFuture> deleteCompanyOverride( String companyOverrideId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId) - .build(); + .addPathSegment(companyOverrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -489,14 +507,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeleteCompanyOverrideResponse.class), + responseBodyString, DeleteCompanyOverrideResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -528,11 +546,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -551,6 +567,11 @@ public CompletableFuture> countCompanyOverrides( + RequestOptions requestOptions) { + return countCompanyOverrides(CountCompanyOverridesRequest.builder().build(), requestOptions); + } + public CompletableFuture> countCompanyOverrides( CountCompanyOverridesRequest request) { return countCompanyOverrides(request, null); @@ -595,6 +616,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -610,14 +636,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountCompanyOverridesResponse.class), + responseBodyString, CountCompanyOverridesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -649,11 +675,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -690,6 +714,11 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -705,14 +734,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListFeatureCompaniesResponse.class), + responseBodyString, ListFeatureCompaniesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -744,11 +773,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -785,6 +812,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -800,14 +832,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountFeatureCompaniesResponse.class), + responseBodyString, CountFeatureCompaniesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -839,11 +871,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -862,6 +892,11 @@ public CompletableFuture> li return listFeatureUsage(ListFeatureUsageRequest.builder().build()); } + public CompletableFuture> listFeatureUsage( + RequestOptions requestOptions) { + return listFeatureUsage(ListFeatureUsageRequest.builder().build(), requestOptions); + } + public CompletableFuture> listFeatureUsage( ListFeatureUsageRequest request) { return listFeatureUsage(request, null); @@ -909,6 +944,11 @@ public CompletableFuture> li QueryStringMapper.addQueryParameter( httpUrl, "feature_ids", request.getFeatureIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -924,14 +964,13 @@ public CompletableFuture> li @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListFeatureUsageResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeatureUsageResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -963,11 +1002,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1000,6 +1037,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1016,14 +1058,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetFeatureUsageTimeSeriesResponse.class), + responseBodyString, GetFeatureUsageTimeSeriesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1050,11 +1092,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1073,6 +1113,11 @@ public CompletableFuture> c return countFeatureUsage(CountFeatureUsageRequest.builder().build()); } + public CompletableFuture> countFeatureUsage( + RequestOptions requestOptions) { + return countFeatureUsage(CountFeatureUsageRequest.builder().build(), requestOptions); + } + public CompletableFuture> countFeatureUsage( CountFeatureUsageRequest request) { return countFeatureUsage(request, null); @@ -1120,6 +1165,11 @@ public CompletableFuture> c QueryStringMapper.addQueryParameter( httpUrl, "feature_ids", request.getFeatureIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1135,14 +1185,14 @@ public CompletableFuture> c @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountFeatureUsageResponse.class), + responseBodyString, CountFeatureUsageResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1174,11 +1224,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1215,6 +1263,11 @@ public CompletableFuture> li QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1230,14 +1283,13 @@ public CompletableFuture> li @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListFeatureUsersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeatureUsersResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1269,11 +1321,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1310,6 +1360,11 @@ public CompletableFuture> c QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1325,14 +1380,14 @@ public CompletableFuture> c @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountFeatureUsersResponse.class), + responseBodyString, CountFeatureUsersResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1364,11 +1419,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1387,6 +1440,11 @@ public CompletableFuture return listPlanEntitlements(ListPlanEntitlementsRequest.builder().build()); } + public CompletableFuture> listPlanEntitlements( + RequestOptions requestOptions) { + return listPlanEntitlements(ListPlanEntitlementsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listPlanEntitlements( ListPlanEntitlementsRequest request) { return listPlanEntitlements(request, null); @@ -1442,6 +1500,11 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1457,14 +1520,14 @@ public CompletableFuture @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListPlanEntitlementsResponse.class), + responseBodyString, ListPlanEntitlementsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1496,11 +1559,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1522,10 +1583,14 @@ public CompletableFuture> createPlanEntitlement( CreatePlanEntitlementRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-entitlements") - .build(); + .addPathSegments("plan-entitlements"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1534,7 +1599,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreatePlanEntitlementResponse.class), + responseBodyString, CreatePlanEntitlementResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1588,11 +1653,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1614,13 +1677,17 @@ public CompletableFuture> public CompletableFuture> getPlanEntitlement( String planEntitlementId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId) - .build(); + .addPathSegment(planEntitlementId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1634,14 +1701,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetPlanEntitlementResponse.class), + responseBodyString, GetPlanEntitlementResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1668,11 +1735,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1694,11 +1759,15 @@ public CompletableFuture> updatePlanEntitlement( String planEntitlementId, UpdatePlanEntitlementRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId) - .build(); + .addPathSegment(planEntitlementId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1707,7 +1776,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdatePlanEntitlementResponse.class), + responseBodyString, UpdatePlanEntitlementResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1761,11 +1830,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1787,13 +1854,17 @@ public CompletableFuture> deletePlanEntitlement( String planEntitlementId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId) - .build(); + .addPathSegment(planEntitlementId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1807,14 +1878,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DeletePlanEntitlementResponse.class), + responseBodyString, DeletePlanEntitlementResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1846,11 +1917,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1869,6 +1938,11 @@ public CompletableFuture> countPlanEntitlements( + RequestOptions requestOptions) { + return countPlanEntitlements(CountPlanEntitlementsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countPlanEntitlements( CountPlanEntitlementsRequest request) { return countPlanEntitlements(request, null); @@ -1924,6 +1998,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1939,14 +2018,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountPlanEntitlementsResponse.class), + responseBodyString, CountPlanEntitlementsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1978,11 +2057,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2004,10 +2081,14 @@ public CompletableFuture> duplicatePlanEntitlements( DuplicatePlanEntitlementsRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-entitlements/duplicate") - .build(); + .addPathSegments("plan-entitlements/duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -2016,7 +2097,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DuplicatePlanEntitlementsResponse.class), + responseBodyString, DuplicatePlanEntitlementsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -2071,11 +2152,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -2101,6 +2180,11 @@ public CompletableFuture { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -2117,14 +2201,14 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetFeatureUsageByCompanyResponse.class), + responseBodyString, GetFeatureUsageByCompanyResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -2151,11 +2235,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 14c39bb..4f9a98a 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/EntitlementsClient.java @@ -65,6 +65,10 @@ public ListCompanyOverridesResponse listCompanyOverrides() { return this.rawClient.listCompanyOverrides().body(); } + public ListCompanyOverridesResponse listCompanyOverrides(RequestOptions requestOptions) { + return this.rawClient.listCompanyOverrides(requestOptions).body(); + } + public ListCompanyOverridesResponse listCompanyOverrides(ListCompanyOverridesRequest request) { return this.rawClient.listCompanyOverrides(request).body(); } @@ -120,6 +124,10 @@ public CountCompanyOverridesResponse countCompanyOverrides() { return this.rawClient.countCompanyOverrides().body(); } + public CountCompanyOverridesResponse countCompanyOverrides(RequestOptions requestOptions) { + return this.rawClient.countCompanyOverrides(requestOptions).body(); + } + public CountCompanyOverridesResponse countCompanyOverrides(CountCompanyOverridesRequest request) { return this.rawClient.countCompanyOverrides(request).body(); } @@ -151,6 +159,10 @@ public ListFeatureUsageResponse listFeatureUsage() { return this.rawClient.listFeatureUsage().body(); } + public ListFeatureUsageResponse listFeatureUsage(RequestOptions requestOptions) { + return this.rawClient.listFeatureUsage(requestOptions).body(); + } + public ListFeatureUsageResponse listFeatureUsage(ListFeatureUsageRequest request) { return this.rawClient.listFeatureUsage(request).body(); } @@ -172,6 +184,10 @@ public CountFeatureUsageResponse countFeatureUsage() { return this.rawClient.countFeatureUsage().body(); } + public CountFeatureUsageResponse countFeatureUsage(RequestOptions requestOptions) { + return this.rawClient.countFeatureUsage(requestOptions).body(); + } + public CountFeatureUsageResponse countFeatureUsage(CountFeatureUsageRequest request) { return this.rawClient.countFeatureUsage(request).body(); } @@ -202,6 +218,10 @@ public ListPlanEntitlementsResponse listPlanEntitlements() { return this.rawClient.listPlanEntitlements().body(); } + public ListPlanEntitlementsResponse listPlanEntitlements(RequestOptions requestOptions) { + return this.rawClient.listPlanEntitlements(requestOptions).body(); + } + public ListPlanEntitlementsResponse listPlanEntitlements(ListPlanEntitlementsRequest request) { return this.rawClient.listPlanEntitlements(request).body(); } @@ -257,6 +277,10 @@ public CountPlanEntitlementsResponse countPlanEntitlements() { return this.rawClient.countPlanEntitlements().body(); } + public CountPlanEntitlementsResponse countPlanEntitlements(RequestOptions requestOptions) { + return this.rawClient.countPlanEntitlements(requestOptions).body(); + } + public CountPlanEntitlementsResponse countPlanEntitlements(CountPlanEntitlementsRequest request) { return this.rawClient.countPlanEntitlements(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 b3db447..1bda5e7 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java +++ b/src/main/java/com/schematic/api/resources/entitlements/RawEntitlementsClient.java @@ -76,6 +76,10 @@ public BaseSchematicHttpResponse listCompanyOverri return listCompanyOverrides(ListCompanyOverridesRequest.builder().build()); } + public BaseSchematicHttpResponse listCompanyOverrides(RequestOptions requestOptions) { + return listCompanyOverrides(ListCompanyOverridesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listCompanyOverrides( ListCompanyOverridesRequest request) { return listCompanyOverrides(request, null); @@ -120,6 +124,11 @@ public BaseSchematicHttpResponse listCompanyOverri if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -132,12 +141,12 @@ public BaseSchematicHttpResponse listCompanyOverri } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCompanyOverridesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompanyOverridesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -159,11 +168,9 @@ public BaseSchematicHttpResponse listCompanyOverri } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -176,10 +183,14 @@ public BaseSchematicHttpResponse createCompanyOve public BaseSchematicHttpResponse createCompanyOverride( CreateCompanyOverrideRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("company-overrides") - .build(); + .addPathSegments("company-overrides"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -188,7 +199,7 @@ public BaseSchematicHttpResponse createCompanyOve throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -200,12 +211,12 @@ public BaseSchematicHttpResponse createCompanyOve } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateCompanyOverrideResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateCompanyOverrideResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -227,11 +238,9 @@ public BaseSchematicHttpResponse createCompanyOve } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -243,13 +252,17 @@ public BaseSchematicHttpResponse getCompanyOverride( public BaseSchematicHttpResponse getCompanyOverride( String companyOverrideId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId) - .build(); + .addPathSegment(companyOverrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -260,12 +273,12 @@ public BaseSchematicHttpResponse getCompanyOverride( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCompanyOverrideResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetCompanyOverrideResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -284,11 +297,9 @@ public BaseSchematicHttpResponse getCompanyOverride( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -301,11 +312,15 @@ public BaseSchematicHttpResponse updateCompanyOve public BaseSchematicHttpResponse updateCompanyOverride( String companyOverrideId, UpdateCompanyOverrideRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId) - .build(); + .addPathSegment(companyOverrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -314,7 +329,7 @@ public BaseSchematicHttpResponse updateCompanyOve throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -326,12 +341,12 @@ public BaseSchematicHttpResponse updateCompanyOve } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateCompanyOverrideResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateCompanyOverrideResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -353,11 +368,9 @@ public BaseSchematicHttpResponse updateCompanyOve } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -369,13 +382,17 @@ public BaseSchematicHttpResponse deleteCompanyOve public BaseSchematicHttpResponse deleteCompanyOverride( String companyOverrideId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-overrides") - .addPathSegment(companyOverrideId) - .build(); + .addPathSegment(companyOverrideId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -386,12 +403,12 @@ public BaseSchematicHttpResponse deleteCompanyOve } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteCompanyOverrideResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteCompanyOverrideResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -413,11 +430,9 @@ public BaseSchematicHttpResponse deleteCompanyOve } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -427,6 +442,11 @@ public BaseSchematicHttpResponse countCompanyOver return countCompanyOverrides(CountCompanyOverridesRequest.builder().build()); } + public BaseSchematicHttpResponse countCompanyOverrides( + RequestOptions requestOptions) { + return countCompanyOverrides(CountCompanyOverridesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countCompanyOverrides( CountCompanyOverridesRequest request) { return countCompanyOverrides(request, null); @@ -471,6 +491,11 @@ public BaseSchematicHttpResponse countCompanyOver if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -483,12 +508,12 @@ public BaseSchematicHttpResponse countCompanyOver } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountCompanyOverridesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCompanyOverridesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -510,11 +535,9 @@ public BaseSchematicHttpResponse countCompanyOver } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -542,6 +565,11 @@ public BaseSchematicHttpResponse listFeatureCompan QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -554,12 +582,12 @@ public BaseSchematicHttpResponse listFeatureCompan } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFeatureCompaniesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeatureCompaniesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -581,11 +609,9 @@ public BaseSchematicHttpResponse listFeatureCompan } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -613,6 +639,11 @@ public BaseSchematicHttpResponse countFeatureComp QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -625,12 +656,12 @@ public BaseSchematicHttpResponse countFeatureComp } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFeatureCompaniesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFeatureCompaniesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -652,11 +683,9 @@ public BaseSchematicHttpResponse countFeatureComp } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -666,6 +695,10 @@ public BaseSchematicHttpResponse listFeatureUsage() { return listFeatureUsage(ListFeatureUsageRequest.builder().build()); } + public BaseSchematicHttpResponse listFeatureUsage(RequestOptions requestOptions) { + return listFeatureUsage(ListFeatureUsageRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listFeatureUsage(ListFeatureUsageRequest request) { return listFeatureUsage(request, null); } @@ -712,6 +745,11 @@ public BaseSchematicHttpResponse listFeatureUsage( QueryStringMapper.addQueryParameter( httpUrl, "feature_ids", request.getFeatureIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -724,12 +762,12 @@ public BaseSchematicHttpResponse listFeatureUsage( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFeatureUsageResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeatureUsageResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -751,11 +789,9 @@ public BaseSchematicHttpResponse listFeatureUsage( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -779,6 +815,11 @@ public BaseSchematicHttpResponse getFeatureUs httpUrl, "granularity", request.getGranularity().get(), false); } QueryStringMapper.addQueryParameter(httpUrl, "start_time", request.getStartTime(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -791,13 +832,13 @@ public BaseSchematicHttpResponse getFeatureUs } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetFeatureUsageTimeSeriesResponse.class), + responseBodyString, GetFeatureUsageTimeSeriesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -816,11 +857,9 @@ public BaseSchematicHttpResponse getFeatureUs } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -830,6 +869,10 @@ public BaseSchematicHttpResponse countFeatureUsage() return countFeatureUsage(CountFeatureUsageRequest.builder().build()); } + public BaseSchematicHttpResponse countFeatureUsage(RequestOptions requestOptions) { + return countFeatureUsage(CountFeatureUsageRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countFeatureUsage(CountFeatureUsageRequest request) { return countFeatureUsage(request, null); } @@ -876,6 +919,11 @@ public BaseSchematicHttpResponse countFeatureUsage( QueryStringMapper.addQueryParameter( httpUrl, "feature_ids", request.getFeatureIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -888,12 +936,12 @@ public BaseSchematicHttpResponse countFeatureUsage( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFeatureUsageResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFeatureUsageResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -915,11 +963,9 @@ public BaseSchematicHttpResponse countFeatureUsage( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -946,6 +992,11 @@ public BaseSchematicHttpResponse listFeatureUsers( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -958,12 +1009,12 @@ public BaseSchematicHttpResponse listFeatureUsers( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFeatureUsersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeatureUsersResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -985,11 +1036,9 @@ public BaseSchematicHttpResponse listFeatureUsers( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1016,6 +1065,11 @@ public BaseSchematicHttpResponse countFeatureUsers( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1028,12 +1082,12 @@ public BaseSchematicHttpResponse countFeatureUsers( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFeatureUsersResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFeatureUsersResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1055,11 +1109,9 @@ public BaseSchematicHttpResponse countFeatureUsers( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1069,6 +1121,10 @@ public BaseSchematicHttpResponse listPlanEntitleme return listPlanEntitlements(ListPlanEntitlementsRequest.builder().build()); } + public BaseSchematicHttpResponse listPlanEntitlements(RequestOptions requestOptions) { + return listPlanEntitlements(ListPlanEntitlementsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listPlanEntitlements( ListPlanEntitlementsRequest request) { return listPlanEntitlements(request, null); @@ -1124,6 +1180,11 @@ public BaseSchematicHttpResponse listPlanEntitleme QueryStringMapper.addQueryParameter( httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1136,12 +1197,12 @@ public BaseSchematicHttpResponse listPlanEntitleme } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPlanEntitlementsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanEntitlementsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1163,11 +1224,9 @@ public BaseSchematicHttpResponse listPlanEntitleme } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1180,10 +1239,14 @@ public BaseSchematicHttpResponse createPlanEntitl public BaseSchematicHttpResponse createPlanEntitlement( CreatePlanEntitlementRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-entitlements") - .build(); + .addPathSegments("plan-entitlements"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1192,7 +1255,7 @@ public BaseSchematicHttpResponse createPlanEntitl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1204,12 +1267,12 @@ public BaseSchematicHttpResponse createPlanEntitl } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanEntitlementResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanEntitlementResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1231,11 +1294,9 @@ public BaseSchematicHttpResponse createPlanEntitl } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1247,13 +1308,17 @@ public BaseSchematicHttpResponse getPlanEntitlement( public BaseSchematicHttpResponse getPlanEntitlement( String planEntitlementId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId) - .build(); + .addPathSegment(planEntitlementId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1264,12 +1329,12 @@ public BaseSchematicHttpResponse getPlanEntitlement( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanEntitlementResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanEntitlementResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1288,11 +1353,9 @@ public BaseSchematicHttpResponse getPlanEntitlement( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1305,11 +1368,15 @@ public BaseSchematicHttpResponse updatePlanEntitl public BaseSchematicHttpResponse updatePlanEntitlement( String planEntitlementId, UpdatePlanEntitlementRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId) - .build(); + .addPathSegment(planEntitlementId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1318,7 +1385,7 @@ public BaseSchematicHttpResponse updatePlanEntitl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1330,12 +1397,12 @@ public BaseSchematicHttpResponse updatePlanEntitl } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanEntitlementResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanEntitlementResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1357,11 +1424,9 @@ public BaseSchematicHttpResponse updatePlanEntitl } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1373,13 +1438,17 @@ public BaseSchematicHttpResponse deletePlanEntitl public BaseSchematicHttpResponse deletePlanEntitlement( String planEntitlementId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-entitlements") - .addPathSegment(planEntitlementId) - .build(); + .addPathSegment(planEntitlementId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1390,12 +1459,12 @@ public BaseSchematicHttpResponse deletePlanEntitl } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePlanEntitlementResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlanEntitlementResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1417,11 +1486,9 @@ public BaseSchematicHttpResponse deletePlanEntitl } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1431,6 +1498,11 @@ public BaseSchematicHttpResponse countPlanEntitle return countPlanEntitlements(CountPlanEntitlementsRequest.builder().build()); } + public BaseSchematicHttpResponse countPlanEntitlements( + RequestOptions requestOptions) { + return countPlanEntitlements(CountPlanEntitlementsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countPlanEntitlements( CountPlanEntitlementsRequest request) { return countPlanEntitlements(request, null); @@ -1486,6 +1558,11 @@ public BaseSchematicHttpResponse countPlanEntitle QueryStringMapper.addQueryParameter( httpUrl, "plan_version_ids", request.getPlanVersionIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1498,12 +1575,12 @@ public BaseSchematicHttpResponse countPlanEntitle } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountPlanEntitlementsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountPlanEntitlementsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1525,11 +1602,9 @@ public BaseSchematicHttpResponse countPlanEntitle } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1542,10 +1617,14 @@ public BaseSchematicHttpResponse duplicatePla public BaseSchematicHttpResponse duplicatePlanEntitlements( DuplicatePlanEntitlementsRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-entitlements/duplicate") - .build(); + .addPathSegments("plan-entitlements/duplicate"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1554,7 +1633,7 @@ public BaseSchematicHttpResponse duplicatePla throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1566,13 +1645,13 @@ public BaseSchematicHttpResponse duplicatePla } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), DuplicatePlanEntitlementsResponse.class), + responseBodyString, DuplicatePlanEntitlementsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1594,11 +1673,9 @@ public BaseSchematicHttpResponse duplicatePla } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1615,6 +1692,11 @@ public BaseSchematicHttpResponse getFeatureUsa .newBuilder() .addPathSegments("usage-by-company"); QueryStringMapper.addQueryParameter(httpUrl, "keys", request.getKeys(), false); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1627,13 +1709,12 @@ public BaseSchematicHttpResponse getFeatureUsa } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetFeatureUsageByCompanyResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFeatureUsageByCompanyResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -1652,11 +1733,9 @@ public BaseSchematicHttpResponse getFeatureUsa } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountCompanyOverridesRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountCompanyOverridesRequest.java index b9569f2..5ca3aaa 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CountCompanyOverridesRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CountCompanyOverridesRequest.java @@ -36,9 +36,9 @@ public final class CountCompanyOverridesRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -50,8 +50,8 @@ private CountCompanyOverridesRequest( Optional featureId, Optional withoutExpired, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.featureIds = featureIds; @@ -125,7 +125,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -133,7 +133,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -199,9 +199,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -338,12 +338,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -375,5 +375,15 @@ public CountCompanyOverridesRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureCompaniesRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureCompaniesRequest.java index c5d9704..7080fce 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureCompaniesRequest.java @@ -25,17 +25,17 @@ public final class CountFeatureCompaniesRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountFeatureCompaniesRequest( String featureId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureId = featureId; this.q = q; @@ -58,7 +58,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -111,6 +111,10 @@ public interface FeatureIdStage { public interface _FinalStage { CountFeatureCompaniesRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage q(Optional q); _FinalStage q(String q); @@ -118,25 +122,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements FeatureIdStage, _FinalStage { private String featureId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional q = Optional.empty(); @@ -166,7 +170,7 @@ public _FinalStage featureId(@NotNull String featureId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -176,7 +180,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -186,7 +190,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -196,7 +200,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -218,5 +222,17 @@ public _FinalStage q(Optional q) { public CountFeatureCompaniesRequest build() { return new CountFeatureCompaniesRequest(featureId, q, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsageRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsageRequest.java index 494b8aa..378680e 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 @@ -34,9 +34,9 @@ public final class CountFeatureUsageRequest { private final Optional withoutNegativeEntitlements; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -47,8 +47,8 @@ private CountFeatureUsageRequest( Optional includeUsageAggregation, Optional q, Optional withoutNegativeEntitlements, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureIds = featureIds; this.companyId = companyId; @@ -98,7 +98,7 @@ public Optional getWithoutNegativeEntitlements() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -106,7 +106,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -168,9 +168,9 @@ public static final class Builder { private Optional withoutNegativeEntitlements = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -267,12 +267,12 @@ public Builder withoutNegativeEntitlements(Boolean withoutNegativeEntitlements) *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -303,5 +303,15 @@ public CountFeatureUsageRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsersRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsersRequest.java index a67f80b..cbd0496 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsersRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/CountFeatureUsersRequest.java @@ -25,17 +25,17 @@ public final class CountFeatureUsersRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountFeatureUsersRequest( String featureId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureId = featureId; this.q = q; @@ -58,7 +58,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -111,6 +111,10 @@ public interface FeatureIdStage { public interface _FinalStage { CountFeatureUsersRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage q(Optional q); _FinalStage q(String q); @@ -118,25 +122,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements FeatureIdStage, _FinalStage { private String featureId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional q = Optional.empty(); @@ -166,7 +170,7 @@ public _FinalStage featureId(@NotNull String featureId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -176,7 +180,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -186,7 +190,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -196,7 +200,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -218,5 +222,17 @@ public _FinalStage q(Optional q) { public CountFeatureUsersRequest build() { return new CountFeatureUsersRequest(featureId, q, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CountPlanEntitlementsRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CountPlanEntitlementsRequest.java index 319d59d..7ac1079 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 @@ -40,9 +40,9 @@ public final class CountPlanEntitlementsRequest { private final Optional withMeteredProducts; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -56,8 +56,8 @@ private CountPlanEntitlementsRequest( Optional planVersionId, Optional q, Optional withMeteredProducts, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureIds = featureIds; this.ids = ids; @@ -149,7 +149,7 @@ public Optional getWithMeteredProducts() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -157,7 +157,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -231,9 +231,9 @@ public static final class Builder { private Optional withMeteredProducts = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -405,12 +405,12 @@ public Builder withMeteredProducts(Boolean withMeteredProducts) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -444,5 +444,15 @@ public CountPlanEntitlementsRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreateCompanyOverrideRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreateCompanyOverrideRequestBody.java index e082dd1..f8c5037 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 @@ -43,7 +43,7 @@ public final class CreateCompanyOverrideRequestBody { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -61,7 +61,7 @@ private CreateCompanyOverrideRequestBody( Optional note, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Map additionalProperties) { @@ -126,7 +126,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -209,6 +209,10 @@ public interface ValueTypeStage { public interface _FinalStage { CreateCompanyOverrideRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditConsumptionRate(Optional creditConsumptionRate); _FinalStage creditConsumptionRate(Double creditConsumptionRate); @@ -239,9 +243,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -258,7 +262,7 @@ public static final class Builder implements CompanyIdStage, FeatureIdStage, Val private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -332,14 +336,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -454,5 +458,17 @@ public CreateCompanyOverrideRequestBody build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/CreatePlanEntitlementRequestBody.java index e9629c1..382ddaf 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 @@ -30,7 +30,7 @@ public final class CreatePlanEntitlementRequestBody { private final Optional billingProductId; - private final Optional billingThreshold; + private final Optional billingThreshold; private final Optional creditConsumptionRate; @@ -46,7 +46,7 @@ public final class CreatePlanEntitlementRequestBody { private final Optional> monthlyPriceTiers; - private final Optional monthlyUnitPrice; + private final Optional monthlyUnitPrice; private final Optional monthlyUnitPriceDecimal; @@ -54,11 +54,13 @@ public final class CreatePlanEntitlementRequestBody { private final String planId; + private final Optional planVersionId; + private final Optional priceBehavior; private final Optional> priceTiers; - private final Optional softLimit; + private final Optional softLimit; private final Optional tierMode; @@ -66,7 +68,7 @@ public final class CreatePlanEntitlementRequestBody { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -76,7 +78,7 @@ public final class CreatePlanEntitlementRequestBody { private final Optional> yearlyPriceTiers; - private final Optional yearlyUnitPrice; + private final Optional yearlyUnitPrice; private final Optional yearlyUnitPriceDecimal; @@ -84,7 +86,7 @@ public final class CreatePlanEntitlementRequestBody { private CreatePlanEntitlementRequestBody( Optional billingProductId, - Optional billingThreshold, + Optional billingThreshold, Optional creditConsumptionRate, Optional currency, String featureId, @@ -92,22 +94,23 @@ private CreatePlanEntitlementRequestBody( Optional metricPeriodMonthReset, Optional monthlyMeteredPriceId, Optional> monthlyPriceTiers, - Optional monthlyUnitPrice, + Optional monthlyUnitPrice, Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, String planId, + Optional planVersionId, Optional priceBehavior, Optional> priceTiers, - Optional softLimit, + Optional softLimit, Optional tierMode, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, - Optional yearlyUnitPrice, + Optional yearlyUnitPrice, Optional yearlyUnitPriceDecimal, Map additionalProperties) { this.billingProductId = billingProductId; @@ -123,6 +126,7 @@ private CreatePlanEntitlementRequestBody( this.monthlyUnitPriceDecimal = monthlyUnitPriceDecimal; this.overageBillingProductId = overageBillingProductId; this.planId = planId; + this.planVersionId = planVersionId; this.priceBehavior = priceBehavior; this.priceTiers = priceTiers; this.softLimit = softLimit; @@ -145,7 +149,7 @@ public Optional getBillingProductId() { } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -185,7 +189,7 @@ public Optional> getMonthlyPriceTiers() { } @JsonProperty("monthly_unit_price") - public Optional getMonthlyUnitPrice() { + public Optional getMonthlyUnitPrice() { return monthlyUnitPrice; } @@ -204,6 +208,11 @@ public String getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("price_behavior") public Optional getPriceBehavior() { return priceBehavior; @@ -218,7 +227,7 @@ public Optional> getPriceTiers() { } @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -238,7 +247,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -263,7 +272,7 @@ public Optional> getYearlyPriceTiers() { } @JsonProperty("yearly_unit_price") - public Optional getYearlyUnitPrice() { + public Optional getYearlyUnitPrice() { return yearlyUnitPrice; } @@ -297,6 +306,7 @@ private boolean equalTo(CreatePlanEntitlementRequestBody other) { && monthlyUnitPriceDecimal.equals(other.monthlyUnitPriceDecimal) && overageBillingProductId.equals(other.overageBillingProductId) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && priceBehavior.equals(other.priceBehavior) && priceTiers.equals(other.priceTiers) && softLimit.equals(other.softLimit) @@ -328,6 +338,7 @@ public int hashCode() { this.monthlyUnitPriceDecimal, this.overageBillingProductId, this.planId, + this.planVersionId, this.priceBehavior, this.priceTiers, this.softLimit, @@ -369,13 +380,17 @@ public interface ValueTypeStage { public interface _FinalStage { CreatePlanEntitlementRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingProductId(Optional billingProductId); _FinalStage billingProductId(String billingProductId); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage billingThreshold(Optional billingThreshold); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage billingThreshold(Long billingThreshold); _FinalStage creditConsumptionRate(Optional creditConsumptionRate); @@ -403,9 +418,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage monthlyPriceTiers(List monthlyPriceTiers); - _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); + _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); - _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice); + _FinalStage monthlyUnitPrice(Long monthlyUnitPrice); _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal); @@ -415,6 +430,10 @@ _FinalStage metricPeriodMonthReset( _FinalStage overageBillingProductId(String overageBillingProductId); + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + _FinalStage priceBehavior(Optional priceBehavior); _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); @@ -426,9 +445,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage priceTiers(List priceTiers); - _FinalStage softLimit(Optional softLimit); + _FinalStage softLimit(Optional softLimit); - _FinalStage softLimit(Integer softLimit); + _FinalStage softLimit(Long softLimit); _FinalStage tierMode(Optional tierMode); @@ -442,9 +461,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -458,9 +477,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage yearlyPriceTiers(List yearlyPriceTiers); - _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); + _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); - _FinalStage yearlyUnitPrice(Integer yearlyUnitPrice); + _FinalStage yearlyUnitPrice(Long yearlyUnitPrice); _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal); @@ -477,7 +496,7 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional yearlyUnitPriceDecimal = Optional.empty(); - private Optional yearlyUnitPrice = Optional.empty(); + private Optional yearlyUnitPrice = Optional.empty(); private Optional> yearlyPriceTiers = Optional.empty(); @@ -485,7 +504,7 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -493,17 +512,19 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional tierMode = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional> priceTiers = Optional.empty(); private Optional priceBehavior = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional overageBillingProductId = Optional.empty(); private Optional monthlyUnitPriceDecimal = Optional.empty(); - private Optional monthlyUnitPrice = Optional.empty(); + private Optional monthlyUnitPrice = Optional.empty(); private Optional> monthlyPriceTiers = Optional.empty(); @@ -518,7 +539,7 @@ public static final class Builder implements FeatureIdStage, PlanIdStage, ValueT private Optional creditConsumptionRate = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); private Optional billingProductId = Optional.empty(); @@ -542,6 +563,7 @@ public Builder from(CreatePlanEntitlementRequestBody other) { monthlyUnitPriceDecimal(other.getMonthlyUnitPriceDecimal()); overageBillingProductId(other.getOverageBillingProductId()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); priceBehavior(other.getPriceBehavior()); priceTiers(other.getPriceTiers()); softLimit(other.getSoftLimit()); @@ -593,14 +615,14 @@ public _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecima } @java.lang.Override - public _FinalStage yearlyUnitPrice(Integer yearlyUnitPrice) { + public _FinalStage yearlyUnitPrice(Long yearlyUnitPrice) { this.yearlyUnitPrice = Optional.ofNullable(yearlyUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "yearly_unit_price", nulls = Nulls.SKIP) - public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { + public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { this.yearlyUnitPrice = yearlyUnitPrice; return this; } @@ -645,14 +667,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -697,14 +719,14 @@ public _FinalStage tierMode(Optional tierMode) { } @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -742,6 +764,19 @@ public _FinalStage priceBehavior(Optional priceBehavio return this; } + @java.lang.Override + public _FinalStage planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public _FinalStage planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + @java.lang.Override public _FinalStage overageBillingProductId(String overageBillingProductId) { this.overageBillingProductId = Optional.ofNullable(overageBillingProductId); @@ -769,14 +804,14 @@ public _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDeci } @java.lang.Override - public _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice) { + public _FinalStage monthlyUnitPrice(Long monthlyUnitPrice) { this.monthlyUnitPrice = Optional.ofNullable(monthlyUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "monthly_unit_price", nulls = Nulls.SKIP) - public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { + public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { this.monthlyUnitPrice = monthlyUnitPrice; return this; } @@ -862,14 +897,14 @@ public _FinalStage creditConsumptionRate(Optional creditConsumptionRate) } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -903,6 +938,7 @@ public CreatePlanEntitlementRequestBody build() { monthlyUnitPriceDecimal, overageBillingProductId, planId, + planVersionId, priceBehavior, priceTiers, softLimit, @@ -918,5 +954,17 @@ public CreatePlanEntitlementRequestBody build() { yearlyUnitPriceDecimal, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java index 8e5806d..d40c531 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/DuplicatePlanEntitlementsRequestBody.java @@ -84,6 +84,10 @@ public interface TargetPlanIdStage { public interface _FinalStage { DuplicatePlanEntitlementsRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -122,5 +126,17 @@ public _FinalStage targetPlanId(@NotNull String targetPlanId) { public DuplicatePlanEntitlementsRequestBody build() { return new DuplicatePlanEntitlementsRequestBody(sourcePlanId, targetPlanId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageByCompanyRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageByCompanyRequest.java index 42fb859..432feb7 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageByCompanyRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageByCompanyRequest.java @@ -107,5 +107,15 @@ public Builder keys(String key, String value) { public GetFeatureUsageByCompanyRequest build() { return new GetFeatureUsageByCompanyRequest(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java index 1ddd7f0..3068ddb 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/GetFeatureUsageTimeSeriesRequest.java @@ -129,6 +129,10 @@ public interface StartTimeStage { public interface _FinalStage { GetFeatureUsageTimeSeriesRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage granularity(Optional granularity); _FinalStage granularity(TimeSeriesGranularity granularity); @@ -208,5 +212,17 @@ public GetFeatureUsageTimeSeriesRequest build() { return new GetFeatureUsageTimeSeriesRequest( companyId, endTime, featureId, granularity, startTime, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListCompanyOverridesRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListCompanyOverridesRequest.java index c56f4bf..66cfdb2 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/ListCompanyOverridesRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/ListCompanyOverridesRequest.java @@ -36,9 +36,9 @@ public final class ListCompanyOverridesRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -50,8 +50,8 @@ private ListCompanyOverridesRequest( Optional featureId, Optional withoutExpired, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.companyIds = companyIds; this.featureIds = featureIds; @@ -125,7 +125,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -133,7 +133,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -199,9 +199,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -338,12 +338,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -375,5 +375,15 @@ public ListCompanyOverridesRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureCompaniesRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureCompaniesRequest.java index 3ead52b..9353c5c 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureCompaniesRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureCompaniesRequest.java @@ -25,17 +25,17 @@ public final class ListFeatureCompaniesRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListFeatureCompaniesRequest( String featureId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureId = featureId; this.q = q; @@ -58,7 +58,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -111,6 +111,10 @@ public interface FeatureIdStage { public interface _FinalStage { ListFeatureCompaniesRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage q(Optional q); _FinalStage q(String q); @@ -118,25 +122,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements FeatureIdStage, _FinalStage { private String featureId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional q = Optional.empty(); @@ -166,7 +170,7 @@ public _FinalStage featureId(@NotNull String featureId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -176,7 +180,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -186,7 +190,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -196,7 +200,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -218,5 +222,17 @@ public _FinalStage q(Optional q) { public ListFeatureCompaniesRequest build() { return new ListFeatureCompaniesRequest(featureId, q, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsageRequest.java index f0ad688..14394b6 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 @@ -34,9 +34,9 @@ public final class ListFeatureUsageRequest { private final Optional withoutNegativeEntitlements; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -47,8 +47,8 @@ private ListFeatureUsageRequest( Optional includeUsageAggregation, Optional q, Optional withoutNegativeEntitlements, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureIds = featureIds; this.companyId = companyId; @@ -98,7 +98,7 @@ public Optional getWithoutNegativeEntitlements() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -106,7 +106,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -168,9 +168,9 @@ public static final class Builder { private Optional withoutNegativeEntitlements = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -267,12 +267,12 @@ public Builder withoutNegativeEntitlements(Boolean withoutNegativeEntitlements) *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -303,5 +303,15 @@ public ListFeatureUsageRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsersRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsersRequest.java index 5b2f308..4e75ad5 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsersRequest.java +++ b/src/main/java/com/schematic/api/resources/entitlements/requests/ListFeatureUsersRequest.java @@ -25,17 +25,17 @@ public final class ListFeatureUsersRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListFeatureUsersRequest( String featureId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureId = featureId; this.q = q; @@ -58,7 +58,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -66,7 +66,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -111,6 +111,10 @@ public interface FeatureIdStage { public interface _FinalStage { ListFeatureUsersRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage q(Optional q); _FinalStage q(String q); @@ -118,25 +122,25 @@ public interface _FinalStage { /** *

Page limit (default 100)

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

Page offset (default 0)

*/ - _FinalStage offset(Optional offset); + _FinalStage offset(Optional offset); - _FinalStage offset(Integer offset); + _FinalStage offset(Long offset); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements FeatureIdStage, _FinalStage { private String featureId; - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); private Optional q = Optional.empty(); @@ -166,7 +170,7 @@ public _FinalStage featureId(@NotNull String featureId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage offset(Integer offset) { + public _FinalStage offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -176,7 +180,7 @@ public _FinalStage offset(Integer offset) { */ @java.lang.Override @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public _FinalStage offset(Optional offset) { + public _FinalStage offset(Optional offset) { this.offset = offset; return this; } @@ -186,7 +190,7 @@ public _FinalStage offset(Optional offset) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage limit(Integer limit) { + public _FinalStage limit(Long limit) { this.limit = Optional.ofNullable(limit); return this; } @@ -196,7 +200,7 @@ public _FinalStage limit(Integer limit) { */ @java.lang.Override @JsonSetter(value = "limit", nulls = Nulls.SKIP) - public _FinalStage limit(Optional limit) { + public _FinalStage limit(Optional limit) { this.limit = limit; return this; } @@ -218,5 +222,17 @@ public _FinalStage q(Optional q) { public ListFeatureUsersRequest build() { return new ListFeatureUsersRequest(featureId, q, limit, offset, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/ListPlanEntitlementsRequest.java b/src/main/java/com/schematic/api/resources/entitlements/requests/ListPlanEntitlementsRequest.java index 2d7f768..55adb06 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 @@ -40,9 +40,9 @@ public final class ListPlanEntitlementsRequest { private final Optional withMeteredProducts; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -56,8 +56,8 @@ private ListPlanEntitlementsRequest( Optional planVersionId, Optional q, Optional withMeteredProducts, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.featureIds = featureIds; this.ids = ids; @@ -149,7 +149,7 @@ public Optional getWithMeteredProducts() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -157,7 +157,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -231,9 +231,9 @@ public static final class Builder { private Optional withMeteredProducts = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -405,12 +405,12 @@ public Builder withMeteredProducts(Boolean withMeteredProducts) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -444,5 +444,15 @@ public ListPlanEntitlementsRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdateCompanyOverrideRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdateCompanyOverrideRequestBody.java index a50acfa..ba385f7 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 @@ -39,7 +39,7 @@ public final class UpdateCompanyOverrideRequestBody { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -55,7 +55,7 @@ private UpdateCompanyOverrideRequestBody( Optional note, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Map additionalProperties) { @@ -108,7 +108,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -179,6 +179,10 @@ public interface ValueTypeStage { public interface _FinalStage { UpdateCompanyOverrideRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditConsumptionRate(Optional creditConsumptionRate); _FinalStage creditConsumptionRate(Double creditConsumptionRate); @@ -209,9 +213,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -224,7 +228,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -282,14 +286,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -402,5 +406,17 @@ public UpdateCompanyOverrideRequestBody build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java b/src/main/java/com/schematic/api/resources/entitlements/requests/UpdatePlanEntitlementRequestBody.java index 537da09..047e157 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 @@ -30,7 +30,7 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional billingProductId; - private final Optional billingThreshold; + private final Optional billingThreshold; private final Optional creditConsumptionRate; @@ -44,7 +44,7 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional> monthlyPriceTiers; - private final Optional monthlyUnitPrice; + private final Optional monthlyUnitPrice; private final Optional monthlyUnitPriceDecimal; @@ -54,7 +54,7 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional> priceTiers; - private final Optional softLimit; + private final Optional softLimit; private final Optional tierMode; @@ -62,7 +62,7 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -72,7 +72,7 @@ public final class UpdatePlanEntitlementRequestBody { private final Optional> yearlyPriceTiers; - private final Optional yearlyUnitPrice; + private final Optional yearlyUnitPrice; private final Optional yearlyUnitPriceDecimal; @@ -80,28 +80,28 @@ public final class UpdatePlanEntitlementRequestBody { private UpdatePlanEntitlementRequestBody( Optional billingProductId, - Optional billingThreshold, + Optional billingThreshold, Optional creditConsumptionRate, Optional currency, Optional metricPeriod, Optional metricPeriodMonthReset, Optional monthlyMeteredPriceId, Optional> monthlyPriceTiers, - Optional monthlyUnitPrice, + Optional monthlyUnitPrice, Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, Optional priceBehavior, Optional> priceTiers, - Optional softLimit, + Optional softLimit, Optional tierMode, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, - Optional yearlyUnitPrice, + Optional yearlyUnitPrice, Optional yearlyUnitPriceDecimal, Map additionalProperties) { this.billingProductId = billingProductId; @@ -137,7 +137,7 @@ public Optional getBillingProductId() { } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -172,7 +172,7 @@ public Optional> getMonthlyPriceTiers() { } @JsonProperty("monthly_unit_price") - public Optional getMonthlyUnitPrice() { + public Optional getMonthlyUnitPrice() { return monthlyUnitPrice; } @@ -200,7 +200,7 @@ public Optional> getPriceTiers() { } @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -220,7 +220,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -245,7 +245,7 @@ public Optional> getYearlyPriceTiers() { } @JsonProperty("yearly_unit_price") - public Optional getYearlyUnitPrice() { + public Optional getYearlyUnitPrice() { return yearlyUnitPrice; } @@ -339,13 +339,17 @@ public interface ValueTypeStage { public interface _FinalStage { UpdatePlanEntitlementRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingProductId(Optional billingProductId); _FinalStage billingProductId(String billingProductId); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage billingThreshold(Optional billingThreshold); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage billingThreshold(Long billingThreshold); _FinalStage creditConsumptionRate(Optional creditConsumptionRate); @@ -373,9 +377,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage monthlyPriceTiers(List monthlyPriceTiers); - _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); + _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); - _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice); + _FinalStage monthlyUnitPrice(Long monthlyUnitPrice); _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal); @@ -396,9 +400,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage priceTiers(List priceTiers); - _FinalStage softLimit(Optional softLimit); + _FinalStage softLimit(Optional softLimit); - _FinalStage softLimit(Integer softLimit); + _FinalStage softLimit(Long softLimit); _FinalStage tierMode(Optional tierMode); @@ -412,9 +416,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -428,9 +432,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage yearlyPriceTiers(List yearlyPriceTiers); - _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); + _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); - _FinalStage yearlyUnitPrice(Integer yearlyUnitPrice); + _FinalStage yearlyUnitPrice(Long yearlyUnitPrice); _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal); @@ -443,7 +447,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional yearlyUnitPriceDecimal = Optional.empty(); - private Optional yearlyUnitPrice = Optional.empty(); + private Optional yearlyUnitPrice = Optional.empty(); private Optional> yearlyPriceTiers = Optional.empty(); @@ -451,7 +455,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -459,7 +463,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional tierMode = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional> priceTiers = Optional.empty(); @@ -469,7 +473,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional monthlyUnitPriceDecimal = Optional.empty(); - private Optional monthlyUnitPrice = Optional.empty(); + private Optional monthlyUnitPrice = Optional.empty(); private Optional> monthlyPriceTiers = Optional.empty(); @@ -484,7 +488,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional creditConsumptionRate = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); private Optional billingProductId = Optional.empty(); @@ -543,14 +547,14 @@ public _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecima } @java.lang.Override - public _FinalStage yearlyUnitPrice(Integer yearlyUnitPrice) { + public _FinalStage yearlyUnitPrice(Long yearlyUnitPrice) { this.yearlyUnitPrice = Optional.ofNullable(yearlyUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "yearly_unit_price", nulls = Nulls.SKIP) - public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { + public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { this.yearlyUnitPrice = yearlyUnitPrice; return this; } @@ -595,14 +599,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -647,14 +651,14 @@ public _FinalStage tierMode(Optional tierMode) { } @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -719,14 +723,14 @@ public _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDeci } @java.lang.Override - public _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice) { + public _FinalStage monthlyUnitPrice(Long monthlyUnitPrice) { this.monthlyUnitPrice = Optional.ofNullable(monthlyUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "monthly_unit_price", nulls = Nulls.SKIP) - public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { + public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { this.monthlyUnitPrice = monthlyUnitPrice; return this; } @@ -812,14 +816,14 @@ public _FinalStage creditConsumptionRate(Optional creditConsumptionRate) } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -866,5 +870,17 @@ public UpdatePlanEntitlementRequestBody build() { yearlyUnitPriceDecimal, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesParams.java index 9be6d52..bf8d3ae 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesParams.java @@ -31,9 +31,9 @@ public final class CountCompanyOverridesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -47,8 +47,8 @@ private CountCompanyOverridesParams( Optional featureId, Optional> featureIds, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional withoutExpired, Map additionalProperties) { @@ -108,7 +108,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -116,7 +116,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -194,9 +194,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -294,12 +294,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -359,5 +359,15 @@ public CountCompanyOverridesParams build() { withoutExpired, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesResponse.java index e25efb2..3f2c1c3 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountCompanyOverridesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountCompanyOverridesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountCompanyOverridesParams params) { public CountCompanyOverridesResponse build() { return new CountCompanyOverridesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesParams.java index 67222b4..2303031 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesParams.java @@ -22,9 +22,9 @@ public final class CountFeatureCompaniesParams { private final Optional featureId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -32,8 +32,8 @@ public final class CountFeatureCompaniesParams { private CountFeatureCompaniesParams( Optional featureId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.featureId = featureId; @@ -52,7 +52,7 @@ public Optional getFeatureId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional featureId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -139,12 +139,12 @@ public Builder featureId(String featureId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder q(String q) { public CountFeatureCompaniesParams build() { return new CountFeatureCompaniesParams(featureId, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesResponse.java index b821b1a..7c78814 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureCompaniesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountFeatureCompaniesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountFeatureCompaniesParams params) { public CountFeatureCompaniesResponse build() { return new CountFeatureCompaniesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageParams.java index aeee0db..29e3f30 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 @@ -29,9 +29,9 @@ public final class CountFeatureUsageParams { private final Optional includeUsageAggregation; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -44,8 +44,8 @@ private CountFeatureUsageParams( Optional> companyKeys, Optional> featureIds, Optional includeUsageAggregation, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional withoutNegativeEntitlements, Map additionalProperties) { @@ -87,7 +87,7 @@ public Optional getIncludeUsageAggregation() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -95,7 +95,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -163,9 +163,9 @@ public static final class Builder { private Optional includeUsageAggregation = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -239,12 +239,12 @@ public Builder includeUsageAggregation(Boolean includeUsageAggregation) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -297,5 +297,15 @@ public CountFeatureUsageParams build() { withoutNegativeEntitlements, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageResponse.java index 1879e8a..bd4268b 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsageResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountFeatureUsageResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountFeatureUsageParams params) { public CountFeatureUsageResponse build() { return new CountFeatureUsageResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersParams.java index 90b303f..f805305 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersParams.java @@ -22,9 +22,9 @@ public final class CountFeatureUsersParams { private final Optional featureId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -32,8 +32,8 @@ public final class CountFeatureUsersParams { private CountFeatureUsersParams( Optional featureId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.featureId = featureId; @@ -52,7 +52,7 @@ public Optional getFeatureId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional featureId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -139,12 +139,12 @@ public Builder featureId(String featureId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder q(String q) { public CountFeatureUsersParams build() { return new CountFeatureUsersParams(featureId, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersResponse.java index d135c87..c4cf145 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountFeatureUsersResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountFeatureUsersResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountFeatureUsersParams params) { public CountFeatureUsersResponse build() { return new CountFeatureUsersResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsParams.java index cca227b..14dea1c 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 @@ -27,9 +27,9 @@ public final class CountPlanEntitlementsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; @@ -49,8 +49,8 @@ private CountPlanEntitlementsParams( Optional featureId, Optional> featureIds, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional> planIds, Optional planVersionId, @@ -100,7 +100,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -108,7 +108,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -218,9 +218,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); @@ -300,12 +300,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -423,5 +423,15 @@ public CountPlanEntitlementsParams build() { withMeteredProducts, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsResponse.java index 05ce432..eb02078 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CountPlanEntitlementsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountPlanEntitlementsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountPlanEntitlementsParams params) { public CountPlanEntitlementsResponse build() { return new CountPlanEntitlementsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideResponse.java index 666fa98..06bb20e 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CreateCompanyOverrideResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateCompanyOverrideResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateCompanyOverrideResponse build() { return new CreateCompanyOverrideResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementResponse.java index e1da40e..f43d85a 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/CreatePlanEntitlementResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreatePlanEntitlementResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreatePlanEntitlementResponse build() { return new CreatePlanEntitlementResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/DeleteCompanyOverrideResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/DeleteCompanyOverrideResponse.java index 55bbc0d..1983824 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/DeleteCompanyOverrideResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/DeleteCompanyOverrideResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteCompanyOverrideResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteCompanyOverrideResponse build() { return new DeleteCompanyOverrideResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/DeletePlanEntitlementResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/DeletePlanEntitlementResponse.java index 7a645e2..0912cc7 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/DeletePlanEntitlementResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/DeletePlanEntitlementResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeletePlanEntitlementResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeletePlanEntitlementResponse build() { return new DeletePlanEntitlementResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java index 407a5b6..b9782ef 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/DuplicatePlanEntitlementsResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { DuplicatePlanEntitlementsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public DuplicatePlanEntitlementsResponse build() { return new DuplicatePlanEntitlementsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetCompanyOverrideResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetCompanyOverrideResponse.java index ea03a2a..d18b46e 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/GetCompanyOverrideResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetCompanyOverrideResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetCompanyOverrideResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetCompanyOverrideResponse build() { return new GetCompanyOverrideResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyParams.java index 3df0210..daa5c5f 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyParams.java @@ -92,5 +92,15 @@ public Builder keys(Map keys) { public GetFeatureUsageByCompanyParams build() { return new GetFeatureUsageByCompanyParams(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyResponse.java index 2920eb3..12ebcb0 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageByCompanyResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { GetFeatureUsageByCompanyResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -135,5 +139,17 @@ public _FinalStage params(@NotNull GetFeatureUsageByCompanyParams params) { public GetFeatureUsageByCompanyResponse build() { return new GetFeatureUsageByCompanyResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java index e134a28..d231fba 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesParams.java @@ -192,5 +192,15 @@ public GetFeatureUsageTimeSeriesParams build() { return new GetFeatureUsageTimeSeriesParams( companyId, endTime, featureId, granularity, startTime, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java index e2be4b7..e622d13 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetFeatureUsageTimeSeriesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { GetFeatureUsageTimeSeriesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -135,5 +139,17 @@ public _FinalStage params(@NotNull GetFeatureUsageTimeSeriesParams params) { public GetFeatureUsageTimeSeriesResponse build() { return new GetFeatureUsageTimeSeriesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/GetPlanEntitlementResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/GetPlanEntitlementResponse.java index b10675d..707bf63 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/GetPlanEntitlementResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/GetPlanEntitlementResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetPlanEntitlementResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetPlanEntitlementResponse build() { return new GetPlanEntitlementResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesParams.java index 03465b1..4554e97 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesParams.java @@ -31,9 +31,9 @@ public final class ListCompanyOverridesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -47,8 +47,8 @@ private ListCompanyOverridesParams( Optional featureId, Optional> featureIds, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional withoutExpired, Map additionalProperties) { @@ -108,7 +108,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -116,7 +116,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -194,9 +194,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -294,12 +294,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -359,5 +359,15 @@ public ListCompanyOverridesParams build() { withoutExpired, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesResponse.java index c41fd0f..8735bc5 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListCompanyOverridesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListCompanyOverridesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(CompanyOverrideResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListCompanyOverridesResponse build() { return new ListCompanyOverridesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesParams.java index ace3cfb..9e77f6b 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesParams.java @@ -22,9 +22,9 @@ public final class ListFeatureCompaniesParams { private final Optional featureId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -32,8 +32,8 @@ public final class ListFeatureCompaniesParams { private ListFeatureCompaniesParams( Optional featureId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.featureId = featureId; @@ -52,7 +52,7 @@ public Optional getFeatureId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional featureId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -139,12 +139,12 @@ public Builder featureId(String featureId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder q(String q) { public ListFeatureCompaniesParams build() { return new ListFeatureCompaniesParams(featureId, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesResponse.java index c9c14a9..5b31d86 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureCompaniesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListFeatureCompaniesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(FeatureCompanyResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListFeatureCompaniesResponse build() { return new ListFeatureCompaniesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageParams.java index 2823bb3..d39d1ec 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 @@ -29,9 +29,9 @@ public final class ListFeatureUsageParams { private final Optional includeUsageAggregation; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -44,8 +44,8 @@ private ListFeatureUsageParams( Optional> companyKeys, Optional> featureIds, Optional includeUsageAggregation, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional withoutNegativeEntitlements, Map additionalProperties) { @@ -87,7 +87,7 @@ public Optional getIncludeUsageAggregation() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -95,7 +95,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -163,9 +163,9 @@ public static final class Builder { private Optional includeUsageAggregation = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -239,12 +239,12 @@ public Builder includeUsageAggregation(Boolean includeUsageAggregation) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -297,5 +297,15 @@ public ListFeatureUsageParams build() { withoutNegativeEntitlements, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageResponse.java index e08c608..c327a47 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsageResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListFeatureUsageResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(FeatureUsageResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListFeatureUsageResponse build() { return new ListFeatureUsageResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersParams.java index 6a981bd..1e7fc41 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersParams.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersParams.java @@ -22,9 +22,9 @@ public final class ListFeatureUsersParams { private final Optional featureId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -32,8 +32,8 @@ public final class ListFeatureUsersParams { private ListFeatureUsersParams( Optional featureId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.featureId = featureId; @@ -52,7 +52,7 @@ public Optional getFeatureId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -60,7 +60,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -105,9 +105,9 @@ public static Builder builder() { public static final class Builder { private Optional featureId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -139,12 +139,12 @@ public Builder featureId(String featureId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -177,5 +177,15 @@ public Builder q(String q) { public ListFeatureUsersParams build() { return new ListFeatureUsersParams(featureId, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersResponse.java index aa9306f..a86d3c6 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListFeatureUsersResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListFeatureUsersResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(FeatureCompanyUserResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListFeatureUsersResponse build() { return new ListFeatureUsersResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsParams.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsParams.java index f3163e5..8997d58 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 @@ -27,9 +27,9 @@ public final class ListPlanEntitlementsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional planId; @@ -49,8 +49,8 @@ private ListPlanEntitlementsParams( Optional featureId, Optional> featureIds, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional planId, Optional> planIds, Optional planVersionId, @@ -100,7 +100,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -108,7 +108,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -218,9 +218,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planId = Optional.empty(); @@ -300,12 +300,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -423,5 +423,15 @@ public ListPlanEntitlementsParams build() { withMeteredProducts, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsResponse.java index 3a5853b..31aef50 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/ListPlanEntitlementsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListPlanEntitlementsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(PlanEntitlementResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListPlanEntitlementsResponse build() { return new ListPlanEntitlementsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideResponse.java index 76901a4..d6159ed 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/UpdateCompanyOverrideResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateCompanyOverrideResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateCompanyOverrideResponse build() { return new UpdateCompanyOverrideResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementResponse.java b/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementResponse.java index 99a80ee..2706ebb 100644 --- a/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementResponse.java +++ b/src/main/java/com/schematic/api/resources/entitlements/types/UpdatePlanEntitlementResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdatePlanEntitlementResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdatePlanEntitlementResponse build() { return new UpdatePlanEntitlementResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/AsyncEventsClient.java b/src/main/java/com/schematic/api/resources/events/AsyncEventsClient.java index 2ead712..3471cdc 100644 --- a/src/main/java/com/schematic/api/resources/events/AsyncEventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/AsyncEventsClient.java @@ -47,6 +47,10 @@ public CompletableFuture getEventSummaries() { return this.rawClient.getEventSummaries().thenApply(response -> response.body()); } + public CompletableFuture getEventSummaries(RequestOptions requestOptions) { + return this.rawClient.getEventSummaries(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture getEventSummaries(GetEventSummariesRequest request) { return this.rawClient.getEventSummaries(request).thenApply(response -> response.body()); } @@ -60,6 +64,10 @@ public CompletableFuture listEvents() { return this.rawClient.listEvents().thenApply(response -> response.body()); } + public CompletableFuture listEvents(RequestOptions requestOptions) { + return this.rawClient.listEvents(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listEvents(ListEventsRequest request) { return this.rawClient.listEvents(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java b/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java index 1e22ad9..f0a5485 100644 --- a/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/AsyncRawEventsClient.java @@ -55,10 +55,14 @@ public CompletableFuture> cr public CompletableFuture> createEventBatch( CreateEventBatchRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("event-batch") - .build(); + .addPathSegments("event-batch"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -67,7 +71,7 @@ public CompletableFuture> cr throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -82,14 +86,13 @@ public CompletableFuture> cr @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreateEventBatchResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEventBatchResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -121,11 +124,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -144,6 +145,11 @@ public CompletableFuture> g return getEventSummaries(GetEventSummariesRequest.builder().build()); } + public CompletableFuture> getEventSummaries( + RequestOptions requestOptions) { + return getEventSummaries(GetEventSummariesRequest.builder().build(), requestOptions); + } + public CompletableFuture> getEventSummaries( GetEventSummariesRequest request) { return getEventSummaries(request, null); @@ -169,6 +175,11 @@ public CompletableFuture> g QueryStringMapper.addQueryParameter( httpUrl, "event_subtypes", request.getEventSubtypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -184,14 +195,14 @@ public CompletableFuture> g @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetEventSummariesResponse.class), + responseBodyString, GetEventSummariesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -223,11 +234,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -246,6 +255,10 @@ public CompletableFuture> listEven return listEvents(ListEventsRequest.builder().build()); } + public CompletableFuture> listEvents(RequestOptions requestOptions) { + return listEvents(ListEventsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listEvents(ListEventsRequest request) { return listEvents(request, null); } @@ -283,6 +296,11 @@ public CompletableFuture> listEven QueryStringMapper.addQueryParameter( httpUrl, "event_types", request.getEventTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -298,13 +316,13 @@ public CompletableFuture> listEven @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListEventsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEventsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -336,11 +354,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -362,10 +378,14 @@ public CompletableFuture> createE public CompletableFuture> createEvent( CreateEventRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("events") - .build(); + .addPathSegments("events"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -374,7 +394,7 @@ public CompletableFuture> createE throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -389,13 +409,13 @@ public CompletableFuture> createE @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateEventResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEventResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -427,11 +447,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -452,13 +470,17 @@ public CompletableFuture> getEvent(S public CompletableFuture> getEvent( String eventId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("events") - .addPathSegment(eventId) - .build(); + .addPathSegment(eventId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -472,13 +494,13 @@ public CompletableFuture> getEvent( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetEventResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEventResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -505,11 +527,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -531,12 +551,16 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { public CompletableFuture> getSegmentIntegrationStatus(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("segment-integration") - .build(); + .addPathSegments("segment-integration"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -551,14 +575,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetSegmentIntegrationStatusResponse.class), + responseBodyString, GetSegmentIntegrationStatusResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -585,11 +609,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/events/EventsClient.java b/src/main/java/com/schematic/api/resources/events/EventsClient.java index 164fa71..200366e 100644 --- a/src/main/java/com/schematic/api/resources/events/EventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/EventsClient.java @@ -46,6 +46,10 @@ public GetEventSummariesResponse getEventSummaries() { return this.rawClient.getEventSummaries().body(); } + public GetEventSummariesResponse getEventSummaries(RequestOptions requestOptions) { + return this.rawClient.getEventSummaries(requestOptions).body(); + } + public GetEventSummariesResponse getEventSummaries(GetEventSummariesRequest request) { return this.rawClient.getEventSummaries(request).body(); } @@ -59,6 +63,10 @@ public ListEventsResponse listEvents() { return this.rawClient.listEvents().body(); } + public ListEventsResponse listEvents(RequestOptions requestOptions) { + return this.rawClient.listEvents(requestOptions).body(); + } + public ListEventsResponse listEvents(ListEventsRequest request) { return this.rawClient.listEvents(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/events/RawEventsClient.java b/src/main/java/com/schematic/api/resources/events/RawEventsClient.java index 7f6534c..c0c69c4 100644 --- a/src/main/java/com/schematic/api/resources/events/RawEventsClient.java +++ b/src/main/java/com/schematic/api/resources/events/RawEventsClient.java @@ -50,10 +50,14 @@ public BaseSchematicHttpResponse createEventBatch(Crea public BaseSchematicHttpResponse createEventBatch( CreateEventBatchRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("event-batch") - .build(); + .addPathSegments("event-batch"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -62,7 +66,7 @@ public BaseSchematicHttpResponse createEventBatch( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -74,12 +78,12 @@ public BaseSchematicHttpResponse createEventBatch( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateEventBatchResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEventBatchResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -101,11 +105,9 @@ public BaseSchematicHttpResponse createEventBatch( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -115,6 +117,10 @@ public BaseSchematicHttpResponse getEventSummaries() return getEventSummaries(GetEventSummariesRequest.builder().build()); } + public BaseSchematicHttpResponse getEventSummaries(RequestOptions requestOptions) { + return getEventSummaries(GetEventSummariesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse getEventSummaries(GetEventSummariesRequest request) { return getEventSummaries(request, null); } @@ -139,6 +145,11 @@ public BaseSchematicHttpResponse getEventSummaries( QueryStringMapper.addQueryParameter( httpUrl, "event_subtypes", request.getEventSubtypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -151,12 +162,12 @@ public BaseSchematicHttpResponse getEventSummaries( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetEventSummariesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEventSummariesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -178,11 +189,9 @@ public BaseSchematicHttpResponse getEventSummaries( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -192,6 +201,10 @@ public BaseSchematicHttpResponse listEvents() { return listEvents(ListEventsRequest.builder().build()); } + public BaseSchematicHttpResponse listEvents(RequestOptions requestOptions) { + return listEvents(ListEventsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listEvents(ListEventsRequest request) { return listEvents(request, null); } @@ -229,6 +242,11 @@ public BaseSchematicHttpResponse listEvents( QueryStringMapper.addQueryParameter( httpUrl, "event_types", request.getEventTypes().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -241,11 +259,11 @@ public BaseSchematicHttpResponse listEvents( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListEventsResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEventsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -267,11 +285,9 @@ public BaseSchematicHttpResponse listEvents( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -283,10 +299,14 @@ public BaseSchematicHttpResponse createEvent(CreateEventReq public BaseSchematicHttpResponse createEvent( CreateEventRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("events") - .build(); + .addPathSegments("events"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -295,7 +315,7 @@ public BaseSchematicHttpResponse createEvent( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -307,12 +327,11 @@ public BaseSchematicHttpResponse createEvent( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateEventResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateEventResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -334,11 +353,9 @@ public BaseSchematicHttpResponse createEvent( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -349,13 +366,17 @@ public BaseSchematicHttpResponse getEvent(String eventId) { } public BaseSchematicHttpResponse getEvent(String eventId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("events") - .addPathSegment(eventId) - .build(); + .addPathSegment(eventId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -366,11 +387,11 @@ public BaseSchematicHttpResponse getEvent(String eventId, Requ } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetEventResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetEventResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -389,11 +410,9 @@ public BaseSchematicHttpResponse getEvent(String eventId, Requ } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -405,12 +424,16 @@ public BaseSchematicHttpResponse getSegment public BaseSchematicHttpResponse getSegmentIntegrationStatus( RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("segment-integration") - .build(); + .addPathSegments("segment-integration"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -421,13 +444,13 @@ public BaseSchematicHttpResponse getSegment } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetSegmentIntegrationStatusResponse.class), + responseBodyString, GetSegmentIntegrationStatusResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -446,11 +469,9 @@ public BaseSchematicHttpResponse getSegment } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/events/requests/CreateEventBatchRequestBody.java b/src/main/java/com/schematic/api/resources/events/requests/CreateEventBatchRequestBody.java index bf2de32..00f0117 100644 --- a/src/main/java/com/schematic/api/resources/events/requests/CreateEventBatchRequestBody.java +++ b/src/main/java/com/schematic/api/resources/events/requests/CreateEventBatchRequestBody.java @@ -103,5 +103,15 @@ public Builder addAllEvents(List events) { public CreateEventBatchRequestBody build() { return new CreateEventBatchRequestBody(events, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/requests/GetEventSummariesRequest.java b/src/main/java/com/schematic/api/resources/events/requests/GetEventSummariesRequest.java index 56b2ed5..a70a044 100644 --- a/src/main/java/com/schematic/api/resources/events/requests/GetEventSummariesRequest.java +++ b/src/main/java/com/schematic/api/resources/events/requests/GetEventSummariesRequest.java @@ -26,17 +26,17 @@ public final class GetEventSummariesRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private GetEventSummariesRequest( Optional> eventSubtypes, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.eventSubtypes = eventSubtypes; this.q = q; @@ -59,7 +59,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -67,7 +67,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -109,9 +109,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -157,12 +157,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -184,5 +184,15 @@ public Builder offset(Integer offset) { public GetEventSummariesRequest build() { return new GetEventSummariesRequest(eventSubtypes, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/requests/ListEventsRequest.java b/src/main/java/com/schematic/api/resources/events/requests/ListEventsRequest.java index 0ee93e5..3c6d55c 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 @@ -33,9 +33,9 @@ public final class ListEventsRequest { private final Optional userId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -45,8 +45,8 @@ private ListEventsRequest( Optional eventSubtype, Optional flagId, Optional userId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.eventTypes = eventTypes; this.companyId = companyId; @@ -87,7 +87,7 @@ public Optional getUserId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -95,7 +95,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -147,9 +147,9 @@ public static final class Builder { private Optional userId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -231,12 +231,12 @@ public Builder userId(String userId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -259,5 +259,15 @@ public ListEventsRequest build() { return new ListEventsRequest( eventTypes, companyId, eventSubtype, flagId, userId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/CreateEventBatchResponse.java b/src/main/java/com/schematic/api/resources/events/types/CreateEventBatchResponse.java index 0c666cf..de4894a 100644 --- a/src/main/java/com/schematic/api/resources/events/types/CreateEventBatchResponse.java +++ b/src/main/java/com/schematic/api/resources/events/types/CreateEventBatchResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateEventBatchResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateEventBatchResponse build() { return new CreateEventBatchResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/CreateEventResponse.java b/src/main/java/com/schematic/api/resources/events/types/CreateEventResponse.java index 3ce6a4d..c84f4e9 100644 --- a/src/main/java/com/schematic/api/resources/events/types/CreateEventResponse.java +++ b/src/main/java/com/schematic/api/resources/events/types/CreateEventResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateEventResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateEventResponse build() { return new CreateEventResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/GetEventResponse.java b/src/main/java/com/schematic/api/resources/events/types/GetEventResponse.java index 94cc93b..999ef69 100644 --- a/src/main/java/com/schematic/api/resources/events/types/GetEventResponse.java +++ b/src/main/java/com/schematic/api/resources/events/types/GetEventResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetEventResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetEventResponse build() { return new GetEventResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesParams.java b/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesParams.java index 8d0b076..8918156 100644 --- a/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesParams.java +++ b/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesParams.java @@ -23,9 +23,9 @@ public final class GetEventSummariesParams { private final Optional> eventSubtypes; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -33,8 +33,8 @@ public final class GetEventSummariesParams { private GetEventSummariesParams( Optional> eventSubtypes, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.eventSubtypes = eventSubtypes; @@ -53,7 +53,7 @@ public Optional> getEventSubtypes() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -61,7 +61,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -106,9 +106,9 @@ public static Builder builder() { public static final class Builder { private Optional> eventSubtypes = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -140,12 +140,12 @@ public Builder eventSubtypes(List eventSubtypes) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -178,5 +178,15 @@ public Builder q(String q) { public GetEventSummariesParams build() { return new GetEventSummariesParams(eventSubtypes, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesResponse.java b/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesResponse.java index 189912a..621c0e6 100644 --- a/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesResponse.java +++ b/src/main/java/com/schematic/api/resources/events/types/GetEventSummariesResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { GetEventSummariesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(EventSummaryResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public GetEventSummariesResponse build() { return new GetEventSummariesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/GetSegmentIntegrationStatusResponse.java b/src/main/java/com/schematic/api/resources/events/types/GetSegmentIntegrationStatusResponse.java index acb9033..9c643b7 100644 --- a/src/main/java/com/schematic/api/resources/events/types/GetSegmentIntegrationStatusResponse.java +++ b/src/main/java/com/schematic/api/resources/events/types/GetSegmentIntegrationStatusResponse.java @@ -88,6 +88,10 @@ public interface DataStage { public interface _FinalStage { GetSegmentIntegrationStatusResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -162,5 +166,17 @@ public _FinalStage params(Map params) { public GetSegmentIntegrationStatusResponse build() { return new GetSegmentIntegrationStatusResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/ListEventsParams.java b/src/main/java/com/schematic/api/resources/events/types/ListEventsParams.java index eb069f3..96b44d8 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 @@ -30,9 +30,9 @@ public final class ListEventsParams { private final Optional flagId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional userId; @@ -43,8 +43,8 @@ private ListEventsParams( Optional eventSubtype, Optional> eventTypes, Optional flagId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional userId, Map additionalProperties) { this.companyId = companyId; @@ -81,7 +81,7 @@ public Optional getFlagId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -89,7 +89,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -144,9 +144,9 @@ public static final class Builder { private Optional flagId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional userId = Optional.empty(); @@ -214,12 +214,12 @@ public Builder flagId(String flagId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -253,5 +253,15 @@ public ListEventsParams build() { return new ListEventsParams( companyId, eventSubtype, eventTypes, flagId, limit, offset, userId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/events/types/ListEventsResponse.java b/src/main/java/com/schematic/api/resources/events/types/ListEventsResponse.java index b3df23f..be320fd 100644 --- a/src/main/java/com/schematic/api/resources/events/types/ListEventsResponse.java +++ b/src/main/java/com/schematic/api/resources/events/types/ListEventsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListEventsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(EventDetailResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListEventsResponse build() { return new ListEventsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java b/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java index cf63690..cda5f18 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncFeaturesClient.java @@ -54,6 +54,10 @@ public CompletableFuture listFeatures() { return this.rawClient.listFeatures().thenApply(response -> response.body()); } + public CompletableFuture listFeatures(RequestOptions requestOptions) { + return this.rawClient.listFeatures(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listFeatures(ListFeaturesRequest request) { return this.rawClient.listFeatures(request).thenApply(response -> response.body()); } @@ -84,6 +88,10 @@ public CompletableFuture updateFeature(String featureId) return this.rawClient.updateFeature(featureId).thenApply(response -> response.body()); } + public CompletableFuture updateFeature(String featureId, RequestOptions requestOptions) { + return this.rawClient.updateFeature(featureId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updateFeature(String featureId, UpdateFeatureRequestBody request) { return this.rawClient.updateFeature(featureId, request).thenApply(response -> response.body()); } @@ -105,6 +113,10 @@ public CompletableFuture countFeatures() { return this.rawClient.countFeatures().thenApply(response -> response.body()); } + public CompletableFuture countFeatures(RequestOptions requestOptions) { + return this.rawClient.countFeatures(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countFeatures(CountFeaturesRequest request) { return this.rawClient.countFeatures(request).thenApply(response -> response.body()); } @@ -118,6 +130,10 @@ public CompletableFuture listFlags() { return this.rawClient.listFlags().thenApply(response -> response.body()); } + public CompletableFuture listFlags(RequestOptions requestOptions) { + return this.rawClient.listFlags(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listFlags(ListFlagsRequest request) { return this.rawClient.listFlags(request).thenApply(response -> response.body()); } @@ -174,6 +190,10 @@ public CompletableFuture checkFlag(String key) { return this.rawClient.checkFlag(key).thenApply(response -> response.body()); } + public CompletableFuture checkFlag(String key, RequestOptions requestOptions) { + return this.rawClient.checkFlag(key, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture checkFlag(String key, CheckFlagRequestBody request) { return this.rawClient.checkFlag(key, request).thenApply(response -> response.body()); } @@ -187,6 +207,10 @@ public CompletableFuture checkFlags() { return this.rawClient.checkFlags().thenApply(response -> response.body()); } + public CompletableFuture checkFlags(RequestOptions requestOptions) { + return this.rawClient.checkFlags(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture checkFlags(CheckFlagRequestBody request) { return this.rawClient.checkFlags(request).thenApply(response -> response.body()); } @@ -209,6 +233,10 @@ public CompletableFuture countFlags() { return this.rawClient.countFlags().thenApply(response -> response.body()); } + public CompletableFuture countFlags(RequestOptions requestOptions) { + return this.rawClient.countFlags(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countFlags(CountFlagsRequest request) { return this.rawClient.countFlags(request).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 9b00287..72865f9 100644 --- a/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/AsyncRawFeaturesClient.java @@ -68,6 +68,11 @@ public CompletableFuture> listFe return listFeatures(ListFeaturesRequest.builder().build()); } + public CompletableFuture> listFeatures( + RequestOptions requestOptions) { + return listFeatures(ListFeaturesRequest.builder().build(), requestOptions); + } + public CompletableFuture> listFeatures( ListFeaturesRequest request) { return listFeatures(request, null); @@ -88,6 +93,10 @@ public CompletableFuture> listFe request.getWithoutCompanyOverrideFor().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -117,6 +126,11 @@ public CompletableFuture> listFe QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -132,13 +146,13 @@ public CompletableFuture> listFe @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFeaturesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeaturesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -170,11 +184,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -196,10 +208,14 @@ public CompletableFuture> creat public CompletableFuture> createFeature( CreateFeatureRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("features") - .build(); + .addPathSegments("features"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -208,7 +224,7 @@ public CompletableFuture> creat throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -223,13 +239,13 @@ public CompletableFuture> creat @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateFeatureResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFeatureResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -261,11 +277,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -286,13 +300,17 @@ public CompletableFuture> getFeatu public CompletableFuture> getFeature( String featureId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId) - .build(); + .addPathSegment(featureId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -306,13 +324,13 @@ public CompletableFuture> getFeatu @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetFeatureResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFeatureResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -339,11 +357,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -362,6 +378,11 @@ public CompletableFuture> updat return updateFeature(featureId, UpdateFeatureRequestBody.builder().build()); } + public CompletableFuture> updateFeature( + String featureId, RequestOptions requestOptions) { + return updateFeature(featureId, UpdateFeatureRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> updateFeature( String featureId, UpdateFeatureRequestBody request) { return updateFeature(featureId, request, null); @@ -369,11 +390,15 @@ public CompletableFuture> updat public CompletableFuture> updateFeature( String featureId, UpdateFeatureRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId) - .build(); + .addPathSegment(featureId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -382,7 +407,7 @@ public CompletableFuture> updat throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -397,13 +422,13 @@ public CompletableFuture> updat @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateFeatureResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFeatureResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -435,11 +460,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -460,13 +483,17 @@ public CompletableFuture> delet public CompletableFuture> deleteFeature( String featureId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId) - .build(); + .addPathSegment(featureId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -480,13 +507,13 @@ public CompletableFuture> delet @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteFeatureResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteFeatureResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -518,11 +545,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -541,6 +566,11 @@ public CompletableFuture> count return countFeatures(CountFeaturesRequest.builder().build()); } + public CompletableFuture> countFeatures( + RequestOptions requestOptions) { + return countFeatures(CountFeaturesRequest.builder().build(), requestOptions); + } + public CompletableFuture> countFeatures( CountFeaturesRequest request) { return countFeatures(request, null); @@ -561,6 +591,10 @@ public CompletableFuture> count request.getWithoutCompanyOverrideFor().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -590,6 +624,11 @@ public CompletableFuture> count QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -605,13 +644,13 @@ public CompletableFuture> count @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFeaturesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFeaturesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -643,11 +682,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -666,6 +703,10 @@ public CompletableFuture> listFlags return listFlags(ListFlagsRequest.builder().build()); } + public CompletableFuture> listFlags(RequestOptions requestOptions) { + return listFlags(ListFlagsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listFlags(ListFlagsRequest request) { return listFlags(request, null); } @@ -693,6 +734,11 @@ public CompletableFuture> listFlags if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -708,13 +754,13 @@ public CompletableFuture> listFlags @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFlagsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFlagsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -746,11 +792,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -771,10 +815,14 @@ public CompletableFuture> createFl public CompletableFuture> createFlag( CreateFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("flags") - .build(); + .addPathSegments("flags"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -783,7 +831,7 @@ public CompletableFuture> createFl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -798,13 +846,13 @@ public CompletableFuture> createFl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateFlagResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFlagResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -836,11 +884,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -861,13 +907,17 @@ public CompletableFuture> getFlag(Str public CompletableFuture> getFlag( String flagId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) - .build(); + .addPathSegment(flagId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -881,13 +931,13 @@ public CompletableFuture> getFlag( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetFlagResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFlagResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -914,11 +964,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -940,11 +988,15 @@ public CompletableFuture> updateFl public CompletableFuture> updateFlag( String flagId, CreateFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) - .build(); + .addPathSegment(flagId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -953,7 +1005,7 @@ public CompletableFuture> updateFl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -968,13 +1020,13 @@ public CompletableFuture> updateFl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateFlagResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFlagResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1006,11 +1058,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1031,13 +1081,17 @@ public CompletableFuture> deleteFl public CompletableFuture> deleteFlag( String flagId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) - .build(); + .addPathSegment(flagId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -1051,13 +1105,13 @@ public CompletableFuture> deleteFl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteFlagResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteFlagResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1089,11 +1143,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1115,12 +1167,16 @@ public CompletableFuture> upd public CompletableFuture> updateFlagRules( String flagId, UpdateFlagRulesRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") .addPathSegment(flagId) - .addPathSegments("rules") - .build(); + .addPathSegments("rules"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1129,7 +1185,7 @@ public CompletableFuture> upd throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1144,14 +1200,13 @@ public CompletableFuture> upd @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateFlagRulesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFlagRulesResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1183,11 +1238,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1206,6 +1259,11 @@ public CompletableFuture> checkFlag return checkFlag(key, CheckFlagRequestBody.builder().build()); } + public CompletableFuture> checkFlag( + String key, RequestOptions requestOptions) { + return checkFlag(key, CheckFlagRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> checkFlag( String key, CheckFlagRequestBody request) { return checkFlag(key, request, null); @@ -1213,12 +1271,16 @@ public CompletableFuture> checkFlag public CompletableFuture> checkFlag( String key, CheckFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") .addPathSegment(key) - .addPathSegments("check") - .build(); + .addPathSegments("check"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1227,7 +1289,7 @@ public CompletableFuture> checkFlag throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1242,13 +1304,13 @@ public CompletableFuture> checkFlag @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckFlagResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckFlagResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1280,11 +1342,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1303,16 +1363,24 @@ public CompletableFuture> checkFla return checkFlags(CheckFlagRequestBody.builder().build()); } + public CompletableFuture> checkFlags(RequestOptions requestOptions) { + return checkFlags(CheckFlagRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> checkFlags(CheckFlagRequestBody request) { return checkFlags(request, null); } public CompletableFuture> checkFlags( CheckFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("flags/check") - .build(); + .addPathSegments("flags/check"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1321,7 +1389,7 @@ public CompletableFuture> checkFla throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1336,13 +1404,13 @@ public CompletableFuture> checkFla @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckFlagsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckFlagsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1374,11 +1442,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1400,10 +1466,14 @@ public CompletableFuture> chec public CompletableFuture> checkFlagsBulk( CheckFlagsBulkRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("flags/check-bulk") - .build(); + .addPathSegments("flags/check-bulk"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1412,7 +1482,7 @@ public CompletableFuture> chec throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1427,14 +1497,13 @@ public CompletableFuture> chec @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CheckFlagsBulkResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckFlagsBulkResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1466,11 +1535,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -1489,6 +1556,10 @@ public CompletableFuture> countFla return countFlags(CountFlagsRequest.builder().build()); } + public CompletableFuture> countFlags(RequestOptions requestOptions) { + return countFlags(CountFlagsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countFlags(CountFlagsRequest request) { return countFlags(request, null); } @@ -1516,6 +1587,11 @@ public CompletableFuture> countFla if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1531,13 +1607,13 @@ public CompletableFuture> countFla @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFlagsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFlagsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1569,11 +1645,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 13a2757..f9712db 100644 --- a/src/main/java/com/schematic/api/resources/features/FeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/FeaturesClient.java @@ -53,6 +53,10 @@ public ListFeaturesResponse listFeatures() { return this.rawClient.listFeatures().body(); } + public ListFeaturesResponse listFeatures(RequestOptions requestOptions) { + return this.rawClient.listFeatures(requestOptions).body(); + } + public ListFeaturesResponse listFeatures(ListFeaturesRequest request) { return this.rawClient.listFeatures(request).body(); } @@ -81,6 +85,10 @@ public UpdateFeatureResponse updateFeature(String featureId) { return this.rawClient.updateFeature(featureId).body(); } + public UpdateFeatureResponse updateFeature(String featureId, RequestOptions requestOptions) { + return this.rawClient.updateFeature(featureId, requestOptions).body(); + } + public UpdateFeatureResponse updateFeature(String featureId, UpdateFeatureRequestBody request) { return this.rawClient.updateFeature(featureId, request).body(); } @@ -102,6 +110,10 @@ public CountFeaturesResponse countFeatures() { return this.rawClient.countFeatures().body(); } + public CountFeaturesResponse countFeatures(RequestOptions requestOptions) { + return this.rawClient.countFeatures(requestOptions).body(); + } + public CountFeaturesResponse countFeatures(CountFeaturesRequest request) { return this.rawClient.countFeatures(request).body(); } @@ -114,6 +126,10 @@ public ListFlagsResponse listFlags() { return this.rawClient.listFlags().body(); } + public ListFlagsResponse listFlags(RequestOptions requestOptions) { + return this.rawClient.listFlags(requestOptions).body(); + } + public ListFlagsResponse listFlags(ListFlagsRequest request) { return this.rawClient.listFlags(request).body(); } @@ -167,6 +183,10 @@ public CheckFlagResponse checkFlag(String key) { return this.rawClient.checkFlag(key).body(); } + public CheckFlagResponse checkFlag(String key, RequestOptions requestOptions) { + return this.rawClient.checkFlag(key, requestOptions).body(); + } + public CheckFlagResponse checkFlag(String key, CheckFlagRequestBody request) { return this.rawClient.checkFlag(key, request).body(); } @@ -179,6 +199,10 @@ public CheckFlagsResponse checkFlags() { return this.rawClient.checkFlags().body(); } + public CheckFlagsResponse checkFlags(RequestOptions requestOptions) { + return this.rawClient.checkFlags(requestOptions).body(); + } + public CheckFlagsResponse checkFlags(CheckFlagRequestBody request) { return this.rawClient.checkFlags(request).body(); } @@ -199,6 +223,10 @@ public CountFlagsResponse countFlags() { return this.rawClient.countFlags().body(); } + public CountFlagsResponse countFlags(RequestOptions requestOptions) { + return this.rawClient.countFlags(requestOptions).body(); + } + public CountFlagsResponse countFlags(CountFlagsRequest request) { return this.rawClient.countFlags(request).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 9386f66..b03e901 100644 --- a/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java +++ b/src/main/java/com/schematic/api/resources/features/RawFeaturesClient.java @@ -64,6 +64,10 @@ public BaseSchematicHttpResponse listFeatures() { return listFeatures(ListFeaturesRequest.builder().build()); } + public BaseSchematicHttpResponse listFeatures(RequestOptions requestOptions) { + return listFeatures(ListFeaturesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listFeatures(ListFeaturesRequest request) { return listFeatures(request, null); } @@ -83,6 +87,10 @@ public BaseSchematicHttpResponse listFeatures( request.getWithoutCompanyOverrideFor().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -112,6 +120,11 @@ public BaseSchematicHttpResponse listFeatures( QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -124,12 +137,11 @@ public BaseSchematicHttpResponse listFeatures( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFeaturesResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFeaturesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -151,11 +163,9 @@ public BaseSchematicHttpResponse listFeatures( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -167,10 +177,14 @@ public BaseSchematicHttpResponse createFeature(CreateFeat public BaseSchematicHttpResponse createFeature( CreateFeatureRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("features") - .build(); + .addPathSegments("features"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -179,7 +193,7 @@ public BaseSchematicHttpResponse createFeature( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -191,12 +205,11 @@ public BaseSchematicHttpResponse createFeature( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateFeatureResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFeatureResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -218,11 +231,9 @@ public BaseSchematicHttpResponse createFeature( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -233,13 +244,17 @@ public BaseSchematicHttpResponse getFeature(String featureId } public BaseSchematicHttpResponse getFeature(String featureId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId) - .build(); + .addPathSegment(featureId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -250,11 +265,11 @@ public BaseSchematicHttpResponse getFeature(String featureId } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetFeatureResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFeatureResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -273,11 +288,9 @@ public BaseSchematicHttpResponse getFeature(String featureId } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -287,6 +300,11 @@ public BaseSchematicHttpResponse updateFeature(String fea return updateFeature(featureId, UpdateFeatureRequestBody.builder().build()); } + public BaseSchematicHttpResponse updateFeature( + String featureId, RequestOptions requestOptions) { + return updateFeature(featureId, UpdateFeatureRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse updateFeature( String featureId, UpdateFeatureRequestBody request) { return updateFeature(featureId, request, null); @@ -294,11 +312,15 @@ public BaseSchematicHttpResponse updateFeature( public BaseSchematicHttpResponse updateFeature( String featureId, UpdateFeatureRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId) - .build(); + .addPathSegment(featureId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -307,7 +329,7 @@ public BaseSchematicHttpResponse updateFeature( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -319,12 +341,11 @@ public BaseSchematicHttpResponse updateFeature( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateFeatureResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFeatureResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -346,11 +367,9 @@ public BaseSchematicHttpResponse updateFeature( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -362,13 +381,17 @@ public BaseSchematicHttpResponse deleteFeature(String fea public BaseSchematicHttpResponse deleteFeature( String featureId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("features") - .addPathSegment(featureId) - .build(); + .addPathSegment(featureId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -379,12 +402,11 @@ public BaseSchematicHttpResponse deleteFeature( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteFeatureResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteFeatureResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -406,11 +428,9 @@ public BaseSchematicHttpResponse deleteFeature( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -420,6 +440,10 @@ public BaseSchematicHttpResponse countFeatures() { return countFeatures(CountFeaturesRequest.builder().build()); } + public BaseSchematicHttpResponse countFeatures(RequestOptions requestOptions) { + return countFeatures(CountFeaturesRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countFeatures(CountFeaturesRequest request) { return countFeatures(request, null); } @@ -439,6 +463,10 @@ public BaseSchematicHttpResponse countFeatures( request.getWithoutCompanyOverrideFor().get(), false); } + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } if (request.getWithoutPlanEntitlementFor().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, @@ -468,6 +496,11 @@ public BaseSchematicHttpResponse countFeatures( QueryStringMapper.addQueryParameter( httpUrl, "feature_type", request.getFeatureType().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -480,12 +513,11 @@ public BaseSchematicHttpResponse countFeatures( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFeaturesResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFeaturesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -507,11 +539,9 @@ public BaseSchematicHttpResponse countFeatures( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -521,6 +551,10 @@ public BaseSchematicHttpResponse listFlags() { return listFlags(ListFlagsRequest.builder().build()); } + public BaseSchematicHttpResponse listFlags(RequestOptions requestOptions) { + return listFlags(ListFlagsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listFlags(ListFlagsRequest request) { return listFlags(request, null); } @@ -548,6 +582,11 @@ public BaseSchematicHttpResponse listFlags( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -560,11 +599,11 @@ public BaseSchematicHttpResponse listFlags( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListFlagsResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListFlagsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -586,11 +625,9 @@ public BaseSchematicHttpResponse listFlags( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -602,10 +639,14 @@ public BaseSchematicHttpResponse createFlag(CreateFlagReques public BaseSchematicHttpResponse createFlag( CreateFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("flags") - .build(); + .addPathSegments("flags"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -614,7 +655,7 @@ public BaseSchematicHttpResponse createFlag( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -626,11 +667,11 @@ public BaseSchematicHttpResponse createFlag( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateFlagResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateFlagResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -652,11 +693,9 @@ public BaseSchematicHttpResponse createFlag( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -667,13 +706,17 @@ public BaseSchematicHttpResponse getFlag(String flagId) { } public BaseSchematicHttpResponse getFlag(String flagId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) - .build(); + .addPathSegment(flagId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -684,11 +727,11 @@ public BaseSchematicHttpResponse getFlag(String flagId, Request } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetFlagResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetFlagResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -707,11 +750,9 @@ public BaseSchematicHttpResponse getFlag(String flagId, Request } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -723,11 +764,15 @@ public BaseSchematicHttpResponse updateFlag(String flagId, C public BaseSchematicHttpResponse updateFlag( String flagId, CreateFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) - .build(); + .addPathSegment(flagId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -736,7 +781,7 @@ public BaseSchematicHttpResponse updateFlag( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -748,11 +793,11 @@ public BaseSchematicHttpResponse updateFlag( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateFlagResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFlagResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -774,11 +819,9 @@ public BaseSchematicHttpResponse updateFlag( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -789,13 +832,17 @@ public BaseSchematicHttpResponse deleteFlag(String flagId) { } public BaseSchematicHttpResponse deleteFlag(String flagId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") - .addPathSegment(flagId) - .build(); + .addPathSegment(flagId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -806,11 +853,11 @@ public BaseSchematicHttpResponse deleteFlag(String flagId, R } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteFlagResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteFlagResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -832,11 +879,9 @@ public BaseSchematicHttpResponse deleteFlag(String flagId, R } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -849,12 +894,16 @@ public BaseSchematicHttpResponse updateFlagRules( public BaseSchematicHttpResponse updateFlagRules( String flagId, UpdateFlagRulesRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") .addPathSegment(flagId) - .addPathSegments("rules") - .build(); + .addPathSegments("rules"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -863,7 +912,7 @@ public BaseSchematicHttpResponse updateFlagRules( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -875,12 +924,12 @@ public BaseSchematicHttpResponse updateFlagRules( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateFlagRulesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateFlagRulesResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -902,11 +951,9 @@ public BaseSchematicHttpResponse updateFlagRules( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -916,18 +963,26 @@ public BaseSchematicHttpResponse checkFlag(String key) { return checkFlag(key, CheckFlagRequestBody.builder().build()); } + public BaseSchematicHttpResponse checkFlag(String key, RequestOptions requestOptions) { + return checkFlag(key, CheckFlagRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse checkFlag(String key, CheckFlagRequestBody request) { return checkFlag(key, request, null); } public BaseSchematicHttpResponse checkFlag( String key, CheckFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("flags") .addPathSegment(key) - .addPathSegments("check") - .build(); + .addPathSegments("check"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -936,7 +991,7 @@ public BaseSchematicHttpResponse checkFlag( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -948,11 +1003,11 @@ public BaseSchematicHttpResponse checkFlag( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckFlagResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckFlagResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -974,11 +1029,9 @@ public BaseSchematicHttpResponse checkFlag( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -988,16 +1041,24 @@ public BaseSchematicHttpResponse checkFlags() { return checkFlags(CheckFlagRequestBody.builder().build()); } + public BaseSchematicHttpResponse checkFlags(RequestOptions requestOptions) { + return checkFlags(CheckFlagRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse checkFlags(CheckFlagRequestBody request) { return checkFlags(request, null); } public BaseSchematicHttpResponse checkFlags( CheckFlagRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("flags/check") - .build(); + .addPathSegments("flags/check"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1006,7 +1067,7 @@ public BaseSchematicHttpResponse checkFlags( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1018,11 +1079,11 @@ public BaseSchematicHttpResponse checkFlags( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckFlagsResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckFlagsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1044,11 +1105,9 @@ public BaseSchematicHttpResponse checkFlags( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1060,10 +1119,14 @@ public BaseSchematicHttpResponse checkFlagsBulk(CheckFla public BaseSchematicHttpResponse checkFlagsBulk( CheckFlagsBulkRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("flags/check-bulk") - .build(); + .addPathSegments("flags/check-bulk"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -1072,7 +1135,7 @@ public BaseSchematicHttpResponse checkFlagsBulk( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -1084,12 +1147,12 @@ public BaseSchematicHttpResponse checkFlagsBulk( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CheckFlagsBulkResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CheckFlagsBulkResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1111,11 +1174,9 @@ public BaseSchematicHttpResponse checkFlagsBulk( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -1125,6 +1186,10 @@ public BaseSchematicHttpResponse countFlags() { return countFlags(CountFlagsRequest.builder().build()); } + public BaseSchematicHttpResponse countFlags(RequestOptions requestOptions) { + return countFlags(CountFlagsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countFlags(CountFlagsRequest request) { return countFlags(request, null); } @@ -1152,6 +1217,11 @@ public BaseSchematicHttpResponse countFlags( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -1164,11 +1234,11 @@ public BaseSchematicHttpResponse countFlags( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountFlagsResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountFlagsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -1190,11 +1260,9 @@ public BaseSchematicHttpResponse countFlags( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java index efe31b7..897cd3d 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java +++ b/src/main/java/com/schematic/api/resources/features/requests/CheckFlagsBulkRequestBody.java @@ -103,5 +103,15 @@ public Builder addAllContexts(List contexts) { public CheckFlagsBulkRequestBody build() { return new CheckFlagsBulkRequestBody(contexts, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/CountFeaturesRequest.java b/src/main/java/com/schematic/api/resources/features/requests/CountFeaturesRequest.java index c80fcaa..7affe0e 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 @@ -31,13 +31,15 @@ public final class CountFeaturesRequest { private final Optional withoutCompanyOverrideFor; + private final Optional planVersionId; + private final Optional withoutPlanEntitlementFor; private final Optional booleanRequireEvent; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -46,15 +48,17 @@ private CountFeaturesRequest( Optional> featureType, Optional q, Optional withoutCompanyOverrideFor, + Optional planVersionId, Optional withoutPlanEntitlementFor, Optional booleanRequireEvent, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.featureType = featureType; this.q = q; this.withoutCompanyOverrideFor = withoutCompanyOverrideFor; + this.planVersionId = planVersionId; this.withoutPlanEntitlementFor = withoutPlanEntitlementFor; this.booleanRequireEvent = booleanRequireEvent; this.limit = limit; @@ -91,6 +95,14 @@ public Optional getWithoutCompanyOverrideFor() { return withoutCompanyOverrideFor; } + /** + * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Filter out features that already have a plan entitlement for the specified plan ID */ @@ -111,7 +123,7 @@ public Optional getBooleanRequireEvent() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -119,7 +131,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -139,6 +151,7 @@ private boolean equalTo(CountFeaturesRequest other) { && featureType.equals(other.featureType) && q.equals(other.q) && withoutCompanyOverrideFor.equals(other.withoutCompanyOverrideFor) + && planVersionId.equals(other.planVersionId) && withoutPlanEntitlementFor.equals(other.withoutPlanEntitlementFor) && booleanRequireEvent.equals(other.booleanRequireEvent) && limit.equals(other.limit) @@ -152,6 +165,7 @@ public int hashCode() { this.featureType, this.q, this.withoutCompanyOverrideFor, + this.planVersionId, this.withoutPlanEntitlementFor, this.booleanRequireEvent, this.limit, @@ -177,13 +191,15 @@ public static final class Builder { private Optional withoutCompanyOverrideFor = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional withoutPlanEntitlementFor = Optional.empty(); private Optional booleanRequireEvent = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -195,6 +211,7 @@ public Builder from(CountFeaturesRequest other) { featureType(other.getFeatureType()); q(other.getQ()); withoutCompanyOverrideFor(other.getWithoutCompanyOverrideFor()); + planVersionId(other.getPlanVersionId()); withoutPlanEntitlementFor(other.getWithoutPlanEntitlementFor()); booleanRequireEvent(other.getBooleanRequireEvent()); limit(other.getLimit()); @@ -265,6 +282,20 @@ public Builder withoutCompanyOverrideFor(String withoutCompanyOverrideFor) { return this; } + /** + *

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

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

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

*/ @@ -297,12 +328,12 @@ public Builder booleanRequireEvent(Boolean booleanRequireEvent) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -327,11 +358,22 @@ public CountFeaturesRequest build() { featureType, q, withoutCompanyOverrideFor, + planVersionId, withoutPlanEntitlementFor, booleanRequireEvent, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/CountFlagsRequest.java b/src/main/java/com/schematic/api/resources/features/requests/CountFlagsRequest.java index 2a34436..b129819 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/CountFlagsRequest.java +++ b/src/main/java/com/schematic/api/resources/features/requests/CountFlagsRequest.java @@ -28,9 +28,9 @@ public final class CountFlagsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -38,8 +38,8 @@ private CountFlagsRequest( Optional> ids, Optional featureId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.featureId = featureId; @@ -71,7 +71,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -79,7 +79,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -124,9 +124,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -187,12 +187,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -214,5 +214,15 @@ public Builder offset(Integer offset) { public CountFlagsRequest build() { return new CountFlagsRequest(ids, featureId, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/CreateFeatureRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/CreateFeatureRequestBody.java index a4ab28d..d55fe51 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 @@ -197,6 +197,10 @@ public interface NameStage { public interface _FinalStage { CreateFeatureRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage eventSubtype(Optional eventSubtype); _FinalStage eventSubtype(String eventSubtype); @@ -416,5 +420,17 @@ public CreateFeatureRequestBody build() { traitId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/ListFeaturesRequest.java b/src/main/java/com/schematic/api/resources/features/requests/ListFeaturesRequest.java index d636c76..1532f60 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 @@ -31,13 +31,15 @@ public final class ListFeaturesRequest { private final Optional withoutCompanyOverrideFor; + private final Optional planVersionId; + private final Optional withoutPlanEntitlementFor; private final Optional booleanRequireEvent; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -46,15 +48,17 @@ private ListFeaturesRequest( Optional> featureType, Optional q, Optional withoutCompanyOverrideFor, + Optional planVersionId, Optional withoutPlanEntitlementFor, Optional booleanRequireEvent, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.featureType = featureType; this.q = q; this.withoutCompanyOverrideFor = withoutCompanyOverrideFor; + this.planVersionId = planVersionId; this.withoutPlanEntitlementFor = withoutPlanEntitlementFor; this.booleanRequireEvent = booleanRequireEvent; this.limit = limit; @@ -91,6 +95,14 @@ public Optional getWithoutCompanyOverrideFor() { return withoutCompanyOverrideFor; } + /** + * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Filter out features that already have a plan entitlement for the specified plan ID */ @@ -111,7 +123,7 @@ public Optional getBooleanRequireEvent() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -119,7 +131,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -139,6 +151,7 @@ private boolean equalTo(ListFeaturesRequest other) { && featureType.equals(other.featureType) && q.equals(other.q) && withoutCompanyOverrideFor.equals(other.withoutCompanyOverrideFor) + && planVersionId.equals(other.planVersionId) && withoutPlanEntitlementFor.equals(other.withoutPlanEntitlementFor) && booleanRequireEvent.equals(other.booleanRequireEvent) && limit.equals(other.limit) @@ -152,6 +165,7 @@ public int hashCode() { this.featureType, this.q, this.withoutCompanyOverrideFor, + this.planVersionId, this.withoutPlanEntitlementFor, this.booleanRequireEvent, this.limit, @@ -177,13 +191,15 @@ public static final class Builder { private Optional withoutCompanyOverrideFor = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional withoutPlanEntitlementFor = Optional.empty(); private Optional booleanRequireEvent = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -195,6 +211,7 @@ public Builder from(ListFeaturesRequest other) { featureType(other.getFeatureType()); q(other.getQ()); withoutCompanyOverrideFor(other.getWithoutCompanyOverrideFor()); + planVersionId(other.getPlanVersionId()); withoutPlanEntitlementFor(other.getWithoutPlanEntitlementFor()); booleanRequireEvent(other.getBooleanRequireEvent()); limit(other.getLimit()); @@ -265,6 +282,20 @@ public Builder withoutCompanyOverrideFor(String withoutCompanyOverrideFor) { return this; } + /** + *

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

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

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

*/ @@ -297,12 +328,12 @@ public Builder booleanRequireEvent(Boolean booleanRequireEvent) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -327,11 +358,22 @@ public ListFeaturesRequest build() { featureType, q, withoutCompanyOverrideFor, + planVersionId, withoutPlanEntitlementFor, booleanRequireEvent, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/ListFlagsRequest.java b/src/main/java/com/schematic/api/resources/features/requests/ListFlagsRequest.java index 11f5021..33ab970 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/ListFlagsRequest.java +++ b/src/main/java/com/schematic/api/resources/features/requests/ListFlagsRequest.java @@ -28,9 +28,9 @@ public final class ListFlagsRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -38,8 +38,8 @@ private ListFlagsRequest( Optional> ids, Optional featureId, Optional q, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.featureId = featureId; @@ -71,7 +71,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -79,7 +79,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -124,9 +124,9 @@ public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -187,12 +187,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -214,5 +214,15 @@ public Builder offset(Integer offset) { public ListFlagsRequest build() { return new ListFlagsRequest(ids, featureId, q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/UpdateFeatureRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/UpdateFeatureRequestBody.java index b8686a6..1c8c2db 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 @@ -359,5 +359,15 @@ public UpdateFeatureRequestBody build() { traitId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/requests/UpdateFlagRulesRequestBody.java b/src/main/java/com/schematic/api/resources/features/requests/UpdateFlagRulesRequestBody.java index 009d56c..e2e0a0d 100644 --- a/src/main/java/com/schematic/api/resources/features/requests/UpdateFlagRulesRequestBody.java +++ b/src/main/java/com/schematic/api/resources/features/requests/UpdateFlagRulesRequestBody.java @@ -104,5 +104,15 @@ public Builder addAllRules(List rules) { public UpdateFlagRulesRequestBody build() { return new UpdateFlagRulesRequestBody(rules, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CheckFlagResponse.java b/src/main/java/com/schematic/api/resources/features/types/CheckFlagResponse.java index cd2410d..6cb4934 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CheckFlagResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CheckFlagResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CheckFlagResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CheckFlagResponse build() { return new CheckFlagResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java b/src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java index 74db7f8..7a241df 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CheckFlagsBulkResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CheckFlagsBulkResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CheckFlagsBulkResponse build() { return new CheckFlagsBulkResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CheckFlagsResponse.java b/src/main/java/com/schematic/api/resources/features/types/CheckFlagsResponse.java index 0ab405f..3a56ebe 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CheckFlagsResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CheckFlagsResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CheckFlagsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CheckFlagsResponse build() { return new CheckFlagsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CountFeaturesParams.java b/src/main/java/com/schematic/api/resources/features/types/CountFeaturesParams.java index 08d3aa1..621e8bd 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 @@ -28,9 +28,11 @@ public final class CountFeaturesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; + + private final Optional planVersionId; private final Optional q; @@ -44,8 +46,9 @@ private CountFeaturesParams( Optional booleanRequireEvent, Optional> featureType, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, + Optional planVersionId, Optional q, Optional withoutCompanyOverrideFor, Optional withoutPlanEntitlementFor, @@ -55,6 +58,7 @@ private CountFeaturesParams( this.ids = ids; this.limit = limit; this.offset = offset; + this.planVersionId = planVersionId; this.q = q; this.withoutCompanyOverrideFor = withoutCompanyOverrideFor; this.withoutPlanEntitlementFor = withoutPlanEntitlementFor; @@ -86,7 +90,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -94,10 +98,18 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } + /** + * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search by feature name or ID */ @@ -139,6 +151,7 @@ private boolean equalTo(CountFeaturesParams other) { && ids.equals(other.ids) && limit.equals(other.limit) && offset.equals(other.offset) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && withoutCompanyOverrideFor.equals(other.withoutCompanyOverrideFor) && withoutPlanEntitlementFor.equals(other.withoutPlanEntitlementFor); @@ -152,6 +165,7 @@ public int hashCode() { this.ids, this.limit, this.offset, + this.planVersionId, this.q, this.withoutCompanyOverrideFor, this.withoutPlanEntitlementFor); @@ -174,9 +188,11 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); + + private Optional planVersionId = Optional.empty(); private Optional q = Optional.empty(); @@ -195,6 +211,7 @@ public Builder from(CountFeaturesParams other) { ids(other.getIds()); limit(other.getLimit()); offset(other.getOffset()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); withoutCompanyOverrideFor(other.getWithoutCompanyOverrideFor()); withoutPlanEntitlementFor(other.getWithoutPlanEntitlementFor()); @@ -244,12 +261,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

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

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

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

Search by feature name or ID

*/ @@ -317,10 +348,21 @@ public CountFeaturesParams build() { ids, limit, offset, + planVersionId, q, withoutCompanyOverrideFor, withoutPlanEntitlementFor, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CountFeaturesResponse.java b/src/main/java/com/schematic/api/resources/features/types/CountFeaturesResponse.java index e5544ad..76f6df8 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CountFeaturesResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CountFeaturesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountFeaturesResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountFeaturesParams params) { public CountFeaturesResponse build() { return new CountFeaturesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CountFlagsParams.java b/src/main/java/com/schematic/api/resources/features/types/CountFlagsParams.java index f339eed..681be23 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CountFlagsParams.java +++ b/src/main/java/com/schematic/api/resources/features/types/CountFlagsParams.java @@ -25,9 +25,9 @@ public final class CountFlagsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -36,8 +36,8 @@ public final class CountFlagsParams { private CountFlagsParams( Optional featureId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.featureId = featureId; @@ -62,7 +62,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -70,7 +70,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -121,9 +121,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -167,12 +167,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -208,5 +208,15 @@ public Builder q(String q) { public CountFlagsParams build() { return new CountFlagsParams(featureId, ids, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CountFlagsResponse.java b/src/main/java/com/schematic/api/resources/features/types/CountFlagsResponse.java index 5e0a143..395e1cc 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CountFlagsResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CountFlagsResponse.java @@ -89,6 +89,10 @@ public interface ParamsStage { public interface _FinalStage { CountFlagsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -132,5 +136,17 @@ public _FinalStage params(@NotNull CountFlagsParams params) { public CountFlagsResponse build() { return new CountFlagsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CreateFeatureResponse.java b/src/main/java/com/schematic/api/resources/features/types/CreateFeatureResponse.java index 85c73e7..b1ac506 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CreateFeatureResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CreateFeatureResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateFeatureResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateFeatureResponse build() { return new CreateFeatureResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/CreateFlagResponse.java b/src/main/java/com/schematic/api/resources/features/types/CreateFlagResponse.java index 1c4b489..b84c4c0 100644 --- a/src/main/java/com/schematic/api/resources/features/types/CreateFlagResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/CreateFlagResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateFlagResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateFlagResponse build() { return new CreateFlagResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/DeleteFeatureResponse.java b/src/main/java/com/schematic/api/resources/features/types/DeleteFeatureResponse.java index 2df9dae..bb48e4d 100644 --- a/src/main/java/com/schematic/api/resources/features/types/DeleteFeatureResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/DeleteFeatureResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteFeatureResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteFeatureResponse build() { return new DeleteFeatureResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/DeleteFlagResponse.java b/src/main/java/com/schematic/api/resources/features/types/DeleteFlagResponse.java index d420ade..7a268f2 100644 --- a/src/main/java/com/schematic/api/resources/features/types/DeleteFlagResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/DeleteFlagResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteFlagResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteFlagResponse build() { return new DeleteFlagResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/GetFeatureResponse.java b/src/main/java/com/schematic/api/resources/features/types/GetFeatureResponse.java index f253547..5a88291 100644 --- a/src/main/java/com/schematic/api/resources/features/types/GetFeatureResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/GetFeatureResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetFeatureResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetFeatureResponse build() { return new GetFeatureResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/GetFlagResponse.java b/src/main/java/com/schematic/api/resources/features/types/GetFlagResponse.java index 22f3ee8..859bbf9 100644 --- a/src/main/java/com/schematic/api/resources/features/types/GetFlagResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/GetFlagResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetFlagResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetFlagResponse build() { return new GetFlagResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/ListFeaturesParams.java b/src/main/java/com/schematic/api/resources/features/types/ListFeaturesParams.java index aa761c8..4c25dd1 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 @@ -28,9 +28,11 @@ public final class ListFeaturesParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; + + private final Optional planVersionId; private final Optional q; @@ -44,8 +46,9 @@ private ListFeaturesParams( Optional booleanRequireEvent, Optional> featureType, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, + Optional planVersionId, Optional q, Optional withoutCompanyOverrideFor, Optional withoutPlanEntitlementFor, @@ -55,6 +58,7 @@ private ListFeaturesParams( this.ids = ids; this.limit = limit; this.offset = offset; + this.planVersionId = planVersionId; this.q = q; this.withoutCompanyOverrideFor = withoutCompanyOverrideFor; this.withoutPlanEntitlementFor = withoutPlanEntitlementFor; @@ -86,7 +90,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -94,10 +98,18 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } + /** + * @return Filter by plan version ID when used with without_plan_entitlement_for; if not provided, the latest published version is used + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + /** * @return Search by feature name or ID */ @@ -139,6 +151,7 @@ private boolean equalTo(ListFeaturesParams other) { && ids.equals(other.ids) && limit.equals(other.limit) && offset.equals(other.offset) + && planVersionId.equals(other.planVersionId) && q.equals(other.q) && withoutCompanyOverrideFor.equals(other.withoutCompanyOverrideFor) && withoutPlanEntitlementFor.equals(other.withoutPlanEntitlementFor); @@ -152,6 +165,7 @@ public int hashCode() { this.ids, this.limit, this.offset, + this.planVersionId, this.q, this.withoutCompanyOverrideFor, this.withoutPlanEntitlementFor); @@ -174,9 +188,11 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); + + private Optional planVersionId = Optional.empty(); private Optional q = Optional.empty(); @@ -195,6 +211,7 @@ public Builder from(ListFeaturesParams other) { ids(other.getIds()); limit(other.getLimit()); offset(other.getOffset()); + planVersionId(other.getPlanVersionId()); q(other.getQ()); withoutCompanyOverrideFor(other.getWithoutCompanyOverrideFor()); withoutPlanEntitlementFor(other.getWithoutPlanEntitlementFor()); @@ -244,12 +261,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

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

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

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

Search by feature name or ID

*/ @@ -317,10 +348,21 @@ public ListFeaturesParams build() { ids, limit, offset, + planVersionId, q, withoutCompanyOverrideFor, withoutPlanEntitlementFor, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/ListFeaturesResponse.java b/src/main/java/com/schematic/api/resources/features/types/ListFeaturesResponse.java index e70e6e1..5504f66 100644 --- a/src/main/java/com/schematic/api/resources/features/types/ListFeaturesResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/ListFeaturesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListFeaturesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(FeatureDetailResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListFeaturesResponse build() { return new ListFeaturesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/ListFlagsParams.java b/src/main/java/com/schematic/api/resources/features/types/ListFlagsParams.java index c97f41b..8a9ad26 100644 --- a/src/main/java/com/schematic/api/resources/features/types/ListFlagsParams.java +++ b/src/main/java/com/schematic/api/resources/features/types/ListFlagsParams.java @@ -25,9 +25,9 @@ public final class ListFlagsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -36,8 +36,8 @@ public final class ListFlagsParams { private ListFlagsParams( Optional featureId, Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Map additionalProperties) { this.featureId = featureId; @@ -62,7 +62,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -70,7 +70,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -121,9 +121,9 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -167,12 +167,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -208,5 +208,15 @@ public Builder q(String q) { public ListFlagsParams build() { return new ListFlagsParams(featureId, ids, limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/ListFlagsResponse.java b/src/main/java/com/schematic/api/resources/features/types/ListFlagsResponse.java index 29434aa..647d428 100644 --- a/src/main/java/com/schematic/api/resources/features/types/ListFlagsResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/ListFlagsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListFlagsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(FlagDetailResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListFlagsResponse build() { return new ListFlagsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureResponse.java b/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureResponse.java index 32a131c..5703023 100644 --- a/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/UpdateFeatureResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateFeatureResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateFeatureResponse build() { return new UpdateFeatureResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/UpdateFlagResponse.java b/src/main/java/com/schematic/api/resources/features/types/UpdateFlagResponse.java index 1441a73..0639594 100644 --- a/src/main/java/com/schematic/api/resources/features/types/UpdateFlagResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/UpdateFlagResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateFlagResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateFlagResponse build() { return new UpdateFlagResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/features/types/UpdateFlagRulesResponse.java b/src/main/java/com/schematic/api/resources/features/types/UpdateFlagRulesResponse.java index a84c734..68b8f6a 100644 --- a/src/main/java/com/schematic/api/resources/features/types/UpdateFlagRulesResponse.java +++ b/src/main/java/com/schematic/api/resources/features/types/UpdateFlagRulesResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateFlagRulesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateFlagRulesResponse build() { return new UpdateFlagRulesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java index 90b9775..82dfd1a 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/AsyncRawPlanbundleClient.java @@ -48,10 +48,14 @@ public CompletableFuture> cr public CompletableFuture> createPlanBundle( CreatePlanBundleRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-bundles") - .build(); + .addPathSegments("plan-bundles"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -60,7 +64,7 @@ public CompletableFuture> cr throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -75,14 +79,13 @@ public CompletableFuture> cr @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreatePlanBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanBundleResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -114,11 +117,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -140,11 +141,15 @@ public CompletableFuture> up public CompletableFuture> updatePlanBundle( String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-bundles") - .addPathSegment(planBundleId) - .build(); + .addPathSegment(planBundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -153,7 +158,7 @@ public CompletableFuture> up throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -168,14 +173,13 @@ public CompletableFuture> up @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdatePlanBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanBundleResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -207,11 +211,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java index 62372e9..2fab6fb 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java +++ b/src/main/java/com/schematic/api/resources/planbundle/RawPlanbundleClient.java @@ -43,10 +43,14 @@ public BaseSchematicHttpResponse createPlanBundle(Crea public BaseSchematicHttpResponse createPlanBundle( CreatePlanBundleRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-bundles") - .build(); + .addPathSegments("plan-bundles"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -55,7 +59,7 @@ public BaseSchematicHttpResponse createPlanBundle( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -67,12 +71,12 @@ public BaseSchematicHttpResponse createPlanBundle( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanBundleResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -94,11 +98,9 @@ public BaseSchematicHttpResponse createPlanBundle( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -111,11 +113,15 @@ public BaseSchematicHttpResponse updatePlanBundle( public BaseSchematicHttpResponse updatePlanBundle( String planBundleId, UpdatePlanBundleRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-bundles") - .addPathSegment(planBundleId) - .build(); + .addPathSegment(planBundleId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -124,7 +130,7 @@ public BaseSchematicHttpResponse updatePlanBundle( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -136,12 +142,12 @@ public BaseSchematicHttpResponse updatePlanBundle( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanBundleResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanBundleResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -163,11 +169,9 @@ public BaseSchematicHttpResponse updatePlanBundle( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java index 6b61d93..1df9bc1 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/CreatePlanBundleRequestBody.java @@ -207,5 +207,15 @@ public CreatePlanBundleRequestBody build() { return new CreatePlanBundleRequestBody( billingProduct, creditGrants, entitlements, plan, traits, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java index dd8eebd..1d51756 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java +++ b/src/main/java/com/schematic/api/resources/planbundle/requests/UpdatePlanBundleRequestBody.java @@ -35,6 +35,8 @@ public final class UpdatePlanBundleRequestBody { private final Optional plan; + private final Optional planVersionId; + private final Optional> traits; private final Map additionalProperties; @@ -44,12 +46,14 @@ private UpdatePlanBundleRequestBody( Optional> creditGrants, List entitlements, Optional plan, + Optional planVersionId, Optional> traits, Map additionalProperties) { this.billingProduct = billingProduct; this.creditGrants = creditGrants; this.entitlements = entitlements; this.plan = plan; + this.planVersionId = planVersionId; this.traits = traits; this.additionalProperties = additionalProperties; } @@ -74,6 +78,11 @@ public Optional getPlan() { return plan; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("traits") public Optional> getTraits() { return traits; @@ -95,12 +104,14 @@ private boolean equalTo(UpdatePlanBundleRequestBody other) { && creditGrants.equals(other.creditGrants) && entitlements.equals(other.entitlements) && plan.equals(other.plan) + && planVersionId.equals(other.planVersionId) && traits.equals(other.traits); } @java.lang.Override public int hashCode() { - return Objects.hash(this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.traits); + return Objects.hash( + this.billingProduct, this.creditGrants, this.entitlements, this.plan, this.planVersionId, this.traits); } @java.lang.Override @@ -122,6 +133,8 @@ public static final class Builder { private Optional plan = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional> traits = Optional.empty(); @JsonAnySetter @@ -134,6 +147,7 @@ public Builder from(UpdatePlanBundleRequestBody other) { creditGrants(other.getCreditGrants()); entitlements(other.getEntitlements()); plan(other.getPlan()); + planVersionId(other.getPlanVersionId()); traits(other.getTraits()); return this; } @@ -192,6 +206,17 @@ public Builder plan(UpdatePlanRequestBody plan) { return this; } + @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; + } + @JsonSetter(value = "traits", nulls = Nulls.SKIP) public Builder traits(Optional> traits) { this.traits = traits; @@ -205,7 +230,17 @@ public Builder traits(List traits) { public UpdatePlanBundleRequestBody build() { return new UpdatePlanBundleRequestBody( - billingProduct, creditGrants, entitlements, plan, traits, additionalProperties); + billingProduct, creditGrants, entitlements, plan, planVersionId, traits, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java b/src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java index 8994e17..d91cbf3 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java +++ b/src/main/java/com/schematic/api/resources/planbundle/types/CreatePlanBundleResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreatePlanBundleResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreatePlanBundleResponse build() { return new CreatePlanBundleResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java b/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java index ed3b008..4e5adb9 100644 --- a/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java +++ b/src/main/java/com/schematic/api/resources/planbundle/types/UpdatePlanBundleResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdatePlanBundleResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdatePlanBundleResponse build() { return new UpdatePlanBundleResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plangroups/AsyncPlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/AsyncPlangroupsClient.java index 38cd1da..49a1654 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/AsyncPlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/AsyncPlangroupsClient.java @@ -6,6 +6,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.plangroups.requests.CreatePlanGroupRequestBody; +import com.schematic.api.resources.plangroups.requests.GetPlanGroupRequest; import com.schematic.api.resources.plangroups.requests.UpdatePlanGroupRequestBody; import com.schematic.api.resources.plangroups.types.CreatePlanGroupResponse; import com.schematic.api.resources.plangroups.types.GetPlanGroupResponse; @@ -37,6 +38,15 @@ public CompletableFuture getPlanGroup(RequestOptions reque return this.rawClient.getPlanGroup(requestOptions).thenApply(response -> response.body()); } + public CompletableFuture getPlanGroup(GetPlanGroupRequest request) { + return this.rawClient.getPlanGroup(request).thenApply(response -> response.body()); + } + + public CompletableFuture getPlanGroup( + GetPlanGroupRequest request, RequestOptions requestOptions) { + return this.rawClient.getPlanGroup(request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture createPlanGroup(CreatePlanGroupRequestBody request) { return this.rawClient.createPlanGroup(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java index 7f8a97d..d3e6ecf 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/AsyncRawPlangroupsClient.java @@ -10,6 +10,7 @@ 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; @@ -17,6 +18,7 @@ import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.plangroups.requests.CreatePlanGroupRequestBody; +import com.schematic.api.resources.plangroups.requests.GetPlanGroupRequest; import com.schematic.api.resources.plangroups.requests.UpdatePlanGroupRequestBody; import com.schematic.api.resources.plangroups.types.CreatePlanGroupResponse; import com.schematic.api.resources.plangroups.types.GetPlanGroupResponse; @@ -43,21 +45,42 @@ public AsyncRawPlangroupsClient(ClientOptions clientOptions) { } public CompletableFuture> getPlanGroup() { - return getPlanGroup(null); + return getPlanGroup(GetPlanGroupRequest.builder().build()); } public CompletableFuture> getPlanGroup( RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + return getPlanGroup(GetPlanGroupRequest.builder().build(), requestOptions); + } + + public CompletableFuture> getPlanGroup( + GetPlanGroupRequest request) { + return getPlanGroup(request, null); + } + + public CompletableFuture> getPlanGroup( + GetPlanGroupRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-groups") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .addPathSegments("plan-groups"); + if (request.getIncludeCompanyCounts().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_company_counts", + request.getIncludeCompanyCounts().get(), + false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); @@ -67,13 +90,13 @@ public CompletableFuture> getPla @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanGroupResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanGroupResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -100,11 +123,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -126,10 +147,14 @@ public CompletableFuture> cre public CompletableFuture> createPlanGroup( CreatePlanGroupRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-groups") - .build(); + .addPathSegments("plan-groups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -138,7 +163,7 @@ public CompletableFuture> cre throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -153,14 +178,13 @@ public CompletableFuture> cre @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CreatePlanGroupResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanGroupResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -192,11 +216,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -218,11 +240,15 @@ public CompletableFuture> upd public CompletableFuture> updatePlanGroup( String planGroupId, UpdatePlanGroupRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-groups") - .addPathSegment(planGroupId) - .build(); + .addPathSegment(planGroupId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -231,7 +257,7 @@ public CompletableFuture> upd throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -246,14 +272,13 @@ public CompletableFuture> upd @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdatePlanGroupResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanGroupResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -285,11 +310,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java index 1855b7a..f4c3ae0 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/PlangroupsClient.java @@ -6,6 +6,7 @@ import com.schematic.api.core.ClientOptions; import com.schematic.api.core.RequestOptions; import com.schematic.api.resources.plangroups.requests.CreatePlanGroupRequestBody; +import com.schematic.api.resources.plangroups.requests.GetPlanGroupRequest; import com.schematic.api.resources.plangroups.requests.UpdatePlanGroupRequestBody; import com.schematic.api.resources.plangroups.types.CreatePlanGroupResponse; import com.schematic.api.resources.plangroups.types.GetPlanGroupResponse; @@ -36,6 +37,14 @@ public GetPlanGroupResponse getPlanGroup(RequestOptions requestOptions) { return this.rawClient.getPlanGroup(requestOptions).body(); } + public GetPlanGroupResponse getPlanGroup(GetPlanGroupRequest request) { + return this.rawClient.getPlanGroup(request).body(); + } + + public GetPlanGroupResponse getPlanGroup(GetPlanGroupRequest request, RequestOptions requestOptions) { + return this.rawClient.getPlanGroup(request, requestOptions).body(); + } + public CreatePlanGroupResponse createPlanGroup(CreatePlanGroupRequestBody request) { return this.rawClient.createPlanGroup(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java b/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java index b6c9a0c..adb0c63 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java +++ b/src/main/java/com/schematic/api/resources/plangroups/RawPlangroupsClient.java @@ -10,6 +10,7 @@ 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; @@ -17,6 +18,7 @@ import com.schematic.api.errors.NotFoundError; import com.schematic.api.errors.UnauthorizedError; import com.schematic.api.resources.plangroups.requests.CreatePlanGroupRequestBody; +import com.schematic.api.resources.plangroups.requests.GetPlanGroupRequest; import com.schematic.api.resources.plangroups.requests.UpdatePlanGroupRequestBody; import com.schematic.api.resources.plangroups.types.CreatePlanGroupResponse; import com.schematic.api.resources.plangroups.types.GetPlanGroupResponse; @@ -39,32 +41,51 @@ public RawPlangroupsClient(ClientOptions clientOptions) { } public BaseSchematicHttpResponse getPlanGroup() { - return getPlanGroup(null); + return getPlanGroup(GetPlanGroupRequest.builder().build()); } public BaseSchematicHttpResponse getPlanGroup(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + return getPlanGroup(GetPlanGroupRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse getPlanGroup(GetPlanGroupRequest request) { + return getPlanGroup(request, null); + } + + public BaseSchematicHttpResponse getPlanGroup( + GetPlanGroupRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-groups") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .addPathSegments("plan-groups"); + if (request.getIncludeCompanyCounts().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_company_counts", + request.getIncludeCompanyCounts().get(), + false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanGroupResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanGroupResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -83,11 +104,9 @@ public BaseSchematicHttpResponse getPlanGroup(RequestOptio } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -99,10 +118,14 @@ public BaseSchematicHttpResponse createPlanGroup(Create public BaseSchematicHttpResponse createPlanGroup( CreatePlanGroupRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plan-groups") - .build(); + .addPathSegments("plan-groups"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -111,7 +134,7 @@ public BaseSchematicHttpResponse createPlanGroup( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -123,12 +146,12 @@ public BaseSchematicHttpResponse createPlanGroup( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanGroupResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanGroupResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -150,11 +173,9 @@ public BaseSchematicHttpResponse createPlanGroup( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -167,11 +188,15 @@ public BaseSchematicHttpResponse updatePlanGroup( public BaseSchematicHttpResponse updatePlanGroup( String planGroupId, UpdatePlanGroupRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plan-groups") - .addPathSegment(planGroupId) - .build(); + .addPathSegment(planGroupId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -180,7 +205,7 @@ public BaseSchematicHttpResponse updatePlanGroup( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -192,12 +217,12 @@ public BaseSchematicHttpResponse updatePlanGroup( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanGroupResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanGroupResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -219,11 +244,9 @@ public BaseSchematicHttpResponse updatePlanGroup( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/CreatePlanGroupRequestBody.java index e7eda28..9133aa2 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 @@ -77,13 +77,15 @@ public final class CreatePlanGroupRequestBody { private final boolean showFeatureDescription; + private final boolean showHardLimit; + private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; private final boolean syncCustomerBillingDetails; - private final Optional trialDays; + private final Optional trialDays; private final Optional trialExpiryPlanId; @@ -118,10 +120,11 @@ private CreatePlanGroupRequestBody( boolean showAsMonthlyPrices, boolean showCredits, boolean showFeatureDescription, + boolean showHardLimit, boolean showPeriodToggle, boolean showZeroPriceAsFree, boolean syncCustomerBillingDetails, - Optional trialDays, + Optional trialDays, Optional trialExpiryPlanId, Optional trialExpiryPlanPriceId, Optional trialPaymentMethodRequired, @@ -150,6 +153,7 @@ private CreatePlanGroupRequestBody( this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showFeatureDescription = showFeatureDescription; + this.showHardLimit = showHardLimit; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; this.syncCustomerBillingDetails = syncCustomerBillingDetails; @@ -283,6 +287,11 @@ public boolean getShowFeatureDescription() { return showFeatureDescription; } + @JsonProperty("show_hard_limit") + public boolean getShowHardLimit() { + return showHardLimit; + } + @JsonProperty("show_period_toggle") public boolean getShowPeriodToggle() { return showPeriodToggle; @@ -299,7 +308,7 @@ public boolean getSyncCustomerBillingDetails() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -354,6 +363,7 @@ private boolean equalTo(CreatePlanGroupRequestBody other) { && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showFeatureDescription == other.showFeatureDescription + && showHardLimit == other.showHardLimit && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree && syncCustomerBillingDetails == other.syncCustomerBillingDetails @@ -390,6 +400,7 @@ public int hashCode() { this.showAsMonthlyPrices, this.showCredits, this.showFeatureDescription, + this.showHardLimit, this.showPeriodToggle, this.showZeroPriceAsFree, this.syncCustomerBillingDetails, @@ -447,7 +458,11 @@ public interface ShowCreditsStage { } public interface ShowFeatureDescriptionStage { - ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); + ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription); + } + + public interface ShowHardLimitStage { + ShowPeriodToggleStage showHardLimit(boolean showHardLimit); } public interface ShowPeriodToggleStage { @@ -465,6 +480,10 @@ public interface SyncCustomerBillingDetailsStage { public interface _FinalStage { CreatePlanGroupRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnCompatibilities(Optional> addOnCompatibilities); _FinalStage addOnCompatibilities(List addOnCompatibilities); @@ -532,9 +551,9 @@ public interface _FinalStage { _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage trialExpiryPlanId(Optional trialExpiryPlanId); @@ -561,6 +580,7 @@ public static final class Builder ShowAsMonthlyPricesStage, ShowCreditsStage, ShowFeatureDescriptionStage, + ShowHardLimitStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, SyncCustomerBillingDetailsStage, @@ -585,6 +605,8 @@ public static final class Builder private boolean showFeatureDescription; + private boolean showHardLimit; + private boolean showPeriodToggle; private boolean showZeroPriceAsFree; @@ -597,7 +619,7 @@ public static final class Builder private Optional trialExpiryPlanId = Optional.empty(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); @@ -658,6 +680,7 @@ public Builder from(CreatePlanGroupRequestBody other) { showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showFeatureDescription(other.getShowFeatureDescription()); + showHardLimit(other.getShowHardLimit()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); syncCustomerBillingDetails(other.getSyncCustomerBillingDetails()); @@ -733,11 +756,18 @@ public ShowFeatureDescriptionStage showCredits(boolean showCredits) { @java.lang.Override @JsonSetter("show_feature_description") - public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + public ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription) { this.showFeatureDescription = showFeatureDescription; return this; } + @java.lang.Override + @JsonSetter("show_hard_limit") + public ShowPeriodToggleStage showHardLimit(boolean showHardLimit) { + this.showHardLimit = showHardLimit; + return this; + } + @java.lang.Override @JsonSetter("show_period_toggle") public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @@ -799,14 +829,14 @@ public _FinalStage trialExpiryPlanId(Optional trialExpiryPlanId) { } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -1078,6 +1108,7 @@ public CreatePlanGroupRequestBody build() { showAsMonthlyPrices, showCredits, showFeatureDescription, + showHardLimit, showPeriodToggle, showZeroPriceAsFree, syncCustomerBillingDetails, @@ -1087,5 +1118,17 @@ public CreatePlanGroupRequestBody build() { trialPaymentMethodRequired, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/GetPlanGroupRequest.java b/src/main/java/com/schematic/api/resources/plangroups/requests/GetPlanGroupRequest.java new file mode 100644 index 0000000..7defe30 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plangroups/requests/GetPlanGroupRequest.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plangroups.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 = GetPlanGroupRequest.Builder.class) +public final class GetPlanGroupRequest { + private final Optional includeCompanyCounts; + + private final Map additionalProperties; + + private GetPlanGroupRequest(Optional includeCompanyCounts, Map additionalProperties) { + this.includeCompanyCounts = includeCompanyCounts; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("include_company_counts") + public Optional getIncludeCompanyCounts() { + return includeCompanyCounts; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetPlanGroupRequest && equalTo((GetPlanGroupRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetPlanGroupRequest other) { + return includeCompanyCounts.equals(other.includeCompanyCounts); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeCompanyCounts); + } + + @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 includeCompanyCounts = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetPlanGroupRequest other) { + includeCompanyCounts(other.getIncludeCompanyCounts()); + return this; + } + + @JsonSetter(value = "include_company_counts", nulls = Nulls.SKIP) + public Builder includeCompanyCounts(Optional includeCompanyCounts) { + this.includeCompanyCounts = includeCompanyCounts; + return this; + } + + public Builder includeCompanyCounts(Boolean includeCompanyCounts) { + this.includeCompanyCounts = Optional.ofNullable(includeCompanyCounts); + return this; + } + + public GetPlanGroupRequest build() { + return new GetPlanGroupRequest(includeCompanyCounts, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java b/src/main/java/com/schematic/api/resources/plangroups/requests/UpdatePlanGroupRequestBody.java index e698da9..120cf22 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 @@ -77,13 +77,15 @@ public final class UpdatePlanGroupRequestBody { private final boolean showFeatureDescription; + private final boolean showHardLimit; + private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; private final boolean syncCustomerBillingDetails; - private final Optional trialDays; + private final Optional trialDays; private final Optional trialExpiryPlanId; @@ -118,10 +120,11 @@ private UpdatePlanGroupRequestBody( boolean showAsMonthlyPrices, boolean showCredits, boolean showFeatureDescription, + boolean showHardLimit, boolean showPeriodToggle, boolean showZeroPriceAsFree, boolean syncCustomerBillingDetails, - Optional trialDays, + Optional trialDays, Optional trialExpiryPlanId, Optional trialExpiryPlanPriceId, Optional trialPaymentMethodRequired, @@ -150,6 +153,7 @@ private UpdatePlanGroupRequestBody( this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showFeatureDescription = showFeatureDescription; + this.showHardLimit = showHardLimit; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; this.syncCustomerBillingDetails = syncCustomerBillingDetails; @@ -283,6 +287,11 @@ public boolean getShowFeatureDescription() { return showFeatureDescription; } + @JsonProperty("show_hard_limit") + public boolean getShowHardLimit() { + return showHardLimit; + } + @JsonProperty("show_period_toggle") public boolean getShowPeriodToggle() { return showPeriodToggle; @@ -299,7 +308,7 @@ public boolean getSyncCustomerBillingDetails() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -354,6 +363,7 @@ private boolean equalTo(UpdatePlanGroupRequestBody other) { && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showFeatureDescription == other.showFeatureDescription + && showHardLimit == other.showHardLimit && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree && syncCustomerBillingDetails == other.syncCustomerBillingDetails @@ -390,6 +400,7 @@ public int hashCode() { this.showAsMonthlyPrices, this.showCredits, this.showFeatureDescription, + this.showHardLimit, this.showPeriodToggle, this.showZeroPriceAsFree, this.syncCustomerBillingDetails, @@ -447,7 +458,11 @@ public interface ShowCreditsStage { } public interface ShowFeatureDescriptionStage { - ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); + ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription); + } + + public interface ShowHardLimitStage { + ShowPeriodToggleStage showHardLimit(boolean showHardLimit); } public interface ShowPeriodToggleStage { @@ -465,6 +480,10 @@ public interface SyncCustomerBillingDetailsStage { public interface _FinalStage { UpdatePlanGroupRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnCompatibilities(Optional> addOnCompatibilities); _FinalStage addOnCompatibilities(List addOnCompatibilities); @@ -532,9 +551,9 @@ public interface _FinalStage { _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage trialExpiryPlanId(Optional trialExpiryPlanId); @@ -561,6 +580,7 @@ public static final class Builder ShowAsMonthlyPricesStage, ShowCreditsStage, ShowFeatureDescriptionStage, + ShowHardLimitStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, SyncCustomerBillingDetailsStage, @@ -585,6 +605,8 @@ public static final class Builder private boolean showFeatureDescription; + private boolean showHardLimit; + private boolean showPeriodToggle; private boolean showZeroPriceAsFree; @@ -597,7 +619,7 @@ public static final class Builder private Optional trialExpiryPlanId = Optional.empty(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); @@ -658,6 +680,7 @@ public Builder from(UpdatePlanGroupRequestBody other) { showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showFeatureDescription(other.getShowFeatureDescription()); + showHardLimit(other.getShowHardLimit()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); syncCustomerBillingDetails(other.getSyncCustomerBillingDetails()); @@ -733,11 +756,18 @@ public ShowFeatureDescriptionStage showCredits(boolean showCredits) { @java.lang.Override @JsonSetter("show_feature_description") - public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + public ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription) { this.showFeatureDescription = showFeatureDescription; return this; } + @java.lang.Override + @JsonSetter("show_hard_limit") + public ShowPeriodToggleStage showHardLimit(boolean showHardLimit) { + this.showHardLimit = showHardLimit; + return this; + } + @java.lang.Override @JsonSetter("show_period_toggle") public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @@ -799,14 +829,14 @@ public _FinalStage trialExpiryPlanId(Optional trialExpiryPlanId) { } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -1078,6 +1108,7 @@ public UpdatePlanGroupRequestBody build() { showAsMonthlyPrices, showCredits, showFeatureDescription, + showHardLimit, showPeriodToggle, showZeroPriceAsFree, syncCustomerBillingDetails, @@ -1087,5 +1118,17 @@ public UpdatePlanGroupRequestBody build() { trialPaymentMethodRequired, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plangroups/types/CreatePlanGroupResponse.java b/src/main/java/com/schematic/api/resources/plangroups/types/CreatePlanGroupResponse.java index 8e91d3a..6e74aa7 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/types/CreatePlanGroupResponse.java +++ b/src/main/java/com/schematic/api/resources/plangroups/types/CreatePlanGroupResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreatePlanGroupResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreatePlanGroupResponse build() { return new CreatePlanGroupResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupParams.java b/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupParams.java new file mode 100644 index 0000000..5dad8fa --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupParams.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plangroups.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 = GetPlanGroupParams.Builder.class) +public final class GetPlanGroupParams { + private final Optional includeCompanyCounts; + + private final Map additionalProperties; + + private GetPlanGroupParams(Optional includeCompanyCounts, Map additionalProperties) { + this.includeCompanyCounts = includeCompanyCounts; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("include_company_counts") + public Optional getIncludeCompanyCounts() { + return includeCompanyCounts; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetPlanGroupParams && equalTo((GetPlanGroupParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetPlanGroupParams other) { + return includeCompanyCounts.equals(other.includeCompanyCounts); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeCompanyCounts); + } + + @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 includeCompanyCounts = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetPlanGroupParams other) { + includeCompanyCounts(other.getIncludeCompanyCounts()); + return this; + } + + @JsonSetter(value = "include_company_counts", nulls = Nulls.SKIP) + public Builder includeCompanyCounts(Optional includeCompanyCounts) { + this.includeCompanyCounts = includeCompanyCounts; + return this; + } + + public Builder includeCompanyCounts(Boolean includeCompanyCounts) { + this.includeCompanyCounts = Optional.ofNullable(includeCompanyCounts); + return this; + } + + public GetPlanGroupParams build() { + return new GetPlanGroupParams(includeCompanyCounts, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupResponse.java b/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupResponse.java index c16d1b6..92e908f 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupResponse.java +++ b/src/main/java/com/schematic/api/resources/plangroups/types/GetPlanGroupResponse.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.PlanGroupDetailResponseData; 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 GetPlanGroupResponse { private final PlanGroupDetailResponseData data; - private final Map params; + private final GetPlanGroupParams params; private final Map additionalProperties; private GetPlanGroupResponse( - PlanGroupDetailResponseData data, Map params, Map additionalProperties) { + PlanGroupDetailResponseData data, GetPlanGroupParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -45,7 +42,7 @@ public PlanGroupDetailResponseData getData() { * @return Input parameters */ @JsonProperty("params") - public Map getParams() { + public GetPlanGroupParams getParams() { return params; } @@ -79,29 +76,31 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull PlanGroupDetailResponseData data); + ParamsStage data(@NotNull PlanGroupDetailResponseData data); Builder from(GetPlanGroupResponse other); } - public interface _FinalStage { - GetPlanGroupResponse build(); - + public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(Map params); + _FinalStage params(@NotNull GetPlanGroupParams params); + } - _FinalStage putAllParams(Map params); + public interface _FinalStage { + GetPlanGroupResponse build(); - _FinalStage params(String key, JsonNode value); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DataStage, _FinalStage { + public static final class Builder implements DataStage, ParamsStage, _FinalStage { private PlanGroupDetailResponseData data; - private Map params = new LinkedHashMap<>(); + private GetPlanGroupParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -117,49 +116,38 @@ public Builder from(GetPlanGroupResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull PlanGroupDetailResponseData data) { + public ParamsStage data(@NotNull PlanGroupDetailResponseData 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 - public _FinalStage params(String key, JsonNode value) { - this.params.put(key, value); + @JsonSetter("params") + public _FinalStage params(@NotNull GetPlanGroupParams params) { + this.params = Objects.requireNonNull(params, "params 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 putAllParams(Map params) { - if (params != null) { - this.params.putAll(params); - } - return this; + public GetPlanGroupResponse build() { + return new GetPlanGroupResponse(data, params, additionalProperties); } - /** - *

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); - } + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); return this; } @java.lang.Override - public GetPlanGroupResponse build() { - return new GetPlanGroupResponse(data, params, additionalProperties); + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/plangroups/types/UpdatePlanGroupResponse.java b/src/main/java/com/schematic/api/resources/plangroups/types/UpdatePlanGroupResponse.java index 4bec0d7..f0972ca 100644 --- a/src/main/java/com/schematic/api/resources/plangroups/types/UpdatePlanGroupResponse.java +++ b/src/main/java/com/schematic/api/resources/plangroups/types/UpdatePlanGroupResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdatePlanGroupResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdatePlanGroupResponse build() { return new UpdatePlanGroupResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java new file mode 100644 index 0000000..448e672 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncPlanmigrationsClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; +import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncPlanmigrationsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPlanmigrationsClient rawClient; + + public AsyncPlanmigrationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPlanmigrationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPlanmigrationsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture listCompanyMigrations() { + return this.rawClient.listCompanyMigrations().thenApply(response -> response.body()); + } + + public CompletableFuture listCompanyMigrations(RequestOptions requestOptions) { + return this.rawClient.listCompanyMigrations(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listCompanyMigrations( + ListCompanyMigrationsRequest request) { + return this.rawClient.listCompanyMigrations(request).thenApply(response -> response.body()); + } + + public CompletableFuture listCompanyMigrations( + ListCompanyMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.listCompanyMigrations(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countCompanyMigrations() { + return this.rawClient.countCompanyMigrations().thenApply(response -> response.body()); + } + + public CompletableFuture countCompanyMigrations(RequestOptions requestOptions) { + return this.rawClient.countCompanyMigrations(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countCompanyMigrations( + CountCompanyMigrationsRequest request) { + return this.rawClient.countCompanyMigrations(request).thenApply(response -> response.body()); + } + + public CompletableFuture countCompanyMigrations( + CountCompanyMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.countCompanyMigrations(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listMigrations() { + return this.rawClient.listMigrations().thenApply(response -> response.body()); + } + + public CompletableFuture listMigrations(RequestOptions requestOptions) { + return this.rawClient.listMigrations(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listMigrations(ListMigrationsRequest request) { + return this.rawClient.listMigrations(request).thenApply(response -> response.body()); + } + + public CompletableFuture listMigrations( + ListMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.listMigrations(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture getMigration(String planVersionMigrationId) { + return this.rawClient.getMigration(planVersionMigrationId).thenApply(response -> response.body()); + } + + public CompletableFuture getMigration( + String planVersionMigrationId, RequestOptions requestOptions) { + return this.rawClient + .getMigration(planVersionMigrationId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture countMigrations() { + return this.rawClient.countMigrations().thenApply(response -> response.body()); + } + + public CompletableFuture countMigrations(RequestOptions requestOptions) { + return this.rawClient.countMigrations(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture countMigrations(CountMigrationsRequest request) { + return this.rawClient.countMigrations(request).thenApply(response -> response.body()); + } + + public CompletableFuture countMigrations( + CountMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.countMigrations(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java new file mode 100644 index 0000000..b948f0b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/AsyncRawPlanmigrationsClient.java @@ -0,0 +1,576 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.schematic.api.core.BaseSchematicApiException; +import com.schematic.api.core.BaseSchematicException; +import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.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.planmigrations.requests.CountCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; +import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPlanmigrationsClient { + protected final ClientOptions clientOptions; + + public AsyncRawPlanmigrationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> listCompanyMigrations() { + return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build()); + } + + public CompletableFuture> listCompanyMigrations( + RequestOptions requestOptions) { + return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> listCompanyMigrations( + ListCompanyMigrationsRequest request) { + return listCompanyMigrations(request, null); + } + + public CompletableFuture> listCompanyMigrations( + ListCompanyMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-company-migrations"); + if (request.getMigrationId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "migration_id", request.getMigrationId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListCompanyMigrationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> countCompanyMigrations() { + return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build()); + } + + public CompletableFuture> countCompanyMigrations( + RequestOptions requestOptions) { + return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> countCompanyMigrations( + CountCompanyMigrationsRequest request) { + return countCompanyMigrations(request, null); + } + + public CompletableFuture> countCompanyMigrations( + CountCompanyMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-company-migrations/count"); + if (request.getMigrationId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "migration_id", request.getMigrationId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CountCompanyMigrationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listMigrations() { + return listMigrations(ListMigrationsRequest.builder().build()); + } + + public CompletableFuture> listMigrations( + RequestOptions requestOptions) { + return listMigrations(ListMigrationsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> listMigrations( + ListMigrationsRequest request) { + return listMigrations(request, null); + } + + public CompletableFuture> listMigrations( + ListMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations"); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMigrationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> getMigration( + String planVersionMigrationId) { + return getMigration(planVersionMigrationId, null); + } + + public CompletableFuture> getMigration( + String planVersionMigrationId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetMigrationResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> countMigrations() { + return countMigrations(CountMigrationsRequest.builder().build()); + } + + public CompletableFuture> countMigrations( + RequestOptions requestOptions) { + return countMigrations(CountMigrationsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> countMigrations( + CountMigrationsRequest request) { + return countMigrations(request, null); + } + + public CompletableFuture> countMigrations( + CountMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations/count"); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountMigrationsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java new file mode 100644 index 0000000..b837657 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/PlanmigrationsClient.java @@ -0,0 +1,110 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.planmigrations.requests.CountCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; +import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; + +public class PlanmigrationsClient { + protected final ClientOptions clientOptions; + + private final RawPlanmigrationsClient rawClient; + + public PlanmigrationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPlanmigrationsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPlanmigrationsClient withRawResponse() { + return this.rawClient; + } + + public ListCompanyMigrationsResponse listCompanyMigrations() { + return this.rawClient.listCompanyMigrations().body(); + } + + public ListCompanyMigrationsResponse listCompanyMigrations(RequestOptions requestOptions) { + return this.rawClient.listCompanyMigrations(requestOptions).body(); + } + + public ListCompanyMigrationsResponse listCompanyMigrations(ListCompanyMigrationsRequest request) { + return this.rawClient.listCompanyMigrations(request).body(); + } + + public ListCompanyMigrationsResponse listCompanyMigrations( + ListCompanyMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.listCompanyMigrations(request, requestOptions).body(); + } + + public CountCompanyMigrationsResponse countCompanyMigrations() { + return this.rawClient.countCompanyMigrations().body(); + } + + public CountCompanyMigrationsResponse countCompanyMigrations(RequestOptions requestOptions) { + return this.rawClient.countCompanyMigrations(requestOptions).body(); + } + + public CountCompanyMigrationsResponse countCompanyMigrations(CountCompanyMigrationsRequest request) { + return this.rawClient.countCompanyMigrations(request).body(); + } + + public CountCompanyMigrationsResponse countCompanyMigrations( + CountCompanyMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.countCompanyMigrations(request, requestOptions).body(); + } + + public ListMigrationsResponse listMigrations() { + return this.rawClient.listMigrations().body(); + } + + public ListMigrationsResponse listMigrations(RequestOptions requestOptions) { + return this.rawClient.listMigrations(requestOptions).body(); + } + + public ListMigrationsResponse listMigrations(ListMigrationsRequest request) { + return this.rawClient.listMigrations(request).body(); + } + + public ListMigrationsResponse listMigrations(ListMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.listMigrations(request, requestOptions).body(); + } + + public GetMigrationResponse getMigration(String planVersionMigrationId) { + return this.rawClient.getMigration(planVersionMigrationId).body(); + } + + public GetMigrationResponse getMigration(String planVersionMigrationId, RequestOptions requestOptions) { + return this.rawClient + .getMigration(planVersionMigrationId, requestOptions) + .body(); + } + + public CountMigrationsResponse countMigrations() { + return this.rawClient.countMigrations().body(); + } + + public CountMigrationsResponse countMigrations(RequestOptions requestOptions) { + return this.rawClient.countMigrations(requestOptions).body(); + } + + public CountMigrationsResponse countMigrations(CountMigrationsRequest request) { + return this.rawClient.countMigrations(request).body(); + } + + public CountMigrationsResponse countMigrations(CountMigrationsRequest request, RequestOptions requestOptions) { + return this.rawClient.countMigrations(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java new file mode 100644 index 0000000..964fae3 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/RawPlanmigrationsClient.java @@ -0,0 +1,451 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.schematic.api.core.BaseSchematicApiException; +import com.schematic.api.core.BaseSchematicException; +import com.schematic.api.core.BaseSchematicHttpResponse; +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.core.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.planmigrations.requests.CountCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.CountMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListCompanyMigrationsRequest; +import com.schematic.api.resources.planmigrations.requests.ListMigrationsRequest; +import com.schematic.api.resources.planmigrations.types.CountCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.CountMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.GetMigrationResponse; +import com.schematic.api.resources.planmigrations.types.ListCompanyMigrationsResponse; +import com.schematic.api.resources.planmigrations.types.ListMigrationsResponse; +import com.schematic.api.types.ApiError; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPlanmigrationsClient { + protected final ClientOptions clientOptions; + + public RawPlanmigrationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public BaseSchematicHttpResponse listCompanyMigrations() { + return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build()); + } + + public BaseSchematicHttpResponse listCompanyMigrations( + RequestOptions requestOptions) { + return listCompanyMigrations(ListCompanyMigrationsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse listCompanyMigrations( + ListCompanyMigrationsRequest request) { + return listCompanyMigrations(request, null); + } + + public BaseSchematicHttpResponse listCompanyMigrations( + ListCompanyMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-company-migrations"); + if (request.getMigrationId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "migration_id", request.getMigrationId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCompanyMigrationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse countCompanyMigrations() { + return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build()); + } + + public BaseSchematicHttpResponse countCompanyMigrations( + RequestOptions requestOptions) { + return countCompanyMigrations(CountCompanyMigrationsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse countCompanyMigrations( + CountCompanyMigrationsRequest request) { + return countCompanyMigrations(request, null); + } + + public BaseSchematicHttpResponse countCompanyMigrations( + CountCompanyMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-company-migrations/count"); + if (request.getMigrationId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "migration_id", request.getMigrationId().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountCompanyMigrationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse listMigrations() { + return listMigrations(ListMigrationsRequest.builder().build()); + } + + public BaseSchematicHttpResponse listMigrations(RequestOptions requestOptions) { + return listMigrations(ListMigrationsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse listMigrations(ListMigrationsRequest request) { + return listMigrations(request, null); + } + + public BaseSchematicHttpResponse listMigrations( + ListMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations"); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMigrationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getMigration(String planVersionMigrationId) { + return getMigration(planVersionMigrationId, null); + } + + public BaseSchematicHttpResponse getMigration( + String planVersionMigrationId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations") + .addPathSegment(planVersionMigrationId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetMigrationResponse.class), response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse countMigrations() { + return countMigrations(CountMigrationsRequest.builder().build()); + } + + public BaseSchematicHttpResponse countMigrations(RequestOptions requestOptions) { + return countMigrations(CountMigrationsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse countMigrations(CountMigrationsRequest request) { + return countMigrations(request, null); + } + + public BaseSchematicHttpResponse countMigrations( + CountMigrationsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plan-version-migrations/count"); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountMigrationsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/CountApiRequestsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java similarity index 51% rename from src/main/java/com/schematic/api/resources/accounts/requests/CountApiRequestsRequest.java rename to src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java index b6e8e81..91d85ff 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/CountApiRequestsRequest.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountCompanyMigrationsRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.requests; +package com.schematic.api.resources.planmigrations.requests; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,61 +12,62 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanVersionCompanyMigrationStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountApiRequestsRequest.Builder.class) -public final class CountApiRequestsRequest { - private final Optional q; +@JsonDeserialize(builder = CountCompanyMigrationsRequest.Builder.class) +public final class CountCompanyMigrationsRequest { + private final Optional migrationId; - private final Optional requestType; + private final Optional q; - private final Optional environmentId; + private final Optional status; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; - private CountApiRequestsRequest( + private CountCompanyMigrationsRequest( + Optional migrationId, Optional q, - Optional requestType, - Optional environmentId, - Optional limit, - Optional offset, + Optional status, + Optional limit, + Optional offset, Map additionalProperties) { + this.migrationId = migrationId; this.q = q; - this.requestType = requestType; - this.environmentId = environmentId; + this.status = status; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } + @JsonProperty("migration_id") + public Optional getMigrationId() { + return migrationId; + } + @JsonProperty("q") public Optional getQ() { return q; } - @JsonProperty("request_type") - public Optional getRequestType() { - return requestType; - } - - @JsonProperty("environment_id") - public Optional getEnvironmentId() { - return environmentId; + @JsonProperty("status") + public Optional getStatus() { + return status; } /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -74,14 +75,14 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountApiRequestsRequest && equalTo((CountApiRequestsRequest) other); + return other instanceof CountCompanyMigrationsRequest && equalTo((CountCompanyMigrationsRequest) other); } @JsonAnyGetter @@ -89,17 +90,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountApiRequestsRequest other) { - return q.equals(other.q) - && requestType.equals(other.requestType) - && environmentId.equals(other.environmentId) + private boolean equalTo(CountCompanyMigrationsRequest other) { + return migrationId.equals(other.migrationId) + && q.equals(other.q) + && status.equals(other.status) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.q, this.requestType, this.environmentId, this.limit, this.offset); + return Objects.hash(this.migrationId, this.q, this.status, this.limit, this.offset); } @java.lang.Override @@ -113,60 +114,60 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional q = Optional.empty(); + private Optional migrationId = Optional.empty(); - private Optional requestType = Optional.empty(); + private Optional q = Optional.empty(); - private Optional environmentId = Optional.empty(); + private Optional status = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(CountApiRequestsRequest other) { + public Builder from(CountCompanyMigrationsRequest other) { + migrationId(other.getMigrationId()); q(other.getQ()); - requestType(other.getRequestType()); - environmentId(other.getEnvironmentId()); + status(other.getStatus()); limit(other.getLimit()); offset(other.getOffset()); return this; } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @JsonSetter(value = "migration_id", nulls = Nulls.SKIP) + public Builder migrationId(Optional migrationId) { + this.migrationId = migrationId; return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + public Builder migrationId(String migrationId) { + this.migrationId = Optional.ofNullable(migrationId); return this; } - @JsonSetter(value = "request_type", nulls = Nulls.SKIP) - public Builder requestType(Optional requestType) { - this.requestType = requestType; + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; return this; } - public Builder requestType(String requestType) { - this.requestType = Optional.ofNullable(requestType); + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } - @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) - public Builder environmentId(Optional environmentId) { - this.environmentId = environmentId; + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; return this; } - public Builder environmentId(String environmentId) { - this.environmentId = Optional.ofNullable(environmentId); + public Builder status(PlanVersionCompanyMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } @@ -174,12 +175,12 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } - public CountApiRequestsRequest build() { - return new CountApiRequestsRequest(q, requestType, environmentId, limit, offset, additionalProperties); + public CountCompanyMigrationsRequest build() { + return new CountCompanyMigrationsRequest(migrationId, q, status, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java new file mode 100644 index 0000000..85886dc --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/CountMigrationsRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountMigrationsRequest.Builder.class) +public final class CountMigrationsRequest { + private final Optional planVersionId; + + private final Optional status; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private CountMigrationsRequest( + Optional planVersionId, + Optional status, + Optional limit, + Optional offset, + Map additionalProperties) { + this.planVersionId = planVersionId; + this.status = status; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @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 CountMigrationsRequest && equalTo((CountMigrationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountMigrationsRequest other) { + return planVersionId.equals(other.planVersionId) + && status.equals(other.status) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planVersionId, this.status, 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 planVersionId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountMigrationsRequest other) { + planVersionId(other.getPlanVersionId()); + status(other.getStatus()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(PlanVersionMigrationStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public CountMigrationsRequest build() { + return new CountMigrationsRequest(planVersionId, status, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/requests/ListApiRequestsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java similarity index 51% rename from src/main/java/com/schematic/api/resources/accounts/requests/ListApiRequestsRequest.java rename to src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java index dcb8d71..6c93fb6 100644 --- a/src/main/java/com/schematic/api/resources/accounts/requests/ListApiRequestsRequest.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListCompanyMigrationsRequest.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.requests; +package com.schematic.api.resources.planmigrations.requests; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,61 +12,62 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanVersionCompanyMigrationStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListApiRequestsRequest.Builder.class) -public final class ListApiRequestsRequest { - private final Optional q; +@JsonDeserialize(builder = ListCompanyMigrationsRequest.Builder.class) +public final class ListCompanyMigrationsRequest { + private final Optional migrationId; - private final Optional requestType; + private final Optional q; - private final Optional environmentId; + private final Optional status; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; - private ListApiRequestsRequest( + private ListCompanyMigrationsRequest( + Optional migrationId, Optional q, - Optional requestType, - Optional environmentId, - Optional limit, - Optional offset, + Optional status, + Optional limit, + Optional offset, Map additionalProperties) { + this.migrationId = migrationId; this.q = q; - this.requestType = requestType; - this.environmentId = environmentId; + this.status = status; this.limit = limit; this.offset = offset; this.additionalProperties = additionalProperties; } + @JsonProperty("migration_id") + public Optional getMigrationId() { + return migrationId; + } + @JsonProperty("q") public Optional getQ() { return q; } - @JsonProperty("request_type") - public Optional getRequestType() { - return requestType; - } - - @JsonProperty("environment_id") - public Optional getEnvironmentId() { - return environmentId; + @JsonProperty("status") + public Optional getStatus() { + return status; } /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -74,14 +75,14 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListApiRequestsRequest && equalTo((ListApiRequestsRequest) other); + return other instanceof ListCompanyMigrationsRequest && equalTo((ListCompanyMigrationsRequest) other); } @JsonAnyGetter @@ -89,17 +90,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListApiRequestsRequest other) { - return q.equals(other.q) - && requestType.equals(other.requestType) - && environmentId.equals(other.environmentId) + private boolean equalTo(ListCompanyMigrationsRequest other) { + return migrationId.equals(other.migrationId) + && q.equals(other.q) + && status.equals(other.status) && limit.equals(other.limit) && offset.equals(other.offset); } @java.lang.Override public int hashCode() { - return Objects.hash(this.q, this.requestType, this.environmentId, this.limit, this.offset); + return Objects.hash(this.migrationId, this.q, this.status, this.limit, this.offset); } @java.lang.Override @@ -113,60 +114,60 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional q = Optional.empty(); + private Optional migrationId = Optional.empty(); - private Optional requestType = Optional.empty(); + private Optional q = Optional.empty(); - private Optional environmentId = Optional.empty(); + private Optional status = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(ListApiRequestsRequest other) { + public Builder from(ListCompanyMigrationsRequest other) { + migrationId(other.getMigrationId()); q(other.getQ()); - requestType(other.getRequestType()); - environmentId(other.getEnvironmentId()); + status(other.getStatus()); limit(other.getLimit()); offset(other.getOffset()); return this; } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; + @JsonSetter(value = "migration_id", nulls = Nulls.SKIP) + public Builder migrationId(Optional migrationId) { + this.migrationId = migrationId; return this; } - public Builder q(String q) { - this.q = Optional.ofNullable(q); + public Builder migrationId(String migrationId) { + this.migrationId = Optional.ofNullable(migrationId); return this; } - @JsonSetter(value = "request_type", nulls = Nulls.SKIP) - public Builder requestType(Optional requestType) { - this.requestType = requestType; + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; return this; } - public Builder requestType(String requestType) { - this.requestType = Optional.ofNullable(requestType); + public Builder q(String q) { + this.q = Optional.ofNullable(q); return this; } - @JsonSetter(value = "environment_id", nulls = Nulls.SKIP) - public Builder environmentId(Optional environmentId) { - this.environmentId = environmentId; + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; return this; } - public Builder environmentId(String environmentId) { - this.environmentId = Optional.ofNullable(environmentId); + public Builder status(PlanVersionCompanyMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } @@ -174,12 +175,12 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } - public ListApiRequestsRequest build() { - return new ListApiRequestsRequest(q, requestType, environmentId, limit, offset, additionalProperties); + public ListCompanyMigrationsRequest build() { + return new ListCompanyMigrationsRequest(migrationId, q, status, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java new file mode 100644 index 0000000..6e63f5b --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/requests/ListMigrationsRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMigrationsRequest.Builder.class) +public final class ListMigrationsRequest { + private final Optional planVersionId; + + private final Optional status; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListMigrationsRequest( + Optional planVersionId, + Optional status, + Optional limit, + Optional offset, + Map additionalProperties) { + this.planVersionId = planVersionId; + this.status = status; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @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 ListMigrationsRequest && equalTo((ListMigrationsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMigrationsRequest other) { + return planVersionId.equals(other.planVersionId) + && status.equals(other.status) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planVersionId, this.status, 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 planVersionId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListMigrationsRequest other) { + planVersionId(other.getPlanVersionId()); + status(other.getStatus()); + limit(other.getLimit()); + offset(other.getOffset()); + return this; + } + + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(PlanVersionMigrationStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public ListMigrationsRequest build() { + return new ListMigrationsRequest(planVersionId, status, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/ListApiRequestsParams.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsParams.java similarity index 51% rename from src/main/java/com/schematic/api/resources/accounts/types/ListApiRequestsParams.java rename to src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsParams.java index c39baef..0d0e9be 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/ListApiRequestsParams.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsParams.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.planmigrations.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,59 +12,60 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanVersionCompanyMigrationStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListApiRequestsParams.Builder.class) -public final class ListApiRequestsParams { - private final Optional environmentId; +@JsonDeserialize(builder = CountCompanyMigrationsParams.Builder.class) +public final class CountCompanyMigrationsParams { + private final Optional limit; - private final Optional limit; + private final Optional migrationId; - private final Optional offset; + private final Optional offset; private final Optional q; - private final Optional requestType; + private final Optional status; private final Map additionalProperties; - private ListApiRequestsParams( - Optional environmentId, - Optional limit, - Optional offset, + private CountCompanyMigrationsParams( + Optional limit, + Optional migrationId, + Optional offset, Optional q, - Optional requestType, + Optional status, Map additionalProperties) { - this.environmentId = environmentId; this.limit = limit; + this.migrationId = migrationId; this.offset = offset; this.q = q; - this.requestType = requestType; + this.status = status; this.additionalProperties = additionalProperties; } - @JsonProperty("environment_id") - public Optional getEnvironmentId() { - return environmentId; - } - /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } + @JsonProperty("migration_id") + public Optional getMigrationId() { + return migrationId; + } + /** * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -73,15 +74,15 @@ public Optional getQ() { return q; } - @JsonProperty("request_type") - public Optional getRequestType() { - return requestType; + @JsonProperty("status") + public Optional getStatus() { + return status; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListApiRequestsParams && equalTo((ListApiRequestsParams) other); + return other instanceof CountCompanyMigrationsParams && equalTo((CountCompanyMigrationsParams) other); } @JsonAnyGetter @@ -89,17 +90,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListApiRequestsParams other) { - return environmentId.equals(other.environmentId) - && limit.equals(other.limit) + private boolean equalTo(CountCompanyMigrationsParams other) { + return limit.equals(other.limit) + && migrationId.equals(other.migrationId) && offset.equals(other.offset) && q.equals(other.q) - && requestType.equals(other.requestType); + && status.equals(other.status); } @java.lang.Override public int hashCode() { - return Objects.hash(this.environmentId, this.limit, this.offset, this.q, this.requestType); + return Objects.hash(this.limit, this.migrationId, this.offset, this.q, this.status); } @java.lang.Override @@ -113,38 +114,27 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional environmentId = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional migrationId = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); - private Optional requestType = Optional.empty(); + private Optional status = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(ListApiRequestsParams other) { - environmentId(other.getEnvironmentId()); + public Builder from(CountCompanyMigrationsParams other) { limit(other.getLimit()); + migrationId(other.getMigrationId()); offset(other.getOffset()); q(other.getQ()); - requestType(other.getRequestType()); - 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); + status(other.getStatus()); return this; } @@ -152,26 +142,37 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -187,19 +188,29 @@ public Builder q(String q) { return this; } - @JsonSetter(value = "request_type", nulls = Nulls.SKIP) - public Builder requestType(Optional requestType) { - this.requestType = requestType; + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; return this; } - public Builder requestType(String requestType) { - this.requestType = Optional.ofNullable(requestType); + public Builder status(PlanVersionCompanyMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } - public ListApiRequestsParams build() { - return new ListApiRequestsParams(environmentId, limit, offset, q, requestType, additionalProperties); + public CountCompanyMigrationsParams build() { + return new CountCompanyMigrationsParams(limit, migrationId, offset, q, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsResponse.java new file mode 100644 index 0000000..a44b027 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CountCompanyMigrationsResponse.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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 = CountCompanyMigrationsResponse.Builder.class) +public final class CountCompanyMigrationsResponse { + private final CountResponse data; + + private final CountCompanyMigrationsParams params; + + private final Map additionalProperties; + + private CountCompanyMigrationsResponse( + CountResponse data, CountCompanyMigrationsParams 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 CountCompanyMigrationsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountCompanyMigrationsResponse && equalTo((CountCompanyMigrationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountCompanyMigrationsResponse 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(CountCompanyMigrationsResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull CountCompanyMigrationsParams params); + } + + public interface _FinalStage { + CountCompanyMigrationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private CountResponse data; + + private CountCompanyMigrationsParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CountCompanyMigrationsResponse 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 CountCompanyMigrationsParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public CountCompanyMigrationsResponse build() { + return new CountCompanyMigrationsResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsParams.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsParams.java new file mode 100644 index 0000000..ca7b54f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsParams.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CountMigrationsParams.Builder.class) +public final class CountMigrationsParams { + private final Optional limit; + + private final Optional offset; + + private final Optional planVersionId; + + private final Optional status; + + private final Map additionalProperties; + + private CountMigrationsParams( + Optional limit, + Optional offset, + Optional planVersionId, + Optional status, + Map additionalProperties) { + this.limit = limit; + this.offset = offset; + this.planVersionId = planVersionId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CountMigrationsParams && equalTo((CountMigrationsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CountMigrationsParams other) { + return limit.equals(other.limit) + && offset.equals(other.offset) + && planVersionId.equals(other.planVersionId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.limit, this.offset, this.planVersionId, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional planVersionId = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CountMigrationsParams other) { + limit(other.getLimit()); + offset(other.getOffset()); + planVersionId(other.getPlanVersionId()); + status(other.getStatus()); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(PlanVersionMigrationStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public CountMigrationsParams build() { + return new CountMigrationsParams(limit, offset, planVersionId, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountApiRequestsResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsResponse.java similarity index 65% rename from src/main/java/com/schematic/api/resources/accounts/types/CountApiRequestsResponse.java rename to src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsResponse.java index a1f1795..f565513 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CountApiRequestsResponse.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/CountMigrationsResponse.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.planmigrations.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -18,16 +18,16 @@ import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountApiRequestsResponse.Builder.class) -public final class CountApiRequestsResponse { +@JsonDeserialize(builder = CountMigrationsResponse.Builder.class) +public final class CountMigrationsResponse { private final CountResponse data; - private final CountApiRequestsParams params; + private final CountMigrationsParams params; private final Map additionalProperties; - private CountApiRequestsResponse( - CountResponse data, CountApiRequestsParams params, Map additionalProperties) { + private CountMigrationsResponse( + CountResponse data, CountMigrationsParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -42,14 +42,14 @@ public CountResponse getData() { * @return Input parameters */ @JsonProperty("params") - public CountApiRequestsParams getParams() { + public CountMigrationsParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountApiRequestsResponse && equalTo((CountApiRequestsResponse) other); + return other instanceof CountMigrationsResponse && equalTo((CountMigrationsResponse) other); } @JsonAnyGetter @@ -57,7 +57,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountApiRequestsResponse other) { + private boolean equalTo(CountMigrationsResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -78,25 +78,29 @@ public static DataStage builder() { public interface DataStage { ParamsStage data(@NotNull CountResponse data); - Builder from(CountApiRequestsResponse other); + Builder from(CountMigrationsResponse other); } public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull CountApiRequestsParams params); + _FinalStage params(@NotNull CountMigrationsParams params); } public interface _FinalStage { - CountApiRequestsResponse build(); + CountMigrationsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DataStage, ParamsStage, _FinalStage { private CountResponse data; - private CountApiRequestsParams params; + private CountMigrationsParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -104,7 +108,7 @@ public static final class Builder implements DataStage, ParamsStage, _FinalStage private Builder() {} @java.lang.Override - public Builder from(CountApiRequestsResponse other) { + public Builder from(CountMigrationsResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -124,14 +128,26 @@ public ParamsStage data(@NotNull CountResponse data) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull CountApiRequestsParams params) { + public _FinalStage params(@NotNull CountMigrationsParams params) { this.params = Objects.requireNonNull(params, "params must not be null"); return this; } @java.lang.Override - public CountApiRequestsResponse build() { - return new CountApiRequestsResponse(data, params, additionalProperties); + public CountMigrationsResponse build() { + return new CountMigrationsResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/types/GetMigrationResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/GetMigrationResponse.java new file mode 100644 index 0000000..d3f4992 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/GetMigrationResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationResponseData; +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 = GetMigrationResponse.Builder.class) +public final class GetMigrationResponse { + private final PlanVersionMigrationResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private GetMigrationResponse( + PlanVersionMigrationResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanVersionMigrationResponseData 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 GetMigrationResponse && equalTo((GetMigrationResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetMigrationResponse 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 PlanVersionMigrationResponseData data); + + Builder from(GetMigrationResponse other); + } + + public interface _FinalStage { + GetMigrationResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PlanVersionMigrationResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetMigrationResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanVersionMigrationResponseData 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 GetMigrationResponse build() { + return new GetMigrationResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/accounts/types/CountApiRequestsParams.java b/src/main/java/com/schematic/api/resources/planmigrations/types/ListCompanyMigrationsParams.java similarity index 51% rename from src/main/java/com/schematic/api/resources/accounts/types/CountApiRequestsParams.java rename to src/main/java/com/schematic/api/resources/planmigrations/types/ListCompanyMigrationsParams.java index de2cc99..28c632f 100644 --- a/src/main/java/com/schematic/api/resources/accounts/types/CountApiRequestsParams.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/ListCompanyMigrationsParams.java @@ -1,7 +1,7 @@ /** * This file was auto-generated by Fern from our API Definition. */ -package com.schematic.api.resources.accounts.types; +package com.schematic.api.resources.planmigrations.types; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; @@ -12,59 +12,60 @@ import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanVersionCompanyMigrationStatus; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CountApiRequestsParams.Builder.class) -public final class CountApiRequestsParams { - private final Optional environmentId; +@JsonDeserialize(builder = ListCompanyMigrationsParams.Builder.class) +public final class ListCompanyMigrationsParams { + private final Optional limit; - private final Optional limit; + private final Optional migrationId; - private final Optional offset; + private final Optional offset; private final Optional q; - private final Optional requestType; + private final Optional status; private final Map additionalProperties; - private CountApiRequestsParams( - Optional environmentId, - Optional limit, - Optional offset, + private ListCompanyMigrationsParams( + Optional limit, + Optional migrationId, + Optional offset, Optional q, - Optional requestType, + Optional status, Map additionalProperties) { - this.environmentId = environmentId; this.limit = limit; + this.migrationId = migrationId; this.offset = offset; this.q = q; - this.requestType = requestType; + this.status = status; this.additionalProperties = additionalProperties; } - @JsonProperty("environment_id") - public Optional getEnvironmentId() { - return environmentId; - } - /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } + @JsonProperty("migration_id") + public Optional getMigrationId() { + return migrationId; + } + /** * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -73,15 +74,15 @@ public Optional getQ() { return q; } - @JsonProperty("request_type") - public Optional getRequestType() { - return requestType; + @JsonProperty("status") + public Optional getStatus() { + return status; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof CountApiRequestsParams && equalTo((CountApiRequestsParams) other); + return other instanceof ListCompanyMigrationsParams && equalTo((ListCompanyMigrationsParams) other); } @JsonAnyGetter @@ -89,17 +90,17 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(CountApiRequestsParams other) { - return environmentId.equals(other.environmentId) - && limit.equals(other.limit) + private boolean equalTo(ListCompanyMigrationsParams other) { + return limit.equals(other.limit) + && migrationId.equals(other.migrationId) && offset.equals(other.offset) && q.equals(other.q) - && requestType.equals(other.requestType); + && status.equals(other.status); } @java.lang.Override public int hashCode() { - return Objects.hash(this.environmentId, this.limit, this.offset, this.q, this.requestType); + return Objects.hash(this.limit, this.migrationId, this.offset, this.q, this.status); } @java.lang.Override @@ -113,38 +114,27 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional environmentId = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional migrationId = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); - private Optional requestType = Optional.empty(); + private Optional status = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} - public Builder from(CountApiRequestsParams other) { - environmentId(other.getEnvironmentId()); + public Builder from(ListCompanyMigrationsParams other) { limit(other.getLimit()); + migrationId(other.getMigrationId()); offset(other.getOffset()); q(other.getQ()); - requestType(other.getRequestType()); - 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); + status(other.getStatus()); return this; } @@ -152,26 +142,37 @@ public Builder environmentId(String environmentId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -187,19 +188,29 @@ public Builder q(String q) { return this; } - @JsonSetter(value = "request_type", nulls = Nulls.SKIP) - public Builder requestType(Optional requestType) { - this.requestType = requestType; + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; return this; } - public Builder requestType(String requestType) { - this.requestType = Optional.ofNullable(requestType); + public Builder status(PlanVersionCompanyMigrationStatus status) { + this.status = Optional.ofNullable(status); return this; } - public CountApiRequestsParams build() { - return new CountApiRequestsParams(environmentId, limit, offset, q, requestType, additionalProperties); + public ListCompanyMigrationsParams build() { + return new ListCompanyMigrationsParams(limit, migrationId, offset, q, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/ListCompanyMigrationsResponse.java similarity index 58% rename from src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterResponse.java rename to src/main/java/com/schematic/api/resources/planmigrations/types/ListCompanyMigrationsResponse.java index f99c32d..7567db5 100644 --- a/src/main/java/com/schematic/api/resources/companies/types/ListCompaniesForAdvancedFilterResponse.java +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/ListCompanyMigrationsResponse.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.planmigrations.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.CompanyViewWithFeatureUsageResponseData; +import com.schematic.api.types.PlanVersionCompanyMigrationResponseData; 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 = ListCompaniesForAdvancedFilterResponse.Builder.class) -public final class ListCompaniesForAdvancedFilterResponse { - private final List data; +@JsonDeserialize(builder = ListCompanyMigrationsResponse.Builder.class) +public final class ListCompanyMigrationsResponse { + private final List data; - private final ListCompaniesForAdvancedFilterParams params; + private final ListCompanyMigrationsParams params; private final Map additionalProperties; - private ListCompaniesForAdvancedFilterResponse( - List data, - ListCompaniesForAdvancedFilterParams params, + private ListCompanyMigrationsResponse( + List data, + ListCompanyMigrationsParams params, Map additionalProperties) { this.data = data; this.params = params; @@ -39,7 +39,7 @@ private ListCompaniesForAdvancedFilterResponse( } @JsonProperty("data") - public List getData() { + public List getData() { return data; } @@ -47,15 +47,14 @@ public List getData() { * @return Input parameters */ @JsonProperty("params") - public ListCompaniesForAdvancedFilterParams getParams() { + public ListCompanyMigrationsParams getParams() { return params; } @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListCompaniesForAdvancedFilterResponse - && equalTo((ListCompaniesForAdvancedFilterResponse) other); + return other instanceof ListCompanyMigrationsResponse && equalTo((ListCompanyMigrationsResponse) other); } @JsonAnyGetter @@ -63,7 +62,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListCompaniesForAdvancedFilterResponse other) { + private boolean equalTo(ListCompanyMigrationsResponse other) { return data.equals(other.data) && params.equals(other.params); } @@ -85,26 +84,30 @@ public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(@NotNull ListCompaniesForAdvancedFilterParams params); + _FinalStage params(@NotNull ListCompanyMigrationsParams params); - Builder from(ListCompaniesForAdvancedFilterResponse other); + Builder from(ListCompanyMigrationsResponse other); } public interface _FinalStage { - ListCompaniesForAdvancedFilterResponse build(); + ListCompanyMigrationsResponse build(); - _FinalStage data(List data); + _FinalStage additionalProperty(String key, Object value); - _FinalStage addData(CompanyViewWithFeatureUsageResponseData data); + _FinalStage additionalProperties(Map additionalProperties); - _FinalStage addAllData(List data); + _FinalStage data(List data); + + _FinalStage addData(PlanVersionCompanyMigrationResponseData data); + + _FinalStage addAllData(List data); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ParamsStage, _FinalStage { - private ListCompaniesForAdvancedFilterParams params; + private ListCompanyMigrationsParams params; - private List data = new ArrayList<>(); + private List data = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -112,7 +115,7 @@ public static final class Builder implements ParamsStage, _FinalStage { private Builder() {} @java.lang.Override - public Builder from(ListCompaniesForAdvancedFilterResponse other) { + public Builder from(ListCompanyMigrationsResponse other) { data(other.getData()); params(other.getParams()); return this; @@ -125,13 +128,13 @@ public Builder from(ListCompaniesForAdvancedFilterResponse other) { */ @java.lang.Override @JsonSetter("params") - public _FinalStage params(@NotNull ListCompaniesForAdvancedFilterParams params) { + public _FinalStage params(@NotNull ListCompanyMigrationsParams 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); } @@ -139,14 +142,14 @@ public _FinalStage addAllData(List data } @java.lang.Override - public _FinalStage addData(CompanyViewWithFeatureUsageResponseData data) { + public _FinalStage addData(PlanVersionCompanyMigrationResponseData 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); @@ -155,8 +158,20 @@ public _FinalStage data(List data) { } @java.lang.Override - public ListCompaniesForAdvancedFilterResponse build() { - return new ListCompaniesForAdvancedFilterResponse(data, params, additionalProperties); + public ListCompanyMigrationsResponse build() { + return new ListCompanyMigrationsResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsParams.java b/src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsParams.java new file mode 100644 index 0000000..fdb3d43 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsParams.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListMigrationsParams.Builder.class) +public final class ListMigrationsParams { + private final Optional limit; + + private final Optional offset; + + private final Optional planVersionId; + + private final Optional status; + + private final Map additionalProperties; + + private ListMigrationsParams( + Optional limit, + Optional offset, + Optional planVersionId, + Optional status, + Map additionalProperties) { + this.limit = limit; + this.offset = offset; + this.planVersionId = planVersionId; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Page limit (default 100) + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Page offset (default 0) + */ + @JsonProperty("offset") + public Optional getOffset() { + return offset; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMigrationsParams && equalTo((ListMigrationsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMigrationsParams other) { + return limit.equals(other.limit) + && offset.equals(other.offset) + && planVersionId.equals(other.planVersionId) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.limit, this.offset, this.planVersionId, this.status); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional planVersionId = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListMigrationsParams other) { + limit(other.getLimit()); + offset(other.getOffset()); + planVersionId(other.getPlanVersionId()); + status(other.getStatus()); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @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; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(PlanVersionMigrationStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public ListMigrationsParams build() { + return new ListMigrationsParams(limit, offset, planVersionId, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsResponse.java b/src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsResponse.java new file mode 100644 index 0000000..1e8f636 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/planmigrations/types/ListMigrationsResponse.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.planmigrations.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.PlanVersionMigrationResponseData; +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 = ListMigrationsResponse.Builder.class) +public final class ListMigrationsResponse { + private final List data; + + private final ListMigrationsParams params; + + private final Map additionalProperties; + + private ListMigrationsResponse( + List data, + ListMigrationsParams params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public ListMigrationsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListMigrationsResponse && equalTo((ListMigrationsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListMigrationsResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ParamsStage builder() { + return new Builder(); + } + + public interface ParamsStage { + /** + *

Input parameters

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

Input parameters

+ *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull ListMigrationsParams 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(PlanVersionMigrationResponseData 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 ListMigrationsResponse build() { + return new ListMigrationsResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java index b887d3f..5698a40 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncPlansClient.java @@ -6,15 +6,20 @@ 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.DeletePlanVersionRequest; +import com.schematic.api.resources.plans.requests.GetPlanRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; +import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; +import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; @@ -56,6 +61,10 @@ public CompletableFuture listPlans() { return this.rawClient.listPlans().thenApply(response -> response.body()); } + public CompletableFuture listPlans(RequestOptions requestOptions) { + return this.rawClient.listPlans(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listPlans(ListPlansRequest request) { return this.rawClient.listPlans(request).thenApply(response -> response.body()); } @@ -81,6 +90,15 @@ public CompletableFuture getPlan(String planId, RequestOptions return this.rawClient.getPlan(planId, requestOptions).thenApply(response -> response.body()); } + public CompletableFuture getPlan(String planId, GetPlanRequest request) { + return this.rawClient.getPlan(planId, request).thenApply(response -> response.body()); + } + + public CompletableFuture getPlan( + String planId, GetPlanRequest request, RequestOptions requestOptions) { + return this.rawClient.getPlan(planId, request, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updatePlan(String planId, UpdatePlanRequestBody request) { return this.rawClient.updatePlan(planId, request).thenApply(response -> response.body()); } @@ -114,6 +132,10 @@ public CompletableFuture countPlans() { return this.rawClient.countPlans().thenApply(response -> response.body()); } + public CompletableFuture countPlans(RequestOptions requestOptions) { + return this.rawClient.countPlans(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countPlans(CountPlansRequest request) { return this.rawClient.countPlans(request).thenApply(response -> response.body()); } @@ -130,4 +152,35 @@ public CompletableFuture listPlanIssues( ListPlanIssuesRequest request, RequestOptions requestOptions) { return this.rawClient.listPlanIssues(request, requestOptions).thenApply(response -> response.body()); } + + public CompletableFuture deletePlanVersion(String planId) { + return this.rawClient.deletePlanVersion(planId).thenApply(response -> response.body()); + } + + public CompletableFuture deletePlanVersion( + String planId, RequestOptions requestOptions) { + return this.rawClient.deletePlanVersion(planId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deletePlanVersion( + String planId, DeletePlanVersionRequest request) { + return this.rawClient.deletePlanVersion(planId, request).thenApply(response -> response.body()); + } + + public CompletableFuture deletePlanVersion( + String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + return this.rawClient.deletePlanVersion(planId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture publishPlanVersion( + String planId, PublishPlanVersionRequestBody request) { + return this.rawClient.publishPlanVersion(planId, request).thenApply(response -> response.body()); + } + + public CompletableFuture publishPlanVersion( + String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .publishPlanVersion(planId, request, requestOptions) + .thenApply(response -> response.body()); + } } diff --git a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java index b666d4a..a1db791 100644 --- a/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/AsyncRawPlansClient.java @@ -18,15 +18,20 @@ 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.DeletePlanVersionRequest; +import com.schematic.api.resources.plans.requests.GetPlanRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; +import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; +import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; @@ -61,11 +66,15 @@ public CompletableFuture> public CompletableFuture> updateCompanyPlans( String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-plans") - .addPathSegment(companyPlanId) - .build(); + .addPathSegment(companyPlanId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -74,7 +83,7 @@ public CompletableFuture> throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -89,14 +98,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpdateCompanyPlansResponse.class), + responseBodyString, UpdateCompanyPlansResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -128,11 +137,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -151,6 +158,10 @@ public CompletableFuture> listPlans return listPlans(ListPlansRequest.builder().build()); } + public CompletableFuture> listPlans(RequestOptions requestOptions) { + return listPlans(ListPlansRequest.builder().build(), requestOptions); + } + public CompletableFuture> listPlans(ListPlansRequest request) { return listPlans(request, null); } @@ -183,6 +194,13 @@ public CompletableFuture> listPlans QueryStringMapper.addQueryParameter( httpUrl, "has_product_id", request.getHasProductId().get(), false); } + if (request.getIncludeDraftVersions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_draft_versions", + request.getIncludeDraftVersions().get(), + false); + } if (request.getPlanType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_type", request.getPlanType().get(), false); @@ -215,6 +233,11 @@ public CompletableFuture> listPlans if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -230,13 +253,13 @@ public CompletableFuture> listPlans @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPlansResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlansResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -268,11 +291,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -293,10 +314,14 @@ public CompletableFuture> createPl public CompletableFuture> createPlan( CreatePlanRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plans") - .build(); + .addPathSegments("plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -305,7 +330,7 @@ public CompletableFuture> createPl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -320,13 +345,13 @@ public CompletableFuture> createPl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -358,11 +383,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -378,22 +401,40 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } public CompletableFuture> getPlan(String planId) { - return getPlan(planId, null); + return getPlan(planId, GetPlanRequest.builder().build()); } public CompletableFuture> getPlan( String planId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + return getPlan(planId, GetPlanRequest.builder().build(), requestOptions); + } + + public CompletableFuture> getPlan( + String planId, GetPlanRequest request) { + return getPlan(planId, request, null); + } + + public CompletableFuture> getPlan( + String planId, GetPlanRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .addPathSegment(planId); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); @@ -403,13 +444,13 @@ public CompletableFuture> getPlan( @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -436,11 +477,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -462,11 +501,15 @@ public CompletableFuture> updatePl public CompletableFuture> updatePlan( String planId, UpdatePlanRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) - .build(); + .addPathSegment(planId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -475,7 +518,7 @@ public CompletableFuture> updatePl throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -490,13 +533,13 @@ public CompletableFuture> updatePl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -528,11 +571,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -553,13 +594,17 @@ public CompletableFuture> deletePl public CompletableFuture> deletePlan( String planId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) - .build(); + .addPathSegment(planId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -573,13 +618,13 @@ public CompletableFuture> deletePl @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -611,11 +656,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -637,12 +680,16 @@ public CompletableFuture> upsertBillingProductPlan( String planId, UpsertBillingProductRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") .addPathSegment(planId) - .addPathSegments("billing_products") - .build(); + .addPathSegments("billing_products"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -651,7 +698,7 @@ public CompletableFuture( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingProductPlanResponse.class), + responseBodyString, UpsertBillingProductPlanResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -706,11 +753,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -729,6 +774,10 @@ public CompletableFuture> countPla return countPlans(CountPlansRequest.builder().build()); } + public CompletableFuture> countPlans(RequestOptions requestOptions) { + return countPlans(CountPlansRequest.builder().build(), requestOptions); + } + public CompletableFuture> countPlans(CountPlansRequest request) { return countPlans(request, null); } @@ -761,6 +810,13 @@ public CompletableFuture> countPla QueryStringMapper.addQueryParameter( httpUrl, "has_product_id", request.getHasProductId().get(), false); } + if (request.getIncludeDraftVersions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_draft_versions", + request.getIncludeDraftVersions().get(), + false); + } if (request.getPlanType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_type", request.getPlanType().get(), false); @@ -793,6 +849,11 @@ public CompletableFuture> countPla if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -808,13 +869,13 @@ public CompletableFuture> countPla @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountPlansResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountPlansResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -846,11 +907,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -876,6 +935,15 @@ public CompletableFuture> list .newBuilder() .addPathSegments("plans/issues"); QueryStringMapper.addQueryParameter(httpUrl, "plan_id", request.getPlanId(), false); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -891,14 +959,212 @@ public CompletableFuture> list @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanIssuesResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deletePlanVersion(String planId) { + return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build()); + } + + public CompletableFuture> deletePlanVersion( + String planId, RequestOptions requestOptions) { + return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build(), requestOptions); + } + + public CompletableFuture> deletePlanVersion( + String planId, DeletePlanVersionRequest request) { + return deletePlanVersion(planId, request, null); + } + + public CompletableFuture> deletePlanVersion( + String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/version") + .addPathSegment(planId); + if (request.getPromoteArchivedVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "promote_archived_version", + request.getPromoteArchivedVersion().get(), + false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListPlanIssuesResponse.class), + responseBodyString, DeletePlanVersionResponse.class), response)); return; } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> publishPlanVersion( + String planId, PublishPlanVersionRequestBody request) { + return publishPlanVersion(planId, request, null); + } + + public CompletableFuture> publishPlanVersion( + String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/version") + .addPathSegment(planId) + .addPathSegments("publish"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, PublishPlanVersionResponse.class), + response)); + return; + } try { switch (response.code()) { case 400: @@ -930,11 +1196,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); 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 b655e81..c70e8ff 100644 --- a/src/main/java/com/schematic/api/resources/plans/PlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/PlansClient.java @@ -6,15 +6,20 @@ 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.DeletePlanVersionRequest; +import com.schematic.api.resources.plans.requests.GetPlanRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; +import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; +import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; @@ -54,6 +59,10 @@ public ListPlansResponse listPlans() { return this.rawClient.listPlans().body(); } + public ListPlansResponse listPlans(RequestOptions requestOptions) { + return this.rawClient.listPlans(requestOptions).body(); + } + public ListPlansResponse listPlans(ListPlansRequest request) { return this.rawClient.listPlans(request).body(); } @@ -78,6 +87,14 @@ public GetPlanResponse getPlan(String planId, RequestOptions requestOptions) { return this.rawClient.getPlan(planId, requestOptions).body(); } + public GetPlanResponse getPlan(String planId, GetPlanRequest request) { + return this.rawClient.getPlan(planId, request).body(); + } + + public GetPlanResponse getPlan(String planId, GetPlanRequest request, RequestOptions requestOptions) { + return this.rawClient.getPlan(planId, request, requestOptions).body(); + } + public UpdatePlanResponse updatePlan(String planId, UpdatePlanRequestBody request) { return this.rawClient.updatePlan(planId, request).body(); } @@ -110,6 +127,10 @@ public CountPlansResponse countPlans() { return this.rawClient.countPlans().body(); } + public CountPlansResponse countPlans(RequestOptions requestOptions) { + return this.rawClient.countPlans(requestOptions).body(); + } + public CountPlansResponse countPlans(CountPlansRequest request) { return this.rawClient.countPlans(request).body(); } @@ -125,4 +146,32 @@ public ListPlanIssuesResponse listPlanIssues(ListPlanIssuesRequest request) { public ListPlanIssuesResponse listPlanIssues(ListPlanIssuesRequest request, RequestOptions requestOptions) { return this.rawClient.listPlanIssues(request, requestOptions).body(); } + + public DeletePlanVersionResponse deletePlanVersion(String planId) { + return this.rawClient.deletePlanVersion(planId).body(); + } + + public DeletePlanVersionResponse deletePlanVersion(String planId, RequestOptions requestOptions) { + return this.rawClient.deletePlanVersion(planId, requestOptions).body(); + } + + public DeletePlanVersionResponse deletePlanVersion(String planId, DeletePlanVersionRequest request) { + return this.rawClient.deletePlanVersion(planId, request).body(); + } + + public DeletePlanVersionResponse deletePlanVersion( + String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + return this.rawClient.deletePlanVersion(planId, request, requestOptions).body(); + } + + public PublishPlanVersionResponse publishPlanVersion(String planId, PublishPlanVersionRequestBody request) { + return this.rawClient.publishPlanVersion(planId, request).body(); + } + + public PublishPlanVersionResponse publishPlanVersion( + String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + return this.rawClient + .publishPlanVersion(planId, request, requestOptions) + .body(); + } } diff --git a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java index e4c99cd..1c02840 100644 --- a/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java +++ b/src/main/java/com/schematic/api/resources/plans/RawPlansClient.java @@ -18,15 +18,20 @@ 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.DeletePlanVersionRequest; +import com.schematic.api.resources.plans.requests.GetPlanRequest; import com.schematic.api.resources.plans.requests.ListPlanIssuesRequest; import com.schematic.api.resources.plans.requests.ListPlansRequest; +import com.schematic.api.resources.plans.requests.PublishPlanVersionRequestBody; import com.schematic.api.resources.plans.requests.UpdateCompanyPlansRequestBody; import com.schematic.api.resources.plans.types.CountPlansResponse; import com.schematic.api.resources.plans.types.CreatePlanResponse; import com.schematic.api.resources.plans.types.DeletePlanResponse; +import com.schematic.api.resources.plans.types.DeletePlanVersionResponse; import com.schematic.api.resources.plans.types.GetPlanResponse; import com.schematic.api.resources.plans.types.ListPlanIssuesResponse; import com.schematic.api.resources.plans.types.ListPlansResponse; +import com.schematic.api.resources.plans.types.PublishPlanVersionResponse; import com.schematic.api.resources.plans.types.UpdateCompanyPlansResponse; import com.schematic.api.resources.plans.types.UpdatePlanResponse; import com.schematic.api.resources.plans.types.UpsertBillingProductPlanResponse; @@ -57,11 +62,15 @@ public BaseSchematicHttpResponse updateCompanyPlans( public BaseSchematicHttpResponse updateCompanyPlans( String companyPlanId, UpdateCompanyPlansRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("company-plans") - .addPathSegment(companyPlanId) - .build(); + .addPathSegment(companyPlanId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -70,7 +79,7 @@ public BaseSchematicHttpResponse updateCompanyPlans( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -82,12 +91,12 @@ public BaseSchematicHttpResponse updateCompanyPlans( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateCompanyPlansResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateCompanyPlansResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -109,11 +118,9 @@ public BaseSchematicHttpResponse updateCompanyPlans( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -123,6 +130,10 @@ public BaseSchematicHttpResponse listPlans() { return listPlans(ListPlansRequest.builder().build()); } + public BaseSchematicHttpResponse listPlans(RequestOptions requestOptions) { + return listPlans(ListPlansRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listPlans(ListPlansRequest request) { return listPlans(request, null); } @@ -155,6 +166,13 @@ public BaseSchematicHttpResponse listPlans( QueryStringMapper.addQueryParameter( httpUrl, "has_product_id", request.getHasProductId().get(), false); } + if (request.getIncludeDraftVersions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_draft_versions", + request.getIncludeDraftVersions().get(), + false); + } if (request.getPlanType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_type", request.getPlanType().get(), false); @@ -187,6 +205,11 @@ public BaseSchematicHttpResponse listPlans( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -199,11 +222,11 @@ public BaseSchematicHttpResponse listPlans( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPlansResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlansResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -225,11 +248,9 @@ public BaseSchematicHttpResponse listPlans( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -241,10 +262,14 @@ public BaseSchematicHttpResponse createPlan(CreatePlanReques public BaseSchematicHttpResponse createPlan( CreatePlanRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("plans") - .build(); + .addPathSegments("plans"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -253,7 +278,7 @@ public BaseSchematicHttpResponse createPlan( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -265,11 +290,11 @@ public BaseSchematicHttpResponse createPlan( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePlanResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreatePlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -291,43 +316,58 @@ public BaseSchematicHttpResponse createPlan( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } } public BaseSchematicHttpResponse getPlan(String planId) { - return getPlan(planId, null); + return getPlan(planId, GetPlanRequest.builder().build()); } public BaseSchematicHttpResponse getPlan(String planId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + return getPlan(planId, GetPlanRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse getPlan(String planId, GetPlanRequest request) { + return getPlan(planId, request, null); + } + + public BaseSchematicHttpResponse getPlan( + String planId, GetPlanRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .addPathSegment(planId); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPlanResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetPlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -346,11 +386,9 @@ public BaseSchematicHttpResponse getPlan(String planId, Request } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -362,11 +400,15 @@ public BaseSchematicHttpResponse updatePlan(String planId, U public BaseSchematicHttpResponse updatePlan( String planId, UpdatePlanRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) - .build(); + .addPathSegment(planId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -375,7 +417,7 @@ public BaseSchematicHttpResponse updatePlan( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -387,11 +429,11 @@ public BaseSchematicHttpResponse updatePlan( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePlanResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdatePlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -413,11 +455,9 @@ public BaseSchematicHttpResponse updatePlan( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -428,13 +468,17 @@ public BaseSchematicHttpResponse deletePlan(String planId) { } public BaseSchematicHttpResponse deletePlan(String planId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") - .addPathSegment(planId) - .build(); + .addPathSegment(planId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -445,11 +489,11 @@ public BaseSchematicHttpResponse deletePlan(String planId, R } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeletePlanResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -471,11 +515,9 @@ public BaseSchematicHttpResponse deletePlan(String planId, R } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -488,12 +530,16 @@ public BaseSchematicHttpResponse upsertBilling public BaseSchematicHttpResponse upsertBillingProductPlan( String planId, UpsertBillingProductRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("plans") .addPathSegment(planId) - .addPathSegments("billing_products") - .build(); + .addPathSegments("billing_products"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -502,7 +548,7 @@ public BaseSchematicHttpResponse upsertBilling throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -514,13 +560,12 @@ public BaseSchematicHttpResponse upsertBilling } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), UpsertBillingProductPlanResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpsertBillingProductPlanResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -542,11 +587,9 @@ public BaseSchematicHttpResponse upsertBilling } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -556,6 +599,10 @@ public BaseSchematicHttpResponse countPlans() { return countPlans(CountPlansRequest.builder().build()); } + public BaseSchematicHttpResponse countPlans(RequestOptions requestOptions) { + return countPlans(CountPlansRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countPlans(CountPlansRequest request) { return countPlans(request, null); } @@ -588,6 +635,13 @@ public BaseSchematicHttpResponse countPlans( QueryStringMapper.addQueryParameter( httpUrl, "has_product_id", request.getHasProductId().get(), false); } + if (request.getIncludeDraftVersions().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_draft_versions", + request.getIncludeDraftVersions().get(), + false); + } if (request.getPlanType().isPresent()) { QueryStringMapper.addQueryParameter( httpUrl, "plan_type", request.getPlanType().get(), false); @@ -620,6 +674,11 @@ public BaseSchematicHttpResponse countPlans( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -632,11 +691,11 @@ public BaseSchematicHttpResponse countPlans( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountPlansResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountPlansResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -658,11 +717,9 @@ public BaseSchematicHttpResponse countPlans( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -678,6 +735,15 @@ public BaseSchematicHttpResponse listPlanIssues( .newBuilder() .addPathSegments("plans/issues"); QueryStringMapper.addQueryParameter(httpUrl, "plan_id", request.getPlanId(), false); + if (request.getPlanVersionId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "plan_version_id", request.getPlanVersionId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -690,12 +756,163 @@ public BaseSchematicHttpResponse listPlanIssues( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPlanIssuesResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPlanIssuesResponse.class), response); } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse deletePlanVersion(String planId) { + return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build()); + } + + public BaseSchematicHttpResponse deletePlanVersion( + String planId, RequestOptions requestOptions) { + return deletePlanVersion(planId, DeletePlanVersionRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse deletePlanVersion( + String planId, DeletePlanVersionRequest request) { + return deletePlanVersion(planId, request, null); + } + + public BaseSchematicHttpResponse deletePlanVersion( + String planId, DeletePlanVersionRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/version") + .addPathSegment(planId); + if (request.getPromoteArchivedVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "promote_archived_version", + request.getPromoteArchivedVersion().get(), + false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeletePlanVersionResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse publishPlanVersion( + String planId, PublishPlanVersionRequestBody request) { + return publishPlanVersion(planId, request, null); + } + + public BaseSchematicHttpResponse publishPlanVersion( + String planId, PublishPlanVersionRequestBody request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("plans/version") + .addPathSegment(planId) + .addPathSegments("publish"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("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(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PublishPlanVersionResponse.class), + response); + } try { switch (response.code()) { case 400: @@ -717,11 +934,9 @@ public BaseSchematicHttpResponse listPlanIssues( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/CountPlansRequest.java index 2b89290..7e1229e 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 @@ -35,6 +35,8 @@ public final class CountPlansRequest { private final Optional hasProductId; + private final Optional includeDraftVersions; + private final Optional planType; private final Optional q; @@ -43,9 +45,9 @@ public final class CountPlansRequest { private final Optional withoutPaidProductId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -56,12 +58,13 @@ private CountPlansRequest( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional hasProductId, + Optional includeDraftVersions, Optional planType, Optional q, Optional withoutEntitlementFor, Optional withoutPaidProductId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.companyId = companyId; @@ -69,6 +72,7 @@ private CountPlansRequest( this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.hasProductId = hasProductId; + this.includeDraftVersions = includeDraftVersions; this.planType = planType; this.q = q; this.withoutEntitlementFor = withoutEntitlementFor; @@ -120,6 +124,14 @@ public Optional getHasProductId() { return hasProductId; } + /** + * @return Include billing settings from draft versions for plans which have draft version + */ + @JsonProperty("include_draft_versions") + public Optional getIncludeDraftVersions() { + return includeDraftVersions; + } + /** * @return Filter by plan type */ @@ -153,7 +165,7 @@ public Optional getWithoutPaidProductId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -161,7 +173,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -183,6 +195,7 @@ private boolean equalTo(CountPlansRequest other) { && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && hasProductId.equals(other.hasProductId) + && includeDraftVersions.equals(other.includeDraftVersions) && planType.equals(other.planType) && q.equals(other.q) && withoutEntitlementFor.equals(other.withoutEntitlementFor) @@ -200,6 +213,7 @@ public int hashCode() { this.forInitialPlan, this.forTrialExpiryPlan, this.hasProductId, + this.includeDraftVersions, this.planType, this.q, this.withoutEntitlementFor, @@ -231,6 +245,8 @@ public static final class Builder { private Optional hasProductId = Optional.empty(); + private Optional includeDraftVersions = Optional.empty(); + private Optional planType = Optional.empty(); private Optional q = Optional.empty(); @@ -239,9 +255,9 @@ public static final class Builder { private Optional withoutPaidProductId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -255,6 +271,7 @@ public Builder from(CountPlansRequest other) { forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); hasProductId(other.getHasProductId()); + includeDraftVersions(other.getIncludeDraftVersions()); planType(other.getPlanType()); q(other.getQ()); withoutEntitlementFor(other.getWithoutEntitlementFor()); @@ -347,6 +364,20 @@ public Builder hasProductId(Boolean hasProductId) { return this; } + /** + *

Include billing settings from draft versions for plans which have draft version

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

Filter by plan type

*/ @@ -404,12 +435,12 @@ public Builder withoutPaidProductId(Boolean withoutPaidProductId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -436,6 +467,7 @@ public CountPlansRequest build() { forInitialPlan, forTrialExpiryPlan, hasProductId, + includeDraftVersions, planType, q, withoutEntitlementFor, @@ -444,5 +476,15 @@ public CountPlansRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/requests/DeletePlanVersionRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/DeletePlanVersionRequest.java new file mode 100644 index 0000000..bfcd427 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/DeletePlanVersionRequest.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePlanVersionRequest.Builder.class) +public final class DeletePlanVersionRequest { + private final Optional promoteArchivedVersion; + + private final Map additionalProperties; + + private DeletePlanVersionRequest( + Optional promoteArchivedVersion, Map additionalProperties) { + this.promoteArchivedVersion = promoteArchivedVersion; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("promote_archived_version") + public Optional getPromoteArchivedVersion() { + return promoteArchivedVersion; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePlanVersionRequest && equalTo((DeletePlanVersionRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePlanVersionRequest other) { + return promoteArchivedVersion.equals(other.promoteArchivedVersion); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.promoteArchivedVersion); + } + + @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 promoteArchivedVersion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeletePlanVersionRequest other) { + promoteArchivedVersion(other.getPromoteArchivedVersion()); + return this; + } + + @JsonSetter(value = "promote_archived_version", nulls = Nulls.SKIP) + public Builder promoteArchivedVersion(Optional promoteArchivedVersion) { + this.promoteArchivedVersion = promoteArchivedVersion; + return this; + } + + public Builder promoteArchivedVersion(Boolean promoteArchivedVersion) { + this.promoteArchivedVersion = Optional.ofNullable(promoteArchivedVersion); + return this; + } + + public DeletePlanVersionRequest build() { + return new DeletePlanVersionRequest(promoteArchivedVersion, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/GetPlanRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/GetPlanRequest.java new file mode 100644 index 0000000..24aaf5c --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/GetPlanRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetPlanRequest.Builder.class) +public final class GetPlanRequest { + private final Optional planVersionId; + + private final Map additionalProperties; + + private GetPlanRequest(Optional planVersionId, Map additionalProperties) { + this.planVersionId = planVersionId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Fetch billing settings for a specific plan version + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetPlanRequest && equalTo((GetPlanRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetPlanRequest other) { + return planVersionId.equals(other.planVersionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planVersionId); + } + + @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 planVersionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetPlanRequest other) { + planVersionId(other.getPlanVersionId()); + return this; + } + + /** + *

Fetch billing settings for a specific plan version

+ */ + @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; + } + + public GetPlanRequest build() { + return new GetPlanRequest(planVersionId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListPlanIssuesRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListPlanIssuesRequest.java index 4f73caf..2db1f10 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/ListPlanIssuesRequest.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/ListPlanIssuesRequest.java @@ -9,11 +9,13 @@ 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) @@ -21,10 +23,14 @@ public final class ListPlanIssuesRequest { private final String planId; + private final Optional planVersionId; + private final Map additionalProperties; - private ListPlanIssuesRequest(String planId, Map additionalProperties) { + private ListPlanIssuesRequest( + String planId, Optional planVersionId, Map additionalProperties) { this.planId = planId; + this.planVersionId = planVersionId; this.additionalProperties = additionalProperties; } @@ -33,6 +39,11 @@ public String getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -45,12 +56,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListPlanIssuesRequest other) { - return planId.equals(other.planId); + return planId.equals(other.planId) && planVersionId.equals(other.planVersionId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planId); + return Objects.hash(this.planId, this.planVersionId); } @java.lang.Override @@ -70,12 +81,22 @@ public interface PlanIdStage { public interface _FinalStage { ListPlanIssuesRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements PlanIdStage, _FinalStage { private String planId; + private Optional planVersionId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -84,6 +105,7 @@ private Builder() {} @java.lang.Override public Builder from(ListPlanIssuesRequest other) { planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); return this; } @@ -94,9 +116,34 @@ public _FinalStage planId(@NotNull String planId) { 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 ListPlanIssuesRequest build() { - return new ListPlanIssuesRequest(planId, additionalProperties); + return new ListPlanIssuesRequest(planId, planVersionId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java b/src/main/java/com/schematic/api/resources/plans/requests/ListPlansRequest.java index 3844b38..a2cf3d7 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 @@ -35,6 +35,8 @@ public final class ListPlansRequest { private final Optional hasProductId; + private final Optional includeDraftVersions; + private final Optional planType; private final Optional q; @@ -43,9 +45,9 @@ public final class ListPlansRequest { private final Optional withoutPaidProductId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -56,12 +58,13 @@ private ListPlansRequest( Optional forInitialPlan, Optional forTrialExpiryPlan, Optional hasProductId, + Optional includeDraftVersions, Optional planType, Optional q, Optional withoutEntitlementFor, Optional withoutPaidProductId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.companyId = companyId; @@ -69,6 +72,7 @@ private ListPlansRequest( this.forInitialPlan = forInitialPlan; this.forTrialExpiryPlan = forTrialExpiryPlan; this.hasProductId = hasProductId; + this.includeDraftVersions = includeDraftVersions; this.planType = planType; this.q = q; this.withoutEntitlementFor = withoutEntitlementFor; @@ -120,6 +124,14 @@ public Optional getHasProductId() { return hasProductId; } + /** + * @return Include billing settings from draft versions for plans which have draft version + */ + @JsonProperty("include_draft_versions") + public Optional getIncludeDraftVersions() { + return includeDraftVersions; + } + /** * @return Filter by plan type */ @@ -153,7 +165,7 @@ public Optional getWithoutPaidProductId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -161,7 +173,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -183,6 +195,7 @@ private boolean equalTo(ListPlansRequest other) { && forInitialPlan.equals(other.forInitialPlan) && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && hasProductId.equals(other.hasProductId) + && includeDraftVersions.equals(other.includeDraftVersions) && planType.equals(other.planType) && q.equals(other.q) && withoutEntitlementFor.equals(other.withoutEntitlementFor) @@ -200,6 +213,7 @@ public int hashCode() { this.forInitialPlan, this.forTrialExpiryPlan, this.hasProductId, + this.includeDraftVersions, this.planType, this.q, this.withoutEntitlementFor, @@ -231,6 +245,8 @@ public static final class Builder { private Optional hasProductId = Optional.empty(); + private Optional includeDraftVersions = Optional.empty(); + private Optional planType = Optional.empty(); private Optional q = Optional.empty(); @@ -239,9 +255,9 @@ public static final class Builder { private Optional withoutPaidProductId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -255,6 +271,7 @@ public Builder from(ListPlansRequest other) { forInitialPlan(other.getForInitialPlan()); forTrialExpiryPlan(other.getForTrialExpiryPlan()); hasProductId(other.getHasProductId()); + includeDraftVersions(other.getIncludeDraftVersions()); planType(other.getPlanType()); q(other.getQ()); withoutEntitlementFor(other.getWithoutEntitlementFor()); @@ -347,6 +364,20 @@ public Builder hasProductId(Boolean hasProductId) { return this; } + /** + *

Include billing settings from draft versions for plans which have draft version

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

Filter by plan type

*/ @@ -404,12 +435,12 @@ public Builder withoutPaidProductId(Boolean withoutPaidProductId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -436,6 +467,7 @@ public ListPlansRequest build() { forInitialPlan, forTrialExpiryPlan, hasProductId, + includeDraftVersions, planType, q, withoutEntitlementFor, @@ -444,5 +476,15 @@ public ListPlansRequest build() { offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java new file mode 100644 index 0000000..f3e62e1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/requests/PublishPlanVersionRequestBody.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanVersionMigrationStrategy; +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 = PublishPlanVersionRequestBody.Builder.class) +public final class PublishPlanVersionRequestBody { + private final List excludedCompanyIds; + + private final PlanVersionMigrationStrategy migrationStrategy; + + private final Map additionalProperties; + + private PublishPlanVersionRequestBody( + List excludedCompanyIds, + PlanVersionMigrationStrategy migrationStrategy, + Map additionalProperties) { + this.excludedCompanyIds = excludedCompanyIds; + this.migrationStrategy = migrationStrategy; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("excluded_company_ids") + public List getExcludedCompanyIds() { + return excludedCompanyIds; + } + + @JsonProperty("migration_strategy") + public PlanVersionMigrationStrategy getMigrationStrategy() { + return migrationStrategy; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PublishPlanVersionRequestBody && equalTo((PublishPlanVersionRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PublishPlanVersionRequestBody other) { + return excludedCompanyIds.equals(other.excludedCompanyIds) && migrationStrategy.equals(other.migrationStrategy); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.excludedCompanyIds, this.migrationStrategy); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MigrationStrategyStage builder() { + return new Builder(); + } + + public interface MigrationStrategyStage { + _FinalStage migrationStrategy(@NotNull PlanVersionMigrationStrategy migrationStrategy); + + Builder from(PublishPlanVersionRequestBody other); + } + + public interface _FinalStage { + PublishPlanVersionRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage excludedCompanyIds(List excludedCompanyIds); + + _FinalStage addExcludedCompanyIds(String excludedCompanyIds); + + _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MigrationStrategyStage, _FinalStage { + private PlanVersionMigrationStrategy migrationStrategy; + + private List excludedCompanyIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PublishPlanVersionRequestBody other) { + excludedCompanyIds(other.getExcludedCompanyIds()); + migrationStrategy(other.getMigrationStrategy()); + return this; + } + + @java.lang.Override + @JsonSetter("migration_strategy") + public _FinalStage migrationStrategy(@NotNull PlanVersionMigrationStrategy migrationStrategy) { + this.migrationStrategy = Objects.requireNonNull(migrationStrategy, "migrationStrategy must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllExcludedCompanyIds(List excludedCompanyIds) { + if (excludedCompanyIds != null) { + this.excludedCompanyIds.addAll(excludedCompanyIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addExcludedCompanyIds(String excludedCompanyIds) { + this.excludedCompanyIds.add(excludedCompanyIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "excluded_company_ids", nulls = Nulls.SKIP) + public _FinalStage excludedCompanyIds(List excludedCompanyIds) { + this.excludedCompanyIds.clear(); + if (excludedCompanyIds != null) { + this.excludedCompanyIds.addAll(excludedCompanyIds); + } + return this; + } + + @java.lang.Override + public PublishPlanVersionRequestBody build() { + return new PublishPlanVersionRequestBody(excludedCompanyIds, migrationStrategy, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java b/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java index aac98f2..fd129b1 100644 --- a/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java +++ b/src/main/java/com/schematic/api/resources/plans/requests/UpdateCompanyPlansRequestBody.java @@ -126,5 +126,15 @@ public Builder basePlanId(String basePlanId) { public UpdateCompanyPlansRequestBody build() { return new UpdateCompanyPlansRequestBody(addOnIds, basePlanId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/CountPlansParams.java index d5dc4dc..7ed35c4 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 @@ -34,9 +34,11 @@ public final class CountPlansParams { private final Optional> ids; - private final Optional limit; + private final Optional includeDraftVersions; - private final Optional offset; + private final Optional limit; + + private final Optional offset; private final Optional planType; @@ -55,8 +57,9 @@ private CountPlansParams( Optional forTrialExpiryPlan, Optional hasProductId, Optional> ids, - Optional limit, - Optional offset, + Optional includeDraftVersions, + Optional limit, + Optional offset, Optional planType, Optional q, Optional withoutEntitlementFor, @@ -68,6 +71,7 @@ private CountPlansParams( this.forTrialExpiryPlan = forTrialExpiryPlan; this.hasProductId = hasProductId; this.ids = ids; + this.includeDraftVersions = includeDraftVersions; this.limit = limit; this.offset = offset; this.planType = planType; @@ -119,11 +123,19 @@ public Optional> getIds() { return ids; } + /** + * @return Include billing settings from draft versions for plans which have draft version + */ + @JsonProperty("include_draft_versions") + public Optional getIncludeDraftVersions() { + return includeDraftVersions; + } + /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -131,10 +143,13 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } + /** + * @return Filter by plan type + */ @JsonProperty("plan_type") public Optional getPlanType() { return planType; @@ -179,6 +194,7 @@ private boolean equalTo(CountPlansParams other) { && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && hasProductId.equals(other.hasProductId) && ids.equals(other.ids) + && includeDraftVersions.equals(other.includeDraftVersions) && limit.equals(other.limit) && offset.equals(other.offset) && planType.equals(other.planType) @@ -196,6 +212,7 @@ public int hashCode() { this.forTrialExpiryPlan, this.hasProductId, this.ids, + this.includeDraftVersions, this.limit, this.offset, this.planType, @@ -227,9 +244,11 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional includeDraftVersions = Optional.empty(); + + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planType = Optional.empty(); @@ -251,6 +270,7 @@ public Builder from(CountPlansParams other) { forTrialExpiryPlan(other.getForTrialExpiryPlan()); hasProductId(other.getHasProductId()); ids(other.getIds()); + includeDraftVersions(other.getIncludeDraftVersions()); limit(other.getLimit()); offset(other.getOffset()); planType(other.getPlanType()); @@ -338,16 +358,30 @@ public Builder ids(List ids) { return this; } + /** + *

Include billing settings from draft versions for plans which have draft version

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

Page limit (default 100)

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

Page offset (default 0)

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

Filter by plan type

+ */ @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) public Builder planType(Optional planType) { this.planType = planType; @@ -424,6 +461,7 @@ public CountPlansParams build() { forTrialExpiryPlan, hasProductId, ids, + includeDraftVersions, limit, offset, planType, @@ -432,5 +470,15 @@ public CountPlansParams build() { withoutPaidProductId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponse.java b/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponse.java index ba47ef9..f7e7e50 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/CountPlansResponse.java @@ -89,6 +89,10 @@ public interface ParamsStage { public interface _FinalStage { CountPlansResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -132,5 +136,17 @@ public _FinalStage params(@NotNull CountPlansParams params) { public CountPlansResponse build() { return new CountPlansResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/CreatePlanResponse.java b/src/main/java/com/schematic/api/resources/plans/types/CreatePlanResponse.java index d3041cc..97d7968 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/CreatePlanResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/CreatePlanResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreatePlanResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreatePlanResponse build() { return new CreatePlanResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/DeletePlanResponse.java b/src/main/java/com/schematic/api/resources/plans/types/DeletePlanResponse.java index 1e736ad..539ef68 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/DeletePlanResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/DeletePlanResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeletePlanResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeletePlanResponse build() { return new DeletePlanResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionParams.java b/src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionParams.java new file mode 100644 index 0000000..265b766 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionParams.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePlanVersionParams.Builder.class) +public final class DeletePlanVersionParams { + private final Optional promoteArchivedVersion; + + private final Map additionalProperties; + + private DeletePlanVersionParams( + Optional promoteArchivedVersion, Map additionalProperties) { + this.promoteArchivedVersion = promoteArchivedVersion; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("promote_archived_version") + public Optional getPromoteArchivedVersion() { + return promoteArchivedVersion; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePlanVersionParams && equalTo((DeletePlanVersionParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePlanVersionParams other) { + return promoteArchivedVersion.equals(other.promoteArchivedVersion); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.promoteArchivedVersion); + } + + @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 promoteArchivedVersion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeletePlanVersionParams other) { + promoteArchivedVersion(other.getPromoteArchivedVersion()); + return this; + } + + @JsonSetter(value = "promote_archived_version", nulls = Nulls.SKIP) + public Builder promoteArchivedVersion(Optional promoteArchivedVersion) { + this.promoteArchivedVersion = promoteArchivedVersion; + return this; + } + + public Builder promoteArchivedVersion(Boolean promoteArchivedVersion) { + this.promoteArchivedVersion = Optional.ofNullable(promoteArchivedVersion); + return this; + } + + public DeletePlanVersionParams build() { + return new DeletePlanVersionParams(promoteArchivedVersion, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionResponse.java b/src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionResponse.java new file mode 100644 index 0000000..f7a81c6 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/DeletePlanVersionResponse.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.DeleteResponse; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeletePlanVersionResponse.Builder.class) +public final class DeletePlanVersionResponse { + private final DeleteResponse data; + + private final DeletePlanVersionParams params; + + private final Map additionalProperties; + + private DeletePlanVersionResponse( + DeleteResponse data, DeletePlanVersionParams params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeleteResponse getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public DeletePlanVersionParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeletePlanVersionResponse && equalTo((DeletePlanVersionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeletePlanVersionResponse 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 DeleteResponse data); + + Builder from(DeletePlanVersionResponse other); + } + + public interface ParamsStage { + /** + *

Input parameters

+ */ + _FinalStage params(@NotNull DeletePlanVersionParams params); + } + + public interface _FinalStage { + DeletePlanVersionResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, ParamsStage, _FinalStage { + private DeleteResponse data; + + private DeletePlanVersionParams params; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeletePlanVersionResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public ParamsStage data(@NotNull DeleteResponse 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 DeletePlanVersionParams params) { + this.params = Objects.requireNonNull(params, "params must not be null"); + return this; + } + + @java.lang.Override + public DeletePlanVersionResponse build() { + return new DeletePlanVersionResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/GetPlanParams.java b/src/main/java/com/schematic/api/resources/plans/types/GetPlanParams.java new file mode 100644 index 0000000..07a6d1c --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/GetPlanParams.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetPlanParams.Builder.class) +public final class GetPlanParams { + private final Optional planVersionId; + + private final Map additionalProperties; + + private GetPlanParams(Optional planVersionId, Map additionalProperties) { + this.planVersionId = planVersionId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Fetch billing settings for a specific plan version + */ + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetPlanParams && equalTo((GetPlanParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetPlanParams other) { + return planVersionId.equals(other.planVersionId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.planVersionId); + } + + @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 planVersionId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetPlanParams other) { + planVersionId(other.getPlanVersionId()); + return this; + } + + /** + *

Fetch billing settings for a specific plan version

+ */ + @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; + } + + public GetPlanParams build() { + return new GetPlanParams(planVersionId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/GetPlanResponse.java b/src/main/java/com/schematic/api/resources/plans/types/GetPlanResponse.java index 9e61a73..ea211cf 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/GetPlanResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/GetPlanResponse.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.PlanDetailResponseData; 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 GetPlanResponse { private final PlanDetailResponseData data; - private final Map params; + private final GetPlanParams params; private final Map additionalProperties; private GetPlanResponse( - PlanDetailResponseData data, Map params, Map additionalProperties) { + PlanDetailResponseData data, GetPlanParams params, Map additionalProperties) { this.data = data; this.params = params; this.additionalProperties = additionalProperties; @@ -45,7 +42,7 @@ public PlanDetailResponseData getData() { * @return Input parameters */ @JsonProperty("params") - public Map getParams() { + public GetPlanParams getParams() { return params; } @@ -79,29 +76,31 @@ public static DataStage builder() { } public interface DataStage { - _FinalStage data(@NotNull PlanDetailResponseData data); + ParamsStage data(@NotNull PlanDetailResponseData data); Builder from(GetPlanResponse other); } - public interface _FinalStage { - GetPlanResponse build(); - + public interface ParamsStage { /** *

Input parameters

*/ - _FinalStage params(Map params); + _FinalStage params(@NotNull GetPlanParams params); + } - _FinalStage putAllParams(Map params); + public interface _FinalStage { + GetPlanResponse build(); - _FinalStage params(String key, JsonNode value); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DataStage, _FinalStage { + public static final class Builder implements DataStage, ParamsStage, _FinalStage { private PlanDetailResponseData data; - private Map params = new LinkedHashMap<>(); + private GetPlanParams params; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -117,49 +116,38 @@ public Builder from(GetPlanResponse other) { @java.lang.Override @JsonSetter("data") - public _FinalStage data(@NotNull PlanDetailResponseData data) { + public ParamsStage data(@NotNull PlanDetailResponseData 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 - public _FinalStage params(String key, JsonNode value) { - this.params.put(key, value); + @JsonSetter("params") + public _FinalStage params(@NotNull GetPlanParams params) { + this.params = Objects.requireNonNull(params, "params 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 putAllParams(Map params) { - if (params != null) { - this.params.putAll(params); - } - return this; + public GetPlanResponse build() { + return new GetPlanResponse(data, params, additionalProperties); } - /** - *

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); - } + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); return this; } @java.lang.Override - public GetPlanResponse build() { - return new GetPlanResponse(data, params, additionalProperties); + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesParams.java index ab6dde5..001bc0f 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesParams.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesParams.java @@ -22,10 +22,14 @@ public final class ListPlanIssuesParams { private final Optional planId; + private final Optional planVersionId; + private final Map additionalProperties; - private ListPlanIssuesParams(Optional planId, Map additionalProperties) { + private ListPlanIssuesParams( + Optional planId, Optional planVersionId, Map additionalProperties) { this.planId = planId; + this.planVersionId = planVersionId; this.additionalProperties = additionalProperties; } @@ -34,6 +38,11 @@ public Optional getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -46,12 +55,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListPlanIssuesParams other) { - return planId.equals(other.planId); + return planId.equals(other.planId) && planVersionId.equals(other.planVersionId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planId); + return Objects.hash(this.planId, this.planVersionId); } @java.lang.Override @@ -67,6 +76,8 @@ public static Builder builder() { public static final class Builder { private Optional planId = Optional.empty(); + private Optional planVersionId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -74,6 +85,7 @@ private Builder() {} public Builder from(ListPlanIssuesParams other) { planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); return this; } @@ -88,8 +100,29 @@ public Builder planId(String planId) { return this; } + @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; + } + public ListPlanIssuesParams build() { - return new ListPlanIssuesParams(planId, additionalProperties); + return new ListPlanIssuesParams(planId, planVersionId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesResponse.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesResponse.java index f162749..e995300 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListPlanIssuesResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListPlanIssuesResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(PlanIssueResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListPlanIssuesResponse build() { return new ListPlanIssuesResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlansParams.java index 935f4a1..86ca235 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 @@ -34,9 +34,11 @@ public final class ListPlansParams { private final Optional> ids; - private final Optional limit; + private final Optional includeDraftVersions; - private final Optional offset; + private final Optional limit; + + private final Optional offset; private final Optional planType; @@ -55,8 +57,9 @@ private ListPlansParams( Optional forTrialExpiryPlan, Optional hasProductId, Optional> ids, - Optional limit, - Optional offset, + Optional includeDraftVersions, + Optional limit, + Optional offset, Optional planType, Optional q, Optional withoutEntitlementFor, @@ -68,6 +71,7 @@ private ListPlansParams( this.forTrialExpiryPlan = forTrialExpiryPlan; this.hasProductId = hasProductId; this.ids = ids; + this.includeDraftVersions = includeDraftVersions; this.limit = limit; this.offset = offset; this.planType = planType; @@ -119,11 +123,19 @@ public Optional> getIds() { return ids; } + /** + * @return Include billing settings from draft versions for plans which have draft version + */ + @JsonProperty("include_draft_versions") + public Optional getIncludeDraftVersions() { + return includeDraftVersions; + } + /** * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -131,10 +143,13 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } + /** + * @return Filter by plan type + */ @JsonProperty("plan_type") public Optional getPlanType() { return planType; @@ -179,6 +194,7 @@ private boolean equalTo(ListPlansParams other) { && forTrialExpiryPlan.equals(other.forTrialExpiryPlan) && hasProductId.equals(other.hasProductId) && ids.equals(other.ids) + && includeDraftVersions.equals(other.includeDraftVersions) && limit.equals(other.limit) && offset.equals(other.offset) && planType.equals(other.planType) @@ -196,6 +212,7 @@ public int hashCode() { this.forTrialExpiryPlan, this.hasProductId, this.ids, + this.includeDraftVersions, this.limit, this.offset, this.planType, @@ -227,9 +244,11 @@ public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional includeDraftVersions = Optional.empty(); + + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional planType = Optional.empty(); @@ -251,6 +270,7 @@ public Builder from(ListPlansParams other) { forTrialExpiryPlan(other.getForTrialExpiryPlan()); hasProductId(other.getHasProductId()); ids(other.getIds()); + includeDraftVersions(other.getIncludeDraftVersions()); limit(other.getLimit()); offset(other.getOffset()); planType(other.getPlanType()); @@ -338,16 +358,30 @@ public Builder ids(List ids) { return this; } + /** + *

Include billing settings from draft versions for plans which have draft version

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

Page limit (default 100)

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

Page offset (default 0)

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

Filter by plan type

+ */ @JsonSetter(value = "plan_type", nulls = Nulls.SKIP) public Builder planType(Optional planType) { this.planType = planType; @@ -424,6 +461,7 @@ public ListPlansParams build() { forTrialExpiryPlan, hasProductId, ids, + includeDraftVersions, limit, offset, planType, @@ -432,5 +470,15 @@ public ListPlansParams build() { withoutPaidProductId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponse.java b/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponse.java index 9e7d30b..dd38484 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/ListPlansResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListPlansResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(PlanDetailResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListPlansResponse build() { return new ListPlansResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/PublishPlanVersionResponse.java b/src/main/java/com/schematic/api/resources/plans/types/PublishPlanVersionResponse.java new file mode 100644 index 0000000..209b8c4 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/plans/types/PublishPlanVersionResponse.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.plans.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.schematic.api.core.ObjectMappers; +import com.schematic.api.types.PlanVersionResponseData; +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 = PublishPlanVersionResponse.Builder.class) +public final class PublishPlanVersionResponse { + private final PlanVersionResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private PublishPlanVersionResponse( + PlanVersionResponseData data, Map params, Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public PlanVersionResponseData 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 PublishPlanVersionResponse && equalTo((PublishPlanVersionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PublishPlanVersionResponse 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 PlanVersionResponseData data); + + Builder from(PublishPlanVersionResponse other); + } + + public interface _FinalStage { + PublishPlanVersionResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private PlanVersionResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PublishPlanVersionResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull PlanVersionResponseData 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 PublishPlanVersionResponse build() { + return new PublishPlanVersionResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java b/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java index 8f99476..2eed0c4 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/UpdateCompanyPlansResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateCompanyPlansResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateCompanyPlansResponse build() { return new UpdateCompanyPlansResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/UpdatePlanResponse.java b/src/main/java/com/schematic/api/resources/plans/types/UpdatePlanResponse.java index 5fbdb3a..02d4dc6 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/UpdatePlanResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/UpdatePlanResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdatePlanResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdatePlanResponse build() { return new UpdatePlanResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductPlanResponse.java b/src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductPlanResponse.java index deb0112..055f154 100644 --- a/src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductPlanResponse.java +++ b/src/main/java/com/schematic/api/resources/plans/types/UpsertBillingProductPlanResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { UpsertBillingProductPlanResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public UpsertBillingProductPlanResponse build() { return new UpsertBillingProductPlanResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java new file mode 100644 index 0000000..b33d6e4 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncRawScheduledcheckoutClient.java @@ -0,0 +1,443 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout; + +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.scheduledcheckout.requests.CreateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.requests.ListScheduledCheckoutsRequest; +import com.schematic.api.resources.scheduledcheckout.requests.UpdateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.types.CreateScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.GetScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.ListScheduledCheckoutsResponse; +import com.schematic.api.resources.scheduledcheckout.types.UpdateScheduledCheckoutResponse; +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 AsyncRawScheduledcheckoutClient { + protected final ClientOptions clientOptions; + + public AsyncRawScheduledcheckoutClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> listScheduledCheckouts() { + return listScheduledCheckouts(ListScheduledCheckoutsRequest.builder().build()); + } + + public CompletableFuture> listScheduledCheckouts( + RequestOptions requestOptions) { + return listScheduledCheckouts(ListScheduledCheckoutsRequest.builder().build(), requestOptions); + } + + public CompletableFuture> listScheduledCheckouts( + ListScheduledCheckoutsRequest request) { + return listScheduledCheckouts(request, null); + } + + public CompletableFuture> listScheduledCheckouts( + ListScheduledCheckoutsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout"); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListScheduledCheckoutsResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> createScheduledCheckout( + CreateScheduledCheckoutRequest request) { + return createScheduledCheckout(request, null); + } + + public CompletableFuture> createScheduledCheckout( + CreateScheduledCheckoutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateScheduledCheckoutResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> getScheduledCheckout( + String scheduledCheckoutId) { + return getScheduledCheckout(scheduledCheckoutId, null); + } + + public CompletableFuture> getScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout") + .addPathSegment(scheduledCheckoutId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetScheduledCheckoutResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateScheduledCheckout( + String scheduledCheckoutId) { + return updateScheduledCheckout( + scheduledCheckoutId, UpdateScheduledCheckoutRequest.builder().build()); + } + + public CompletableFuture> updateScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + return updateScheduledCheckout( + scheduledCheckoutId, UpdateScheduledCheckoutRequest.builder().build(), requestOptions); + } + + public CompletableFuture> updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request) { + return updateScheduledCheckout(scheduledCheckoutId, request, null); + } + + public CompletableFuture> updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout") + .addPathSegment(scheduledCheckoutId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("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()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateScheduledCheckoutResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 401: + future.completeExceptionally(new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + case 500: + future.completeExceptionally(new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncScheduledcheckoutClient.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncScheduledcheckoutClient.java new file mode 100644 index 0000000..018a710 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/AsyncScheduledcheckoutClient.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.scheduledcheckout.requests.CreateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.requests.ListScheduledCheckoutsRequest; +import com.schematic.api.resources.scheduledcheckout.requests.UpdateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.types.CreateScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.GetScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.ListScheduledCheckoutsResponse; +import com.schematic.api.resources.scheduledcheckout.types.UpdateScheduledCheckoutResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncScheduledcheckoutClient { + protected final ClientOptions clientOptions; + + private final AsyncRawScheduledcheckoutClient rawClient; + + public AsyncScheduledcheckoutClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawScheduledcheckoutClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawScheduledcheckoutClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture listScheduledCheckouts() { + return this.rawClient.listScheduledCheckouts().thenApply(response -> response.body()); + } + + public CompletableFuture listScheduledCheckouts(RequestOptions requestOptions) { + return this.rawClient.listScheduledCheckouts(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listScheduledCheckouts( + ListScheduledCheckoutsRequest request) { + return this.rawClient.listScheduledCheckouts(request).thenApply(response -> response.body()); + } + + public CompletableFuture listScheduledCheckouts( + ListScheduledCheckoutsRequest request, RequestOptions requestOptions) { + return this.rawClient.listScheduledCheckouts(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture createScheduledCheckout( + CreateScheduledCheckoutRequest request) { + return this.rawClient.createScheduledCheckout(request).thenApply(response -> response.body()); + } + + public CompletableFuture createScheduledCheckout( + CreateScheduledCheckoutRequest request, RequestOptions requestOptions) { + return this.rawClient.createScheduledCheckout(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture getScheduledCheckout(String scheduledCheckoutId) { + return this.rawClient.getScheduledCheckout(scheduledCheckoutId).thenApply(response -> response.body()); + } + + public CompletableFuture getScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + return this.rawClient + .getScheduledCheckout(scheduledCheckoutId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture updateScheduledCheckout(String scheduledCheckoutId) { + return this.rawClient.updateScheduledCheckout(scheduledCheckoutId).thenApply(response -> response.body()); + } + + public CompletableFuture updateScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + return this.rawClient + .updateScheduledCheckout(scheduledCheckoutId, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request) { + return this.rawClient + .updateScheduledCheckout(scheduledCheckoutId, request) + .thenApply(response -> response.body()); + } + + public CompletableFuture updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request, RequestOptions requestOptions) { + return this.rawClient + .updateScheduledCheckout(scheduledCheckoutId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java new file mode 100644 index 0000000..287dd6a --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/RawScheduledcheckoutClient.java @@ -0,0 +1,342 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout; + +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.scheduledcheckout.requests.CreateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.requests.ListScheduledCheckoutsRequest; +import com.schematic.api.resources.scheduledcheckout.requests.UpdateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.types.CreateScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.GetScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.ListScheduledCheckoutsResponse; +import com.schematic.api.resources.scheduledcheckout.types.UpdateScheduledCheckoutResponse; +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 RawScheduledcheckoutClient { + protected final ClientOptions clientOptions; + + public RawScheduledcheckoutClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public BaseSchematicHttpResponse listScheduledCheckouts() { + return listScheduledCheckouts(ListScheduledCheckoutsRequest.builder().build()); + } + + public BaseSchematicHttpResponse listScheduledCheckouts( + RequestOptions requestOptions) { + return listScheduledCheckouts(ListScheduledCheckoutsRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse listScheduledCheckouts( + ListScheduledCheckoutsRequest request) { + return listScheduledCheckouts(request, null); + } + + public BaseSchematicHttpResponse listScheduledCheckouts( + ListScheduledCheckoutsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout"); + if (request.getCompanyId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "company_id", request.getCompanyId().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getOffset().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "offset", request.getOffset().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListScheduledCheckoutsResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse createScheduledCheckout( + CreateScheduledCheckoutRequest request) { + return createScheduledCheckout(request, null); + } + + public BaseSchematicHttpResponse createScheduledCheckout( + CreateScheduledCheckoutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateScheduledCheckoutResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse getScheduledCheckout(String scheduledCheckoutId) { + return getScheduledCheckout(scheduledCheckoutId, null); + } + + public BaseSchematicHttpResponse getScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout") + .addPathSegment(scheduledCheckoutId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetScheduledCheckoutResponse.class), + response); + } + try { + switch (response.code()) { + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } + + public BaseSchematicHttpResponse updateScheduledCheckout( + String scheduledCheckoutId) { + return updateScheduledCheckout( + scheduledCheckoutId, UpdateScheduledCheckoutRequest.builder().build()); + } + + public BaseSchematicHttpResponse updateScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + return updateScheduledCheckout( + scheduledCheckoutId, UpdateScheduledCheckoutRequest.builder().build(), requestOptions); + } + + public BaseSchematicHttpResponse updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request) { + return updateScheduledCheckout(scheduledCheckoutId, request, null); + } + + public BaseSchematicHttpResponse updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("scheduled-checkout") + .addPathSegment(scheduledCheckoutId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new BaseSchematicException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new BaseSchematicHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateScheduledCheckoutResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 401: + throw new UnauthorizedError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + case 500: + throw new InternalServerError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ApiError.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new BaseSchematicApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new BaseSchematicException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/ScheduledcheckoutClient.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/ScheduledcheckoutClient.java new file mode 100644 index 0000000..e5cd042 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/ScheduledcheckoutClient.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout; + +import com.schematic.api.core.ClientOptions; +import com.schematic.api.core.RequestOptions; +import com.schematic.api.resources.scheduledcheckout.requests.CreateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.requests.ListScheduledCheckoutsRequest; +import com.schematic.api.resources.scheduledcheckout.requests.UpdateScheduledCheckoutRequest; +import com.schematic.api.resources.scheduledcheckout.types.CreateScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.GetScheduledCheckoutResponse; +import com.schematic.api.resources.scheduledcheckout.types.ListScheduledCheckoutsResponse; +import com.schematic.api.resources.scheduledcheckout.types.UpdateScheduledCheckoutResponse; + +public class ScheduledcheckoutClient { + protected final ClientOptions clientOptions; + + private final RawScheduledcheckoutClient rawClient; + + public ScheduledcheckoutClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawScheduledcheckoutClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawScheduledcheckoutClient withRawResponse() { + return this.rawClient; + } + + public ListScheduledCheckoutsResponse listScheduledCheckouts() { + return this.rawClient.listScheduledCheckouts().body(); + } + + public ListScheduledCheckoutsResponse listScheduledCheckouts(RequestOptions requestOptions) { + return this.rawClient.listScheduledCheckouts(requestOptions).body(); + } + + public ListScheduledCheckoutsResponse listScheduledCheckouts(ListScheduledCheckoutsRequest request) { + return this.rawClient.listScheduledCheckouts(request).body(); + } + + public ListScheduledCheckoutsResponse listScheduledCheckouts( + ListScheduledCheckoutsRequest request, RequestOptions requestOptions) { + return this.rawClient.listScheduledCheckouts(request, requestOptions).body(); + } + + public CreateScheduledCheckoutResponse createScheduledCheckout(CreateScheduledCheckoutRequest request) { + return this.rawClient.createScheduledCheckout(request).body(); + } + + public CreateScheduledCheckoutResponse createScheduledCheckout( + CreateScheduledCheckoutRequest request, RequestOptions requestOptions) { + return this.rawClient.createScheduledCheckout(request, requestOptions).body(); + } + + public GetScheduledCheckoutResponse getScheduledCheckout(String scheduledCheckoutId) { + return this.rawClient.getScheduledCheckout(scheduledCheckoutId).body(); + } + + public GetScheduledCheckoutResponse getScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + return this.rawClient + .getScheduledCheckout(scheduledCheckoutId, requestOptions) + .body(); + } + + public UpdateScheduledCheckoutResponse updateScheduledCheckout(String scheduledCheckoutId) { + return this.rawClient.updateScheduledCheckout(scheduledCheckoutId).body(); + } + + public UpdateScheduledCheckoutResponse updateScheduledCheckout( + String scheduledCheckoutId, RequestOptions requestOptions) { + return this.rawClient + .updateScheduledCheckout(scheduledCheckoutId, requestOptions) + .body(); + } + + public UpdateScheduledCheckoutResponse updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request) { + return this.rawClient + .updateScheduledCheckout(scheduledCheckoutId, request) + .body(); + } + + public UpdateScheduledCheckoutResponse updateScheduledCheckout( + String scheduledCheckoutId, UpdateScheduledCheckoutRequest request, RequestOptions requestOptions) { + return this.rawClient + .updateScheduledCheckout(scheduledCheckoutId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/CreateScheduledCheckoutRequest.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/CreateScheduledCheckoutRequest.java new file mode 100644 index 0000000..e4f8fb1 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/CreateScheduledCheckoutRequest.java @@ -0,0 +1,195 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.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 = CreateScheduledCheckoutRequest.Builder.class) +public final class CreateScheduledCheckoutRequest { + private final String companyId; + + private final OffsetDateTime executeAfter; + + private final String fromPlanId; + + private final String toPlanId; + + private final Map additionalProperties; + + private CreateScheduledCheckoutRequest( + String companyId, + OffsetDateTime executeAfter, + String fromPlanId, + String toPlanId, + Map additionalProperties) { + this.companyId = companyId; + this.executeAfter = executeAfter; + this.fromPlanId = fromPlanId; + this.toPlanId = toPlanId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("execute_after") + public OffsetDateTime getExecuteAfter() { + return executeAfter; + } + + @JsonProperty("from_plan_id") + public String getFromPlanId() { + return fromPlanId; + } + + @JsonProperty("to_plan_id") + public String getToPlanId() { + return toPlanId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateScheduledCheckoutRequest && equalTo((CreateScheduledCheckoutRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateScheduledCheckoutRequest other) { + return companyId.equals(other.companyId) + && executeAfter.equals(other.executeAfter) + && fromPlanId.equals(other.fromPlanId) + && toPlanId.equals(other.toPlanId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.executeAfter, this.fromPlanId, this.toPlanId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + ExecuteAfterStage companyId(@NotNull String companyId); + + Builder from(CreateScheduledCheckoutRequest other); + } + + public interface ExecuteAfterStage { + FromPlanIdStage executeAfter(@NotNull OffsetDateTime executeAfter); + } + + public interface FromPlanIdStage { + ToPlanIdStage fromPlanId(@NotNull String fromPlanId); + } + + public interface ToPlanIdStage { + _FinalStage toPlanId(@NotNull String toPlanId); + } + + public interface _FinalStage { + CreateScheduledCheckoutRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyIdStage, ExecuteAfterStage, FromPlanIdStage, ToPlanIdStage, _FinalStage { + private String companyId; + + private OffsetDateTime executeAfter; + + private String fromPlanId; + + private String toPlanId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateScheduledCheckoutRequest other) { + companyId(other.getCompanyId()); + executeAfter(other.getExecuteAfter()); + fromPlanId(other.getFromPlanId()); + toPlanId(other.getToPlanId()); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public ExecuteAfterStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("execute_after") + public FromPlanIdStage executeAfter(@NotNull OffsetDateTime executeAfter) { + this.executeAfter = Objects.requireNonNull(executeAfter, "executeAfter must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("from_plan_id") + public ToPlanIdStage fromPlanId(@NotNull String fromPlanId) { + this.fromPlanId = Objects.requireNonNull(fromPlanId, "fromPlanId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_id") + public _FinalStage toPlanId(@NotNull String toPlanId) { + this.toPlanId = Objects.requireNonNull(toPlanId, "toPlanId must not be null"); + return this; + } + + @java.lang.Override + public CreateScheduledCheckoutRequest build() { + return new CreateScheduledCheckoutRequest( + companyId, executeAfter, fromPlanId, toPlanId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/ListScheduledCheckoutsRequest.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/ListScheduledCheckoutsRequest.java new file mode 100644 index 0000000..b88977f --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/ListScheduledCheckoutsRequest.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.ScheduledCheckoutStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListScheduledCheckoutsRequest.Builder.class) +public final class ListScheduledCheckoutsRequest { + private final Optional companyId; + + private final Optional status; + + private final Optional limit; + + private final Optional offset; + + private final Map additionalProperties; + + private ListScheduledCheckoutsRequest( + Optional companyId, + Optional status, + Optional limit, + Optional offset, + Map additionalProperties) { + this.companyId = companyId; + this.status = status; + this.limit = limit; + this.offset = offset; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @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 ListScheduledCheckoutsRequest && equalTo((ListScheduledCheckoutsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListScheduledCheckoutsRequest other) { + return companyId.equals(other.companyId) + && status.equals(other.status) + && limit.equals(other.limit) + && offset.equals(other.offset); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.status, 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 companyId = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListScheduledCheckoutsRequest other) { + companyId(other.getCompanyId()); + status(other.getStatus()); + limit(other.getLimit()); + offset(other.getOffset()); + 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 = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ScheduledCheckoutStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + public ListScheduledCheckoutsRequest build() { + return new ListScheduledCheckoutsRequest(companyId, status, limit, offset, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/UpdateScheduledCheckoutRequest.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/UpdateScheduledCheckoutRequest.java new file mode 100644 index 0000000..23c4497 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/requests/UpdateScheduledCheckoutRequest.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.ScheduledCheckoutStatus; +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 = UpdateScheduledCheckoutRequest.Builder.class) +public final class UpdateScheduledCheckoutRequest { + private final Optional executeAfter; + + private final Optional status; + + private final Map additionalProperties; + + private UpdateScheduledCheckoutRequest( + Optional executeAfter, + Optional status, + Map additionalProperties) { + this.executeAfter = executeAfter; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("execute_after") + public Optional getExecuteAfter() { + return executeAfter; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateScheduledCheckoutRequest && equalTo((UpdateScheduledCheckoutRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateScheduledCheckoutRequest other) { + return executeAfter.equals(other.executeAfter) && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.executeAfter, this.status); + } + + @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 executeAfter = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateScheduledCheckoutRequest other) { + executeAfter(other.getExecuteAfter()); + status(other.getStatus()); + return this; + } + + @JsonSetter(value = "execute_after", nulls = Nulls.SKIP) + public Builder executeAfter(Optional executeAfter) { + this.executeAfter = executeAfter; + return this; + } + + public Builder executeAfter(OffsetDateTime executeAfter) { + this.executeAfter = Optional.ofNullable(executeAfter); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ScheduledCheckoutStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public UpdateScheduledCheckoutRequest build() { + return new UpdateScheduledCheckoutRequest(executeAfter, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/types/CreateScheduledCheckoutResponse.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/CreateScheduledCheckoutResponse.java new file mode 100644 index 0000000..c08412e --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/CreateScheduledCheckoutResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.ScheduledCheckoutResponseData; +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 = CreateScheduledCheckoutResponse.Builder.class) +public final class CreateScheduledCheckoutResponse { + private final ScheduledCheckoutResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private CreateScheduledCheckoutResponse( + ScheduledCheckoutResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public ScheduledCheckoutResponseData 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 CreateScheduledCheckoutResponse && equalTo((CreateScheduledCheckoutResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateScheduledCheckoutResponse 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 ScheduledCheckoutResponseData data); + + Builder from(CreateScheduledCheckoutResponse other); + } + + public interface _FinalStage { + CreateScheduledCheckoutResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Input parameters

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

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private ScheduledCheckoutResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetScheduledCheckoutResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull ScheduledCheckoutResponseData 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 GetScheduledCheckoutResponse build() { + return new GetScheduledCheckoutResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsParams.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsParams.java new file mode 100644 index 0000000..de7a2b9 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsParams.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.ScheduledCheckoutStatus; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListScheduledCheckoutsParams.Builder.class) +public final class ListScheduledCheckoutsParams { + private final Optional companyId; + + private final Optional limit; + + private final Optional offset; + + private final Optional status; + + private final Map additionalProperties; + + private ListScheduledCheckoutsParams( + Optional companyId, + Optional limit, + Optional offset, + Optional status, + Map additionalProperties) { + this.companyId = companyId; + this.limit = limit; + this.offset = offset; + this.status = status; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public Optional getCompanyId() { + return companyId; + } + + /** + * @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("status") + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListScheduledCheckoutsParams && equalTo((ListScheduledCheckoutsParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListScheduledCheckoutsParams other) { + return companyId.equals(other.companyId) + && limit.equals(other.limit) + && offset.equals(other.offset) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.companyId, this.limit, this.offset, this.status); + } + + @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 limit = Optional.empty(); + + private Optional offset = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListScheduledCheckoutsParams other) { + companyId(other.getCompanyId()); + limit(other.getLimit()); + offset(other.getOffset()); + status(other.getStatus()); + 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; + } + + /** + *

Page limit (default 100)

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

Page offset (default 0)

+ */ + @JsonSetter(value = "offset", nulls = Nulls.SKIP) + public Builder offset(Optional offset) { + this.offset = offset; + return this; + } + + public Builder offset(Long offset) { + this.offset = Optional.ofNullable(offset); + return this; + } + + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(ScheduledCheckoutStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public ListScheduledCheckoutsParams build() { + return new ListScheduledCheckoutsParams(companyId, limit, offset, status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsResponse.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsResponse.java new file mode 100644 index 0000000..a0e2049 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/ListScheduledCheckoutsResponse.java @@ -0,0 +1,177 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.ScheduledCheckoutResponseData; +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 = ListScheduledCheckoutsResponse.Builder.class) +public final class ListScheduledCheckoutsResponse { + private final List data; + + private final ListScheduledCheckoutsParams params; + + private final Map additionalProperties; + + private ListScheduledCheckoutsResponse( + List data, + ListScheduledCheckoutsParams params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + /** + * @return Input parameters + */ + @JsonProperty("params") + public ListScheduledCheckoutsParams getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListScheduledCheckoutsResponse && equalTo((ListScheduledCheckoutsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListScheduledCheckoutsResponse other) { + return data.equals(other.data) && params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ParamsStage builder() { + return new Builder(); + } + + public interface ParamsStage { + /** + *

Input parameters

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

Input parameters

+ *

Input parameters

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("params") + public _FinalStage params(@NotNull ListScheduledCheckoutsParams 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(ScheduledCheckoutResponseData 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 ListScheduledCheckoutsResponse build() { + return new ListScheduledCheckoutsResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/scheduledcheckout/types/UpdateScheduledCheckoutResponse.java b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/UpdateScheduledCheckoutResponse.java new file mode 100644 index 0000000..f49e646 --- /dev/null +++ b/src/main/java/com/schematic/api/resources/scheduledcheckout/types/UpdateScheduledCheckoutResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.resources.scheduledcheckout.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.ScheduledCheckoutResponseData; +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 = UpdateScheduledCheckoutResponse.Builder.class) +public final class UpdateScheduledCheckoutResponse { + private final ScheduledCheckoutResponseData data; + + private final Map params; + + private final Map additionalProperties; + + private UpdateScheduledCheckoutResponse( + ScheduledCheckoutResponseData data, + Map params, + Map additionalProperties) { + this.data = data; + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public ScheduledCheckoutResponseData 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 UpdateScheduledCheckoutResponse && equalTo((UpdateScheduledCheckoutResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateScheduledCheckoutResponse 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 ScheduledCheckoutResponseData data); + + Builder from(UpdateScheduledCheckoutResponse other); + } + + public interface _FinalStage { + UpdateScheduledCheckoutResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Input parameters

+ */ + _FinalStage params(Map params); + + _FinalStage putAllParams(Map params); + + _FinalStage params(String key, JsonNode value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private ScheduledCheckoutResponseData data; + + private Map params = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateScheduledCheckoutResponse other) { + data(other.getData()); + params(other.getParams()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull ScheduledCheckoutResponseData 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 UpdateScheduledCheckoutResponse build() { + return new UpdateScheduledCheckoutResponse(data, params, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java index 0dff711..084b8bd 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/AsyncRawWebhooksClient.java @@ -57,6 +57,11 @@ public CompletableFuture> l return listWebhookEvents(ListWebhookEventsRequest.builder().build()); } + public CompletableFuture> listWebhookEvents( + RequestOptions requestOptions) { + return listWebhookEvents(ListWebhookEventsRequest.builder().build(), requestOptions); + } + public CompletableFuture> listWebhookEvents( ListWebhookEventsRequest request) { return listWebhookEvents(request, null); @@ -85,6 +90,11 @@ public CompletableFuture> l if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -100,14 +110,14 @@ public CompletableFuture> l @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), ListWebhookEventsResponse.class), + responseBodyString, ListWebhookEventsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -139,11 +149,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -165,13 +173,17 @@ public CompletableFuture> get public CompletableFuture> getWebhookEvent( String webhookEventId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhook-events") - .addPathSegment(webhookEventId) - .build(); + .addPathSegment(webhookEventId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -185,14 +197,13 @@ public CompletableFuture> get @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), GetWebhookEventResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookEventResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -219,11 +230,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -242,6 +251,11 @@ public CompletableFuture> return countWebhookEvents(CountWebhookEventsRequest.builder().build()); } + public CompletableFuture> countWebhookEvents( + RequestOptions requestOptions) { + return countWebhookEvents(CountWebhookEventsRequest.builder().build(), requestOptions); + } + public CompletableFuture> countWebhookEvents( CountWebhookEventsRequest request) { return countWebhookEvents(request, null); @@ -270,6 +284,11 @@ public CompletableFuture> if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -285,14 +304,14 @@ public CompletableFuture> @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( - responseBody.string(), CountWebhookEventsResponse.class), + responseBodyString, CountWebhookEventsResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -324,11 +343,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -347,6 +364,11 @@ public CompletableFuture> listWe return listWebhooks(ListWebhooksRequest.builder().build()); } + public CompletableFuture> listWebhooks( + RequestOptions requestOptions) { + return listWebhooks(ListWebhooksRequest.builder().build(), requestOptions); + } + public CompletableFuture> listWebhooks( ListWebhooksRequest request) { return listWebhooks(request, null); @@ -368,6 +390,11 @@ public CompletableFuture> listWe QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -383,13 +410,13 @@ public CompletableFuture> listWe @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListWebhooksResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWebhooksResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -421,11 +448,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -447,10 +472,14 @@ public CompletableFuture> creat public CompletableFuture> createWebhook( CreateWebhookRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("webhooks") - .build(); + .addPathSegments("webhooks"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -459,7 +488,7 @@ public CompletableFuture> creat throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -474,13 +503,13 @@ public CompletableFuture> creat @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateWebhookResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateWebhookResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -512,11 +541,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -537,13 +564,17 @@ public CompletableFuture> getWebho public CompletableFuture> getWebhook( String webhookId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) - .build(); + .addPathSegment(webhookId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -557,13 +588,13 @@ public CompletableFuture> getWebho @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetWebhookResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -590,11 +621,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -613,6 +642,11 @@ public CompletableFuture> updat return updateWebhook(webhookId, UpdateWebhookRequestBody.builder().build()); } + public CompletableFuture> updateWebhook( + String webhookId, RequestOptions requestOptions) { + return updateWebhook(webhookId, UpdateWebhookRequestBody.builder().build(), requestOptions); + } + public CompletableFuture> updateWebhook( String webhookId, UpdateWebhookRequestBody request) { return updateWebhook(webhookId, request, null); @@ -620,11 +654,15 @@ public CompletableFuture> updat public CompletableFuture> updateWebhook( String webhookId, UpdateWebhookRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) - .build(); + .addPathSegment(webhookId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -633,7 +671,7 @@ public CompletableFuture> updat throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -648,13 +686,13 @@ public CompletableFuture> updat @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateWebhookResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateWebhookResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -686,11 +724,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -711,13 +747,17 @@ public CompletableFuture> delet public CompletableFuture> deleteWebhook( String webhookId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) - .build(); + .addPathSegment(webhookId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -731,13 +771,13 @@ public CompletableFuture> delet @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteWebhookResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteWebhookResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -769,11 +809,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); @@ -792,6 +830,11 @@ public CompletableFuture> count return countWebhooks(CountWebhooksRequest.builder().build()); } + public CompletableFuture> countWebhooks( + RequestOptions requestOptions) { + return countWebhooks(CountWebhooksRequest.builder().build(), requestOptions); + } + public CompletableFuture> countWebhooks( CountWebhooksRequest request) { return countWebhooks(request, null); @@ -813,6 +856,11 @@ public CompletableFuture> count QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -828,13 +876,13 @@ public CompletableFuture> count @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { future.complete(new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountWebhooksResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountWebhooksResponse.class), response)); return; } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -866,11 +914,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); + "Error with status code " + response.code(), response.code(), errorBody, response)); return; } catch (IOException e) { future.completeExceptionally(new BaseSchematicException("Network error executing HTTP request", e)); diff --git a/src/main/java/com/schematic/api/resources/webhooks/AsyncWebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/AsyncWebhooksClient.java index e6769e2..7ec64b5 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/AsyncWebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/AsyncWebhooksClient.java @@ -43,6 +43,10 @@ public CompletableFuture listWebhookEvents() { return this.rawClient.listWebhookEvents().thenApply(response -> response.body()); } + public CompletableFuture listWebhookEvents(RequestOptions requestOptions) { + return this.rawClient.listWebhookEvents(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listWebhookEvents(ListWebhookEventsRequest request) { return this.rawClient.listWebhookEvents(request).thenApply(response -> response.body()); } @@ -65,6 +69,10 @@ public CompletableFuture countWebhookEvents() { return this.rawClient.countWebhookEvents().thenApply(response -> response.body()); } + public CompletableFuture countWebhookEvents(RequestOptions requestOptions) { + return this.rawClient.countWebhookEvents(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countWebhookEvents(CountWebhookEventsRequest request) { return this.rawClient.countWebhookEvents(request).thenApply(response -> response.body()); } @@ -78,6 +86,10 @@ public CompletableFuture listWebhooks() { return this.rawClient.listWebhooks().thenApply(response -> response.body()); } + public CompletableFuture listWebhooks(RequestOptions requestOptions) { + return this.rawClient.listWebhooks(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture listWebhooks(ListWebhooksRequest request) { return this.rawClient.listWebhooks(request).thenApply(response -> response.body()); } @@ -108,6 +120,10 @@ public CompletableFuture updateWebhook(String webhookId) return this.rawClient.updateWebhook(webhookId).thenApply(response -> response.body()); } + public CompletableFuture updateWebhook(String webhookId, RequestOptions requestOptions) { + return this.rawClient.updateWebhook(webhookId, requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture updateWebhook(String webhookId, UpdateWebhookRequestBody request) { return this.rawClient.updateWebhook(webhookId, request).thenApply(response -> response.body()); } @@ -129,6 +145,10 @@ public CompletableFuture countWebhooks() { return this.rawClient.countWebhooks().thenApply(response -> response.body()); } + public CompletableFuture countWebhooks(RequestOptions requestOptions) { + return this.rawClient.countWebhooks(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture countWebhooks(CountWebhooksRequest request) { return this.rawClient.countWebhooks(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java index ce52b98..0375d9f 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/RawWebhooksClient.java @@ -53,6 +53,10 @@ public BaseSchematicHttpResponse listWebhookEvents() return listWebhookEvents(ListWebhookEventsRequest.builder().build()); } + public BaseSchematicHttpResponse listWebhookEvents(RequestOptions requestOptions) { + return listWebhookEvents(ListWebhookEventsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listWebhookEvents(ListWebhookEventsRequest request) { return listWebhookEvents(request, null); } @@ -80,6 +84,11 @@ public BaseSchematicHttpResponse listWebhookEvents( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -92,12 +101,12 @@ public BaseSchematicHttpResponse listWebhookEvents( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListWebhookEventsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWebhookEventsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -119,11 +128,9 @@ public BaseSchematicHttpResponse listWebhookEvents( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -135,13 +142,17 @@ public BaseSchematicHttpResponse getWebhookEvent(String public BaseSchematicHttpResponse getWebhookEvent( String webhookEventId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhook-events") - .addPathSegment(webhookEventId) - .build(); + .addPathSegment(webhookEventId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -152,12 +163,12 @@ public BaseSchematicHttpResponse getWebhookEvent( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetWebhookEventResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookEventResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -176,11 +187,9 @@ public BaseSchematicHttpResponse getWebhookEvent( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -190,6 +199,10 @@ public BaseSchematicHttpResponse countWebhookEvents( return countWebhookEvents(CountWebhookEventsRequest.builder().build()); } + public BaseSchematicHttpResponse countWebhookEvents(RequestOptions requestOptions) { + return countWebhookEvents(CountWebhookEventsRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countWebhookEvents(CountWebhookEventsRequest request) { return countWebhookEvents(request, null); } @@ -217,6 +230,11 @@ public BaseSchematicHttpResponse countWebhookEvents( if (request.getIds().isPresent()) { QueryStringMapper.addQueryParameter(httpUrl, "ids", request.getIds().get(), true); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -229,12 +247,12 @@ public BaseSchematicHttpResponse countWebhookEvents( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountWebhookEventsResponse.class), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountWebhookEventsResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -256,11 +274,9 @@ public BaseSchematicHttpResponse countWebhookEvents( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -270,6 +286,10 @@ public BaseSchematicHttpResponse listWebhooks() { return listWebhooks(ListWebhooksRequest.builder().build()); } + public BaseSchematicHttpResponse listWebhooks(RequestOptions requestOptions) { + return listWebhooks(ListWebhooksRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse listWebhooks(ListWebhooksRequest request) { return listWebhooks(request, null); } @@ -290,6 +310,11 @@ public BaseSchematicHttpResponse listWebhooks( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -302,12 +327,11 @@ public BaseSchematicHttpResponse listWebhooks( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListWebhooksResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListWebhooksResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -329,11 +353,9 @@ public BaseSchematicHttpResponse listWebhooks( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -345,10 +367,14 @@ public BaseSchematicHttpResponse createWebhook(CreateWebh public BaseSchematicHttpResponse createWebhook( CreateWebhookRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() - .addPathSegments("webhooks") - .build(); + .addPathSegments("webhooks"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -357,7 +383,7 @@ public BaseSchematicHttpResponse createWebhook( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("POST", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -369,12 +395,11 @@ public BaseSchematicHttpResponse createWebhook( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateWebhookResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateWebhookResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -396,11 +421,9 @@ public BaseSchematicHttpResponse createWebhook( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -411,13 +434,17 @@ public BaseSchematicHttpResponse getWebhook(String webhookId } public BaseSchematicHttpResponse getWebhook(String webhookId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) - .build(); + .addPathSegment(webhookId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("GET", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -428,11 +455,11 @@ public BaseSchematicHttpResponse getWebhook(String webhookId } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetWebhookResponse.class), response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetWebhookResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 401: @@ -451,11 +478,9 @@ public BaseSchematicHttpResponse getWebhook(String webhookId } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -465,6 +490,11 @@ public BaseSchematicHttpResponse updateWebhook(String web return updateWebhook(webhookId, UpdateWebhookRequestBody.builder().build()); } + public BaseSchematicHttpResponse updateWebhook( + String webhookId, RequestOptions requestOptions) { + return updateWebhook(webhookId, UpdateWebhookRequestBody.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse updateWebhook( String webhookId, UpdateWebhookRequestBody request) { return updateWebhook(webhookId, request, null); @@ -472,11 +502,15 @@ public BaseSchematicHttpResponse updateWebhook( public BaseSchematicHttpResponse updateWebhook( String webhookId, UpdateWebhookRequestBody request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) - .build(); + .addPathSegment(webhookId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } RequestBody body; try { body = RequestBody.create( @@ -485,7 +519,7 @@ public BaseSchematicHttpResponse updateWebhook( throw new BaseSchematicException("Failed to serialize request", e); } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("PUT", body) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Content-Type", "application/json") @@ -497,12 +531,11 @@ public BaseSchematicHttpResponse updateWebhook( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateWebhookResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateWebhookResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -524,11 +557,9 @@ public BaseSchematicHttpResponse updateWebhook( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -540,13 +571,17 @@ public BaseSchematicHttpResponse deleteWebhook(String web public BaseSchematicHttpResponse deleteWebhook( String webhookId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("webhooks") - .addPathSegment(webhookId) - .build(); + .addPathSegment(webhookId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request okhttpRequest = new Request.Builder() - .url(httpUrl) + .url(httpUrl.build()) .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") @@ -557,12 +592,11 @@ public BaseSchematicHttpResponse deleteWebhook( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteWebhookResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteWebhookResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -584,11 +618,9 @@ public BaseSchematicHttpResponse deleteWebhook( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } @@ -598,6 +630,10 @@ public BaseSchematicHttpResponse countWebhooks() { return countWebhooks(CountWebhooksRequest.builder().build()); } + public BaseSchematicHttpResponse countWebhooks(RequestOptions requestOptions) { + return countWebhooks(CountWebhooksRequest.builder().build(), requestOptions); + } + public BaseSchematicHttpResponse countWebhooks(CountWebhooksRequest request) { return countWebhooks(request, null); } @@ -618,6 +654,11 @@ public BaseSchematicHttpResponse countWebhooks( QueryStringMapper.addQueryParameter( httpUrl, "offset", request.getOffset().get(), false); } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -630,12 +671,11 @@ public BaseSchematicHttpResponse countWebhooks( } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { return new BaseSchematicHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CountWebhooksResponse.class), - response); + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CountWebhooksResponse.class), response); } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; try { switch (response.code()) { case 400: @@ -657,11 +697,9 @@ public BaseSchematicHttpResponse countWebhooks( } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new BaseSchematicApiException( - "Error with status code " + response.code(), - response.code(), - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response); + "Error with status code " + response.code(), response.code(), errorBody, response); } catch (IOException e) { throw new BaseSchematicException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java b/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java index c0b692e..2f3ab88 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java +++ b/src/main/java/com/schematic/api/resources/webhooks/WebhooksClient.java @@ -42,6 +42,10 @@ public ListWebhookEventsResponse listWebhookEvents() { return this.rawClient.listWebhookEvents().body(); } + public ListWebhookEventsResponse listWebhookEvents(RequestOptions requestOptions) { + return this.rawClient.listWebhookEvents(requestOptions).body(); + } + public ListWebhookEventsResponse listWebhookEvents(ListWebhookEventsRequest request) { return this.rawClient.listWebhookEvents(request).body(); } @@ -63,6 +67,10 @@ public CountWebhookEventsResponse countWebhookEvents() { return this.rawClient.countWebhookEvents().body(); } + public CountWebhookEventsResponse countWebhookEvents(RequestOptions requestOptions) { + return this.rawClient.countWebhookEvents(requestOptions).body(); + } + public CountWebhookEventsResponse countWebhookEvents(CountWebhookEventsRequest request) { return this.rawClient.countWebhookEvents(request).body(); } @@ -76,6 +84,10 @@ public ListWebhooksResponse listWebhooks() { return this.rawClient.listWebhooks().body(); } + public ListWebhooksResponse listWebhooks(RequestOptions requestOptions) { + return this.rawClient.listWebhooks(requestOptions).body(); + } + public ListWebhooksResponse listWebhooks(ListWebhooksRequest request) { return this.rawClient.listWebhooks(request).body(); } @@ -104,6 +116,10 @@ public UpdateWebhookResponse updateWebhook(String webhookId) { return this.rawClient.updateWebhook(webhookId).body(); } + public UpdateWebhookResponse updateWebhook(String webhookId, RequestOptions requestOptions) { + return this.rawClient.updateWebhook(webhookId, requestOptions).body(); + } + public UpdateWebhookResponse updateWebhook(String webhookId, UpdateWebhookRequestBody request) { return this.rawClient.updateWebhook(webhookId, request).body(); } @@ -125,6 +141,10 @@ public CountWebhooksResponse countWebhooks() { return this.rawClient.countWebhooks().body(); } + public CountWebhooksResponse countWebhooks(RequestOptions requestOptions) { + return this.rawClient.countWebhooks(requestOptions).body(); + } + public CountWebhooksResponse countWebhooks(CountWebhooksRequest request) { return this.rawClient.countWebhooks(request).body(); } diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhookEventsRequest.java b/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhookEventsRequest.java index 1b8db1e..77a8d09 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhookEventsRequest.java +++ b/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhookEventsRequest.java @@ -28,9 +28,9 @@ public final class CountWebhookEventsRequest { private final Optional webhookId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -38,8 +38,8 @@ private CountWebhookEventsRequest( Optional> ids, Optional q, Optional webhookId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.q = q; @@ -68,7 +68,7 @@ public Optional getWebhookId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -76,7 +76,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -121,9 +121,9 @@ public static final class Builder { private Optional webhookId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -181,12 +181,12 @@ public Builder webhookId(String webhookId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -208,5 +208,15 @@ public Builder offset(Integer offset) { public CountWebhookEventsRequest build() { return new CountWebhookEventsRequest(ids, q, webhookId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhooksRequest.java b/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhooksRequest.java index a52f48a..1edbf02 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhooksRequest.java +++ b/src/main/java/com/schematic/api/resources/webhooks/requests/CountWebhooksRequest.java @@ -22,17 +22,14 @@ public final class CountWebhooksRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private CountWebhooksRequest( - Optional q, - Optional limit, - Optional offset, - Map additionalProperties) { + Optional q, Optional limit, Optional offset, Map additionalProperties) { this.q = q; this.limit = limit; this.offset = offset; @@ -48,7 +45,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -56,7 +53,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -93,9 +90,9 @@ public static Builder builder() { public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,12 +121,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder offset(Integer offset) { public CountWebhooksRequest build() { return new CountWebhooksRequest(q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/CreateWebhookRequestBody.java b/src/main/java/com/schematic/api/resources/webhooks/requests/CreateWebhookRequestBody.java index 88339c1..e82f432 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 @@ -125,6 +125,10 @@ public interface UrlStage { public interface _FinalStage { CreateWebhookRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditTriggerConfigs(Optional> creditTriggerConfigs); _FinalStage creditTriggerConfigs(List creditTriggerConfigs); @@ -237,5 +241,17 @@ public CreateWebhookRequestBody build() { return new CreateWebhookRequestBody( creditTriggerConfigs, entitlementTriggerConfigs, name, requestTypes, url, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhookEventsRequest.java b/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhookEventsRequest.java index cd8585a..0a8d37d 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhookEventsRequest.java +++ b/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhookEventsRequest.java @@ -28,9 +28,9 @@ public final class ListWebhookEventsRequest { private final Optional webhookId; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; @@ -38,8 +38,8 @@ private ListWebhookEventsRequest( Optional> ids, Optional q, Optional webhookId, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Map additionalProperties) { this.ids = ids; this.q = q; @@ -68,7 +68,7 @@ public Optional getWebhookId() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -76,7 +76,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -121,9 +121,9 @@ public static final class Builder { private Optional webhookId = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -181,12 +181,12 @@ public Builder webhookId(String webhookId) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -208,5 +208,15 @@ public Builder offset(Integer offset) { public ListWebhookEventsRequest build() { return new ListWebhookEventsRequest(ids, q, webhookId, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhooksRequest.java b/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhooksRequest.java index 4dc7f30..4089b5b 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhooksRequest.java +++ b/src/main/java/com/schematic/api/resources/webhooks/requests/ListWebhooksRequest.java @@ -22,17 +22,14 @@ public final class ListWebhooksRequest { private final Optional q; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Map additionalProperties; private ListWebhooksRequest( - Optional q, - Optional limit, - Optional offset, - Map additionalProperties) { + Optional q, Optional limit, Optional offset, Map additionalProperties) { this.q = q; this.limit = limit; this.offset = offset; @@ -48,7 +45,7 @@ public Optional getQ() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -56,7 +53,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -93,9 +90,9 @@ public static Builder builder() { public static final class Builder { private Optional q = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -124,12 +121,12 @@ public Builder q(String q) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder offset(Integer offset) { public ListWebhooksRequest build() { return new ListWebhooksRequest(q, limit, offset, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/requests/UpdateWebhookRequestBody.java b/src/main/java/com/schematic/api/resources/webhooks/requests/UpdateWebhookRequestBody.java index 5d7fe07..6530baf 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 @@ -231,5 +231,15 @@ public UpdateWebhookRequestBody build() { url, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsParams.java b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsParams.java index a0dc1c3..aa1b1a1 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsParams.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsParams.java @@ -23,9 +23,9 @@ public final class CountWebhookEventsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -35,8 +35,8 @@ public final class CountWebhookEventsParams { private CountWebhookEventsParams( Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional webhookId, Map additionalProperties) { @@ -57,7 +57,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -116,9 +116,9 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -153,12 +153,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -202,5 +202,15 @@ public Builder webhookId(String webhookId) { public CountWebhookEventsParams build() { return new CountWebhookEventsParams(ids, limit, offset, q, webhookId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsResponse.java index ea4e14b..4b9e1d8 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhookEventsResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountWebhookEventsResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountWebhookEventsParams params) { public CountWebhookEventsResponse build() { return new CountWebhookEventsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksParams.java b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksParams.java index f17a2f4..97913da 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksParams.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksParams.java @@ -20,19 +20,16 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CountWebhooksParams.Builder.class) public final class CountWebhooksParams { - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; private final Map additionalProperties; private CountWebhooksParams( - Optional limit, - Optional offset, - Optional q, - Map additionalProperties) { + Optional limit, Optional offset, Optional q, Map additionalProperties) { this.limit = limit; this.offset = offset; this.q = q; @@ -43,7 +40,7 @@ private CountWebhooksParams( * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -51,7 +48,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -91,9 +88,9 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -113,12 +110,12 @@ public Builder from(CountWebhooksParams other) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder q(String q) { public CountWebhooksParams build() { return new CountWebhooksParams(limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksResponse.java index 5d9cd4f..ad59a7b 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/CountWebhooksResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { CountWebhooksResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -133,5 +137,17 @@ public _FinalStage params(@NotNull CountWebhooksParams params) { public CountWebhooksResponse build() { return new CountWebhooksResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookResponse.java index 752a326..edaa40a 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/CreateWebhookResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { CreateWebhookResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public CreateWebhookResponse build() { return new CreateWebhookResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/DeleteWebhookResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/DeleteWebhookResponse.java index d8fe5ac..b95794e 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/DeleteWebhookResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/DeleteWebhookResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { DeleteWebhookResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public DeleteWebhookResponse build() { return new DeleteWebhookResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookEventResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookEventResponse.java index 9f7aacf..d8c52c2 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookEventResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookEventResponse.java @@ -89,6 +89,10 @@ public interface DataStage { public interface _FinalStage { GetWebhookEventResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -163,5 +167,17 @@ public _FinalStage params(Map params) { public GetWebhookEventResponse build() { return new GetWebhookEventResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookResponse.java index 1f7e92b..fafe41d 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/GetWebhookResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { GetWebhookResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public GetWebhookResponse build() { return new GetWebhookResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsParams.java b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsParams.java index 7aed7a8..6286655 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsParams.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsParams.java @@ -23,9 +23,9 @@ public final class ListWebhookEventsParams { private final Optional> ids; - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; @@ -35,8 +35,8 @@ public final class ListWebhookEventsParams { private ListWebhookEventsParams( Optional> ids, - Optional limit, - Optional offset, + Optional limit, + Optional offset, Optional q, Optional webhookId, Map additionalProperties) { @@ -57,7 +57,7 @@ public Optional> getIds() { * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -65,7 +65,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -116,9 +116,9 @@ public static Builder builder() { public static final class Builder { private Optional> ids = Optional.empty(); - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -153,12 +153,12 @@ public Builder ids(List ids) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -202,5 +202,15 @@ public Builder webhookId(String webhookId) { public ListWebhookEventsParams build() { return new ListWebhookEventsParams(ids, limit, offset, q, webhookId, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsResponse.java index 99ae3cd..c6b37a7 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhookEventsResponse.java @@ -92,6 +92,10 @@ public interface ParamsStage { public interface _FinalStage { ListWebhookEventsResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(WebhookEventDetailResponseData data); @@ -157,5 +161,17 @@ public _FinalStage data(List data) { public ListWebhookEventsResponse build() { return new ListWebhookEventsResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksParams.java b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksParams.java index be1e9f1..057537a 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksParams.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksParams.java @@ -20,19 +20,16 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListWebhooksParams.Builder.class) public final class ListWebhooksParams { - private final Optional limit; + private final Optional limit; - private final Optional offset; + private final Optional offset; private final Optional q; private final Map additionalProperties; private ListWebhooksParams( - Optional limit, - Optional offset, - Optional q, - Map additionalProperties) { + Optional limit, Optional offset, Optional q, Map additionalProperties) { this.limit = limit; this.offset = offset; this.q = q; @@ -43,7 +40,7 @@ private ListWebhooksParams( * @return Page limit (default 100) */ @JsonProperty("limit") - public Optional getLimit() { + public Optional getLimit() { return limit; } @@ -51,7 +48,7 @@ public Optional getLimit() { * @return Page offset (default 0) */ @JsonProperty("offset") - public Optional getOffset() { + public Optional getOffset() { return offset; } @@ -91,9 +88,9 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional limit = Optional.empty(); + private Optional limit = Optional.empty(); - private Optional offset = Optional.empty(); + private Optional offset = Optional.empty(); private Optional q = Optional.empty(); @@ -113,12 +110,12 @@ public Builder from(ListWebhooksParams other) { *

Page limit (default 100)

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

Page offset (default 0)

*/ @JsonSetter(value = "offset", nulls = Nulls.SKIP) - public Builder offset(Optional offset) { + public Builder offset(Optional offset) { this.offset = offset; return this; } - public Builder offset(Integer offset) { + public Builder offset(Long offset) { this.offset = Optional.ofNullable(offset); return this; } @@ -151,5 +148,15 @@ public Builder q(String q) { public ListWebhooksParams build() { return new ListWebhooksParams(limit, offset, q, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksResponse.java index 085afe7..8be9790 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/ListWebhooksResponse.java @@ -90,6 +90,10 @@ public interface ParamsStage { public interface _FinalStage { ListWebhooksResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage data(List data); _FinalStage addData(WebhookResponseData data); @@ -155,5 +159,17 @@ public _FinalStage data(List data) { public ListWebhooksResponse build() { return new ListWebhooksResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookResponse.java b/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookResponse.java index 53d451e..7087073 100644 --- a/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookResponse.java +++ b/src/main/java/com/schematic/api/resources/webhooks/types/UpdateWebhookResponse.java @@ -87,6 +87,10 @@ public interface DataStage { public interface _FinalStage { UpdateWebhookResponse build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Input parameters

*/ @@ -161,5 +165,17 @@ public _FinalStage params(Map params) { public UpdateWebhookResponse build() { return new UpdateWebhookResponse(data, params, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ActorType.java b/src/main/java/com/schematic/api/types/ActorType.java index 13df57d..a2fdfee 100644 --- a/src/main/java/com/schematic/api/types/ActorType.java +++ b/src/main/java/com/schematic/api/types/ActorType.java @@ -14,6 +14,8 @@ public final class ActorType { public static final ActorType API_KEY = new ActorType(Value.API_KEY, "api_key"); + public static final ActorType STRIPE_APP = new ActorType(Value.STRIPE_APP, "stripe_app"); + public static final ActorType SYSTEM = new ActorType(Value.SYSTEM, "system"); private final Value value; @@ -53,6 +55,8 @@ public T visit(Visitor visitor) { return visitor.visitAppUser(); case API_KEY: return visitor.visitApiKey(); + case STRIPE_APP: + return visitor.visitStripeApp(); case SYSTEM: return visitor.visitSystem(); case UNKNOWN: @@ -70,6 +74,8 @@ public static ActorType valueOf(String value) { return APP_USER; case "api_key": return API_KEY; + case "stripe_app": + return STRIPE_APP; case "system": return SYSTEM; default: @@ -82,6 +88,8 @@ public enum Value { APP_USER, + STRIPE_APP, + SYSTEM, TEMPORARY_ACCESS_TOKEN, @@ -94,6 +102,8 @@ public interface Visitor { T visitAppUser(); + T visitStripeApp(); + T visitSystem(); T visitTemporaryAccessToken(); diff --git a/src/main/java/com/schematic/api/types/ApiError.java b/src/main/java/com/schematic/api/types/ApiError.java index e4e4841..9e3d917 100644 --- a/src/main/java/com/schematic/api/types/ApiError.java +++ b/src/main/java/com/schematic/api/types/ApiError.java @@ -76,6 +76,10 @@ public interface ErrorStage { public interface _FinalStage { ApiError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -109,5 +113,17 @@ public _FinalStage error(@NotNull String error) { public ApiError build() { return new ApiError(error, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java index b7df5a6..aab7f9a 100644 --- a/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java +++ b/src/main/java/com/schematic/api/types/ApiKeyCreateResponseData.java @@ -36,6 +36,8 @@ public final class ApiKeyCreateResponseData { private final String name; + private final boolean readonly; + private final List scopes; private final String secret; @@ -51,6 +53,7 @@ private ApiKeyCreateResponseData( String id, Optional lastUsedAt, String name, + boolean readonly, List scopes, String secret, OffsetDateTime updatedAt, @@ -61,6 +64,7 @@ private ApiKeyCreateResponseData( this.id = id; this.lastUsedAt = lastUsedAt; this.name = name; + this.readonly = readonly; this.scopes = scopes; this.secret = secret; this.updatedAt = updatedAt; @@ -97,6 +101,11 @@ public String getName() { return name; } + @JsonProperty("readonly") + public boolean getReadonly() { + return readonly; + } + @JsonProperty("scopes") public List getScopes() { return scopes; @@ -130,6 +139,7 @@ private boolean equalTo(ApiKeyCreateResponseData other) { && id.equals(other.id) && lastUsedAt.equals(other.lastUsedAt) && name.equals(other.name) + && readonly == other.readonly && scopes.equals(other.scopes) && secret.equals(other.secret) && updatedAt.equals(other.updatedAt); @@ -144,6 +154,7 @@ public int hashCode() { this.id, this.lastUsedAt, this.name, + this.readonly, this.scopes, this.secret, this.updatedAt); @@ -169,7 +180,11 @@ public interface IdStage { } public interface NameStage { - SecretStage name(@NotNull String name); + ReadonlyStage name(@NotNull String name); + } + + public interface ReadonlyStage { + SecretStage readonly(boolean readonly); } public interface SecretStage { @@ -183,6 +198,10 @@ public interface UpdatedAtStage { public interface _FinalStage { ApiKeyCreateResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -204,13 +223,15 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder - implements CreatedAtStage, IdStage, NameStage, SecretStage, UpdatedAtStage, _FinalStage { + implements CreatedAtStage, IdStage, NameStage, ReadonlyStage, SecretStage, UpdatedAtStage, _FinalStage { private OffsetDateTime createdAt; private String id; private String name; + private boolean readonly; + private String secret; private OffsetDateTime updatedAt; @@ -236,6 +257,7 @@ public Builder from(ApiKeyCreateResponseData other) { id(other.getId()); lastUsedAt(other.getLastUsedAt()); name(other.getName()); + readonly(other.getReadonly()); scopes(other.getScopes()); secret(other.getSecret()); updatedAt(other.getUpdatedAt()); @@ -258,11 +280,18 @@ public NameStage id(@NotNull String id) { @java.lang.Override @JsonSetter("name") - public SecretStage name(@NotNull String name) { + public ReadonlyStage name(@NotNull String name) { this.name = Objects.requireNonNull(name, "name must not be null"); return this; } + @java.lang.Override + @JsonSetter("readonly") + public SecretStage readonly(boolean readonly) { + this.readonly = readonly; + return this; + } + @java.lang.Override @JsonSetter("secret") public UpdatedAtStage secret(@NotNull String secret) { @@ -349,10 +378,23 @@ public ApiKeyCreateResponseData build() { id, lastUsedAt, name, + readonly, scopes, secret, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ApiKeyRequestListResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyRequestListResponseData.java deleted file mode 100644 index 24516fe..0000000 --- a/src/main/java/com/schematic/api/types/ApiKeyRequestListResponseData.java +++ /dev/null @@ -1,567 +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 = ApiKeyRequestListResponseData.Builder.class) -public final class ApiKeyRequestListResponseData { - private final String apiKeyId; - - private final Optional endedAt; - - private final Optional environmentId; - - private final String id; - - private final String method; - - private final Optional reqBody; - - private final Optional requestType; - - 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 ApiKeyRequestListResponseData( - String apiKeyId, - Optional endedAt, - Optional environmentId, - String id, - String method, - Optional reqBody, - Optional requestType, - Optional resourceId, - Optional resourceIdString, - Optional resourceName, - Optional resourceType, - Optional respCode, - Optional secondaryResource, - OffsetDateTime startedAt, - String url, - Optional userName, - Map additionalProperties) { - this.apiKeyId = apiKeyId; - this.endedAt = endedAt; - this.environmentId = environmentId; - this.id = id; - this.method = method; - this.reqBody = reqBody; - this.requestType = requestType; - 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("api_key_id") - public String 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("request_type") - public Optional getRequestType() { - return requestType; - } - - @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 ApiKeyRequestListResponseData && equalTo((ApiKeyRequestListResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ApiKeyRequestListResponseData other) { - return apiKeyId.equals(other.apiKeyId) - && endedAt.equals(other.endedAt) - && environmentId.equals(other.environmentId) - && id.equals(other.id) - && method.equals(other.method) - && reqBody.equals(other.reqBody) - && requestType.equals(other.requestType) - && 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.apiKeyId, - this.endedAt, - this.environmentId, - this.id, - this.method, - this.reqBody, - this.requestType, - 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 ApiKeyIdStage builder() { - return new Builder(); - } - - public interface ApiKeyIdStage { - IdStage apiKeyId(@NotNull String apiKeyId); - - Builder from(ApiKeyRequestListResponseData 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 { - ApiKeyRequestListResponseData build(); - - _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 requestType(Optional requestType); - - _FinalStage requestType(String requestType); - - _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 ApiKeyIdStage, IdStage, MethodStage, StartedAtStage, UrlStage, _FinalStage { - private String apiKeyId; - - 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 requestType = Optional.empty(); - - private Optional reqBody = Optional.empty(); - - private Optional environmentId = Optional.empty(); - - private Optional endedAt = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ApiKeyRequestListResponseData other) { - apiKeyId(other.getApiKeyId()); - endedAt(other.getEndedAt()); - environmentId(other.getEnvironmentId()); - id(other.getId()); - method(other.getMethod()); - reqBody(other.getReqBody()); - requestType(other.getRequestType()); - 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("api_key_id") - public IdStage apiKeyId(@NotNull String apiKeyId) { - this.apiKeyId = Objects.requireNonNull(apiKeyId, "apiKeyId 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 requestType(String requestType) { - this.requestType = Optional.ofNullable(requestType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "request_type", nulls = Nulls.SKIP) - public _FinalStage requestType(Optional requestType) { - this.requestType = requestType; - 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 ApiKeyRequestListResponseData build() { - return new ApiKeyRequestListResponseData( - apiKeyId, - endedAt, - environmentId, - id, - method, - reqBody, - requestType, - resourceId, - resourceIdString, - resourceName, - resourceType, - respCode, - secondaryResource, - startedAt, - url, - userName, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/ApiKeyRequestResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyRequestResponseData.java deleted file mode 100644 index 20b4b89..0000000 --- a/src/main/java/com/schematic/api/types/ApiKeyRequestResponseData.java +++ /dev/null @@ -1,695 +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 = ApiKeyRequestResponseData.Builder.class) -public final class ApiKeyRequestResponseData { - private final Optional apiKey; - - private final String apiKeyId; - - private final Optional endedAt; - - private final Optional environmentId; - - private final String id; - - private final String method; - - private final Optional reqBody; - - private final Optional requestType; - - 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 userAgent; - - private final Optional userId; - - private final Optional userName; - - private final Map additionalProperties; - - private ApiKeyRequestResponseData( - Optional apiKey, - String apiKeyId, - Optional endedAt, - Optional environmentId, - String id, - String method, - Optional reqBody, - Optional requestType, - Optional resourceId, - Optional resourceIdString, - Optional resourceName, - Optional resourceType, - Optional respBody, - Optional respCode, - Optional secondaryResource, - OffsetDateTime startedAt, - String url, - Optional userAgent, - Optional userId, - Optional userName, - Map additionalProperties) { - this.apiKey = apiKey; - this.apiKeyId = apiKeyId; - this.endedAt = endedAt; - this.environmentId = environmentId; - this.id = id; - this.method = method; - this.reqBody = reqBody; - this.requestType = requestType; - 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.userAgent = userAgent; - this.userId = userId; - this.userName = userName; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("api_key") - public Optional getApiKey() { - return apiKey; - } - - @JsonProperty("api_key_id") - public String 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("request_type") - public Optional getRequestType() { - return requestType; - } - - @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_agent") - public Optional getUserAgent() { - return userAgent; - } - - @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 ApiKeyRequestResponseData && equalTo((ApiKeyRequestResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ApiKeyRequestResponseData other) { - return apiKey.equals(other.apiKey) - && apiKeyId.equals(other.apiKeyId) - && endedAt.equals(other.endedAt) - && environmentId.equals(other.environmentId) - && id.equals(other.id) - && method.equals(other.method) - && reqBody.equals(other.reqBody) - && requestType.equals(other.requestType) - && 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) - && userAgent.equals(other.userAgent) - && userId.equals(other.userId) - && userName.equals(other.userName); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.apiKey, - this.apiKeyId, - this.endedAt, - this.environmentId, - this.id, - this.method, - this.reqBody, - this.requestType, - this.resourceId, - this.resourceIdString, - this.resourceName, - this.resourceType, - this.respBody, - this.respCode, - this.secondaryResource, - this.startedAt, - this.url, - this.userAgent, - this.userId, - this.userName); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ApiKeyIdStage builder() { - return new Builder(); - } - - public interface ApiKeyIdStage { - IdStage apiKeyId(@NotNull String apiKeyId); - - Builder from(ApiKeyRequestResponseData 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 { - ApiKeyRequestResponseData build(); - - _FinalStage apiKey(Optional apiKey); - - _FinalStage apiKey(ApiKeyResponseData apiKey); - - _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 requestType(Optional requestType); - - _FinalStage requestType(String requestType); - - _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 userAgent(Optional userAgent); - - _FinalStage userAgent(String userAgent); - - _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 ApiKeyIdStage, IdStage, MethodStage, StartedAtStage, UrlStage, _FinalStage { - private String apiKeyId; - - private String id; - - private String method; - - private OffsetDateTime startedAt; - - private String url; - - private Optional userName = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional userAgent = 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 requestType = Optional.empty(); - - private Optional reqBody = Optional.empty(); - - private Optional environmentId = Optional.empty(); - - private Optional endedAt = Optional.empty(); - - private Optional apiKey = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ApiKeyRequestResponseData other) { - apiKey(other.getApiKey()); - apiKeyId(other.getApiKeyId()); - endedAt(other.getEndedAt()); - environmentId(other.getEnvironmentId()); - id(other.getId()); - method(other.getMethod()); - reqBody(other.getReqBody()); - requestType(other.getRequestType()); - 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()); - userAgent(other.getUserAgent()); - userId(other.getUserId()); - userName(other.getUserName()); - return this; - } - - @java.lang.Override - @JsonSetter("api_key_id") - public IdStage apiKeyId(@NotNull String apiKeyId) { - this.apiKeyId = Objects.requireNonNull(apiKeyId, "apiKeyId 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 userAgent(String userAgent) { - this.userAgent = Optional.ofNullable(userAgent); - return this; - } - - @java.lang.Override - @JsonSetter(value = "user_agent", nulls = Nulls.SKIP) - public _FinalStage userAgent(Optional userAgent) { - this.userAgent = userAgent; - 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 requestType(String requestType) { - this.requestType = Optional.ofNullable(requestType); - return this; - } - - @java.lang.Override - @JsonSetter(value = "request_type", nulls = Nulls.SKIP) - public _FinalStage requestType(Optional requestType) { - this.requestType = requestType; - 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 apiKey(ApiKeyResponseData apiKey) { - this.apiKey = Optional.ofNullable(apiKey); - return this; - } - - @java.lang.Override - @JsonSetter(value = "api_key", nulls = Nulls.SKIP) - public _FinalStage apiKey(Optional apiKey) { - this.apiKey = apiKey; - return this; - } - - @java.lang.Override - public ApiKeyRequestResponseData build() { - return new ApiKeyRequestResponseData( - apiKey, - apiKeyId, - endedAt, - environmentId, - id, - method, - reqBody, - requestType, - resourceId, - resourceIdString, - resourceName, - resourceType, - respBody, - respCode, - secondaryResource, - startedAt, - url, - userAgent, - userId, - userName, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/ApiKeyResponseData.java b/src/main/java/com/schematic/api/types/ApiKeyResponseData.java index f98026a..338e1d8 100644 --- a/src/main/java/com/schematic/api/types/ApiKeyResponseData.java +++ b/src/main/java/com/schematic/api/types/ApiKeyResponseData.java @@ -36,6 +36,8 @@ public final class ApiKeyResponseData { private final String name; + private final boolean readonly; + private final List scopes; private final OffsetDateTime updatedAt; @@ -49,6 +51,7 @@ private ApiKeyResponseData( String id, Optional lastUsedAt, String name, + boolean readonly, List scopes, OffsetDateTime updatedAt, Map additionalProperties) { @@ -58,6 +61,7 @@ private ApiKeyResponseData( this.id = id; this.lastUsedAt = lastUsedAt; this.name = name; + this.readonly = readonly; this.scopes = scopes; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -93,6 +97,11 @@ public String getName() { return name; } + @JsonProperty("readonly") + public boolean getReadonly() { + return readonly; + } + @JsonProperty("scopes") public List getScopes() { return scopes; @@ -121,6 +130,7 @@ private boolean equalTo(ApiKeyResponseData other) { && id.equals(other.id) && lastUsedAt.equals(other.lastUsedAt) && name.equals(other.name) + && readonly == other.readonly && scopes.equals(other.scopes) && updatedAt.equals(other.updatedAt); } @@ -134,6 +144,7 @@ public int hashCode() { this.id, this.lastUsedAt, this.name, + this.readonly, this.scopes, this.updatedAt); } @@ -158,7 +169,11 @@ public interface IdStage { } public interface NameStage { - UpdatedAtStage name(@NotNull String name); + ReadonlyStage name(@NotNull String name); + } + + public interface ReadonlyStage { + UpdatedAtStage readonly(boolean readonly); } public interface UpdatedAtStage { @@ -168,6 +183,10 @@ public interface UpdatedAtStage { public interface _FinalStage { ApiKeyResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -188,13 +207,16 @@ public interface _FinalStage { } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CreatedAtStage, IdStage, NameStage, UpdatedAtStage, _FinalStage { + public static final class Builder + implements CreatedAtStage, IdStage, NameStage, ReadonlyStage, UpdatedAtStage, _FinalStage { private OffsetDateTime createdAt; private String id; private String name; + private boolean readonly; + private OffsetDateTime updatedAt; private List scopes = new ArrayList<>(); @@ -218,6 +240,7 @@ public Builder from(ApiKeyResponseData other) { id(other.getId()); lastUsedAt(other.getLastUsedAt()); name(other.getName()); + readonly(other.getReadonly()); scopes(other.getScopes()); updatedAt(other.getUpdatedAt()); return this; @@ -239,11 +262,18 @@ public NameStage id(@NotNull String id) { @java.lang.Override @JsonSetter("name") - public UpdatedAtStage name(@NotNull String name) { + public ReadonlyStage name(@NotNull String name) { this.name = Objects.requireNonNull(name, "name must not be null"); return this; } + @java.lang.Override + @JsonSetter("readonly") + public UpdatedAtStage readonly(boolean readonly) { + this.readonly = readonly; + return this; + } + @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -323,9 +353,22 @@ public ApiKeyResponseData build() { id, lastUsedAt, name, + readonly, scopes, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/AuditLogListResponseData.java b/src/main/java/com/schematic/api/types/AuditLogListResponseData.java index 0651861..49c7012 100644 --- a/src/main/java/com/schematic/api/types/AuditLogListResponseData.java +++ b/src/main/java/com/schematic/api/types/AuditLogListResponseData.java @@ -34,7 +34,7 @@ public final class AuditLogListResponseData { private final String method; - private final Optional resourceId; + private final Optional resourceId; private final Optional resourceIdString; @@ -42,7 +42,7 @@ public final class AuditLogListResponseData { private final Optional resourceType; - private final Optional respCode; + private final Optional respCode; private final Optional secondaryResource; @@ -61,11 +61,11 @@ private AuditLogListResponseData( Optional environmentId, String id, String method, - Optional resourceId, + Optional resourceId, Optional resourceIdString, Optional resourceName, Optional resourceType, - Optional respCode, + Optional respCode, Optional secondaryResource, OffsetDateTime startedAt, String url, @@ -120,7 +120,7 @@ public String getMethod() { } @JsonProperty("resource_id") - public Optional getResourceId() { + public Optional getResourceId() { return resourceId; } @@ -140,7 +140,7 @@ public Optional getResourceType() { } @JsonProperty("resp_code") - public Optional getRespCode() { + public Optional getRespCode() { return respCode; } @@ -247,6 +247,10 @@ public interface UrlStage { public interface _FinalStage { AuditLogListResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage apiKeyId(Optional apiKeyId); _FinalStage apiKeyId(String apiKeyId); @@ -259,9 +263,9 @@ public interface _FinalStage { _FinalStage environmentId(String environmentId); - _FinalStage resourceId(Optional resourceId); + _FinalStage resourceId(Optional resourceId); - _FinalStage resourceId(Integer resourceId); + _FinalStage resourceId(Long resourceId); _FinalStage resourceIdString(Optional resourceIdString); @@ -275,9 +279,9 @@ public interface _FinalStage { _FinalStage resourceType(String resourceType); - _FinalStage respCode(Optional respCode); + _FinalStage respCode(Optional respCode); - _FinalStage respCode(Integer respCode); + _FinalStage respCode(Long respCode); _FinalStage secondaryResource(Optional secondaryResource); @@ -305,7 +309,7 @@ public static final class Builder private Optional secondaryResource = Optional.empty(); - private Optional respCode = Optional.empty(); + private Optional respCode = Optional.empty(); private Optional resourceType = Optional.empty(); @@ -313,7 +317,7 @@ public static final class Builder private Optional resourceIdString = Optional.empty(); - private Optional resourceId = Optional.empty(); + private Optional resourceId = Optional.empty(); private Optional environmentId = Optional.empty(); @@ -408,14 +412,14 @@ public _FinalStage secondaryResource(Optional secondaryResource) { } @java.lang.Override - public _FinalStage respCode(Integer respCode) { + public _FinalStage respCode(Long respCode) { this.respCode = Optional.ofNullable(respCode); return this; } @java.lang.Override @JsonSetter(value = "resp_code", nulls = Nulls.SKIP) - public _FinalStage respCode(Optional respCode) { + public _FinalStage respCode(Optional respCode) { this.respCode = respCode; return this; } @@ -460,14 +464,14 @@ public _FinalStage resourceIdString(Optional resourceIdString) { } @java.lang.Override - public _FinalStage resourceId(Integer resourceId) { + public _FinalStage resourceId(Long resourceId) { this.resourceId = Optional.ofNullable(resourceId); return this; } @java.lang.Override @JsonSetter(value = "resource_id", nulls = Nulls.SKIP) - public _FinalStage resourceId(Optional resourceId) { + public _FinalStage resourceId(Optional resourceId) { this.resourceId = resourceId; return this; } @@ -531,5 +535,17 @@ public AuditLogListResponseData build() { userName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/AuditLogResponseData.java b/src/main/java/com/schematic/api/types/AuditLogResponseData.java index f62a67d..c41b5fe 100644 --- a/src/main/java/com/schematic/api/types/AuditLogResponseData.java +++ b/src/main/java/com/schematic/api/types/AuditLogResponseData.java @@ -36,7 +36,7 @@ public final class AuditLogResponseData { private final Optional reqBody; - private final Optional resourceId; + private final Optional resourceId; private final Optional resourceIdString; @@ -46,7 +46,7 @@ public final class AuditLogResponseData { private final Optional respBody; - private final Optional respCode; + private final Optional respCode; private final Optional secondaryResource; @@ -68,12 +68,12 @@ private AuditLogResponseData( String id, String method, Optional reqBody, - Optional resourceId, + Optional resourceId, Optional resourceIdString, Optional resourceName, Optional resourceType, Optional respBody, - Optional respCode, + Optional respCode, Optional secondaryResource, OffsetDateTime startedAt, String url, @@ -137,7 +137,7 @@ public Optional getReqBody() { } @JsonProperty("resource_id") - public Optional getResourceId() { + public Optional getResourceId() { return resourceId; } @@ -162,7 +162,7 @@ public Optional getRespBody() { } @JsonProperty("resp_code") - public Optional getRespCode() { + public Optional getRespCode() { return respCode; } @@ -280,6 +280,10 @@ public interface UrlStage { public interface _FinalStage { AuditLogResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage apiKeyId(Optional apiKeyId); _FinalStage apiKeyId(String apiKeyId); @@ -296,9 +300,9 @@ public interface _FinalStage { _FinalStage reqBody(String reqBody); - _FinalStage resourceId(Optional resourceId); + _FinalStage resourceId(Optional resourceId); - _FinalStage resourceId(Integer resourceId); + _FinalStage resourceId(Long resourceId); _FinalStage resourceIdString(Optional resourceIdString); @@ -316,9 +320,9 @@ public interface _FinalStage { _FinalStage respBody(String respBody); - _FinalStage respCode(Optional respCode); + _FinalStage respCode(Optional respCode); - _FinalStage respCode(Integer respCode); + _FinalStage respCode(Long respCode); _FinalStage secondaryResource(Optional secondaryResource); @@ -352,7 +356,7 @@ public static final class Builder private Optional secondaryResource = Optional.empty(); - private Optional respCode = Optional.empty(); + private Optional respCode = Optional.empty(); private Optional respBody = Optional.empty(); @@ -362,7 +366,7 @@ public static final class Builder private Optional resourceIdString = Optional.empty(); - private Optional resourceId = Optional.empty(); + private Optional resourceId = Optional.empty(); private Optional reqBody = Optional.empty(); @@ -475,14 +479,14 @@ public _FinalStage secondaryResource(Optional secondaryResource) { } @java.lang.Override - public _FinalStage respCode(Integer respCode) { + public _FinalStage respCode(Long respCode) { this.respCode = Optional.ofNullable(respCode); return this; } @java.lang.Override @JsonSetter(value = "resp_code", nulls = Nulls.SKIP) - public _FinalStage respCode(Optional respCode) { + public _FinalStage respCode(Optional respCode) { this.respCode = respCode; return this; } @@ -540,14 +544,14 @@ public _FinalStage resourceIdString(Optional resourceIdString) { } @java.lang.Override - public _FinalStage resourceId(Integer resourceId) { + public _FinalStage resourceId(Long resourceId) { this.resourceId = Optional.ofNullable(resourceId); return this; } @java.lang.Override @JsonSetter(value = "resource_id", nulls = Nulls.SKIP) - public _FinalStage resourceId(Optional resourceId) { + public _FinalStage resourceId(Optional resourceId) { this.resourceId = resourceId; return this; } @@ -627,5 +631,17 @@ public AuditLogResponseData build() { userName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCouponResponseData.java b/src/main/java/com/schematic/api/types/BillingCouponResponseData.java index 73c9fdc..5f3fe91 100644 --- a/src/main/java/com/schematic/api/types/BillingCouponResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCouponResponseData.java @@ -26,13 +26,13 @@ public final class BillingCouponResponseData { private final String accountId; - private final Optional amountOff; + private final Optional amountOff; private final Optional currency; private final Optional duration; - private final Optional durationInMonths; + private final Optional durationInMonths; private final String environmentId; @@ -42,7 +42,7 @@ public final class BillingCouponResponseData { private final boolean isActive; - private final Optional maxRedemptions; + private final Optional maxRedemptions; private final Map metadata; @@ -52,7 +52,7 @@ public final class BillingCouponResponseData { private final BillingProviderType providerType; - private final int timesRedeemed; + private final long timesRedeemed; private final Optional validFrom; @@ -62,20 +62,20 @@ public final class BillingCouponResponseData { private BillingCouponResponseData( String accountId, - Optional amountOff, + Optional amountOff, Optional currency, Optional duration, - Optional durationInMonths, + Optional durationInMonths, String environmentId, String externalId, String id, boolean isActive, - Optional maxRedemptions, + Optional maxRedemptions, Map metadata, String name, Optional percentOff, BillingProviderType providerType, - int timesRedeemed, + long timesRedeemed, Optional validFrom, Optional validUntil, Map additionalProperties) { @@ -105,7 +105,7 @@ public String getAccountId() { } @JsonProperty("amount_off") - public Optional getAmountOff() { + public Optional getAmountOff() { return amountOff; } @@ -120,7 +120,7 @@ public Optional getDuration() { } @JsonProperty("duration_in_months") - public Optional getDurationInMonths() { + public Optional getDurationInMonths() { return durationInMonths; } @@ -145,7 +145,7 @@ public boolean getIsActive() { } @JsonProperty("max_redemptions") - public Optional getMaxRedemptions() { + public Optional getMaxRedemptions() { return maxRedemptions; } @@ -170,7 +170,7 @@ public BillingProviderType getProviderType() { } @JsonProperty("times_redeemed") - public int getTimesRedeemed() { + public long getTimesRedeemed() { return timesRedeemed; } @@ -277,15 +277,19 @@ public interface ProviderTypeStage { } public interface TimesRedeemedStage { - _FinalStage timesRedeemed(int timesRedeemed); + _FinalStage timesRedeemed(long timesRedeemed); } public interface _FinalStage { BillingCouponResponseData build(); - _FinalStage amountOff(Optional amountOff); + _FinalStage additionalProperty(String key, Object value); - _FinalStage amountOff(Integer amountOff); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage amountOff(Optional amountOff); + + _FinalStage amountOff(Long amountOff); _FinalStage currency(Optional currency); @@ -295,13 +299,13 @@ public interface _FinalStage { _FinalStage duration(String duration); - _FinalStage durationInMonths(Optional durationInMonths); + _FinalStage durationInMonths(Optional durationInMonths); - _FinalStage durationInMonths(Integer durationInMonths); + _FinalStage durationInMonths(Long durationInMonths); - _FinalStage maxRedemptions(Optional maxRedemptions); + _FinalStage maxRedemptions(Optional maxRedemptions); - _FinalStage maxRedemptions(Integer maxRedemptions); + _FinalStage maxRedemptions(Long maxRedemptions); _FinalStage metadata(Map metadata); @@ -347,7 +351,7 @@ public static final class Builder private BillingProviderType providerType; - private int timesRedeemed; + private long timesRedeemed; private Optional validUntil = Optional.empty(); @@ -357,15 +361,15 @@ public static final class Builder private Map metadata = new LinkedHashMap<>(); - private Optional maxRedemptions = Optional.empty(); + private Optional maxRedemptions = Optional.empty(); - private Optional durationInMonths = Optional.empty(); + private Optional durationInMonths = Optional.empty(); private Optional duration = Optional.empty(); private Optional currency = Optional.empty(); - private Optional amountOff = Optional.empty(); + private Optional amountOff = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -445,7 +449,7 @@ public TimesRedeemedStage providerType(@NotNull BillingProviderType providerType @java.lang.Override @JsonSetter("times_redeemed") - public _FinalStage timesRedeemed(int timesRedeemed) { + public _FinalStage timesRedeemed(long timesRedeemed) { this.timesRedeemed = timesRedeemed; return this; } @@ -514,27 +518,27 @@ public _FinalStage metadata(Map metadata) { } @java.lang.Override - public _FinalStage maxRedemptions(Integer maxRedemptions) { + public _FinalStage maxRedemptions(Long maxRedemptions) { this.maxRedemptions = Optional.ofNullable(maxRedemptions); return this; } @java.lang.Override @JsonSetter(value = "max_redemptions", nulls = Nulls.SKIP) - public _FinalStage maxRedemptions(Optional maxRedemptions) { + public _FinalStage maxRedemptions(Optional maxRedemptions) { this.maxRedemptions = maxRedemptions; return this; } @java.lang.Override - public _FinalStage durationInMonths(Integer durationInMonths) { + public _FinalStage durationInMonths(Long durationInMonths) { this.durationInMonths = Optional.ofNullable(durationInMonths); return this; } @java.lang.Override @JsonSetter(value = "duration_in_months", nulls = Nulls.SKIP) - public _FinalStage durationInMonths(Optional durationInMonths) { + public _FinalStage durationInMonths(Optional durationInMonths) { this.durationInMonths = durationInMonths; return this; } @@ -566,14 +570,14 @@ public _FinalStage currency(Optional currency) { } @java.lang.Override - public _FinalStage amountOff(Integer amountOff) { + public _FinalStage amountOff(Long amountOff) { this.amountOff = Optional.ofNullable(amountOff); return this; } @java.lang.Override @JsonSetter(value = "amount_off", nulls = Nulls.SKIP) - public _FinalStage amountOff(Optional amountOff) { + public _FinalStage amountOff(Optional amountOff) { this.amountOff = amountOff; return this; } @@ -600,5 +604,17 @@ public BillingCouponResponseData build() { validUntil, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java index 11f0628..4d29635 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleResponseData.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; @@ -36,11 +38,13 @@ public final class BillingCreditBundleResponseData { private final String creditName; + private final List currencyPrices; + private final BillingCreditExpiryType expiryType; private final BillingCreditExpiryUnit expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final boolean hasGrants; @@ -52,7 +56,7 @@ public final class BillingCreditBundleResponseData { private final Optional price; - private final Optional quantity; + private final Optional quantity; private final Optional singularName; @@ -72,15 +76,16 @@ private BillingCreditBundleResponseData( Optional creditIcon, String creditId, String creditName, + List currencyPrices, BillingCreditExpiryType expiryType, BillingCreditExpiryUnit expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, boolean hasGrants, String id, String name, Optional pluralName, Optional price, - Optional quantity, + Optional quantity, Optional singularName, BillingCreditBundleStatus status, Optional unitPrice, @@ -93,6 +98,7 @@ private BillingCreditBundleResponseData( this.creditIcon = creditIcon; this.creditId = creditId; this.creditName = creditName; + this.currencyPrices = currencyPrices; this.expiryType = expiryType; this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; @@ -144,6 +150,11 @@ public String getCreditName() { return creditName; } + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("expiry_type") public BillingCreditExpiryType getExpiryType() { return expiryType; @@ -155,7 +166,7 @@ public BillingCreditExpiryUnit getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -185,7 +196,7 @@ public Optional getPrice() { } @JsonProperty("quantity") - public Optional getQuantity() { + public Optional getQuantity() { return quantity; } @@ -228,6 +239,7 @@ private boolean equalTo(BillingCreditBundleResponseData other) { && creditIcon.equals(other.creditIcon) && creditId.equals(other.creditId) && creditName.equals(other.creditName) + && currencyPrices.equals(other.currencyPrices) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) @@ -253,6 +265,7 @@ public int hashCode() { this.creditIcon, this.creditId, this.creditName, + this.currencyPrices, this.expiryType, this.expiryUnit, this.expiryUnitCount, @@ -326,6 +339,10 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingCreditBundleResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingInvoiceId(Optional billingInvoiceId); _FinalStage billingInvoiceId(String billingInvoiceId); @@ -338,9 +355,15 @@ public interface _FinalStage { _FinalStage creditIcon(String creditIcon); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(CreditBundleCurrencyPriceResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage pluralName(Optional pluralName); @@ -350,9 +373,9 @@ public interface _FinalStage { _FinalStage price(BillingPriceResponseData price); - _FinalStage quantity(Optional quantity); + _FinalStage quantity(Optional quantity); - _FinalStage quantity(Integer quantity); + _FinalStage quantity(Long quantity); _FinalStage singularName(Optional singularName); @@ -403,13 +426,15 @@ public static final class Builder private Optional singularName = Optional.empty(); - private Optional quantity = Optional.empty(); + private Optional quantity = Optional.empty(); private Optional price = Optional.empty(); private Optional pluralName = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); private Optional creditIcon = Optional.empty(); @@ -431,6 +456,7 @@ public Builder from(BillingCreditBundleResponseData other) { creditIcon(other.getCreditIcon()); creditId(other.getCreditId()); creditName(other.getCreditName()); + currencyPrices(other.getCurrencyPrices()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); @@ -551,14 +577,14 @@ public _FinalStage singularName(Optional singularName) { } @java.lang.Override - public _FinalStage quantity(Integer quantity) { + public _FinalStage quantity(Long quantity) { this.quantity = Optional.ofNullable(quantity); return this; } @java.lang.Override @JsonSetter(value = "quantity", nulls = Nulls.SKIP) - public _FinalStage quantity(Optional quantity) { + public _FinalStage quantity(Optional quantity) { this.quantity = quantity; return this; } @@ -590,18 +616,42 @@ public _FinalStage pluralName(Optional pluralName) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(CreditBundleCurrencyPriceResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + @java.lang.Override public _FinalStage creditIcon(String creditIcon) { this.creditIcon = Optional.ofNullable(creditIcon); @@ -651,6 +701,7 @@ public BillingCreditBundleResponseData build() { creditIcon, creditId, creditName, + currencyPrices, expiryType, expiryUnit, expiryUnitCount, @@ -666,5 +717,17 @@ public BillingCreditBundleResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditBundleView.java b/src/main/java/com/schematic/api/types/BillingCreditBundleView.java index 0584084..019a7a3 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditBundleView.java +++ b/src/main/java/com/schematic/api/types/BillingCreditBundleView.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; @@ -22,8 +23,6 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingCreditBundleView.Builder.class) public final class BillingCreditBundleView { - private final Optional billingInvoiceId; - private final String bundleType; private final OffsetDateTime createdAt; @@ -36,11 +35,13 @@ public final class BillingCreditBundleView { private final String creditName; + private final Optional> currencyPrices; + private final BillingCreditExpiryType expiryType; private final BillingCreditExpiryUnit expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final boolean hasGrants; @@ -52,7 +53,7 @@ public final class BillingCreditBundleView { private final Optional price; - private final Optional quantity; + private final Optional quantity; private final Optional singularName; @@ -65,34 +66,34 @@ public final class BillingCreditBundleView { private final Map additionalProperties; private BillingCreditBundleView( - Optional billingInvoiceId, String bundleType, OffsetDateTime createdAt, Optional creditDescription, Optional creditIcon, String creditId, String creditName, + Optional> currencyPrices, BillingCreditExpiryType expiryType, BillingCreditExpiryUnit expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, boolean hasGrants, String id, String name, Optional pluralName, Optional price, - Optional quantity, + Optional quantity, Optional singularName, BillingCreditBundleStatus status, Optional unitPrice, OffsetDateTime updatedAt, Map additionalProperties) { - this.billingInvoiceId = billingInvoiceId; this.bundleType = bundleType; this.createdAt = createdAt; this.creditDescription = creditDescription; this.creditIcon = creditIcon; this.creditId = creditId; this.creditName = creditName; + this.currencyPrices = currencyPrices; this.expiryType = expiryType; this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; @@ -109,11 +110,6 @@ private BillingCreditBundleView( this.additionalProperties = additionalProperties; } - @JsonProperty("billing_invoice_id") - public Optional getBillingInvoiceId() { - return billingInvoiceId; - } - @JsonProperty("bundle_type") public String getBundleType() { return bundleType; @@ -144,6 +140,11 @@ public String getCreditName() { return creditName; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("expiry_type") public BillingCreditExpiryType getExpiryType() { return expiryType; @@ -155,7 +156,7 @@ public BillingCreditExpiryUnit getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -185,7 +186,7 @@ public Optional getPrice() { } @JsonProperty("quantity") - public Optional getQuantity() { + public Optional getQuantity() { return quantity; } @@ -221,13 +222,13 @@ public Map getAdditionalProperties() { } private boolean equalTo(BillingCreditBundleView other) { - return billingInvoiceId.equals(other.billingInvoiceId) - && bundleType.equals(other.bundleType) + return bundleType.equals(other.bundleType) && createdAt.equals(other.createdAt) && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) && creditId.equals(other.creditId) && creditName.equals(other.creditName) + && currencyPrices.equals(other.currencyPrices) && expiryType.equals(other.expiryType) && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) @@ -246,13 +247,13 @@ private boolean equalTo(BillingCreditBundleView other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.billingInvoiceId, this.bundleType, this.createdAt, this.creditDescription, this.creditIcon, this.creditId, this.creditName, + this.currencyPrices, this.expiryType, this.expiryUnit, this.expiryUnitCount, @@ -326,9 +327,9 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingCreditBundleView build(); - _FinalStage billingInvoiceId(Optional billingInvoiceId); + _FinalStage additionalProperty(String key, Object value); - _FinalStage billingInvoiceId(String billingInvoiceId); + _FinalStage additionalProperties(Map additionalProperties); _FinalStage creditDescription(Optional creditDescription); @@ -338,9 +339,13 @@ public interface _FinalStage { _FinalStage creditIcon(String creditIcon); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage pluralName(Optional pluralName); @@ -350,9 +355,9 @@ public interface _FinalStage { _FinalStage price(BillingProductPriceResponseData price); - _FinalStage quantity(Optional quantity); + _FinalStage quantity(Optional quantity); - _FinalStage quantity(Integer quantity); + _FinalStage quantity(Long quantity); _FinalStage singularName(Optional singularName); @@ -403,20 +408,20 @@ public static final class Builder private Optional singularName = Optional.empty(); - private Optional quantity = Optional.empty(); + private Optional quantity = Optional.empty(); private Optional price = Optional.empty(); private Optional pluralName = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); + + private Optional> currencyPrices = Optional.empty(); private Optional creditIcon = Optional.empty(); private Optional creditDescription = Optional.empty(); - private Optional billingInvoiceId = Optional.empty(); - @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -424,13 +429,13 @@ private Builder() {} @java.lang.Override public Builder from(BillingCreditBundleView other) { - billingInvoiceId(other.getBillingInvoiceId()); bundleType(other.getBundleType()); createdAt(other.getCreatedAt()); creditDescription(other.getCreditDescription()); creditIcon(other.getCreditIcon()); creditId(other.getCreditId()); creditName(other.getCreditName()); + currencyPrices(other.getCurrencyPrices()); expiryType(other.getExpiryType()); expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); @@ -551,14 +556,14 @@ public _FinalStage singularName(Optional singularName) { } @java.lang.Override - public _FinalStage quantity(Integer quantity) { + public _FinalStage quantity(Long quantity) { this.quantity = Optional.ofNullable(quantity); return this; } @java.lang.Override @JsonSetter(value = "quantity", nulls = Nulls.SKIP) - public _FinalStage quantity(Optional quantity) { + public _FinalStage quantity(Optional quantity) { this.quantity = quantity; return this; } @@ -590,18 +595,31 @@ public _FinalStage pluralName(Optional pluralName) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } + @java.lang.Override + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage creditIcon(String creditIcon) { this.creditIcon = Optional.ofNullable(creditIcon); @@ -628,29 +646,16 @@ public _FinalStage creditDescription(Optional creditDescription) { return this; } - @java.lang.Override - public _FinalStage billingInvoiceId(String billingInvoiceId) { - this.billingInvoiceId = Optional.ofNullable(billingInvoiceId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "billing_invoice_id", nulls = Nulls.SKIP) - public _FinalStage billingInvoiceId(Optional billingInvoiceId) { - this.billingInvoiceId = billingInvoiceId; - return this; - } - @java.lang.Override public BillingCreditBundleView build() { return new BillingCreditBundleView( - billingInvoiceId, bundleType, createdAt, creditDescription, creditIcon, creditId, creditName, + currencyPrices, expiryType, expiryUnit, expiryUnitCount, @@ -666,5 +671,17 @@ public BillingCreditBundleView build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java index 022c3d6..072e5ea 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditGrantResponseData.java @@ -35,6 +35,8 @@ public final class BillingCreditGrantResponseData { private final String creditName; + private final Optional currency; + private final Optional expiresAt; private final BillingCreditGrantReason grantReason; @@ -47,7 +49,7 @@ public final class BillingCreditGrantResponseData { private final Optional price; - private final int quantity; + private final long quantity; private final double quantityRemaining; @@ -78,13 +80,14 @@ private BillingCreditGrantResponseData( Optional creditIcon, String creditId, String creditName, + Optional currency, Optional expiresAt, BillingCreditGrantReason grantReason, String id, Optional planId, Optional planName, Optional price, - int quantity, + long quantity, double quantityRemaining, double quantityUsed, boolean renewalEnabled, @@ -102,6 +105,7 @@ private BillingCreditGrantResponseData( this.creditIcon = creditIcon; this.creditId = creditId; this.creditName = creditName; + this.currency = currency; this.expiresAt = expiresAt; this.grantReason = grantReason; this.id = id; @@ -152,6 +156,11 @@ public String getCreditName() { return creditName; } + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + @JsonProperty("expires_at") public Optional getExpiresAt() { return expiresAt; @@ -183,7 +192,7 @@ public Optional getPrice() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -255,6 +264,7 @@ private boolean equalTo(BillingCreditGrantResponseData other) { && creditIcon.equals(other.creditIcon) && creditId.equals(other.creditId) && creditName.equals(other.creditName) + && currency.equals(other.currency) && expiresAt.equals(other.expiresAt) && grantReason.equals(other.grantReason) && id.equals(other.id) @@ -283,6 +293,7 @@ public int hashCode() { this.creditIcon, this.creditId, this.creditName, + this.currency, this.expiresAt, this.grantReason, this.id, @@ -342,7 +353,7 @@ public interface IdStage { } public interface QuantityStage { - QuantityRemainingStage quantity(int quantity); + QuantityRemainingStage quantity(long quantity); } public interface QuantityRemainingStage { @@ -368,10 +379,18 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingCreditGrantResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditIcon(Optional creditIcon); _FinalStage creditIcon(String creditIcon); + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + _FinalStage expiresAt(Optional expiresAt); _FinalStage expiresAt(OffsetDateTime expiresAt); @@ -439,7 +458,7 @@ public static final class Builder private String id; - private int quantity; + private long quantity; private double quantityRemaining; @@ -469,6 +488,8 @@ public static final class Builder private Optional expiresAt = Optional.empty(); + private Optional currency = Optional.empty(); + private Optional creditIcon = Optional.empty(); @JsonAnySetter @@ -484,6 +505,7 @@ public Builder from(BillingCreditGrantResponseData other) { creditIcon(other.getCreditIcon()); creditId(other.getCreditId()); creditName(other.getCreditName()); + currency(other.getCurrency()); expiresAt(other.getExpiresAt()); grantReason(other.getGrantReason()); id(other.getId()); @@ -555,7 +577,7 @@ public QuantityStage id(@NotNull String id) { @java.lang.Override @JsonSetter("quantity") - public QuantityRemainingStage quantity(int quantity) { + public QuantityRemainingStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -712,6 +734,19 @@ public _FinalStage expiresAt(Optional expiresAt) { 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 creditIcon(String creditIcon) { this.creditIcon = Optional.ofNullable(creditIcon); @@ -734,6 +769,7 @@ public BillingCreditGrantResponseData build() { creditIcon, creditId, creditName, + currency, expiresAt, grantReason, id, @@ -753,5 +789,17 @@ public BillingCreditGrantResponseData build() { zeroedOutReason, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditLedgerResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditLedgerResponseData.java index 5427992..bb2e8e5 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditLedgerResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditLedgerResponseData.java @@ -129,6 +129,10 @@ public interface NameStage { public interface _FinalStage { BillingCreditLedgerResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -247,5 +251,17 @@ public BillingCreditLedgerResponseData build() { return new BillingCreditLedgerResponseData( description, icon, id, name, pluralName, singularName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditResponseData.java b/src/main/java/com/schematic/api/types/BillingCreditResponseData.java index f4a012d..d716cda 100644 --- a/src/main/java/com/schematic/api/types/BillingCreditResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCreditResponseData.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; @@ -24,11 +26,15 @@ public final class BillingCreditResponseData { private final BillingCreditBurnStrategy burnStrategy; + private final boolean costEditable; + private final OffsetDateTime createdAt; + private final List currencyPrices; + private final BillingCreditExpiryUnit defaultExpiryUnit; - private final Optional defaultExpiryUnitCount; + private final Optional defaultExpiryUnitCount; private final BillingCreditRolloverPolicy defaultRolloverPolicy; @@ -54,9 +60,11 @@ public final class BillingCreditResponseData { private BillingCreditResponseData( BillingCreditBurnStrategy burnStrategy, + boolean costEditable, OffsetDateTime createdAt, + List currencyPrices, BillingCreditExpiryUnit defaultExpiryUnit, - Optional defaultExpiryUnitCount, + Optional defaultExpiryUnitCount, BillingCreditRolloverPolicy defaultRolloverPolicy, String description, Optional icon, @@ -69,7 +77,9 @@ private BillingCreditResponseData( OffsetDateTime updatedAt, Map additionalProperties) { this.burnStrategy = burnStrategy; + this.costEditable = costEditable; this.createdAt = createdAt; + this.currencyPrices = currencyPrices; this.defaultExpiryUnit = defaultExpiryUnit; this.defaultExpiryUnitCount = defaultExpiryUnitCount; this.defaultRolloverPolicy = defaultRolloverPolicy; @@ -90,18 +100,28 @@ public BillingCreditBurnStrategy getBurnStrategy() { return burnStrategy; } + @JsonProperty("cost_editable") + public boolean getCostEditable() { + return costEditable; + } + @JsonProperty("created_at") public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("default_expiry_unit") public BillingCreditExpiryUnit getDefaultExpiryUnit() { return defaultExpiryUnit; } @JsonProperty("default_expiry_unit_count") - public Optional getDefaultExpiryUnitCount() { + public Optional getDefaultExpiryUnitCount() { return defaultExpiryUnitCount; } @@ -168,7 +188,9 @@ public Map getAdditionalProperties() { private boolean equalTo(BillingCreditResponseData other) { return burnStrategy.equals(other.burnStrategy) + && costEditable == other.costEditable && createdAt.equals(other.createdAt) + && currencyPrices.equals(other.currencyPrices) && defaultExpiryUnit.equals(other.defaultExpiryUnit) && defaultExpiryUnitCount.equals(other.defaultExpiryUnitCount) && defaultRolloverPolicy.equals(other.defaultRolloverPolicy) @@ -187,7 +209,9 @@ private boolean equalTo(BillingCreditResponseData other) { public int hashCode() { return Objects.hash( this.burnStrategy, + this.costEditable, this.createdAt, + this.currencyPrices, this.defaultExpiryUnit, this.defaultExpiryUnitCount, this.defaultRolloverPolicy, @@ -212,11 +236,15 @@ public static BurnStrategyStage builder() { } public interface BurnStrategyStage { - CreatedAtStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy); + CostEditableStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy); Builder from(BillingCreditResponseData other); } + public interface CostEditableStage { + CreatedAtStage costEditable(boolean costEditable); + } + public interface CreatedAtStage { DefaultExpiryUnitStage createdAt(@NotNull OffsetDateTime createdAt); } @@ -248,9 +276,19 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingCreditResponseData build(); - _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage currencyPrices(List currencyPrices); - _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount); + _FinalStage addCurrencyPrices(CreditCurrencyPriceResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); + + _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount); _FinalStage icon(Optional icon); @@ -276,6 +314,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements BurnStrategyStage, + CostEditableStage, CreatedAtStage, DefaultExpiryUnitStage, DefaultRolloverPolicyStage, @@ -286,6 +325,8 @@ public static final class Builder _FinalStage { private BillingCreditBurnStrategy burnStrategy; + private boolean costEditable; + private OffsetDateTime createdAt; private BillingCreditExpiryUnit defaultExpiryUnit; @@ -310,7 +351,9 @@ public static final class Builder private Optional icon = Optional.empty(); - private Optional defaultExpiryUnitCount = Optional.empty(); + private Optional defaultExpiryUnitCount = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -320,7 +363,9 @@ private Builder() {} @java.lang.Override public Builder from(BillingCreditResponseData other) { burnStrategy(other.getBurnStrategy()); + costEditable(other.getCostEditable()); createdAt(other.getCreatedAt()); + currencyPrices(other.getCurrencyPrices()); defaultExpiryUnit(other.getDefaultExpiryUnit()); defaultExpiryUnitCount(other.getDefaultExpiryUnitCount()); defaultRolloverPolicy(other.getDefaultRolloverPolicy()); @@ -338,11 +383,18 @@ public Builder from(BillingCreditResponseData other) { @java.lang.Override @JsonSetter("burn_strategy") - public CreatedAtStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy) { + public CostEditableStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy) { this.burnStrategy = Objects.requireNonNull(burnStrategy, "burnStrategy must not be null"); return this; } + @java.lang.Override + @JsonSetter("cost_editable") + public CreatedAtStage costEditable(boolean costEditable) { + this.costEditable = costEditable; + return this; + } + @java.lang.Override @JsonSetter("created_at") public DefaultExpiryUnitStage createdAt(@NotNull OffsetDateTime createdAt) { @@ -459,23 +511,49 @@ public _FinalStage icon(Optional icon) { } @java.lang.Override - public _FinalStage defaultExpiryUnitCount(Integer defaultExpiryUnitCount) { + public _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount) { this.defaultExpiryUnitCount = Optional.ofNullable(defaultExpiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "default_expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { + public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { this.defaultExpiryUnitCount = defaultExpiryUnitCount; return this; } + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(CreditCurrencyPriceResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + @java.lang.Override public BillingCreditResponseData build() { return new BillingCreditResponseData( burnStrategy, + costEditable, createdAt, + currencyPrices, defaultExpiryUnit, defaultExpiryUnitCount, defaultRolloverPolicy, @@ -490,5 +568,17 @@ public BillingCreditResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCreditView.java b/src/main/java/com/schematic/api/types/BillingCreditView.java new file mode 100644 index 0000000..9cebee7 --- /dev/null +++ b/src/main/java/com/schematic/api/types/BillingCreditView.java @@ -0,0 +1,655 @@ +/** + * 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 = BillingCreditView.Builder.class) +public final class BillingCreditView { + private final String accountId; + + private final BillingCreditBurnStrategy burnStrategy; + + private final boolean costEditable; + + private final OffsetDateTime createdAt; + + private final BillingCreditExpiryUnit defaultExpiryUnit; + + private final Optional defaultExpiryUnitCount; + + private final BillingCreditRolloverPolicy defaultRolloverPolicy; + + private final String description; + + private final String environmentId; + + private final Optional icon; + + private final String id; + + private final String name; + + private final Optional pluralName; + + private final Optional price; + + private final Optional pricePerUnit; + + private final Optional pricePerUnitDecimal; + + private final Optional product; + + private final Optional singularName; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private BillingCreditView( + String accountId, + BillingCreditBurnStrategy burnStrategy, + boolean costEditable, + OffsetDateTime createdAt, + BillingCreditExpiryUnit defaultExpiryUnit, + Optional defaultExpiryUnitCount, + BillingCreditRolloverPolicy defaultRolloverPolicy, + String description, + String environmentId, + Optional icon, + String id, + String name, + Optional pluralName, + Optional price, + Optional pricePerUnit, + Optional pricePerUnitDecimal, + Optional product, + Optional singularName, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.accountId = accountId; + this.burnStrategy = burnStrategy; + this.costEditable = costEditable; + this.createdAt = createdAt; + this.defaultExpiryUnit = defaultExpiryUnit; + this.defaultExpiryUnitCount = defaultExpiryUnitCount; + this.defaultRolloverPolicy = defaultRolloverPolicy; + this.description = description; + this.environmentId = environmentId; + this.icon = icon; + this.id = id; + this.name = name; + this.pluralName = pluralName; + this.price = price; + this.pricePerUnit = pricePerUnit; + this.pricePerUnitDecimal = pricePerUnitDecimal; + this.product = product; + this.singularName = singularName; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("burn_strategy") + public BillingCreditBurnStrategy getBurnStrategy() { + return burnStrategy; + } + + @JsonProperty("cost_editable") + public boolean getCostEditable() { + return costEditable; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("default_expiry_unit") + public BillingCreditExpiryUnit getDefaultExpiryUnit() { + return defaultExpiryUnit; + } + + @JsonProperty("default_expiry_unit_count") + public Optional getDefaultExpiryUnitCount() { + return defaultExpiryUnitCount; + } + + @JsonProperty("default_rollover_policy") + public BillingCreditRolloverPolicy getDefaultRolloverPolicy() { + return defaultRolloverPolicy; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("icon") + public Optional getIcon() { + return icon; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("plural_name") + public Optional getPluralName() { + return pluralName; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @JsonProperty("price_per_unit") + public Optional getPricePerUnit() { + return pricePerUnit; + } + + @JsonProperty("price_per_unit_decimal") + public Optional getPricePerUnitDecimal() { + return pricePerUnitDecimal; + } + + @JsonProperty("product") + public Optional getProduct() { + return product; + } + + @JsonProperty("singular_name") + public Optional getSingularName() { + return singularName; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingCreditView && equalTo((BillingCreditView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingCreditView other) { + return accountId.equals(other.accountId) + && burnStrategy.equals(other.burnStrategy) + && costEditable == other.costEditable + && createdAt.equals(other.createdAt) + && defaultExpiryUnit.equals(other.defaultExpiryUnit) + && defaultExpiryUnitCount.equals(other.defaultExpiryUnitCount) + && defaultRolloverPolicy.equals(other.defaultRolloverPolicy) + && description.equals(other.description) + && environmentId.equals(other.environmentId) + && icon.equals(other.icon) + && id.equals(other.id) + && name.equals(other.name) + && pluralName.equals(other.pluralName) + && price.equals(other.price) + && pricePerUnit.equals(other.pricePerUnit) + && pricePerUnitDecimal.equals(other.pricePerUnitDecimal) + && product.equals(other.product) + && singularName.equals(other.singularName) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.burnStrategy, + this.costEditable, + this.createdAt, + this.defaultExpiryUnit, + this.defaultExpiryUnitCount, + this.defaultRolloverPolicy, + this.description, + this.environmentId, + this.icon, + this.id, + this.name, + this.pluralName, + this.price, + this.pricePerUnit, + this.pricePerUnitDecimal, + this.product, + this.singularName, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + BurnStrategyStage accountId(@NotNull String accountId); + + Builder from(BillingCreditView other); + } + + public interface BurnStrategyStage { + CostEditableStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy); + } + + public interface CostEditableStage { + CreatedAtStage costEditable(boolean costEditable); + } + + public interface CreatedAtStage { + DefaultExpiryUnitStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface DefaultExpiryUnitStage { + DefaultRolloverPolicyStage defaultExpiryUnit(@NotNull BillingCreditExpiryUnit defaultExpiryUnit); + } + + public interface DefaultRolloverPolicyStage { + DescriptionStage defaultRolloverPolicy(@NotNull BillingCreditRolloverPolicy defaultRolloverPolicy); + } + + public interface DescriptionStage { + EnvironmentIdStage description(@NotNull String description); + } + + public interface EnvironmentIdStage { + IdStage environmentId(@NotNull String environmentId); + } + + 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 { + BillingCreditView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount); + + _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount); + + _FinalStage icon(Optional icon); + + _FinalStage icon(String icon); + + _FinalStage pluralName(Optional pluralName); + + _FinalStage pluralName(String pluralName); + + _FinalStage price(Optional price); + + _FinalStage price(BillingPriceView price); + + _FinalStage pricePerUnit(Optional pricePerUnit); + + _FinalStage pricePerUnit(Long pricePerUnit); + + _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal); + + _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal); + + _FinalStage product(Optional product); + + _FinalStage product(BillingProductResponseData product); + + _FinalStage singularName(Optional singularName); + + _FinalStage singularName(String singularName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AccountIdStage, + BurnStrategyStage, + CostEditableStage, + CreatedAtStage, + DefaultExpiryUnitStage, + DefaultRolloverPolicyStage, + DescriptionStage, + EnvironmentIdStage, + IdStage, + NameStage, + UpdatedAtStage, + _FinalStage { + private String accountId; + + private BillingCreditBurnStrategy burnStrategy; + + private boolean costEditable; + + private OffsetDateTime createdAt; + + private BillingCreditExpiryUnit defaultExpiryUnit; + + private BillingCreditRolloverPolicy defaultRolloverPolicy; + + private String description; + + private String environmentId; + + private String id; + + private String name; + + private OffsetDateTime updatedAt; + + private Optional singularName = Optional.empty(); + + private Optional product = Optional.empty(); + + private Optional pricePerUnitDecimal = Optional.empty(); + + private Optional pricePerUnit = Optional.empty(); + + private Optional price = Optional.empty(); + + private Optional pluralName = Optional.empty(); + + private Optional icon = Optional.empty(); + + private Optional defaultExpiryUnitCount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingCreditView other) { + accountId(other.getAccountId()); + burnStrategy(other.getBurnStrategy()); + costEditable(other.getCostEditable()); + createdAt(other.getCreatedAt()); + defaultExpiryUnit(other.getDefaultExpiryUnit()); + defaultExpiryUnitCount(other.getDefaultExpiryUnitCount()); + defaultRolloverPolicy(other.getDefaultRolloverPolicy()); + description(other.getDescription()); + environmentId(other.getEnvironmentId()); + icon(other.getIcon()); + id(other.getId()); + name(other.getName()); + pluralName(other.getPluralName()); + price(other.getPrice()); + pricePerUnit(other.getPricePerUnit()); + pricePerUnitDecimal(other.getPricePerUnitDecimal()); + product(other.getProduct()); + singularName(other.getSingularName()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public BurnStrategyStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("burn_strategy") + public CostEditableStage burnStrategy(@NotNull BillingCreditBurnStrategy burnStrategy) { + this.burnStrategy = Objects.requireNonNull(burnStrategy, "burnStrategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("cost_editable") + public CreatedAtStage costEditable(boolean costEditable) { + this.costEditable = costEditable; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public DefaultExpiryUnitStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("default_expiry_unit") + 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 BillingCreditRolloverPolicy defaultRolloverPolicy) { + this.defaultRolloverPolicy = + Objects.requireNonNull(defaultRolloverPolicy, "defaultRolloverPolicy 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 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 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 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 product(BillingProductResponseData product) { + this.product = Optional.ofNullable(product); + return this; + } + + @java.lang.Override + @JsonSetter(value = "product", nulls = Nulls.SKIP) + public _FinalStage product(Optional product) { + this.product = product; + return this; + } + + @java.lang.Override + public _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal) { + this.pricePerUnitDecimal = Optional.ofNullable(pricePerUnitDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_per_unit_decimal", nulls = Nulls.SKIP) + public _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal) { + this.pricePerUnitDecimal = pricePerUnitDecimal; + return this; + } + + @java.lang.Override + public _FinalStage pricePerUnit(Long pricePerUnit) { + this.pricePerUnit = Optional.ofNullable(pricePerUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_per_unit", nulls = Nulls.SKIP) + public _FinalStage pricePerUnit(Optional pricePerUnit) { + this.pricePerUnit = pricePerUnit; + return this; + } + + @java.lang.Override + public _FinalStage price(BillingPriceView price) { + this.price = Optional.ofNullable(price); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public _FinalStage price(Optional price) { + this.price = price; + return this; + } + + @java.lang.Override + public _FinalStage 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 icon(String icon) { + this.icon = Optional.ofNullable(icon); + return this; + } + + @java.lang.Override + @JsonSetter(value = "icon", nulls = Nulls.SKIP) + public _FinalStage icon(Optional icon) { + this.icon = icon; + return this; + } + + @java.lang.Override + public _FinalStage defaultExpiryUnitCount(Long defaultExpiryUnitCount) { + this.defaultExpiryUnitCount = Optional.ofNullable(defaultExpiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "default_expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage defaultExpiryUnitCount(Optional defaultExpiryUnitCount) { + this.defaultExpiryUnitCount = defaultExpiryUnitCount; + return this; + } + + @java.lang.Override + public BillingCreditView build() { + return new BillingCreditView( + accountId, + burnStrategy, + costEditable, + createdAt, + defaultExpiryUnit, + defaultExpiryUnitCount, + defaultRolloverPolicy, + description, + environmentId, + icon, + id, + name, + pluralName, + price, + pricePerUnit, + pricePerUnitDecimal, + product, + singularName, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java b/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java index cf4a6dd..66dfc9e 100644 --- a/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCustomerResponseData.java @@ -174,6 +174,10 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingCustomerResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -293,5 +297,17 @@ public BillingCustomerResponseData build() { return new BillingCustomerResponseData( companyId, deletedAt, email, externalId, id, name, providerType, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCustomerSubscription.java b/src/main/java/com/schematic/api/types/BillingCustomerSubscription.java index 21b304d..b8bae80 100644 --- a/src/main/java/com/schematic/api/types/BillingCustomerSubscription.java +++ b/src/main/java/com/schematic/api/types/BillingCustomerSubscription.java @@ -30,9 +30,9 @@ public final class BillingCustomerSubscription { private final boolean meteredUsage; - private final int perUnitPrice; + private final long perUnitPrice; - private final int totalPrice; + private final long totalPrice; private final Map additionalProperties; @@ -41,8 +41,8 @@ private BillingCustomerSubscription( Optional expiredAt, String interval, boolean meteredUsage, - int perUnitPrice, - int totalPrice, + long perUnitPrice, + long totalPrice, Map additionalProperties) { this.currency = currency; this.expiredAt = expiredAt; @@ -74,12 +74,12 @@ public boolean getMeteredUsage() { } @JsonProperty("per_unit_price") - public int getPerUnitPrice() { + public long getPerUnitPrice() { return perUnitPrice; } @JsonProperty("total_price") - public int getTotalPrice() { + public long getTotalPrice() { return totalPrice; } @@ -133,16 +133,20 @@ public interface MeteredUsageStage { } public interface PerUnitPriceStage { - TotalPriceStage perUnitPrice(int perUnitPrice); + TotalPriceStage perUnitPrice(long perUnitPrice); } public interface TotalPriceStage { - _FinalStage totalPrice(int totalPrice); + _FinalStage totalPrice(long totalPrice); } public interface _FinalStage { BillingCustomerSubscription build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage expiredAt(Optional expiredAt); _FinalStage expiredAt(OffsetDateTime expiredAt); @@ -162,9 +166,9 @@ public static final class Builder private boolean meteredUsage; - private int perUnitPrice; + private long perUnitPrice; - private int totalPrice; + private long totalPrice; private Optional expiredAt = Optional.empty(); @@ -207,14 +211,14 @@ public PerUnitPriceStage meteredUsage(boolean meteredUsage) { @java.lang.Override @JsonSetter("per_unit_price") - public TotalPriceStage perUnitPrice(int perUnitPrice) { + public TotalPriceStage perUnitPrice(long perUnitPrice) { this.perUnitPrice = perUnitPrice; return this; } @java.lang.Override @JsonSetter("total_price") - public _FinalStage totalPrice(int totalPrice) { + public _FinalStage totalPrice(long totalPrice) { this.totalPrice = totalPrice; return this; } @@ -237,5 +241,17 @@ public BillingCustomerSubscription build() { return new BillingCustomerSubscription( currency, expiredAt, interval, meteredUsage, perUnitPrice, totalPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java b/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java index 8461fdc..c053bb0 100644 --- a/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingCustomerWithSubscriptionsResponseData.java @@ -188,6 +188,10 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingCustomerWithSubscriptionsResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -349,5 +353,17 @@ public BillingCustomerWithSubscriptionsResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingMeterResponseData.java b/src/main/java/com/schematic/api/types/BillingMeterResponseData.java index e0d2fe4..865764a 100644 --- a/src/main/java/com/schematic/api/types/BillingMeterResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingMeterResponseData.java @@ -148,6 +148,10 @@ public interface ProviderTypeStage { public interface _FinalStage { BillingMeterResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -234,5 +238,17 @@ public BillingMeterResponseData build() { return new BillingMeterResponseData( dispalyName, eventName, eventPayloadKey, externalPriceId, id, providerType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java index b1a66a2..2a4bfa3 100644 --- a/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPlanCreditGrantResponseData.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingPlanCreditGrantResponseData.Builder.class) public final class BillingPlanCreditGrantResponseData { - private final Optional autoTopupAmount; + private final Optional autoTopupAmount; private final Optional autoTopupAmountType; @@ -32,13 +32,15 @@ public final class BillingPlanCreditGrantResponseData { private final Optional autoTopupExpiryUnit; - private final Optional autoTopupExpiryUnitCount; + private final Optional autoTopupExpiryUnitCount; - private final Optional autoTopupThresholdPercent; + private final Optional autoTopupThresholdPercent; private final OffsetDateTime createdAt; - private final int creditAmount; + private final Optional credit; + + private final long creditAmount; private final String creditId; @@ -52,7 +54,7 @@ public final class BillingPlanCreditGrantResponseData { private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final String id; @@ -62,9 +64,11 @@ public final class BillingPlanCreditGrantResponseData { private final String planName; - private final BillingPlanCreditGrantResetCadence resetCadence; + private final Optional planVersionId; + + private final Optional resetCadence; - private final BillingPlanCreditGrantResetStart resetStart; + private final Optional resetStart; private final Optional resetType; @@ -73,28 +77,30 @@ public final class BillingPlanCreditGrantResponseData { private final Map additionalProperties; private BillingPlanCreditGrantResponseData( - Optional autoTopupAmount, + Optional autoTopupAmount, Optional autoTopupAmountType, boolean autoTopupEnabled, Optional autoTopupExpiryType, Optional autoTopupExpiryUnit, - Optional autoTopupExpiryUnitCount, - Optional autoTopupThresholdPercent, + Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdPercent, OffsetDateTime createdAt, - int creditAmount, + Optional credit, + long creditAmount, String creditId, String creditName, Optional creditPluralName, Optional creditSingularName, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, String id, Optional plan, String planId, String planName, - BillingPlanCreditGrantResetCadence resetCadence, - BillingPlanCreditGrantResetStart resetStart, + Optional planVersionId, + Optional resetCadence, + Optional resetStart, Optional resetType, OffsetDateTime updatedAt, Map additionalProperties) { @@ -106,6 +112,7 @@ private BillingPlanCreditGrantResponseData( this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; this.autoTopupThresholdPercent = autoTopupThresholdPercent; this.createdAt = createdAt; + this.credit = credit; this.creditAmount = creditAmount; this.creditId = creditId; this.creditName = creditName; @@ -118,6 +125,7 @@ private BillingPlanCreditGrantResponseData( this.plan = plan; this.planId = planId; this.planName = planName; + this.planVersionId = planVersionId; this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; @@ -126,7 +134,7 @@ private BillingPlanCreditGrantResponseData( } @JsonProperty("auto_topup_amount") - public Optional getAutoTopupAmount() { + public Optional getAutoTopupAmount() { return autoTopupAmount; } @@ -151,12 +159,12 @@ public Optional getAutoTopupExpiryUnit() { } @JsonProperty("auto_topup_expiry_unit_count") - public Optional getAutoTopupExpiryUnitCount() { + public Optional getAutoTopupExpiryUnitCount() { return autoTopupExpiryUnitCount; } @JsonProperty("auto_topup_threshold_percent") - public Optional getAutoTopupThresholdPercent() { + public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; } @@ -165,8 +173,13 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + @JsonProperty("credit_amount") - public int getCreditAmount() { + public long getCreditAmount() { return creditAmount; } @@ -175,16 +188,25 @@ public String getCreditId() { return creditId; } + /** + * @return Use credit.name from the nested credit object instead + */ @JsonProperty("credit_name") public String getCreditName() { return creditName; } + /** + * @return Use plural_name from the nested credit object instead + */ @JsonProperty("credit_plural_name") public Optional getCreditPluralName() { return creditPluralName; } + /** + * @return Use singular_name from the nested credit object instead + */ @JsonProperty("credit_singular_name") public Optional getCreditSingularName() { return creditSingularName; @@ -201,7 +223,7 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -228,13 +250,18 @@ public String getPlanName() { return planName; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("reset_cadence") - public BillingPlanCreditGrantResetCadence getResetCadence() { + public Optional getResetCadence() { return resetCadence; } @JsonProperty("reset_start") - public BillingPlanCreditGrantResetStart getResetStart() { + public Optional getResetStart() { return resetStart; } @@ -269,6 +296,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && autoTopupExpiryUnitCount.equals(other.autoTopupExpiryUnitCount) && autoTopupThresholdPercent.equals(other.autoTopupThresholdPercent) && createdAt.equals(other.createdAt) + && credit.equals(other.credit) && creditAmount == other.creditAmount && creditId.equals(other.creditId) && creditName.equals(other.creditName) @@ -281,6 +309,7 @@ private boolean equalTo(BillingPlanCreditGrantResponseData other) { && plan.equals(other.plan) && planId.equals(other.planId) && planName.equals(other.planName) + && planVersionId.equals(other.planVersionId) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType) @@ -298,6 +327,7 @@ public int hashCode() { this.autoTopupExpiryUnitCount, this.autoTopupThresholdPercent, this.createdAt, + this.credit, this.creditAmount, this.creditId, this.creditName, @@ -310,6 +340,7 @@ public int hashCode() { this.plan, this.planId, this.planName, + this.planVersionId, this.resetCadence, this.resetStart, this.resetType, @@ -336,7 +367,7 @@ public interface CreatedAtStage { } public interface CreditAmountStage { - CreditIdStage creditAmount(int creditAmount); + CreditIdStage creditAmount(long creditAmount); } public interface CreditIdStage { @@ -344,6 +375,9 @@ public interface CreditIdStage { } public interface CreditNameStage { + /** + *

Use credit.name from the nested credit object instead

+ */ IdStage creditName(@NotNull String creditName); } @@ -359,15 +393,7 @@ public interface PlanNameStage { /** *

Use plan.name from the nested plan object instead

*/ - ResetCadenceStage planName(@NotNull String planName); - } - - public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); - } - - public interface ResetStartStage { - UpdatedAtStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); + UpdatedAtStage planName(@NotNull String planName); } public interface UpdatedAtStage { @@ -377,9 +403,13 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingPlanCreditGrantResponseData build(); - _FinalStage autoTopupAmount(Optional autoTopupAmount); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); - _FinalStage autoTopupAmount(Integer autoTopupAmount); + _FinalStage autoTopupAmount(Optional autoTopupAmount); + + _FinalStage autoTopupAmount(Long autoTopupAmount); _FinalStage autoTopupAmountType(Optional autoTopupAmountType); @@ -393,18 +423,28 @@ public interface _FinalStage { _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit); - _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + + _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount); + + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); - _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount); + _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); - _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); + _FinalStage credit(Optional credit); - _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent); + _FinalStage credit(BillingCreditResponseData credit); + /** + *

Use plural_name from the nested credit object instead

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

Use singular_name from the nested credit object instead

+ */ _FinalStage creditSingularName(Optional creditSingularName); _FinalStage creditSingularName(String creditSingularName); @@ -417,14 +457,26 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage plan(Optional plan); _FinalStage plan(PreviewObjectResponseData plan); + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + + _FinalStage resetCadence(Optional resetCadence); + + _FinalStage resetCadence(BillingPlanCreditGrantResetCadence resetCadence); + + _FinalStage resetStart(Optional resetStart); + + _FinalStage resetStart(BillingPlanCreditGrantResetStart resetStart); + _FinalStage resetType(Optional resetType); _FinalStage resetType(BillingPlanCreditGrantResetType resetType); @@ -440,15 +492,13 @@ public static final class Builder IdStage, PlanIdStage, PlanNameStage, - ResetCadenceStage, - ResetStartStage, UpdatedAtStage, _FinalStage { private boolean autoTopupEnabled; private OffsetDateTime createdAt; - private int creditAmount; + private long creditAmount; private String creditId; @@ -460,17 +510,19 @@ public static final class Builder private String planName; - private BillingPlanCreditGrantResetCadence resetCadence; - - private BillingPlanCreditGrantResetStart resetStart; - private OffsetDateTime updatedAt; private Optional resetType = Optional.empty(); + private Optional resetStart = Optional.empty(); + + private Optional resetCadence = Optional.empty(); + + private Optional planVersionId = Optional.empty(); + private Optional plan = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -480,9 +532,11 @@ public static final class Builder private Optional creditPluralName = Optional.empty(); - private Optional autoTopupThresholdPercent = Optional.empty(); + private Optional credit = Optional.empty(); + + private Optional autoTopupThresholdPercent = Optional.empty(); - private Optional autoTopupExpiryUnitCount = Optional.empty(); + private Optional autoTopupExpiryUnitCount = Optional.empty(); private Optional autoTopupExpiryUnit = Optional.empty(); @@ -490,7 +544,7 @@ public static final class Builder private Optional autoTopupAmountType = Optional.empty(); - private Optional autoTopupAmount = Optional.empty(); + private Optional autoTopupAmount = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -507,6 +561,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { autoTopupExpiryUnitCount(other.getAutoTopupExpiryUnitCount()); autoTopupThresholdPercent(other.getAutoTopupThresholdPercent()); createdAt(other.getCreatedAt()); + credit(other.getCredit()); creditAmount(other.getCreditAmount()); creditId(other.getCreditId()); creditName(other.getCreditName()); @@ -519,6 +574,7 @@ public Builder from(BillingPlanCreditGrantResponseData other) { plan(other.getPlan()); planId(other.getPlanId()); planName(other.getPlanName()); + planVersionId(other.getPlanVersionId()); resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); @@ -542,7 +598,7 @@ public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("credit_amount") - public CreditIdStage creditAmount(int creditAmount) { + public CreditIdStage creditAmount(long creditAmount) { this.creditAmount = creditAmount; return this; } @@ -554,6 +610,11 @@ public CreditNameStage creditId(@NotNull String creditId) { return this; } + /** + *

Use credit.name from the nested credit object instead

+ *

Use credit.name from the nested credit object instead

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("credit_name") public IdStage creditName(@NotNull String creditName) { @@ -582,25 +643,11 @@ public PlanNameStage planId(@NotNull String planId) { */ @java.lang.Override @JsonSetter("plan_name") - public ResetCadenceStage planName(@NotNull String planName) { + public UpdatedAtStage 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 BillingPlanCreditGrantResetCadence resetCadence) { - this.resetCadence = Objects.requireNonNull(resetCadence, "resetCadence must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("reset_start") - public UpdatedAtStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart) { - this.resetStart = Objects.requireNonNull(resetStart, "resetStart must not be null"); - return this; - } - @java.lang.Override @JsonSetter("updated_at") public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { @@ -621,6 +668,45 @@ public _FinalStage resetType(Optional resetType return this; } + @java.lang.Override + public _FinalStage resetStart(BillingPlanCreditGrantResetStart resetStart) { + this.resetStart = Optional.ofNullable(resetStart); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_start", nulls = Nulls.SKIP) + public _FinalStage resetStart(Optional resetStart) { + this.resetStart = resetStart; + return this; + } + + @java.lang.Override + public _FinalStage resetCadence(BillingPlanCreditGrantResetCadence resetCadence) { + this.resetCadence = Optional.ofNullable(resetCadence); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_cadence", nulls = Nulls.SKIP) + public _FinalStage resetCadence(Optional resetCadence) { + this.resetCadence = resetCadence; + return this; + } + + @java.lang.Override + public _FinalStage 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 plan(PreviewObjectResponseData plan) { this.plan = Optional.ofNullable(plan); @@ -635,14 +721,14 @@ public _FinalStage plan(Optional plan) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -673,12 +759,19 @@ public _FinalStage expiryType(Optional expiryType) { return this; } + /** + *

Use singular_name from the nested credit object instead

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

Use singular_name from the nested credit object instead

+ */ @java.lang.Override @JsonSetter(value = "credit_singular_name", nulls = Nulls.SKIP) public _FinalStage creditSingularName(Optional creditSingularName) { @@ -686,12 +779,19 @@ public _FinalStage creditSingularName(Optional creditSingularName) { return this; } + /** + *

Use plural_name from the nested credit object instead

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

Use plural_name from the nested credit object instead

+ */ @java.lang.Override @JsonSetter(value = "credit_plural_name", nulls = Nulls.SKIP) public _FinalStage creditPluralName(Optional creditPluralName) { @@ -700,27 +800,40 @@ public _FinalStage creditPluralName(Optional creditPluralName) { } @java.lang.Override - public _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent) { + public _FinalStage credit(BillingCreditResponseData 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 autoTopupThresholdPercent(Long 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) { + public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent) { this.autoTopupThresholdPercent = autoTopupThresholdPercent; return this; } @java.lang.Override - public _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount) { + public _FinalStage autoTopupExpiryUnitCount(Long 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) { + public _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount) { this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; return this; } @@ -765,14 +878,14 @@ public _FinalStage autoTopupAmountType(Optional autoTopupAmountType) { } @java.lang.Override - public _FinalStage autoTopupAmount(Integer autoTopupAmount) { + public _FinalStage autoTopupAmount(Long autoTopupAmount) { this.autoTopupAmount = Optional.ofNullable(autoTopupAmount); return this; } @java.lang.Override @JsonSetter(value = "auto_topup_amount", nulls = Nulls.SKIP) - public _FinalStage autoTopupAmount(Optional autoTopupAmount) { + public _FinalStage autoTopupAmount(Optional autoTopupAmount) { this.autoTopupAmount = autoTopupAmount; return this; } @@ -788,6 +901,7 @@ public BillingPlanCreditGrantResponseData build() { autoTopupExpiryUnitCount, autoTopupThresholdPercent, createdAt, + credit, creditAmount, creditId, creditName, @@ -800,11 +914,24 @@ public BillingPlanCreditGrantResponseData build() { plan, planId, planName, + planVersionId, resetCadence, resetStart, resetType, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingPriceResponseData.java b/src/main/java/com/schematic/api/types/BillingPriceResponseData.java index c684c22..bb3b26d 100644 --- a/src/main/java/com/schematic/api/types/BillingPriceResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingPriceResponseData.java @@ -29,7 +29,7 @@ public final class BillingPriceResponseData { private final BillingProductPriceInterval interval; - private final int price; + private final long price; private final Optional priceDecimal; @@ -44,7 +44,7 @@ private BillingPriceResponseData( String externalPriceId, String id, BillingProductPriceInterval interval, - int price, + long price, Optional priceDecimal, BillingProviderType providerType, BillingPriceScheme scheme, @@ -81,7 +81,7 @@ public BillingProductPriceInterval getInterval() { } @JsonProperty("price") - public int getPrice() { + public long getPrice() { return price; } @@ -163,7 +163,7 @@ public interface IntervalStage { } public interface PriceStage { - ProviderTypeStage price(int price); + ProviderTypeStage price(long price); } public interface ProviderTypeStage { @@ -177,6 +177,10 @@ public interface SchemeStage { public interface _FinalStage { BillingPriceResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage priceDecimal(Optional priceDecimal); _FinalStage priceDecimal(String priceDecimal); @@ -200,7 +204,7 @@ public static final class Builder private BillingProductPriceInterval interval; - private int price; + private long price; private BillingProviderType providerType; @@ -256,7 +260,7 @@ public PriceStage interval(@NotNull BillingProductPriceInterval interval) { @java.lang.Override @JsonSetter("price") - public ProviderTypeStage price(int price) { + public ProviderTypeStage price(long price) { this.price = price; return this; } @@ -301,5 +305,17 @@ public BillingPriceResponseData build() { scheme, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingPriceView.java b/src/main/java/com/schematic/api/types/BillingPriceView.java index 37a66b0..c3d5359 100644 --- a/src/main/java/com/schematic/api/types/BillingPriceView.java +++ b/src/main/java/com/schematic/api/types/BillingPriceView.java @@ -42,9 +42,9 @@ public final class BillingPriceView { private final Optional meterId; - private final int packageSize; + private final long packageSize; - private final int price; + private final long price; private final Optional priceDecimal; @@ -80,8 +80,8 @@ private BillingPriceView( Optional meterEventName, Optional meterEventPayloadKey, Optional meterId, - int packageSize, - int price, + long packageSize, + long price, Optional priceDecimal, String priceExternalId, String priceId, @@ -165,12 +165,12 @@ public Optional getMeterId() { } @JsonProperty("package_size") - public int getPackageSize() { + public long getPackageSize() { return packageSize; } @JsonProperty("price") - public int getPrice() { + public long getPrice() { return price; } @@ -328,11 +328,11 @@ public interface IsActiveStage { } public interface PackageSizeStage { - PriceStage packageSize(int packageSize); + PriceStage packageSize(long packageSize); } public interface PriceStage { - PriceExternalIdStage price(int price); + PriceExternalIdStage price(long price); } public interface PriceExternalIdStage { @@ -370,6 +370,10 @@ public interface UsageTypeStage { public interface _FinalStage { BillingPriceView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage meterEventName(Optional meterEventName); _FinalStage meterEventName(String meterEventName); @@ -428,9 +432,9 @@ public static final class Builder private boolean isActive; - private int packageSize; + private long packageSize; - private int price; + private long price; private String priceExternalId; @@ -536,14 +540,14 @@ public PackageSizeStage isActive(boolean isActive) { @java.lang.Override @JsonSetter("package_size") - public PriceStage packageSize(int packageSize) { + public PriceStage packageSize(long packageSize) { this.packageSize = packageSize; return this; } @java.lang.Override @JsonSetter("price") - public PriceExternalIdStage price(int price) { + public PriceExternalIdStage price(long price) { this.price = price; return this; } @@ -720,5 +724,17 @@ public BillingPriceView build() { usageType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java b/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java index d676272..499a553 100644 --- a/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductDetailResponseData.java @@ -50,7 +50,7 @@ public final class BillingProductDetailResponseData { private final double quantity; - private final int subscriptionCount; + private final long subscriptionCount; private final OffsetDateTime updatedAt; @@ -70,7 +70,7 @@ private BillingProductDetailResponseData( String productId, BillingProviderType providerType, double quantity, - int subscriptionCount, + long subscriptionCount, OffsetDateTime updatedAt, Map additionalProperties) { this.accountId = accountId; @@ -160,7 +160,7 @@ public double getQuantity() { } @JsonProperty("subscription_count") - public int getSubscriptionCount() { + public long getSubscriptionCount() { return subscriptionCount; } @@ -270,7 +270,7 @@ public interface QuantityStage { } public interface SubscriptionCountStage { - UpdatedAtStage subscriptionCount(int subscriptionCount); + UpdatedAtStage subscriptionCount(long subscriptionCount); } public interface UpdatedAtStage { @@ -280,6 +280,10 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingProductDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Deprecated; currencies are associated with prices, not products

*/ @@ -333,7 +337,7 @@ public static final class Builder private double quantity; - private int subscriptionCount; + private long subscriptionCount; private OffsetDateTime updatedAt; @@ -440,7 +444,7 @@ public SubscriptionCountStage quantity(double quantity) { @java.lang.Override @JsonSetter("subscription_count") - public UpdatedAtStage subscriptionCount(int subscriptionCount) { + public UpdatedAtStage subscriptionCount(long subscriptionCount) { this.subscriptionCount = subscriptionCount; return this; } @@ -529,5 +533,17 @@ public BillingProductDetailResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java b/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java index 8be568a..4f5a344 100644 --- a/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductForSubscriptionResponseData.java @@ -26,7 +26,7 @@ public final class BillingProductForSubscriptionResponseData { private final BillingPriceScheme billingScheme; - private final Optional billingThreshold; + private final Optional billingThreshold; private final OffsetDateTime createdAt; @@ -44,9 +44,9 @@ public final class BillingProductForSubscriptionResponseData { private final String name; - private final int packageSize; + private final long packageSize; - private final int price; + private final long price; private final Optional priceDecimal; @@ -72,7 +72,7 @@ public final class BillingProductForSubscriptionResponseData { private BillingProductForSubscriptionResponseData( BillingPriceScheme billingScheme, - Optional billingThreshold, + Optional billingThreshold, OffsetDateTime createdAt, String currency, String environmentId, @@ -81,8 +81,8 @@ private BillingProductForSubscriptionResponseData( String interval, Optional meterId, String name, - int packageSize, - int price, + long packageSize, + long price, Optional priceDecimal, String priceExternalId, String priceId, @@ -125,7 +125,7 @@ public BillingPriceScheme getBillingScheme() { } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -170,12 +170,12 @@ public String getName() { } @JsonProperty("package_size") - public int getPackageSize() { + public long getPackageSize() { return packageSize; } @JsonProperty("price") - public int getPrice() { + public long getPrice() { return price; } @@ -337,11 +337,11 @@ public interface NameStage { } public interface PackageSizeStage { - PriceStage packageSize(int packageSize); + PriceStage packageSize(long packageSize); } public interface PriceStage { - PriceExternalIdStage price(int price); + PriceExternalIdStage price(long price); } public interface PriceExternalIdStage { @@ -375,9 +375,13 @@ public interface UsageTypeStage { public interface _FinalStage { BillingProductForSubscriptionResponseData build(); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage additionalProperty(String key, Object value); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingThreshold(Optional billingThreshold); + + _FinalStage billingThreshold(Long billingThreshold); _FinalStage meterId(Optional meterId); @@ -434,9 +438,9 @@ public static final class Builder private String name; - private int packageSize; + private long packageSize; - private int price; + private long price; private String priceExternalId; @@ -460,7 +464,7 @@ public static final class Builder private Optional meterId = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -552,14 +556,14 @@ public PackageSizeStage name(@NotNull String name) { @java.lang.Override @JsonSetter("package_size") - public PriceStage packageSize(int packageSize) { + public PriceStage packageSize(long packageSize) { this.packageSize = packageSize; return this; } @java.lang.Override @JsonSetter("price") - public PriceExternalIdStage price(int price) { + public PriceExternalIdStage price(long price) { this.price = price; return this; } @@ -677,14 +681,14 @@ public _FinalStage meterId(Optional meterId) { } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -716,5 +720,17 @@ public BillingProductForSubscriptionResponseData build() { usageType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java index f48e059..52bb422 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPlanResponseData.java @@ -39,7 +39,7 @@ public final class BillingProductPlanResponseData { private final String planId; - private final Optional trialDays; + private final Optional trialDays; private final Optional yearlyPriceId; @@ -55,7 +55,7 @@ private BillingProductPlanResponseData( Optional monthlyPriceId, Optional oneTimePriceId, String planId, - Optional trialDays, + Optional trialDays, Optional yearlyPriceId, Map additionalProperties) { this.accountId = accountId; @@ -118,7 +118,7 @@ public String getPlanId() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -210,6 +210,10 @@ public interface PlanIdStage { public interface _FinalStage { BillingProductPlanResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage monthlyPriceId(Optional monthlyPriceId); _FinalStage monthlyPriceId(String monthlyPriceId); @@ -218,9 +222,9 @@ public interface _FinalStage { _FinalStage oneTimePriceId(String oneTimePriceId); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage yearlyPriceId(Optional yearlyPriceId); @@ -253,7 +257,7 @@ public static final class Builder private Optional yearlyPriceId = Optional.empty(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional oneTimePriceId = Optional.empty(); @@ -343,14 +347,14 @@ public _FinalStage yearlyPriceId(Optional yearlyPriceId) { } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -397,5 +401,17 @@ public BillingProductPlanResponseData build() { yearlyPriceId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java index 1455e11..bdacebf 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPriceResponseData.java @@ -36,9 +36,9 @@ public final class BillingProductPriceResponseData { private final Optional meterId; - private final int packageSize; + private final long packageSize; - private final int price; + private final long price; private final Optional priceDecimal; @@ -64,8 +64,8 @@ private BillingProductPriceResponseData( BillingProductPriceInterval interval, boolean isActive, Optional meterId, - int packageSize, - int price, + long packageSize, + long price, Optional priceDecimal, String priceExternalId, String productExternalId, @@ -129,12 +129,12 @@ public Optional getMeterId() { } @JsonProperty("package_size") - public int getPackageSize() { + public long getPackageSize() { return packageSize; } @JsonProperty("price") - public int getPrice() { + public long getPrice() { return price; } @@ -260,11 +260,11 @@ public interface IsActiveStage { } public interface PackageSizeStage { - PriceStage packageSize(int packageSize); + PriceStage packageSize(long packageSize); } public interface PriceStage { - PriceExternalIdStage price(int price); + PriceExternalIdStage price(long price); } public interface PriceExternalIdStage { @@ -290,6 +290,10 @@ public interface UsageTypeStage { public interface _FinalStage { BillingProductPriceResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage meterId(Optional meterId); _FinalStage meterId(String meterId); @@ -331,9 +335,9 @@ public static final class Builder private boolean isActive; - private int packageSize; + private long packageSize; - private int price; + private long price; private String priceExternalId; @@ -421,14 +425,14 @@ public PackageSizeStage isActive(boolean isActive) { @java.lang.Override @JsonSetter("package_size") - public PriceStage packageSize(int packageSize) { + public PriceStage packageSize(long packageSize) { this.packageSize = packageSize; return this; } @java.lang.Override @JsonSetter("price") - public PriceExternalIdStage price(int price) { + public PriceExternalIdStage price(long price) { this.price = price; return this; } @@ -528,5 +532,17 @@ public BillingProductPriceResponseData build() { usageType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductPriceTierResponseData.java b/src/main/java/com/schematic/api/types/BillingProductPriceTierResponseData.java index a86b7a1..9d80f5b 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPriceTierResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductPriceTierResponseData.java @@ -20,21 +20,21 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingProductPriceTierResponseData.Builder.class) public final class BillingProductPriceTierResponseData { - private final Optional flatAmount; + private final Optional flatAmount; - private final Optional perUnitPrice; + private final Optional perUnitPrice; private final Optional perUnitPriceDecimal; - private final Optional upTo; + private final Optional upTo; private final Map additionalProperties; private BillingProductPriceTierResponseData( - Optional flatAmount, - Optional perUnitPrice, + Optional flatAmount, + Optional perUnitPrice, Optional perUnitPriceDecimal, - Optional upTo, + Optional upTo, Map additionalProperties) { this.flatAmount = flatAmount; this.perUnitPrice = perUnitPrice; @@ -44,12 +44,12 @@ private BillingProductPriceTierResponseData( } @JsonProperty("flat_amount") - public Optional getFlatAmount() { + public Optional getFlatAmount() { return flatAmount; } @JsonProperty("per_unit_price") - public Optional getPerUnitPrice() { + public Optional getPerUnitPrice() { return perUnitPrice; } @@ -59,7 +59,7 @@ public Optional getPerUnitPriceDecimal() { } @JsonProperty("up_to") - public Optional getUpTo() { + public Optional getUpTo() { return upTo; } @@ -98,13 +98,13 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional flatAmount = Optional.empty(); + private Optional flatAmount = Optional.empty(); - private Optional perUnitPrice = Optional.empty(); + private Optional perUnitPrice = Optional.empty(); private Optional perUnitPriceDecimal = Optional.empty(); - private Optional upTo = Optional.empty(); + private Optional upTo = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -120,23 +120,23 @@ public Builder from(BillingProductPriceTierResponseData other) { } @JsonSetter(value = "flat_amount", nulls = Nulls.SKIP) - public Builder flatAmount(Optional flatAmount) { + public Builder flatAmount(Optional flatAmount) { this.flatAmount = flatAmount; return this; } - public Builder flatAmount(Integer flatAmount) { + public Builder flatAmount(Long flatAmount) { this.flatAmount = Optional.ofNullable(flatAmount); return this; } @JsonSetter(value = "per_unit_price", nulls = Nulls.SKIP) - public Builder perUnitPrice(Optional perUnitPrice) { + public Builder perUnitPrice(Optional perUnitPrice) { this.perUnitPrice = perUnitPrice; return this; } - public Builder perUnitPrice(Integer perUnitPrice) { + public Builder perUnitPrice(Long perUnitPrice) { this.perUnitPrice = Optional.ofNullable(perUnitPrice); return this; } @@ -153,12 +153,12 @@ public Builder perUnitPriceDecimal(String perUnitPriceDecimal) { } @JsonSetter(value = "up_to", nulls = Nulls.SKIP) - public Builder upTo(Optional upTo) { + public Builder upTo(Optional upTo) { this.upTo = upTo; return this; } - public Builder upTo(Integer upTo) { + public Builder upTo(Long upTo) { this.upTo = Optional.ofNullable(upTo); return this; } @@ -167,5 +167,15 @@ public BillingProductPriceTierResponseData build() { return new BillingProductPriceTierResponseData( flatAmount, perUnitPrice, perUnitPriceDecimal, upTo, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductPricing.java b/src/main/java/com/schematic/api/types/BillingProductPricing.java index 7d3463c..37400a5 100644 --- a/src/main/java/com/schematic/api/types/BillingProductPricing.java +++ b/src/main/java/com/schematic/api/types/BillingProductPricing.java @@ -21,7 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingProductPricing.Builder.class) public final class BillingProductPricing { - private final Optional billingThreshold; + private final Optional billingThreshold; private final String currency; @@ -29,9 +29,9 @@ public final class BillingProductPricing { private final Optional meterId; - private final Optional packageSize; + private final Optional packageSize; - private final int price; + private final long price; private final Optional priceDecimal; @@ -39,7 +39,7 @@ public final class BillingProductPricing { private final String productExternalId; - private final int quantity; + private final long quantity; private final Optional subscriptionItemExternalId; @@ -48,16 +48,16 @@ public final class BillingProductPricing { private final Map additionalProperties; private BillingProductPricing( - Optional billingThreshold, + Optional billingThreshold, String currency, String interval, Optional meterId, - Optional packageSize, - int price, + Optional packageSize, + long price, Optional priceDecimal, String priceExternalId, String productExternalId, - int quantity, + long quantity, Optional subscriptionItemExternalId, BillingPriceUsageType usageType, Map additionalProperties) { @@ -77,7 +77,7 @@ private BillingProductPricing( } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -97,12 +97,12 @@ public Optional getMeterId() { } @JsonProperty("package_size") - public Optional getPackageSize() { + public Optional getPackageSize() { return packageSize; } @JsonProperty("price") - public int getPrice() { + public long getPrice() { return price; } @@ -122,7 +122,7 @@ public String getProductExternalId() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -199,7 +199,7 @@ public interface IntervalStage { } public interface PriceStage { - PriceExternalIdStage price(int price); + PriceExternalIdStage price(long price); } public interface PriceExternalIdStage { @@ -211,7 +211,7 @@ public interface ProductExternalIdStage { } public interface QuantityStage { - UsageTypeStage quantity(int quantity); + UsageTypeStage quantity(long quantity); } public interface UsageTypeStage { @@ -221,17 +221,21 @@ public interface UsageTypeStage { public interface _FinalStage { BillingProductPricing build(); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage additionalProperty(String key, Object value); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingThreshold(Optional billingThreshold); + + _FinalStage billingThreshold(Long billingThreshold); _FinalStage meterId(Optional meterId); _FinalStage meterId(String meterId); - _FinalStage packageSize(Optional packageSize); + _FinalStage packageSize(Optional packageSize); - _FinalStage packageSize(Integer packageSize); + _FinalStage packageSize(Long packageSize); _FinalStage priceDecimal(Optional priceDecimal); @@ -256,13 +260,13 @@ public static final class Builder private String interval; - private int price; + private long price; private String priceExternalId; private String productExternalId; - private int quantity; + private long quantity; private BillingPriceUsageType usageType; @@ -270,11 +274,11 @@ public static final class Builder private Optional priceDecimal = Optional.empty(); - private Optional packageSize = Optional.empty(); + private Optional packageSize = Optional.empty(); private Optional meterId = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -314,7 +318,7 @@ public PriceStage interval(@NotNull String interval) { @java.lang.Override @JsonSetter("price") - public PriceExternalIdStage price(int price) { + public PriceExternalIdStage price(long price) { this.price = price; return this; } @@ -335,7 +339,7 @@ public QuantityStage productExternalId(@NotNull String productExternalId) { @java.lang.Override @JsonSetter("quantity") - public UsageTypeStage quantity(int quantity) { + public UsageTypeStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -374,14 +378,14 @@ public _FinalStage priceDecimal(Optional priceDecimal) { } @java.lang.Override - public _FinalStage packageSize(Integer packageSize) { + public _FinalStage packageSize(Long packageSize) { this.packageSize = Optional.ofNullable(packageSize); return this; } @java.lang.Override @JsonSetter(value = "package_size", nulls = Nulls.SKIP) - public _FinalStage packageSize(Optional packageSize) { + public _FinalStage packageSize(Optional packageSize) { this.packageSize = packageSize; return this; } @@ -400,14 +404,14 @@ public _FinalStage meterId(Optional meterId) { } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -429,5 +433,17 @@ public BillingProductPricing build() { usageType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingProductResponseData.java b/src/main/java/com/schematic/api/types/BillingProductResponseData.java index f0c4f11..90f2c89 100644 --- a/src/main/java/com/schematic/api/types/BillingProductResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingProductResponseData.java @@ -252,6 +252,10 @@ public interface UpdatedAtStage { public interface _FinalStage { BillingProductResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Deprecated; currencies are associated with prices, not products

*/ @@ -455,5 +459,17 @@ public BillingProductResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingSubscriptionDiscount.java b/src/main/java/com/schematic/api/types/BillingSubscriptionDiscount.java index f770b81..31949f6 100644 --- a/src/main/java/com/schematic/api/types/BillingSubscriptionDiscount.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionDiscount.java @@ -155,6 +155,10 @@ public interface StartedAtStage { public interface _FinalStage { BillingSubscriptionDiscount build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage customerFacingCode(Optional customerFacingCode); _FinalStage customerFacingCode(String customerFacingCode); @@ -281,5 +285,17 @@ public BillingSubscriptionDiscount build() { startedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingSubscriptionDiscountView.java b/src/main/java/com/schematic/api/types/BillingSubscriptionDiscountView.java index d9c0ed3..1178911 100644 --- a/src/main/java/com/schematic/api/types/BillingSubscriptionDiscountView.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionDiscountView.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = BillingSubscriptionDiscountView.Builder.class) public final class BillingSubscriptionDiscountView { - private final Optional amountOff; + private final Optional amountOff; private final String couponId; @@ -36,7 +36,7 @@ public final class BillingSubscriptionDiscountView { private final String duration; - private final Optional durationInMonths; + private final Optional durationInMonths; private final Optional endedAt; @@ -53,14 +53,14 @@ public final class BillingSubscriptionDiscountView { private final Map additionalProperties; private BillingSubscriptionDiscountView( - Optional amountOff, + Optional amountOff, String couponId, String couponName, Optional currency, Optional customerFacingCode, String discountExternalId, String duration, - Optional durationInMonths, + Optional durationInMonths, Optional endedAt, boolean isActive, Optional percentOff, @@ -86,7 +86,7 @@ private BillingSubscriptionDiscountView( } @JsonProperty("amount_off") - public Optional getAmountOff() { + public Optional getAmountOff() { return amountOff; } @@ -121,7 +121,7 @@ public String getDuration() { } @JsonProperty("duration_in_months") - public Optional getDurationInMonths() { + public Optional getDurationInMonths() { return durationInMonths; } @@ -244,9 +244,13 @@ public interface SubscriptionExternalIdStage { public interface _FinalStage { BillingSubscriptionDiscountView build(); - _FinalStage amountOff(Optional amountOff); + _FinalStage additionalProperty(String key, Object value); - _FinalStage amountOff(Integer amountOff); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage amountOff(Optional amountOff); + + _FinalStage amountOff(Long amountOff); _FinalStage currency(Optional currency); @@ -256,9 +260,9 @@ public interface _FinalStage { _FinalStage customerFacingCode(String customerFacingCode); - _FinalStage durationInMonths(Optional durationInMonths); + _FinalStage durationInMonths(Optional durationInMonths); - _FinalStage durationInMonths(Integer durationInMonths); + _FinalStage durationInMonths(Long durationInMonths); _FinalStage endedAt(Optional endedAt); @@ -303,13 +307,13 @@ public static final class Builder private Optional endedAt = Optional.empty(); - private Optional durationInMonths = Optional.empty(); + private Optional durationInMonths = Optional.empty(); private Optional customerFacingCode = Optional.empty(); private Optional currency = Optional.empty(); - private Optional amountOff = Optional.empty(); + private Optional amountOff = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -425,14 +429,14 @@ public _FinalStage endedAt(Optional endedAt) { } @java.lang.Override - public _FinalStage durationInMonths(Integer durationInMonths) { + public _FinalStage durationInMonths(Long durationInMonths) { this.durationInMonths = Optional.ofNullable(durationInMonths); return this; } @java.lang.Override @JsonSetter(value = "duration_in_months", nulls = Nulls.SKIP) - public _FinalStage durationInMonths(Optional durationInMonths) { + public _FinalStage durationInMonths(Optional durationInMonths) { this.durationInMonths = durationInMonths; return this; } @@ -464,14 +468,14 @@ public _FinalStage currency(Optional currency) { } @java.lang.Override - public _FinalStage amountOff(Integer amountOff) { + public _FinalStage amountOff(Long amountOff) { this.amountOff = Optional.ofNullable(amountOff); return this; } @java.lang.Override @JsonSetter(value = "amount_off", nulls = Nulls.SKIP) - public _FinalStage amountOff(Optional amountOff) { + public _FinalStage amountOff(Optional amountOff) { this.amountOff = amountOff; return this; } @@ -495,5 +499,17 @@ public BillingSubscriptionDiscountView build() { subscriptionExternalId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java b/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java index 5528df4..78b065b 100644 --- a/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionResponseData.java @@ -25,7 +25,7 @@ public final class BillingSubscriptionResponseData { private final Optional applicationId; - private final Optional cancelAt; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -47,9 +47,9 @@ public final class BillingSubscriptionResponseData { private final Optional> metadata; - private final int periodEnd; + private final long periodEnd; - private final int periodStart; + private final long periodStart; private final BillingProviderType providerType; @@ -57,9 +57,9 @@ public final class BillingSubscriptionResponseData { private final String subscriptionExternalId; - private final int totalPrice; + private final long totalPrice; - private final Optional trialEnd; + private final Optional trialEnd; private final Optional trialEndSetting; @@ -67,7 +67,7 @@ public final class BillingSubscriptionResponseData { private BillingSubscriptionResponseData( Optional applicationId, - Optional cancelAt, + Optional cancelAt, boolean cancelAtPeriodEnd, Optional companyId, OffsetDateTime createdAt, @@ -78,13 +78,13 @@ private BillingSubscriptionResponseData( String id, String interval, Optional> metadata, - int periodEnd, - int periodStart, + long periodEnd, + long periodStart, BillingProviderType providerType, String status, String subscriptionExternalId, - int totalPrice, - Optional trialEnd, + long totalPrice, + Optional trialEnd, Optional trialEndSetting, Map additionalProperties) { this.applicationId = applicationId; @@ -116,7 +116,7 @@ public Optional getApplicationId() { } @JsonProperty("cancel_at") - public Optional getCancelAt() { + public Optional getCancelAt() { return cancelAt; } @@ -171,12 +171,12 @@ public Optional> getMetadata() { } @JsonProperty("period_end") - public int getPeriodEnd() { + public long getPeriodEnd() { return periodEnd; } @JsonProperty("period_start") - public int getPeriodStart() { + public long getPeriodStart() { return periodStart; } @@ -196,12 +196,12 @@ public String getSubscriptionExternalId() { } @JsonProperty("total_price") - public int getTotalPrice() { + public long getTotalPrice() { return totalPrice; } @JsonProperty("trial_end") - public Optional getTrialEnd() { + public Optional getTrialEnd() { return trialEnd; } @@ -305,11 +305,11 @@ public interface IntervalStage { } public interface PeriodEndStage { - PeriodStartStage periodEnd(int periodEnd); + PeriodStartStage periodEnd(long periodEnd); } public interface PeriodStartStage { - ProviderTypeStage periodStart(int periodStart); + ProviderTypeStage periodStart(long periodStart); } public interface ProviderTypeStage { @@ -325,19 +325,23 @@ public interface SubscriptionExternalIdStage { } public interface TotalPriceStage { - _FinalStage totalPrice(int totalPrice); + _FinalStage totalPrice(long totalPrice); } public interface _FinalStage { BillingSubscriptionResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage applicationId(Optional applicationId); _FinalStage applicationId(String applicationId); - _FinalStage cancelAt(Optional cancelAt); + _FinalStage cancelAt(Optional cancelAt); - _FinalStage cancelAt(Integer cancelAt); + _FinalStage cancelAt(Long cancelAt); _FinalStage companyId(Optional companyId); @@ -355,9 +359,9 @@ public interface _FinalStage { _FinalStage metadata(Map metadata); - _FinalStage trialEnd(Optional trialEnd); + _FinalStage trialEnd(Optional trialEnd); - _FinalStage trialEnd(Integer trialEnd); + _FinalStage trialEnd(Long trialEnd); _FinalStage trialEndSetting(Optional trialEndSetting); @@ -391,9 +395,9 @@ public static final class Builder private String interval; - private int periodEnd; + private long periodEnd; - private int periodStart; + private long periodStart; private BillingProviderType providerType; @@ -401,11 +405,11 @@ public static final class Builder private String subscriptionExternalId; - private int totalPrice; + private long totalPrice; private Optional trialEndSetting = Optional.empty(); - private Optional trialEnd = Optional.empty(); + private Optional trialEnd = Optional.empty(); private Optional> metadata = Optional.empty(); @@ -415,7 +419,7 @@ public static final class Builder private Optional companyId = Optional.empty(); - private Optional cancelAt = Optional.empty(); + private Optional cancelAt = Optional.empty(); private Optional applicationId = Optional.empty(); @@ -493,14 +497,14 @@ public PeriodEndStage interval(@NotNull String interval) { @java.lang.Override @JsonSetter("period_end") - public PeriodStartStage periodEnd(int periodEnd) { + public PeriodStartStage periodEnd(long periodEnd) { this.periodEnd = periodEnd; return this; } @java.lang.Override @JsonSetter("period_start") - public ProviderTypeStage periodStart(int periodStart) { + public ProviderTypeStage periodStart(long periodStart) { this.periodStart = periodStart; return this; } @@ -529,7 +533,7 @@ public TotalPriceStage subscriptionExternalId(@NotNull String subscriptionExtern @java.lang.Override @JsonSetter("total_price") - public _FinalStage totalPrice(int totalPrice) { + public _FinalStage totalPrice(long totalPrice) { this.totalPrice = totalPrice; return this; } @@ -548,14 +552,14 @@ public _FinalStage trialEndSetting(Optional } @java.lang.Override - public _FinalStage trialEnd(Integer trialEnd) { + public _FinalStage trialEnd(Long trialEnd) { this.trialEnd = Optional.ofNullable(trialEnd); return this; } @java.lang.Override @JsonSetter(value = "trial_end", nulls = Nulls.SKIP) - public _FinalStage trialEnd(Optional trialEnd) { + public _FinalStage trialEnd(Optional trialEnd) { this.trialEnd = trialEnd; return this; } @@ -613,14 +617,14 @@ public _FinalStage companyId(Optional companyId) { } @java.lang.Override - public _FinalStage cancelAt(Integer cancelAt) { + public _FinalStage cancelAt(Long cancelAt) { this.cancelAt = Optional.ofNullable(cancelAt); return this; } @java.lang.Override @JsonSetter(value = "cancel_at", nulls = Nulls.SKIP) - public _FinalStage cancelAt(Optional cancelAt) { + public _FinalStage cancelAt(Optional cancelAt) { this.cancelAt = cancelAt; return this; } @@ -663,5 +667,17 @@ public BillingSubscriptionResponseData build() { trialEndSetting, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/BillingSubscriptionView.java b/src/main/java/com/schematic/api/types/BillingSubscriptionView.java index de69cf0..b6bd686 100644 --- a/src/main/java/com/schematic/api/types/BillingSubscriptionView.java +++ b/src/main/java/com/schematic/api/types/BillingSubscriptionView.java @@ -27,7 +27,7 @@ public final class BillingSubscriptionView { private final Optional applicationId; - private final Optional cancelAt; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -55,9 +55,9 @@ public final class BillingSubscriptionView { private final Optional paymentMethod; - private final int periodEnd; + private final long periodEnd; - private final int periodStart; + private final long periodStart; private final List products; @@ -67,9 +67,9 @@ public final class BillingSubscriptionView { private final String subscriptionExternalId; - private final int totalPrice; + private final long totalPrice; - private final Optional trialEnd; + private final Optional trialEnd; private final Optional trialEndSetting; @@ -77,7 +77,7 @@ public final class BillingSubscriptionView { private BillingSubscriptionView( Optional applicationId, - Optional cancelAt, + Optional cancelAt, boolean cancelAtPeriodEnd, Optional companyId, OffsetDateTime createdAt, @@ -91,14 +91,14 @@ private BillingSubscriptionView( Optional latestInvoice, Optional> metadata, Optional paymentMethod, - int periodEnd, - int periodStart, + long periodEnd, + long periodStart, List products, BillingProviderType providerType, String status, String subscriptionExternalId, - int totalPrice, - Optional trialEnd, + long totalPrice, + Optional trialEnd, Optional trialEndSetting, Map additionalProperties) { this.applicationId = applicationId; @@ -134,7 +134,7 @@ public Optional getApplicationId() { } @JsonProperty("cancel_at") - public Optional getCancelAt() { + public Optional getCancelAt() { return cancelAt; } @@ -204,12 +204,12 @@ public Optional getPaymentMethod() { } @JsonProperty("period_end") - public int getPeriodEnd() { + public long getPeriodEnd() { return periodEnd; } @JsonProperty("period_start") - public int getPeriodStart() { + public long getPeriodStart() { return periodStart; } @@ -234,12 +234,12 @@ public String getSubscriptionExternalId() { } @JsonProperty("total_price") - public int getTotalPrice() { + public long getTotalPrice() { return totalPrice; } @JsonProperty("trial_end") - public Optional getTrialEnd() { + public Optional getTrialEnd() { return trialEnd; } @@ -351,11 +351,11 @@ public interface IntervalStage { } public interface PeriodEndStage { - PeriodStartStage periodEnd(int periodEnd); + PeriodStartStage periodEnd(long periodEnd); } public interface PeriodStartStage { - ProviderTypeStage periodStart(int periodStart); + ProviderTypeStage periodStart(long periodStart); } public interface ProviderTypeStage { @@ -371,19 +371,23 @@ public interface SubscriptionExternalIdStage { } public interface TotalPriceStage { - _FinalStage totalPrice(int totalPrice); + _FinalStage totalPrice(long totalPrice); } public interface _FinalStage { BillingSubscriptionView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage applicationId(Optional applicationId); _FinalStage applicationId(String applicationId); - _FinalStage cancelAt(Optional cancelAt); + _FinalStage cancelAt(Optional cancelAt); - _FinalStage cancelAt(Integer cancelAt); + _FinalStage cancelAt(Long cancelAt); _FinalStage companyId(Optional companyId); @@ -421,9 +425,9 @@ public interface _FinalStage { _FinalStage addAllProducts(List products); - _FinalStage trialEnd(Optional trialEnd); + _FinalStage trialEnd(Optional trialEnd); - _FinalStage trialEnd(Integer trialEnd); + _FinalStage trialEnd(Long trialEnd); _FinalStage trialEndSetting(Optional trialEndSetting); @@ -457,9 +461,9 @@ public static final class Builder private String interval; - private int periodEnd; + private long periodEnd; - private int periodStart; + private long periodStart; private BillingProviderType providerType; @@ -467,11 +471,11 @@ public static final class Builder private String subscriptionExternalId; - private int totalPrice; + private long totalPrice; private Optional trialEndSetting = Optional.empty(); - private Optional trialEnd = Optional.empty(); + private Optional trialEnd = Optional.empty(); private List products = new ArrayList<>(); @@ -489,7 +493,7 @@ public static final class Builder private Optional companyId = Optional.empty(); - private Optional cancelAt = Optional.empty(); + private Optional cancelAt = Optional.empty(); private Optional applicationId = Optional.empty(); @@ -571,14 +575,14 @@ public PeriodEndStage interval(@NotNull String interval) { @java.lang.Override @JsonSetter("period_end") - public PeriodStartStage periodEnd(int periodEnd) { + public PeriodStartStage periodEnd(long periodEnd) { this.periodEnd = periodEnd; return this; } @java.lang.Override @JsonSetter("period_start") - public ProviderTypeStage periodStart(int periodStart) { + public ProviderTypeStage periodStart(long periodStart) { this.periodStart = periodStart; return this; } @@ -607,7 +611,7 @@ public TotalPriceStage subscriptionExternalId(@NotNull String subscriptionExtern @java.lang.Override @JsonSetter("total_price") - public _FinalStage totalPrice(int totalPrice) { + public _FinalStage totalPrice(long totalPrice) { this.totalPrice = totalPrice; return this; } @@ -626,14 +630,14 @@ public _FinalStage trialEndSetting(Optional } @java.lang.Override - public _FinalStage trialEnd(Integer trialEnd) { + public _FinalStage trialEnd(Long trialEnd) { this.trialEnd = Optional.ofNullable(trialEnd); return this; } @java.lang.Override @JsonSetter(value = "trial_end", nulls = Nulls.SKIP) - public _FinalStage trialEnd(Optional trialEnd) { + public _FinalStage trialEnd(Optional trialEnd) { this.trialEnd = trialEnd; return this; } @@ -765,14 +769,14 @@ public _FinalStage companyId(Optional companyId) { } @java.lang.Override - public _FinalStage cancelAt(Integer cancelAt) { + public _FinalStage cancelAt(Long cancelAt) { this.cancelAt = Optional.ofNullable(cancelAt); return this; } @java.lang.Override @JsonSetter(value = "cancel_at", nulls = Nulls.SKIP) - public _FinalStage cancelAt(Optional cancelAt) { + public _FinalStage cancelAt(Optional cancelAt) { this.cancelAt = cancelAt; return this; } @@ -819,5 +823,17 @@ public BillingSubscriptionView build() { trialEndSetting, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CaptureRawEvent.java b/src/main/java/com/schematic/api/types/CaptureRawEvent.java new file mode 100644 index 0000000..867efbd --- /dev/null +++ b/src/main/java/com/schematic/api/types/CaptureRawEvent.java @@ -0,0 +1,226 @@ +/** + * 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 = CaptureRawEvent.Builder.class) +public final class CaptureRawEvent { + private final OffsetDateTime capturedAt; + + private final Optional eventId; + + private final String rawBytes; + + private final String remoteIp; + + private final String userAgent; + + private final Map additionalProperties; + + private CaptureRawEvent( + OffsetDateTime capturedAt, + Optional eventId, + String rawBytes, + String remoteIp, + String userAgent, + Map additionalProperties) { + this.capturedAt = capturedAt; + this.eventId = eventId; + this.rawBytes = rawBytes; + this.remoteIp = remoteIp; + this.userAgent = userAgent; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("captured_at") + public OffsetDateTime getCapturedAt() { + return capturedAt; + } + + @JsonProperty("event_id") + public Optional getEventId() { + return eventId; + } + + @JsonProperty("raw_bytes") + public String getRawBytes() { + return rawBytes; + } + + @JsonProperty("remote_ip") + public String getRemoteIp() { + return remoteIp; + } + + @JsonProperty("user_agent") + public String getUserAgent() { + return userAgent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CaptureRawEvent && equalTo((CaptureRawEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CaptureRawEvent other) { + return capturedAt.equals(other.capturedAt) + && eventId.equals(other.eventId) + && rawBytes.equals(other.rawBytes) + && remoteIp.equals(other.remoteIp) + && userAgent.equals(other.userAgent); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.capturedAt, this.eventId, this.rawBytes, this.remoteIp, this.userAgent); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CapturedAtStage builder() { + return new Builder(); + } + + public interface CapturedAtStage { + RawBytesStage capturedAt(@NotNull OffsetDateTime capturedAt); + + Builder from(CaptureRawEvent other); + } + + public interface RawBytesStage { + RemoteIpStage rawBytes(@NotNull String rawBytes); + } + + public interface RemoteIpStage { + UserAgentStage remoteIp(@NotNull String remoteIp); + } + + public interface UserAgentStage { + _FinalStage userAgent(@NotNull String userAgent); + } + + public interface _FinalStage { + CaptureRawEvent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage eventId(Optional eventId); + + _FinalStage eventId(String eventId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CapturedAtStage, RawBytesStage, RemoteIpStage, UserAgentStage, _FinalStage { + private OffsetDateTime capturedAt; + + private String rawBytes; + + private String remoteIp; + + private String userAgent; + + private Optional eventId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CaptureRawEvent other) { + capturedAt(other.getCapturedAt()); + eventId(other.getEventId()); + rawBytes(other.getRawBytes()); + remoteIp(other.getRemoteIp()); + userAgent(other.getUserAgent()); + return this; + } + + @java.lang.Override + @JsonSetter("captured_at") + public RawBytesStage capturedAt(@NotNull OffsetDateTime capturedAt) { + this.capturedAt = Objects.requireNonNull(capturedAt, "capturedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("raw_bytes") + public RemoteIpStage rawBytes(@NotNull String rawBytes) { + this.rawBytes = Objects.requireNonNull(rawBytes, "rawBytes must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("remote_ip") + public UserAgentStage remoteIp(@NotNull String remoteIp) { + this.remoteIp = Objects.requireNonNull(remoteIp, "remoteIp must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("user_agent") + public _FinalStage userAgent(@NotNull String userAgent) { + this.userAgent = Objects.requireNonNull(userAgent, "userAgent must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage eventId(String eventId) { + this.eventId = Optional.ofNullable(eventId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "event_id", nulls = Nulls.SKIP) + public _FinalStage eventId(Optional eventId) { + this.eventId = eventId; + return this; + } + + @java.lang.Override + public CaptureRawEvent build() { + return new CaptureRawEvent(capturedAt, eventId, rawBytes, remoteIp, userAgent, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CaptureRawEventBatch.java b/src/main/java/com/schematic/api/types/CaptureRawEventBatch.java new file mode 100644 index 0000000..769bcba --- /dev/null +++ b/src/main/java/com/schematic/api/types/CaptureRawEventBatch.java @@ -0,0 +1,116 @@ +/** + * 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 = CaptureRawEventBatch.Builder.class) +public final class CaptureRawEventBatch { + private final List events; + + private final Map additionalProperties; + + private CaptureRawEventBatch(List events, Map additionalProperties) { + this.events = events; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("events") + public List getEvents() { + return events; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CaptureRawEventBatch && equalTo((CaptureRawEventBatch) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CaptureRawEventBatch other) { + return events.equals(other.events); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.events); + } + + @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 events = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CaptureRawEventBatch other) { + events(other.getEvents()); + return this; + } + + @JsonSetter(value = "events", nulls = Nulls.SKIP) + public Builder events(List events) { + this.events.clear(); + if (events != null) { + this.events.addAll(events); + } + return this; + } + + public Builder addEvents(CaptureRawEvent events) { + this.events.add(events); + return this; + } + + public Builder addAllEvents(List events) { + if (events != null) { + this.events.addAll(events); + } + return this; + } + + public CaptureRawEventBatch build() { + return new CaptureRawEventBatch(events, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java b/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java index 0b247cd..4972456 100644 --- a/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java +++ b/src/main/java/com/schematic/api/types/ChangeSubscriptionInternalRequestBody.java @@ -190,6 +190,10 @@ public interface SkipTrialStage { public interface _FinalStage { ChangeSubscriptionInternalRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnIds(List addOnIds); _FinalStage addAddOnIds(UpdateAddOnRequestBody addOnIds); @@ -418,5 +422,17 @@ public ChangeSubscriptionInternalRequestBody build() { skipTrial, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java b/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java index ecc9fc6..ef9b57e 100644 --- a/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java +++ b/src/main/java/com/schematic/api/types/ChangeSubscriptionRequestBody.java @@ -174,6 +174,10 @@ public interface SkipTrialStage { public interface _FinalStage { ChangeSubscriptionRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnIds(List addOnIds); _FinalStage addAddOnIds(UpdateAddOnRequestBody addOnIds); @@ -390,5 +394,17 @@ public ChangeSubscriptionRequestBody build() { skipTrial, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java b/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java index 9cd88ad..70813ee 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java +++ b/src/main/java/com/schematic/api/types/CheckFlagRequestBody.java @@ -116,5 +116,15 @@ public Builder user(Map user) { public CheckFlagRequestBody build() { return new CheckFlagRequestBody(company, user, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CheckFlagResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagResponseData.java index 60a627b..faf2990 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckFlagResponseData.java @@ -24,11 +24,13 @@ public final class CheckFlagResponseData { private final Optional companyId; + private final Optional entitlement; + private final Optional error; - private final Optional featureAllocation; + private final Optional featureAllocation; - private final Optional featureUsage; + private final Optional featureUsage; private final Optional featureUsageEvent; @@ -54,9 +56,10 @@ public final class CheckFlagResponseData { private CheckFlagResponseData( Optional companyId, + Optional entitlement, Optional error, - Optional featureAllocation, - Optional featureUsage, + Optional featureAllocation, + Optional featureUsage, Optional featureUsageEvent, Optional featureUsagePeriod, Optional featureUsageResetAt, @@ -69,6 +72,7 @@ private CheckFlagResponseData( boolean value, Map additionalProperties) { this.companyId = companyId; + this.entitlement = entitlement; this.error = error; this.featureAllocation = featureAllocation; this.featureUsage = featureUsage; @@ -93,6 +97,14 @@ public Optional getCompanyId() { return companyId; } + /** + * @return If a feature entitlement rule was matched, its entitlement details + */ + @JsonProperty("entitlement") + public Optional getEntitlement() { + return entitlement; + } + /** * @return If an error occurred while checking the flag, the error message */ @@ -102,23 +114,23 @@ public Optional getError() { } /** - * @return If a numeric feature entitlement rule was matched, its allocation + * @return Deprecated: Use Entitlement.Allocation instead. */ @JsonProperty("feature_allocation") - public Optional getFeatureAllocation() { + public Optional getFeatureAllocation() { return featureAllocation; } /** - * @return If a numeric feature entitlement rule was matched, the company's usage + * @return Deprecated: Use Entitlement.Usage instead. */ @JsonProperty("feature_usage") - public Optional getFeatureUsage() { + public Optional getFeatureUsage() { return featureUsage; } /** - * @return If an event-based numeric feature entitlement rule was matched, the event used to track its usage + * @return Deprecated: Use Entitlement.EventName instead. */ @JsonProperty("feature_usage_event") public Optional getFeatureUsageEvent() { @@ -126,7 +138,7 @@ public Optional getFeatureUsageEvent() { } /** - * @return For event-based feature entitlement rules, the period over which usage is tracked (current_month, current_day, current_week, all_time) + * @return Deprecated: Use Entitlement.MetricPeriod instead. */ @JsonProperty("feature_usage_period") public Optional getFeatureUsagePeriod() { @@ -134,7 +146,7 @@ public Optional getFeatureUsagePeriod() { } /** - * @return For event-based feature entitlement rules, when the usage period will reset + * @return Deprecated: Use Entitlement.MetricResetAt instead. */ @JsonProperty("feature_usage_reset_at") public Optional getFeatureUsageResetAt() { @@ -210,6 +222,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CheckFlagResponseData other) { return companyId.equals(other.companyId) + && entitlement.equals(other.entitlement) && error.equals(other.error) && featureAllocation.equals(other.featureAllocation) && featureUsage.equals(other.featureUsage) @@ -229,6 +242,7 @@ private boolean equalTo(CheckFlagResponseData other) { public int hashCode() { return Objects.hash( this.companyId, + this.entitlement, this.error, this.featureAllocation, this.featureUsage, @@ -279,6 +293,10 @@ public interface ValueStage { public interface _FinalStage { CheckFlagResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

If company keys were provided and matched a company, its ID

*/ @@ -286,6 +304,13 @@ public interface _FinalStage { _FinalStage companyId(String companyId); + /** + *

If a feature entitlement rule was matched, its entitlement details

+ */ + _FinalStage entitlement(Optional entitlement); + + _FinalStage entitlement(FeatureEntitlement entitlement); + /** *

If an error occurred while checking the flag, the error message

*/ @@ -294,35 +319,35 @@ public interface _FinalStage { _FinalStage error(String error); /** - *

If a numeric feature entitlement rule was matched, its allocation

+ *

Deprecated: Use Entitlement.Allocation instead.

*/ - _FinalStage featureAllocation(Optional featureAllocation); + _FinalStage featureAllocation(Optional featureAllocation); - _FinalStage featureAllocation(Integer featureAllocation); + _FinalStage featureAllocation(Long featureAllocation); /** - *

If a numeric feature entitlement rule was matched, the company's usage

+ *

Deprecated: Use Entitlement.Usage instead.

*/ - _FinalStage featureUsage(Optional featureUsage); + _FinalStage featureUsage(Optional featureUsage); - _FinalStage featureUsage(Integer featureUsage); + _FinalStage featureUsage(Long featureUsage); /** - *

If an event-based numeric feature entitlement rule was matched, the event used to track its usage

+ *

Deprecated: Use Entitlement.EventName instead.

*/ _FinalStage featureUsageEvent(Optional featureUsageEvent); _FinalStage featureUsageEvent(String featureUsageEvent); /** - *

For event-based feature entitlement rules, the period over which usage is tracked (current_month, current_day, current_week, all_time)

+ *

Deprecated: Use Entitlement.MetricPeriod instead.

*/ _FinalStage featureUsagePeriod(Optional featureUsagePeriod); _FinalStage featureUsagePeriod(String featureUsagePeriod); /** - *

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

+ *

Deprecated: Use Entitlement.MetricResetAt instead.

*/ _FinalStage featureUsageResetAt(Optional featureUsageResetAt); @@ -379,12 +404,14 @@ public static final class Builder implements FlagStage, ReasonStage, ValueStage, private Optional featureUsageEvent = Optional.empty(); - private Optional featureUsage = Optional.empty(); + private Optional featureUsage = Optional.empty(); - private Optional featureAllocation = Optional.empty(); + private Optional featureAllocation = Optional.empty(); private Optional error = Optional.empty(); + private Optional entitlement = Optional.empty(); + private Optional companyId = Optional.empty(); @JsonAnySetter @@ -395,6 +422,7 @@ private Builder() {} @java.lang.Override public Builder from(CheckFlagResponseData other) { companyId(other.getCompanyId()); + entitlement(other.getEntitlement()); error(other.getError()); featureAllocation(other.getFeatureAllocation()); featureUsage(other.getFeatureUsage()); @@ -528,7 +556,7 @@ public _FinalStage flagId(Optional flagId) { } /** - *

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

+ *

Deprecated: Use Entitlement.MetricResetAt instead.

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

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

+ *

Deprecated: Use Entitlement.MetricResetAt instead.

*/ @java.lang.Override @JsonSetter(value = "feature_usage_reset_at", nulls = Nulls.SKIP) @@ -548,7 +576,7 @@ public _FinalStage featureUsageResetAt(Optional featureUsageRese } /** - *

For event-based feature entitlement rules, the period over which usage is tracked (current_month, current_day, current_week, all_time)

+ *

Deprecated: Use Entitlement.MetricPeriod instead.

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

For event-based feature entitlement rules, the period over which usage is tracked (current_month, current_day, current_week, all_time)

+ *

Deprecated: Use Entitlement.MetricPeriod instead.

*/ @java.lang.Override @JsonSetter(value = "feature_usage_period", nulls = Nulls.SKIP) @@ -568,7 +596,7 @@ public _FinalStage featureUsagePeriod(Optional featureUsagePeriod) { } /** - *

If an event-based numeric feature entitlement rule was matched, the event used to track its usage

+ *

Deprecated: Use Entitlement.EventName instead.

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

If an event-based numeric feature entitlement rule was matched, the event used to track its usage

+ *

Deprecated: Use Entitlement.EventName instead.

*/ @java.lang.Override @JsonSetter(value = "feature_usage_event", nulls = Nulls.SKIP) @@ -588,41 +616,41 @@ public _FinalStage featureUsageEvent(Optional featureUsageEvent) { } /** - *

If a numeric feature entitlement rule was matched, the company's usage

+ *

Deprecated: Use Entitlement.Usage instead.

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

If a numeric feature entitlement rule was matched, the company's usage

+ *

Deprecated: Use Entitlement.Usage instead.

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

If a numeric feature entitlement rule was matched, its allocation

+ *

Deprecated: Use Entitlement.Allocation instead.

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

If a numeric feature entitlement rule was matched, its allocation

+ *

Deprecated: Use Entitlement.Allocation instead.

*/ @java.lang.Override @JsonSetter(value = "feature_allocation", nulls = Nulls.SKIP) - public _FinalStage featureAllocation(Optional featureAllocation) { + public _FinalStage featureAllocation(Optional featureAllocation) { this.featureAllocation = featureAllocation; return this; } @@ -647,6 +675,26 @@ public _FinalStage error(Optional error) { return this; } + /** + *

If a feature entitlement rule was matched, its entitlement details

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

If a feature entitlement rule was matched, its entitlement details

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

If company keys were provided and matched a company, its ID

* @return Reference to {@code this} so that method calls can be chained together. @@ -671,6 +719,7 @@ public _FinalStage companyId(Optional companyId) { public CheckFlagResponseData build() { return new CheckFlagResponseData( companyId, + entitlement, error, featureAllocation, featureUsage, @@ -686,5 +735,17 @@ public CheckFlagResponseData build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java index bc36fa3..f5cfec6 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckFlagsBulkResponseData.java @@ -102,5 +102,15 @@ public Builder addAllData(List data) { public CheckFlagsBulkResponseData build() { return new CheckFlagsBulkResponseData(data, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java b/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java index 76eba1e..787e5e2 100644 --- a/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckFlagsResponseData.java @@ -17,16 +17,23 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CheckFlagsResponseData.Builder.class) public final class CheckFlagsResponseData { private final List flags; + private final Optional plan; + private final Map additionalProperties; - private CheckFlagsResponseData(List flags, Map additionalProperties) { + private CheckFlagsResponseData( + List flags, + Optional plan, + Map additionalProperties) { this.flags = flags; + this.plan = plan; this.additionalProperties = additionalProperties; } @@ -35,6 +42,11 @@ public List getFlags() { return flags; } + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -47,12 +59,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(CheckFlagsResponseData other) { - return flags.equals(other.flags); + return flags.equals(other.flags) && plan.equals(other.plan); } @java.lang.Override public int hashCode() { - return Objects.hash(this.flags); + return Objects.hash(this.flags, this.plan); } @java.lang.Override @@ -68,6 +80,8 @@ public static Builder builder() { public static final class Builder { private List flags = new ArrayList<>(); + private Optional plan = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -75,6 +89,7 @@ private Builder() {} public Builder from(CheckFlagsResponseData other) { flags(other.getFlags()); + plan(other.getPlan()); return this; } @@ -99,8 +114,29 @@ public Builder addAllFlags(List flags) { return this; } + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public Builder plan(Optional plan) { + this.plan = plan; + return this; + } + + public Builder plan(DatastreamCompanyPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + public CheckFlagsResponseData build() { - return new CheckFlagsResponseData(flags, additionalProperties); + return new CheckFlagsResponseData(flags, plan, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java b/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java index d8b10dd..9926a96 100644 --- a/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckoutDataResponseData.java @@ -387,5 +387,15 @@ public CheckoutDataResponseData build() { subscription, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java b/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java index f458ec9..905dd8c 100644 --- a/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java +++ b/src/main/java/com/schematic/api/types/CheckoutSettingsResponseData.java @@ -99,6 +99,10 @@ public interface CollectPhoneStage { public interface _FinalStage { CheckoutSettingsResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -148,5 +152,17 @@ public _FinalStage collectPhone(boolean collectPhone) { public CheckoutSettingsResponseData build() { return new CheckoutSettingsResponseData(collectAddress, collectEmail, collectPhone, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CheckoutSubscription.java b/src/main/java/com/schematic/api/types/CheckoutSubscription.java index 55a1e3f..26b9294 100644 --- a/src/main/java/com/schematic/api/types/CheckoutSubscription.java +++ b/src/main/java/com/schematic/api/types/CheckoutSubscription.java @@ -25,7 +25,7 @@ public final class CheckoutSubscription { private final Optional applicationId; - private final Optional cancelAt; + private final Optional cancelAt; private final boolean cancelAtPeriodEnd; @@ -51,9 +51,9 @@ public final class CheckoutSubscription { private final Optional> metadata; - private final int periodEnd; + private final long periodEnd; - private final int periodStart; + private final long periodStart; private final BillingProviderType providerType; @@ -61,9 +61,9 @@ public final class CheckoutSubscription { private final String subscriptionExternalId; - private final int totalPrice; + private final long totalPrice; - private final Optional trialEnd; + private final Optional trialEnd; private final Optional trialEndSetting; @@ -71,7 +71,7 @@ public final class CheckoutSubscription { private CheckoutSubscription( Optional applicationId, - Optional cancelAt, + Optional cancelAt, boolean cancelAtPeriodEnd, Optional companyId, Optional confirmPaymentIntentClientSecret, @@ -84,13 +84,13 @@ private CheckoutSubscription( String id, String interval, Optional> metadata, - int periodEnd, - int periodStart, + long periodEnd, + long periodStart, BillingProviderType providerType, String status, String subscriptionExternalId, - int totalPrice, - Optional trialEnd, + long totalPrice, + Optional trialEnd, Optional trialEndSetting, Map additionalProperties) { this.applicationId = applicationId; @@ -124,7 +124,7 @@ public Optional getApplicationId() { } @JsonProperty("cancel_at") - public Optional getCancelAt() { + public Optional getCancelAt() { return cancelAt; } @@ -189,12 +189,12 @@ public Optional> getMetadata() { } @JsonProperty("period_end") - public int getPeriodEnd() { + public long getPeriodEnd() { return periodEnd; } @JsonProperty("period_start") - public int getPeriodStart() { + public long getPeriodStart() { return periodStart; } @@ -214,12 +214,12 @@ public String getSubscriptionExternalId() { } @JsonProperty("total_price") - public int getTotalPrice() { + public long getTotalPrice() { return totalPrice; } @JsonProperty("trial_end") - public Optional getTrialEnd() { + public Optional getTrialEnd() { return trialEnd; } @@ -327,11 +327,11 @@ public interface IntervalStage { } public interface PeriodEndStage { - PeriodStartStage periodEnd(int periodEnd); + PeriodStartStage periodEnd(long periodEnd); } public interface PeriodStartStage { - ProviderTypeStage periodStart(int periodStart); + ProviderTypeStage periodStart(long periodStart); } public interface ProviderTypeStage { @@ -347,19 +347,23 @@ public interface SubscriptionExternalIdStage { } public interface TotalPriceStage { - _FinalStage totalPrice(int totalPrice); + _FinalStage totalPrice(long totalPrice); } public interface _FinalStage { CheckoutSubscription build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage applicationId(Optional applicationId); _FinalStage applicationId(String applicationId); - _FinalStage cancelAt(Optional cancelAt); + _FinalStage cancelAt(Optional cancelAt); - _FinalStage cancelAt(Integer cancelAt); + _FinalStage cancelAt(Long cancelAt); _FinalStage companyId(Optional companyId); @@ -385,9 +389,9 @@ public interface _FinalStage { _FinalStage metadata(Map metadata); - _FinalStage trialEnd(Optional trialEnd); + _FinalStage trialEnd(Optional trialEnd); - _FinalStage trialEnd(Integer trialEnd); + _FinalStage trialEnd(Long trialEnd); _FinalStage trialEndSetting(Optional trialEndSetting); @@ -421,9 +425,9 @@ public static final class Builder private String interval; - private int periodEnd; + private long periodEnd; - private int periodStart; + private long periodStart; private BillingProviderType providerType; @@ -431,11 +435,11 @@ public static final class Builder private String subscriptionExternalId; - private int totalPrice; + private long totalPrice; private Optional trialEndSetting = Optional.empty(); - private Optional trialEnd = Optional.empty(); + private Optional trialEnd = Optional.empty(); private Optional> metadata = Optional.empty(); @@ -449,7 +453,7 @@ public static final class Builder private Optional companyId = Optional.empty(); - private Optional cancelAt = Optional.empty(); + private Optional cancelAt = Optional.empty(); private Optional applicationId = Optional.empty(); @@ -529,14 +533,14 @@ public PeriodEndStage interval(@NotNull String interval) { @java.lang.Override @JsonSetter("period_end") - public PeriodStartStage periodEnd(int periodEnd) { + public PeriodStartStage periodEnd(long periodEnd) { this.periodEnd = periodEnd; return this; } @java.lang.Override @JsonSetter("period_start") - public ProviderTypeStage periodStart(int periodStart) { + public ProviderTypeStage periodStart(long periodStart) { this.periodStart = periodStart; return this; } @@ -565,7 +569,7 @@ public TotalPriceStage subscriptionExternalId(@NotNull String subscriptionExtern @java.lang.Override @JsonSetter("total_price") - public _FinalStage totalPrice(int totalPrice) { + public _FinalStage totalPrice(long totalPrice) { this.totalPrice = totalPrice; return this; } @@ -584,14 +588,14 @@ public _FinalStage trialEndSetting(Optional } @java.lang.Override - public _FinalStage trialEnd(Integer trialEnd) { + public _FinalStage trialEnd(Long trialEnd) { this.trialEnd = Optional.ofNullable(trialEnd); return this; } @java.lang.Override @JsonSetter(value = "trial_end", nulls = Nulls.SKIP) - public _FinalStage trialEnd(Optional trialEnd) { + public _FinalStage trialEnd(Optional trialEnd) { this.trialEnd = trialEnd; return this; } @@ -675,14 +679,14 @@ public _FinalStage companyId(Optional companyId) { } @java.lang.Override - public _FinalStage cancelAt(Integer cancelAt) { + public _FinalStage cancelAt(Long cancelAt) { this.cancelAt = Optional.ofNullable(cancelAt); return this; } @java.lang.Override @JsonSetter(value = "cancel_at", nulls = Nulls.SKIP) - public _FinalStage cancelAt(Optional cancelAt) { + public _FinalStage cancelAt(Optional cancelAt) { this.cancelAt = cancelAt; return this; } @@ -727,5 +731,17 @@ public CheckoutSubscription build() { trialEndSetting, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java index 9a10185..f40aec8 100644 --- a/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyDetailResponseData.java @@ -63,11 +63,13 @@ public final class CompanyDetailResponseData { private final List rules; + private final Optional scheduledDowngrade; + private final Optional> traits; private final OffsetDateTime updatedAt; - private final int userCount; + private final long userCount; private final Map additionalProperties; @@ -91,9 +93,10 @@ private CompanyDetailResponseData( Optional plan, List plans, List rules, + Optional scheduledDowngrade, Optional> traits, OffsetDateTime updatedAt, - int userCount, + long userCount, Map additionalProperties) { this.addOns = addOns; this.billingCreditBalances = billingCreditBalances; @@ -114,6 +117,7 @@ private CompanyDetailResponseData( this.plan = plan; this.plans = plans; this.rules = rules; + this.scheduledDowngrade = scheduledDowngrade; this.traits = traits; this.updatedAt = updatedAt; this.userCount = userCount; @@ -215,6 +219,11 @@ public List getRules() { return rules; } + @JsonProperty("scheduled_downgrade") + public Optional getScheduledDowngrade() { + return scheduledDowngrade; + } + /** * @return A map of trait names to trait values */ @@ -229,7 +238,7 @@ public OffsetDateTime getUpdatedAt() { } @JsonProperty("user_count") - public int getUserCount() { + public long getUserCount() { return userCount; } @@ -264,6 +273,7 @@ private boolean equalTo(CompanyDetailResponseData other) { && plan.equals(other.plan) && plans.equals(other.plans) && rules.equals(other.rules) + && scheduledDowngrade.equals(other.scheduledDowngrade) && traits.equals(other.traits) && updatedAt.equals(other.updatedAt) && userCount == other.userCount; @@ -291,6 +301,7 @@ public int hashCode() { this.plan, this.plans, this.rules, + this.scheduledDowngrade, this.traits, this.updatedAt, this.userCount); @@ -328,12 +339,16 @@ public interface UpdatedAtStage { } public interface UserCountStage { - _FinalStage userCount(int userCount); + _FinalStage userCount(long userCount); } public interface _FinalStage { CompanyDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOns(List addOns); _FinalStage addAddOns(CompanyPlanWithBillingSubView addOns); @@ -412,6 +427,10 @@ public interface _FinalStage { _FinalStage addAllRules(List rules); + _FinalStage scheduledDowngrade(Optional scheduledDowngrade); + + _FinalStage scheduledDowngrade(ScheduledDowngradeResponseData scheduledDowngrade); + /** *

A map of trait names to trait values

*/ @@ -439,10 +458,12 @@ public static final class Builder private OffsetDateTime updatedAt; - private int userCount; + private long userCount; private Optional> traits = Optional.empty(); + private Optional scheduledDowngrade = Optional.empty(); + private List rules = new ArrayList<>(); private List plans = new ArrayList<>(); @@ -499,6 +520,7 @@ public Builder from(CompanyDetailResponseData other) { plan(other.getPlan()); plans(other.getPlans()); rules(other.getRules()); + scheduledDowngrade(other.getScheduledDowngrade()); traits(other.getTraits()); updatedAt(other.getUpdatedAt()); userCount(other.getUserCount()); @@ -542,7 +564,7 @@ public UserCountStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("user_count") - public _FinalStage userCount(int userCount) { + public _FinalStage userCount(long userCount) { this.userCount = userCount; return this; } @@ -567,6 +589,19 @@ public _FinalStage traits(Optional> traits) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngrade(ScheduledDowngradeResponseData scheduledDowngrade) { + this.scheduledDowngrade = Optional.ofNullable(scheduledDowngrade); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngrade(Optional scheduledDowngrade) { + this.scheduledDowngrade = scheduledDowngrade; + return this; + } + @java.lang.Override public _FinalStage addAllRules(List rules) { if (rules != null) { @@ -883,10 +918,23 @@ public CompanyDetailResponseData build() { plan, plans, rules, + scheduledDowngrade, traits, updatedAt, userCount, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyEventPeriodMetricsResponseData.java b/src/main/java/com/schematic/api/types/CompanyEventPeriodMetricsResponseData.java index 6174fb1..5d69465 100644 --- a/src/main/java/com/schematic/api/types/CompanyEventPeriodMetricsResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyEventPeriodMetricsResponseData.java @@ -42,7 +42,7 @@ public final class CompanyEventPeriodMetricsResponseData { private final Optional validUntil; - private final int value; + private final long value; private final Map additionalProperties; @@ -57,7 +57,7 @@ private CompanyEventPeriodMetricsResponseData( String monthReset, String period, Optional validUntil, - int value, + long value, Map additionalProperties) { this.accountId = accountId; this.capturedAtMax = capturedAtMax; @@ -124,7 +124,7 @@ public Optional getValidUntil() { } @JsonProperty("value") - public int getValue() { + public long getValue() { return value; } @@ -218,12 +218,16 @@ public interface PeriodStage { } public interface ValueStage { - _FinalStage value(int value); + _FinalStage value(long value); } public interface _FinalStage { CompanyEventPeriodMetricsResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage validUntil(Optional validUntil); _FinalStage validUntil(OffsetDateTime validUntil); @@ -260,7 +264,7 @@ public static final class Builder private String period; - private int value; + private long value; private Optional validUntil = Optional.empty(); @@ -350,7 +354,7 @@ public ValueStage period(@NotNull String period) { @java.lang.Override @JsonSetter("value") - public _FinalStage value(int value) { + public _FinalStage value(long value) { this.value = value; return this; } @@ -384,5 +388,17 @@ public CompanyEventPeriodMetricsResponseData build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyLedgerResponseData.java b/src/main/java/com/schematic/api/types/CompanyLedgerResponseData.java index f8d1be0..952f307 100644 --- a/src/main/java/com/schematic/api/types/CompanyLedgerResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyLedgerResponseData.java @@ -94,6 +94,10 @@ public interface NameStage { public interface _FinalStage { CompanyLedgerResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage logoUrl(Optional logoUrl); _FinalStage logoUrl(String logoUrl); @@ -151,5 +155,17 @@ public _FinalStage logoUrl(Optional logoUrl) { public CompanyLedgerResponseData build() { return new CompanyLedgerResponseData(id, logoUrl, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyMembershipDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyMembershipDetailResponseData.java index 34d8f12..1e85978 100644 --- a/src/main/java/com/schematic/api/types/CompanyMembershipDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyMembershipDetailResponseData.java @@ -143,6 +143,10 @@ public interface UserIdStage { public interface _FinalStage { CompanyMembershipDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage company(Optional company); _FinalStage company(CompanyResponseData company); @@ -232,5 +236,17 @@ public CompanyMembershipDetailResponseData build() { return new CompanyMembershipDetailResponseData( company, companyId, createdAt, id, updatedAt, userId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyMembershipResponseData.java b/src/main/java/com/schematic/api/types/CompanyMembershipResponseData.java index c8bb6e1..a962a22 100644 --- a/src/main/java/com/schematic/api/types/CompanyMembershipResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyMembershipResponseData.java @@ -129,6 +129,10 @@ public interface UserIdStage { public interface _FinalStage { CompanyMembershipResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -198,5 +202,17 @@ public _FinalStage userId(@NotNull String userId) { public CompanyMembershipResponseData build() { return new CompanyMembershipResponseData(companyId, createdAt, id, updatedAt, userId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyOverrideNoteResponseData.java b/src/main/java/com/schematic/api/types/CompanyOverrideNoteResponseData.java index edfb403..f34f65f 100644 --- a/src/main/java/com/schematic/api/types/CompanyOverrideNoteResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyOverrideNoteResponseData.java @@ -144,6 +144,10 @@ public interface UpdatedAtStage { public interface _FinalStage { CompanyOverrideNoteResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -230,5 +234,17 @@ public CompanyOverrideNoteResponseData build() { return new CompanyOverrideNoteResponseData( createdAt, externalUserId, externalUserName, id, note, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java b/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java index a5a00b2..fa95ee0 100644 --- a/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyOverrideResponseData.java @@ -56,7 +56,7 @@ public final class CompanyOverrideResponseData { private final Optional valueBool; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTrait; @@ -83,7 +83,7 @@ private CompanyOverrideResponseData( Optional ruleIdUsageExceeded, OffsetDateTime updatedAt, Optional valueBool, - Optional valueNumeric, + Optional valueNumeric, Optional valueTrait, Optional valueTraitId, EntitlementValueType valueType, @@ -192,7 +192,7 @@ public Optional getValueBool() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -312,6 +312,10 @@ public interface ValueTypeStage { public interface _FinalStage { CompanyOverrideResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage company(Optional company); _FinalStage company(CompanyDetailResponseData company); @@ -354,9 +358,9 @@ public interface _FinalStage { _FinalStage valueBool(Boolean valueBool); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTrait(Optional valueTrait); @@ -395,7 +399,7 @@ public static final class Builder private Optional valueTrait = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueBool = Optional.empty(); @@ -523,14 +527,14 @@ public _FinalStage valueTrait(Optional valueT } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -701,5 +705,17 @@ public CompanyOverrideResponseData build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java index be1d75d..09a3f68 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanDetailResponseData.java @@ -24,6 +24,8 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CompanyPlanDetailResponseData.Builder.class) public final class CompanyPlanDetailResponseData { + private final Optional activeVersion; + private final Optional audienceType; private final Optional billingProduct; @@ -32,7 +34,7 @@ public final class CompanyPlanDetailResponseData { private final boolean companyCanTrial; - private final int companyCount; + private final long companyCount; private final List compatiblePlanIds; @@ -40,6 +42,8 @@ public final class CompanyPlanDetailResponseData { private final OffsetDateTime createdAt; + private final List currencyPrices; + private final boolean current; private final boolean custom; @@ -48,6 +52,8 @@ public final class CompanyPlanDetailResponseData { private final String description; + private final Optional draftVersion; + private final List entitlements; private final List features; @@ -76,7 +82,7 @@ public final class CompanyPlanDetailResponseData { private final PlanType planType; - private final Optional trialDays; + private final Optional trialDays; private final OffsetDateTime updatedAt; @@ -91,18 +97,21 @@ public final class CompanyPlanDetailResponseData { private final Map additionalProperties; private CompanyPlanDetailResponseData( + Optional activeVersion, Optional audienceType, Optional billingProduct, ChargeType chargeType, boolean companyCanTrial, - int companyCount, + long companyCount, List compatiblePlanIds, PlanControlledByType controlledBy, OffsetDateTime createdAt, + List currencyPrices, boolean current, boolean custom, Optional customPlanConfig, String description, + Optional draftVersion, List entitlements, List features, String icon, @@ -117,13 +126,14 @@ private CompanyPlanDetailResponseData( String name, Optional oneTimePrice, PlanType planType, - Optional trialDays, + Optional trialDays, OffsetDateTime updatedAt, List usageViolations, boolean valid, List versions, Optional yearlyPrice, Map additionalProperties) { + this.activeVersion = activeVersion; this.audienceType = audienceType; this.billingProduct = billingProduct; this.chargeType = chargeType; @@ -132,10 +142,12 @@ private CompanyPlanDetailResponseData( this.compatiblePlanIds = compatiblePlanIds; this.controlledBy = controlledBy; this.createdAt = createdAt; + this.currencyPrices = currencyPrices; this.current = current; this.custom = custom; this.customPlanConfig = customPlanConfig; this.description = description; + this.draftVersion = draftVersion; this.entitlements = entitlements; this.features = features; this.icon = icon; @@ -159,6 +171,11 @@ private CompanyPlanDetailResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("active_version") + public Optional getActiveVersion() { + return activeVersion; + } + @JsonProperty("audience_type") public Optional getAudienceType() { return audienceType; @@ -180,7 +197,7 @@ public boolean getCompanyCanTrial() { } @JsonProperty("company_count") - public int getCompanyCount() { + public long getCompanyCount() { return companyCount; } @@ -199,6 +216,11 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("current") public boolean getCurrent() { return current; @@ -219,6 +241,11 @@ public String getDescription() { return description; } + @JsonProperty("draft_version") + public Optional getDraftVersion() { + return draftVersion; + } + @JsonProperty("entitlements") public List getEntitlements() { return entitlements; @@ -290,7 +317,7 @@ public PlanType getPlanType() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -331,7 +358,8 @@ public Map getAdditionalProperties() { } private boolean equalTo(CompanyPlanDetailResponseData other) { - return audienceType.equals(other.audienceType) + return activeVersion.equals(other.activeVersion) + && audienceType.equals(other.audienceType) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCanTrial == other.companyCanTrial @@ -339,10 +367,12 @@ private boolean equalTo(CompanyPlanDetailResponseData other) { && compatiblePlanIds.equals(other.compatiblePlanIds) && controlledBy.equals(other.controlledBy) && createdAt.equals(other.createdAt) + && currencyPrices.equals(other.currencyPrices) && current == other.current && custom == other.custom && customPlanConfig.equals(other.customPlanConfig) && description.equals(other.description) + && draftVersion.equals(other.draftVersion) && entitlements.equals(other.entitlements) && features.equals(other.features) && icon.equals(other.icon) @@ -368,6 +398,7 @@ private boolean equalTo(CompanyPlanDetailResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.activeVersion, this.audienceType, this.billingProduct, this.chargeType, @@ -376,10 +407,12 @@ public int hashCode() { this.compatiblePlanIds, this.controlledBy, this.createdAt, + this.currencyPrices, this.current, this.custom, this.customPlanConfig, this.description, + this.draftVersion, this.entitlements, this.features, this.icon, @@ -422,7 +455,7 @@ public interface CompanyCanTrialStage { } public interface CompanyCountStage { - ControlledByStage companyCount(int companyCount); + ControlledByStage companyCount(long companyCount); } public interface ControlledByStage { @@ -488,6 +521,14 @@ public interface ValidStage { public interface _FinalStage { CompanyPlanDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage activeVersion(Optional activeVersion); + + _FinalStage activeVersion(PlanVersionResponseData activeVersion); + _FinalStage audienceType(Optional audienceType); _FinalStage audienceType(String audienceType); @@ -502,10 +543,20 @@ public interface _FinalStage { _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + _FinalStage customPlanConfig(Optional customPlanConfig); _FinalStage customPlanConfig(CustomPlanConfig customPlanConfig); + _FinalStage draftVersion(Optional draftVersion); + + _FinalStage draftVersion(PlanVersionResponseData draftVersion); + _FinalStage entitlements(List entitlements); _FinalStage addEntitlements(PlanEntitlementResponseData entitlements); @@ -536,9 +587,9 @@ public interface _FinalStage { _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage usageViolations(List usageViolations); @@ -582,7 +633,7 @@ public static final class Builder private boolean companyCanTrial; - private int companyCount; + private long companyCount; private PlanControlledByType controlledBy; @@ -620,7 +671,7 @@ public static final class Builder private List usageViolations = new ArrayList<>(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional oneTimePrice = Optional.empty(); @@ -634,14 +685,20 @@ public static final class Builder private List entitlements = new ArrayList<>(); + private Optional draftVersion = Optional.empty(); + private Optional customPlanConfig = Optional.empty(); + private List currencyPrices = new ArrayList<>(); + private List compatiblePlanIds = new ArrayList<>(); private Optional billingProduct = Optional.empty(); private Optional audienceType = Optional.empty(); + private Optional activeVersion = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -649,6 +706,7 @@ private Builder() {} @java.lang.Override public Builder from(CompanyPlanDetailResponseData other) { + activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); @@ -657,10 +715,12 @@ public Builder from(CompanyPlanDetailResponseData other) { compatiblePlanIds(other.getCompatiblePlanIds()); controlledBy(other.getControlledBy()); createdAt(other.getCreatedAt()); + currencyPrices(other.getCurrencyPrices()); current(other.getCurrent()); custom(other.getCustom()); customPlanConfig(other.getCustomPlanConfig()); description(other.getDescription()); + draftVersion(other.getDraftVersion()); entitlements(other.getEntitlements()); features(other.getFeatures()); icon(other.getIcon()); @@ -700,7 +760,7 @@ public CompanyCountStage companyCanTrial(boolean companyCanTrial) { @java.lang.Override @JsonSetter("company_count") - public ControlledByStage companyCount(int companyCount) { + public ControlledByStage companyCount(long companyCount) { this.companyCount = companyCount; return this; } @@ -872,14 +932,14 @@ public _FinalStage usageViolations(List usageViolation } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -995,6 +1055,19 @@ public _FinalStage entitlements(List entitlements) return this; } + @java.lang.Override + public _FinalStage draftVersion(PlanVersionResponseData draftVersion) { + this.draftVersion = Optional.ofNullable(draftVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "draft_version", nulls = Nulls.SKIP) + public _FinalStage draftVersion(Optional draftVersion) { + this.draftVersion = draftVersion; + return this; + } + @java.lang.Override public _FinalStage customPlanConfig(CustomPlanConfig customPlanConfig) { this.customPlanConfig = Optional.ofNullable(customPlanConfig); @@ -1008,6 +1081,30 @@ public _FinalStage customPlanConfig(Optional customPlanConfig) return this; } + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + @java.lang.Override public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { if (compatiblePlanIds != null) { @@ -1058,9 +1155,23 @@ public _FinalStage audienceType(Optional audienceType) { return this; } + @java.lang.Override + public _FinalStage activeVersion(PlanVersionResponseData activeVersion) { + this.activeVersion = Optional.ofNullable(activeVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active_version", nulls = Nulls.SKIP) + public _FinalStage activeVersion(Optional activeVersion) { + this.activeVersion = activeVersion; + return this; + } + @java.lang.Override public CompanyPlanDetailResponseData build() { return new CompanyPlanDetailResponseData( + activeVersion, audienceType, billingProduct, chargeType, @@ -1069,10 +1180,12 @@ public CompanyPlanDetailResponseData build() { compatiblePlanIds, controlledBy, createdAt, + currencyPrices, current, custom, customPlanConfig, description, + draftVersion, entitlements, features, icon, @@ -1095,5 +1208,17 @@ public CompanyPlanDetailResponseData build() { yearlyPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java b/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java index 7b44914..f9c46ef 100644 --- a/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java +++ b/src/main/java/com/schematic/api/types/CompanyPlanWithBillingSubView.java @@ -42,7 +42,7 @@ public final class CompanyPlanWithBillingSubView { private final Optional planPeriod; - private final Optional planPrice; + private final Optional planPrice; private final Optional planVersionId; @@ -58,7 +58,7 @@ private CompanyPlanWithBillingSubView( List includedCreditGrants, String name, Optional planPeriod, - Optional planPrice, + Optional planPrice, Optional planVersionId, Map additionalProperties) { this.addedOn = addedOn; @@ -121,7 +121,7 @@ public Optional getPlanPeriod() { } @JsonProperty("plan_price") - public Optional getPlanPrice() { + public Optional getPlanPrice() { return planPrice; } @@ -193,6 +193,10 @@ public interface NameStage { public interface _FinalStage { CompanyPlanWithBillingSubView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addedOn(Optional addedOn); _FinalStage addedOn(OffsetDateTime addedOn); @@ -223,9 +227,9 @@ public interface _FinalStage { _FinalStage planPeriod(String planPeriod); - _FinalStage planPrice(Optional planPrice); + _FinalStage planPrice(Optional planPrice); - _FinalStage planPrice(Integer planPrice); + _FinalStage planPrice(Long planPrice); _FinalStage planVersionId(Optional planVersionId); @@ -240,7 +244,7 @@ public static final class Builder implements IdStage, NameStage, _FinalStage { private Optional planVersionId = Optional.empty(); - private Optional planPrice = Optional.empty(); + private Optional planPrice = Optional.empty(); private Optional planPeriod = Optional.empty(); @@ -305,14 +309,14 @@ public _FinalStage planVersionId(Optional planVersionId) { } @java.lang.Override - public _FinalStage planPrice(Integer planPrice) { + public _FinalStage planPrice(Long planPrice) { this.planPrice = Optional.ofNullable(planPrice); return this; } @java.lang.Override @JsonSetter(value = "plan_price", nulls = Nulls.SKIP) - public _FinalStage planPrice(Optional planPrice) { + public _FinalStage planPrice(Optional planPrice) { this.planPrice = planPrice; return this; } @@ -435,5 +439,17 @@ public CompanyPlanWithBillingSubView build() { planVersionId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyResponseData.java b/src/main/java/com/schematic/api/types/CompanyResponseData.java index 15d0f9b..33565c8 100644 --- a/src/main/java/com/schematic/api/types/CompanyResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanyResponseData.java @@ -153,6 +153,10 @@ public interface UpdatedAtStage { public interface _FinalStage { CompanyResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage lastSeenAt(Optional lastSeenAt); _FinalStage lastSeenAt(OffsetDateTime lastSeenAt); @@ -262,5 +266,17 @@ public CompanyResponseData build() { return new CompanyResponseData( createdAt, environmentId, id, lastSeenAt, logoUrl, name, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java b/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java index 90792f8..d3e78fa 100644 --- a/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java +++ b/src/main/java/com/schematic/api/types/CompanySubscriptionResponseData.java @@ -48,7 +48,7 @@ public final class CompanySubscriptionResponseData { private final String subscriptionExternalId; - private final int totalPrice; + private final long totalPrice; private final Optional trialEnd; @@ -67,7 +67,7 @@ private CompanySubscriptionResponseData( List products, String status, String subscriptionExternalId, - int totalPrice, + long totalPrice, Optional trialEnd, Map additionalProperties) { this.cancelAt = cancelAt; @@ -148,7 +148,7 @@ public String getSubscriptionExternalId() { } @JsonProperty("total_price") - public int getTotalPrice() { + public long getTotalPrice() { return totalPrice; } @@ -240,12 +240,16 @@ public interface SubscriptionExternalIdStage { } public interface TotalPriceStage { - _FinalStage totalPrice(int totalPrice); + _FinalStage totalPrice(long totalPrice); } public interface _FinalStage { CompanySubscriptionResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage cancelAt(Optional cancelAt); _FinalStage cancelAt(OffsetDateTime cancelAt); @@ -301,7 +305,7 @@ public static final class Builder private String subscriptionExternalId; - private int totalPrice; + private long totalPrice; private Optional trialEnd = Optional.empty(); @@ -386,7 +390,7 @@ public TotalPriceStage subscriptionExternalId(@NotNull String subscriptionExtern @java.lang.Override @JsonSetter("total_price") - public _FinalStage totalPrice(int totalPrice) { + public _FinalStage totalPrice(long totalPrice) { this.totalPrice = totalPrice; return this; } @@ -523,5 +527,17 @@ public CompanySubscriptionResponseData build() { trialEnd, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java b/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java deleted file mode 100644 index 488365a..0000000 --- a/src/main/java/com/schematic/api/types/CompanyViewWithFeatureUsageResponseData.java +++ /dev/null @@ -1,938 +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.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 = CompanyViewWithFeatureUsageResponseData.Builder.class) -public final class CompanyViewWithFeatureUsageResponseData { - private final List addOns; - - private final Optional> billingCreditBalances; - - private final Optional billingSubscription; - - private final List billingSubscriptions; - - private final OffsetDateTime createdAt; - - private final Optional defaultPaymentMethod; - - private final List entitlements; - - private final List entityTraits; - - private final String environmentId; - - private final List featureUsage; - - private final String id; - - private final List keys; - - private final Optional lastSeenAt; - - private final Optional logoUrl; - - private final List metrics; - - private final String name; - - private final List paymentMethods; - - private final Optional plan; - - private final List plans; - - private final List rules; - - private final Optional> traits; - - private final OffsetDateTime updatedAt; - - private final int userCount; - - private final Map additionalProperties; - - private CompanyViewWithFeatureUsageResponseData( - List addOns, - Optional> billingCreditBalances, - Optional billingSubscription, - List billingSubscriptions, - OffsetDateTime createdAt, - Optional defaultPaymentMethod, - List entitlements, - List entityTraits, - String environmentId, - List featureUsage, - String id, - List keys, - Optional lastSeenAt, - Optional logoUrl, - List metrics, - String name, - List paymentMethods, - Optional plan, - List plans, - List rules, - Optional> traits, - OffsetDateTime updatedAt, - int userCount, - Map additionalProperties) { - this.addOns = addOns; - this.billingCreditBalances = billingCreditBalances; - this.billingSubscription = billingSubscription; - this.billingSubscriptions = billingSubscriptions; - this.createdAt = createdAt; - this.defaultPaymentMethod = defaultPaymentMethod; - this.entitlements = entitlements; - this.entityTraits = entityTraits; - this.environmentId = environmentId; - this.featureUsage = featureUsage; - this.id = id; - this.keys = keys; - this.lastSeenAt = lastSeenAt; - this.logoUrl = logoUrl; - this.metrics = metrics; - this.name = name; - this.paymentMethods = paymentMethods; - this.plan = plan; - this.plans = plans; - this.rules = rules; - this.traits = traits; - this.updatedAt = updatedAt; - this.userCount = userCount; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("add_ons") - public List getAddOns() { - return addOns; - } - - @JsonProperty("billing_credit_balances") - public Optional> getBillingCreditBalances() { - return billingCreditBalances; - } - - @JsonProperty("billing_subscription") - public Optional getBillingSubscription() { - return billingSubscription; - } - - @JsonProperty("billing_subscriptions") - public List getBillingSubscriptions() { - return billingSubscriptions; - } - - @JsonProperty("created_at") - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("default_payment_method") - public Optional getDefaultPaymentMethod() { - return defaultPaymentMethod; - } - - @JsonProperty("entitlements") - public List getEntitlements() { - return entitlements; - } - - @JsonProperty("entity_traits") - public List getEntityTraits() { - return entityTraits; - } - - @JsonProperty("environment_id") - public String getEnvironmentId() { - return environmentId; - } - - @JsonProperty("feature_usage") - public List getFeatureUsage() { - return featureUsage; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("keys") - public List getKeys() { - return keys; - } - - @JsonProperty("last_seen_at") - public Optional getLastSeenAt() { - return lastSeenAt; - } - - @JsonProperty("logo_url") - public Optional getLogoUrl() { - return logoUrl; - } - - @JsonProperty("metrics") - public List getMetrics() { - return metrics; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("payment_methods") - public List getPaymentMethods() { - return paymentMethods; - } - - @JsonProperty("plan") - public Optional getPlan() { - return plan; - } - - @JsonProperty("plans") - public List getPlans() { - return plans; - } - - @JsonProperty("rules") - public List getRules() { - return rules; - } - - /** - * @return A map of trait names to trait values - */ - @JsonProperty("traits") - public Optional> getTraits() { - return traits; - } - - @JsonProperty("updated_at") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @JsonProperty("user_count") - public int getUserCount() { - return userCount; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CompanyViewWithFeatureUsageResponseData - && equalTo((CompanyViewWithFeatureUsageResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CompanyViewWithFeatureUsageResponseData other) { - return addOns.equals(other.addOns) - && billingCreditBalances.equals(other.billingCreditBalances) - && billingSubscription.equals(other.billingSubscription) - && 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) - && id.equals(other.id) - && keys.equals(other.keys) - && lastSeenAt.equals(other.lastSeenAt) - && logoUrl.equals(other.logoUrl) - && metrics.equals(other.metrics) - && name.equals(other.name) - && paymentMethods.equals(other.paymentMethods) - && plan.equals(other.plan) - && plans.equals(other.plans) - && rules.equals(other.rules) - && traits.equals(other.traits) - && updatedAt.equals(other.updatedAt) - && userCount == other.userCount; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.addOns, - this.billingCreditBalances, - this.billingSubscription, - this.billingSubscriptions, - this.createdAt, - this.defaultPaymentMethod, - this.entitlements, - this.entityTraits, - this.environmentId, - this.featureUsage, - this.id, - this.keys, - this.lastSeenAt, - this.logoUrl, - this.metrics, - this.name, - this.paymentMethods, - this.plan, - this.plans, - this.rules, - this.traits, - this.updatedAt, - this.userCount); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static CreatedAtStage builder() { - return new Builder(); - } - - public interface CreatedAtStage { - EnvironmentIdStage createdAt(@NotNull OffsetDateTime createdAt); - - Builder from(CompanyViewWithFeatureUsageResponseData other); - } - - public interface EnvironmentIdStage { - IdStage environmentId(@NotNull String environmentId); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - UpdatedAtStage name(@NotNull String name); - } - - public interface UpdatedAtStage { - UserCountStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface UserCountStage { - _FinalStage userCount(int userCount); - } - - public interface _FinalStage { - CompanyViewWithFeatureUsageResponseData build(); - - _FinalStage addOns(List addOns); - - _FinalStage addAddOns(CompanyPlanWithBillingSubView addOns); - - _FinalStage addAllAddOns(List addOns); - - _FinalStage billingCreditBalances(Optional> billingCreditBalances); - - _FinalStage billingCreditBalances(Map billingCreditBalances); - - _FinalStage billingSubscription(Optional billingSubscription); - - _FinalStage billingSubscription(BillingSubscriptionView billingSubscription); - - _FinalStage billingSubscriptions(List billingSubscriptions); - - _FinalStage addBillingSubscriptions(BillingSubscriptionView billingSubscriptions); - - _FinalStage addAllBillingSubscriptions(List billingSubscriptions); - - _FinalStage defaultPaymentMethod(Optional defaultPaymentMethod); - - _FinalStage defaultPaymentMethod(PaymentMethodResponseData defaultPaymentMethod); - - _FinalStage entitlements(List entitlements); - - _FinalStage addEntitlements(FeatureEntitlement entitlements); - - _FinalStage addAllEntitlements(List entitlements); - - _FinalStage entityTraits(List entityTraits); - - _FinalStage addEntityTraits(EntityTraitDetailResponseData entityTraits); - - _FinalStage addAllEntityTraits(List entityTraits); - - _FinalStage featureUsage(List featureUsage); - - _FinalStage addFeatureUsage(FeatureUsageDataResponseData featureUsage); - - _FinalStage addAllFeatureUsage(List featureUsage); - - _FinalStage keys(List keys); - - _FinalStage addKeys(EntityKeyDetailResponseData keys); - - _FinalStage addAllKeys(List keys); - - _FinalStage lastSeenAt(Optional lastSeenAt); - - _FinalStage lastSeenAt(OffsetDateTime lastSeenAt); - - _FinalStage logoUrl(Optional logoUrl); - - _FinalStage logoUrl(String logoUrl); - - _FinalStage metrics(List metrics); - - _FinalStage addMetrics(CompanyEventPeriodMetricsResponseData metrics); - - _FinalStage addAllMetrics(List metrics); - - _FinalStage paymentMethods(List paymentMethods); - - _FinalStage addPaymentMethods(PaymentMethodResponseData paymentMethods); - - _FinalStage addAllPaymentMethods(List paymentMethods); - - _FinalStage plan(Optional plan); - - _FinalStage plan(CompanyPlanWithBillingSubView plan); - - _FinalStage plans(List plans); - - _FinalStage addPlans(GenericPreviewObject plans); - - _FinalStage addAllPlans(List plans); - - _FinalStage rules(List rules); - - _FinalStage addRules(Rule rules); - - _FinalStage addAllRules(List rules); - - /** - *

A map of trait names to trait values

- */ - _FinalStage traits(Optional> traits); - - _FinalStage traits(Map traits); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements CreatedAtStage, - EnvironmentIdStage, - IdStage, - NameStage, - UpdatedAtStage, - UserCountStage, - _FinalStage { - private OffsetDateTime createdAt; - - private String environmentId; - - private String id; - - private String name; - - private OffsetDateTime updatedAt; - - private int userCount; - - private Optional> traits = Optional.empty(); - - private List rules = new ArrayList<>(); - - private List plans = new ArrayList<>(); - - private Optional plan = Optional.empty(); - - private List paymentMethods = new ArrayList<>(); - - private List metrics = new ArrayList<>(); - - private Optional logoUrl = Optional.empty(); - - private Optional lastSeenAt = Optional.empty(); - - private List keys = new ArrayList<>(); - - private List featureUsage = new ArrayList<>(); - - private List entityTraits = new ArrayList<>(); - - private List entitlements = new ArrayList<>(); - - private Optional defaultPaymentMethod = Optional.empty(); - - private List billingSubscriptions = new ArrayList<>(); - - private Optional billingSubscription = Optional.empty(); - - private Optional> billingCreditBalances = Optional.empty(); - - private List addOns = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CompanyViewWithFeatureUsageResponseData other) { - addOns(other.getAddOns()); - billingCreditBalances(other.getBillingCreditBalances()); - billingSubscription(other.getBillingSubscription()); - billingSubscriptions(other.getBillingSubscriptions()); - createdAt(other.getCreatedAt()); - defaultPaymentMethod(other.getDefaultPaymentMethod()); - entitlements(other.getEntitlements()); - entityTraits(other.getEntityTraits()); - environmentId(other.getEnvironmentId()); - featureUsage(other.getFeatureUsage()); - id(other.getId()); - keys(other.getKeys()); - lastSeenAt(other.getLastSeenAt()); - logoUrl(other.getLogoUrl()); - metrics(other.getMetrics()); - name(other.getName()); - paymentMethods(other.getPaymentMethods()); - plan(other.getPlan()); - plans(other.getPlans()); - rules(other.getRules()); - traits(other.getTraits()); - updatedAt(other.getUpdatedAt()); - userCount(other.getUserCount()); - 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 UpdatedAtStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updated_at") - public UserCountStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("user_count") - public _FinalStage userCount(int userCount) { - this.userCount = userCount; - return this; - } - - /** - *

A map of trait names to trait values

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

A map of trait names to trait values

- */ - @java.lang.Override - @JsonSetter(value = "traits", nulls = Nulls.SKIP) - public _FinalStage traits(Optional> traits) { - this.traits = 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(Rule 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 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 plan(CompanyPlanWithBillingSubView 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 addAllPaymentMethods(List paymentMethods) { - if (paymentMethods != null) { - this.paymentMethods.addAll(paymentMethods); - } - return this; - } - - @java.lang.Override - public _FinalStage addPaymentMethods(PaymentMethodResponseData paymentMethods) { - this.paymentMethods.add(paymentMethods); - return this; - } - - @java.lang.Override - @JsonSetter(value = "payment_methods", nulls = Nulls.SKIP) - public _FinalStage paymentMethods(List paymentMethods) { - this.paymentMethods.clear(); - if (paymentMethods != null) { - this.paymentMethods.addAll(paymentMethods); - } - 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(CompanyEventPeriodMetricsResponseData 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 logoUrl(String logoUrl) { - this.logoUrl = Optional.ofNullable(logoUrl); - return this; - } - - @java.lang.Override - @JsonSetter(value = "logo_url", nulls = Nulls.SKIP) - public _FinalStage logoUrl(Optional logoUrl) { - this.logoUrl = logoUrl; - return this; - } - - @java.lang.Override - public _FinalStage lastSeenAt(OffsetDateTime lastSeenAt) { - this.lastSeenAt = Optional.ofNullable(lastSeenAt); - return this; - } - - @java.lang.Override - @JsonSetter(value = "last_seen_at", nulls = Nulls.SKIP) - public _FinalStage lastSeenAt(Optional lastSeenAt) { - this.lastSeenAt = lastSeenAt; - return this; - } - - @java.lang.Override - public _FinalStage addAllKeys(List keys) { - if (keys != null) { - this.keys.addAll(keys); - } - return this; - } - - @java.lang.Override - public _FinalStage addKeys(EntityKeyDetailResponseData keys) { - this.keys.add(keys); - return this; - } - - @java.lang.Override - @JsonSetter(value = "keys", nulls = Nulls.SKIP) - public _FinalStage keys(List keys) { - this.keys.clear(); - if (keys != null) { - this.keys.addAll(keys); - } - return this; - } - - @java.lang.Override - public _FinalStage addAllFeatureUsage(List featureUsage) { - if (featureUsage != null) { - this.featureUsage.addAll(featureUsage); - } - return this; - } - - @java.lang.Override - public _FinalStage addFeatureUsage(FeatureUsageDataResponseData featureUsage) { - this.featureUsage.add(featureUsage); - return this; - } - - @java.lang.Override - @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) - public _FinalStage featureUsage(List featureUsage) { - this.featureUsage.clear(); - if (featureUsage != null) { - this.featureUsage.addAll(featureUsage); - } - return this; - } - - @java.lang.Override - public _FinalStage addAllEntityTraits(List entityTraits) { - if (entityTraits != null) { - this.entityTraits.addAll(entityTraits); - } - return this; - } - - @java.lang.Override - public _FinalStage addEntityTraits(EntityTraitDetailResponseData entityTraits) { - this.entityTraits.add(entityTraits); - return this; - } - - @java.lang.Override - @JsonSetter(value = "entity_traits", nulls = Nulls.SKIP) - public _FinalStage entityTraits(List entityTraits) { - this.entityTraits.clear(); - if (entityTraits != null) { - this.entityTraits.addAll(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); - return this; - } - - @java.lang.Override - @JsonSetter(value = "default_payment_method", nulls = Nulls.SKIP) - public _FinalStage defaultPaymentMethod(Optional defaultPaymentMethod) { - this.defaultPaymentMethod = defaultPaymentMethod; - return this; - } - - @java.lang.Override - public _FinalStage addAllBillingSubscriptions(List billingSubscriptions) { - if (billingSubscriptions != null) { - this.billingSubscriptions.addAll(billingSubscriptions); - } - return this; - } - - @java.lang.Override - public _FinalStage addBillingSubscriptions(BillingSubscriptionView billingSubscriptions) { - this.billingSubscriptions.add(billingSubscriptions); - return this; - } - - @java.lang.Override - @JsonSetter(value = "billing_subscriptions", nulls = Nulls.SKIP) - public _FinalStage billingSubscriptions(List billingSubscriptions) { - this.billingSubscriptions.clear(); - if (billingSubscriptions != null) { - this.billingSubscriptions.addAll(billingSubscriptions); - } - return this; - } - - @java.lang.Override - public _FinalStage billingSubscription(BillingSubscriptionView billingSubscription) { - this.billingSubscription = Optional.ofNullable(billingSubscription); - return this; - } - - @java.lang.Override - @JsonSetter(value = "billing_subscription", nulls = Nulls.SKIP) - public _FinalStage billingSubscription(Optional billingSubscription) { - this.billingSubscription = billingSubscription; - return this; - } - - @java.lang.Override - public _FinalStage billingCreditBalances(Map billingCreditBalances) { - this.billingCreditBalances = Optional.ofNullable(billingCreditBalances); - return this; - } - - @java.lang.Override - @JsonSetter(value = "billing_credit_balances", nulls = Nulls.SKIP) - public _FinalStage billingCreditBalances(Optional> billingCreditBalances) { - this.billingCreditBalances = billingCreditBalances; - return this; - } - - @java.lang.Override - public _FinalStage addAllAddOns(List addOns) { - if (addOns != null) { - this.addOns.addAll(addOns); - } - return this; - } - - @java.lang.Override - public _FinalStage addAddOns(CompanyPlanWithBillingSubView addOns) { - this.addOns.add(addOns); - return this; - } - - @java.lang.Override - @JsonSetter(value = "add_ons", nulls = Nulls.SKIP) - public _FinalStage addOns(List addOns) { - this.addOns.clear(); - if (addOns != null) { - this.addOns.addAll(addOns); - } - return this; - } - - @java.lang.Override - public CompanyViewWithFeatureUsageResponseData build() { - return new CompanyViewWithFeatureUsageResponseData( - addOns, - billingCreditBalances, - billingSubscription, - billingSubscriptions, - createdAt, - defaultPaymentMethod, - entitlements, - entityTraits, - environmentId, - featureUsage, - id, - keys, - lastSeenAt, - logoUrl, - metrics, - name, - paymentMethods, - plan, - plans, - rules, - traits, - updatedAt, - userCount, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/CompatiblePlans.java b/src/main/java/com/schematic/api/types/CompatiblePlans.java index 72c62f3..5ea1e44 100644 --- a/src/main/java/com/schematic/api/types/CompatiblePlans.java +++ b/src/main/java/com/schematic/api/types/CompatiblePlans.java @@ -83,6 +83,10 @@ public interface SourcePlanIdStage { public interface _FinalStage { CompatiblePlans build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage compatiblePlanIds(List compatiblePlanIds); _FinalStage addCompatiblePlanIds(String compatiblePlanIds); @@ -143,5 +147,17 @@ public _FinalStage compatiblePlanIds(List compatiblePlanIds) { public CompatiblePlans build() { return new CompatiblePlans(compatiblePlanIds, sourcePlanId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CompatiblePlansResponseData.java b/src/main/java/com/schematic/api/types/CompatiblePlansResponseData.java index 6dbd2cd..a24b2e3 100644 --- a/src/main/java/com/schematic/api/types/CompatiblePlansResponseData.java +++ b/src/main/java/com/schematic/api/types/CompatiblePlansResponseData.java @@ -83,6 +83,10 @@ public interface SourcePlanIdStage { public interface _FinalStage { CompatiblePlansResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage compatiblePlanIds(List compatiblePlanIds); _FinalStage addCompatiblePlanIds(String compatiblePlanIds); @@ -143,5 +147,17 @@ public _FinalStage compatiblePlanIds(List compatiblePlanIds) { public CompatiblePlansResponseData build() { return new CompatiblePlansResponseData(compatiblePlanIds, sourcePlanId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentCapabilities.java b/src/main/java/com/schematic/api/types/ComponentCapabilities.java index d0c17fe..2db941f 100644 --- a/src/main/java/com/schematic/api/types/ComponentCapabilities.java +++ b/src/main/java/com/schematic/api/types/ComponentCapabilities.java @@ -81,6 +81,10 @@ public interface CheckoutStage { public interface _FinalStage { ComponentCapabilities build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -119,5 +123,17 @@ public _FinalStage checkout(boolean checkout) { public ComponentCapabilities build() { return new ComponentCapabilities(badgeVisibility, checkout, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java b/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java index e496fe3..adf1b65 100644 --- a/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java +++ b/src/main/java/com/schematic/api/types/ComponentCheckoutSettings.java @@ -113,6 +113,10 @@ public interface TaxCollectionEnabledStage { public interface _FinalStage { ComponentCheckoutSettings build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -177,5 +181,17 @@ public ComponentCheckoutSettings build() { return new ComponentCheckoutSettings( collectAddress, collectEmail, collectPhone, taxCollectionEnabled, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java b/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java index 304e37a..f404738 100644 --- a/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java +++ b/src/main/java/com/schematic/api/types/ComponentDisplaySettings.java @@ -24,6 +24,8 @@ public final class ComponentDisplaySettings { private final boolean showFeatureDescription; + private final boolean showHardLimit; + private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; @@ -34,12 +36,14 @@ private ComponentDisplaySettings( boolean showAsMonthlyPrices, boolean showCredits, boolean showFeatureDescription, + boolean showHardLimit, boolean showPeriodToggle, boolean showZeroPriceAsFree, Map additionalProperties) { this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showFeatureDescription = showFeatureDescription; + this.showHardLimit = showHardLimit; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; this.additionalProperties = additionalProperties; @@ -60,6 +64,11 @@ public boolean getShowFeatureDescription() { return showFeatureDescription; } + @JsonProperty("show_hard_limit") + public boolean getShowHardLimit() { + return showHardLimit; + } + @JsonProperty("show_period_toggle") public boolean getShowPeriodToggle() { return showPeriodToggle; @@ -85,6 +94,7 @@ private boolean equalTo(ComponentDisplaySettings other) { return showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showFeatureDescription == other.showFeatureDescription + && showHardLimit == other.showHardLimit && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree; } @@ -95,6 +105,7 @@ public int hashCode() { this.showAsMonthlyPrices, this.showCredits, this.showFeatureDescription, + this.showHardLimit, this.showPeriodToggle, this.showZeroPriceAsFree); } @@ -119,7 +130,11 @@ public interface ShowCreditsStage { } public interface ShowFeatureDescriptionStage { - ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); + ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription); + } + + public interface ShowHardLimitStage { + ShowPeriodToggleStage showHardLimit(boolean showHardLimit); } public interface ShowPeriodToggleStage { @@ -132,6 +147,10 @@ public interface ShowZeroPriceAsFreeStage { public interface _FinalStage { ComponentDisplaySettings build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -139,6 +158,7 @@ public static final class Builder implements ShowAsMonthlyPricesStage, ShowCreditsStage, ShowFeatureDescriptionStage, + ShowHardLimitStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, _FinalStage { @@ -148,6 +168,8 @@ public static final class Builder private boolean showFeatureDescription; + private boolean showHardLimit; + private boolean showPeriodToggle; private boolean showZeroPriceAsFree; @@ -162,6 +184,7 @@ public Builder from(ComponentDisplaySettings other) { showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showFeatureDescription(other.getShowFeatureDescription()); + showHardLimit(other.getShowHardLimit()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); return this; @@ -183,11 +206,18 @@ public ShowFeatureDescriptionStage showCredits(boolean showCredits) { @java.lang.Override @JsonSetter("show_feature_description") - public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + public ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription) { this.showFeatureDescription = showFeatureDescription; return this; } + @java.lang.Override + @JsonSetter("show_hard_limit") + public ShowPeriodToggleStage showHardLimit(boolean showHardLimit) { + this.showHardLimit = showHardLimit; + return this; + } + @java.lang.Override @JsonSetter("show_period_toggle") public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @@ -208,9 +238,22 @@ public ComponentDisplaySettings build() { showAsMonthlyPrices, showCredits, showFeatureDescription, + showHardLimit, showPeriodToggle, showZeroPriceAsFree, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java index ddf3465..49bf1d1 100644 --- a/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentHydrateResponseData.java @@ -57,6 +57,8 @@ public final class ComponentHydrateResponseData { private final Optional preventSelfServiceDowngradeUrl; + private final Optional scheduledDowngrade; + private final boolean showAsMonthlyPrices; private final boolean showCredits; @@ -93,6 +95,7 @@ private ComponentHydrateResponseData( boolean preventSelfServiceDowngrade, Optional preventSelfServiceDowngradeButtonText, Optional preventSelfServiceDowngradeUrl, + Optional scheduledDowngrade, boolean showAsMonthlyPrices, boolean showCredits, boolean showPeriodToggle, @@ -119,6 +122,7 @@ private ComponentHydrateResponseData( this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.scheduledDowngrade = scheduledDowngrade; this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showPeriodToggle = showPeriodToggle; @@ -215,6 +219,11 @@ public Optional getPreventSelfServiceDowngradeUrl() { return preventSelfServiceDowngradeUrl; } + @JsonProperty("scheduled_downgrade") + public Optional getScheduledDowngrade() { + return scheduledDowngrade; + } + @JsonProperty("show_as_monthly_prices") public boolean getShowAsMonthlyPrices() { return showAsMonthlyPrices; @@ -284,6 +293,7 @@ private boolean equalTo(ComponentHydrateResponseData other) { && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && scheduledDowngrade.equals(other.scheduledDowngrade) && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showPeriodToggle == other.showPeriodToggle @@ -314,6 +324,7 @@ public int hashCode() { this.preventSelfServiceDowngrade, this.preventSelfServiceDowngradeButtonText, this.preventSelfServiceDowngradeUrl, + this.scheduledDowngrade, this.showAsMonthlyPrices, this.showCredits, this.showPeriodToggle, @@ -366,6 +377,10 @@ public interface ShowZeroPriceAsFreeStage { public interface _FinalStage { ComponentHydrateResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage activeAddOns(List activeAddOns); _FinalStage addActiveAddOns(CompanyPlanDetailResponseData activeAddOns); @@ -435,6 +450,10 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + _FinalStage scheduledDowngrade(Optional scheduledDowngrade); + + _FinalStage scheduledDowngrade(ScheduledDowngradeResponseData scheduledDowngrade); + _FinalStage stripeEmbed(Optional stripeEmbed); _FinalStage stripeEmbed(StripeEmbedInfo stripeEmbed); @@ -484,6 +503,8 @@ public static final class Builder private Optional stripeEmbed = Optional.empty(); + private Optional scheduledDowngrade = Optional.empty(); + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); @@ -536,6 +557,7 @@ public Builder from(ComponentHydrateResponseData other) { preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + scheduledDowngrade(other.getScheduledDowngrade()); showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showPeriodToggle(other.getShowPeriodToggle()); @@ -648,6 +670,19 @@ public _FinalStage stripeEmbed(Optional stripeEmbed) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngrade(ScheduledDowngradeResponseData scheduledDowngrade) { + this.scheduledDowngrade = Optional.ofNullable(scheduledDowngrade); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngrade(Optional scheduledDowngrade) { + this.scheduledDowngrade = scheduledDowngrade; + return this; + } + @java.lang.Override public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); @@ -920,6 +955,7 @@ public ComponentHydrateResponseData build() { preventSelfServiceDowngrade, preventSelfServiceDowngradeButtonText, preventSelfServiceDowngradeUrl, + scheduledDowngrade, showAsMonthlyPrices, showCredits, showPeriodToggle, @@ -930,5 +966,17 @@ public ComponentHydrateResponseData build() { upcomingInvoice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java index 3410e3f..49e7f16 100644 --- a/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentPreviewResponseData.java @@ -59,6 +59,8 @@ public final class ComponentPreviewResponseData { private final Optional preventSelfServiceDowngradeUrl; + private final Optional scheduledDowngrade; + private final boolean showAsMonthlyPrices; private final boolean showCredits; @@ -96,6 +98,7 @@ private ComponentPreviewResponseData( boolean preventSelfServiceDowngrade, Optional preventSelfServiceDowngradeButtonText, Optional preventSelfServiceDowngradeUrl, + Optional scheduledDowngrade, boolean showAsMonthlyPrices, boolean showCredits, boolean showPeriodToggle, @@ -123,6 +126,7 @@ private ComponentPreviewResponseData( this.preventSelfServiceDowngrade = preventSelfServiceDowngrade; this.preventSelfServiceDowngradeButtonText = preventSelfServiceDowngradeButtonText; this.preventSelfServiceDowngradeUrl = preventSelfServiceDowngradeUrl; + this.scheduledDowngrade = scheduledDowngrade; this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showPeriodToggle = showPeriodToggle; @@ -224,6 +228,11 @@ public Optional getPreventSelfServiceDowngradeUrl() { return preventSelfServiceDowngradeUrl; } + @JsonProperty("scheduled_downgrade") + public Optional getScheduledDowngrade() { + return scheduledDowngrade; + } + @JsonProperty("show_as_monthly_prices") public boolean getShowAsMonthlyPrices() { return showAsMonthlyPrices; @@ -294,6 +303,7 @@ private boolean equalTo(ComponentPreviewResponseData other) { && preventSelfServiceDowngrade == other.preventSelfServiceDowngrade && preventSelfServiceDowngradeButtonText.equals(other.preventSelfServiceDowngradeButtonText) && preventSelfServiceDowngradeUrl.equals(other.preventSelfServiceDowngradeUrl) + && scheduledDowngrade.equals(other.scheduledDowngrade) && showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showPeriodToggle == other.showPeriodToggle @@ -325,6 +335,7 @@ public int hashCode() { this.preventSelfServiceDowngrade, this.preventSelfServiceDowngradeButtonText, this.preventSelfServiceDowngradeUrl, + this.scheduledDowngrade, this.showAsMonthlyPrices, this.showCredits, this.showPeriodToggle, @@ -377,6 +388,10 @@ public interface ShowZeroPriceAsFreeStage { public interface _FinalStage { ComponentPreviewResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage activeAddOns(List activeAddOns); _FinalStage addActiveAddOns(CompanyPlanDetailResponseData activeAddOns); @@ -452,6 +467,10 @@ _FinalStage addAllActiveUsageBasedEntitlements( _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl); + _FinalStage scheduledDowngrade(Optional scheduledDowngrade); + + _FinalStage scheduledDowngrade(ScheduledDowngradeResponseData scheduledDowngrade); + _FinalStage stripeEmbed(Optional stripeEmbed); _FinalStage stripeEmbed(StripeEmbedInfo stripeEmbed); @@ -501,6 +520,8 @@ public static final class Builder private Optional stripeEmbed = Optional.empty(); + private Optional scheduledDowngrade = Optional.empty(); + private Optional preventSelfServiceDowngradeUrl = Optional.empty(); private Optional preventSelfServiceDowngradeButtonText = Optional.empty(); @@ -556,6 +577,7 @@ public Builder from(ComponentPreviewResponseData other) { preventSelfServiceDowngrade(other.getPreventSelfServiceDowngrade()); preventSelfServiceDowngradeButtonText(other.getPreventSelfServiceDowngradeButtonText()); preventSelfServiceDowngradeUrl(other.getPreventSelfServiceDowngradeUrl()); + scheduledDowngrade(other.getScheduledDowngrade()); showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showPeriodToggle(other.getShowPeriodToggle()); @@ -668,6 +690,19 @@ public _FinalStage stripeEmbed(Optional stripeEmbed) { return this; } + @java.lang.Override + public _FinalStage scheduledDowngrade(ScheduledDowngradeResponseData scheduledDowngrade) { + this.scheduledDowngrade = Optional.ofNullable(scheduledDowngrade); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_downgrade", nulls = Nulls.SKIP) + public _FinalStage scheduledDowngrade(Optional scheduledDowngrade) { + this.scheduledDowngrade = scheduledDowngrade; + return this; + } + @java.lang.Override public _FinalStage preventSelfServiceDowngradeUrl(String preventSelfServiceDowngradeUrl) { this.preventSelfServiceDowngradeUrl = Optional.ofNullable(preventSelfServiceDowngradeUrl); @@ -965,6 +1000,7 @@ public ComponentPreviewResponseData build() { preventSelfServiceDowngrade, preventSelfServiceDowngradeButtonText, preventSelfServiceDowngradeUrl, + scheduledDowngrade, showAsMonthlyPrices, showCredits, showPeriodToggle, @@ -975,5 +1011,17 @@ public ComponentPreviewResponseData build() { upcomingInvoice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentResponseData.java b/src/main/java/com/schematic/api/types/ComponentResponseData.java index dfa7fde..1582ded 100644 --- a/src/main/java/com/schematic/api/types/ComponentResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentResponseData.java @@ -156,6 +156,10 @@ public interface UpdatedAtStage { public interface _FinalStage { ComponentResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage ast(Optional> ast); _FinalStage ast(Map ast); @@ -254,5 +258,17 @@ public _FinalStage ast(Optional> ast) { public ComponentResponseData build() { return new ComponentResponseData(ast, createdAt, id, name, state, type, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java b/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java index 974d511..0a334a9 100644 --- a/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java +++ b/src/main/java/com/schematic/api/types/ComponentSettingsResponseData.java @@ -24,6 +24,8 @@ public final class ComponentSettingsResponseData { private final boolean showFeatureDescription; + private final boolean showHardLimit; + private final boolean showPeriodToggle; private final boolean showZeroPriceAsFree; @@ -34,12 +36,14 @@ private ComponentSettingsResponseData( boolean showAsMonthlyPrices, boolean showCredits, boolean showFeatureDescription, + boolean showHardLimit, boolean showPeriodToggle, boolean showZeroPriceAsFree, Map additionalProperties) { this.showAsMonthlyPrices = showAsMonthlyPrices; this.showCredits = showCredits; this.showFeatureDescription = showFeatureDescription; + this.showHardLimit = showHardLimit; this.showPeriodToggle = showPeriodToggle; this.showZeroPriceAsFree = showZeroPriceAsFree; this.additionalProperties = additionalProperties; @@ -60,6 +64,11 @@ public boolean getShowFeatureDescription() { return showFeatureDescription; } + @JsonProperty("show_hard_limit") + public boolean getShowHardLimit() { + return showHardLimit; + } + @JsonProperty("show_period_toggle") public boolean getShowPeriodToggle() { return showPeriodToggle; @@ -85,6 +94,7 @@ private boolean equalTo(ComponentSettingsResponseData other) { return showAsMonthlyPrices == other.showAsMonthlyPrices && showCredits == other.showCredits && showFeatureDescription == other.showFeatureDescription + && showHardLimit == other.showHardLimit && showPeriodToggle == other.showPeriodToggle && showZeroPriceAsFree == other.showZeroPriceAsFree; } @@ -95,6 +105,7 @@ public int hashCode() { this.showAsMonthlyPrices, this.showCredits, this.showFeatureDescription, + this.showHardLimit, this.showPeriodToggle, this.showZeroPriceAsFree); } @@ -119,7 +130,11 @@ public interface ShowCreditsStage { } public interface ShowFeatureDescriptionStage { - ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription); + ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription); + } + + public interface ShowHardLimitStage { + ShowPeriodToggleStage showHardLimit(boolean showHardLimit); } public interface ShowPeriodToggleStage { @@ -132,6 +147,10 @@ public interface ShowZeroPriceAsFreeStage { public interface _FinalStage { ComponentSettingsResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -139,6 +158,7 @@ public static final class Builder implements ShowAsMonthlyPricesStage, ShowCreditsStage, ShowFeatureDescriptionStage, + ShowHardLimitStage, ShowPeriodToggleStage, ShowZeroPriceAsFreeStage, _FinalStage { @@ -148,6 +168,8 @@ public static final class Builder private boolean showFeatureDescription; + private boolean showHardLimit; + private boolean showPeriodToggle; private boolean showZeroPriceAsFree; @@ -162,6 +184,7 @@ public Builder from(ComponentSettingsResponseData other) { showAsMonthlyPrices(other.getShowAsMonthlyPrices()); showCredits(other.getShowCredits()); showFeatureDescription(other.getShowFeatureDescription()); + showHardLimit(other.getShowHardLimit()); showPeriodToggle(other.getShowPeriodToggle()); showZeroPriceAsFree(other.getShowZeroPriceAsFree()); return this; @@ -183,11 +206,18 @@ public ShowFeatureDescriptionStage showCredits(boolean showCredits) { @java.lang.Override @JsonSetter("show_feature_description") - public ShowPeriodToggleStage showFeatureDescription(boolean showFeatureDescription) { + public ShowHardLimitStage showFeatureDescription(boolean showFeatureDescription) { this.showFeatureDescription = showFeatureDescription; return this; } + @java.lang.Override + @JsonSetter("show_hard_limit") + public ShowPeriodToggleStage showHardLimit(boolean showHardLimit) { + this.showHardLimit = showHardLimit; + return this; + } + @java.lang.Override @JsonSetter("show_period_toggle") public ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle) { @@ -208,9 +238,22 @@ public ComponentSettingsResponseData build() { showAsMonthlyPrices, showCredits, showFeatureDescription, + showHardLimit, showPeriodToggle, showZeroPriceAsFree, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/Condition.java b/src/main/java/com/schematic/api/types/Condition.java index fc54d2c..9939dfb 100644 --- a/src/main/java/com/schematic/api/types/Condition.java +++ b/src/main/java/com/schematic/api/types/Condition.java @@ -43,7 +43,7 @@ public final class Condition { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final ConditionOperator operator; @@ -66,7 +66,7 @@ private Condition( String id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, ConditionOperator operator, List resourceIds, Optional traitDefinition, @@ -141,7 +141,7 @@ public Optional getMetricPeriodMonthReset() { } @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -252,6 +252,10 @@ public interface TraitValueStage { public interface _FinalStage { Condition build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage comparisonTraitDefinition(Optional comparisonTraitDefinition); _FinalStage comparisonTraitDefinition(TraitDefinition comparisonTraitDefinition); @@ -276,9 +280,9 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(ConditionMetricPeriodMonthReset metricPeriodMonthReset); - _FinalStage metricValue(Optional metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Long metricValue); _FinalStage resourceIds(List resourceIds); @@ -316,7 +320,7 @@ public static final class Builder private List resourceIds = new ArrayList<>(); - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -435,14 +439,14 @@ public _FinalStage resourceIds(List resourceIds) { } @java.lang.Override - public _FinalStage metricValue(Integer metricValue) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -545,5 +549,17 @@ public Condition build() { traitValue, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ConditionGroup.java b/src/main/java/com/schematic/api/types/ConditionGroup.java index 97293f2..261ebed 100644 --- a/src/main/java/com/schematic/api/types/ConditionGroup.java +++ b/src/main/java/com/schematic/api/types/ConditionGroup.java @@ -102,5 +102,15 @@ public Builder addAllConditions(List conditions) { public ConditionGroup build() { return new ConditionGroup(conditions, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ConditionGroupResponseData.java b/src/main/java/com/schematic/api/types/ConditionGroupResponseData.java index b7f700d..e03a7bd 100644 --- a/src/main/java/com/schematic/api/types/ConditionGroupResponseData.java +++ b/src/main/java/com/schematic/api/types/ConditionGroupResponseData.java @@ -32,8 +32,6 @@ public final class ConditionGroupResponseData { private final String id; - private final Optional planVersionId; - private final String ruleId; private final OffsetDateTime updatedAt; @@ -46,7 +44,6 @@ private ConditionGroupResponseData( String environmentId, Optional flagId, String id, - Optional planVersionId, String ruleId, OffsetDateTime updatedAt, Map additionalProperties) { @@ -55,7 +52,6 @@ private ConditionGroupResponseData( this.environmentId = environmentId; this.flagId = flagId; this.id = id; - this.planVersionId = planVersionId; this.ruleId = ruleId; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -86,11 +82,6 @@ public String getId() { return id; } - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - @JsonProperty("rule_id") public String getRuleId() { return ruleId; @@ -118,7 +109,6 @@ private boolean equalTo(ConditionGroupResponseData other) { && environmentId.equals(other.environmentId) && flagId.equals(other.flagId) && id.equals(other.id) - && planVersionId.equals(other.planVersionId) && ruleId.equals(other.ruleId) && updatedAt.equals(other.updatedAt); } @@ -126,14 +116,7 @@ private boolean equalTo(ConditionGroupResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.accountId, - this.createdAt, - this.environmentId, - this.flagId, - this.id, - this.planVersionId, - this.ruleId, - this.updatedAt); + this.accountId, this.createdAt, this.environmentId, this.flagId, this.id, this.ruleId, this.updatedAt); } @java.lang.Override @@ -174,13 +157,13 @@ public interface UpdatedAtStage { public interface _FinalStage { ConditionGroupResponseData build(); - _FinalStage flagId(Optional flagId); + _FinalStage additionalProperty(String key, Object value); - _FinalStage flagId(String flagId); + _FinalStage additionalProperties(Map additionalProperties); - _FinalStage planVersionId(Optional planVersionId); + _FinalStage flagId(Optional flagId); - _FinalStage planVersionId(String planVersionId); + _FinalStage flagId(String flagId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -204,8 +187,6 @@ public static final class Builder private OffsetDateTime updatedAt; - private Optional planVersionId = Optional.empty(); - private Optional flagId = Optional.empty(); @JsonAnySetter @@ -220,7 +201,6 @@ public Builder from(ConditionGroupResponseData other) { environmentId(other.getEnvironmentId()); flagId(other.getFlagId()); id(other.getId()); - planVersionId(other.getPlanVersionId()); ruleId(other.getRuleId()); updatedAt(other.getUpdatedAt()); return this; @@ -268,19 +248,6 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { 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); @@ -297,15 +264,19 @@ public _FinalStage flagId(Optional flagId) { @java.lang.Override public ConditionGroupResponseData build() { return new ConditionGroupResponseData( - accountId, - createdAt, - environmentId, - flagId, - id, - planVersionId, - ruleId, - updatedAt, - additionalProperties); + accountId, createdAt, environmentId, flagId, id, ruleId, updatedAt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/types/ConditionGroupView.java b/src/main/java/com/schematic/api/types/ConditionGroupView.java index 81f60c1..64de245 100644 --- a/src/main/java/com/schematic/api/types/ConditionGroupView.java +++ b/src/main/java/com/schematic/api/types/ConditionGroupView.java @@ -36,8 +36,6 @@ public final class ConditionGroupView { private final String id; - private final Optional planVersionId; - private final String ruleId; private final OffsetDateTime updatedAt; @@ -51,7 +49,6 @@ private ConditionGroupView( String environmentId, Optional flagId, String id, - Optional planVersionId, String ruleId, OffsetDateTime updatedAt, Map additionalProperties) { @@ -61,7 +58,6 @@ private ConditionGroupView( this.environmentId = environmentId; this.flagId = flagId; this.id = id; - this.planVersionId = planVersionId; this.ruleId = ruleId; this.updatedAt = updatedAt; this.additionalProperties = additionalProperties; @@ -97,11 +93,6 @@ public String getId() { return id; } - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - @JsonProperty("rule_id") public String getRuleId() { return ruleId; @@ -130,7 +121,6 @@ private boolean equalTo(ConditionGroupView other) { && environmentId.equals(other.environmentId) && flagId.equals(other.flagId) && id.equals(other.id) - && planVersionId.equals(other.planVersionId) && ruleId.equals(other.ruleId) && updatedAt.equals(other.updatedAt); } @@ -144,7 +134,6 @@ public int hashCode() { this.environmentId, this.flagId, this.id, - this.planVersionId, this.ruleId, this.updatedAt); } @@ -187,6 +176,10 @@ public interface UpdatedAtStage { public interface _FinalStage { ConditionGroupView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditions(List conditions); _FinalStage addConditions(ConditionView conditions); @@ -196,10 +189,6 @@ public interface _FinalStage { _FinalStage flagId(Optional flagId); _FinalStage flagId(String flagId); - - _FinalStage planVersionId(Optional planVersionId); - - _FinalStage planVersionId(String planVersionId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -223,8 +212,6 @@ public static final class Builder private OffsetDateTime updatedAt; - private Optional planVersionId = Optional.empty(); - private Optional flagId = Optional.empty(); private List conditions = new ArrayList<>(); @@ -242,7 +229,6 @@ public Builder from(ConditionGroupView other) { environmentId(other.getEnvironmentId()); flagId(other.getFlagId()); id(other.getId()); - planVersionId(other.getPlanVersionId()); ruleId(other.getRuleId()); updatedAt(other.getUpdatedAt()); return this; @@ -290,19 +276,6 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { 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); @@ -349,10 +322,21 @@ public ConditionGroupView build() { environmentId, flagId, id, - planVersionId, ruleId, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ConditionResponseData.java b/src/main/java/com/schematic/api/types/ConditionResponseData.java index adc231c..c99e460 100644 --- a/src/main/java/com/schematic/api/types/ConditionResponseData.java +++ b/src/main/java/com/schematic/api/types/ConditionResponseData.java @@ -50,12 +50,10 @@ public final class ConditionResponseData { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final String operator; - private final Optional planVersionId; - private final List resourceUnspecifiedIds; private final String ruleId; @@ -70,7 +68,7 @@ public final class ConditionResponseData { private final Optional traitValueDate; - private final int traitValueInt; + private final long traitValueInt; private final OffsetDateTime updatedAt; @@ -90,9 +88,8 @@ private ConditionResponseData( String id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, String operator, - Optional planVersionId, List resourceUnspecifiedIds, String ruleId, Optional traitEntityType, @@ -100,7 +97,7 @@ private ConditionResponseData( String traitValue, boolean traitValueBool, Optional traitValueDate, - int traitValueInt, + long traitValueInt, OffsetDateTime updatedAt, Map additionalProperties) { this.accountId = accountId; @@ -118,7 +115,6 @@ private ConditionResponseData( this.metricPeriodMonthReset = metricPeriodMonthReset; this.metricValue = metricValue; this.operator = operator; - this.planVersionId = planVersionId; this.resourceUnspecifiedIds = resourceUnspecifiedIds; this.ruleId = ruleId; this.traitEntityType = traitEntityType; @@ -197,7 +193,7 @@ public Optional getMetricPeriodMonthReset() { } @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -206,11 +202,6 @@ public String getOperator() { return operator; } - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - @JsonProperty("resource_unspecified_ids") public List getResourceUnspecifiedIds() { return resourceUnspecifiedIds; @@ -247,7 +238,7 @@ public Optional getTraitValueDate() { } @JsonProperty("trait_value_int") - public int getTraitValueInt() { + public long getTraitValueInt() { return traitValueInt; } @@ -283,7 +274,6 @@ private boolean equalTo(ConditionResponseData other) { && 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) @@ -313,7 +303,6 @@ public int hashCode() { this.metricPeriodMonthReset, this.metricValue, this.operator, - this.planVersionId, this.resourceUnspecifiedIds, this.ruleId, this.traitEntityType, @@ -373,7 +362,7 @@ public interface TraitValueBoolStage { } public interface TraitValueIntStage { - UpdatedAtStage traitValueInt(int traitValueInt); + UpdatedAtStage traitValueInt(long traitValueInt); } public interface UpdatedAtStage { @@ -383,6 +372,10 @@ public interface UpdatedAtStage { public interface _FinalStage { ConditionResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage comparisonTraitId(Optional comparisonTraitId); _FinalStage comparisonTraitId(String comparisonTraitId); @@ -415,13 +408,9 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); - _FinalStage metricValue(Optional metricValue); - - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage planVersionId(Optional planVersionId); - - _FinalStage planVersionId(String planVersionId); + _FinalStage metricValue(Long metricValue); _FinalStage resourceUnspecifiedIds(List resourceUnspecifiedIds); @@ -474,7 +463,7 @@ public static final class Builder private boolean traitValueBool; - private int traitValueInt; + private long traitValueInt; private OffsetDateTime updatedAt; @@ -486,9 +475,7 @@ public static final class Builder private List resourceUnspecifiedIds = new ArrayList<>(); - private Optional planVersionId = Optional.empty(); - - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -528,7 +515,6 @@ public Builder from(ConditionResponseData other) { metricPeriodMonthReset(other.getMetricPeriodMonthReset()); metricValue(other.getMetricValue()); operator(other.getOperator()); - planVersionId(other.getPlanVersionId()); resourceUnspecifiedIds(other.getResourceUnspecifiedIds()); ruleId(other.getRuleId()); traitEntityType(other.getTraitEntityType()); @@ -606,7 +592,7 @@ public TraitValueIntStage traitValueBool(boolean traitValueBool) { @java.lang.Override @JsonSetter("trait_value_int") - public UpdatedAtStage traitValueInt(int traitValueInt) { + public UpdatedAtStage traitValueInt(long traitValueInt) { this.traitValueInt = traitValueInt; return this; } @@ -682,27 +668,14 @@ public _FinalStage resourceUnspecifiedIds(List resourceUnspecifiedIds) { } @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) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -829,7 +802,6 @@ public ConditionResponseData build() { metricPeriodMonthReset, metricValue, operator, - planVersionId, resourceUnspecifiedIds, ruleId, traitEntityType, @@ -841,5 +813,17 @@ public ConditionResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ConditionView.java b/src/main/java/com/schematic/api/types/ConditionView.java index d7d069f..838f319 100644 --- a/src/main/java/com/schematic/api/types/ConditionView.java +++ b/src/main/java/com/schematic/api/types/ConditionView.java @@ -56,12 +56,10 @@ public final class ConditionView { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final String operator; - private final Optional planVersionId; - private final List planVersions; private final List plans; @@ -82,7 +80,7 @@ public final class ConditionView { private final Optional traitValueDate; - private final int traitValueInt; + private final long traitValueInt; private final OffsetDateTime updatedAt; @@ -107,9 +105,8 @@ private ConditionView( String id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, String operator, - Optional planVersionId, List planVersions, List plans, List resourceUnspecifiedIds, @@ -120,7 +117,7 @@ private ConditionView( String traitValue, boolean traitValueBool, Optional traitValueDate, - int traitValueInt, + long traitValueInt, OffsetDateTime updatedAt, List users, Map additionalProperties) { @@ -142,7 +139,6 @@ private ConditionView( this.metricPeriodMonthReset = metricPeriodMonthReset; this.metricValue = metricValue; this.operator = operator; - this.planVersionId = planVersionId; this.planVersions = planVersions; this.plans = plans; this.resourceUnspecifiedIds = resourceUnspecifiedIds; @@ -240,7 +236,7 @@ public Optional getMetricPeriodMonthReset() { } @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -249,11 +245,6 @@ public String getOperator() { return operator; } - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - @JsonProperty("plan_versions") public List getPlanVersions() { return planVersions; @@ -305,7 +296,7 @@ public Optional getTraitValueDate() { } @JsonProperty("trait_value_int") - public int getTraitValueInt() { + public long getTraitValueInt() { return traitValueInt; } @@ -349,7 +340,6 @@ private boolean equalTo(ConditionView other) { && 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) @@ -386,7 +376,6 @@ public int hashCode() { this.metricPeriodMonthReset, this.metricValue, this.operator, - this.planVersionId, this.planVersions, this.plans, this.resourceUnspecifiedIds, @@ -450,7 +439,7 @@ public interface TraitValueBoolStage { } public interface TraitValueIntStage { - UpdatedAtStage traitValueInt(int traitValueInt); + UpdatedAtStage traitValueInt(long traitValueInt); } public interface UpdatedAtStage { @@ -460,6 +449,10 @@ public interface UpdatedAtStage { public interface _FinalStage { ConditionView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingProducts(List billingProducts); _FinalStage addBillingProducts(GenericPreviewObject billingProducts); @@ -508,13 +501,9 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); - _FinalStage metricValue(Optional metricValue); - - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage planVersionId(Optional planVersionId); - - _FinalStage planVersionId(String planVersionId); + _FinalStage metricValue(Long metricValue); _FinalStage planVersions(List planVersions); @@ -589,7 +578,7 @@ public static final class Builder private boolean traitValueBool; - private int traitValueInt; + private long traitValueInt; private OffsetDateTime updatedAt; @@ -609,9 +598,7 @@ public static final class Builder private List planVersions = new ArrayList<>(); - private Optional planVersionId = Optional.empty(); - - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -660,7 +647,6 @@ public Builder from(ConditionView other) { metricPeriodMonthReset(other.getMetricPeriodMonthReset()); metricValue(other.getMetricValue()); operator(other.getOperator()); - planVersionId(other.getPlanVersionId()); planVersions(other.getPlanVersions()); plans(other.getPlans()); resourceUnspecifiedIds(other.getResourceUnspecifiedIds()); @@ -742,7 +728,7 @@ public TraitValueIntStage traitValueBool(boolean traitValueBool) { @java.lang.Override @JsonSetter("trait_value_int") - public UpdatedAtStage traitValueInt(int traitValueInt) { + public UpdatedAtStage traitValueInt(long traitValueInt) { this.traitValueInt = traitValueInt; return this; } @@ -903,27 +889,14 @@ public _FinalStage planVersions(List planVersions) { } @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) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -1114,7 +1087,6 @@ public ConditionView build() { metricPeriodMonthReset, metricValue, operator, - planVersionId, planVersions, plans, resourceUnspecifiedIds, @@ -1130,5 +1102,17 @@ public ConditionView build() { users, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CountResponse.java b/src/main/java/com/schematic/api/types/CountResponse.java index 38df719..84b2f19 100644 --- a/src/main/java/com/schematic/api/types/CountResponse.java +++ b/src/main/java/com/schematic/api/types/CountResponse.java @@ -97,5 +97,15 @@ public Builder count(Integer count) { public CountResponse build() { return new CountResponse(count, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CouponRequestBody.java b/src/main/java/com/schematic/api/types/CouponRequestBody.java index 58598e6..8138117 100644 --- a/src/main/java/com/schematic/api/types/CouponRequestBody.java +++ b/src/main/java/com/schematic/api/types/CouponRequestBody.java @@ -21,33 +21,33 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CouponRequestBody.Builder.class) public final class CouponRequestBody { - private final int amountOff; + private final long amountOff; private final Optional currency; private final String duration; - private final int durationInMonths; + private final long durationInMonths; - private final int maxRedemptions; + private final long maxRedemptions; private final String name; private final double percentOff; - private final int timesRedeemed; + private final long timesRedeemed; private final Map additionalProperties; private CouponRequestBody( - int amountOff, + long amountOff, Optional currency, String duration, - int durationInMonths, - int maxRedemptions, + long durationInMonths, + long maxRedemptions, String name, double percentOff, - int timesRedeemed, + long timesRedeemed, Map additionalProperties) { this.amountOff = amountOff; this.currency = currency; @@ -61,7 +61,7 @@ private CouponRequestBody( } @JsonProperty("amount_off") - public int getAmountOff() { + public long getAmountOff() { return amountOff; } @@ -76,12 +76,12 @@ public String getDuration() { } @JsonProperty("duration_in_months") - public int getDurationInMonths() { + public long getDurationInMonths() { return durationInMonths; } @JsonProperty("max_redemptions") - public int getMaxRedemptions() { + public long getMaxRedemptions() { return maxRedemptions; } @@ -96,7 +96,7 @@ public double getPercentOff() { } @JsonProperty("times_redeemed") - public int getTimesRedeemed() { + public long getTimesRedeemed() { return timesRedeemed; } @@ -145,7 +145,7 @@ public static AmountOffStage builder() { } public interface AmountOffStage { - DurationStage amountOff(int amountOff); + DurationStage amountOff(long amountOff); Builder from(CouponRequestBody other); } @@ -155,11 +155,11 @@ public interface DurationStage { } public interface DurationInMonthsStage { - MaxRedemptionsStage durationInMonths(int durationInMonths); + MaxRedemptionsStage durationInMonths(long durationInMonths); } public interface MaxRedemptionsStage { - NameStage maxRedemptions(int maxRedemptions); + NameStage maxRedemptions(long maxRedemptions); } public interface NameStage { @@ -171,12 +171,16 @@ public interface PercentOffStage { } public interface TimesRedeemedStage { - _FinalStage timesRedeemed(int timesRedeemed); + _FinalStage timesRedeemed(long timesRedeemed); } public interface _FinalStage { CouponRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage currency(Optional currency); _FinalStage currency(String currency); @@ -192,19 +196,19 @@ public static final class Builder PercentOffStage, TimesRedeemedStage, _FinalStage { - private int amountOff; + private long amountOff; private String duration; - private int durationInMonths; + private long durationInMonths; - private int maxRedemptions; + private long maxRedemptions; private String name; private double percentOff; - private int timesRedeemed; + private long timesRedeemed; private Optional currency = Optional.empty(); @@ -228,7 +232,7 @@ public Builder from(CouponRequestBody other) { @java.lang.Override @JsonSetter("amount_off") - public DurationStage amountOff(int amountOff) { + public DurationStage amountOff(long amountOff) { this.amountOff = amountOff; return this; } @@ -242,14 +246,14 @@ public DurationInMonthsStage duration(@NotNull String duration) { @java.lang.Override @JsonSetter("duration_in_months") - public MaxRedemptionsStage durationInMonths(int durationInMonths) { + public MaxRedemptionsStage durationInMonths(long durationInMonths) { this.durationInMonths = durationInMonths; return this; } @java.lang.Override @JsonSetter("max_redemptions") - public NameStage maxRedemptions(int maxRedemptions) { + public NameStage maxRedemptions(long maxRedemptions) { this.maxRedemptions = maxRedemptions; return this; } @@ -270,7 +274,7 @@ public TimesRedeemedStage percentOff(double percentOff) { @java.lang.Override @JsonSetter("times_redeemed") - public _FinalStage timesRedeemed(int timesRedeemed) { + public _FinalStage timesRedeemed(long timesRedeemed) { this.timesRedeemed = timesRedeemed; return this; } @@ -301,5 +305,17 @@ public CouponRequestBody build() { timesRedeemed, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java index 776995a..92deca8 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPlanCreditGrantRequestBody.java @@ -23,7 +23,7 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional applyToExisting; - private final Optional autoTopupAmount; + private final Optional autoTopupAmount; private final Optional autoTopupAmountType; @@ -33,11 +33,11 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional autoTopupExpiryUnit; - private final Optional autoTopupExpiryUnitCount; + private final Optional autoTopupExpiryUnitCount; - private final Optional autoTopupThresholdPercent; + private final Optional autoTopupThresholdPercent; - private final int creditAmount; + private final long creditAmount; private final String creditId; @@ -45,10 +45,12 @@ public final class CreateBillingPlanCreditGrantRequestBody { private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final String planId; + private final Optional planVersionId; + private final BillingPlanCreditGrantResetCadence resetCadence; private final BillingPlanCreditGrantResetStart resetStart; @@ -59,19 +61,20 @@ public final class CreateBillingPlanCreditGrantRequestBody { private CreateBillingPlanCreditGrantRequestBody( Optional applyToExisting, - Optional autoTopupAmount, + Optional autoTopupAmount, Optional autoTopupAmountType, Optional autoTopupEnabled, Optional autoTopupExpiryType, Optional autoTopupExpiryUnit, - Optional autoTopupExpiryUnitCount, - Optional autoTopupThresholdPercent, - int creditAmount, + Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdPercent, + long creditAmount, String creditId, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, String planId, + Optional planVersionId, BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, @@ -90,6 +93,7 @@ private CreateBillingPlanCreditGrantRequestBody( this.expiryUnit = expiryUnit; this.expiryUnitCount = expiryUnitCount; this.planId = planId; + this.planVersionId = planVersionId; this.resetCadence = resetCadence; this.resetStart = resetStart; this.resetType = resetType; @@ -102,7 +106,7 @@ public Optional getApplyToExisting() { } @JsonProperty("auto_topup_amount") - public Optional getAutoTopupAmount() { + public Optional getAutoTopupAmount() { return autoTopupAmount; } @@ -127,17 +131,17 @@ public Optional getAutoTopupExpiryUnit() { } @JsonProperty("auto_topup_expiry_unit_count") - public Optional getAutoTopupExpiryUnitCount() { + public Optional getAutoTopupExpiryUnitCount() { return autoTopupExpiryUnitCount; } @JsonProperty("auto_topup_threshold_percent") - public Optional getAutoTopupThresholdPercent() { + public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; } @JsonProperty("credit_amount") - public int getCreditAmount() { + public long getCreditAmount() { return creditAmount; } @@ -157,7 +161,7 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -166,6 +170,11 @@ public String getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("reset_cadence") public BillingPlanCreditGrantResetCadence getResetCadence() { return resetCadence; @@ -208,6 +217,7 @@ private boolean equalTo(CreateBillingPlanCreditGrantRequestBody other) { && expiryUnit.equals(other.expiryUnit) && expiryUnitCount.equals(other.expiryUnitCount) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) && resetType.equals(other.resetType); @@ -230,6 +240,7 @@ public int hashCode() { this.expiryUnit, this.expiryUnitCount, this.planId, + this.planVersionId, this.resetCadence, this.resetStart, this.resetType); @@ -245,7 +256,7 @@ public static CreditAmountStage builder() { } public interface CreditAmountStage { - CreditIdStage creditAmount(int creditAmount); + CreditIdStage creditAmount(long creditAmount); Builder from(CreateBillingPlanCreditGrantRequestBody other); } @@ -269,13 +280,17 @@ public interface ResetStartStage { public interface _FinalStage { CreateBillingPlanCreditGrantRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage applyToExisting(Optional applyToExisting); _FinalStage applyToExisting(Boolean applyToExisting); - _FinalStage autoTopupAmount(Optional autoTopupAmount); + _FinalStage autoTopupAmount(Optional autoTopupAmount); - _FinalStage autoTopupAmount(Integer autoTopupAmount); + _FinalStage autoTopupAmount(Long autoTopupAmount); _FinalStage autoTopupAmountType(Optional autoTopupAmountType); @@ -293,13 +308,13 @@ public interface _FinalStage { _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit); - _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); - _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount); + _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount); - _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); - _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent); + _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); _FinalStage expiryType(Optional expiryType); @@ -309,9 +324,13 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Long expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); _FinalStage resetType(Optional resetType); @@ -321,7 +340,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements CreditAmountStage, CreditIdStage, PlanIdStage, ResetCadenceStage, ResetStartStage, _FinalStage { - private int creditAmount; + private long creditAmount; private String creditId; @@ -333,15 +352,17 @@ public static final class Builder private Optional resetType = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional planVersionId = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); private Optional expiryType = Optional.empty(); - private Optional autoTopupThresholdPercent = Optional.empty(); + private Optional autoTopupThresholdPercent = Optional.empty(); - private Optional autoTopupExpiryUnitCount = Optional.empty(); + private Optional autoTopupExpiryUnitCount = Optional.empty(); private Optional autoTopupExpiryUnit = Optional.empty(); @@ -351,7 +372,7 @@ public static final class Builder private Optional autoTopupAmountType = Optional.empty(); - private Optional autoTopupAmount = Optional.empty(); + private Optional autoTopupAmount = Optional.empty(); private Optional applyToExisting = Optional.empty(); @@ -376,6 +397,7 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { expiryUnit(other.getExpiryUnit()); expiryUnitCount(other.getExpiryUnitCount()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); resetType(other.getResetType()); @@ -384,7 +406,7 @@ public Builder from(CreateBillingPlanCreditGrantRequestBody other) { @java.lang.Override @JsonSetter("credit_amount") - public CreditIdStage creditAmount(int creditAmount) { + public CreditIdStage creditAmount(long creditAmount) { this.creditAmount = creditAmount; return this; } @@ -431,14 +453,27 @@ public _FinalStage resetType(Optional resetType } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + 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 expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -470,27 +505,27 @@ public _FinalStage expiryType(Optional expiryType) { } @java.lang.Override - public _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent) { + public _FinalStage autoTopupThresholdPercent(Long 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) { + public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent) { this.autoTopupThresholdPercent = autoTopupThresholdPercent; return this; } @java.lang.Override - public _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount) { + public _FinalStage autoTopupExpiryUnitCount(Long 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) { + public _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount) { this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; return this; } @@ -548,14 +583,14 @@ public _FinalStage autoTopupAmountType(Optional autoTopupAmountType) { } @java.lang.Override - public _FinalStage autoTopupAmount(Integer autoTopupAmount) { + public _FinalStage autoTopupAmount(Long autoTopupAmount) { this.autoTopupAmount = Optional.ofNullable(autoTopupAmount); return this; } @java.lang.Override @JsonSetter(value = "auto_topup_amount", nulls = Nulls.SKIP) - public _FinalStage autoTopupAmount(Optional autoTopupAmount) { + public _FinalStage autoTopupAmount(Optional autoTopupAmount) { this.autoTopupAmount = autoTopupAmount; return this; } @@ -590,10 +625,23 @@ public CreateBillingPlanCreditGrantRequestBody build() { expiryUnit, expiryUnitCount, planId, + planVersionId, resetCadence, resetStart, resetType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java b/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java index 5bafe8c..188dc37 100644 --- a/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateBillingPriceTierRequestBody.java @@ -21,27 +21,27 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreateBillingPriceTierRequestBody.Builder.class) public final class CreateBillingPriceTierRequestBody { - private final Optional flatAmount; + private final Optional flatAmount; private final Optional perUnitDecimal; - private final Optional perUnitPrice; + private final Optional perUnitPrice; private final String priceExternalId; private final Optional providerType; - private final Optional upTo; + private final Optional upTo; private final Map additionalProperties; private CreateBillingPriceTierRequestBody( - Optional flatAmount, + Optional flatAmount, Optional perUnitDecimal, - Optional perUnitPrice, + Optional perUnitPrice, String priceExternalId, Optional providerType, - Optional upTo, + Optional upTo, Map additionalProperties) { this.flatAmount = flatAmount; this.perUnitDecimal = perUnitDecimal; @@ -53,7 +53,7 @@ private CreateBillingPriceTierRequestBody( } @JsonProperty("flat_amount") - public Optional getFlatAmount() { + public Optional getFlatAmount() { return flatAmount; } @@ -63,7 +63,7 @@ public Optional getPerUnitDecimal() { } @JsonProperty("per_unit_price") - public Optional getPerUnitPrice() { + public Optional getPerUnitPrice() { return perUnitPrice; } @@ -78,7 +78,7 @@ public Optional getProviderType() { } @JsonProperty("up_to") - public Optional getUpTo() { + public Optional getUpTo() { return upTo; } @@ -131,40 +131,44 @@ public interface PriceExternalIdStage { public interface _FinalStage { CreateBillingPriceTierRequestBody build(); - _FinalStage flatAmount(Optional flatAmount); + _FinalStage additionalProperty(String key, Object value); - _FinalStage flatAmount(Integer flatAmount); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage flatAmount(Optional flatAmount); + + _FinalStage flatAmount(Long flatAmount); _FinalStage perUnitDecimal(Optional perUnitDecimal); _FinalStage perUnitDecimal(String perUnitDecimal); - _FinalStage perUnitPrice(Optional perUnitPrice); + _FinalStage perUnitPrice(Optional perUnitPrice); - _FinalStage perUnitPrice(Integer perUnitPrice); + _FinalStage perUnitPrice(Long perUnitPrice); _FinalStage providerType(Optional providerType); _FinalStage providerType(BillingProviderType providerType); - _FinalStage upTo(Optional upTo); + _FinalStage upTo(Optional upTo); - _FinalStage upTo(Integer upTo); + _FinalStage upTo(Long upTo); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements PriceExternalIdStage, _FinalStage { private String priceExternalId; - private Optional upTo = Optional.empty(); + private Optional upTo = Optional.empty(); private Optional providerType = Optional.empty(); - private Optional perUnitPrice = Optional.empty(); + private Optional perUnitPrice = Optional.empty(); private Optional perUnitDecimal = Optional.empty(); - private Optional flatAmount = Optional.empty(); + private Optional flatAmount = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -190,14 +194,14 @@ public _FinalStage priceExternalId(@NotNull String priceExternalId) { } @java.lang.Override - public _FinalStage upTo(Integer upTo) { + public _FinalStage upTo(Long upTo) { this.upTo = Optional.ofNullable(upTo); return this; } @java.lang.Override @JsonSetter(value = "up_to", nulls = Nulls.SKIP) - public _FinalStage upTo(Optional upTo) { + public _FinalStage upTo(Optional upTo) { this.upTo = upTo; return this; } @@ -216,14 +220,14 @@ public _FinalStage providerType(Optional providerType) { } @java.lang.Override - public _FinalStage perUnitPrice(Integer perUnitPrice) { + public _FinalStage perUnitPrice(Long perUnitPrice) { this.perUnitPrice = Optional.ofNullable(perUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "per_unit_price", nulls = Nulls.SKIP) - public _FinalStage perUnitPrice(Optional perUnitPrice) { + public _FinalStage perUnitPrice(Optional perUnitPrice) { this.perUnitPrice = perUnitPrice; return this; } @@ -242,14 +246,14 @@ public _FinalStage perUnitDecimal(Optional perUnitDecimal) { } @java.lang.Override - public _FinalStage flatAmount(Integer flatAmount) { + public _FinalStage flatAmount(Long flatAmount) { this.flatAmount = Optional.ofNullable(flatAmount); return this; } @java.lang.Override @JsonSetter(value = "flat_amount", nulls = Nulls.SKIP) - public _FinalStage flatAmount(Optional flatAmount) { + public _FinalStage flatAmount(Optional flatAmount) { this.flatAmount = flatAmount; return this; } @@ -265,5 +269,17 @@ public CreateBillingPriceTierRequestBody build() { upTo, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java index e619ea1..b793a67 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateEntitlementInBundleRequestBody.java @@ -24,7 +24,7 @@ public final class CreateEntitlementInBundleRequestBody { private final Optional billingProductId; - private final Optional billingThreshold; + private final Optional billingThreshold; private final Optional creditConsumptionRate; @@ -40,17 +40,21 @@ public final class CreateEntitlementInBundleRequestBody { private final Optional> monthlyPriceTiers; - private final Optional monthlyUnitPrice; + private final Optional monthlyUnitPrice; private final Optional monthlyUnitPriceDecimal; private final Optional overageBillingProductId; + private final String planId; + + private final Optional planVersionId; + private final Optional priceBehavior; private final Optional> priceTiers; - private final Optional softLimit; + private final Optional softLimit; private final Optional tierMode; @@ -58,7 +62,7 @@ public final class CreateEntitlementInBundleRequestBody { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -68,7 +72,7 @@ public final class CreateEntitlementInBundleRequestBody { private final Optional> yearlyPriceTiers; - private final Optional yearlyUnitPrice; + private final Optional yearlyUnitPrice; private final Optional yearlyUnitPriceDecimal; @@ -76,7 +80,7 @@ public final class CreateEntitlementInBundleRequestBody { private CreateEntitlementInBundleRequestBody( Optional billingProductId, - Optional billingThreshold, + Optional billingThreshold, Optional creditConsumptionRate, Optional currency, String featureId, @@ -84,21 +88,23 @@ private CreateEntitlementInBundleRequestBody( Optional metricPeriodMonthReset, Optional monthlyMeteredPriceId, Optional> monthlyPriceTiers, - Optional monthlyUnitPrice, + Optional monthlyUnitPrice, Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, + String planId, + Optional planVersionId, Optional priceBehavior, Optional> priceTiers, - Optional softLimit, + Optional softLimit, Optional tierMode, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, - Optional yearlyUnitPrice, + Optional yearlyUnitPrice, Optional yearlyUnitPriceDecimal, Map additionalProperties) { this.billingProductId = billingProductId; @@ -113,6 +119,8 @@ private CreateEntitlementInBundleRequestBody( this.monthlyUnitPrice = monthlyUnitPrice; this.monthlyUnitPriceDecimal = monthlyUnitPriceDecimal; this.overageBillingProductId = overageBillingProductId; + this.planId = planId; + this.planVersionId = planVersionId; this.priceBehavior = priceBehavior; this.priceTiers = priceTiers; this.softLimit = softLimit; @@ -135,7 +143,7 @@ public Optional getBillingProductId() { } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -175,7 +183,7 @@ public Optional> getMonthlyPriceTiers() { } @JsonProperty("monthly_unit_price") - public Optional getMonthlyUnitPrice() { + public Optional getMonthlyUnitPrice() { return monthlyUnitPrice; } @@ -189,6 +197,16 @@ public Optional getOverageBillingProductId() { return overageBillingProductId; } + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + @JsonProperty("price_behavior") public Optional getPriceBehavior() { return priceBehavior; @@ -203,7 +221,7 @@ public Optional> getPriceTiers() { } @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -223,7 +241,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -248,7 +266,7 @@ public Optional> getYearlyPriceTiers() { } @JsonProperty("yearly_unit_price") - public Optional getYearlyUnitPrice() { + public Optional getYearlyUnitPrice() { return yearlyUnitPrice; } @@ -282,6 +300,8 @@ private boolean equalTo(CreateEntitlementInBundleRequestBody other) { && monthlyUnitPrice.equals(other.monthlyUnitPrice) && monthlyUnitPriceDecimal.equals(other.monthlyUnitPriceDecimal) && overageBillingProductId.equals(other.overageBillingProductId) + && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && priceBehavior.equals(other.priceBehavior) && priceTiers.equals(other.priceTiers) && softLimit.equals(other.softLimit) @@ -312,6 +332,8 @@ public int hashCode() { this.monthlyUnitPrice, this.monthlyUnitPriceDecimal, this.overageBillingProductId, + this.planId, + this.planVersionId, this.priceBehavior, this.priceTiers, this.softLimit, @@ -337,11 +359,15 @@ public static FeatureIdStage builder() { } public interface FeatureIdStage { - ValueTypeStage featureId(@NotNull String featureId); + PlanIdStage featureId(@NotNull String featureId); Builder from(CreateEntitlementInBundleRequestBody other); } + public interface PlanIdStage { + ValueTypeStage planId(@NotNull String planId); + } + public interface ValueTypeStage { _FinalStage valueType(@NotNull EntitlementValueType valueType); } @@ -349,13 +375,17 @@ public interface ValueTypeStage { public interface _FinalStage { CreateEntitlementInBundleRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingProductId(Optional billingProductId); _FinalStage billingProductId(String billingProductId); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage billingThreshold(Optional billingThreshold); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage billingThreshold(Long billingThreshold); _FinalStage creditConsumptionRate(Optional creditConsumptionRate); @@ -383,9 +413,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage monthlyPriceTiers(List monthlyPriceTiers); - _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); + _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice); - _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice); + _FinalStage monthlyUnitPrice(Long monthlyUnitPrice); _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDecimal); @@ -395,6 +425,10 @@ _FinalStage metricPeriodMonthReset( _FinalStage overageBillingProductId(String overageBillingProductId); + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + _FinalStage priceBehavior(Optional priceBehavior); _FinalStage priceBehavior(EntitlementPriceBehavior priceBehavior); @@ -406,9 +440,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage priceTiers(List priceTiers); - _FinalStage softLimit(Optional softLimit); + _FinalStage softLimit(Optional softLimit); - _FinalStage softLimit(Integer softLimit); + _FinalStage softLimit(Long softLimit); _FinalStage tierMode(Optional tierMode); @@ -422,9 +456,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -438,9 +472,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage yearlyPriceTiers(List yearlyPriceTiers); - _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); + _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice); - _FinalStage yearlyUnitPrice(Integer yearlyUnitPrice); + _FinalStage yearlyUnitPrice(Long yearlyUnitPrice); _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecimal); @@ -448,14 +482,16 @@ _FinalStage metricPeriodMonthReset( } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements FeatureIdStage, ValueTypeStage, _FinalStage { + public static final class Builder implements FeatureIdStage, PlanIdStage, ValueTypeStage, _FinalStage { private String featureId; + private String planId; + private EntitlementValueType valueType; private Optional yearlyUnitPriceDecimal = Optional.empty(); - private Optional yearlyUnitPrice = Optional.empty(); + private Optional yearlyUnitPrice = Optional.empty(); private Optional> yearlyPriceTiers = Optional.empty(); @@ -463,7 +499,7 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -471,17 +507,19 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional tierMode = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional> priceTiers = Optional.empty(); private Optional priceBehavior = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional overageBillingProductId = Optional.empty(); private Optional monthlyUnitPriceDecimal = Optional.empty(); - private Optional monthlyUnitPrice = Optional.empty(); + private Optional monthlyUnitPrice = Optional.empty(); private Optional> monthlyPriceTiers = Optional.empty(); @@ -496,7 +534,7 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional creditConsumptionRate = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); private Optional billingProductId = Optional.empty(); @@ -519,6 +557,8 @@ public Builder from(CreateEntitlementInBundleRequestBody other) { monthlyUnitPrice(other.getMonthlyUnitPrice()); monthlyUnitPriceDecimal(other.getMonthlyUnitPriceDecimal()); overageBillingProductId(other.getOverageBillingProductId()); + planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); priceBehavior(other.getPriceBehavior()); priceTiers(other.getPriceTiers()); softLimit(other.getSoftLimit()); @@ -537,11 +577,18 @@ public Builder from(CreateEntitlementInBundleRequestBody other) { @java.lang.Override @JsonSetter("feature_id") - public ValueTypeStage featureId(@NotNull String featureId) { + public PlanIdStage featureId(@NotNull String featureId) { this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); return this; } + @java.lang.Override + @JsonSetter("plan_id") + public ValueTypeStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + @java.lang.Override @JsonSetter("value_type") public _FinalStage valueType(@NotNull EntitlementValueType valueType) { @@ -563,14 +610,14 @@ public _FinalStage yearlyUnitPriceDecimal(Optional yearlyUnitPriceDecima } @java.lang.Override - public _FinalStage yearlyUnitPrice(Integer yearlyUnitPrice) { + public _FinalStage yearlyUnitPrice(Long yearlyUnitPrice) { this.yearlyUnitPrice = Optional.ofNullable(yearlyUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "yearly_unit_price", nulls = Nulls.SKIP) - public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { + public _FinalStage yearlyUnitPrice(Optional yearlyUnitPrice) { this.yearlyUnitPrice = yearlyUnitPrice; return this; } @@ -615,14 +662,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -667,14 +714,14 @@ public _FinalStage tierMode(Optional tierMode) { } @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -712,6 +759,19 @@ public _FinalStage priceBehavior(Optional priceBehavio return this; } + @java.lang.Override + public _FinalStage planVersionId(String planVersionId) { + this.planVersionId = Optional.ofNullable(planVersionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_id", nulls = Nulls.SKIP) + public _FinalStage planVersionId(Optional planVersionId) { + this.planVersionId = planVersionId; + return this; + } + @java.lang.Override public _FinalStage overageBillingProductId(String overageBillingProductId) { this.overageBillingProductId = Optional.ofNullable(overageBillingProductId); @@ -739,14 +799,14 @@ public _FinalStage monthlyUnitPriceDecimal(Optional monthlyUnitPriceDeci } @java.lang.Override - public _FinalStage monthlyUnitPrice(Integer monthlyUnitPrice) { + public _FinalStage monthlyUnitPrice(Long monthlyUnitPrice) { this.monthlyUnitPrice = Optional.ofNullable(monthlyUnitPrice); return this; } @java.lang.Override @JsonSetter(value = "monthly_unit_price", nulls = Nulls.SKIP) - public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { + public _FinalStage monthlyUnitPrice(Optional monthlyUnitPrice) { this.monthlyUnitPrice = monthlyUnitPrice; return this; } @@ -832,14 +892,14 @@ public _FinalStage creditConsumptionRate(Optional creditConsumptionRate) } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -872,6 +932,8 @@ public CreateEntitlementInBundleRequestBody build() { monthlyUnitPrice, monthlyUnitPriceDecimal, overageBillingProductId, + planId, + planVersionId, priceBehavior, priceTiers, softLimit, @@ -887,5 +949,17 @@ public CreateEntitlementInBundleRequestBody build() { yearlyUnitPriceDecimal, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java b/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java index d805b2f..d895544 100644 --- a/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java +++ b/src/main/java/com/schematic/api/types/CreateEntitlementReqCommon.java @@ -33,7 +33,7 @@ public final class CreateEntitlementReqCommon { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -48,7 +48,7 @@ private CreateEntitlementReqCommon( Optional metricPeriodMonthReset, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Map additionalProperties) { @@ -95,7 +95,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -168,6 +168,10 @@ public interface ValueTypeStage { public interface _FinalStage { CreateEntitlementReqCommon build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditConsumptionRate(Optional creditConsumptionRate); _FinalStage creditConsumptionRate(Double creditConsumptionRate); @@ -189,9 +193,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -206,7 +210,7 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -265,14 +269,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -358,5 +362,17 @@ public CreateEntitlementReqCommon build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateEventRequestBody.java b/src/main/java/com/schematic/api/types/CreateEventRequestBody.java index d766c20..73fcaf1 100644 --- a/src/main/java/com/schematic/api/types/CreateEventRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateEventRequestBody.java @@ -46,6 +46,9 @@ public Optional getBody() { return body; } + /** + * @return Either 'identify' or 'track' + */ @JsonProperty("event_type") public EventType getEventType() { return eventType; @@ -89,6 +92,9 @@ public static EventTypeStage builder() { } public interface EventTypeStage { + /** + *

Either 'identify' or 'track'

+ */ _FinalStage eventType(@NotNull EventType eventType); Builder from(CreateEventRequestBody other); @@ -97,6 +103,10 @@ public interface EventTypeStage { public interface _FinalStage { CreateEventRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage body(Optional body); _FinalStage body(EventBody body); @@ -130,6 +140,11 @@ 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 EventType eventType) { @@ -174,5 +189,17 @@ public _FinalStage body(Optional body) { public CreateEventRequestBody build() { return new CreateEventRequestBody(body, eventType, sentAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java b/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java index 2c3ab1e..870370d 100644 --- a/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateFlagRequestBody.java @@ -158,6 +158,10 @@ public interface NameStage { public interface _FinalStage { CreateFlagRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage featureId(Optional featureId); _FinalStage featureId(String featureId); @@ -267,5 +271,17 @@ public CreateFlagRequestBody build() { return new CreateFlagRequestBody( defaultValue, description, featureId, flagType, key, maintainerId, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionGroupRequestBody.java b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionGroupRequestBody.java index 7eddfbf..60fef67 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionGroupRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionGroupRequestBody.java @@ -152,5 +152,15 @@ public Builder id(String id) { public CreateOrUpdateConditionGroupRequestBody build() { return new CreateOrUpdateConditionGroupRequestBody(conditions, flagId, id, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBody.java b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBody.java index b6a270b..1e43cd4 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateConditionRequestBody.java @@ -39,7 +39,7 @@ public final class CreateOrUpdateConditionRequestBody { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final CreateOrUpdateConditionRequestBodyOperator operator; @@ -60,7 +60,7 @@ private CreateOrUpdateConditionRequestBody( Optional id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, CreateOrUpdateConditionRequestBodyOperator operator, List resourceIds, Optional traitId, @@ -144,7 +144,7 @@ public Optional getMet * @return Value to compare the track event metric against */ @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -245,6 +245,10 @@ public interface OperatorStage { public interface _FinalStage { CreateOrUpdateConditionRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Optionally provide a trait ID to compare a metric or trait value against instead of a value

*/ @@ -296,9 +300,9 @@ _FinalStage metricPeriodMonthReset( /** *

Value to compare the track event metric against

*/ - _FinalStage metricValue(Optional metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Long metricValue); /** *

List of resource IDs (companies, users, or plans) targeted by this condition

@@ -336,7 +340,7 @@ public static final class Builder implements ConditionTypeStage, OperatorStage, private List resourceIds = new ArrayList<>(); - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -470,7 +474,7 @@ public _FinalStage resourceIds(List resourceIds) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage metricValue(Integer metricValue) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @@ -480,7 +484,7 @@ public _FinalStage metricValue(Integer metricValue) { */ @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -638,5 +642,17 @@ public CreateOrUpdateConditionRequestBody build() { traitValue, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java b/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java index 28c4904..de8a554 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateFlagRequestBody.java @@ -169,6 +169,10 @@ public interface NameStage { public interface _FinalStage { CreateOrUpdateFlagRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage featureId(Optional featureId); _FinalStage featureId(String featureId); @@ -298,5 +302,17 @@ public CreateOrUpdateFlagRequestBody build() { return new CreateOrUpdateFlagRequestBody( defaultValue, description, featureId, flagType, id, key, maintainerId, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreateOrUpdateRuleRequestBody.java b/src/main/java/com/schematic/api/types/CreateOrUpdateRuleRequestBody.java index 8d91ab3..19ba420 100644 --- a/src/main/java/com/schematic/api/types/CreateOrUpdateRuleRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreateOrUpdateRuleRequestBody.java @@ -31,7 +31,7 @@ public final class CreateOrUpdateRuleRequestBody { private final String name; - private final int priority; + private final long priority; private final Optional ruleType; @@ -44,7 +44,7 @@ private CreateOrUpdateRuleRequestBody( List conditions, Optional id, String name, - int priority, + long priority, Optional ruleType, boolean value, Map additionalProperties) { @@ -79,7 +79,7 @@ public String getName() { } @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -136,7 +136,7 @@ public interface NameStage { } public interface PriorityStage { - ValueStage priority(int priority); + ValueStage priority(long priority); } public interface ValueStage { @@ -146,6 +146,10 @@ public interface ValueStage { public interface _FinalStage { CreateOrUpdateRuleRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditionGroups(List conditionGroups); _FinalStage addConditionGroups(CreateOrUpdateConditionGroupRequestBody conditionGroups); @@ -171,7 +175,7 @@ public interface _FinalStage { public static final class Builder implements NameStage, PriorityStage, ValueStage, _FinalStage { private String name; - private int priority; + private long priority; private boolean value; @@ -209,7 +213,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public ValueStage priority(int priority) { + public ValueStage priority(long priority) { this.priority = priority; return this; } @@ -300,5 +304,17 @@ public CreateOrUpdateRuleRequestBody build() { return new CreateOrUpdateRuleRequestBody( conditionGroups, conditions, id, name, priority, ruleType, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java index 487fa6c..e310446 100644 --- a/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreatePlanRequestBody.java @@ -113,6 +113,10 @@ public interface PlanTypeStage { public interface _FinalStage { CreatePlanRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage icon(Optional icon); _FinalStage icon(String icon); @@ -180,5 +184,17 @@ public _FinalStage icon(Optional icon) { public CreatePlanRequestBody build() { return new CreatePlanRequestBody(description, icon, name, planType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreatePriceTierRequestBody.java b/src/main/java/com/schematic/api/types/CreatePriceTierRequestBody.java index 95f054a..3a888a1 100644 --- a/src/main/java/com/schematic/api/types/CreatePriceTierRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreatePriceTierRequestBody.java @@ -20,21 +20,21 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreatePriceTierRequestBody.Builder.class) public final class CreatePriceTierRequestBody { - private final Optional flatAmount; + private final Optional flatAmount; - private final Optional perUnitPrice; + private final Optional perUnitPrice; private final Optional perUnitPriceDecimal; - private final Optional upTo; + private final Optional upTo; private final Map additionalProperties; private CreatePriceTierRequestBody( - Optional flatAmount, - Optional perUnitPrice, + Optional flatAmount, + Optional perUnitPrice, Optional perUnitPriceDecimal, - Optional upTo, + Optional upTo, Map additionalProperties) { this.flatAmount = flatAmount; this.perUnitPrice = perUnitPrice; @@ -44,12 +44,12 @@ private CreatePriceTierRequestBody( } @JsonProperty("flat_amount") - public Optional getFlatAmount() { + public Optional getFlatAmount() { return flatAmount; } @JsonProperty("per_unit_price") - public Optional getPerUnitPrice() { + public Optional getPerUnitPrice() { return perUnitPrice; } @@ -59,7 +59,7 @@ public Optional getPerUnitPriceDecimal() { } @JsonProperty("up_to") - public Optional getUpTo() { + public Optional getUpTo() { return upTo; } @@ -97,13 +97,13 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional flatAmount = Optional.empty(); + private Optional flatAmount = Optional.empty(); - private Optional perUnitPrice = Optional.empty(); + private Optional perUnitPrice = Optional.empty(); private Optional perUnitPriceDecimal = Optional.empty(); - private Optional upTo = Optional.empty(); + private Optional upTo = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -119,23 +119,23 @@ public Builder from(CreatePriceTierRequestBody other) { } @JsonSetter(value = "flat_amount", nulls = Nulls.SKIP) - public Builder flatAmount(Optional flatAmount) { + public Builder flatAmount(Optional flatAmount) { this.flatAmount = flatAmount; return this; } - public Builder flatAmount(Integer flatAmount) { + public Builder flatAmount(Long flatAmount) { this.flatAmount = Optional.ofNullable(flatAmount); return this; } @JsonSetter(value = "per_unit_price", nulls = Nulls.SKIP) - public Builder perUnitPrice(Optional perUnitPrice) { + public Builder perUnitPrice(Optional perUnitPrice) { this.perUnitPrice = perUnitPrice; return this; } - public Builder perUnitPrice(Integer perUnitPrice) { + public Builder perUnitPrice(Long perUnitPrice) { this.perUnitPrice = Optional.ofNullable(perUnitPrice); return this; } @@ -152,12 +152,12 @@ public Builder perUnitPriceDecimal(String perUnitPriceDecimal) { } @JsonSetter(value = "up_to", nulls = Nulls.SKIP) - public Builder upTo(Optional upTo) { + public Builder upTo(Optional upTo) { this.upTo = upTo; return this; } - public Builder upTo(Integer upTo) { + public Builder upTo(Long upTo) { this.upTo = Optional.ofNullable(upTo); return this; } @@ -166,5 +166,15 @@ public CreatePriceTierRequestBody build() { return new CreatePriceTierRequestBody( flatAmount, perUnitPrice, perUnitPriceDecimal, upTo, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditBundleCurrencyPrice.java b/src/main/java/com/schematic/api/types/CreditBundleCurrencyPrice.java new file mode 100644 index 0000000..201a08e --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditBundleCurrencyPrice.java @@ -0,0 +1,149 @@ +/** + * 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 = CreditBundleCurrencyPrice.Builder.class) +public final class CreditBundleCurrencyPrice { + private final String currency; + + private final Optional price; + + private final Map additionalProperties; + + private CreditBundleCurrencyPrice( + String currency, Optional price, Map additionalProperties) { + this.currency = currency; + this.price = price; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditBundleCurrencyPrice && equalTo((CreditBundleCurrencyPrice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditBundleCurrencyPrice other) { + return currency.equals(other.currency) && price.equals(other.price); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.price); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(CreditBundleCurrencyPrice other); + } + + public interface _FinalStage { + CreditBundleCurrencyPrice build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage price(Optional price); + + _FinalStage price(BillingPriceView price); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional price = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditBundleCurrencyPrice other) { + currency(other.getCurrency()); + price(other.getPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage price(BillingPriceView price) { + this.price = Optional.ofNullable(price); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public _FinalStage price(Optional price) { + this.price = price; + return this; + } + + @java.lang.Override + public CreditBundleCurrencyPrice build() { + return new CreditBundleCurrencyPrice(currency, price, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceRequestBody.java b/src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceRequestBody.java new file mode 100644 index 0000000..6d935d4 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceRequestBody.java @@ -0,0 +1,184 @@ +/** + * 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 = CreditBundleCurrencyPriceRequestBody.Builder.class) +public final class CreditBundleCurrencyPriceRequestBody { + private final String currency; + + private final Optional pricePerUnit; + + private final Optional pricePerUnitDecimal; + + private final Map additionalProperties; + + private CreditBundleCurrencyPriceRequestBody( + String currency, + Optional pricePerUnit, + Optional pricePerUnitDecimal, + Map additionalProperties) { + this.currency = currency; + this.pricePerUnit = pricePerUnit; + this.pricePerUnitDecimal = pricePerUnitDecimal; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("price_per_unit") + public Optional getPricePerUnit() { + return pricePerUnit; + } + + @JsonProperty("price_per_unit_decimal") + public Optional getPricePerUnitDecimal() { + return pricePerUnitDecimal; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditBundleCurrencyPriceRequestBody + && equalTo((CreditBundleCurrencyPriceRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditBundleCurrencyPriceRequestBody other) { + return currency.equals(other.currency) + && pricePerUnit.equals(other.pricePerUnit) + && pricePerUnitDecimal.equals(other.pricePerUnitDecimal); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.pricePerUnit, this.pricePerUnitDecimal); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(CreditBundleCurrencyPriceRequestBody other); + } + + public interface _FinalStage { + CreditBundleCurrencyPriceRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage pricePerUnit(Optional pricePerUnit); + + _FinalStage pricePerUnit(Long pricePerUnit); + + _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal); + + _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional pricePerUnitDecimal = Optional.empty(); + + private Optional pricePerUnit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditBundleCurrencyPriceRequestBody other) { + currency(other.getCurrency()); + pricePerUnit(other.getPricePerUnit()); + pricePerUnitDecimal(other.getPricePerUnitDecimal()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal) { + this.pricePerUnitDecimal = Optional.ofNullable(pricePerUnitDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_per_unit_decimal", nulls = Nulls.SKIP) + public _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal) { + this.pricePerUnitDecimal = pricePerUnitDecimal; + return this; + } + + @java.lang.Override + public _FinalStage pricePerUnit(Long pricePerUnit) { + this.pricePerUnit = Optional.ofNullable(pricePerUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_per_unit", nulls = Nulls.SKIP) + public _FinalStage pricePerUnit(Optional pricePerUnit) { + this.pricePerUnit = pricePerUnit; + return this; + } + + @java.lang.Override + public CreditBundleCurrencyPriceRequestBody build() { + return new CreditBundleCurrencyPriceRequestBody( + currency, pricePerUnit, pricePerUnitDecimal, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceResponseData.java b/src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceResponseData.java new file mode 100644 index 0000000..fe1b896 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditBundleCurrencyPriceResponseData.java @@ -0,0 +1,150 @@ +/** + * 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 = CreditBundleCurrencyPriceResponseData.Builder.class) +public final class CreditBundleCurrencyPriceResponseData { + private final String currency; + + private final Optional price; + + private final Map additionalProperties; + + private CreditBundleCurrencyPriceResponseData( + String currency, Optional price, Map additionalProperties) { + this.currency = currency; + this.price = price; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditBundleCurrencyPriceResponseData + && equalTo((CreditBundleCurrencyPriceResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditBundleCurrencyPriceResponseData other) { + return currency.equals(other.currency) && price.equals(other.price); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.price); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(CreditBundleCurrencyPriceResponseData other); + } + + public interface _FinalStage { + CreditBundleCurrencyPriceResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage price(Optional price); + + _FinalStage price(BillingPriceResponseData price); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional price = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditBundleCurrencyPriceResponseData other) { + currency(other.getCurrency()); + price(other.getPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage price(BillingPriceResponseData price) { + this.price = Optional.ofNullable(price); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public _FinalStage price(Optional price) { + this.price = price; + return this; + } + + @java.lang.Override + public CreditBundleCurrencyPriceResponseData build() { + return new CreditBundleCurrencyPriceResponseData(currency, price, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditBundlePurchaseResponseData.java b/src/main/java/com/schematic/api/types/CreditBundlePurchaseResponseData.java index 2776f74..5e4e19d 100644 --- a/src/main/java/com/schematic/api/types/CreditBundlePurchaseResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditBundlePurchaseResponseData.java @@ -22,16 +22,16 @@ public final class CreditBundlePurchaseResponseData { private final Optional bundle; - private final int quantity; + private final long quantity; - private final int total; + private final long total; private final Map additionalProperties; private CreditBundlePurchaseResponseData( Optional bundle, - int quantity, - int total, + long quantity, + long total, Map additionalProperties) { this.bundle = bundle; this.quantity = quantity; @@ -45,12 +45,12 @@ public Optional getBundle() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @JsonProperty("total") - public int getTotal() { + public long getTotal() { return total; } @@ -84,18 +84,22 @@ public static QuantityStage builder() { } public interface QuantityStage { - TotalStage quantity(int quantity); + TotalStage quantity(long quantity); Builder from(CreditBundlePurchaseResponseData other); } public interface TotalStage { - _FinalStage total(int total); + _FinalStage total(long total); } public interface _FinalStage { CreditBundlePurchaseResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage bundle(Optional bundle); _FinalStage bundle(BillingCreditBundleResponseData bundle); @@ -103,9 +107,9 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements QuantityStage, TotalStage, _FinalStage { - private int quantity; + private long quantity; - private int total; + private long total; private Optional bundle = Optional.empty(); @@ -124,14 +128,14 @@ public Builder from(CreditBundlePurchaseResponseData other) { @java.lang.Override @JsonSetter("quantity") - public TotalStage quantity(int quantity) { + public TotalStage quantity(long quantity) { this.quantity = quantity; return this; } @java.lang.Override @JsonSetter("total") - public _FinalStage total(int total) { + public _FinalStage total(long total) { this.total = total; return this; } @@ -153,5 +157,17 @@ public _FinalStage bundle(Optional bundle) { public CreditBundlePurchaseResponseData build() { return new CreditBundlePurchaseResponseData(bundle, quantity, total, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java index 741f7cb..7cdca3e 100644 --- a/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java +++ b/src/main/java/com/schematic/api/types/CreditCompanyGrantView.java @@ -39,6 +39,8 @@ public final class CreditCompanyGrantView { private final String creditName; + private final Optional currency; + private final Optional exhaustedAt; private final Optional expiresAt; @@ -47,7 +49,7 @@ public final class CreditCompanyGrantView { private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final BillingCreditGrantReason grantReason; @@ -61,7 +63,7 @@ public final class CreditCompanyGrantView { private final Optional price; - private final int quantity; + private final long quantity; private final double quantityRemaining; @@ -96,18 +98,19 @@ private CreditCompanyGrantView( String creditDescription, Optional creditIcon, String creditName, + Optional currency, Optional exhaustedAt, Optional expiresAt, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, BillingCreditGrantReason grantReason, String id, Optional planId, Optional planName, Optional pluralName, Optional price, - int quantity, + long quantity, double quantityRemaining, double quantityUsed, boolean renewalEnabled, @@ -128,6 +131,7 @@ private CreditCompanyGrantView( this.creditDescription = creditDescription; this.creditIcon = creditIcon; this.creditName = creditName; + this.currency = currency; this.exhaustedAt = exhaustedAt; this.expiresAt = expiresAt; this.expiryType = expiryType; @@ -194,6 +198,11 @@ public String getCreditName() { return creditName; } + @JsonProperty("currency") + public Optional getCurrency() { + return currency; + } + @JsonProperty("exhausted_at") public Optional getExhaustedAt() { return exhaustedAt; @@ -215,7 +224,7 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -250,7 +259,7 @@ public Optional getPrice() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -329,6 +338,7 @@ private boolean equalTo(CreditCompanyGrantView other) { && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) && creditName.equals(other.creditName) + && currency.equals(other.currency) && exhaustedAt.equals(other.exhaustedAt) && expiresAt.equals(other.expiresAt) && expiryType.equals(other.expiryType) @@ -365,6 +375,7 @@ public int hashCode() { this.creditDescription, this.creditIcon, this.creditName, + this.currency, this.exhaustedAt, this.expiresAt, this.expiryType, @@ -434,7 +445,7 @@ public interface IdStage { } public interface QuantityStage { - QuantityRemainingStage quantity(int quantity); + QuantityRemainingStage quantity(long quantity); } public interface QuantityRemainingStage { @@ -460,6 +471,10 @@ public interface UpdatedAtStage { public interface _FinalStage { CreditCompanyGrantView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingCreditBundleId(Optional billingCreditBundleId); _FinalStage billingCreditBundleId(String billingCreditBundleId); @@ -468,6 +483,10 @@ public interface _FinalStage { _FinalStage creditIcon(String creditIcon); + _FinalStage currency(Optional currency); + + _FinalStage currency(String currency); + _FinalStage exhaustedAt(Optional exhaustedAt); _FinalStage exhaustedAt(OffsetDateTime exhaustedAt); @@ -484,9 +503,9 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage planId(Optional planId); @@ -562,7 +581,7 @@ public static final class Builder private String id; - private int quantity; + private long quantity; private double quantityRemaining; @@ -594,7 +613,7 @@ public static final class Builder private Optional planId = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -604,6 +623,8 @@ public static final class Builder private Optional exhaustedAt = Optional.empty(); + private Optional currency = Optional.empty(); + private Optional creditIcon = Optional.empty(); private Optional billingCreditBundleId = Optional.empty(); @@ -623,6 +644,7 @@ public Builder from(CreditCompanyGrantView other) { creditDescription(other.getCreditDescription()); creditIcon(other.getCreditIcon()); creditName(other.getCreditName()); + currency(other.getCurrency()); exhaustedAt(other.getExhaustedAt()); expiresAt(other.getExpiresAt()); expiryType(other.getExpiryType()); @@ -707,7 +729,7 @@ public QuantityStage id(@NotNull String id) { @java.lang.Override @JsonSetter("quantity") - public QuantityRemainingStage quantity(int quantity) { + public QuantityRemainingStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -878,14 +900,14 @@ public _FinalStage planId(Optional planId) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -942,6 +964,19 @@ public _FinalStage exhaustedAt(Optional exhaustedAt) { 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 creditIcon(String creditIcon) { this.creditIcon = Optional.ofNullable(creditIcon); @@ -979,6 +1014,7 @@ public CreditCompanyGrantView build() { creditDescription, creditIcon, creditName, + currency, exhaustedAt, expiresAt, expiryType, @@ -1004,5 +1040,17 @@ public CreditCompanyGrantView build() { zeroedOutReason, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditCurrencyPriceRequestBody.java b/src/main/java/com/schematic/api/types/CreditCurrencyPriceRequestBody.java new file mode 100644 index 0000000..b7fa59a --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditCurrencyPriceRequestBody.java @@ -0,0 +1,183 @@ +/** + * 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 = CreditCurrencyPriceRequestBody.Builder.class) +public final class CreditCurrencyPriceRequestBody { + private final String currency; + + private final Optional pricePerUnit; + + private final Optional pricePerUnitDecimal; + + private final Map additionalProperties; + + private CreditCurrencyPriceRequestBody( + String currency, + Optional pricePerUnit, + Optional pricePerUnitDecimal, + Map additionalProperties) { + this.currency = currency; + this.pricePerUnit = pricePerUnit; + this.pricePerUnitDecimal = pricePerUnitDecimal; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("price_per_unit") + public Optional getPricePerUnit() { + return pricePerUnit; + } + + @JsonProperty("price_per_unit_decimal") + public Optional getPricePerUnitDecimal() { + return pricePerUnitDecimal; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditCurrencyPriceRequestBody && equalTo((CreditCurrencyPriceRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditCurrencyPriceRequestBody other) { + return currency.equals(other.currency) + && pricePerUnit.equals(other.pricePerUnit) + && pricePerUnitDecimal.equals(other.pricePerUnitDecimal); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.pricePerUnit, this.pricePerUnitDecimal); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(CreditCurrencyPriceRequestBody other); + } + + public interface _FinalStage { + CreditCurrencyPriceRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage pricePerUnit(Optional pricePerUnit); + + _FinalStage pricePerUnit(Long pricePerUnit); + + _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal); + + _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional pricePerUnitDecimal = Optional.empty(); + + private Optional pricePerUnit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditCurrencyPriceRequestBody other) { + currency(other.getCurrency()); + pricePerUnit(other.getPricePerUnit()); + pricePerUnitDecimal(other.getPricePerUnitDecimal()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage pricePerUnitDecimal(String pricePerUnitDecimal) { + this.pricePerUnitDecimal = Optional.ofNullable(pricePerUnitDecimal); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_per_unit_decimal", nulls = Nulls.SKIP) + public _FinalStage pricePerUnitDecimal(Optional pricePerUnitDecimal) { + this.pricePerUnitDecimal = pricePerUnitDecimal; + return this; + } + + @java.lang.Override + public _FinalStage pricePerUnit(Long pricePerUnit) { + this.pricePerUnit = Optional.ofNullable(pricePerUnit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price_per_unit", nulls = Nulls.SKIP) + public _FinalStage pricePerUnit(Optional pricePerUnit) { + this.pricePerUnit = pricePerUnit; + return this; + } + + @java.lang.Override + public CreditCurrencyPriceRequestBody build() { + return new CreditCurrencyPriceRequestBody( + currency, pricePerUnit, pricePerUnitDecimal, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditCurrencyPriceResponseData.java b/src/main/java/com/schematic/api/types/CreditCurrencyPriceResponseData.java new file mode 100644 index 0000000..b9d5ba0 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditCurrencyPriceResponseData.java @@ -0,0 +1,149 @@ +/** + * 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 = CreditCurrencyPriceResponseData.Builder.class) +public final class CreditCurrencyPriceResponseData { + private final String currency; + + private final Optional price; + + private final Map additionalProperties; + + private CreditCurrencyPriceResponseData( + String currency, Optional price, Map additionalProperties) { + this.currency = currency; + this.price = price; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("price") + public Optional getPrice() { + return price; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditCurrencyPriceResponseData && equalTo((CreditCurrencyPriceResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditCurrencyPriceResponseData other) { + return currency.equals(other.currency) && price.equals(other.price); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.price); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(CreditCurrencyPriceResponseData other); + } + + public interface _FinalStage { + CreditCurrencyPriceResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage price(Optional price); + + _FinalStage price(BillingPriceResponseData price); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional price = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditCurrencyPriceResponseData other) { + currency(other.getCurrency()); + price(other.getPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage price(BillingPriceResponseData price) { + this.price = Optional.ofNullable(price); + return this; + } + + @java.lang.Override + @JsonSetter(value = "price", nulls = Nulls.SKIP) + public _FinalStage price(Optional price) { + this.price = price; + return this; + } + + @java.lang.Override + public CreditCurrencyPriceResponseData build() { + return new CreditCurrencyPriceResponseData(currency, price, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java b/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java new file mode 100644 index 0000000..75a5f15 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditEventLedgerResponseData.java @@ -0,0 +1,1048 @@ +/** + * 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 = CreditEventLedgerResponseData.Builder.class) +public final class CreditEventLedgerResponseData { + private final double amount; + + private final Optional autoTopupLogId; + + private final Optional billingCreditBundleId; + + private final String billingCreditId; + + private final Optional company; + + private final String companyId; + + private final Optional credit; + + private final String creditName; + + private final String environmentId; + + private final OffsetDateTime eventAt; + + private final String eventId; + + private final CreditEventType eventType; + + private final Optional expiryType; + + private final Optional expiryUnit; + + private final Optional expiryUnitCount; + + private final Optional feature; + + private final Optional featureId; + + private final Optional fromGrantId; + + private final Optional grantExpiresAt; + + private final Optional grantId; + + private final Optional grantQuantity; + + private final Optional grantQuantityRemaining; + + private final Optional grantReason; + + private final Optional grantValidFrom; + + private final Optional planId; + + private final Optional quantityConsumed; + + private final Optional quantityRemainingAtZeroOut; + + private final long sourceId; + + private final Optional toGrantId; + + private final Optional usageEventId; + + private final Optional zeroedOutReason; + + private final Map additionalProperties; + + private CreditEventLedgerResponseData( + double amount, + Optional autoTopupLogId, + Optional billingCreditBundleId, + String billingCreditId, + Optional company, + String companyId, + Optional credit, + String creditName, + String environmentId, + OffsetDateTime eventAt, + String eventId, + CreditEventType eventType, + Optional expiryType, + Optional expiryUnit, + Optional expiryUnitCount, + Optional feature, + Optional featureId, + Optional fromGrantId, + Optional grantExpiresAt, + Optional grantId, + Optional grantQuantity, + Optional grantQuantityRemaining, + Optional grantReason, + Optional grantValidFrom, + Optional planId, + Optional quantityConsumed, + Optional quantityRemainingAtZeroOut, + long sourceId, + Optional toGrantId, + Optional usageEventId, + Optional zeroedOutReason, + Map additionalProperties) { + this.amount = amount; + this.autoTopupLogId = autoTopupLogId; + this.billingCreditBundleId = billingCreditBundleId; + this.billingCreditId = billingCreditId; + this.company = company; + this.companyId = companyId; + this.credit = credit; + this.creditName = creditName; + this.environmentId = environmentId; + this.eventAt = eventAt; + this.eventId = eventId; + this.eventType = eventType; + this.expiryType = expiryType; + this.expiryUnit = expiryUnit; + this.expiryUnitCount = expiryUnitCount; + this.feature = feature; + this.featureId = featureId; + this.fromGrantId = fromGrantId; + this.grantExpiresAt = grantExpiresAt; + this.grantId = grantId; + this.grantQuantity = grantQuantity; + this.grantQuantityRemaining = grantQuantityRemaining; + this.grantReason = grantReason; + this.grantValidFrom = grantValidFrom; + this.planId = planId; + this.quantityConsumed = quantityConsumed; + this.quantityRemainingAtZeroOut = quantityRemainingAtZeroOut; + this.sourceId = sourceId; + this.toGrantId = toGrantId; + this.usageEventId = usageEventId; + this.zeroedOutReason = zeroedOutReason; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + @JsonProperty("auto_topup_log_id") + public Optional getAutoTopupLogId() { + return autoTopupLogId; + } + + @JsonProperty("billing_credit_bundle_id") + public Optional getBillingCreditBundleId() { + return billingCreditBundleId; + } + + @JsonProperty("billing_credit_id") + public String getBillingCreditId() { + return billingCreditId; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + + @JsonProperty("credit_name") + public String getCreditName() { + return creditName; + } + + @JsonProperty("environment_id") + public String getEnvironmentId() { + return environmentId; + } + + @JsonProperty("event_at") + public OffsetDateTime getEventAt() { + return eventAt; + } + + @JsonProperty("event_id") + public String getEventId() { + return eventId; + } + + @JsonProperty("event_type") + public CreditEventType getEventType() { + return eventType; + } + + @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("feature") + public Optional getFeature() { + return feature; + } + + @JsonProperty("feature_id") + public Optional getFeatureId() { + return featureId; + } + + @JsonProperty("from_grant_id") + public Optional getFromGrantId() { + return fromGrantId; + } + + @JsonProperty("grant_expires_at") + public Optional getGrantExpiresAt() { + return grantExpiresAt; + } + + @JsonProperty("grant_id") + public Optional getGrantId() { + return grantId; + } + + @JsonProperty("grant_quantity") + public Optional getGrantQuantity() { + return grantQuantity; + } + + @JsonProperty("grant_quantity_remaining") + public Optional getGrantQuantityRemaining() { + return grantQuantityRemaining; + } + + @JsonProperty("grant_reason") + public Optional getGrantReason() { + return grantReason; + } + + @JsonProperty("grant_valid_from") + public Optional getGrantValidFrom() { + return grantValidFrom; + } + + @JsonProperty("plan_id") + public Optional getPlanId() { + return planId; + } + + @JsonProperty("quantity_consumed") + public Optional getQuantityConsumed() { + return quantityConsumed; + } + + @JsonProperty("quantity_remaining_at_zero_out") + public Optional getQuantityRemainingAtZeroOut() { + return quantityRemainingAtZeroOut; + } + + @JsonProperty("source_id") + public long getSourceId() { + return sourceId; + } + + @JsonProperty("to_grant_id") + public Optional getToGrantId() { + return toGrantId; + } + + @JsonProperty("usage_event_id") + public Optional getUsageEventId() { + return usageEventId; + } + + @JsonProperty("zeroed_out_reason") + public Optional getZeroedOutReason() { + return zeroedOutReason; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreditEventLedgerResponseData && equalTo((CreditEventLedgerResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreditEventLedgerResponseData other) { + return amount == other.amount + && autoTopupLogId.equals(other.autoTopupLogId) + && billingCreditBundleId.equals(other.billingCreditBundleId) + && billingCreditId.equals(other.billingCreditId) + && company.equals(other.company) + && companyId.equals(other.companyId) + && credit.equals(other.credit) + && creditName.equals(other.creditName) + && environmentId.equals(other.environmentId) + && eventAt.equals(other.eventAt) + && eventId.equals(other.eventId) + && eventType.equals(other.eventType) + && expiryType.equals(other.expiryType) + && expiryUnit.equals(other.expiryUnit) + && expiryUnitCount.equals(other.expiryUnitCount) + && feature.equals(other.feature) + && featureId.equals(other.featureId) + && fromGrantId.equals(other.fromGrantId) + && grantExpiresAt.equals(other.grantExpiresAt) + && grantId.equals(other.grantId) + && grantQuantity.equals(other.grantQuantity) + && grantQuantityRemaining.equals(other.grantQuantityRemaining) + && grantReason.equals(other.grantReason) + && grantValidFrom.equals(other.grantValidFrom) + && planId.equals(other.planId) + && quantityConsumed.equals(other.quantityConsumed) + && quantityRemainingAtZeroOut.equals(other.quantityRemainingAtZeroOut) + && sourceId == other.sourceId + && toGrantId.equals(other.toGrantId) + && usageEventId.equals(other.usageEventId) + && zeroedOutReason.equals(other.zeroedOutReason); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.amount, + this.autoTopupLogId, + this.billingCreditBundleId, + this.billingCreditId, + this.company, + this.companyId, + this.credit, + this.creditName, + this.environmentId, + this.eventAt, + this.eventId, + this.eventType, + this.expiryType, + this.expiryUnit, + this.expiryUnitCount, + this.feature, + this.featureId, + this.fromGrantId, + this.grantExpiresAt, + this.grantId, + this.grantQuantity, + this.grantQuantityRemaining, + this.grantReason, + this.grantValidFrom, + this.planId, + this.quantityConsumed, + this.quantityRemainingAtZeroOut, + this.sourceId, + this.toGrantId, + this.usageEventId, + this.zeroedOutReason); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AmountStage builder() { + return new Builder(); + } + + public interface AmountStage { + BillingCreditIdStage amount(double amount); + + Builder from(CreditEventLedgerResponseData other); + } + + public interface BillingCreditIdStage { + CompanyIdStage billingCreditId(@NotNull String billingCreditId); + } + + public interface CompanyIdStage { + CreditNameStage companyId(@NotNull String companyId); + } + + public interface CreditNameStage { + EnvironmentIdStage creditName(@NotNull String creditName); + } + + public interface EnvironmentIdStage { + EventAtStage environmentId(@NotNull String environmentId); + } + + public interface EventAtStage { + EventIdStage eventAt(@NotNull OffsetDateTime eventAt); + } + + public interface EventIdStage { + EventTypeStage eventId(@NotNull String eventId); + } + + public interface EventTypeStage { + SourceIdStage eventType(@NotNull CreditEventType eventType); + } + + public interface SourceIdStage { + _FinalStage sourceId(long sourceId); + } + + public interface _FinalStage { + CreditEventLedgerResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage autoTopupLogId(Optional autoTopupLogId); + + _FinalStage autoTopupLogId(String autoTopupLogId); + + _FinalStage billingCreditBundleId(Optional billingCreditBundleId); + + _FinalStage billingCreditBundleId(String billingCreditBundleId); + + _FinalStage company(Optional company); + + _FinalStage company(CompanyLedgerResponseData company); + + _FinalStage credit(Optional credit); + + _FinalStage credit(BillingCreditLedgerResponseData credit); + + _FinalStage expiryType(Optional expiryType); + + _FinalStage expiryType(BillingCreditExpiryType expiryType); + + _FinalStage expiryUnit(Optional expiryUnit); + + _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); + + _FinalStage expiryUnitCount(Optional expiryUnitCount); + + _FinalStage expiryUnitCount(Long expiryUnitCount); + + _FinalStage feature(Optional feature); + + _FinalStage feature(FeatureLedgerResponseData feature); + + _FinalStage featureId(Optional featureId); + + _FinalStage featureId(String featureId); + + _FinalStage fromGrantId(Optional fromGrantId); + + _FinalStage fromGrantId(String fromGrantId); + + _FinalStage grantExpiresAt(Optional grantExpiresAt); + + _FinalStage grantExpiresAt(OffsetDateTime grantExpiresAt); + + _FinalStage grantId(Optional grantId); + + _FinalStage grantId(String grantId); + + _FinalStage grantQuantity(Optional grantQuantity); + + _FinalStage grantQuantity(Long grantQuantity); + + _FinalStage grantQuantityRemaining(Optional grantQuantityRemaining); + + _FinalStage grantQuantityRemaining(Double grantQuantityRemaining); + + _FinalStage grantReason(Optional grantReason); + + _FinalStage grantReason(BillingCreditGrantReason grantReason); + + _FinalStage grantValidFrom(Optional grantValidFrom); + + _FinalStage grantValidFrom(OffsetDateTime grantValidFrom); + + _FinalStage planId(Optional planId); + + _FinalStage planId(String planId); + + _FinalStage quantityConsumed(Optional quantityConsumed); + + _FinalStage quantityConsumed(Double quantityConsumed); + + _FinalStage quantityRemainingAtZeroOut(Optional quantityRemainingAtZeroOut); + + _FinalStage quantityRemainingAtZeroOut(Double quantityRemainingAtZeroOut); + + _FinalStage toGrantId(Optional toGrantId); + + _FinalStage toGrantId(String toGrantId); + + _FinalStage usageEventId(Optional usageEventId); + + _FinalStage usageEventId(String usageEventId); + + _FinalStage zeroedOutReason(Optional zeroedOutReason); + + _FinalStage zeroedOutReason(BillingCreditGrantZeroedOutReason zeroedOutReason); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AmountStage, + BillingCreditIdStage, + CompanyIdStage, + CreditNameStage, + EnvironmentIdStage, + EventAtStage, + EventIdStage, + EventTypeStage, + SourceIdStage, + _FinalStage { + private double amount; + + private String billingCreditId; + + private String companyId; + + private String creditName; + + private String environmentId; + + private OffsetDateTime eventAt; + + private String eventId; + + private CreditEventType eventType; + + private long sourceId; + + private Optional zeroedOutReason = Optional.empty(); + + private Optional usageEventId = Optional.empty(); + + private Optional toGrantId = Optional.empty(); + + private Optional quantityRemainingAtZeroOut = Optional.empty(); + + private Optional quantityConsumed = Optional.empty(); + + private Optional planId = Optional.empty(); + + private Optional grantValidFrom = Optional.empty(); + + private Optional grantReason = Optional.empty(); + + private Optional grantQuantityRemaining = Optional.empty(); + + private Optional grantQuantity = Optional.empty(); + + private Optional grantId = Optional.empty(); + + private Optional grantExpiresAt = Optional.empty(); + + private Optional fromGrantId = Optional.empty(); + + private Optional featureId = Optional.empty(); + + private Optional feature = Optional.empty(); + + private Optional expiryUnitCount = Optional.empty(); + + private Optional expiryUnit = Optional.empty(); + + private Optional expiryType = Optional.empty(); + + private Optional credit = Optional.empty(); + + private Optional company = Optional.empty(); + + private Optional billingCreditBundleId = Optional.empty(); + + private Optional autoTopupLogId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreditEventLedgerResponseData other) { + amount(other.getAmount()); + autoTopupLogId(other.getAutoTopupLogId()); + billingCreditBundleId(other.getBillingCreditBundleId()); + billingCreditId(other.getBillingCreditId()); + company(other.getCompany()); + companyId(other.getCompanyId()); + credit(other.getCredit()); + creditName(other.getCreditName()); + environmentId(other.getEnvironmentId()); + eventAt(other.getEventAt()); + eventId(other.getEventId()); + eventType(other.getEventType()); + expiryType(other.getExpiryType()); + expiryUnit(other.getExpiryUnit()); + expiryUnitCount(other.getExpiryUnitCount()); + feature(other.getFeature()); + featureId(other.getFeatureId()); + fromGrantId(other.getFromGrantId()); + grantExpiresAt(other.getGrantExpiresAt()); + grantId(other.getGrantId()); + grantQuantity(other.getGrantQuantity()); + grantQuantityRemaining(other.getGrantQuantityRemaining()); + grantReason(other.getGrantReason()); + grantValidFrom(other.getGrantValidFrom()); + planId(other.getPlanId()); + quantityConsumed(other.getQuantityConsumed()); + quantityRemainingAtZeroOut(other.getQuantityRemainingAtZeroOut()); + sourceId(other.getSourceId()); + toGrantId(other.getToGrantId()); + usageEventId(other.getUsageEventId()); + zeroedOutReason(other.getZeroedOutReason()); + return this; + } + + @java.lang.Override + @JsonSetter("amount") + public BillingCreditIdStage amount(double amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + @JsonSetter("billing_credit_id") + public CompanyIdStage billingCreditId(@NotNull String billingCreditId) { + this.billingCreditId = Objects.requireNonNull(billingCreditId, "billingCreditId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public CreditNameStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("credit_name") + public EnvironmentIdStage creditName(@NotNull String creditName) { + this.creditName = Objects.requireNonNull(creditName, "creditName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("environment_id") + public EventAtStage environmentId(@NotNull String environmentId) { + this.environmentId = Objects.requireNonNull(environmentId, "environmentId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_at") + public EventIdStage eventAt(@NotNull OffsetDateTime eventAt) { + this.eventAt = Objects.requireNonNull(eventAt, "eventAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_id") + public EventTypeStage eventId(@NotNull String eventId) { + this.eventId = Objects.requireNonNull(eventId, "eventId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("event_type") + public SourceIdStage eventType(@NotNull CreditEventType eventType) { + this.eventType = Objects.requireNonNull(eventType, "eventType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("source_id") + public _FinalStage sourceId(long sourceId) { + this.sourceId = sourceId; + return this; + } + + @java.lang.Override + 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) { + this.zeroedOutReason = zeroedOutReason; + return this; + } + + @java.lang.Override + public _FinalStage usageEventId(String usageEventId) { + this.usageEventId = Optional.ofNullable(usageEventId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "usage_event_id", nulls = Nulls.SKIP) + public _FinalStage usageEventId(Optional usageEventId) { + this.usageEventId = usageEventId; + return this; + } + + @java.lang.Override + public _FinalStage toGrantId(String toGrantId) { + this.toGrantId = Optional.ofNullable(toGrantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "to_grant_id", nulls = Nulls.SKIP) + public _FinalStage toGrantId(Optional toGrantId) { + this.toGrantId = toGrantId; + return this; + } + + @java.lang.Override + public _FinalStage quantityRemainingAtZeroOut(Double quantityRemainingAtZeroOut) { + this.quantityRemainingAtZeroOut = Optional.ofNullable(quantityRemainingAtZeroOut); + return this; + } + + @java.lang.Override + @JsonSetter(value = "quantity_remaining_at_zero_out", nulls = Nulls.SKIP) + public _FinalStage quantityRemainingAtZeroOut(Optional quantityRemainingAtZeroOut) { + this.quantityRemainingAtZeroOut = quantityRemainingAtZeroOut; + return this; + } + + @java.lang.Override + public _FinalStage quantityConsumed(Double quantityConsumed) { + this.quantityConsumed = Optional.ofNullable(quantityConsumed); + return this; + } + + @java.lang.Override + @JsonSetter(value = "quantity_consumed", nulls = Nulls.SKIP) + public _FinalStage quantityConsumed(Optional quantityConsumed) { + this.quantityConsumed = quantityConsumed; + 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 grantValidFrom(OffsetDateTime grantValidFrom) { + this.grantValidFrom = Optional.ofNullable(grantValidFrom); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_valid_from", nulls = Nulls.SKIP) + public _FinalStage grantValidFrom(Optional grantValidFrom) { + this.grantValidFrom = grantValidFrom; + return this; + } + + @java.lang.Override + public _FinalStage grantReason(BillingCreditGrantReason grantReason) { + this.grantReason = Optional.ofNullable(grantReason); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_reason", nulls = Nulls.SKIP) + public _FinalStage grantReason(Optional grantReason) { + this.grantReason = grantReason; + return this; + } + + @java.lang.Override + public _FinalStage grantQuantityRemaining(Double grantQuantityRemaining) { + this.grantQuantityRemaining = Optional.ofNullable(grantQuantityRemaining); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_quantity_remaining", nulls = Nulls.SKIP) + public _FinalStage grantQuantityRemaining(Optional grantQuantityRemaining) { + this.grantQuantityRemaining = grantQuantityRemaining; + return this; + } + + @java.lang.Override + public _FinalStage grantQuantity(Long grantQuantity) { + this.grantQuantity = Optional.ofNullable(grantQuantity); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_quantity", nulls = Nulls.SKIP) + public _FinalStage grantQuantity(Optional grantQuantity) { + this.grantQuantity = grantQuantity; + return this; + } + + @java.lang.Override + public _FinalStage grantId(String grantId) { + this.grantId = Optional.ofNullable(grantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_id", nulls = Nulls.SKIP) + public _FinalStage grantId(Optional grantId) { + this.grantId = grantId; + return this; + } + + @java.lang.Override + public _FinalStage grantExpiresAt(OffsetDateTime grantExpiresAt) { + this.grantExpiresAt = Optional.ofNullable(grantExpiresAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "grant_expires_at", nulls = Nulls.SKIP) + public _FinalStage grantExpiresAt(Optional grantExpiresAt) { + this.grantExpiresAt = grantExpiresAt; + return this; + } + + @java.lang.Override + public _FinalStage fromGrantId(String fromGrantId) { + this.fromGrantId = Optional.ofNullable(fromGrantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "from_grant_id", nulls = Nulls.SKIP) + public _FinalStage fromGrantId(Optional fromGrantId) { + this.fromGrantId = fromGrantId; + 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(FeatureLedgerResponseData 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 expiryUnitCount(Long expiryUnitCount) { + this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); + return this; + } + + @java.lang.Override + @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + this.expiryUnitCount = expiryUnitCount; + return this; + } + + @java.lang.Override + public _FinalStage 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 credit(BillingCreditLedgerResponseData 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(CompanyLedgerResponseData 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 billingCreditBundleId(String billingCreditBundleId) { + this.billingCreditBundleId = Optional.ofNullable(billingCreditBundleId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_credit_bundle_id", nulls = Nulls.SKIP) + public _FinalStage billingCreditBundleId(Optional billingCreditBundleId) { + this.billingCreditBundleId = billingCreditBundleId; + return this; + } + + @java.lang.Override + public _FinalStage autoTopupLogId(String autoTopupLogId) { + this.autoTopupLogId = Optional.ofNullable(autoTopupLogId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "auto_topup_log_id", nulls = Nulls.SKIP) + public _FinalStage autoTopupLogId(Optional autoTopupLogId) { + this.autoTopupLogId = autoTopupLogId; + return this; + } + + @java.lang.Override + public CreditEventLedgerResponseData build() { + return new CreditEventLedgerResponseData( + amount, + autoTopupLogId, + billingCreditBundleId, + billingCreditId, + company, + companyId, + credit, + creditName, + environmentId, + eventAt, + eventId, + eventType, + expiryType, + expiryUnit, + expiryUnitCount, + feature, + featureId, + fromGrantId, + grantExpiresAt, + grantId, + grantQuantity, + grantQuantityRemaining, + grantReason, + grantValidFrom, + planId, + quantityConsumed, + quantityRemainingAtZeroOut, + sourceId, + toGrantId, + usageEventId, + zeroedOutReason, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/CreditEventType.java b/src/main/java/com/schematic/api/types/CreditEventType.java new file mode 100644 index 0000000..54f8031 --- /dev/null +++ b/src/main/java/com/schematic/api/types/CreditEventType.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 CreditEventType { + public static final CreditEventType USAGE = new CreditEventType(Value.USAGE, "usage"); + + public static final CreditEventType ZERO_OUT = new CreditEventType(Value.ZERO_OUT, "zero_out"); + + public static final CreditEventType TRANSFER = new CreditEventType(Value.TRANSFER, "transfer"); + + public static final CreditEventType GRANT = new CreditEventType(Value.GRANT, "grant"); + + private final Value value; + + private final String string; + + CreditEventType(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 CreditEventType && this.string.equals(((CreditEventType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case USAGE: + return visitor.visitUsage(); + case ZERO_OUT: + return visitor.visitZeroOut(); + case TRANSFER: + return visitor.visitTransfer(); + case GRANT: + return visitor.visitGrant(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreditEventType valueOf(String value) { + switch (value) { + case "usage": + return USAGE; + case "zero_out": + return ZERO_OUT; + case "transfer": + return TRANSFER; + case "grant": + return GRANT; + default: + return new CreditEventType(Value.UNKNOWN, value); + } + } + + public enum Value { + GRANT, + + TRANSFER, + + USAGE, + + ZERO_OUT, + + UNKNOWN + } + + public interface Visitor { + T visitGrant(); + + T visitTransfer(); + + T visitUsage(); + + T visitZeroOut(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/CreditGrantDetail.java b/src/main/java/com/schematic/api/types/CreditGrantDetail.java index 45bd658..f778cc4 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantDetail.java +++ b/src/main/java/com/schematic/api/types/CreditGrantDetail.java @@ -110,6 +110,10 @@ public interface QuantityStage { public interface _FinalStage { CreditGrantDetail build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditTypeIcon(Optional creditTypeIcon); _FinalStage creditTypeIcon(String creditTypeIcon); @@ -187,5 +191,17 @@ public _FinalStage creditTypeIcon(Optional creditTypeIcon) { public CreditGrantDetail build() { return new CreditGrantDetail(creditTypeIcon, expiresAt, grantReason, quantity, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java index 268ee24..973a1d1 100644 --- a/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java +++ b/src/main/java/com/schematic/api/types/CreditGrantExpiryRequestBody.java @@ -25,7 +25,7 @@ public final class CreditGrantExpiryRequestBody { private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final BillingPlanCreditGrantResetCadence resetCadence; @@ -38,7 +38,7 @@ public final class CreditGrantExpiryRequestBody { private CreditGrantExpiryRequestBody( Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, @@ -63,7 +63,7 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -135,6 +135,10 @@ public interface ResetStartStage { public interface _FinalStage { CreditGrantExpiryRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage expiryType(Optional expiryType); _FinalStage expiryType(BillingCreditExpiryType expiryType); @@ -143,9 +147,9 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage resetType(Optional resetType); @@ -160,7 +164,7 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private Optional resetType = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -210,14 +214,14 @@ public _FinalStage resetType(Optional resetType } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -253,5 +257,17 @@ public CreditGrantExpiryRequestBody build() { return new CreditGrantExpiryRequestBody( expiryType, expiryUnit, expiryUnitCount, resetCadence, resetStart, resetType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java b/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java index f591fb2..505129b 100644 --- a/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditLedgerEnrichedEntryResponseData.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = CreditLedgerEnrichedEntryResponseData.Builder.class) public final class CreditLedgerEnrichedEntryResponseData { - private final int billingCreditAutoTopupGrantCount; + private final long billingCreditAutoTopupGrantCount; private final String billingCreditId; @@ -32,7 +32,7 @@ public final class CreditLedgerEnrichedEntryResponseData { private final Optional credit; - private final int expiredGrantCount; + private final long expiredGrantCount; private final Optional feature; @@ -40,19 +40,19 @@ public final class CreditLedgerEnrichedEntryResponseData { private final OffsetDateTime firstTransactionAt; - private final int freeGrantCount; + private final long freeGrantCount; - private final int grantCount; + private final long grantCount; private final OffsetDateTime lastTransactionAt; - private final int manuallyZeroedCount; + private final long manuallyZeroedCount; private final double netChange; - private final int planGrantCount; + private final long planGrantCount; - private final int purchasedGrantCount; + private final long purchasedGrantCount; private final OffsetDateTime timeBucket; @@ -60,37 +60,37 @@ public final class CreditLedgerEnrichedEntryResponseData { private final double totalGranted; - private final int transactionCount; + private final long transactionCount; - private final int usageCount; + private final long usageCount; - private final int zeroedOutCount; + private final long zeroedOutCount; private final Map additionalProperties; private CreditLedgerEnrichedEntryResponseData( - int billingCreditAutoTopupGrantCount, + long billingCreditAutoTopupGrantCount, String billingCreditId, Optional company, String companyId, Optional credit, - int expiredGrantCount, + long expiredGrantCount, Optional feature, Optional featureId, OffsetDateTime firstTransactionAt, - int freeGrantCount, - int grantCount, + long freeGrantCount, + long grantCount, OffsetDateTime lastTransactionAt, - int manuallyZeroedCount, + long manuallyZeroedCount, double netChange, - int planGrantCount, - int purchasedGrantCount, + long planGrantCount, + long purchasedGrantCount, OffsetDateTime timeBucket, double totalConsumed, double totalGranted, - int transactionCount, - int usageCount, - int zeroedOutCount, + long transactionCount, + long usageCount, + long zeroedOutCount, Map additionalProperties) { this.billingCreditAutoTopupGrantCount = billingCreditAutoTopupGrantCount; this.billingCreditId = billingCreditId; @@ -118,7 +118,7 @@ private CreditLedgerEnrichedEntryResponseData( } @JsonProperty("billing_credit_auto_topup_grant_count") - public int getBillingCreditAutoTopupGrantCount() { + public long getBillingCreditAutoTopupGrantCount() { return billingCreditAutoTopupGrantCount; } @@ -143,7 +143,7 @@ public Optional getCredit() { } @JsonProperty("expired_grant_count") - public int getExpiredGrantCount() { + public long getExpiredGrantCount() { return expiredGrantCount; } @@ -163,12 +163,12 @@ public OffsetDateTime getFirstTransactionAt() { } @JsonProperty("free_grant_count") - public int getFreeGrantCount() { + public long getFreeGrantCount() { return freeGrantCount; } @JsonProperty("grant_count") - public int getGrantCount() { + public long getGrantCount() { return grantCount; } @@ -178,7 +178,7 @@ public OffsetDateTime getLastTransactionAt() { } @JsonProperty("manually_zeroed_count") - public int getManuallyZeroedCount() { + public long getManuallyZeroedCount() { return manuallyZeroedCount; } @@ -188,12 +188,12 @@ public double getNetChange() { } @JsonProperty("plan_grant_count") - public int getPlanGrantCount() { + public long getPlanGrantCount() { return planGrantCount; } @JsonProperty("purchased_grant_count") - public int getPurchasedGrantCount() { + public long getPurchasedGrantCount() { return purchasedGrantCount; } @@ -213,17 +213,17 @@ public double getTotalGranted() { } @JsonProperty("transaction_count") - public int getTransactionCount() { + public long getTransactionCount() { return transactionCount; } @JsonProperty("usage_count") - public int getUsageCount() { + public long getUsageCount() { return usageCount; } @JsonProperty("zeroed_out_count") - public int getZeroedOutCount() { + public long getZeroedOutCount() { return zeroedOutCount; } @@ -301,7 +301,7 @@ public static BillingCreditAutoTopupGrantCountStage builder() { } public interface BillingCreditAutoTopupGrantCountStage { - BillingCreditIdStage billingCreditAutoTopupGrantCount(int billingCreditAutoTopupGrantCount); + BillingCreditIdStage billingCreditAutoTopupGrantCount(long billingCreditAutoTopupGrantCount); Builder from(CreditLedgerEnrichedEntryResponseData other); } @@ -315,7 +315,7 @@ public interface CompanyIdStage { } public interface ExpiredGrantCountStage { - FirstTransactionAtStage expiredGrantCount(int expiredGrantCount); + FirstTransactionAtStage expiredGrantCount(long expiredGrantCount); } public interface FirstTransactionAtStage { @@ -323,11 +323,11 @@ public interface FirstTransactionAtStage { } public interface FreeGrantCountStage { - GrantCountStage freeGrantCount(int freeGrantCount); + GrantCountStage freeGrantCount(long freeGrantCount); } public interface GrantCountStage { - LastTransactionAtStage grantCount(int grantCount); + LastTransactionAtStage grantCount(long grantCount); } public interface LastTransactionAtStage { @@ -335,7 +335,7 @@ public interface LastTransactionAtStage { } public interface ManuallyZeroedCountStage { - NetChangeStage manuallyZeroedCount(int manuallyZeroedCount); + NetChangeStage manuallyZeroedCount(long manuallyZeroedCount); } public interface NetChangeStage { @@ -343,11 +343,11 @@ public interface NetChangeStage { } public interface PlanGrantCountStage { - PurchasedGrantCountStage planGrantCount(int planGrantCount); + PurchasedGrantCountStage planGrantCount(long planGrantCount); } public interface PurchasedGrantCountStage { - TimeBucketStage purchasedGrantCount(int purchasedGrantCount); + TimeBucketStage purchasedGrantCount(long purchasedGrantCount); } public interface TimeBucketStage { @@ -363,20 +363,24 @@ public interface TotalGrantedStage { } public interface TransactionCountStage { - UsageCountStage transactionCount(int transactionCount); + UsageCountStage transactionCount(long transactionCount); } public interface UsageCountStage { - ZeroedOutCountStage usageCount(int usageCount); + ZeroedOutCountStage usageCount(long usageCount); } public interface ZeroedOutCountStage { - _FinalStage zeroedOutCount(int zeroedOutCount); + _FinalStage zeroedOutCount(long zeroedOutCount); } public interface _FinalStage { CreditLedgerEnrichedEntryResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage company(Optional company); _FinalStage company(CompanyLedgerResponseData company); @@ -415,29 +419,29 @@ public static final class Builder UsageCountStage, ZeroedOutCountStage, _FinalStage { - private int billingCreditAutoTopupGrantCount; + private long billingCreditAutoTopupGrantCount; private String billingCreditId; private String companyId; - private int expiredGrantCount; + private long expiredGrantCount; private OffsetDateTime firstTransactionAt; - private int freeGrantCount; + private long freeGrantCount; - private int grantCount; + private long grantCount; private OffsetDateTime lastTransactionAt; - private int manuallyZeroedCount; + private long manuallyZeroedCount; private double netChange; - private int planGrantCount; + private long planGrantCount; - private int purchasedGrantCount; + private long purchasedGrantCount; private OffsetDateTime timeBucket; @@ -445,11 +449,11 @@ public static final class Builder private double totalGranted; - private int transactionCount; + private long transactionCount; - private int usageCount; + private long usageCount; - private int zeroedOutCount; + private long zeroedOutCount; private Optional featureId = Optional.empty(); @@ -493,7 +497,7 @@ public Builder from(CreditLedgerEnrichedEntryResponseData other) { @java.lang.Override @JsonSetter("billing_credit_auto_topup_grant_count") - public BillingCreditIdStage billingCreditAutoTopupGrantCount(int billingCreditAutoTopupGrantCount) { + public BillingCreditIdStage billingCreditAutoTopupGrantCount(long billingCreditAutoTopupGrantCount) { this.billingCreditAutoTopupGrantCount = billingCreditAutoTopupGrantCount; return this; } @@ -514,7 +518,7 @@ public ExpiredGrantCountStage companyId(@NotNull String companyId) { @java.lang.Override @JsonSetter("expired_grant_count") - public FirstTransactionAtStage expiredGrantCount(int expiredGrantCount) { + public FirstTransactionAtStage expiredGrantCount(long expiredGrantCount) { this.expiredGrantCount = expiredGrantCount; return this; } @@ -528,14 +532,14 @@ public FreeGrantCountStage firstTransactionAt(@NotNull OffsetDateTime firstTrans @java.lang.Override @JsonSetter("free_grant_count") - public GrantCountStage freeGrantCount(int freeGrantCount) { + public GrantCountStage freeGrantCount(long freeGrantCount) { this.freeGrantCount = freeGrantCount; return this; } @java.lang.Override @JsonSetter("grant_count") - public LastTransactionAtStage grantCount(int grantCount) { + public LastTransactionAtStage grantCount(long grantCount) { this.grantCount = grantCount; return this; } @@ -549,7 +553,7 @@ public ManuallyZeroedCountStage lastTransactionAt(@NotNull OffsetDateTime lastTr @java.lang.Override @JsonSetter("manually_zeroed_count") - public NetChangeStage manuallyZeroedCount(int manuallyZeroedCount) { + public NetChangeStage manuallyZeroedCount(long manuallyZeroedCount) { this.manuallyZeroedCount = manuallyZeroedCount; return this; } @@ -563,14 +567,14 @@ public PlanGrantCountStage netChange(double netChange) { @java.lang.Override @JsonSetter("plan_grant_count") - public PurchasedGrantCountStage planGrantCount(int planGrantCount) { + public PurchasedGrantCountStage planGrantCount(long planGrantCount) { this.planGrantCount = planGrantCount; return this; } @java.lang.Override @JsonSetter("purchased_grant_count") - public TimeBucketStage purchasedGrantCount(int purchasedGrantCount) { + public TimeBucketStage purchasedGrantCount(long purchasedGrantCount) { this.purchasedGrantCount = purchasedGrantCount; return this; } @@ -598,21 +602,21 @@ public TransactionCountStage totalGranted(double totalGranted) { @java.lang.Override @JsonSetter("transaction_count") - public UsageCountStage transactionCount(int transactionCount) { + public UsageCountStage transactionCount(long transactionCount) { this.transactionCount = transactionCount; return this; } @java.lang.Override @JsonSetter("usage_count") - public ZeroedOutCountStage usageCount(int usageCount) { + public ZeroedOutCountStage usageCount(long usageCount) { this.usageCount = usageCount; return this; } @java.lang.Override @JsonSetter("zeroed_out_count") - public _FinalStage zeroedOutCount(int zeroedOutCount) { + public _FinalStage zeroedOutCount(long zeroedOutCount) { this.zeroedOutCount = zeroedOutCount; return this; } @@ -696,5 +700,17 @@ public CreditLedgerEnrichedEntryResponseData build() { zeroedOutCount, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditTransferResponseData.java b/src/main/java/com/schematic/api/types/CreditTransferResponseData.java index f443066..bba7c4f 100644 --- a/src/main/java/com/schematic/api/types/CreditTransferResponseData.java +++ b/src/main/java/com/schematic/api/types/CreditTransferResponseData.java @@ -143,6 +143,10 @@ public interface RelatedGrantIdStage { public interface _FinalStage { CreditTransferResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -229,5 +233,17 @@ public CreditTransferResponseData build() { return new CreditTransferResponseData( amount, createdAt, direction, id, reason, relatedGrantId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditTransferView.java b/src/main/java/com/schematic/api/types/CreditTransferView.java index 555932e..ff6d480 100644 --- a/src/main/java/com/schematic/api/types/CreditTransferView.java +++ b/src/main/java/com/schematic/api/types/CreditTransferView.java @@ -143,6 +143,10 @@ public interface RelatedGrantIdStage { public interface _FinalStage { CreditTransferView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -229,5 +233,17 @@ public CreditTransferView build() { return new CreditTransferView( amount, createdAt, direction, id, reason, relatedGrantId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditTriggerConfig.java b/src/main/java/com/schematic/api/types/CreditTriggerConfig.java index c62d75d..3889c99 100644 --- a/src/main/java/com/schematic/api/types/CreditTriggerConfig.java +++ b/src/main/java/com/schematic/api/types/CreditTriggerConfig.java @@ -70,6 +70,10 @@ public interface CreditIdStage { public interface _FinalStage { CreditTriggerConfig build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -98,5 +102,17 @@ public _FinalStage creditId(@NotNull String creditId) { public CreditTriggerConfig build() { return new CreditTriggerConfig(creditId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditUsage.java b/src/main/java/com/schematic/api/types/CreditUsage.java index 9e41dd4..a3f6648 100644 --- a/src/main/java/com/schematic/api/types/CreditUsage.java +++ b/src/main/java/com/schematic/api/types/CreditUsage.java @@ -305,5 +305,15 @@ public CreditUsage build() { usageAggregation, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditUsageAggregation.java b/src/main/java/com/schematic/api/types/CreditUsageAggregation.java index 0c75da7..1ed15de 100644 --- a/src/main/java/com/schematic/api/types/CreditUsageAggregation.java +++ b/src/main/java/com/schematic/api/types/CreditUsageAggregation.java @@ -191,5 +191,15 @@ public CreditUsageAggregation build() { return new CreditUsageAggregation( usageThisBillingPeriod, usageThisCalendarMonth, usageThisWeek, usageToday, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditUsageResponseData.java b/src/main/java/com/schematic/api/types/CreditUsageResponseData.java deleted file mode 100644 index 3bf4a27..0000000 --- a/src/main/java/com/schematic/api/types/CreditUsageResponseData.java +++ /dev/null @@ -1,300 +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; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreditUsageResponseData.Builder.class) -public final class CreditUsageResponseData { - private final Optional creditConsumptionRate; - - private final Optional> creditGrantCounts; - - private final List creditGrantDetails; - - private final Optional creditRemaining; - - private final Optional creditTotal; - - private final Optional creditTypeIcon; - - private final Optional creditTypeName; - - private final Optional creditUsed; - - private final Map additionalProperties; - - private CreditUsageResponseData( - Optional creditConsumptionRate, - Optional> creditGrantCounts, - List creditGrantDetails, - Optional creditRemaining, - Optional creditTotal, - Optional creditTypeIcon, - Optional creditTypeName, - Optional creditUsed, - Map additionalProperties) { - this.creditConsumptionRate = creditConsumptionRate; - this.creditGrantCounts = creditGrantCounts; - this.creditGrantDetails = creditGrantDetails; - this.creditRemaining = creditRemaining; - this.creditTotal = creditTotal; - this.creditTypeIcon = creditTypeIcon; - this.creditTypeName = creditTypeName; - this.creditUsed = creditUsed; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("credit_consumption_rate") - public Optional getCreditConsumptionRate() { - return creditConsumptionRate; - } - - @JsonProperty("credit_grant_counts") - public Optional> getCreditGrantCounts() { - return creditGrantCounts; - } - - @JsonProperty("credit_grant_details") - public List getCreditGrantDetails() { - return creditGrantDetails; - } - - @JsonProperty("credit_remaining") - public Optional getCreditRemaining() { - return creditRemaining; - } - - /** - * @return Deprecated: Use credit_remaining instead. - */ - @JsonProperty("credit_total") - public Optional getCreditTotal() { - return creditTotal; - } - - @JsonProperty("credit_type_icon") - public Optional getCreditTypeIcon() { - return creditTypeIcon; - } - - @JsonProperty("credit_type_name") - public Optional getCreditTypeName() { - return creditTypeName; - } - - @JsonProperty("credit_used") - public Optional getCreditUsed() { - return creditUsed; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreditUsageResponseData && equalTo((CreditUsageResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreditUsageResponseData other) { - return creditConsumptionRate.equals(other.creditConsumptionRate) - && creditGrantCounts.equals(other.creditGrantCounts) - && creditGrantDetails.equals(other.creditGrantDetails) - && creditRemaining.equals(other.creditRemaining) - && creditTotal.equals(other.creditTotal) - && creditTypeIcon.equals(other.creditTypeIcon) - && creditTypeName.equals(other.creditTypeName) - && creditUsed.equals(other.creditUsed); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.creditConsumptionRate, - this.creditGrantCounts, - this.creditGrantDetails, - this.creditRemaining, - this.creditTotal, - this.creditTypeIcon, - this.creditTypeName, - this.creditUsed); - } - - @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 creditConsumptionRate = Optional.empty(); - - private Optional> creditGrantCounts = Optional.empty(); - - private List creditGrantDetails = new ArrayList<>(); - - private Optional creditRemaining = Optional.empty(); - - private Optional creditTotal = Optional.empty(); - - private Optional creditTypeIcon = Optional.empty(); - - private Optional creditTypeName = Optional.empty(); - - private Optional creditUsed = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CreditUsageResponseData other) { - creditConsumptionRate(other.getCreditConsumptionRate()); - creditGrantCounts(other.getCreditGrantCounts()); - creditGrantDetails(other.getCreditGrantDetails()); - creditRemaining(other.getCreditRemaining()); - creditTotal(other.getCreditTotal()); - creditTypeIcon(other.getCreditTypeIcon()); - creditTypeName(other.getCreditTypeName()); - creditUsed(other.getCreditUsed()); - return this; - } - - @JsonSetter(value = "credit_consumption_rate", nulls = Nulls.SKIP) - public Builder creditConsumptionRate(Optional creditConsumptionRate) { - this.creditConsumptionRate = creditConsumptionRate; - return this; - } - - public Builder creditConsumptionRate(Double creditConsumptionRate) { - this.creditConsumptionRate = Optional.ofNullable(creditConsumptionRate); - return this; - } - - @JsonSetter(value = "credit_grant_counts", nulls = Nulls.SKIP) - public Builder creditGrantCounts(Optional> creditGrantCounts) { - this.creditGrantCounts = creditGrantCounts; - return this; - } - - public Builder creditGrantCounts(Map creditGrantCounts) { - this.creditGrantCounts = Optional.ofNullable(creditGrantCounts); - return this; - } - - @JsonSetter(value = "credit_grant_details", nulls = Nulls.SKIP) - public Builder creditGrantDetails(List creditGrantDetails) { - this.creditGrantDetails.clear(); - if (creditGrantDetails != null) { - this.creditGrantDetails.addAll(creditGrantDetails); - } - return this; - } - - public Builder addCreditGrantDetails(CreditGrantDetail creditGrantDetails) { - this.creditGrantDetails.add(creditGrantDetails); - return this; - } - - public Builder addAllCreditGrantDetails(List creditGrantDetails) { - if (creditGrantDetails != null) { - this.creditGrantDetails.addAll(creditGrantDetails); - } - return this; - } - - @JsonSetter(value = "credit_remaining", nulls = Nulls.SKIP) - public Builder creditRemaining(Optional creditRemaining) { - this.creditRemaining = creditRemaining; - return this; - } - - public Builder creditRemaining(Double creditRemaining) { - this.creditRemaining = Optional.ofNullable(creditRemaining); - return this; - } - - /** - *

Deprecated: Use credit_remaining instead.

- */ - @JsonSetter(value = "credit_total", nulls = Nulls.SKIP) - public Builder creditTotal(Optional creditTotal) { - this.creditTotal = creditTotal; - return this; - } - - public Builder creditTotal(Double creditTotal) { - this.creditTotal = Optional.ofNullable(creditTotal); - return this; - } - - @JsonSetter(value = "credit_type_icon", nulls = Nulls.SKIP) - public Builder creditTypeIcon(Optional creditTypeIcon) { - this.creditTypeIcon = creditTypeIcon; - return this; - } - - public Builder creditTypeIcon(String creditTypeIcon) { - this.creditTypeIcon = Optional.ofNullable(creditTypeIcon); - return this; - } - - @JsonSetter(value = "credit_type_name", nulls = Nulls.SKIP) - public Builder creditTypeName(Optional creditTypeName) { - this.creditTypeName = creditTypeName; - return this; - } - - public Builder creditTypeName(String creditTypeName) { - this.creditTypeName = Optional.ofNullable(creditTypeName); - return this; - } - - @JsonSetter(value = "credit_used", nulls = Nulls.SKIP) - public Builder creditUsed(Optional creditUsed) { - this.creditUsed = creditUsed; - return this; - } - - public Builder creditUsed(Double creditUsed) { - this.creditUsed = Optional.ofNullable(creditUsed); - return this; - } - - public CreditUsageResponseData build() { - return new CreditUsageResponseData( - creditConsumptionRate, - creditGrantCounts, - creditGrantDetails, - creditRemaining, - creditTotal, - creditTypeIcon, - creditTypeName, - creditUsed, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java index 6f50961..d3fe6c9 100644 --- a/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupCompanySummary.java @@ -82,6 +82,10 @@ public interface NameStage { public interface _FinalStage { CreditsAutoTopupCompanySummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -120,5 +124,17 @@ public _FinalStage name(@NotNull String name) { public CreditsAutoTopupCompanySummary build() { return new CreditsAutoTopupCompanySummary(id, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java index e33893f..8eeda60 100644 --- a/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupCreditSummary.java @@ -82,6 +82,10 @@ public interface NameStage { public interface _FinalStage { CreditsAutoTopupCreditSummary build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -120,5 +124,17 @@ public _FinalStage name(@NotNull String name) { public CreditsAutoTopupCreditSummary build() { return new CreditsAutoTopupCreditSummary(id, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.java index b9778df..70f2049 100644 --- a/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.java +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupHardFailure.java @@ -166,5 +166,15 @@ public CreditsAutoTopupHardFailure build() { return new CreditsAutoTopupHardFailure( company, credit, errorMessage, stripeErrorCode, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java b/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java index d37b85d..62548a7 100644 --- a/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java +++ b/src/main/java/com/schematic/api/types/CreditsAutoTopupRetryFailure.java @@ -22,7 +22,7 @@ public final class CreditsAutoTopupRetryFailure { private final Optional company; - private final int consecutiveFailures; + private final long consecutiveFailures; private final Optional credit; @@ -34,7 +34,7 @@ public final class CreditsAutoTopupRetryFailure { private CreditsAutoTopupRetryFailure( Optional company, - int consecutiveFailures, + long consecutiveFailures, Optional credit, Optional lastErrorMessage, Optional stripeErrorCode, @@ -53,7 +53,7 @@ public Optional getCompany() { } @JsonProperty("consecutive_failures") - public int getConsecutiveFailures() { + public long getConsecutiveFailures() { return consecutiveFailures; } @@ -107,7 +107,7 @@ public static ConsecutiveFailuresStage builder() { } public interface ConsecutiveFailuresStage { - _FinalStage consecutiveFailures(int consecutiveFailures); + _FinalStage consecutiveFailures(long consecutiveFailures); Builder from(CreditsAutoTopupRetryFailure other); } @@ -115,6 +115,10 @@ public interface ConsecutiveFailuresStage { public interface _FinalStage { CreditsAutoTopupRetryFailure build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage company(Optional company); _FinalStage company(CreditsAutoTopupCompanySummary company); @@ -134,7 +138,7 @@ public interface _FinalStage { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ConsecutiveFailuresStage, _FinalStage { - private int consecutiveFailures; + private long consecutiveFailures; private Optional stripeErrorCode = Optional.empty(); @@ -161,7 +165,7 @@ public Builder from(CreditsAutoTopupRetryFailure other) { @java.lang.Override @JsonSetter("consecutive_failures") - public _FinalStage consecutiveFailures(int consecutiveFailures) { + public _FinalStage consecutiveFailures(long consecutiveFailures) { this.consecutiveFailures = consecutiveFailures; return this; } @@ -223,5 +227,17 @@ public CreditsAutoTopupRetryFailure build() { return new CreditsAutoTopupRetryFailure( company, consecutiveFailures, credit, lastErrorMessage, stripeErrorCode, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CustomPlanConfig.java b/src/main/java/com/schematic/api/types/CustomPlanConfig.java index 122bc42..d44ead1 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanConfig.java +++ b/src/main/java/com/schematic/api/types/CustomPlanConfig.java @@ -97,6 +97,10 @@ public interface PriceTextStage { public interface _FinalStage { CustomPlanConfig build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -145,5 +149,17 @@ public _FinalStage priceText(@NotNull String priceText) { public CustomPlanConfig build() { return new CustomPlanConfig(ctaText, ctaWebSite, priceText, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/CustomPlanViewConfigResponseData.java b/src/main/java/com/schematic/api/types/CustomPlanViewConfigResponseData.java index d4d9c45..981ab66 100644 --- a/src/main/java/com/schematic/api/types/CustomPlanViewConfigResponseData.java +++ b/src/main/java/com/schematic/api/types/CustomPlanViewConfigResponseData.java @@ -97,6 +97,10 @@ public interface PriceTextStage { public interface _FinalStage { CustomPlanViewConfigResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -145,5 +149,17 @@ public _FinalStage priceText(@NotNull String priceText) { public CustomPlanViewConfigResponseData build() { return new CustomPlanViewConfigResponseData(ctaText, ctaWebSite, priceText, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/DataEventPayload.java b/src/main/java/com/schematic/api/types/DataEventPayload.java new file mode 100644 index 0000000..9692641 --- /dev/null +++ b/src/main/java/com/schematic/api/types/DataEventPayload.java @@ -0,0 +1,208 @@ +/** + * 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 = DataEventPayload.Builder.class) +public final class DataEventPayload { + private final String apiKey; + + private final Optional> body; + + private final Optional sentAt; + + private final EventType type; + + private final Map additionalProperties; + + private DataEventPayload( + String apiKey, + Optional> body, + Optional sentAt, + EventType type, + Map additionalProperties) { + this.apiKey = apiKey; + this.body = body; + this.sentAt = sentAt; + this.type = type; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("api_key") + public String getApiKey() { + return apiKey; + } + + @JsonProperty("body") + public Optional> getBody() { + return body; + } + + @JsonProperty("sent_at") + public Optional getSentAt() { + return sentAt; + } + + @JsonProperty("type") + public EventType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DataEventPayload && equalTo((DataEventPayload) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DataEventPayload other) { + return apiKey.equals(other.apiKey) + && body.equals(other.body) + && sentAt.equals(other.sentAt) + && type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.body, this.sentAt, this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + TypeStage apiKey(@NotNull String apiKey); + + Builder from(DataEventPayload other); + } + + public interface TypeStage { + _FinalStage type(@NotNull EventType type); + } + + public interface _FinalStage { + DataEventPayload build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage body(Optional> body); + + _FinalStage body(Map body); + + _FinalStage sentAt(Optional sentAt); + + _FinalStage sentAt(OffsetDateTime sentAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, TypeStage, _FinalStage { + private String apiKey; + + private EventType type; + + private Optional sentAt = Optional.empty(); + + private Optional> body = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DataEventPayload other) { + apiKey(other.getApiKey()); + body(other.getBody()); + sentAt(other.getSentAt()); + type(other.getType()); + return this; + } + + @java.lang.Override + @JsonSetter("api_key") + public TypeStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull EventType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage sentAt(OffsetDateTime sentAt) { + this.sentAt = Optional.ofNullable(sentAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "sent_at", nulls = Nulls.SKIP) + public _FinalStage sentAt(Optional sentAt) { + this.sentAt = sentAt; + return this; + } + + @java.lang.Override + public _FinalStage body(Map body) { + this.body = Optional.ofNullable(body); + return this; + } + + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Optional> body) { + this.body = body; + return this; + } + + @java.lang.Override + public DataEventPayload build() { + return new DataEventPayload(apiKey, body, sentAt, type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/DataExportResponseData.java b/src/main/java/com/schematic/api/types/DataExportResponseData.java index 4deef38..9fd815d 100644 --- a/src/main/java/com/schematic/api/types/DataExportResponseData.java +++ b/src/main/java/com/schematic/api/types/DataExportResponseData.java @@ -194,6 +194,10 @@ public interface UpdatedAtStage { public interface _FinalStage { DataExportResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -322,5 +326,17 @@ public DataExportResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java b/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java new file mode 100644 index 0000000..a3323cf --- /dev/null +++ b/src/main/java/com/schematic/api/types/DatastreamCompanyPlan.java @@ -0,0 +1,172 @@ +/** + * 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 = DatastreamCompanyPlan.Builder.class) +public final class DatastreamCompanyPlan { + private final String id; + + private final String name; + + private final Optional trialEndDate; + + private final Map additionalProperties; + + private DatastreamCompanyPlan( + String id, String name, Optional trialEndDate, Map additionalProperties) { + this.id = id; + this.name = name; + this.trialEndDate = trialEndDate; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("trial_end_date") + public Optional getTrialEndDate() { + return trialEndDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DatastreamCompanyPlan && equalTo((DatastreamCompanyPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DatastreamCompanyPlan other) { + return id.equals(other.id) && name.equals(other.name) && trialEndDate.equals(other.trialEndDate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.trialEndDate); + } + + @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(DatastreamCompanyPlan other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + DatastreamCompanyPlan build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage trialEndDate(Optional trialEndDate); + + _FinalStage trialEndDate(OffsetDateTime trialEndDate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + private Optional trialEndDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DatastreamCompanyPlan other) { + id(other.getId()); + name(other.getName()); + trialEndDate(other.getTrialEndDate()); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage trialEndDate(OffsetDateTime trialEndDate) { + this.trialEndDate = Optional.ofNullable(trialEndDate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trial_end_date", nulls = Nulls.SKIP) + public _FinalStage trialEndDate(Optional trialEndDate) { + this.trialEndDate = trialEndDate; + return this; + } + + @java.lang.Override + public DatastreamCompanyPlan build() { + return new DatastreamCompanyPlan(id, name, trialEndDate, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java index 9f1903c..e2528ee 100644 --- a/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/DeleteBillingPlanCreditGrantRequestBody.java @@ -93,5 +93,15 @@ public Builder applyToExisting(Boolean applyToExisting) { public DeleteBillingPlanCreditGrantRequestBody build() { return new DeleteBillingPlanCreditGrantRequestBody(applyToExisting, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/DeleteResponse.java b/src/main/java/com/schematic/api/types/DeleteResponse.java index 94308eb..b551bca 100644 --- a/src/main/java/com/schematic/api/types/DeleteResponse.java +++ b/src/main/java/com/schematic/api/types/DeleteResponse.java @@ -97,5 +97,15 @@ public Builder deleted(Boolean deleted) { public DeleteResponse build() { return new DeleteResponse(deleted, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java b/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java index b7e92c9..7dac7ab 100644 --- a/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java +++ b/src/main/java/com/schematic/api/types/DuplicatePlanEntitlementsResponseResponseData.java @@ -138,5 +138,15 @@ public Builder addAllSkipped(List skipped) { public DuplicatePlanEntitlementsResponseResponseData build() { return new DuplicatePlanEntitlementsResponseResponseData(data, skipped, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntitlementCurrencyPricesResponseData.java b/src/main/java/com/schematic/api/types/EntitlementCurrencyPricesResponseData.java new file mode 100644 index 0000000..a2fce3f --- /dev/null +++ b/src/main/java/com/schematic/api/types/EntitlementCurrencyPricesResponseData.java @@ -0,0 +1,183 @@ +/** + * 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 = EntitlementCurrencyPricesResponseData.Builder.class) +public final class EntitlementCurrencyPricesResponseData { + private final String currency; + + private final Optional monthlyPrice; + + private final Optional yearlyPrice; + + private final Map additionalProperties; + + private EntitlementCurrencyPricesResponseData( + String currency, + Optional monthlyPrice, + Optional yearlyPrice, + Map additionalProperties) { + this.currency = currency; + this.monthlyPrice = monthlyPrice; + this.yearlyPrice = yearlyPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("monthly_price") + public Optional getMonthlyPrice() { + return monthlyPrice; + } + + @JsonProperty("yearly_price") + public Optional getYearlyPrice() { + return yearlyPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EntitlementCurrencyPricesResponseData + && equalTo((EntitlementCurrencyPricesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EntitlementCurrencyPricesResponseData other) { + return currency.equals(other.currency) + && monthlyPrice.equals(other.monthlyPrice) + && yearlyPrice.equals(other.yearlyPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.monthlyPrice, this.yearlyPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(EntitlementCurrencyPricesResponseData other); + } + + public interface _FinalStage { + EntitlementCurrencyPricesResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(BillingPriceView monthlyPrice); + + _FinalStage yearlyPrice(Optional yearlyPrice); + + _FinalStage yearlyPrice(BillingPriceView yearlyPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional yearlyPrice = Optional.empty(); + + private Optional monthlyPrice = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EntitlementCurrencyPricesResponseData other) { + currency(other.getCurrency()); + monthlyPrice(other.getMonthlyPrice()); + yearlyPrice(other.getYearlyPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage yearlyPrice(BillingPriceView yearlyPrice) { + this.yearlyPrice = Optional.ofNullable(yearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) + public _FinalStage yearlyPrice(Optional yearlyPrice) { + this.yearlyPrice = yearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPrice(BillingPriceView monthlyPrice) { + this.monthlyPrice = Optional.ofNullable(monthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) + public _FinalStage monthlyPrice(Optional monthlyPrice) { + this.monthlyPrice = monthlyPrice; + return this; + } + + @java.lang.Override + public EntitlementCurrencyPricesResponseData build() { + return new EntitlementCurrencyPricesResponseData(currency, monthlyPrice, yearlyPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/EntitlementTriggerConfig.java b/src/main/java/com/schematic/api/types/EntitlementTriggerConfig.java index 19f5934..609de08 100644 --- a/src/main/java/com/schematic/api/types/EntitlementTriggerConfig.java +++ b/src/main/java/com/schematic/api/types/EntitlementTriggerConfig.java @@ -70,6 +70,10 @@ public interface FeatureIdStage { public interface _FinalStage { EntitlementTriggerConfig build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -98,5 +102,17 @@ public _FinalStage featureId(@NotNull String featureId) { public EntitlementTriggerConfig build() { return new EntitlementTriggerConfig(featureId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntitlementsInPlan.java b/src/main/java/com/schematic/api/types/EntitlementsInPlan.java index a53d748..7b5d1c0 100644 --- a/src/main/java/com/schematic/api/types/EntitlementsInPlan.java +++ b/src/main/java/com/schematic/api/types/EntitlementsInPlan.java @@ -82,6 +82,10 @@ public interface EntitlementIdStage { public interface _FinalStage { EntitlementsInPlan build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage visible(Optional visible); _FinalStage visible(Boolean visible); @@ -129,5 +133,17 @@ public _FinalStage visible(Optional visible) { public EntitlementsInPlan build() { return new EntitlementsInPlan(entitlementId, visible, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java b/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java index 4acbdb1..adf1153 100644 --- a/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityKeyDefinitionResponseData.java @@ -129,6 +129,10 @@ public interface UpdatedAtStage { public interface _FinalStage { EntityKeyDefinitionResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -198,5 +202,17 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { public EntityKeyDefinitionResponseData build() { return new EntityKeyDefinitionResponseData(createdAt, entityType, id, key, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java b/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java index 1194f02..1080b5a 100644 --- a/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityKeyDetailResponseData.java @@ -208,6 +208,10 @@ public interface ValueStage { public interface _FinalStage { EntityKeyDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage definition(Optional definition); _FinalStage definition(EntityKeyDefinitionResponseData definition); @@ -356,5 +360,17 @@ public EntityKeyDetailResponseData build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityKeyResponseData.java b/src/main/java/com/schematic/api/types/EntityKeyResponseData.java index bb6100e..fcf0a0c 100644 --- a/src/main/java/com/schematic/api/types/EntityKeyResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityKeyResponseData.java @@ -194,6 +194,10 @@ public interface ValueStage { public interface _FinalStage { EntityKeyResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -322,5 +326,17 @@ public EntityKeyResponseData build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java b/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java index 87b7879..b4f6010 100644 --- a/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityTraitDefinitionResponseData.java @@ -164,6 +164,10 @@ public interface UpdatedAtStage { public interface _FinalStage { EntityTraitDefinitionResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage hierarchy(List hierarchy); _FinalStage addHierarchy(String hierarchy); @@ -282,5 +286,17 @@ public EntityTraitDefinitionResponseData build() { return new EntityTraitDefinitionResponseData( createdAt, displayName, entityType, hierarchy, id, traitType, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityTraitDetailResponseData.java b/src/main/java/com/schematic/api/types/EntityTraitDetailResponseData.java index f85315a..6d37294 100644 --- a/src/main/java/com/schematic/api/types/EntityTraitDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityTraitDetailResponseData.java @@ -163,6 +163,10 @@ public interface ValueStage { public interface _FinalStage { EntityTraitDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage definition(Optional definition); _FinalStage definition(EntityTraitDefinitionResponseData definition); @@ -268,5 +272,17 @@ public EntityTraitDetailResponseData build() { return new EntityTraitDetailResponseData( createdAt, definition, definitionId, environmentId, id, updatedAt, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityTraitResponseData.java b/src/main/java/com/schematic/api/types/EntityTraitResponseData.java index 9bc7990..6453bc2 100644 --- a/src/main/java/com/schematic/api/types/EntityTraitResponseData.java +++ b/src/main/java/com/schematic/api/types/EntityTraitResponseData.java @@ -143,6 +143,10 @@ public interface ValueStage { public interface _FinalStage { EntityTraitResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -229,5 +233,17 @@ public EntityTraitResponseData build() { return new EntityTraitResponseData( createdAt, definitionId, environmentId, id, updatedAt, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EntityTraitValue.java b/src/main/java/com/schematic/api/types/EntityTraitValue.java index be38ed9..f591bbf 100644 --- a/src/main/java/com/schematic/api/types/EntityTraitValue.java +++ b/src/main/java/com/schematic/api/types/EntityTraitValue.java @@ -82,6 +82,10 @@ public interface ValueStage { public interface _FinalStage { EntityTraitValue build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -120,5 +124,17 @@ public _FinalStage value(@NotNull String value) { public EntityTraitValue build() { return new EntityTraitValue(definitionId, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java b/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java index 08aa523..9ac2aaa 100644 --- a/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EnvironmentDetailResponseData.java @@ -143,6 +143,10 @@ public interface UpdatedAtStage { public interface _FinalStage { EnvironmentDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage apiKeys(List apiKeys); _FinalStage addApiKeys(ApiKeyResponseData apiKeys); @@ -245,5 +249,17 @@ public EnvironmentDetailResponseData build() { return new EnvironmentDetailResponseData( apiKeys, createdAt, environmentType, id, name, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EnvironmentResponseData.java b/src/main/java/com/schematic/api/types/EnvironmentResponseData.java index b1c88ed..25f6e41 100644 --- a/src/main/java/com/schematic/api/types/EnvironmentResponseData.java +++ b/src/main/java/com/schematic/api/types/EnvironmentResponseData.java @@ -129,6 +129,10 @@ public interface UpdatedAtStage { public interface _FinalStage { EnvironmentResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -198,5 +202,17 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { public EnvironmentResponseData build() { return new EnvironmentResponseData(createdAt, environmentType, id, name, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java b/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java index 951a3a3..56c26d1 100644 --- a/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java +++ b/src/main/java/com/schematic/api/types/EventBodyFlagCheck.java @@ -222,6 +222,10 @@ public interface ValueStage { public interface _FinalStage { EventBodyFlagCheck build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Schematic company ID (starting with 'comp_') of the company evaluated, if any

*/ @@ -505,5 +509,17 @@ public EventBodyFlagCheck build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventBodyIdentify.java b/src/main/java/com/schematic/api/types/EventBodyIdentify.java index 4fa0403..f5ca648 100644 --- a/src/main/java/com/schematic/api/types/EventBodyIdentify.java +++ b/src/main/java/com/schematic/api/types/EventBodyIdentify.java @@ -201,5 +201,15 @@ public Builder traits(Map traits) { public EventBodyIdentify build() { return new EventBodyIdentify(company, keys, name, traits, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventBodyIdentifyCompany.java b/src/main/java/com/schematic/api/types/EventBodyIdentifyCompany.java index 3d8a1dd..961dbf3 100644 --- a/src/main/java/com/schematic/api/types/EventBodyIdentifyCompany.java +++ b/src/main/java/com/schematic/api/types/EventBodyIdentifyCompany.java @@ -169,5 +169,15 @@ public Builder traits(Map traits) { public EventBodyIdentifyCompany build() { return new EventBodyIdentifyCompany(keys, name, traits, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventBodyTrack.java b/src/main/java/com/schematic/api/types/EventBodyTrack.java index b33576d..4585ad5 100644 --- a/src/main/java/com/schematic/api/types/EventBodyTrack.java +++ b/src/main/java/com/schematic/api/types/EventBodyTrack.java @@ -134,6 +134,10 @@ public interface EventStage { public interface _FinalStage { EventBodyTrack build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Key-value pairs to identify company associated with track event

*/ @@ -286,5 +290,17 @@ public _FinalStage company(Optional> company) { public EventBodyTrack build() { return new EventBodyTrack(company, event, quantity, traits, user, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventDetailResponseData.java b/src/main/java/com/schematic/api/types/EventDetailResponseData.java index a31eaef..ca89d11 100644 --- a/src/main/java/com/schematic/api/types/EventDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/EventDetailResponseData.java @@ -54,7 +54,7 @@ public final class EventDetailResponseData { private final Optional processedAt; - private final int quantity; + private final long quantity; private final Optional sentAt; @@ -87,7 +87,7 @@ private EventDetailResponseData( String id, Optional loadedAt, Optional processedAt, - int quantity, + long quantity, Optional sentAt, EventStatus status, Optional subtype, @@ -192,7 +192,7 @@ public Optional getProcessedAt() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -318,7 +318,7 @@ public interface IdStage { } public interface QuantityStage { - StatusStage quantity(int quantity); + StatusStage quantity(long quantity); } public interface StatusStage { @@ -332,6 +332,10 @@ public interface TypeStage { public interface _FinalStage { EventDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage apiKey(Optional apiKey); _FinalStage apiKey(String apiKey); @@ -412,7 +416,7 @@ public static final class Builder private String id; - private int quantity; + private long quantity; private EventStatus status; @@ -505,7 +509,7 @@ public QuantityStage id(@NotNull String id) { @java.lang.Override @JsonSetter("quantity") - public StatusStage quantity(int quantity) { + public StatusStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -792,5 +796,17 @@ public EventDetailResponseData build() { userId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventResponseData.java b/src/main/java/com/schematic/api/types/EventResponseData.java index dc04ba4..6e4cfe9 100644 --- a/src/main/java/com/schematic/api/types/EventResponseData.java +++ b/src/main/java/com/schematic/api/types/EventResponseData.java @@ -50,7 +50,7 @@ public final class EventResponseData { private final Optional processedAt; - private final int quantity; + private final long quantity; private final Optional sentAt; @@ -79,7 +79,7 @@ private EventResponseData( String id, Optional loadedAt, Optional processedAt, - int quantity, + long quantity, Optional sentAt, EventStatus status, Optional subtype, @@ -170,7 +170,7 @@ public Optional getProcessedAt() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -285,7 +285,7 @@ public interface IdStage { } public interface QuantityStage { - StatusStage quantity(int quantity); + StatusStage quantity(long quantity); } public interface StatusStage { @@ -299,6 +299,10 @@ public interface TypeStage { public interface _FinalStage { EventResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage apiKey(Optional apiKey); _FinalStage apiKey(String apiKey); @@ -365,7 +369,7 @@ public static final class Builder private String id; - private int quantity; + private long quantity; private EventStatus status; @@ -449,7 +453,7 @@ public QuantityStage id(@NotNull String id) { @java.lang.Override @JsonSetter("quantity") - public StatusStage quantity(int quantity) { + public StatusStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -683,5 +687,17 @@ public EventResponseData build() { userId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/EventSummaryResponseData.java b/src/main/java/com/schematic/api/types/EventSummaryResponseData.java index 89cb3bb..8836058 100644 --- a/src/main/java/com/schematic/api/types/EventSummaryResponseData.java +++ b/src/main/java/com/schematic/api/types/EventSummaryResponseData.java @@ -22,27 +22,27 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = EventSummaryResponseData.Builder.class) public final class EventSummaryResponseData { - private final int companyCount; + private final long companyCount; private final String environmentId; - private final int eventCount; + private final long eventCount; private final String eventSubtype; private final Optional lastSeenAt; - private final int userCount; + private final long userCount; private final Map additionalProperties; private EventSummaryResponseData( - int companyCount, + long companyCount, String environmentId, - int eventCount, + long eventCount, String eventSubtype, Optional lastSeenAt, - int userCount, + long userCount, Map additionalProperties) { this.companyCount = companyCount; this.environmentId = environmentId; @@ -54,7 +54,7 @@ private EventSummaryResponseData( } @JsonProperty("company_count") - public int getCompanyCount() { + public long getCompanyCount() { return companyCount; } @@ -64,7 +64,7 @@ public String getEnvironmentId() { } @JsonProperty("event_count") - public int getEventCount() { + public long getEventCount() { return eventCount; } @@ -79,7 +79,7 @@ public Optional getLastSeenAt() { } @JsonProperty("user_count") - public int getUserCount() { + public long getUserCount() { return userCount; } @@ -124,7 +124,7 @@ public static CompanyCountStage builder() { } public interface CompanyCountStage { - EnvironmentIdStage companyCount(int companyCount); + EnvironmentIdStage companyCount(long companyCount); Builder from(EventSummaryResponseData other); } @@ -134,7 +134,7 @@ public interface EnvironmentIdStage { } public interface EventCountStage { - EventSubtypeStage eventCount(int eventCount); + EventSubtypeStage eventCount(long eventCount); } public interface EventSubtypeStage { @@ -142,12 +142,16 @@ public interface EventSubtypeStage { } public interface UserCountStage { - _FinalStage userCount(int userCount); + _FinalStage userCount(long userCount); } public interface _FinalStage { EventSummaryResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage lastSeenAt(Optional lastSeenAt); _FinalStage lastSeenAt(OffsetDateTime lastSeenAt); @@ -161,15 +165,15 @@ public static final class Builder EventSubtypeStage, UserCountStage, _FinalStage { - private int companyCount; + private long companyCount; private String environmentId; - private int eventCount; + private long eventCount; private String eventSubtype; - private int userCount; + private long userCount; private Optional lastSeenAt = Optional.empty(); @@ -191,7 +195,7 @@ public Builder from(EventSummaryResponseData other) { @java.lang.Override @JsonSetter("company_count") - public EnvironmentIdStage companyCount(int companyCount) { + public EnvironmentIdStage companyCount(long companyCount) { this.companyCount = companyCount; return this; } @@ -205,7 +209,7 @@ public EventCountStage environmentId(@NotNull String environmentId) { @java.lang.Override @JsonSetter("event_count") - public EventSubtypeStage eventCount(int eventCount) { + public EventSubtypeStage eventCount(long eventCount) { this.eventCount = eventCount; return this; } @@ -219,7 +223,7 @@ public UserCountStage eventSubtype(@NotNull String eventSubtype) { @java.lang.Override @JsonSetter("user_count") - public _FinalStage userCount(int userCount) { + public _FinalStage userCount(long userCount) { this.userCount = userCount; return this; } @@ -242,5 +246,17 @@ public EventSummaryResponseData build() { return new EventSummaryResponseData( companyCount, environmentId, eventCount, eventSubtype, lastSeenAt, userCount, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java b/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java index 8f1b227..f3627ae 100644 --- a/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureCompanyResponseData.java @@ -25,7 +25,7 @@ public final class FeatureCompanyResponseData { private final boolean access; - private final Optional allocation; + private final Optional allocation; private final EntitlementValueType allocationType; @@ -53,7 +53,7 @@ public final class FeatureCompanyResponseData { private final Optional creditUsed; - private final Optional effectiveLimit; + private final Optional effectiveLimit; private final Optional effectivePrice; @@ -77,7 +77,7 @@ public final class FeatureCompanyResponseData { private final Optional monthlyUsageBasedPrice; - private final Optional overuse; + private final Optional overuse; private final Optional percentUsed; @@ -89,9 +89,9 @@ public final class FeatureCompanyResponseData { private final Optional priceBehavior; - private final Optional softLimit; + private final Optional softLimit; - private final Optional usage; + private final Optional usage; private final Optional yearlyUsageBasedPrice; @@ -99,7 +99,7 @@ public final class FeatureCompanyResponseData { private FeatureCompanyResponseData( boolean access, - Optional allocation, + Optional allocation, EntitlementValueType allocationType, Optional company, Optional companyOverride, @@ -113,7 +113,7 @@ private FeatureCompanyResponseData( Optional creditUsage, Optional creditUsageAggregation, Optional creditUsed, - Optional effectiveLimit, + Optional effectiveLimit, Optional effectivePrice, Optional entitlementExpirationDate, String entitlementId, @@ -125,14 +125,14 @@ private FeatureCompanyResponseData( Optional metricResetAt, Optional monthReset, Optional monthlyUsageBasedPrice, - Optional overuse, + Optional overuse, Optional percentUsed, Optional period, Optional plan, Optional planEntitlement, Optional priceBehavior, - Optional softLimit, - Optional usage, + Optional softLimit, + Optional usage, Optional yearlyUsageBasedPrice, Map additionalProperties) { this.access = access; @@ -186,10 +186,13 @@ public boolean getAccess() { * @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() { + public Optional getAllocation() { return allocation; } + /** + * @return The type of allocation that is being used. + */ @JsonProperty("allocation_type") public EntitlementValueType getAllocationType() { return allocationType; @@ -223,6 +226,9 @@ public Optional> getCreditGrantDetails() { return creditGrantDetails; } + /** + * @return Reason for the credit grant + */ @JsonProperty("credit_grant_reason") public Optional getCreditGrantReason() { return creditGrantReason; @@ -254,6 +260,9 @@ public Optional getCreditUsage() { return creditUsage; } + /** + * @return Aggregated credit usage by time period (day, week, month, billing period) + */ @JsonProperty("credit_usage_aggregation") public Optional getCreditUsageAggregation() { return creditUsageAggregation; @@ -268,7 +277,7 @@ public Optional getCreditUsed() { * @return Effective limit for usage calculations. For overage pricing, this is the soft limit where overage charges begin. For tiered pricing, this is the first tier boundary. For other pricing models, this is the base allocation. Used to calculate usage percentages and determine access thresholds. */ @JsonProperty("effective_limit") - public Optional getEffectiveLimit() { + public Optional getEffectiveLimit() { return effectiveLimit; } @@ -349,7 +358,7 @@ public Optional getMonthlyUsageBasedPrice() { * @return Amount of usage exceeding soft limit (overage pricing only) */ @JsonProperty("overuse") - public Optional getOveruse() { + public Optional getOveruse() { return overuse; } @@ -388,7 +397,7 @@ public Optional getPriceBehavior() { * @return The soft limit for the feature usage. Available only for overage price behavior */ @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -396,7 +405,7 @@ public Optional getSoftLimit() { * @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() { + public Optional getUsage() { return usage; } @@ -515,6 +524,9 @@ public interface AccessStage { } public interface AllocationTypeStage { + /** + *

The type of allocation that is being used.

+ */ EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType); } @@ -529,12 +541,16 @@ public interface EntitlementTypeStage { public interface _FinalStage { FeatureCompanyResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

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); + _FinalStage allocation(Optional allocation); - _FinalStage allocation(Integer allocation); + _FinalStage allocation(Long allocation); _FinalStage company(Optional company); @@ -559,6 +575,9 @@ public interface _FinalStage { _FinalStage creditGrantDetails(List creditGrantDetails); + /** + *

Reason for the credit grant

+ */ _FinalStage creditGrantReason(Optional creditGrantReason); _FinalStage creditGrantReason(BillingCreditGrantReason creditGrantReason); @@ -585,6 +604,9 @@ public interface _FinalStage { _FinalStage creditUsage(CreditUsage creditUsage); + /** + *

Aggregated credit usage by time period (day, week, month, billing period)

+ */ _FinalStage creditUsageAggregation(Optional creditUsageAggregation); _FinalStage creditUsageAggregation(CreditUsageAggregation creditUsageAggregation); @@ -596,9 +618,9 @@ public interface _FinalStage { /** *

Effective limit for usage calculations. For overage pricing, this is the soft limit where overage charges begin. For tiered pricing, this is the first tier boundary. For other pricing models, this is the base allocation. Used to calculate usage percentages and determine access thresholds.

*/ - _FinalStage effectiveLimit(Optional effectiveLimit); + _FinalStage effectiveLimit(Optional effectiveLimit); - _FinalStage effectiveLimit(Integer effectiveLimit); + _FinalStage effectiveLimit(Long effectiveLimit); /** *

Per-unit price for current usage scenario

@@ -657,9 +679,9 @@ public interface _FinalStage { /** *

Amount of usage exceeding soft limit (overage pricing only)

*/ - _FinalStage overuse(Optional overuse); + _FinalStage overuse(Optional overuse); - _FinalStage overuse(Integer overuse); + _FinalStage overuse(Long overuse); /** *

Percentage of allocation consumed (0-100+)

@@ -690,16 +712,16 @@ public interface _FinalStage { /** *

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

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

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); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice); @@ -719,9 +741,9 @@ public static final class Builder private Optional yearlyUsageBasedPrice = Optional.empty(); - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional priceBehavior = Optional.empty(); @@ -733,7 +755,7 @@ public static final class Builder private Optional percentUsed = Optional.empty(); - private Optional overuse = Optional.empty(); + private Optional overuse = Optional.empty(); private Optional monthlyUsageBasedPrice = Optional.empty(); @@ -753,7 +775,7 @@ public static final class Builder private Optional effectivePrice = Optional.empty(); - private Optional effectiveLimit = Optional.empty(); + private Optional effectiveLimit = Optional.empty(); private Optional creditUsed = Optional.empty(); @@ -779,7 +801,7 @@ public static final class Builder private Optional company = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -839,6 +861,11 @@ 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 EntitlementValueType allocationType) { @@ -878,7 +905,7 @@ public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageB * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @@ -888,7 +915,7 @@ public _FinalStage usage(Integer usage) { */ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -898,7 +925,7 @@ public _FinalStage usage(Optional usage) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @@ -908,7 +935,7 @@ public _FinalStage softLimit(Integer softLimit) { */ @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -997,7 +1024,7 @@ public _FinalStage percentUsed(Optional percentUsed) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage overuse(Integer overuse) { + public _FinalStage overuse(Long overuse) { this.overuse = Optional.ofNullable(overuse); return this; } @@ -1007,7 +1034,7 @@ public _FinalStage overuse(Integer overuse) { */ @java.lang.Override @JsonSetter(value = "overuse", nulls = Nulls.SKIP) - public _FinalStage overuse(Optional overuse) { + public _FinalStage overuse(Optional overuse) { this.overuse = overuse; return this; } @@ -1176,7 +1203,7 @@ public _FinalStage effectivePrice(Optional effectivePrice) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage effectiveLimit(Integer effectiveLimit) { + public _FinalStage effectiveLimit(Long effectiveLimit) { this.effectiveLimit = Optional.ofNullable(effectiveLimit); return this; } @@ -1186,7 +1213,7 @@ public _FinalStage effectiveLimit(Integer effectiveLimit) { */ @java.lang.Override @JsonSetter(value = "effective_limit", nulls = Nulls.SKIP) - public _FinalStage effectiveLimit(Optional effectiveLimit) { + public _FinalStage effectiveLimit(Optional effectiveLimit) { this.effectiveLimit = effectiveLimit; return this; } @@ -1204,12 +1231,19 @@ public _FinalStage creditUsed(Optional creditUsed) { return this; } + /** + *

Aggregated credit usage by time period (day, week, month, billing period)

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

Aggregated credit usage by time period (day, week, month, billing period)

+ */ @java.lang.Override @JsonSetter(value = "credit_usage_aggregation", nulls = Nulls.SKIP) public _FinalStage creditUsageAggregation(Optional creditUsageAggregation) { @@ -1283,12 +1317,19 @@ 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(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) { @@ -1373,7 +1414,7 @@ public _FinalStage company(Optional company) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @@ -1383,7 +1424,7 @@ public _FinalStage allocation(Integer allocation) { */ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -1429,5 +1470,17 @@ public FeatureCompanyResponseData build() { yearlyUsageBasedPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java b/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java index bfc7580..e56a116 100644 --- a/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureCompanyUserResponseData.java @@ -24,7 +24,7 @@ public final class FeatureCompanyUserResponseData { private final boolean access; - private final Optional allocation; + private final Optional allocation; private final EntitlementValueType allocationType; @@ -44,7 +44,7 @@ public final class FeatureCompanyUserResponseData { private final Optional plan; - private final Optional usage; + private final Optional usage; private final Optional user; @@ -52,7 +52,7 @@ public final class FeatureCompanyUserResponseData { private FeatureCompanyUserResponseData( boolean access, - Optional allocation, + Optional allocation, EntitlementValueType allocationType, Optional company, String entitlementId, @@ -62,7 +62,7 @@ private FeatureCompanyUserResponseData( Optional monthReset, Optional period, Optional plan, - Optional usage, + Optional usage, Optional user, Map additionalProperties) { this.access = access; @@ -93,10 +93,13 @@ public boolean getAccess() { * @return The maximum amount of usage that is permitted; a null value indicates that unlimited usage is permitted. */ @JsonProperty("allocation") - public Optional getAllocation() { + public Optional getAllocation() { return allocation; } + /** + * @return The type of allocation that is being used. + */ @JsonProperty("allocation_type") public EntitlementValueType getAllocationType() { return allocationType; @@ -155,7 +158,7 @@ public Optional getPlan() { * @return The amount of usage that has been consumed; a null value indicates that usage is not being measured. */ @JsonProperty("usage") - public Optional getUsage() { + public Optional getUsage() { return usage; } @@ -228,6 +231,9 @@ public interface AccessStage { } public interface AllocationTypeStage { + /** + *

The type of allocation that is being used.

+ */ EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType); } @@ -242,12 +248,16 @@ public interface EntitlementTypeStage { public interface _FinalStage { FeatureCompanyUserResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

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

*/ - _FinalStage allocation(Optional allocation); + _FinalStage allocation(Optional allocation); - _FinalStage allocation(Integer allocation); + _FinalStage allocation(Long allocation); _FinalStage company(Optional company); @@ -285,9 +295,9 @@ public interface _FinalStage { /** *

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

*/ - _FinalStage usage(Optional usage); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); _FinalStage user(Optional user); @@ -307,7 +317,7 @@ public static final class Builder private Optional user = Optional.empty(); - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); private Optional plan = Optional.empty(); @@ -321,7 +331,7 @@ public static final class Builder private Optional company = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -358,6 +368,11 @@ 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 EntitlementValueType allocationType) { @@ -397,7 +412,7 @@ public _FinalStage user(Optional user) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @@ -407,7 +422,7 @@ public _FinalStage usage(Integer usage) { */ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -516,7 +531,7 @@ public _FinalStage company(Optional company) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @@ -526,7 +541,7 @@ public _FinalStage allocation(Integer allocation) { */ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -549,5 +564,17 @@ public FeatureCompanyUserResponseData build() { user, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java b/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java index 43c67d7..ec302f7 100644 --- a/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureDetailResponseData.java @@ -279,6 +279,10 @@ public interface UpdatedAtStage { public interface _FinalStage { FeatureDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage eventSubtype(Optional eventSubtype); _FinalStage eventSubtype(String eventSubtype); @@ -618,5 +622,17 @@ public FeatureDetailResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureEntitlement.java b/src/main/java/com/schematic/api/types/FeatureEntitlement.java index 2b4958c..7c4c5de 100644 --- a/src/main/java/com/schematic/api/types/FeatureEntitlement.java +++ b/src/main/java/com/schematic/api/types/FeatureEntitlement.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = FeatureEntitlement.Builder.class) public final class FeatureEntitlement { - private final Optional allocation; + private final Optional allocation; private final Optional creditId; @@ -44,16 +44,16 @@ public final class FeatureEntitlement { private final Optional monthReset; - private final Optional softLimit; + private final Optional softLimit; - private final Optional usage; + private final Optional usage; private final EntitlementValueType valueType; private final Map additionalProperties; private FeatureEntitlement( - Optional allocation, + Optional allocation, Optional creditId, Optional creditRemaining, Optional creditTotal, @@ -64,8 +64,8 @@ private FeatureEntitlement( Optional metricPeriod, Optional metricResetAt, Optional monthReset, - Optional softLimit, - Optional usage, + Optional softLimit, + Optional usage, EntitlementValueType valueType, Map additionalProperties) { this.allocation = allocation; @@ -89,7 +89,7 @@ private FeatureEntitlement( * @return If the company has a numeric entitlement for this feature, the allocated amount */ @JsonProperty("allocation") - public Optional getAllocation() { + public Optional getAllocation() { return allocation; } @@ -177,7 +177,7 @@ public Optional getMonthReset() { * @return For usage-based pricing, the soft limit for overage charges or the next tier boundary */ @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -185,10 +185,13 @@ public Optional getSoftLimit() { * @return If the company has a numeric entitlement for this feature, the current usage amount */ @JsonProperty("usage") - public Optional getUsage() { + public Optional getUsage() { return usage; } + /** + * @return The type of the entitlement value + */ @JsonProperty("value_type") public EntitlementValueType getValueType() { return valueType; @@ -267,18 +270,25 @@ public interface FeatureKeyStage { } public interface ValueTypeStage { + /** + *

The type of the entitlement value

+ */ _FinalStage valueType(@NotNull EntitlementValueType valueType); } public interface _FinalStage { FeatureEntitlement build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

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

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

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

@@ -339,16 +349,16 @@ public interface _FinalStage { /** *

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

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

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

*/ - _FinalStage usage(Optional usage); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -359,9 +369,9 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private EntitlementValueType valueType; - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional monthReset = Optional.empty(); @@ -379,7 +389,7 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private Optional creditId = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -429,6 +439,11 @@ public ValueTypeStage featureKey(@NotNull String featureKey) { return this; } + /** + *

The type of the entitlement value

+ *

The type of the entitlement value

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("value_type") public _FinalStage valueType(@NotNull EntitlementValueType valueType) { @@ -441,7 +456,7 @@ public _FinalStage valueType(@NotNull EntitlementValueType valueType) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @@ -451,7 +466,7 @@ public _FinalStage usage(Integer usage) { */ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -461,7 +476,7 @@ public _FinalStage usage(Optional usage) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @@ -471,7 +486,7 @@ public _FinalStage softLimit(Integer softLimit) { */ @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -641,7 +656,7 @@ public _FinalStage creditId(Optional creditId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @@ -651,7 +666,7 @@ public _FinalStage allocation(Integer allocation) { */ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -675,5 +690,17 @@ public FeatureEntitlement build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureLedgerResponseData.java b/src/main/java/com/schematic/api/types/FeatureLedgerResponseData.java index 4faddbc..160548f 100644 --- a/src/main/java/com/schematic/api/types/FeatureLedgerResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureLedgerResponseData.java @@ -109,6 +109,10 @@ public interface NameStage { public interface _FinalStage { FeatureLedgerResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -186,5 +190,17 @@ public _FinalStage description(Optional description) { public FeatureLedgerResponseData build() { return new FeatureLedgerResponseData(description, icon, id, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureResponseData.java b/src/main/java/com/schematic/api/types/FeatureResponseData.java index ab7b191..04804cd 100644 --- a/src/main/java/com/schematic/api/types/FeatureResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureResponseData.java @@ -233,6 +233,10 @@ public interface UpdatedAtStage { public interface _FinalStage { FeatureResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage eventSubtype(Optional eventSubtype); _FinalStage eventSubtype(String eventSubtype); @@ -462,5 +466,17 @@ public FeatureResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java deleted file mode 100644 index f281348..0000000 --- a/src/main/java/com/schematic/api/types/FeatureUsageDataResponseData.java +++ /dev/null @@ -1,553 +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 = FeatureUsageDataResponseData.Builder.class) -public final class FeatureUsageDataResponseData { - private final Optional creditTypeId; - - private final Optional creditUsage; - - private final String entitlementSource; - - private final String entitlementValueType; - - private final String featureId; - - private final String featureName; - - private final FeatureType featureType; - - private final String hardLimit; - - private final boolean hasAccess; - - private final Optional metricResetAt; - - private final Optional monthlyUsageBasedPrice; - - private final Optional priceBehavior; - - private final String softLimit; - - private final String usage; - - private final Optional valueNumeric; - - private final Optional yearlyUsageBasedPrice; - - private final Map additionalProperties; - - private FeatureUsageDataResponseData( - Optional creditTypeId, - Optional creditUsage, - String entitlementSource, - String entitlementValueType, - String featureId, - String featureName, - FeatureType featureType, - String hardLimit, - boolean hasAccess, - Optional metricResetAt, - Optional monthlyUsageBasedPrice, - Optional priceBehavior, - String softLimit, - String usage, - Optional valueNumeric, - Optional yearlyUsageBasedPrice, - Map additionalProperties) { - this.creditTypeId = creditTypeId; - this.creditUsage = creditUsage; - this.entitlementSource = entitlementSource; - this.entitlementValueType = entitlementValueType; - this.featureId = featureId; - this.featureName = featureName; - this.featureType = featureType; - this.hardLimit = hardLimit; - this.hasAccess = hasAccess; - this.metricResetAt = metricResetAt; - this.monthlyUsageBasedPrice = monthlyUsageBasedPrice; - this.priceBehavior = priceBehavior; - this.softLimit = softLimit; - this.usage = usage; - this.valueNumeric = valueNumeric; - this.yearlyUsageBasedPrice = yearlyUsageBasedPrice; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("credit_type_id") - public Optional getCreditTypeId() { - return creditTypeId; - } - - @JsonProperty("credit_usage") - public Optional getCreditUsage() { - return creditUsage; - } - - @JsonProperty("entitlement_source") - public String getEntitlementSource() { - return entitlementSource; - } - - @JsonProperty("entitlement_value_type") - public String getEntitlementValueType() { - return entitlementValueType; - } - - @JsonProperty("feature_id") - public String getFeatureId() { - return featureId; - } - - @JsonProperty("feature_name") - public String getFeatureName() { - return featureName; - } - - @JsonProperty("feature_type") - public FeatureType getFeatureType() { - return featureType; - } - - @JsonProperty("hard_limit") - public String getHardLimit() { - return hardLimit; - } - - @JsonProperty("has_access") - public boolean getHasAccess() { - return hasAccess; - } - - @JsonProperty("metric_reset_at") - public Optional getMetricResetAt() { - return metricResetAt; - } - - @JsonProperty("monthly_usage_based_price") - public Optional getMonthlyUsageBasedPrice() { - return monthlyUsageBasedPrice; - } - - @JsonProperty("price_behavior") - public Optional getPriceBehavior() { - return priceBehavior; - } - - @JsonProperty("soft_limit") - public String getSoftLimit() { - return softLimit; - } - - @JsonProperty("usage") - public String getUsage() { - return usage; - } - - @JsonProperty("value_numeric") - public Optional getValueNumeric() { - return valueNumeric; - } - - @JsonProperty("yearly_usage_based_price") - public Optional getYearlyUsageBasedPrice() { - return yearlyUsageBasedPrice; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FeatureUsageDataResponseData && equalTo((FeatureUsageDataResponseData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(FeatureUsageDataResponseData other) { - return creditTypeId.equals(other.creditTypeId) - && creditUsage.equals(other.creditUsage) - && entitlementSource.equals(other.entitlementSource) - && entitlementValueType.equals(other.entitlementValueType) - && featureId.equals(other.featureId) - && featureName.equals(other.featureName) - && featureType.equals(other.featureType) - && hardLimit.equals(other.hardLimit) - && hasAccess == other.hasAccess - && metricResetAt.equals(other.metricResetAt) - && monthlyUsageBasedPrice.equals(other.monthlyUsageBasedPrice) - && priceBehavior.equals(other.priceBehavior) - && softLimit.equals(other.softLimit) - && usage.equals(other.usage) - && valueNumeric.equals(other.valueNumeric) - && yearlyUsageBasedPrice.equals(other.yearlyUsageBasedPrice); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.creditTypeId, - this.creditUsage, - this.entitlementSource, - this.entitlementValueType, - this.featureId, - this.featureName, - this.featureType, - this.hardLimit, - this.hasAccess, - this.metricResetAt, - this.monthlyUsageBasedPrice, - this.priceBehavior, - this.softLimit, - this.usage, - this.valueNumeric, - this.yearlyUsageBasedPrice); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static EntitlementSourceStage builder() { - return new Builder(); - } - - public interface EntitlementSourceStage { - EntitlementValueTypeStage entitlementSource(@NotNull String entitlementSource); - - Builder from(FeatureUsageDataResponseData other); - } - - public interface EntitlementValueTypeStage { - FeatureIdStage entitlementValueType(@NotNull String entitlementValueType); - } - - public interface FeatureIdStage { - FeatureNameStage featureId(@NotNull String featureId); - } - - public interface FeatureNameStage { - FeatureTypeStage featureName(@NotNull String featureName); - } - - public interface FeatureTypeStage { - HardLimitStage featureType(@NotNull FeatureType featureType); - } - - public interface HardLimitStage { - HasAccessStage hardLimit(@NotNull String hardLimit); - } - - public interface HasAccessStage { - SoftLimitStage hasAccess(boolean hasAccess); - } - - public interface SoftLimitStage { - UsageStage softLimit(@NotNull String softLimit); - } - - public interface UsageStage { - _FinalStage usage(@NotNull String usage); - } - - public interface _FinalStage { - FeatureUsageDataResponseData build(); - - _FinalStage creditTypeId(Optional creditTypeId); - - _FinalStage creditTypeId(String creditTypeId); - - _FinalStage creditUsage(Optional creditUsage); - - _FinalStage creditUsage(CreditUsageResponseData creditUsage); - - _FinalStage metricResetAt(Optional metricResetAt); - - _FinalStage metricResetAt(OffsetDateTime metricResetAt); - - _FinalStage monthlyUsageBasedPrice(Optional monthlyUsageBasedPrice); - - _FinalStage monthlyUsageBasedPrice(BillingPriceView monthlyUsageBasedPrice); - - _FinalStage priceBehavior(Optional priceBehavior); - - _FinalStage priceBehavior(String priceBehavior); - - _FinalStage valueNumeric(Optional valueNumeric); - - _FinalStage valueNumeric(Integer valueNumeric); - - _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice); - - _FinalStage yearlyUsageBasedPrice(BillingPriceView yearlyUsageBasedPrice); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements EntitlementSourceStage, - EntitlementValueTypeStage, - FeatureIdStage, - FeatureNameStage, - FeatureTypeStage, - HardLimitStage, - HasAccessStage, - SoftLimitStage, - UsageStage, - _FinalStage { - private String entitlementSource; - - private String entitlementValueType; - - private String featureId; - - private String featureName; - - private FeatureType featureType; - - private String hardLimit; - - private boolean hasAccess; - - private String softLimit; - - private String usage; - - private Optional yearlyUsageBasedPrice = Optional.empty(); - - private Optional valueNumeric = Optional.empty(); - - private Optional priceBehavior = Optional.empty(); - - private Optional monthlyUsageBasedPrice = Optional.empty(); - - private Optional metricResetAt = Optional.empty(); - - private Optional creditUsage = Optional.empty(); - - private Optional creditTypeId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(FeatureUsageDataResponseData other) { - creditTypeId(other.getCreditTypeId()); - creditUsage(other.getCreditUsage()); - entitlementSource(other.getEntitlementSource()); - entitlementValueType(other.getEntitlementValueType()); - featureId(other.getFeatureId()); - featureName(other.getFeatureName()); - featureType(other.getFeatureType()); - hardLimit(other.getHardLimit()); - hasAccess(other.getHasAccess()); - metricResetAt(other.getMetricResetAt()); - monthlyUsageBasedPrice(other.getMonthlyUsageBasedPrice()); - priceBehavior(other.getPriceBehavior()); - softLimit(other.getSoftLimit()); - usage(other.getUsage()); - valueNumeric(other.getValueNumeric()); - yearlyUsageBasedPrice(other.getYearlyUsageBasedPrice()); - return this; - } - - @java.lang.Override - @JsonSetter("entitlement_source") - public EntitlementValueTypeStage entitlementSource(@NotNull String entitlementSource) { - this.entitlementSource = Objects.requireNonNull(entitlementSource, "entitlementSource must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("entitlement_value_type") - public FeatureIdStage entitlementValueType(@NotNull String entitlementValueType) { - this.entitlementValueType = - Objects.requireNonNull(entitlementValueType, "entitlementValueType must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("feature_id") - public FeatureNameStage featureId(@NotNull String featureId) { - this.featureId = Objects.requireNonNull(featureId, "featureId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("feature_name") - public FeatureTypeStage featureName(@NotNull String featureName) { - this.featureName = Objects.requireNonNull(featureName, "featureName must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("feature_type") - public HardLimitStage featureType(@NotNull FeatureType featureType) { - this.featureType = Objects.requireNonNull(featureType, "featureType must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("hard_limit") - public HasAccessStage hardLimit(@NotNull String hardLimit) { - this.hardLimit = Objects.requireNonNull(hardLimit, "hardLimit must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("has_access") - public SoftLimitStage hasAccess(boolean hasAccess) { - this.hasAccess = hasAccess; - return this; - } - - @java.lang.Override - @JsonSetter("soft_limit") - public UsageStage softLimit(@NotNull String softLimit) { - this.softLimit = Objects.requireNonNull(softLimit, "softLimit must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("usage") - public _FinalStage usage(@NotNull String usage) { - this.usage = Objects.requireNonNull(usage, "usage must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage yearlyUsageBasedPrice(BillingPriceView yearlyUsageBasedPrice) { - this.yearlyUsageBasedPrice = Optional.ofNullable(yearlyUsageBasedPrice); - return this; - } - - @java.lang.Override - @JsonSetter(value = "yearly_usage_based_price", nulls = Nulls.SKIP) - public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice) { - this.yearlyUsageBasedPrice = yearlyUsageBasedPrice; - 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 priceBehavior(String 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 monthlyUsageBasedPrice(BillingPriceView monthlyUsageBasedPrice) { - this.monthlyUsageBasedPrice = Optional.ofNullable(monthlyUsageBasedPrice); - return this; - } - - @java.lang.Override - @JsonSetter(value = "monthly_usage_based_price", nulls = Nulls.SKIP) - public _FinalStage monthlyUsageBasedPrice(Optional monthlyUsageBasedPrice) { - this.monthlyUsageBasedPrice = monthlyUsageBasedPrice; - return this; - } - - @java.lang.Override - public _FinalStage metricResetAt(OffsetDateTime metricResetAt) { - this.metricResetAt = Optional.ofNullable(metricResetAt); - return this; - } - - @java.lang.Override - @JsonSetter(value = "metric_reset_at", nulls = Nulls.SKIP) - public _FinalStage metricResetAt(Optional metricResetAt) { - this.metricResetAt = metricResetAt; - return this; - } - - @java.lang.Override - public _FinalStage creditUsage(CreditUsageResponseData creditUsage) { - this.creditUsage = Optional.ofNullable(creditUsage); - return this; - } - - @java.lang.Override - @JsonSetter(value = "credit_usage", nulls = Nulls.SKIP) - public _FinalStage creditUsage(Optional creditUsage) { - this.creditUsage = creditUsage; - return this; - } - - @java.lang.Override - public _FinalStage creditTypeId(String creditTypeId) { - this.creditTypeId = Optional.ofNullable(creditTypeId); - return this; - } - - @java.lang.Override - @JsonSetter(value = "credit_type_id", nulls = Nulls.SKIP) - public _FinalStage creditTypeId(Optional creditTypeId) { - this.creditTypeId = creditTypeId; - return this; - } - - @java.lang.Override - public FeatureUsageDataResponseData build() { - return new FeatureUsageDataResponseData( - creditTypeId, - creditUsage, - entitlementSource, - entitlementValueType, - featureId, - featureName, - featureType, - hardLimit, - hasAccess, - metricResetAt, - monthlyUsageBasedPrice, - priceBehavior, - softLimit, - usage, - valueNumeric, - yearlyUsageBasedPrice, - additionalProperties); - } - } -} diff --git a/src/main/java/com/schematic/api/types/FeatureUsageDetailResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageDetailResponseData.java index 90a7a36..72d28fc 100644 --- a/src/main/java/com/schematic/api/types/FeatureUsageDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureUsageDetailResponseData.java @@ -103,5 +103,15 @@ public Builder addAllFeatures(List features) { public FeatureUsageDetailResponseData build() { return new FeatureUsageDetailResponseData(features, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java index c402af5..ed09109 100644 --- a/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureUsageLegacyResponseData.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = FeatureUsageLegacyResponseData.Builder.class) public final class FeatureUsageLegacyResponseData { - private final Optional allocation; + private final Optional allocation; private final Optional creditUsage; @@ -32,17 +32,17 @@ public final class FeatureUsageLegacyResponseData { private final Optional metricResetAt; - private final Optional usage; + private final Optional usage; private final Map additionalProperties; private FeatureUsageLegacyResponseData( - Optional allocation, + Optional allocation, Optional creditUsage, String entitlement, Optional feature, Optional metricResetAt, - Optional usage, + Optional usage, Map additionalProperties) { this.allocation = allocation; this.creditUsage = creditUsage; @@ -54,7 +54,7 @@ private FeatureUsageLegacyResponseData( } @JsonProperty("Allocation") - public Optional getAllocation() { + public Optional getAllocation() { return allocation; } @@ -79,7 +79,7 @@ public Optional getMetricResetAt() { } @JsonProperty("Usage") - public Optional getUsage() { + public Optional getUsage() { return usage; } @@ -127,9 +127,13 @@ public interface EntitlementStage { public interface _FinalStage { FeatureUsageLegacyResponseData build(); - _FinalStage allocation(Optional allocation); + _FinalStage additionalProperty(String key, Object value); - _FinalStage allocation(Integer allocation); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage allocation(Optional allocation); + + _FinalStage allocation(Long allocation); _FinalStage creditUsage(Optional creditUsage); @@ -143,16 +147,16 @@ public interface _FinalStage { _FinalStage metricResetAt(OffsetDateTime metricResetAt); - _FinalStage usage(Optional usage); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements EntitlementStage, _FinalStage { private String entitlement; - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); private Optional metricResetAt = Optional.empty(); @@ -160,7 +164,7 @@ public static final class Builder implements EntitlementStage, _FinalStage { private Optional creditUsage = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -186,14 +190,14 @@ public _FinalStage entitlement(@NotNull String entitlement) { } @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @java.lang.Override @JsonSetter(value = "Usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -238,14 +242,14 @@ public _FinalStage creditUsage(Optional creditUsage) { } @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @java.lang.Override @JsonSetter(value = "Allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -255,5 +259,17 @@ public FeatureUsageLegacyResponseData build() { return new FeatureUsageLegacyResponseData( allocation, creditUsage, entitlement, feature, metricResetAt, usage, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java index 335c5ea..186795a 100644 --- a/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureUsageResponseData.java @@ -25,7 +25,7 @@ public final class FeatureUsageResponseData { private final boolean access; - private final Optional allocation; + private final Optional allocation; private final EntitlementValueType allocationType; @@ -49,7 +49,7 @@ public final class FeatureUsageResponseData { private final Optional creditUsed; - private final Optional effectiveLimit; + private final Optional effectiveLimit; private final Optional effectivePrice; @@ -73,7 +73,7 @@ public final class FeatureUsageResponseData { private final Optional monthlyUsageBasedPrice; - private final Optional overuse; + private final Optional overuse; private final Optional percentUsed; @@ -85,9 +85,9 @@ public final class FeatureUsageResponseData { private final Optional priceBehavior; - private final Optional softLimit; + private final Optional softLimit; - private final Optional usage; + private final Optional usage; private final Optional yearlyUsageBasedPrice; @@ -95,7 +95,7 @@ public final class FeatureUsageResponseData { private FeatureUsageResponseData( boolean access, - Optional allocation, + Optional allocation, EntitlementValueType allocationType, Optional companyOverride, Optional creditConsumptionRate, @@ -107,7 +107,7 @@ private FeatureUsageResponseData( Optional creditTypeIcon, Optional creditUsageAggregation, Optional creditUsed, - Optional effectiveLimit, + Optional effectiveLimit, Optional effectivePrice, Optional entitlementExpirationDate, String entitlementId, @@ -119,14 +119,14 @@ private FeatureUsageResponseData( Optional metricResetAt, Optional monthReset, Optional monthlyUsageBasedPrice, - Optional overuse, + Optional overuse, Optional percentUsed, Optional period, Optional plan, Optional planEntitlement, Optional priceBehavior, - Optional softLimit, - Optional usage, + Optional softLimit, + Optional usage, Optional yearlyUsageBasedPrice, Map additionalProperties) { this.access = access; @@ -178,10 +178,13 @@ public boolean getAccess() { * @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() { + public Optional getAllocation() { return allocation; } + /** + * @return The type of allocation that is being used. + */ @JsonProperty("allocation_type") public EntitlementValueType getAllocationType() { return allocationType; @@ -210,6 +213,9 @@ public Optional> getCreditGrantDetails() { return creditGrantDetails; } + /** + * @return Reason for the credit grant + */ @JsonProperty("credit_grant_reason") public Optional getCreditGrantReason() { return creditGrantReason; @@ -236,6 +242,9 @@ public Optional getCreditTypeIcon() { return creditTypeIcon; } + /** + * @return Aggregated credit usage by time period (day, week, month, billing period) + */ @JsonProperty("credit_usage_aggregation") public Optional getCreditUsageAggregation() { return creditUsageAggregation; @@ -250,7 +259,7 @@ public Optional getCreditUsed() { * @return Effective limit for usage calculations. For overage pricing, this is the soft limit where overage charges begin. For tiered pricing, this is the first tier boundary. For other pricing models, this is the base allocation. Used to calculate usage percentages and determine access thresholds. */ @JsonProperty("effective_limit") - public Optional getEffectiveLimit() { + public Optional getEffectiveLimit() { return effectiveLimit; } @@ -331,7 +340,7 @@ public Optional getMonthlyUsageBasedPrice() { * @return Amount of usage exceeding soft limit (overage pricing only) */ @JsonProperty("overuse") - public Optional getOveruse() { + public Optional getOveruse() { return overuse; } @@ -370,7 +379,7 @@ public Optional getPriceBehavior() { * @return The soft limit for the feature usage. Available only for overage price behavior */ @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -378,7 +387,7 @@ public Optional getSoftLimit() { * @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() { + public Optional getUsage() { return usage; } @@ -493,6 +502,9 @@ public interface AccessStage { } public interface AllocationTypeStage { + /** + *

The type of allocation that is being used.

+ */ EntitlementIdStage allocationType(@NotNull EntitlementValueType allocationType); } @@ -507,12 +519,16 @@ public interface EntitlementTypeStage { public interface _FinalStage { FeatureUsageResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

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); + _FinalStage allocation(Optional allocation); - _FinalStage allocation(Integer allocation); + _FinalStage allocation(Long allocation); _FinalStage companyOverride(Optional companyOverride); @@ -533,6 +549,9 @@ public interface _FinalStage { _FinalStage creditGrantDetails(List creditGrantDetails); + /** + *

Reason for the credit grant

+ */ _FinalStage creditGrantReason(Optional creditGrantReason); _FinalStage creditGrantReason(BillingCreditGrantReason creditGrantReason); @@ -555,6 +574,9 @@ public interface _FinalStage { _FinalStage creditTypeIcon(String creditTypeIcon); + /** + *

Aggregated credit usage by time period (day, week, month, billing period)

+ */ _FinalStage creditUsageAggregation(Optional creditUsageAggregation); _FinalStage creditUsageAggregation(CreditUsageAggregation creditUsageAggregation); @@ -566,9 +588,9 @@ public interface _FinalStage { /** *

Effective limit for usage calculations. For overage pricing, this is the soft limit where overage charges begin. For tiered pricing, this is the first tier boundary. For other pricing models, this is the base allocation. Used to calculate usage percentages and determine access thresholds.

*/ - _FinalStage effectiveLimit(Optional effectiveLimit); + _FinalStage effectiveLimit(Optional effectiveLimit); - _FinalStage effectiveLimit(Integer effectiveLimit); + _FinalStage effectiveLimit(Long effectiveLimit); /** *

Per-unit price for current usage scenario

@@ -627,9 +649,9 @@ public interface _FinalStage { /** *

Amount of usage exceeding soft limit (overage pricing only)

*/ - _FinalStage overuse(Optional overuse); + _FinalStage overuse(Optional overuse); - _FinalStage overuse(Integer overuse); + _FinalStage overuse(Long overuse); /** *

Percentage of allocation consumed (0-100+)

@@ -660,16 +682,16 @@ public interface _FinalStage { /** *

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

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

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); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice); @@ -689,9 +711,9 @@ public static final class Builder private Optional yearlyUsageBasedPrice = Optional.empty(); - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional priceBehavior = Optional.empty(); @@ -703,7 +725,7 @@ public static final class Builder private Optional percentUsed = Optional.empty(); - private Optional overuse = Optional.empty(); + private Optional overuse = Optional.empty(); private Optional monthlyUsageBasedPrice = Optional.empty(); @@ -723,7 +745,7 @@ public static final class Builder private Optional effectivePrice = Optional.empty(); - private Optional effectiveLimit = Optional.empty(); + private Optional effectiveLimit = Optional.empty(); private Optional creditUsed = Optional.empty(); @@ -745,7 +767,7 @@ public static final class Builder private Optional companyOverride = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -803,6 +825,11 @@ 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 EntitlementValueType allocationType) { @@ -842,7 +869,7 @@ public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageB * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @@ -852,7 +879,7 @@ public _FinalStage usage(Integer usage) { */ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -862,7 +889,7 @@ public _FinalStage usage(Optional usage) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @@ -872,7 +899,7 @@ public _FinalStage softLimit(Integer softLimit) { */ @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -961,7 +988,7 @@ public _FinalStage percentUsed(Optional percentUsed) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage overuse(Integer overuse) { + public _FinalStage overuse(Long overuse) { this.overuse = Optional.ofNullable(overuse); return this; } @@ -971,7 +998,7 @@ public _FinalStage overuse(Integer overuse) { */ @java.lang.Override @JsonSetter(value = "overuse", nulls = Nulls.SKIP) - public _FinalStage overuse(Optional overuse) { + public _FinalStage overuse(Optional overuse) { this.overuse = overuse; return this; } @@ -1140,7 +1167,7 @@ public _FinalStage effectivePrice(Optional effectivePrice) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage effectiveLimit(Integer effectiveLimit) { + public _FinalStage effectiveLimit(Long effectiveLimit) { this.effectiveLimit = Optional.ofNullable(effectiveLimit); return this; } @@ -1150,7 +1177,7 @@ public _FinalStage effectiveLimit(Integer effectiveLimit) { */ @java.lang.Override @JsonSetter(value = "effective_limit", nulls = Nulls.SKIP) - public _FinalStage effectiveLimit(Optional effectiveLimit) { + public _FinalStage effectiveLimit(Optional effectiveLimit) { this.effectiveLimit = effectiveLimit; return this; } @@ -1168,12 +1195,19 @@ public _FinalStage creditUsed(Optional creditUsed) { return this; } + /** + *

Aggregated credit usage by time period (day, week, month, billing period)

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

Aggregated credit usage by time period (day, week, month, billing period)

+ */ @java.lang.Override @JsonSetter(value = "credit_usage_aggregation", nulls = Nulls.SKIP) public _FinalStage creditUsageAggregation(Optional creditUsageAggregation) { @@ -1234,12 +1268,19 @@ 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(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) { @@ -1311,7 +1352,7 @@ public _FinalStage companyOverride(Optional company * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @@ -1321,7 +1362,7 @@ public _FinalStage allocation(Integer allocation) { */ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -1365,5 +1406,17 @@ public FeatureUsageResponseData build() { yearlyUsageBasedPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java b/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java index 65f4806..5cf9784 100644 --- a/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java +++ b/src/main/java/com/schematic/api/types/FeatureUsageTimeSeriesResponseData.java @@ -122,6 +122,10 @@ public interface FeatureTypeStage { public interface _FinalStage { FeatureUsageTimeSeriesResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage limits(List limits); _FinalStage addLimits(LimitTimeSeriesPointResponseData limits); @@ -246,5 +250,17 @@ public FeatureUsageTimeSeriesResponseData build() { return new FeatureUsageTimeSeriesResponseData( featureId, featureType, limits, periodType, usagePoints, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FeatureView.java b/src/main/java/com/schematic/api/types/FeatureView.java index a8ec98f..a5da337 100644 --- a/src/main/java/com/schematic/api/types/FeatureView.java +++ b/src/main/java/com/schematic/api/types/FeatureView.java @@ -294,6 +294,10 @@ public interface UpdatedAtStage { public interface _FinalStage { FeatureView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage eventSubtype(Optional eventSubtype); _FinalStage eventSubtype(String eventSubtype); @@ -645,5 +649,17 @@ public FeatureView build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FlagDetailResponseData.java b/src/main/java/com/schematic/api/types/FlagDetailResponseData.java index f882038..826a624 100644 --- a/src/main/java/com/schematic/api/types/FlagDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/FlagDetailResponseData.java @@ -239,6 +239,10 @@ public interface UpdatedAtStage { public interface _FinalStage { FlagDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage feature(Optional feature); _FinalStage feature(FeatureResponseData feature); @@ -472,5 +476,17 @@ public FlagDetailResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FlagResponseData.java b/src/main/java/com/schematic/api/types/FlagResponseData.java index 637336e..b2de2f2 100644 --- a/src/main/java/com/schematic/api/types/FlagResponseData.java +++ b/src/main/java/com/schematic/api/types/FlagResponseData.java @@ -204,6 +204,10 @@ public interface UpdatedAtStage { public interface _FinalStage { FlagResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage featureId(Optional featureId); _FinalStage featureId(String featureId); @@ -361,5 +365,17 @@ public FlagResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/FlagView.java b/src/main/java/com/schematic/api/types/FlagView.java index 6e4c91e..900a930 100644 --- a/src/main/java/com/schematic/api/types/FlagView.java +++ b/src/main/java/com/schematic/api/types/FlagView.java @@ -254,6 +254,10 @@ public interface UpdatedAtStage { public interface _FinalStage { FlagView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage feature(Optional feature); _FinalStage feature(FeatureResponseData feature); @@ -499,5 +503,17 @@ public FlagView build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/GenericPreviewObject.java b/src/main/java/com/schematic/api/types/GenericPreviewObject.java index 14a562e..cd2da1a 100644 --- a/src/main/java/com/schematic/api/types/GenericPreviewObject.java +++ b/src/main/java/com/schematic/api/types/GenericPreviewObject.java @@ -109,6 +109,10 @@ public interface NameStage { public interface _FinalStage { GenericPreviewObject build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -186,5 +190,17 @@ public _FinalStage description(Optional description) { public GenericPreviewObject build() { return new GenericPreviewObject(description, id, imageUrl, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/InvoiceRequestBody.java b/src/main/java/com/schematic/api/types/InvoiceRequestBody.java index 6f4b003..5785b8e 100644 --- a/src/main/java/com/schematic/api/types/InvoiceRequestBody.java +++ b/src/main/java/com/schematic/api/types/InvoiceRequestBody.java @@ -22,11 +22,11 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = InvoiceRequestBody.Builder.class) public final class InvoiceRequestBody { - private final int amountDue; + private final long amountDue; - private final int amountPaid; + private final long amountPaid; - private final int amountRemaining; + private final long amountRemaining; private final String collectionMethod; @@ -38,25 +38,28 @@ public final class InvoiceRequestBody { private final Optional paymentMethodExternalId; + private final Optional status; + private final Optional subscriptionExternalId; - private final int subtotal; + private final long subtotal; private final Optional url; private final Map additionalProperties; private InvoiceRequestBody( - int amountDue, - int amountPaid, - int amountRemaining, + long amountDue, + long amountPaid, + long amountRemaining, String collectionMethod, String currency, String customerExternalId, Optional dueDate, Optional paymentMethodExternalId, + Optional status, Optional subscriptionExternalId, - int subtotal, + long subtotal, Optional url, Map additionalProperties) { this.amountDue = amountDue; @@ -67,6 +70,7 @@ private InvoiceRequestBody( this.customerExternalId = customerExternalId; this.dueDate = dueDate; this.paymentMethodExternalId = paymentMethodExternalId; + this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.subtotal = subtotal; this.url = url; @@ -74,17 +78,17 @@ private InvoiceRequestBody( } @JsonProperty("amount_due") - public int getAmountDue() { + public long getAmountDue() { return amountDue; } @JsonProperty("amount_paid") - public int getAmountPaid() { + public long getAmountPaid() { return amountPaid; } @JsonProperty("amount_remaining") - public int getAmountRemaining() { + public long getAmountRemaining() { return amountRemaining; } @@ -113,13 +117,18 @@ public Optional getPaymentMethodExternalId() { return paymentMethodExternalId; } + @JsonProperty("status") + public Optional getStatus() { + return status; + } + @JsonProperty("subscription_external_id") public Optional getSubscriptionExternalId() { return subscriptionExternalId; } @JsonProperty("subtotal") - public int getSubtotal() { + public long getSubtotal() { return subtotal; } @@ -148,6 +157,7 @@ private boolean equalTo(InvoiceRequestBody other) { && customerExternalId.equals(other.customerExternalId) && dueDate.equals(other.dueDate) && paymentMethodExternalId.equals(other.paymentMethodExternalId) + && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && subtotal == other.subtotal && url.equals(other.url); @@ -164,6 +174,7 @@ public int hashCode() { this.customerExternalId, this.dueDate, this.paymentMethodExternalId, + this.status, this.subscriptionExternalId, this.subtotal, this.url); @@ -179,17 +190,17 @@ public static AmountDueStage builder() { } public interface AmountDueStage { - AmountPaidStage amountDue(int amountDue); + AmountPaidStage amountDue(long amountDue); Builder from(InvoiceRequestBody other); } public interface AmountPaidStage { - AmountRemainingStage amountPaid(int amountPaid); + AmountRemainingStage amountPaid(long amountPaid); } public interface AmountRemainingStage { - CollectionMethodStage amountRemaining(int amountRemaining); + CollectionMethodStage amountRemaining(long amountRemaining); } public interface CollectionMethodStage { @@ -205,12 +216,16 @@ public interface CustomerExternalIdStage { } public interface SubtotalStage { - _FinalStage subtotal(int subtotal); + _FinalStage subtotal(long subtotal); } public interface _FinalStage { InvoiceRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage dueDate(Optional dueDate); _FinalStage dueDate(OffsetDateTime dueDate); @@ -219,6 +234,10 @@ public interface _FinalStage { _FinalStage paymentMethodExternalId(String paymentMethodExternalId); + _FinalStage status(Optional status); + + _FinalStage status(InvoiceStatus status); + _FinalStage subscriptionExternalId(Optional subscriptionExternalId); _FinalStage subscriptionExternalId(String subscriptionExternalId); @@ -238,11 +257,11 @@ public static final class Builder CustomerExternalIdStage, SubtotalStage, _FinalStage { - private int amountDue; + private long amountDue; - private int amountPaid; + private long amountPaid; - private int amountRemaining; + private long amountRemaining; private String collectionMethod; @@ -250,12 +269,14 @@ public static final class Builder private String customerExternalId; - private int subtotal; + private long subtotal; private Optional url = Optional.empty(); private Optional subscriptionExternalId = Optional.empty(); + private Optional status = Optional.empty(); + private Optional paymentMethodExternalId = Optional.empty(); private Optional dueDate = Optional.empty(); @@ -275,6 +296,7 @@ public Builder from(InvoiceRequestBody other) { customerExternalId(other.getCustomerExternalId()); dueDate(other.getDueDate()); paymentMethodExternalId(other.getPaymentMethodExternalId()); + status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); subtotal(other.getSubtotal()); url(other.getUrl()); @@ -283,21 +305,21 @@ public Builder from(InvoiceRequestBody other) { @java.lang.Override @JsonSetter("amount_due") - public AmountPaidStage amountDue(int amountDue) { + public AmountPaidStage amountDue(long amountDue) { this.amountDue = amountDue; return this; } @java.lang.Override @JsonSetter("amount_paid") - public AmountRemainingStage amountPaid(int amountPaid) { + public AmountRemainingStage amountPaid(long amountPaid) { this.amountPaid = amountPaid; return this; } @java.lang.Override @JsonSetter("amount_remaining") - public CollectionMethodStage amountRemaining(int amountRemaining) { + public CollectionMethodStage amountRemaining(long amountRemaining) { this.amountRemaining = amountRemaining; return this; } @@ -325,7 +347,7 @@ public SubtotalStage customerExternalId(@NotNull String customerExternalId) { @java.lang.Override @JsonSetter("subtotal") - public _FinalStage subtotal(int subtotal) { + public _FinalStage subtotal(long subtotal) { this.subtotal = subtotal; return this; } @@ -356,6 +378,19 @@ public _FinalStage subscriptionExternalId(Optional subscriptionExternalI return this; } + @java.lang.Override + public _FinalStage status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + @java.lang.Override public _FinalStage paymentMethodExternalId(String paymentMethodExternalId) { this.paymentMethodExternalId = Optional.ofNullable(paymentMethodExternalId); @@ -393,10 +428,23 @@ public InvoiceRequestBody build() { customerExternalId, dueDate, paymentMethodExternalId, + status, subscriptionExternalId, subtotal, url, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/InvoiceResponseData.java b/src/main/java/com/schematic/api/types/InvoiceResponseData.java index 91c8feb..2700209 100644 --- a/src/main/java/com/schematic/api/types/InvoiceResponseData.java +++ b/src/main/java/com/schematic/api/types/InvoiceResponseData.java @@ -22,11 +22,11 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = InvoiceResponseData.Builder.class) public final class InvoiceResponseData { - private final int amountDue; + private final long amountDue; - private final int amountPaid; + private final long amountPaid; - private final int amountRemaining; + private final long amountRemaining; private final String collectionMethod; @@ -50,9 +50,11 @@ public final class InvoiceResponseData { private final BillingProviderType providerType; + private final Optional status; + private final Optional subscriptionExternalId; - private final int subtotal; + private final long subtotal; private final OffsetDateTime updatedAt; @@ -61,9 +63,9 @@ public final class InvoiceResponseData { private final Map additionalProperties; private InvoiceResponseData( - int amountDue, - int amountPaid, - int amountRemaining, + long amountDue, + long amountPaid, + long amountRemaining, String collectionMethod, Optional companyId, OffsetDateTime createdAt, @@ -75,8 +77,9 @@ private InvoiceResponseData( String id, Optional paymentMethodExternalId, BillingProviderType providerType, + Optional status, Optional subscriptionExternalId, - int subtotal, + long subtotal, OffsetDateTime updatedAt, Optional url, Map additionalProperties) { @@ -94,6 +97,7 @@ private InvoiceResponseData( this.id = id; this.paymentMethodExternalId = paymentMethodExternalId; this.providerType = providerType; + this.status = status; this.subscriptionExternalId = subscriptionExternalId; this.subtotal = subtotal; this.updatedAt = updatedAt; @@ -102,17 +106,17 @@ private InvoiceResponseData( } @JsonProperty("amount_due") - public int getAmountDue() { + public long getAmountDue() { return amountDue; } @JsonProperty("amount_paid") - public int getAmountPaid() { + public long getAmountPaid() { return amountPaid; } @JsonProperty("amount_remaining") - public int getAmountRemaining() { + public long getAmountRemaining() { return amountRemaining; } @@ -171,13 +175,18 @@ public BillingProviderType getProviderType() { return providerType; } + @JsonProperty("status") + public Optional getStatus() { + return status; + } + @JsonProperty("subscription_external_id") public Optional getSubscriptionExternalId() { return subscriptionExternalId; } @JsonProperty("subtotal") - public int getSubtotal() { + public long getSubtotal() { return subtotal; } @@ -217,6 +226,7 @@ private boolean equalTo(InvoiceResponseData other) { && id.equals(other.id) && paymentMethodExternalId.equals(other.paymentMethodExternalId) && providerType.equals(other.providerType) + && status.equals(other.status) && subscriptionExternalId.equals(other.subscriptionExternalId) && subtotal == other.subtotal && updatedAt.equals(other.updatedAt) @@ -240,6 +250,7 @@ public int hashCode() { this.id, this.paymentMethodExternalId, this.providerType, + this.status, this.subscriptionExternalId, this.subtotal, this.updatedAt, @@ -256,17 +267,17 @@ public static AmountDueStage builder() { } public interface AmountDueStage { - AmountPaidStage amountDue(int amountDue); + AmountPaidStage amountDue(long amountDue); Builder from(InvoiceResponseData other); } public interface AmountPaidStage { - AmountRemainingStage amountPaid(int amountPaid); + AmountRemainingStage amountPaid(long amountPaid); } public interface AmountRemainingStage { - CollectionMethodStage amountRemaining(int amountRemaining); + CollectionMethodStage amountRemaining(long amountRemaining); } public interface CollectionMethodStage { @@ -298,7 +309,7 @@ public interface ProviderTypeStage { } public interface SubtotalStage { - UpdatedAtStage subtotal(int subtotal); + UpdatedAtStage subtotal(long subtotal); } public interface UpdatedAtStage { @@ -308,6 +319,10 @@ public interface UpdatedAtStage { public interface _FinalStage { InvoiceResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -324,6 +339,10 @@ public interface _FinalStage { _FinalStage paymentMethodExternalId(String paymentMethodExternalId); + _FinalStage status(Optional status); + + _FinalStage status(InvoiceStatus status); + _FinalStage subscriptionExternalId(Optional subscriptionExternalId); _FinalStage subscriptionExternalId(String subscriptionExternalId); @@ -348,11 +367,11 @@ public static final class Builder SubtotalStage, UpdatedAtStage, _FinalStage { - private int amountDue; + private long amountDue; - private int amountPaid; + private long amountPaid; - private int amountRemaining; + private long amountRemaining; private String collectionMethod; @@ -368,7 +387,7 @@ public static final class Builder private BillingProviderType providerType; - private int subtotal; + private long subtotal; private OffsetDateTime updatedAt; @@ -376,6 +395,8 @@ public static final class Builder private Optional subscriptionExternalId = Optional.empty(); + private Optional status = Optional.empty(); + private Optional paymentMethodExternalId = Optional.empty(); private Optional externalId = Optional.empty(); @@ -405,6 +426,7 @@ public Builder from(InvoiceResponseData other) { id(other.getId()); paymentMethodExternalId(other.getPaymentMethodExternalId()); providerType(other.getProviderType()); + status(other.getStatus()); subscriptionExternalId(other.getSubscriptionExternalId()); subtotal(other.getSubtotal()); updatedAt(other.getUpdatedAt()); @@ -414,21 +436,21 @@ public Builder from(InvoiceResponseData other) { @java.lang.Override @JsonSetter("amount_due") - public AmountPaidStage amountDue(int amountDue) { + public AmountPaidStage amountDue(long amountDue) { this.amountDue = amountDue; return this; } @java.lang.Override @JsonSetter("amount_paid") - public AmountRemainingStage amountPaid(int amountPaid) { + public AmountRemainingStage amountPaid(long amountPaid) { this.amountPaid = amountPaid; return this; } @java.lang.Override @JsonSetter("amount_remaining") - public CollectionMethodStage amountRemaining(int amountRemaining) { + public CollectionMethodStage amountRemaining(long amountRemaining) { this.amountRemaining = amountRemaining; return this; } @@ -484,7 +506,7 @@ public SubtotalStage providerType(@NotNull BillingProviderType providerType) { @java.lang.Override @JsonSetter("subtotal") - public UpdatedAtStage subtotal(int subtotal) { + public UpdatedAtStage subtotal(long subtotal) { this.subtotal = subtotal; return this; } @@ -522,6 +544,19 @@ public _FinalStage subscriptionExternalId(Optional subscriptionExternalI return this; } + @java.lang.Override + public _FinalStage status(InvoiceStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + @java.lang.Override public _FinalStage paymentMethodExternalId(String paymentMethodExternalId) { this.paymentMethodExternalId = Optional.ofNullable(paymentMethodExternalId); @@ -591,11 +626,24 @@ public InvoiceResponseData build() { id, paymentMethodExternalId, providerType, + status, subscriptionExternalId, subtotal, updatedAt, url, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/InvoiceStatus.java b/src/main/java/com/schematic/api/types/InvoiceStatus.java new file mode 100644 index 0000000..335ceff --- /dev/null +++ b/src/main/java/com/schematic/api/types/InvoiceStatus.java @@ -0,0 +1,113 @@ +/** + * 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 InvoiceStatus { + public static final InvoiceStatus PAID = new InvoiceStatus(Value.PAID, "paid"); + + public static final InvoiceStatus UNCOLLECTIBLE = new InvoiceStatus(Value.UNCOLLECTIBLE, "uncollectible"); + + public static final InvoiceStatus OPEN = new InvoiceStatus(Value.OPEN, "open"); + + public static final InvoiceStatus VOID = new InvoiceStatus(Value.VOID, "void"); + + public static final InvoiceStatus DRAFT = new InvoiceStatus(Value.DRAFT, "draft"); + + private final Value value; + + private final String string; + + InvoiceStatus(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 InvoiceStatus && this.string.equals(((InvoiceStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PAID: + return visitor.visitPaid(); + case UNCOLLECTIBLE: + return visitor.visitUncollectible(); + case OPEN: + return visitor.visitOpen(); + case VOID: + return visitor.visitVoid(); + case DRAFT: + return visitor.visitDraft(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static InvoiceStatus valueOf(String value) { + switch (value) { + case "paid": + return PAID; + case "uncollectible": + return UNCOLLECTIBLE; + case "open": + return OPEN; + case "void": + return VOID; + case "draft": + return DRAFT; + default: + return new InvoiceStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + DRAFT, + + OPEN, + + PAID, + + UNCOLLECTIBLE, + + VOID, + + UNKNOWN + } + + public interface Visitor { + T visitDraft(); + + T visitOpen(); + + T visitPaid(); + + T visitUncollectible(); + + T visitVoid(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/IssueTemporaryAccessTokenResponseData.java b/src/main/java/com/schematic/api/types/IssueTemporaryAccessTokenResponseData.java index 9d6e1cc..ebd3d0f 100644 --- a/src/main/java/com/schematic/api/types/IssueTemporaryAccessTokenResponseData.java +++ b/src/main/java/com/schematic/api/types/IssueTemporaryAccessTokenResponseData.java @@ -180,6 +180,10 @@ public interface UpdatedAtStage { public interface _FinalStage { IssueTemporaryAccessTokenResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -296,5 +300,17 @@ public IssueTemporaryAccessTokenResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/KeysRequestBody.java b/src/main/java/com/schematic/api/types/KeysRequestBody.java index c79c8a8..dccde4a 100644 --- a/src/main/java/com/schematic/api/types/KeysRequestBody.java +++ b/src/main/java/com/schematic/api/types/KeysRequestBody.java @@ -101,5 +101,15 @@ public Builder keys(String key, String value) { public KeysRequestBody build() { return new KeysRequestBody(keys, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java b/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java index bbb610d..f1b6748 100644 --- a/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java +++ b/src/main/java/com/schematic/api/types/LimitTimeSeriesPointResponseData.java @@ -28,7 +28,7 @@ public final class LimitTimeSeriesPointResponseData { private final EntitlementType limitSource; - private final Optional limitValue; + private final Optional limitValue; private final Optional planId; @@ -40,7 +40,7 @@ private LimitTimeSeriesPointResponseData( OffsetDateTime effectiveAt, boolean isSoftLimit, EntitlementType limitSource, - Optional limitValue, + Optional limitValue, Optional planId, Optional priceBehavior, Map additionalProperties) { @@ -69,7 +69,7 @@ public EntitlementType getLimitSource() { } @JsonProperty("limit_value") - public Optional getLimitValue() { + public Optional getLimitValue() { return limitValue; } @@ -135,9 +135,13 @@ public interface LimitSourceStage { public interface _FinalStage { LimitTimeSeriesPointResponseData build(); - _FinalStage limitValue(Optional limitValue); + _FinalStage additionalProperty(String key, Object value); - _FinalStage limitValue(Integer limitValue); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage limitValue(Optional limitValue); + + _FinalStage limitValue(Long limitValue); _FinalStage planId(Optional planId); @@ -160,7 +164,7 @@ public static final class Builder implements EffectiveAtStage, IsSoftLimitStage, private Optional planId = Optional.empty(); - private Optional limitValue = Optional.empty(); + private Optional limitValue = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -226,14 +230,14 @@ public _FinalStage planId(Optional planId) { } @java.lang.Override - public _FinalStage limitValue(Integer limitValue) { + public _FinalStage limitValue(Long limitValue) { this.limitValue = Optional.ofNullable(limitValue); return this; } @java.lang.Override @JsonSetter(value = "limit_value", nulls = Nulls.SKIP) - public _FinalStage limitValue(Optional limitValue) { + public _FinalStage limitValue(Optional limitValue) { this.limitValue = limitValue; return this; } @@ -243,5 +247,17 @@ public LimitTimeSeriesPointResponseData build() { return new LimitTimeSeriesPointResponseData( effectiveAt, isSoftLimit, limitSource, limitValue, planId, priceBehavior, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ManagePlanPreviewResponseResponseData.java b/src/main/java/com/schematic/api/types/ManagePlanPreviewResponseResponseData.java index 89db780..7f86fe9 100644 --- a/src/main/java/com/schematic/api/types/ManagePlanPreviewResponseResponseData.java +++ b/src/main/java/com/schematic/api/types/ManagePlanPreviewResponseResponseData.java @@ -95,5 +95,15 @@ public Builder subscriptionChangePreview(PreviewSubscriptionChangeResponseData s public ManagePlanPreviewResponseResponseData build() { return new ManagePlanPreviewResponseResponseData(subscriptionChangePreview, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ManagePlanRequest.java b/src/main/java/com/schematic/api/types/ManagePlanRequest.java index 870fe4a..eaad86b 100644 --- a/src/main/java/com/schematic/api/types/ManagePlanRequest.java +++ b/src/main/java/com/schematic/api/types/ManagePlanRequest.java @@ -30,6 +30,8 @@ public final class ManagePlanRequest { private final Optional basePlanPriceId; + private final Optional basePlanVersionId; + private final Optional cancelImmediately; private final String companyId; @@ -54,6 +56,7 @@ private ManagePlanRequest( List addOnSelections, Optional basePlanId, Optional basePlanPriceId, + Optional basePlanVersionId, Optional cancelImmediately, String companyId, Optional couponExternalId, @@ -67,6 +70,7 @@ private ManagePlanRequest( this.addOnSelections = addOnSelections; this.basePlanId = basePlanId; this.basePlanPriceId = basePlanPriceId; + this.basePlanVersionId = basePlanVersionId; this.cancelImmediately = cancelImmediately; this.companyId = companyId; this.couponExternalId = couponExternalId; @@ -94,6 +98,11 @@ public Optional getBasePlanPriceId() { return basePlanPriceId; } + @JsonProperty("base_plan_version_id") + public Optional getBasePlanVersionId() { + return basePlanVersionId; + } + /** * @return If false, subscription cancels at period end. Only applies when removing all plans. Defaults to true. */ @@ -160,6 +169,7 @@ private boolean equalTo(ManagePlanRequest other) { return addOnSelections.equals(other.addOnSelections) && basePlanId.equals(other.basePlanId) && basePlanPriceId.equals(other.basePlanPriceId) + && basePlanVersionId.equals(other.basePlanVersionId) && cancelImmediately.equals(other.cancelImmediately) && companyId.equals(other.companyId) && couponExternalId.equals(other.couponExternalId) @@ -177,6 +187,7 @@ public int hashCode() { this.addOnSelections, this.basePlanId, this.basePlanPriceId, + this.basePlanVersionId, this.cancelImmediately, this.companyId, this.couponExternalId, @@ -206,6 +217,10 @@ public interface CompanyIdStage { public interface _FinalStage { ManagePlanRequest build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnSelections(List addOnSelections); _FinalStage addAddOnSelections(PlanSelection addOnSelections); @@ -220,6 +235,10 @@ public interface _FinalStage { _FinalStage basePlanPriceId(String basePlanPriceId); + _FinalStage basePlanVersionId(Optional basePlanVersionId); + + _FinalStage basePlanVersionId(String basePlanVersionId); + /** *

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

*/ @@ -283,6 +302,8 @@ public static final class Builder implements CompanyIdStage, _FinalStage { private Optional cancelImmediately = Optional.empty(); + private Optional basePlanVersionId = Optional.empty(); + private Optional basePlanPriceId = Optional.empty(); private Optional basePlanId = Optional.empty(); @@ -299,6 +320,7 @@ public Builder from(ManagePlanRequest other) { addOnSelections(other.getAddOnSelections()); basePlanId(other.getBasePlanId()); basePlanPriceId(other.getBasePlanPriceId()); + basePlanVersionId(other.getBasePlanVersionId()); cancelImmediately(other.getCancelImmediately()); companyId(other.getCompanyId()); couponExternalId(other.getCouponExternalId()); @@ -459,6 +481,19 @@ public _FinalStage cancelImmediately(Optional cancelImmediately) { return this; } + @java.lang.Override + public _FinalStage basePlanVersionId(String basePlanVersionId) { + this.basePlanVersionId = Optional.ofNullable(basePlanVersionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "base_plan_version_id", nulls = Nulls.SKIP) + public _FinalStage basePlanVersionId(Optional basePlanVersionId) { + this.basePlanVersionId = basePlanVersionId; + return this; + } + @java.lang.Override public _FinalStage basePlanPriceId(String basePlanPriceId) { this.basePlanPriceId = Optional.ofNullable(basePlanPriceId); @@ -515,6 +550,7 @@ public ManagePlanRequest build() { addOnSelections, basePlanId, basePlanPriceId, + basePlanVersionId, cancelImmediately, companyId, couponExternalId, @@ -526,5 +562,17 @@ public ManagePlanRequest build() { trialEnd, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ManagePlanResponseResponseData.java b/src/main/java/com/schematic/api/types/ManagePlanResponseResponseData.java index ed45ea2..2643901 100644 --- a/src/main/java/com/schematic/api/types/ManagePlanResponseResponseData.java +++ b/src/main/java/com/schematic/api/types/ManagePlanResponseResponseData.java @@ -81,6 +81,10 @@ public interface SuccessStage { public interface _FinalStage { ManagePlanResponseResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage company(Optional company); _FinalStage company(CompanyDetailResponseData company); @@ -128,5 +132,17 @@ public _FinalStage company(Optional company) { public ManagePlanResponseResponseData build() { return new ManagePlanResponseResponseData(company, success, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/MeterRequestBody.java b/src/main/java/com/schematic/api/types/MeterRequestBody.java index 6297398..395e450 100644 --- a/src/main/java/com/schematic/api/types/MeterRequestBody.java +++ b/src/main/java/com/schematic/api/types/MeterRequestBody.java @@ -97,6 +97,10 @@ public interface EventPayloadKeyStage { public interface _FinalStage { MeterRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -145,5 +149,17 @@ public _FinalStage eventPayloadKey(@NotNull String eventPayloadKey) { public MeterRequestBody build() { return new MeterRequestBody(displayName, eventName, eventPayloadKey, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/OrderedPlansInGroup.java b/src/main/java/com/schematic/api/types/OrderedPlansInGroup.java index a4d13c0..b3fea95 100644 --- a/src/main/java/com/schematic/api/types/OrderedPlansInGroup.java +++ b/src/main/java/com/schematic/api/types/OrderedPlansInGroup.java @@ -83,6 +83,10 @@ public interface PlanIdStage { public interface _FinalStage { OrderedPlansInGroup build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage entitlements(Optional> entitlements); _FinalStage entitlements(List entitlements); @@ -130,5 +134,17 @@ public _FinalStage entitlements(Optional> entitlements) public OrderedPlansInGroup build() { return new OrderedPlansInGroup(entitlements, planId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PaymentMethodRequestBody.java b/src/main/java/com/schematic/api/types/PaymentMethodRequestBody.java index 9bccae4..a9665dd 100644 --- a/src/main/java/com/schematic/api/types/PaymentMethodRequestBody.java +++ b/src/main/java/com/schematic/api/types/PaymentMethodRequestBody.java @@ -33,9 +33,9 @@ public final class PaymentMethodRequestBody { private final Optional cardBrand; - private final Optional cardExpMonth; + private final Optional cardExpMonth; - private final Optional cardExpYear; + private final Optional cardExpYear; private final Optional cardLast4; @@ -52,8 +52,8 @@ private PaymentMethodRequestBody( Optional billingEmail, Optional billingName, Optional cardBrand, - Optional cardExpMonth, - Optional cardExpYear, + Optional cardExpMonth, + Optional cardExpYear, Optional cardLast4, String customerExternalId, String paymentMethodType, @@ -103,12 +103,12 @@ public Optional getCardBrand() { } @JsonProperty("card_exp_month") - public Optional getCardExpMonth() { + public Optional getCardExpMonth() { return cardExpMonth; } @JsonProperty("card_exp_year") - public Optional getCardExpYear() { + public Optional getCardExpYear() { return cardExpYear; } @@ -190,6 +190,10 @@ public interface PaymentMethodTypeStage { public interface _FinalStage { PaymentMethodRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage accountLast4(Optional accountLast4); _FinalStage accountLast4(String accountLast4); @@ -214,13 +218,13 @@ public interface _FinalStage { _FinalStage cardBrand(String cardBrand); - _FinalStage cardExpMonth(Optional cardExpMonth); + _FinalStage cardExpMonth(Optional cardExpMonth); - _FinalStage cardExpMonth(Integer cardExpMonth); + _FinalStage cardExpMonth(Long cardExpMonth); - _FinalStage cardExpYear(Optional cardExpYear); + _FinalStage cardExpYear(Optional cardExpYear); - _FinalStage cardExpYear(Integer cardExpYear); + _FinalStage cardExpYear(Long cardExpYear); _FinalStage cardLast4(Optional cardLast4); @@ -235,9 +239,9 @@ public static final class Builder implements CustomerExternalIdStage, PaymentMet private Optional cardLast4 = Optional.empty(); - private Optional cardExpYear = Optional.empty(); + private Optional cardExpYear = Optional.empty(); - private Optional cardExpMonth = Optional.empty(); + private Optional cardExpMonth = Optional.empty(); private Optional cardBrand = Optional.empty(); @@ -300,27 +304,27 @@ public _FinalStage cardLast4(Optional cardLast4) { } @java.lang.Override - public _FinalStage cardExpYear(Integer cardExpYear) { + public _FinalStage cardExpYear(Long cardExpYear) { this.cardExpYear = Optional.ofNullable(cardExpYear); return this; } @java.lang.Override @JsonSetter(value = "card_exp_year", nulls = Nulls.SKIP) - public _FinalStage cardExpYear(Optional cardExpYear) { + public _FinalStage cardExpYear(Optional cardExpYear) { this.cardExpYear = cardExpYear; return this; } @java.lang.Override - public _FinalStage cardExpMonth(Integer cardExpMonth) { + public _FinalStage cardExpMonth(Long cardExpMonth) { this.cardExpMonth = Optional.ofNullable(cardExpMonth); return this; } @java.lang.Override @JsonSetter(value = "card_exp_month", nulls = Nulls.SKIP) - public _FinalStage cardExpMonth(Optional cardExpMonth) { + public _FinalStage cardExpMonth(Optional cardExpMonth) { this.cardExpMonth = cardExpMonth; return this; } @@ -419,5 +423,17 @@ public PaymentMethodRequestBody build() { paymentMethodType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java b/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java index f5acc53..5cbdd36 100644 --- a/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java +++ b/src/main/java/com/schematic/api/types/PaymentMethodResponseData.java @@ -34,9 +34,9 @@ public final class PaymentMethodResponseData { private final Optional cardBrand; - private final Optional cardExpMonth; + private final Optional cardExpMonth; - private final Optional cardExpYear; + private final Optional cardExpYear; private final Optional cardLast4; @@ -67,8 +67,8 @@ private PaymentMethodResponseData( Optional billingEmail, Optional billingName, Optional cardBrand, - Optional cardExpMonth, - Optional cardExpYear, + Optional cardExpMonth, + Optional cardExpYear, Optional cardLast4, Optional companyId, OffsetDateTime createdAt, @@ -132,12 +132,12 @@ public Optional getCardBrand() { } @JsonProperty("card_exp_month") - public Optional getCardExpMonth() { + public Optional getCardExpMonth() { return cardExpMonth; } @JsonProperty("card_exp_year") - public Optional getCardExpYear() { + public Optional getCardExpYear() { return cardExpYear; } @@ -292,6 +292,10 @@ public interface UpdatedAtStage { public interface _FinalStage { PaymentMethodResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage accountLast4(Optional accountLast4); _FinalStage accountLast4(String accountLast4); @@ -316,13 +320,13 @@ public interface _FinalStage { _FinalStage cardBrand(String cardBrand); - _FinalStage cardExpMonth(Optional cardExpMonth); + _FinalStage cardExpMonth(Optional cardExpMonth); - _FinalStage cardExpMonth(Integer cardExpMonth); + _FinalStage cardExpMonth(Long cardExpMonth); - _FinalStage cardExpYear(Optional cardExpYear); + _FinalStage cardExpYear(Optional cardExpYear); - _FinalStage cardExpYear(Integer cardExpYear); + _FinalStage cardExpYear(Long cardExpYear); _FinalStage cardLast4(Optional cardLast4); @@ -364,9 +368,9 @@ public static final class Builder private Optional cardLast4 = Optional.empty(); - private Optional cardExpYear = Optional.empty(); + private Optional cardExpYear = Optional.empty(); - private Optional cardExpMonth = Optional.empty(); + private Optional cardExpMonth = Optional.empty(); private Optional cardBrand = Optional.empty(); @@ -491,27 +495,27 @@ public _FinalStage cardLast4(Optional cardLast4) { } @java.lang.Override - public _FinalStage cardExpYear(Integer cardExpYear) { + public _FinalStage cardExpYear(Long cardExpYear) { this.cardExpYear = Optional.ofNullable(cardExpYear); return this; } @java.lang.Override @JsonSetter(value = "card_exp_year", nulls = Nulls.SKIP) - public _FinalStage cardExpYear(Optional cardExpYear) { + public _FinalStage cardExpYear(Optional cardExpYear) { this.cardExpYear = cardExpYear; return this; } @java.lang.Override - public _FinalStage cardExpMonth(Integer cardExpMonth) { + public _FinalStage cardExpMonth(Long cardExpMonth) { this.cardExpMonth = Optional.ofNullable(cardExpMonth); return this; } @java.lang.Override @JsonSetter(value = "card_exp_month", nulls = Nulls.SKIP) - public _FinalStage cardExpMonth(Optional cardExpMonth) { + public _FinalStage cardExpMonth(Optional cardExpMonth) { this.cardExpMonth = cardExpMonth; return this; } @@ -617,5 +621,17 @@ public PaymentMethodResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java index e2baba8..cfb2264 100644 --- a/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/PlanBundleCreditGrantRequestBody.java @@ -115,6 +115,10 @@ public interface ActionStage { public interface _FinalStage { PlanBundleCreditGrantRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage createReq(Optional createReq); _FinalStage createReq(CreateBillingPlanCreditGrantRequestBody createReq); @@ -223,5 +227,17 @@ public PlanBundleCreditGrantRequestBody build() { return new PlanBundleCreditGrantRequestBody( action, createReq, creditGrantId, deleteReq, updateReq, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java b/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java index 7a07a44..0cf555f 100644 --- a/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/types/PlanBundleEntitlementRequestBody.java @@ -93,6 +93,10 @@ public interface ActionStage { public interface _FinalStage { PlanBundleEntitlementRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage entitlementId(Optional entitlementId); _FinalStage entitlementId(String entitlementId); @@ -160,5 +164,17 @@ public _FinalStage entitlementId(Optional entitlementId) { public PlanBundleEntitlementRequestBody build() { return new PlanBundleEntitlementRequestBody(action, entitlementId, req, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanBundleResponseData.java b/src/main/java/com/schematic/api/types/PlanBundleResponseData.java index 909bf3a..82e59a5 100644 --- a/src/main/java/com/schematic/api/types/PlanBundleResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanBundleResponseData.java @@ -191,5 +191,15 @@ public PlanBundleResponseData build() { return new PlanBundleResponseData( billingProduct, creditGrants, entitlements, plan, traits, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanChangeAction.java b/src/main/java/com/schematic/api/types/PlanChangeAction.java index cf6592c..cdaf97d 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeAction.java +++ b/src/main/java/com/schematic/api/types/PlanChangeAction.java @@ -7,6 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class PlanChangeAction { + public static final PlanChangeAction PLAN_VERSION_MIGRATION = + new PlanChangeAction(Value.PLAN_VERSION_MIGRATION, "plan_version_migration"); + public static final PlanChangeAction CHECKOUT = new PlanChangeAction(Value.CHECKOUT, "checkout"); public static final PlanChangeAction MIGRATION = new PlanChangeAction(Value.MIGRATION, "migration"); @@ -62,6 +65,8 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case PLAN_VERSION_MIGRATION: + return visitor.visitPlanVersionMigration(); case CHECKOUT: return visitor.visitCheckout(); case MIGRATION: @@ -91,6 +96,8 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static PlanChangeAction valueOf(String value) { switch (value) { + case "plan_version_migration": + return PLAN_VERSION_MIGRATION; case "checkout": return CHECKOUT; case "migration": @@ -133,6 +140,8 @@ public enum Value { PLAN_TRAIT_CHANGE, + PLAN_VERSION_MIGRATION, + QUICKSTART, SUBSCRIPTION_CHANGE, @@ -157,6 +166,8 @@ public interface Visitor { T visitPlanTraitChange(); + T visitPlanVersionMigration(); + T visitQuickstart(); T visitSubscriptionChange(); diff --git a/src/main/java/com/schematic/api/types/PlanChangeResponseData.java b/src/main/java/com/schematic/api/types/PlanChangeResponseData.java index 3c01064..b459a7c 100644 --- a/src/main/java/com/schematic/api/types/PlanChangeResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanChangeResponseData.java @@ -34,12 +34,14 @@ public final class PlanChangeResponseData { private final Optional apiKey; - private final Optional apiKeyRequest; + private final Optional auditLog; private final Optional basePlan; private final Optional basePlanAction; + private final Optional basePlanVersion; + private final Optional company; private final String companyId; @@ -52,6 +54,8 @@ public final class PlanChangeResponseData { private final Optional previousBasePlan; + private final Optional previousBasePlanVersion; + private final Optional requestId; private final Optional subscriptionChangeAction; @@ -72,15 +76,17 @@ private PlanChangeResponseData( List addOnsAdded, List addOnsRemoved, Optional apiKey, - Optional apiKeyRequest, + Optional auditLog, Optional basePlan, Optional basePlanAction, + Optional basePlanVersion, Optional company, String companyId, OffsetDateTime createdAt, String environmentId, String id, Optional previousBasePlan, + Optional previousBasePlanVersion, Optional requestId, Optional subscriptionChangeAction, List traitsUpdated, @@ -93,15 +99,17 @@ private PlanChangeResponseData( this.addOnsAdded = addOnsAdded; this.addOnsRemoved = addOnsRemoved; this.apiKey = apiKey; - this.apiKeyRequest = apiKeyRequest; + this.auditLog = auditLog; this.basePlan = basePlan; this.basePlanAction = basePlanAction; + this.basePlanVersion = basePlanVersion; this.company = company; this.companyId = companyId; this.createdAt = createdAt; this.environmentId = environmentId; this.id = id; this.previousBasePlan = previousBasePlan; + this.previousBasePlanVersion = previousBasePlanVersion; this.requestId = requestId; this.subscriptionChangeAction = subscriptionChangeAction; this.traitsUpdated = traitsUpdated; @@ -136,9 +144,9 @@ public Optional getApiKey() { return apiKey; } - @JsonProperty("api_key_request") - public Optional getApiKeyRequest() { - return apiKeyRequest; + @JsonProperty("audit_log") + public Optional getAuditLog() { + return auditLog; } @JsonProperty("base_plan") @@ -146,11 +154,22 @@ 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() { return basePlanAction; } + /** + * @return The plan version that was assigned during this change. + */ + @JsonProperty("base_plan_version") + public Optional getBasePlanVersion() { + return basePlanVersion; + } + @JsonProperty("company") public Optional getCompany() { return company; @@ -181,11 +200,22 @@ public Optional getPreviousBasePlan() { return previousBasePlan; } + /** + * @return The plan version of the previous base plan before this change. + */ + @JsonProperty("previous_base_plan_version") + public Optional getPreviousBasePlanVersion() { + return previousBasePlanVersion; + } + @JsonProperty("request_id") 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() { return subscriptionChangeAction; @@ -231,15 +261,17 @@ private boolean equalTo(PlanChangeResponseData other) { && addOnsAdded.equals(other.addOnsAdded) && addOnsRemoved.equals(other.addOnsRemoved) && apiKey.equals(other.apiKey) - && apiKeyRequest.equals(other.apiKeyRequest) + && auditLog.equals(other.auditLog) && basePlan.equals(other.basePlan) && basePlanAction.equals(other.basePlanAction) + && basePlanVersion.equals(other.basePlanVersion) && company.equals(other.company) && companyId.equals(other.companyId) && createdAt.equals(other.createdAt) && environmentId.equals(other.environmentId) && id.equals(other.id) && previousBasePlan.equals(other.previousBasePlan) + && previousBasePlanVersion.equals(other.previousBasePlanVersion) && requestId.equals(other.requestId) && subscriptionChangeAction.equals(other.subscriptionChangeAction) && traitsUpdated.equals(other.traitsUpdated) @@ -256,15 +288,17 @@ public int hashCode() { this.addOnsAdded, this.addOnsRemoved, this.apiKey, - this.apiKeyRequest, + this.auditLog, this.basePlan, this.basePlanAction, + this.basePlanVersion, this.company, this.companyId, this.createdAt, this.environmentId, this.id, this.previousBasePlan, + this.previousBasePlanVersion, this.requestId, this.subscriptionChangeAction, this.traitsUpdated, @@ -315,6 +349,10 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanChangeResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnsAdded(List addOnsAdded); _FinalStage addAddOnsAdded(PlanSnapshotView addOnsAdded); @@ -331,18 +369,28 @@ public interface _FinalStage { _FinalStage apiKey(ApiKeyResponseData apiKey); - _FinalStage apiKeyRequest(Optional apiKeyRequest); + _FinalStage auditLog(Optional auditLog); - _FinalStage apiKeyRequest(ApiKeyRequestListResponseData apiKeyRequest); + _FinalStage auditLog(AuditLogListResponseData auditLog); _FinalStage basePlan(Optional basePlan); _FinalStage basePlan(PlanSnapshotView basePlan); + /** + *

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

+ */ _FinalStage basePlanAction(Optional basePlanAction); _FinalStage basePlanAction(PlanChangeBasePlanAction basePlanAction); + /** + *

The plan version that was assigned during this change.

+ */ + _FinalStage basePlanVersion(Optional basePlanVersion); + + _FinalStage basePlanVersion(PlanVersionSnapshotView basePlanVersion); + _FinalStage company(Optional company); _FinalStage company(CompanyResponseData company); @@ -351,10 +399,20 @@ public interface _FinalStage { _FinalStage previousBasePlan(PlanSnapshotView previousBasePlan); + /** + *

The plan version of the previous base plan before this change.

+ */ + _FinalStage previousBasePlanVersion(Optional previousBasePlanVersion); + + _FinalStage previousBasePlanVersion(PlanVersionSnapshotView previousBasePlanVersion); + _FinalStage requestId(Optional requestId); _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(PlanChangeSubscriptionAction subscriptionChangeAction); @@ -411,15 +469,19 @@ public static final class Builder private Optional requestId = Optional.empty(); + private Optional previousBasePlanVersion = Optional.empty(); + private Optional previousBasePlan = Optional.empty(); private Optional company = Optional.empty(); + private Optional basePlanVersion = Optional.empty(); + private Optional basePlanAction = Optional.empty(); private Optional basePlan = Optional.empty(); - private Optional apiKeyRequest = Optional.empty(); + private Optional auditLog = Optional.empty(); private Optional apiKey = Optional.empty(); @@ -439,15 +501,17 @@ public Builder from(PlanChangeResponseData other) { addOnsAdded(other.getAddOnsAdded()); addOnsRemoved(other.getAddOnsRemoved()); apiKey(other.getApiKey()); - apiKeyRequest(other.getApiKeyRequest()); + auditLog(other.getAuditLog()); basePlan(other.getBasePlan()); basePlanAction(other.getBasePlanAction()); + basePlanVersion(other.getBasePlanVersion()); company(other.getCompany()); companyId(other.getCompanyId()); createdAt(other.getCreatedAt()); environmentId(other.getEnvironmentId()); id(other.getId()); previousBasePlan(other.getPreviousBasePlan()); + previousBasePlanVersion(other.getPreviousBasePlanVersion()); requestId(other.getRequestId()); subscriptionChangeAction(other.getSubscriptionChangeAction()); traitsUpdated(other.getTraitsUpdated()); @@ -567,12 +631,19 @@ 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(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) { @@ -593,6 +664,26 @@ public _FinalStage requestId(Optional requestId) { return this; } + /** + *

The plan version of the previous base plan before this change.

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

The plan version of the previous base plan before this change.

+ */ + @java.lang.Override + @JsonSetter(value = "previous_base_plan_version", nulls = Nulls.SKIP) + public _FinalStage previousBasePlanVersion(Optional previousBasePlanVersion) { + this.previousBasePlanVersion = previousBasePlanVersion; + return this; + } + @java.lang.Override public _FinalStage previousBasePlan(PlanSnapshotView previousBasePlan) { this.previousBasePlan = Optional.ofNullable(previousBasePlan); @@ -619,12 +710,39 @@ public _FinalStage company(Optional company) { return this; } + /** + *

The plan version that was assigned during this change.

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

The plan version that was assigned during this change.

+ */ + @java.lang.Override + @JsonSetter(value = "base_plan_version", nulls = Nulls.SKIP) + public _FinalStage basePlanVersion(Optional basePlanVersion) { + this.basePlanVersion = basePlanVersion; + 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(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) { @@ -646,15 +764,15 @@ public _FinalStage basePlan(Optional basePlan) { } @java.lang.Override - public _FinalStage apiKeyRequest(ApiKeyRequestListResponseData apiKeyRequest) { - this.apiKeyRequest = Optional.ofNullable(apiKeyRequest); + public _FinalStage auditLog(AuditLogListResponseData auditLog) { + this.auditLog = Optional.ofNullable(auditLog); return this; } @java.lang.Override - @JsonSetter(value = "api_key_request", nulls = Nulls.SKIP) - public _FinalStage apiKeyRequest(Optional apiKeyRequest) { - this.apiKeyRequest = apiKeyRequest; + @JsonSetter(value = "audit_log", nulls = Nulls.SKIP) + public _FinalStage auditLog(Optional auditLog) { + this.auditLog = auditLog; return this; } @@ -727,15 +845,17 @@ public PlanChangeResponseData build() { addOnsAdded, addOnsRemoved, apiKey, - apiKeyRequest, + auditLog, basePlan, basePlanAction, + basePlanVersion, company, companyId, createdAt, environmentId, id, previousBasePlan, + previousBasePlanVersion, requestId, subscriptionChangeAction, traitsUpdated, @@ -744,5 +864,17 @@ public PlanChangeResponseData build() { userName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java index 2245f12..46b8673 100644 --- a/src/main/java/com/schematic/api/types/PlanCreditGrantView.java +++ b/src/main/java/com/schematic/api/types/PlanCreditGrantView.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanCreditGrantView.Builder.class) public final class PlanCreditGrantView { - private final Optional billingCreditAutoTopupAmount; + private final Optional billingCreditAutoTopupAmount; private final Optional billingCreditAutoTopupAmountType; @@ -32,13 +32,15 @@ public final class PlanCreditGrantView { private final Optional billingCreditAutoTopupExpiryUnit; - private final Optional billingCreditAutoTopupExpiryUnitCount; + private final Optional billingCreditAutoTopupExpiryUnitCount; - private final Optional billingCreditAutoTopupThresholdPercent; + private final Optional billingCreditAutoTopupThresholdPercent; private final OffsetDateTime createdAt; - private final int creditAmount; + private final Optional credit; + + private final long creditAmount; private final String creditDescription; @@ -52,7 +54,7 @@ public final class PlanCreditGrantView { private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final String id; @@ -60,11 +62,13 @@ public final class PlanCreditGrantView { private final String planId; + private final Optional planVersionId; + private final Optional pluralName; - private final BillingPlanCreditGrantResetCadence resetCadence; + private final Optional resetCadence; - private final BillingPlanCreditGrantResetStart resetStart; + private final Optional resetStart; private final BillingPlanCreditGrantResetType resetType; @@ -75,28 +79,30 @@ public final class PlanCreditGrantView { private final Map additionalProperties; private PlanCreditGrantView( - Optional billingCreditAutoTopupAmount, + Optional billingCreditAutoTopupAmount, Optional billingCreditAutoTopupAmountType, boolean billingCreditAutoTopupEnabled, Optional billingCreditAutoTopupExpiryType, Optional billingCreditAutoTopupExpiryUnit, - Optional billingCreditAutoTopupExpiryUnitCount, - Optional billingCreditAutoTopupThresholdPercent, + Optional billingCreditAutoTopupExpiryUnitCount, + Optional billingCreditAutoTopupThresholdPercent, OffsetDateTime createdAt, - int creditAmount, + Optional credit, + long creditAmount, String creditDescription, Optional creditIcon, String creditId, String creditName, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, String id, Optional plan, String planId, + Optional planVersionId, Optional pluralName, - BillingPlanCreditGrantResetCadence resetCadence, - BillingPlanCreditGrantResetStart resetStart, + Optional resetCadence, + Optional resetStart, BillingPlanCreditGrantResetType resetType, Optional singularName, OffsetDateTime updatedAt, @@ -109,6 +115,7 @@ private PlanCreditGrantView( this.billingCreditAutoTopupExpiryUnitCount = billingCreditAutoTopupExpiryUnitCount; this.billingCreditAutoTopupThresholdPercent = billingCreditAutoTopupThresholdPercent; this.createdAt = createdAt; + this.credit = credit; this.creditAmount = creditAmount; this.creditDescription = creditDescription; this.creditIcon = creditIcon; @@ -120,6 +127,7 @@ private PlanCreditGrantView( this.id = id; this.plan = plan; this.planId = planId; + this.planVersionId = planVersionId; this.pluralName = pluralName; this.resetCadence = resetCadence; this.resetStart = resetStart; @@ -130,7 +138,7 @@ private PlanCreditGrantView( } @JsonProperty("billing_credit_auto_topup_amount") - public Optional getBillingCreditAutoTopupAmount() { + public Optional getBillingCreditAutoTopupAmount() { return billingCreditAutoTopupAmount; } @@ -155,12 +163,12 @@ public Optional getBillingCreditAutoTopupExpiryUnit() { } @JsonProperty("billing_credit_auto_topup_expiry_unit_count") - public Optional getBillingCreditAutoTopupExpiryUnitCount() { + public Optional getBillingCreditAutoTopupExpiryUnitCount() { return billingCreditAutoTopupExpiryUnitCount; } @JsonProperty("billing_credit_auto_topup_threshold_percent") - public Optional getBillingCreditAutoTopupThresholdPercent() { + public Optional getBillingCreditAutoTopupThresholdPercent() { return billingCreditAutoTopupThresholdPercent; } @@ -169,16 +177,27 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("credit") + public Optional getCredit() { + return credit; + } + @JsonProperty("credit_amount") - public int getCreditAmount() { + public long getCreditAmount() { return creditAmount; } + /** + * @return Deprecated field, will be removed in the future. Use Credit.Description instead. + */ @JsonProperty("credit_description") public String getCreditDescription() { return creditDescription; } + /** + * @return Deprecated field, will be removed in the future. Use Credit.Icon instead. + */ @JsonProperty("credit_icon") public Optional getCreditIcon() { return creditIcon; @@ -189,6 +208,9 @@ public String getCreditId() { return creditId; } + /** + * @return Deprecated field, will be removed in the future. Use Credit.Name instead. + */ @JsonProperty("credit_name") public String getCreditName() { return creditName; @@ -205,7 +227,7 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -224,18 +246,26 @@ public String getPlanId() { return planId; } + @JsonProperty("plan_version_id") + public Optional getPlanVersionId() { + return planVersionId; + } + + /** + * @return Deprecated field, will be removed in the future. Use Credit.PluralName instead. + */ @JsonProperty("plural_name") public Optional getPluralName() { return pluralName; } @JsonProperty("reset_cadence") - public BillingPlanCreditGrantResetCadence getResetCadence() { + public Optional getResetCadence() { return resetCadence; } @JsonProperty("reset_start") - public BillingPlanCreditGrantResetStart getResetStart() { + public Optional getResetStart() { return resetStart; } @@ -244,6 +274,9 @@ public BillingPlanCreditGrantResetType getResetType() { return resetType; } + /** + * @return Deprecated field, will be removed in the future. Use Credit.SingularName instead. + */ @JsonProperty("singular_name") public Optional getSingularName() { return singularName; @@ -274,6 +307,7 @@ private boolean equalTo(PlanCreditGrantView other) { && billingCreditAutoTopupExpiryUnitCount.equals(other.billingCreditAutoTopupExpiryUnitCount) && billingCreditAutoTopupThresholdPercent.equals(other.billingCreditAutoTopupThresholdPercent) && createdAt.equals(other.createdAt) + && credit.equals(other.credit) && creditAmount == other.creditAmount && creditDescription.equals(other.creditDescription) && creditIcon.equals(other.creditIcon) @@ -285,6 +319,7 @@ private boolean equalTo(PlanCreditGrantView other) { && id.equals(other.id) && plan.equals(other.plan) && planId.equals(other.planId) + && planVersionId.equals(other.planVersionId) && pluralName.equals(other.pluralName) && resetCadence.equals(other.resetCadence) && resetStart.equals(other.resetStart) @@ -304,6 +339,7 @@ public int hashCode() { this.billingCreditAutoTopupExpiryUnitCount, this.billingCreditAutoTopupThresholdPercent, this.createdAt, + this.credit, this.creditAmount, this.creditDescription, this.creditIcon, @@ -315,6 +351,7 @@ public int hashCode() { this.id, this.plan, this.planId, + this.planVersionId, this.pluralName, this.resetCadence, this.resetStart, @@ -343,10 +380,13 @@ public interface CreatedAtStage { } public interface CreditAmountStage { - CreditDescriptionStage creditAmount(int creditAmount); + CreditDescriptionStage creditAmount(long creditAmount); } public interface CreditDescriptionStage { + /** + *

Deprecated field, will be removed in the future. Use Credit.Description instead.

+ */ CreditIdStage creditDescription(@NotNull String creditDescription); } @@ -355,6 +395,9 @@ public interface CreditIdStage { } public interface CreditNameStage { + /** + *

Deprecated field, will be removed in the future. Use Credit.Name instead.

+ */ IdStage creditName(@NotNull String creditName); } @@ -363,15 +406,7 @@ public interface IdStage { } public interface PlanIdStage { - ResetCadenceStage planId(@NotNull String planId); - } - - public interface ResetCadenceStage { - ResetStartStage resetCadence(@NotNull BillingPlanCreditGrantResetCadence resetCadence); - } - - public interface ResetStartStage { - ResetTypeStage resetStart(@NotNull BillingPlanCreditGrantResetStart resetStart); + ResetTypeStage planId(@NotNull String planId); } public interface ResetTypeStage { @@ -385,9 +420,13 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanCreditGrantView build(); - _FinalStage billingCreditAutoTopupAmount(Optional billingCreditAutoTopupAmount); + _FinalStage additionalProperty(String key, Object value); - _FinalStage billingCreditAutoTopupAmount(Integer billingCreditAutoTopupAmount); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingCreditAutoTopupAmount(Optional billingCreditAutoTopupAmount); + + _FinalStage billingCreditAutoTopupAmount(Long billingCreditAutoTopupAmount); _FinalStage billingCreditAutoTopupAmountType(Optional billingCreditAutoTopupAmountType); @@ -403,14 +442,21 @@ _FinalStage billingCreditAutoTopupExpiryUnit( _FinalStage billingCreditAutoTopupExpiryUnit(BillingCreditExpiryUnit billingCreditAutoTopupExpiryUnit); - _FinalStage billingCreditAutoTopupExpiryUnitCount(Optional billingCreditAutoTopupExpiryUnitCount); + _FinalStage billingCreditAutoTopupExpiryUnitCount(Optional billingCreditAutoTopupExpiryUnitCount); + + _FinalStage billingCreditAutoTopupExpiryUnitCount(Long billingCreditAutoTopupExpiryUnitCount); - _FinalStage billingCreditAutoTopupExpiryUnitCount(Integer billingCreditAutoTopupExpiryUnitCount); + _FinalStage billingCreditAutoTopupThresholdPercent(Optional billingCreditAutoTopupThresholdPercent); - _FinalStage billingCreditAutoTopupThresholdPercent(Optional billingCreditAutoTopupThresholdPercent); + _FinalStage billingCreditAutoTopupThresholdPercent(Long billingCreditAutoTopupThresholdPercent); - _FinalStage billingCreditAutoTopupThresholdPercent(Integer billingCreditAutoTopupThresholdPercent); + _FinalStage credit(Optional credit); + _FinalStage credit(BillingCreditView credit); + + /** + *

Deprecated field, will be removed in the future. Use Credit.Icon instead.

+ */ _FinalStage creditIcon(Optional creditIcon); _FinalStage creditIcon(String creditIcon); @@ -423,18 +469,36 @@ _FinalStage billingCreditAutoTopupExpiryUnit( _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage plan(Optional plan); _FinalStage plan(GenericPreviewObject plan); + _FinalStage planVersionId(Optional planVersionId); + + _FinalStage planVersionId(String planVersionId); + + /** + *

Deprecated field, will be removed in the future. Use Credit.PluralName instead.

+ */ _FinalStage pluralName(Optional pluralName); _FinalStage pluralName(String pluralName); + _FinalStage resetCadence(Optional resetCadence); + + _FinalStage resetCadence(BillingPlanCreditGrantResetCadence resetCadence); + + _FinalStage resetStart(Optional resetStart); + + _FinalStage resetStart(BillingPlanCreditGrantResetStart resetStart); + + /** + *

Deprecated field, will be removed in the future. Use Credit.SingularName instead.

+ */ _FinalStage singularName(Optional singularName); _FinalStage singularName(String singularName); @@ -450,8 +514,6 @@ public static final class Builder CreditNameStage, IdStage, PlanIdStage, - ResetCadenceStage, - ResetStartStage, ResetTypeStage, UpdatedAtStage, _FinalStage { @@ -459,7 +521,7 @@ public static final class Builder private OffsetDateTime createdAt; - private int creditAmount; + private long creditAmount; private String creditDescription; @@ -471,21 +533,23 @@ public static final class Builder private String planId; - private BillingPlanCreditGrantResetCadence resetCadence; - - private BillingPlanCreditGrantResetStart resetStart; - private BillingPlanCreditGrantResetType resetType; private OffsetDateTime updatedAt; private Optional singularName = Optional.empty(); + private Optional resetStart = Optional.empty(); + + private Optional resetCadence = Optional.empty(); + private Optional pluralName = Optional.empty(); + private Optional planVersionId = Optional.empty(); + private Optional plan = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); @@ -493,9 +557,11 @@ public static final class Builder private Optional creditIcon = Optional.empty(); - private Optional billingCreditAutoTopupThresholdPercent = Optional.empty(); + private Optional credit = Optional.empty(); + + private Optional billingCreditAutoTopupThresholdPercent = Optional.empty(); - private Optional billingCreditAutoTopupExpiryUnitCount = Optional.empty(); + private Optional billingCreditAutoTopupExpiryUnitCount = Optional.empty(); private Optional billingCreditAutoTopupExpiryUnit = Optional.empty(); @@ -503,7 +569,7 @@ public static final class Builder private Optional billingCreditAutoTopupAmountType = Optional.empty(); - private Optional billingCreditAutoTopupAmount = Optional.empty(); + private Optional billingCreditAutoTopupAmount = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -520,6 +586,7 @@ public Builder from(PlanCreditGrantView other) { billingCreditAutoTopupExpiryUnitCount(other.getBillingCreditAutoTopupExpiryUnitCount()); billingCreditAutoTopupThresholdPercent(other.getBillingCreditAutoTopupThresholdPercent()); createdAt(other.getCreatedAt()); + credit(other.getCredit()); creditAmount(other.getCreditAmount()); creditDescription(other.getCreditDescription()); creditIcon(other.getCreditIcon()); @@ -531,6 +598,7 @@ public Builder from(PlanCreditGrantView other) { id(other.getId()); plan(other.getPlan()); planId(other.getPlanId()); + planVersionId(other.getPlanVersionId()); pluralName(other.getPluralName()); resetCadence(other.getResetCadence()); resetStart(other.getResetStart()); @@ -556,11 +624,16 @@ public CreditAmountStage createdAt(@NotNull OffsetDateTime createdAt) { @java.lang.Override @JsonSetter("credit_amount") - public CreditDescriptionStage creditAmount(int creditAmount) { + public CreditDescriptionStage creditAmount(long creditAmount) { this.creditAmount = creditAmount; return this; } + /** + *

Deprecated field, will be removed in the future. Use Credit.Description instead.

+ *

Deprecated field, will be removed in the future. Use Credit.Description instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("credit_description") public CreditIdStage creditDescription(@NotNull String creditDescription) { @@ -575,6 +648,11 @@ public CreditNameStage creditId(@NotNull String creditId) { return this; } + /** + *

Deprecated field, will be removed in the future. Use Credit.Name instead.

+ *

Deprecated field, will be removed in the future. Use Credit.Name instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("credit_name") public IdStage creditName(@NotNull String creditName) { @@ -591,25 +669,11 @@ public PlanIdStage id(@NotNull String id) { @java.lang.Override @JsonSetter("plan_id") - public ResetCadenceStage planId(@NotNull String planId) { + public ResetTypeStage 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 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 BillingPlanCreditGrantResetType resetType) { @@ -624,12 +688,19 @@ public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { return this; } + /** + *

Deprecated field, will be removed in the future. Use Credit.SingularName instead.

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

Deprecated field, will be removed in the future. Use Credit.SingularName instead.

+ */ @java.lang.Override @JsonSetter(value = "singular_name", nulls = Nulls.SKIP) public _FinalStage singularName(Optional singularName) { @@ -637,12 +708,45 @@ public _FinalStage singularName(Optional singularName) { return this; } + @java.lang.Override + public _FinalStage resetStart(BillingPlanCreditGrantResetStart resetStart) { + this.resetStart = Optional.ofNullable(resetStart); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_start", nulls = Nulls.SKIP) + public _FinalStage resetStart(Optional resetStart) { + this.resetStart = resetStart; + return this; + } + + @java.lang.Override + public _FinalStage resetCadence(BillingPlanCreditGrantResetCadence resetCadence) { + this.resetCadence = Optional.ofNullable(resetCadence); + return this; + } + + @java.lang.Override + @JsonSetter(value = "reset_cadence", nulls = Nulls.SKIP) + public _FinalStage resetCadence(Optional resetCadence) { + this.resetCadence = resetCadence; + return this; + } + + /** + *

Deprecated field, will be removed in the future. Use Credit.PluralName instead.

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

Deprecated field, will be removed in the future. Use Credit.PluralName instead.

+ */ @java.lang.Override @JsonSetter(value = "plural_name", nulls = Nulls.SKIP) public _FinalStage pluralName(Optional pluralName) { @@ -650,6 +754,19 @@ public _FinalStage pluralName(Optional pluralName) { 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 plan(GenericPreviewObject plan) { this.plan = Optional.ofNullable(plan); @@ -664,14 +781,14 @@ public _FinalStage plan(Optional plan) { } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -702,12 +819,19 @@ public _FinalStage expiryType(Optional expiryType) { return this; } + /** + *

Deprecated field, will be removed in the future. Use Credit.Icon instead.

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

Deprecated field, will be removed in the future. Use Credit.Icon instead.

+ */ @java.lang.Override @JsonSetter(value = "credit_icon", nulls = Nulls.SKIP) public _FinalStage creditIcon(Optional creditIcon) { @@ -716,7 +840,20 @@ public _FinalStage creditIcon(Optional creditIcon) { } @java.lang.Override - public _FinalStage billingCreditAutoTopupThresholdPercent(Integer billingCreditAutoTopupThresholdPercent) { + public _FinalStage credit(BillingCreditView 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 billingCreditAutoTopupThresholdPercent(Long billingCreditAutoTopupThresholdPercent) { this.billingCreditAutoTopupThresholdPercent = Optional.ofNullable(billingCreditAutoTopupThresholdPercent); return this; } @@ -724,21 +861,20 @@ public _FinalStage billingCreditAutoTopupThresholdPercent(Integer billingCreditA @java.lang.Override @JsonSetter(value = "billing_credit_auto_topup_threshold_percent", nulls = Nulls.SKIP) public _FinalStage billingCreditAutoTopupThresholdPercent( - Optional billingCreditAutoTopupThresholdPercent) { + Optional billingCreditAutoTopupThresholdPercent) { this.billingCreditAutoTopupThresholdPercent = billingCreditAutoTopupThresholdPercent; return this; } @java.lang.Override - public _FinalStage billingCreditAutoTopupExpiryUnitCount(Integer billingCreditAutoTopupExpiryUnitCount) { + public _FinalStage billingCreditAutoTopupExpiryUnitCount(Long 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) { + public _FinalStage billingCreditAutoTopupExpiryUnitCount(Optional billingCreditAutoTopupExpiryUnitCount) { this.billingCreditAutoTopupExpiryUnitCount = billingCreditAutoTopupExpiryUnitCount; return this; } @@ -785,14 +921,14 @@ public _FinalStage billingCreditAutoTopupAmountType(Optional billingCred } @java.lang.Override - public _FinalStage billingCreditAutoTopupAmount(Integer billingCreditAutoTopupAmount) { + public _FinalStage billingCreditAutoTopupAmount(Long 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) { + public _FinalStage billingCreditAutoTopupAmount(Optional billingCreditAutoTopupAmount) { this.billingCreditAutoTopupAmount = billingCreditAutoTopupAmount; return this; } @@ -808,6 +944,7 @@ public PlanCreditGrantView build() { billingCreditAutoTopupExpiryUnitCount, billingCreditAutoTopupThresholdPercent, createdAt, + credit, creditAmount, creditDescription, creditIcon, @@ -819,6 +956,7 @@ public PlanCreditGrantView build() { id, plan, planId, + planVersionId, pluralName, resetCadence, resetStart, @@ -827,5 +965,17 @@ public PlanCreditGrantView build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanCurrencyPriceRequestBody.java b/src/main/java/com/schematic/api/types/PlanCurrencyPriceRequestBody.java new file mode 100644 index 0000000..f0cef05 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanCurrencyPriceRequestBody.java @@ -0,0 +1,213 @@ +/** + * 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 = PlanCurrencyPriceRequestBody.Builder.class) +public final class PlanCurrencyPriceRequestBody { + private final String currency; + + private final Optional monthlyPrice; + + private final Optional oneTimePrice; + + private final Optional yearlyPrice; + + private final Map additionalProperties; + + private PlanCurrencyPriceRequestBody( + String currency, + Optional monthlyPrice, + Optional oneTimePrice, + Optional yearlyPrice, + Map additionalProperties) { + this.currency = currency; + this.monthlyPrice = monthlyPrice; + this.oneTimePrice = oneTimePrice; + this.yearlyPrice = yearlyPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("monthly_price") + public Optional getMonthlyPrice() { + return monthlyPrice; + } + + @JsonProperty("one_time_price") + public Optional getOneTimePrice() { + return oneTimePrice; + } + + @JsonProperty("yearly_price") + public Optional getYearlyPrice() { + return yearlyPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanCurrencyPriceRequestBody && equalTo((PlanCurrencyPriceRequestBody) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanCurrencyPriceRequestBody other) { + return currency.equals(other.currency) + && monthlyPrice.equals(other.monthlyPrice) + && oneTimePrice.equals(other.oneTimePrice) + && yearlyPrice.equals(other.yearlyPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.monthlyPrice, this.oneTimePrice, this.yearlyPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(PlanCurrencyPriceRequestBody other); + } + + public interface _FinalStage { + PlanCurrencyPriceRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(Long monthlyPrice); + + _FinalStage oneTimePrice(Optional oneTimePrice); + + _FinalStage oneTimePrice(Long oneTimePrice); + + _FinalStage yearlyPrice(Optional yearlyPrice); + + _FinalStage yearlyPrice(Long yearlyPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional yearlyPrice = Optional.empty(); + + private Optional oneTimePrice = Optional.empty(); + + private Optional monthlyPrice = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanCurrencyPriceRequestBody other) { + currency(other.getCurrency()); + monthlyPrice(other.getMonthlyPrice()); + oneTimePrice(other.getOneTimePrice()); + yearlyPrice(other.getYearlyPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage yearlyPrice(Long yearlyPrice) { + this.yearlyPrice = Optional.ofNullable(yearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) + public _FinalStage yearlyPrice(Optional yearlyPrice) { + this.yearlyPrice = yearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage oneTimePrice(Long oneTimePrice) { + this.oneTimePrice = Optional.ofNullable(oneTimePrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "one_time_price", nulls = Nulls.SKIP) + public _FinalStage oneTimePrice(Optional oneTimePrice) { + this.oneTimePrice = oneTimePrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPrice(Long monthlyPrice) { + this.monthlyPrice = Optional.ofNullable(monthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) + public _FinalStage monthlyPrice(Optional monthlyPrice) { + this.monthlyPrice = monthlyPrice; + return this; + } + + @java.lang.Override + public PlanCurrencyPriceRequestBody build() { + return new PlanCurrencyPriceRequestBody( + currency, monthlyPrice, oneTimePrice, yearlyPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanCurrencyPricesResponseData.java b/src/main/java/com/schematic/api/types/PlanCurrencyPricesResponseData.java new file mode 100644 index 0000000..738d39b --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanCurrencyPricesResponseData.java @@ -0,0 +1,213 @@ +/** + * 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 = PlanCurrencyPricesResponseData.Builder.class) +public final class PlanCurrencyPricesResponseData { + private final String currency; + + private final Optional monthlyPrice; + + private final Optional oneTimePrice; + + private final Optional yearlyPrice; + + private final Map additionalProperties; + + private PlanCurrencyPricesResponseData( + String currency, + Optional monthlyPrice, + Optional oneTimePrice, + Optional yearlyPrice, + Map additionalProperties) { + this.currency = currency; + this.monthlyPrice = monthlyPrice; + this.oneTimePrice = oneTimePrice; + this.yearlyPrice = yearlyPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("monthly_price") + public Optional getMonthlyPrice() { + return monthlyPrice; + } + + @JsonProperty("one_time_price") + public Optional getOneTimePrice() { + return oneTimePrice; + } + + @JsonProperty("yearly_price") + public Optional getYearlyPrice() { + return yearlyPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanCurrencyPricesResponseData && equalTo((PlanCurrencyPricesResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanCurrencyPricesResponseData other) { + return currency.equals(other.currency) + && monthlyPrice.equals(other.monthlyPrice) + && oneTimePrice.equals(other.oneTimePrice) + && yearlyPrice.equals(other.yearlyPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.currency, this.monthlyPrice, this.oneTimePrice, this.yearlyPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + _FinalStage currency(@NotNull String currency); + + Builder from(PlanCurrencyPricesResponseData other); + } + + public interface _FinalStage { + PlanCurrencyPricesResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); + + _FinalStage oneTimePrice(Optional oneTimePrice); + + _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice); + + _FinalStage yearlyPrice(Optional yearlyPrice); + + _FinalStage yearlyPrice(BillingPriceResponseData yearlyPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CurrencyStage, _FinalStage { + private String currency; + + private Optional yearlyPrice = Optional.empty(); + + private Optional oneTimePrice = Optional.empty(); + + private Optional monthlyPrice = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanCurrencyPricesResponseData other) { + currency(other.getCurrency()); + monthlyPrice(other.getMonthlyPrice()); + oneTimePrice(other.getOneTimePrice()); + yearlyPrice(other.getYearlyPrice()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public _FinalStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage yearlyPrice(BillingPriceResponseData yearlyPrice) { + this.yearlyPrice = Optional.ofNullable(yearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) + public _FinalStage yearlyPrice(Optional yearlyPrice) { + this.yearlyPrice = yearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice) { + this.oneTimePrice = Optional.ofNullable(oneTimePrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "one_time_price", nulls = Nulls.SKIP) + public _FinalStage oneTimePrice(Optional oneTimePrice) { + this.oneTimePrice = oneTimePrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice) { + this.monthlyPrice = Optional.ofNullable(monthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) + public _FinalStage monthlyPrice(Optional monthlyPrice) { + this.monthlyPrice = monthlyPrice; + return this; + } + + @java.lang.Override + public PlanCurrencyPricesResponseData build() { + return new PlanCurrencyPricesResponseData( + currency, monthlyPrice, oneTimePrice, yearlyPrice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java index ae9a77d..e5a85a1 100644 --- a/src/main/java/com/schematic/api/types/PlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanDetailResponseData.java @@ -24,20 +24,26 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanDetailResponseData.Builder.class) public final class PlanDetailResponseData { + private final Optional activeVersion; + private final Optional audienceType; private final Optional billingProduct; private final ChargeType chargeType; - private final int companyCount; + private final long companyCount; private final PlanControlledByType controlledBy; private final OffsetDateTime createdAt; + private final List currencyPrices; + private final String description; + private final Optional draftVersion; + private final List features; private final String icon; @@ -60,7 +66,7 @@ public final class PlanDetailResponseData { private final PlanType planType; - private final Optional trialDays; + private final Optional trialDays; private final OffsetDateTime updatedAt; @@ -71,13 +77,16 @@ public final class PlanDetailResponseData { private final Map additionalProperties; private PlanDetailResponseData( + Optional activeVersion, Optional audienceType, Optional billingProduct, ChargeType chargeType, - int companyCount, + long companyCount, PlanControlledByType controlledBy, OffsetDateTime createdAt, + List currencyPrices, String description, + Optional draftVersion, List features, String icon, String id, @@ -89,18 +98,21 @@ private PlanDetailResponseData( String name, Optional oneTimePrice, PlanType planType, - Optional trialDays, + Optional trialDays, OffsetDateTime updatedAt, List versions, Optional yearlyPrice, Map additionalProperties) { + this.activeVersion = activeVersion; this.audienceType = audienceType; this.billingProduct = billingProduct; this.chargeType = chargeType; this.companyCount = companyCount; this.controlledBy = controlledBy; this.createdAt = createdAt; + this.currencyPrices = currencyPrices; this.description = description; + this.draftVersion = draftVersion; this.features = features; this.icon = icon; this.id = id; @@ -119,6 +131,11 @@ private PlanDetailResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("active_version") + public Optional getActiveVersion() { + return activeVersion; + } + @JsonProperty("audience_type") public Optional getAudienceType() { return audienceType; @@ -135,7 +152,7 @@ public ChargeType getChargeType() { } @JsonProperty("company_count") - public int getCompanyCount() { + public long getCompanyCount() { return companyCount; } @@ -149,11 +166,21 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("description") public String getDescription() { return description; } + @JsonProperty("draft_version") + public Optional getDraftVersion() { + return draftVersion; + } + @JsonProperty("features") public List getFeatures() { return features; @@ -210,7 +237,7 @@ public PlanType getPlanType() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -241,13 +268,16 @@ public Map getAdditionalProperties() { } private boolean equalTo(PlanDetailResponseData other) { - return audienceType.equals(other.audienceType) + return activeVersion.equals(other.activeVersion) + && audienceType.equals(other.audienceType) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCount == other.companyCount && controlledBy.equals(other.controlledBy) && createdAt.equals(other.createdAt) + && currencyPrices.equals(other.currencyPrices) && description.equals(other.description) + && draftVersion.equals(other.draftVersion) && features.equals(other.features) && icon.equals(other.icon) && id.equals(other.id) @@ -268,13 +298,16 @@ private boolean equalTo(PlanDetailResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.activeVersion, this.audienceType, this.billingProduct, this.chargeType, this.companyCount, this.controlledBy, this.createdAt, + this.currencyPrices, this.description, + this.draftVersion, this.features, this.icon, this.id, @@ -308,7 +341,7 @@ public interface ChargeTypeStage { } public interface CompanyCountStage { - ControlledByStage companyCount(int companyCount); + ControlledByStage companyCount(long companyCount); } public interface ControlledByStage { @@ -358,6 +391,14 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage activeVersion(Optional activeVersion); + + _FinalStage activeVersion(PlanVersionResponseData activeVersion); + _FinalStage audienceType(Optional audienceType); _FinalStage audienceType(String audienceType); @@ -366,6 +407,16 @@ public interface _FinalStage { _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage draftVersion(Optional draftVersion); + + _FinalStage draftVersion(PlanVersionResponseData draftVersion); + _FinalStage features(List features); _FinalStage addFeatures(FeatureDetailResponseData features); @@ -384,9 +435,9 @@ public interface _FinalStage { _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage versions(List versions); @@ -417,7 +468,7 @@ public static final class Builder _FinalStage { private ChargeType chargeType; - private int companyCount; + private long companyCount; private PlanControlledByType controlledBy; @@ -445,7 +496,7 @@ public static final class Builder private List versions = new ArrayList<>(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional oneTimePrice = Optional.empty(); @@ -455,10 +506,16 @@ public static final class Builder private List features = new ArrayList<>(); + private Optional draftVersion = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); + private Optional billingProduct = Optional.empty(); private Optional audienceType = Optional.empty(); + private Optional activeVersion = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -466,13 +523,16 @@ private Builder() {} @java.lang.Override public Builder from(PlanDetailResponseData other) { + activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); companyCount(other.getCompanyCount()); controlledBy(other.getControlledBy()); createdAt(other.getCreatedAt()); + currencyPrices(other.getCurrencyPrices()); description(other.getDescription()); + draftVersion(other.getDraftVersion()); features(other.getFeatures()); icon(other.getIcon()); id(other.getId()); @@ -500,7 +560,7 @@ public CompanyCountStage chargeType(@NotNull ChargeType chargeType) { @java.lang.Override @JsonSetter("company_count") - public ControlledByStage companyCount(int companyCount) { + public ControlledByStage companyCount(long companyCount) { this.companyCount = companyCount; return this; } @@ -620,14 +680,14 @@ public _FinalStage versions(List versions) { } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -696,6 +756,43 @@ public _FinalStage features(List features) { return this; } + @java.lang.Override + public _FinalStage draftVersion(PlanVersionResponseData draftVersion) { + this.draftVersion = Optional.ofNullable(draftVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "draft_version", nulls = Nulls.SKIP) + public _FinalStage draftVersion(Optional draftVersion) { + this.draftVersion = draftVersion; + return this; + } + + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + @java.lang.Override public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { this.billingProduct = Optional.ofNullable(billingProduct); @@ -722,16 +819,32 @@ public _FinalStage audienceType(Optional audienceType) { return this; } + @java.lang.Override + public _FinalStage activeVersion(PlanVersionResponseData activeVersion) { + this.activeVersion = Optional.ofNullable(activeVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active_version", nulls = Nulls.SKIP) + public _FinalStage activeVersion(Optional activeVersion) { + this.activeVersion = activeVersion; + return this; + } + @java.lang.Override public PlanDetailResponseData build() { return new PlanDetailResponseData( + activeVersion, audienceType, billingProduct, chargeType, companyCount, controlledBy, createdAt, + currencyPrices, description, + draftVersion, features, icon, id, @@ -749,5 +862,17 @@ public PlanDetailResponseData build() { yearlyPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java index d779430..1aa473c 100644 --- a/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanEntitlementResponseData.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; @@ -22,12 +24,14 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanEntitlementResponseData.Builder.class) public final class PlanEntitlementResponseData { - private final Optional billingThreshold; + private final Optional billingThreshold; private final Optional consumptionRate; private final OffsetDateTime createdAt; + private final List currencyPrices; + private final String environmentId; private final Optional feature; @@ -54,7 +58,7 @@ public final class PlanEntitlementResponseData { private final Optional ruleIdUsageExceeded; - private final Optional softLimit; + private final Optional softLimit; private final OffsetDateTime updatedAt; @@ -64,7 +68,7 @@ public final class PlanEntitlementResponseData { private final Optional valueCredit; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTrait; @@ -75,9 +79,10 @@ public final class PlanEntitlementResponseData { private final Map additionalProperties; private PlanEntitlementResponseData( - Optional billingThreshold, + Optional billingThreshold, Optional consumptionRate, OffsetDateTime createdAt, + List currencyPrices, String environmentId, Optional feature, String featureId, @@ -91,12 +96,12 @@ private PlanEntitlementResponseData( Optional priceBehavior, String ruleId, Optional ruleIdUsageExceeded, - Optional softLimit, + Optional softLimit, OffsetDateTime updatedAt, Optional usageBasedProduct, Optional valueBool, Optional valueCredit, - Optional valueNumeric, + Optional valueNumeric, Optional valueTrait, Optional valueTraitId, EntitlementValueType valueType, @@ -104,6 +109,7 @@ private PlanEntitlementResponseData( this.billingThreshold = billingThreshold; this.consumptionRate = consumptionRate; this.createdAt = createdAt; + this.currencyPrices = currencyPrices; this.environmentId = environmentId; this.feature = feature; this.featureId = featureId; @@ -130,7 +136,7 @@ private PlanEntitlementResponseData( } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -144,6 +150,11 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("environment_id") public String getEnvironmentId() { return environmentId; @@ -210,7 +221,7 @@ public Optional getRuleIdUsageExceeded() { } @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -235,7 +246,7 @@ public Optional getValueCredit() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -269,6 +280,7 @@ private boolean equalTo(PlanEntitlementResponseData other) { return billingThreshold.equals(other.billingThreshold) && consumptionRate.equals(other.consumptionRate) && createdAt.equals(other.createdAt) + && currencyPrices.equals(other.currencyPrices) && environmentId.equals(other.environmentId) && feature.equals(other.feature) && featureId.equals(other.featureId) @@ -299,6 +311,7 @@ public int hashCode() { this.billingThreshold, this.consumptionRate, this.createdAt, + this.currencyPrices, this.environmentId, this.feature, this.featureId, @@ -369,14 +382,24 @@ public interface ValueTypeStage { public interface _FinalStage { PlanEntitlementResponseData build(); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage billingThreshold(Optional billingThreshold); + + _FinalStage billingThreshold(Long billingThreshold); _FinalStage consumptionRate(Optional consumptionRate); _FinalStage consumptionRate(Double consumptionRate); + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(EntitlementCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + _FinalStage feature(Optional feature); _FinalStage feature(FeatureResponseData feature); @@ -409,9 +432,9 @@ public interface _FinalStage { _FinalStage ruleIdUsageExceeded(String ruleIdUsageExceeded); - _FinalStage softLimit(Optional softLimit); + _FinalStage softLimit(Optional softLimit); - _FinalStage softLimit(Integer softLimit); + _FinalStage softLimit(Long softLimit); _FinalStage usageBasedProduct(Optional usageBasedProduct); @@ -425,9 +448,9 @@ public interface _FinalStage { _FinalStage valueCredit(BillingCreditResponseData valueCredit); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTrait(Optional valueTrait); @@ -469,7 +492,7 @@ public static final class Builder private Optional valueTrait = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCredit = Optional.empty(); @@ -477,7 +500,7 @@ public static final class Builder private Optional usageBasedProduct = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional ruleIdUsageExceeded = Optional.empty(); @@ -495,9 +518,11 @@ public static final class Builder private Optional feature = Optional.empty(); + private List currencyPrices = new ArrayList<>(); + private Optional consumptionRate = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -509,6 +534,7 @@ public Builder from(PlanEntitlementResponseData other) { billingThreshold(other.getBillingThreshold()); consumptionRate(other.getConsumptionRate()); createdAt(other.getCreatedAt()); + currencyPrices(other.getCurrencyPrices()); environmentId(other.getEnvironmentId()); feature(other.getFeature()); featureId(other.getFeatureId()); @@ -617,14 +643,14 @@ public _FinalStage valueTrait(Optional valueT } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -669,14 +695,14 @@ public _FinalStage usageBasedProduct(Optional usageB } @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -785,6 +811,30 @@ public _FinalStage feature(Optional feature) { return this; } + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(EntitlementCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + @java.lang.Override public _FinalStage consumptionRate(Double consumptionRate) { this.consumptionRate = Optional.ofNullable(consumptionRate); @@ -799,14 +849,14 @@ public _FinalStage consumptionRate(Optional consumptionRate) { } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -817,6 +867,7 @@ public PlanEntitlementResponseData build() { billingThreshold, consumptionRate, createdAt, + currencyPrices, environmentId, feature, featureId, @@ -841,5 +892,17 @@ public PlanEntitlementResponseData build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanEntitlementsOrder.java b/src/main/java/com/schematic/api/types/PlanEntitlementsOrder.java index 7296c1f..ea43997 100644 --- a/src/main/java/com/schematic/api/types/PlanEntitlementsOrder.java +++ b/src/main/java/com/schematic/api/types/PlanEntitlementsOrder.java @@ -82,6 +82,10 @@ public interface PlanEntitlementIdStage { public interface _FinalStage { PlanEntitlementsOrder build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage visible(Optional visible); _FinalStage visible(Boolean visible); @@ -129,5 +133,17 @@ public _FinalStage visible(Optional visible) { public PlanEntitlementsOrder build() { return new PlanEntitlementsOrder(planEntitlementId, visible, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanGroupBundleOrder.java b/src/main/java/com/schematic/api/types/PlanGroupBundleOrder.java index 04f892c..858f160 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupBundleOrder.java +++ b/src/main/java/com/schematic/api/types/PlanGroupBundleOrder.java @@ -70,6 +70,10 @@ public interface BundleIdStage { public interface _FinalStage { PlanGroupBundleOrder build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -98,5 +102,17 @@ public _FinalStage bundleId(@NotNull String bundleId) { public PlanGroupBundleOrder build() { return new PlanGroupBundleOrder(bundleId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java index 62e29a2..fc4658f 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupDetailResponseData.java @@ -85,7 +85,7 @@ public final class PlanGroupDetailResponseData { private final boolean taxCollectionEnabled; - private final Optional trialDays; + private final Optional trialDays; private final Optional trialExpiryPlan; @@ -131,7 +131,7 @@ private PlanGroupDetailResponseData( boolean showZeroPriceAsFree, boolean syncCustomerBillingDetails, boolean taxCollectionEnabled, - Optional trialDays, + Optional trialDays, Optional trialExpiryPlan, Optional trialExpiryPlanId, Optional trialExpiryPlanPrice, @@ -334,7 +334,7 @@ public boolean getTaxCollectionEnabled() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -518,6 +518,10 @@ public interface TaxCollectionEnabledStage { public interface _FinalStage { PlanGroupDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOns(List addOns); _FinalStage addAddOns(PlanGroupPlanDetailResponseData addOns); @@ -604,9 +608,9 @@ public interface _FinalStage { _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage trialExpiryPlan(Optional trialExpiryPlan); @@ -678,7 +682,7 @@ public static final class Builder private Optional trialExpiryPlan = Optional.empty(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); @@ -915,14 +919,14 @@ public _FinalStage trialExpiryPlan(Optional tri } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -1273,5 +1277,17 @@ public PlanGroupDetailResponseData build() { trialPaymentMethodRequired, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java index ed1915a..1b31de5 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanDetailResponseData.java @@ -24,13 +24,15 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PlanGroupPlanDetailResponseData.Builder.class) public final class PlanGroupPlanDetailResponseData { + private final Optional activeVersion; + private final Optional audienceType; private final Optional billingProduct; private final ChargeType chargeType; - private final int companyCount; + private final long companyCount; private final List compatiblePlanIds; @@ -38,10 +40,14 @@ public final class PlanGroupPlanDetailResponseData { private final OffsetDateTime createdAt; + private final List currencyPrices; + private final Optional customPlanConfig; private final String description; + private final Optional draftVersion; + private final List entitlements; private final List features; @@ -68,7 +74,7 @@ public final class PlanGroupPlanDetailResponseData { private final PlanType planType; - private final Optional trialDays; + private final Optional trialDays; private final OffsetDateTime updatedAt; @@ -79,15 +85,18 @@ public final class PlanGroupPlanDetailResponseData { private final Map additionalProperties; private PlanGroupPlanDetailResponseData( + Optional activeVersion, Optional audienceType, Optional billingProduct, ChargeType chargeType, - int companyCount, + long companyCount, List compatiblePlanIds, PlanControlledByType controlledBy, OffsetDateTime createdAt, + List currencyPrices, Optional customPlanConfig, String description, + Optional draftVersion, List entitlements, List features, String icon, @@ -101,11 +110,12 @@ private PlanGroupPlanDetailResponseData( String name, Optional oneTimePrice, PlanType planType, - Optional trialDays, + Optional trialDays, OffsetDateTime updatedAt, List versions, Optional yearlyPrice, Map additionalProperties) { + this.activeVersion = activeVersion; this.audienceType = audienceType; this.billingProduct = billingProduct; this.chargeType = chargeType; @@ -113,8 +123,10 @@ private PlanGroupPlanDetailResponseData( this.compatiblePlanIds = compatiblePlanIds; this.controlledBy = controlledBy; this.createdAt = createdAt; + this.currencyPrices = currencyPrices; this.customPlanConfig = customPlanConfig; this.description = description; + this.draftVersion = draftVersion; this.entitlements = entitlements; this.features = features; this.icon = icon; @@ -135,6 +147,11 @@ private PlanGroupPlanDetailResponseData( this.additionalProperties = additionalProperties; } + @JsonProperty("active_version") + public Optional getActiveVersion() { + return activeVersion; + } + @JsonProperty("audience_type") public Optional getAudienceType() { return audienceType; @@ -151,7 +168,7 @@ public ChargeType getChargeType() { } @JsonProperty("company_count") - public int getCompanyCount() { + public long getCompanyCount() { return companyCount; } @@ -170,6 +187,11 @@ public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("custom_plan_config") public Optional getCustomPlanConfig() { return customPlanConfig; @@ -180,6 +202,11 @@ public String getDescription() { return description; } + @JsonProperty("draft_version") + public Optional getDraftVersion() { + return draftVersion; + } + @JsonProperty("entitlements") public List getEntitlements() { return entitlements; @@ -246,7 +273,7 @@ public PlanType getPlanType() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -277,15 +304,18 @@ public Map getAdditionalProperties() { } private boolean equalTo(PlanGroupPlanDetailResponseData other) { - return audienceType.equals(other.audienceType) + return activeVersion.equals(other.activeVersion) + && audienceType.equals(other.audienceType) && billingProduct.equals(other.billingProduct) && chargeType.equals(other.chargeType) && companyCount == other.companyCount && compatiblePlanIds.equals(other.compatiblePlanIds) && controlledBy.equals(other.controlledBy) && createdAt.equals(other.createdAt) + && currencyPrices.equals(other.currencyPrices) && customPlanConfig.equals(other.customPlanConfig) && description.equals(other.description) + && draftVersion.equals(other.draftVersion) && entitlements.equals(other.entitlements) && features.equals(other.features) && icon.equals(other.icon) @@ -308,6 +338,7 @@ private boolean equalTo(PlanGroupPlanDetailResponseData other) { @java.lang.Override public int hashCode() { return Objects.hash( + this.activeVersion, this.audienceType, this.billingProduct, this.chargeType, @@ -315,8 +346,10 @@ public int hashCode() { this.compatiblePlanIds, this.controlledBy, this.createdAt, + this.currencyPrices, this.customPlanConfig, this.description, + this.draftVersion, this.entitlements, this.features, this.icon, @@ -352,7 +385,7 @@ public interface ChargeTypeStage { } public interface CompanyCountStage { - ControlledByStage companyCount(int companyCount); + ControlledByStage companyCount(long companyCount); } public interface ControlledByStage { @@ -406,6 +439,14 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanGroupPlanDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage activeVersion(Optional activeVersion); + + _FinalStage activeVersion(PlanVersionResponseData activeVersion); + _FinalStage audienceType(Optional audienceType); _FinalStage audienceType(String audienceType); @@ -420,10 +461,20 @@ public interface _FinalStage { _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + _FinalStage customPlanConfig(Optional customPlanConfig); _FinalStage customPlanConfig(CustomPlanViewConfigResponseData customPlanConfig); + _FinalStage draftVersion(Optional draftVersion); + + _FinalStage draftVersion(PlanVersionResponseData draftVersion); + _FinalStage entitlements(List entitlements); _FinalStage addEntitlements(PlanEntitlementResponseData entitlements); @@ -448,9 +499,9 @@ public interface _FinalStage { _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage versions(List versions); @@ -482,7 +533,7 @@ public static final class Builder _FinalStage { private ChargeType chargeType; - private int companyCount; + private long companyCount; private PlanControlledByType controlledBy; @@ -512,7 +563,7 @@ public static final class Builder private List versions = new ArrayList<>(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional oneTimePrice = Optional.empty(); @@ -524,14 +575,20 @@ public static final class Builder private List entitlements = new ArrayList<>(); + private Optional draftVersion = Optional.empty(); + private Optional customPlanConfig = Optional.empty(); + private List currencyPrices = new ArrayList<>(); + private List compatiblePlanIds = new ArrayList<>(); private Optional billingProduct = Optional.empty(); private Optional audienceType = Optional.empty(); + private Optional activeVersion = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -539,6 +596,7 @@ private Builder() {} @java.lang.Override public Builder from(PlanGroupPlanDetailResponseData other) { + activeVersion(other.getActiveVersion()); audienceType(other.getAudienceType()); billingProduct(other.getBillingProduct()); chargeType(other.getChargeType()); @@ -546,8 +604,10 @@ public Builder from(PlanGroupPlanDetailResponseData other) { compatiblePlanIds(other.getCompatiblePlanIds()); controlledBy(other.getControlledBy()); createdAt(other.getCreatedAt()); + currencyPrices(other.getCurrencyPrices()); customPlanConfig(other.getCustomPlanConfig()); description(other.getDescription()); + draftVersion(other.getDraftVersion()); entitlements(other.getEntitlements()); features(other.getFeatures()); icon(other.getIcon()); @@ -577,7 +637,7 @@ public CompanyCountStage chargeType(@NotNull ChargeType chargeType) { @java.lang.Override @JsonSetter("company_count") - public ControlledByStage companyCount(int companyCount) { + public ControlledByStage companyCount(long companyCount) { this.companyCount = companyCount; return this; } @@ -704,14 +764,14 @@ public _FinalStage versions(List versions) { } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -804,6 +864,19 @@ public _FinalStage entitlements(List entitlements) return this; } + @java.lang.Override + public _FinalStage draftVersion(PlanVersionResponseData draftVersion) { + this.draftVersion = Optional.ofNullable(draftVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "draft_version", nulls = Nulls.SKIP) + public _FinalStage draftVersion(Optional draftVersion) { + this.draftVersion = draftVersion; + return this; + } + @java.lang.Override public _FinalStage customPlanConfig(CustomPlanViewConfigResponseData customPlanConfig) { this.customPlanConfig = Optional.ofNullable(customPlanConfig); @@ -817,6 +890,30 @@ public _FinalStage customPlanConfig(Optional c return this; } + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + @java.lang.Override public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { if (compatiblePlanIds != null) { @@ -867,9 +964,23 @@ public _FinalStage audienceType(Optional audienceType) { return this; } + @java.lang.Override + public _FinalStage activeVersion(PlanVersionResponseData activeVersion) { + this.activeVersion = Optional.ofNullable(activeVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active_version", nulls = Nulls.SKIP) + public _FinalStage activeVersion(Optional activeVersion) { + this.activeVersion = activeVersion; + return this; + } + @java.lang.Override public PlanGroupPlanDetailResponseData build() { return new PlanGroupPlanDetailResponseData( + activeVersion, audienceType, billingProduct, chargeType, @@ -877,8 +988,10 @@ public PlanGroupPlanDetailResponseData build() { compatiblePlanIds, controlledBy, createdAt, + currencyPrices, customPlanConfig, description, + draftVersion, entitlements, features, icon, @@ -898,5 +1011,17 @@ public PlanGroupPlanDetailResponseData build() { yearlyPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanGroupPlanEntitlementsOrder.java b/src/main/java/com/schematic/api/types/PlanGroupPlanEntitlementsOrder.java index f15470c..51657fb 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupPlanEntitlementsOrder.java +++ b/src/main/java/com/schematic/api/types/PlanGroupPlanEntitlementsOrder.java @@ -85,6 +85,10 @@ public interface PlanIdStage { public interface _FinalStage { PlanGroupPlanEntitlementsOrder build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage entitlements(Optional> entitlements); _FinalStage entitlements(List entitlements); @@ -132,5 +136,17 @@ public _FinalStage entitlements(Optional> entitlemen public PlanGroupPlanEntitlementsOrder build() { return new PlanGroupPlanEntitlementsOrder(entitlements, planId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanGroupResponseData.java b/src/main/java/com/schematic/api/types/PlanGroupResponseData.java index e57ddb7..c3d6020 100644 --- a/src/main/java/com/schematic/api/types/PlanGroupResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanGroupResponseData.java @@ -71,7 +71,7 @@ public final class PlanGroupResponseData { private final boolean taxCollectionEnabled; - private final Optional trialDays; + private final Optional trialDays; private final Optional trialExpiryPlanId; @@ -106,7 +106,7 @@ private PlanGroupResponseData( boolean showZeroPriceAsFree, boolean syncCustomerBillingDetails, boolean taxCollectionEnabled, - Optional trialDays, + Optional trialDays, Optional trialExpiryPlanId, Optional trialExpiryPlanPriceId, Optional trialPaymentMethodRequired, @@ -263,7 +263,7 @@ public boolean getTaxCollectionEnabled() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @@ -419,6 +419,10 @@ public interface TaxCollectionEnabledStage { public interface _FinalStage { PlanGroupResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage addOnCompatibilities(List addOnCompatibilities); _FinalStage addAddOnCompatibilities(CompatiblePlansResponseData addOnCompatibilities); @@ -475,9 +479,9 @@ public interface _FinalStage { _FinalStage scheduledDowngradePreventWhenOverLimit(Boolean scheduledDowngradePreventWhenOverLimit); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); _FinalStage trialExpiryPlanId(Optional trialExpiryPlanId); @@ -537,7 +541,7 @@ public static final class Builder private Optional trialExpiryPlanId = Optional.empty(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional scheduledDowngradePreventWhenOverLimit = Optional.empty(); @@ -725,14 +729,14 @@ public _FinalStage trialExpiryPlanId(Optional trialExpiryPlanId) { } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -972,5 +976,17 @@ public PlanGroupResponseData build() { trialPaymentMethodRequired, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanIssueResponseData.java b/src/main/java/com/schematic/api/types/PlanIssueResponseData.java index bc30d5b..cd24a04 100644 --- a/src/main/java/com/schematic/api/types/PlanIssueResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanIssueResponseData.java @@ -109,6 +109,10 @@ public interface DescriptionStage { public interface _FinalStage { PlanIssueResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage detail(Optional detail); _FinalStage detail(String detail); @@ -186,5 +190,17 @@ public _FinalStage detail(Optional detail) { public PlanIssueResponseData build() { return new PlanIssueResponseData(code, description, detail, id, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanResponseData.java b/src/main/java/com/schematic/api/types/PlanResponseData.java index 4a557ff..dc1815c 100644 --- a/src/main/java/com/schematic/api/types/PlanResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanResponseData.java @@ -178,6 +178,10 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage audienceType(Optional audienceType); _FinalStage audienceType(String audienceType); @@ -294,5 +298,17 @@ public PlanResponseData build() { return new PlanResponseData( audienceType, createdAt, description, icon, id, name, planType, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanSelection.java b/src/main/java/com/schematic/api/types/PlanSelection.java index 47b691b..8f3b643 100644 --- a/src/main/java/com/schematic/api/types/PlanSelection.java +++ b/src/main/java/com/schematic/api/types/PlanSelection.java @@ -25,11 +25,18 @@ public final class PlanSelection { private final Optional priceId; + private final Optional versionId; + private final Map additionalProperties; - private PlanSelection(String planId, Optional priceId, Map additionalProperties) { + private PlanSelection( + String planId, + Optional priceId, + Optional versionId, + Map additionalProperties) { this.planId = planId; this.priceId = priceId; + this.versionId = versionId; this.additionalProperties = additionalProperties; } @@ -43,6 +50,11 @@ public Optional getPriceId() { return priceId; } + @JsonProperty("version_id") + public Optional getVersionId() { + return versionId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -55,12 +67,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(PlanSelection other) { - return planId.equals(other.planId) && priceId.equals(other.priceId); + return planId.equals(other.planId) && priceId.equals(other.priceId) && versionId.equals(other.versionId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.planId, this.priceId); + return Objects.hash(this.planId, this.priceId, this.versionId); } @java.lang.Override @@ -81,15 +93,25 @@ public interface PlanIdStage { public interface _FinalStage { PlanSelection build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage priceId(Optional priceId); _FinalStage priceId(String priceId); + + _FinalStage versionId(Optional versionId); + + _FinalStage versionId(String versionId); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements PlanIdStage, _FinalStage { private String planId; + private Optional versionId = Optional.empty(); + private Optional priceId = Optional.empty(); @JsonAnySetter @@ -101,6 +123,7 @@ private Builder() {} public Builder from(PlanSelection other) { planId(other.getPlanId()); priceId(other.getPriceId()); + versionId(other.getVersionId()); return this; } @@ -111,6 +134,19 @@ public _FinalStage planId(@NotNull String planId) { return this; } + @java.lang.Override + public _FinalStage versionId(String versionId) { + this.versionId = Optional.ofNullable(versionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "version_id", nulls = Nulls.SKIP) + public _FinalStage versionId(Optional versionId) { + this.versionId = versionId; + return this; + } + @java.lang.Override public _FinalStage priceId(String priceId) { this.priceId = Optional.ofNullable(priceId); @@ -126,7 +162,19 @@ public _FinalStage priceId(Optional priceId) { @java.lang.Override public PlanSelection build() { - return new PlanSelection(planId, priceId, additionalProperties); + return new PlanSelection(planId, priceId, versionId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/types/PlanSnapshotView.java b/src/main/java/com/schematic/api/types/PlanSnapshotView.java index 4ddddb6..36a603b 100644 --- a/src/main/java/com/schematic/api/types/PlanSnapshotView.java +++ b/src/main/java/com/schematic/api/types/PlanSnapshotView.java @@ -128,6 +128,10 @@ public interface NameStage { public interface _FinalStage { PlanSnapshotView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -197,5 +201,17 @@ public _FinalStage name(@NotNull String name) { public PlanSnapshotView build() { return new PlanSnapshotView(deleted, description, icon, id, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanTraitResponseData.java b/src/main/java/com/schematic/api/types/PlanTraitResponseData.java index f7e554c..81d3535 100644 --- a/src/main/java/com/schematic/api/types/PlanTraitResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanTraitResponseData.java @@ -194,6 +194,10 @@ public interface UpdatedAtStage { public interface _FinalStage { PlanTraitResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -322,5 +326,17 @@ public PlanTraitResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java new file mode 100644 index 0000000..8e039ee --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationResponseData.java @@ -0,0 +1,419 @@ +/** + * 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 = PlanVersionCompanyMigrationResponseData.Builder.class) +public final class PlanVersionCompanyMigrationResponseData { + private final String companyId; + + private final String companyName; + + private final Optional completedAt; + + private final OffsetDateTime createdAt; + + private final Optional error; + + private final String id; + + private final String migrationId; + + private final Optional planVersionIdFrom; + + private final Optional startedAt; + + private final PlanVersionCompanyMigrationStatus status; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private PlanVersionCompanyMigrationResponseData( + String companyId, + String companyName, + Optional completedAt, + OffsetDateTime createdAt, + Optional error, + String id, + String migrationId, + Optional planVersionIdFrom, + Optional startedAt, + PlanVersionCompanyMigrationStatus status, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.companyId = companyId; + this.companyName = companyName; + this.completedAt = completedAt; + this.createdAt = createdAt; + this.error = error; + this.id = id; + this.migrationId = migrationId; + this.planVersionIdFrom = planVersionIdFrom; + this.startedAt = startedAt; + this.status = status; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("company_name") + public String getCompanyName() { + return companyName; + } + + @JsonProperty("completed_at") + public Optional getCompletedAt() { + return completedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("error") + public Optional getError() { + return error; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("migration_id") + public String getMigrationId() { + return migrationId; + } + + @JsonProperty("plan_version_id_from") + public Optional getPlanVersionIdFrom() { + return planVersionIdFrom; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("status") + public PlanVersionCompanyMigrationStatus getStatus() { + return status; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanVersionCompanyMigrationResponseData + && equalTo((PlanVersionCompanyMigrationResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanVersionCompanyMigrationResponseData other) { + return companyId.equals(other.companyId) + && companyName.equals(other.companyName) + && completedAt.equals(other.completedAt) + && createdAt.equals(other.createdAt) + && error.equals(other.error) + && id.equals(other.id) + && migrationId.equals(other.migrationId) + && planVersionIdFrom.equals(other.planVersionIdFrom) + && startedAt.equals(other.startedAt) + && status.equals(other.status) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.companyId, + this.companyName, + this.completedAt, + this.createdAt, + this.error, + this.id, + this.migrationId, + this.planVersionIdFrom, + this.startedAt, + this.status, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompanyIdStage builder() { + return new Builder(); + } + + public interface CompanyIdStage { + CompanyNameStage companyId(@NotNull String companyId); + + Builder from(PlanVersionCompanyMigrationResponseData other); + } + + public interface CompanyNameStage { + CreatedAtStage companyName(@NotNull String companyName); + } + + public interface CreatedAtStage { + IdStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface IdStage { + MigrationIdStage id(@NotNull String id); + } + + public interface MigrationIdStage { + StatusStage migrationId(@NotNull String migrationId); + } + + public interface StatusStage { + UpdatedAtStage status(@NotNull PlanVersionCompanyMigrationStatus status); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + PlanVersionCompanyMigrationResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage completedAt(Optional completedAt); + + _FinalStage completedAt(OffsetDateTime completedAt); + + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage planVersionIdFrom(Optional planVersionIdFrom); + + _FinalStage planVersionIdFrom(String planVersionIdFrom); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompanyIdStage, + CompanyNameStage, + CreatedAtStage, + IdStage, + MigrationIdStage, + StatusStage, + UpdatedAtStage, + _FinalStage { + private String companyId; + + private String companyName; + + private OffsetDateTime createdAt; + + private String id; + + private String migrationId; + + private PlanVersionCompanyMigrationStatus status; + + private OffsetDateTime updatedAt; + + private Optional startedAt = Optional.empty(); + + private Optional planVersionIdFrom = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional completedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanVersionCompanyMigrationResponseData other) { + companyId(other.getCompanyId()); + companyName(other.getCompanyName()); + completedAt(other.getCompletedAt()); + createdAt(other.getCreatedAt()); + error(other.getError()); + id(other.getId()); + migrationId(other.getMigrationId()); + planVersionIdFrom(other.getPlanVersionIdFrom()); + startedAt(other.getStartedAt()); + status(other.getStatus()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("company_id") + public CompanyNameStage companyId(@NotNull String companyId) { + this.companyId = Objects.requireNonNull(companyId, "companyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("company_name") + public CreatedAtStage companyName(@NotNull String companyName) { + this.companyName = Objects.requireNonNull(companyName, "companyName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public IdStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public MigrationIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("migration_id") + public StatusStage migrationId(@NotNull String migrationId) { + this.migrationId = Objects.requireNonNull(migrationId, "migrationId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public UpdatedAtStage status(@NotNull PlanVersionCompanyMigrationStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + @java.lang.Override + public _FinalStage planVersionIdFrom(String planVersionIdFrom) { + this.planVersionIdFrom = Optional.ofNullable(planVersionIdFrom); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_id_from", nulls = Nulls.SKIP) + public _FinalStage planVersionIdFrom(Optional planVersionIdFrom) { + this.planVersionIdFrom = planVersionIdFrom; + return this; + } + + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public _FinalStage completedAt(OffsetDateTime completedAt) { + this.completedAt = Optional.ofNullable(completedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "completed_at", nulls = Nulls.SKIP) + public _FinalStage completedAt(Optional completedAt) { + this.completedAt = completedAt; + return this; + } + + @java.lang.Override + public PlanVersionCompanyMigrationResponseData build() { + return new PlanVersionCompanyMigrationResponseData( + companyId, + companyName, + completedAt, + createdAt, + error, + id, + migrationId, + planVersionIdFrom, + startedAt, + status, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java new file mode 100644 index 0000000..d397813 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionCompanyMigrationStatus.java @@ -0,0 +1,119 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class PlanVersionCompanyMigrationStatus { + public static final PlanVersionCompanyMigrationStatus SKIPPED = + new PlanVersionCompanyMigrationStatus(Value.SKIPPED, "skipped"); + + public static final PlanVersionCompanyMigrationStatus FAILED = + new PlanVersionCompanyMigrationStatus(Value.FAILED, "failed"); + + public static final PlanVersionCompanyMigrationStatus COMPLETED = + new PlanVersionCompanyMigrationStatus(Value.COMPLETED, "completed"); + + public static final PlanVersionCompanyMigrationStatus IN_PROGRESS = + new PlanVersionCompanyMigrationStatus(Value.IN_PROGRESS, "in_progress"); + + public static final PlanVersionCompanyMigrationStatus PENDING = + new PlanVersionCompanyMigrationStatus(Value.PENDING, "pending"); + + private final Value value; + + private final String string; + + PlanVersionCompanyMigrationStatus(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 PlanVersionCompanyMigrationStatus + && this.string.equals(((PlanVersionCompanyMigrationStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SKIPPED: + return visitor.visitSkipped(); + case FAILED: + return visitor.visitFailed(); + case COMPLETED: + return visitor.visitCompleted(); + case IN_PROGRESS: + return visitor.visitInProgress(); + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanVersionCompanyMigrationStatus valueOf(String value) { + switch (value) { + case "skipped": + return SKIPPED; + case "failed": + return FAILED; + case "completed": + return COMPLETED; + case "in_progress": + return IN_PROGRESS; + case "pending": + return PENDING; + default: + return new PlanVersionCompanyMigrationStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + COMPLETED, + + FAILED, + + IN_PROGRESS, + + PENDING, + + SKIPPED, + + UNKNOWN + } + + public interface Visitor { + T visitCompleted(); + + T visitFailed(); + + T visitInProgress(); + + T visitPending(); + + T visitSkipped(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java new file mode 100644 index 0000000..3fe1394 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationResponseData.java @@ -0,0 +1,526 @@ +/** + * 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 = PlanVersionMigrationResponseData.Builder.class) +public final class PlanVersionMigrationResponseData { + private final Optional completedAt; + + private final long completedCompanies; + + private final OffsetDateTime createdAt; + + private final Optional error; + + private final long failedCompanies; + + private final String id; + + private final String planId; + + private final Optional planVersionIdFrom; + + private final String planVersionIdTo; + + private final long skippedCompanies; + + private final Optional startedAt; + + private final PlanVersionMigrationStatus status; + + private final PlanVersionMigrationStrategy strategy; + + private final long totalCompanies; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private PlanVersionMigrationResponseData( + Optional completedAt, + long completedCompanies, + OffsetDateTime createdAt, + Optional error, + long failedCompanies, + String id, + String planId, + Optional planVersionIdFrom, + String planVersionIdTo, + long skippedCompanies, + Optional startedAt, + PlanVersionMigrationStatus status, + PlanVersionMigrationStrategy strategy, + long totalCompanies, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.completedAt = completedAt; + this.completedCompanies = completedCompanies; + this.createdAt = createdAt; + this.error = error; + this.failedCompanies = failedCompanies; + this.id = id; + this.planId = planId; + this.planVersionIdFrom = planVersionIdFrom; + this.planVersionIdTo = planVersionIdTo; + this.skippedCompanies = skippedCompanies; + this.startedAt = startedAt; + this.status = status; + this.strategy = strategy; + this.totalCompanies = totalCompanies; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("completed_at") + public Optional getCompletedAt() { + return completedAt; + } + + @JsonProperty("completed_companies") + public long getCompletedCompanies() { + return completedCompanies; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("error") + public Optional getError() { + return error; + } + + @JsonProperty("failed_companies") + public long getFailedCompanies() { + return failedCompanies; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("plan_id") + public String getPlanId() { + return planId; + } + + @JsonProperty("plan_version_id_from") + public Optional getPlanVersionIdFrom() { + return planVersionIdFrom; + } + + @JsonProperty("plan_version_id_to") + public String getPlanVersionIdTo() { + return planVersionIdTo; + } + + @JsonProperty("skipped_companies") + public long getSkippedCompanies() { + return skippedCompanies; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("status") + public PlanVersionMigrationStatus getStatus() { + return status; + } + + @JsonProperty("strategy") + public PlanVersionMigrationStrategy getStrategy() { + return strategy; + } + + @JsonProperty("total_companies") + public long getTotalCompanies() { + return totalCompanies; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanVersionMigrationResponseData && equalTo((PlanVersionMigrationResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanVersionMigrationResponseData other) { + return completedAt.equals(other.completedAt) + && completedCompanies == other.completedCompanies + && createdAt.equals(other.createdAt) + && error.equals(other.error) + && failedCompanies == other.failedCompanies + && id.equals(other.id) + && planId.equals(other.planId) + && planVersionIdFrom.equals(other.planVersionIdFrom) + && planVersionIdTo.equals(other.planVersionIdTo) + && skippedCompanies == other.skippedCompanies + && startedAt.equals(other.startedAt) + && status.equals(other.status) + && strategy.equals(other.strategy) + && totalCompanies == other.totalCompanies + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.completedAt, + this.completedCompanies, + this.createdAt, + this.error, + this.failedCompanies, + this.id, + this.planId, + this.planVersionIdFrom, + this.planVersionIdTo, + this.skippedCompanies, + this.startedAt, + this.status, + this.strategy, + this.totalCompanies, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CompletedCompaniesStage builder() { + return new Builder(); + } + + public interface CompletedCompaniesStage { + CreatedAtStage completedCompanies(long completedCompanies); + + Builder from(PlanVersionMigrationResponseData other); + } + + public interface CreatedAtStage { + FailedCompaniesStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface FailedCompaniesStage { + IdStage failedCompanies(long failedCompanies); + } + + public interface IdStage { + PlanIdStage id(@NotNull String id); + } + + public interface PlanIdStage { + PlanVersionIdToStage planId(@NotNull String planId); + } + + public interface PlanVersionIdToStage { + SkippedCompaniesStage planVersionIdTo(@NotNull String planVersionIdTo); + } + + public interface SkippedCompaniesStage { + StatusStage skippedCompanies(long skippedCompanies); + } + + public interface StatusStage { + StrategyStage status(@NotNull PlanVersionMigrationStatus status); + } + + public interface StrategyStage { + TotalCompaniesStage strategy(@NotNull PlanVersionMigrationStrategy strategy); + } + + public interface TotalCompaniesStage { + UpdatedAtStage totalCompanies(long totalCompanies); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + PlanVersionMigrationResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage completedAt(Optional completedAt); + + _FinalStage completedAt(OffsetDateTime completedAt); + + _FinalStage error(Optional error); + + _FinalStage error(String error); + + _FinalStage planVersionIdFrom(Optional planVersionIdFrom); + + _FinalStage planVersionIdFrom(String planVersionIdFrom); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CompletedCompaniesStage, + CreatedAtStage, + FailedCompaniesStage, + IdStage, + PlanIdStage, + PlanVersionIdToStage, + SkippedCompaniesStage, + StatusStage, + StrategyStage, + TotalCompaniesStage, + UpdatedAtStage, + _FinalStage { + private long completedCompanies; + + private OffsetDateTime createdAt; + + private long failedCompanies; + + private String id; + + private String planId; + + private String planVersionIdTo; + + private long skippedCompanies; + + private PlanVersionMigrationStatus status; + + private PlanVersionMigrationStrategy strategy; + + private long totalCompanies; + + private OffsetDateTime updatedAt; + + private Optional startedAt = Optional.empty(); + + private Optional planVersionIdFrom = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional completedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanVersionMigrationResponseData other) { + completedAt(other.getCompletedAt()); + completedCompanies(other.getCompletedCompanies()); + createdAt(other.getCreatedAt()); + error(other.getError()); + failedCompanies(other.getFailedCompanies()); + id(other.getId()); + planId(other.getPlanId()); + planVersionIdFrom(other.getPlanVersionIdFrom()); + planVersionIdTo(other.getPlanVersionIdTo()); + skippedCompanies(other.getSkippedCompanies()); + startedAt(other.getStartedAt()); + status(other.getStatus()); + strategy(other.getStrategy()); + totalCompanies(other.getTotalCompanies()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("completed_companies") + public CreatedAtStage completedCompanies(long completedCompanies) { + this.completedCompanies = completedCompanies; + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public FailedCompaniesStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("failed_companies") + public IdStage failedCompanies(long failedCompanies) { + this.failedCompanies = failedCompanies; + return this; + } + + @java.lang.Override + @JsonSetter("id") + public PlanIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_id") + public PlanVersionIdToStage planId(@NotNull String planId) { + this.planId = Objects.requireNonNull(planId, "planId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("plan_version_id_to") + public SkippedCompaniesStage planVersionIdTo(@NotNull String planVersionIdTo) { + this.planVersionIdTo = Objects.requireNonNull(planVersionIdTo, "planVersionIdTo must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("skipped_companies") + public StatusStage skippedCompanies(long skippedCompanies) { + this.skippedCompanies = skippedCompanies; + return this; + } + + @java.lang.Override + @JsonSetter("status") + public StrategyStage status(@NotNull PlanVersionMigrationStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("strategy") + public TotalCompaniesStage strategy(@NotNull PlanVersionMigrationStrategy strategy) { + this.strategy = Objects.requireNonNull(strategy, "strategy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("total_companies") + public UpdatedAtStage totalCompanies(long totalCompanies) { + this.totalCompanies = totalCompanies; + 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 startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + @java.lang.Override + public _FinalStage planVersionIdFrom(String planVersionIdFrom) { + this.planVersionIdFrom = Optional.ofNullable(planVersionIdFrom); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan_version_id_from", nulls = Nulls.SKIP) + public _FinalStage planVersionIdFrom(Optional planVersionIdFrom) { + this.planVersionIdFrom = planVersionIdFrom; + return this; + } + + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public _FinalStage completedAt(OffsetDateTime completedAt) { + this.completedAt = Optional.ofNullable(completedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "completed_at", nulls = Nulls.SKIP) + public _FinalStage completedAt(Optional completedAt) { + this.completedAt = completedAt; + return this; + } + + @java.lang.Override + public PlanVersionMigrationResponseData build() { + return new PlanVersionMigrationResponseData( + completedAt, + completedCompanies, + createdAt, + error, + failedCompanies, + id, + planId, + planVersionIdFrom, + planVersionIdTo, + skippedCompanies, + startedAt, + status, + strategy, + totalCompanies, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.java new file mode 100644 index 0000000..87bd011 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationStatus.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 PlanVersionMigrationStatus { + public static final PlanVersionMigrationStatus FAILED = new PlanVersionMigrationStatus(Value.FAILED, "failed"); + + public static final PlanVersionMigrationStatus COMPLETED = + new PlanVersionMigrationStatus(Value.COMPLETED, "completed"); + + public static final PlanVersionMigrationStatus IN_PROGRESS = + new PlanVersionMigrationStatus(Value.IN_PROGRESS, "in_progress"); + + public static final PlanVersionMigrationStatus PENDING = new PlanVersionMigrationStatus(Value.PENDING, "pending"); + + private final Value value; + + private final String string; + + PlanVersionMigrationStatus(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 PlanVersionMigrationStatus + && this.string.equals(((PlanVersionMigrationStatus) 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 COMPLETED: + return visitor.visitCompleted(); + case IN_PROGRESS: + return visitor.visitInProgress(); + case PENDING: + return visitor.visitPending(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanVersionMigrationStatus valueOf(String value) { + switch (value) { + case "failed": + return FAILED; + case "completed": + return COMPLETED; + case "in_progress": + return IN_PROGRESS; + case "pending": + return PENDING; + default: + return new PlanVersionMigrationStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + COMPLETED, + + FAILED, + + IN_PROGRESS, + + PENDING, + + UNKNOWN + } + + public interface Visitor { + T visitCompleted(); + + T visitFailed(); + + T visitInProgress(); + + T visitPending(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java b/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.java new file mode 100644 index 0000000..6d2b82e --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionMigrationStrategy.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 PlanVersionMigrationStrategy { + public static final PlanVersionMigrationStrategy IMMEDIATE = + new PlanVersionMigrationStrategy(Value.IMMEDIATE, "immediate"); + + public static final PlanVersionMigrationStrategy LEAVE = new PlanVersionMigrationStrategy(Value.LEAVE, "leave"); + + private final Value value; + + private final String string; + + PlanVersionMigrationStrategy(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 PlanVersionMigrationStrategy + && this.string.equals(((PlanVersionMigrationStrategy) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IMMEDIATE: + return visitor.visitImmediate(); + case LEAVE: + return visitor.visitLeave(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static PlanVersionMigrationStrategy valueOf(String value) { + switch (value) { + case "immediate": + return IMMEDIATE; + case "leave": + return LEAVE; + default: + return new PlanVersionMigrationStrategy(Value.UNKNOWN, value); + } + } + + public enum Value { + IMMEDIATE, + + LEAVE, + + UNKNOWN + } + + public interface Visitor { + T visitImmediate(); + + T visitLeave(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/PlanVersionResponseData.java b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java index 2699bcb..c4201cf 100644 --- a/src/main/java/com/schematic/api/types/PlanVersionResponseData.java +++ b/src/main/java/com/schematic/api/types/PlanVersionResponseData.java @@ -42,7 +42,7 @@ public final class PlanVersionResponseData { private final OffsetDateTime updatedAt; - private final int version; + private final long version; private final Map additionalProperties; @@ -57,7 +57,7 @@ private PlanVersionResponseData( PlanType planType, PlanVersionStatus status, OffsetDateTime updatedAt, - int version, + long version, Map additionalProperties) { this.createdAt = createdAt; this.description = description; @@ -124,7 +124,7 @@ public OffsetDateTime getUpdatedAt() { } @JsonProperty("version") - public int getVersion() { + public long getVersion() { return version; } @@ -217,12 +217,16 @@ public interface UpdatedAtStage { } public interface VersionStage { - _FinalStage version(int version); + _FinalStage version(long version); } public interface _FinalStage { PlanVersionResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage originalPlanId(Optional originalPlanId); _FinalStage originalPlanId(String originalPlanId); @@ -259,7 +263,7 @@ public static final class Builder private OffsetDateTime updatedAt; - private int version; + private long version; private Optional originalPlanId = Optional.empty(); @@ -349,7 +353,7 @@ public VersionStage updatedAt(@NotNull OffsetDateTime updatedAt) { @java.lang.Override @JsonSetter("version") - public _FinalStage version(int version) { + public _FinalStage version(long version) { this.version = version; return this; } @@ -383,5 +387,17 @@ public PlanVersionResponseData build() { version, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PlanVersionSnapshotView.java b/src/main/java/com/schematic/api/types/PlanVersionSnapshotView.java new file mode 100644 index 0000000..0bffba6 --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanVersionSnapshotView.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.schematic.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.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 = PlanVersionSnapshotView.Builder.class) +public final class PlanVersionSnapshotView { + private final String id; + + private final String name; + + private final long version; + + private final Map additionalProperties; + + private PlanVersionSnapshotView(String id, String name, long version, Map additionalProperties) { + this.id = id; + this.name = name; + this.version = version; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("version") + public long getVersion() { + return version; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanVersionSnapshotView && equalTo((PlanVersionSnapshotView) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanVersionSnapshotView other) { + return id.equals(other.id) && name.equals(other.name) && version == other.version; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.version); + } + + @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(PlanVersionSnapshotView other); + } + + public interface NameStage { + VersionStage name(@NotNull String name); + } + + public interface VersionStage { + _FinalStage version(long version); + } + + public interface _FinalStage { + PlanVersionSnapshotView build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, VersionStage, _FinalStage { + private String id; + + private String name; + + private long version; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanVersionSnapshotView other) { + id(other.getId()); + name(other.getName()); + version(other.getVersion()); + 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 VersionStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("version") + public _FinalStage version(long version) { + this.version = version; + return this; + } + + @java.lang.Override + public PlanVersionSnapshotView build() { + return new PlanVersionSnapshotView(id, name, version, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java new file mode 100644 index 0000000..eab4b9e --- /dev/null +++ b/src/main/java/com/schematic/api/types/PlanViewPublicResponseData.java @@ -0,0 +1,1066 @@ +/** + * 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 = PlanViewPublicResponseData.Builder.class) +public final class PlanViewPublicResponseData { + private final Optional activeVersion; + + private final Optional audienceType; + + private final Optional billingProduct; + + private final ChargeType chargeType; + + private final long companyCount; + + private final List compatiblePlanIds; + + private final PlanControlledByType controlledBy; + + private final OffsetDateTime createdAt; + + private final List currencyPrices; + + private final boolean custom; + + private final Optional customPlanConfig; + + private final String description; + + private final Optional draftVersion; + + private final List entitlements; + + private final List features; + + private final String icon; + + private final String id; + + private final List includedCreditGrants; + + private final boolean isCustom; + + private final boolean isDefault; + + private final boolean isFree; + + private final boolean isTrialable; + + private final Optional monthlyPrice; + + private final String name; + + private final Optional oneTimePrice; + + private final PlanType planType; + + private final Optional trialDays; + + private final OffsetDateTime updatedAt; + + private final List versions; + + private final Optional yearlyPrice; + + private final Map additionalProperties; + + private PlanViewPublicResponseData( + Optional activeVersion, + Optional audienceType, + Optional billingProduct, + ChargeType chargeType, + long companyCount, + List compatiblePlanIds, + PlanControlledByType controlledBy, + OffsetDateTime createdAt, + List currencyPrices, + boolean custom, + Optional customPlanConfig, + String description, + Optional draftVersion, + List entitlements, + List features, + String icon, + String id, + List includedCreditGrants, + boolean isCustom, + boolean isDefault, + boolean isFree, + boolean isTrialable, + Optional monthlyPrice, + String name, + Optional oneTimePrice, + PlanType planType, + Optional trialDays, + OffsetDateTime updatedAt, + List versions, + Optional yearlyPrice, + Map additionalProperties) { + this.activeVersion = activeVersion; + this.audienceType = audienceType; + this.billingProduct = billingProduct; + this.chargeType = chargeType; + this.companyCount = companyCount; + this.compatiblePlanIds = compatiblePlanIds; + this.controlledBy = controlledBy; + this.createdAt = createdAt; + this.currencyPrices = currencyPrices; + this.custom = custom; + this.customPlanConfig = customPlanConfig; + this.description = description; + this.draftVersion = draftVersion; + this.entitlements = entitlements; + this.features = features; + this.icon = icon; + this.id = id; + this.includedCreditGrants = includedCreditGrants; + this.isCustom = isCustom; + this.isDefault = isDefault; + this.isFree = isFree; + this.isTrialable = isTrialable; + this.monthlyPrice = monthlyPrice; + this.name = name; + this.oneTimePrice = oneTimePrice; + this.planType = planType; + this.trialDays = trialDays; + this.updatedAt = updatedAt; + this.versions = versions; + this.yearlyPrice = yearlyPrice; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("active_version") + public Optional getActiveVersion() { + return activeVersion; + } + + @JsonProperty("audience_type") + public Optional getAudienceType() { + return audienceType; + } + + @JsonProperty("billing_product") + public Optional getBillingProduct() { + return billingProduct; + } + + @JsonProperty("charge_type") + public ChargeType getChargeType() { + return chargeType; + } + + @JsonProperty("company_count") + public long getCompanyCount() { + return companyCount; + } + + @JsonProperty("compatible_plan_ids") + public List getCompatiblePlanIds() { + return compatiblePlanIds; + } + + @JsonProperty("controlled_by") + public PlanControlledByType getControlledBy() { + return controlledBy; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("currency_prices") + public List getCurrencyPrices() { + return currencyPrices; + } + + @JsonProperty("custom") + public boolean getCustom() { + return custom; + } + + @JsonProperty("custom_plan_config") + public Optional getCustomPlanConfig() { + return customPlanConfig; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("draft_version") + public Optional getDraftVersion() { + return draftVersion; + } + + @JsonProperty("entitlements") + public List getEntitlements() { + return entitlements; + } + + @JsonProperty("features") + public List getFeatures() { + return features; + } + + @JsonProperty("icon") + public String getIcon() { + return icon; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("included_credit_grants") + public List getIncludedCreditGrants() { + return includedCreditGrants; + } + + @JsonProperty("is_custom") + public boolean getIsCustom() { + return isCustom; + } + + @JsonProperty("is_default") + public boolean getIsDefault() { + return isDefault; + } + + @JsonProperty("is_free") + public boolean getIsFree() { + return isFree; + } + + @JsonProperty("is_trialable") + public boolean getIsTrialable() { + return isTrialable; + } + + @JsonProperty("monthly_price") + public Optional getMonthlyPrice() { + return monthlyPrice; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("one_time_price") + public Optional getOneTimePrice() { + return oneTimePrice; + } + + @JsonProperty("plan_type") + public PlanType getPlanType() { + return planType; + } + + @JsonProperty("trial_days") + public Optional getTrialDays() { + return trialDays; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("versions") + public List getVersions() { + return versions; + } + + @JsonProperty("yearly_price") + public Optional getYearlyPrice() { + return yearlyPrice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanViewPublicResponseData && equalTo((PlanViewPublicResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlanViewPublicResponseData other) { + return activeVersion.equals(other.activeVersion) + && audienceType.equals(other.audienceType) + && billingProduct.equals(other.billingProduct) + && chargeType.equals(other.chargeType) + && companyCount == other.companyCount + && compatiblePlanIds.equals(other.compatiblePlanIds) + && controlledBy.equals(other.controlledBy) + && createdAt.equals(other.createdAt) + && currencyPrices.equals(other.currencyPrices) + && custom == other.custom + && customPlanConfig.equals(other.customPlanConfig) + && description.equals(other.description) + && draftVersion.equals(other.draftVersion) + && entitlements.equals(other.entitlements) + && features.equals(other.features) + && icon.equals(other.icon) + && id.equals(other.id) + && includedCreditGrants.equals(other.includedCreditGrants) + && isCustom == other.isCustom + && isDefault == other.isDefault + && isFree == other.isFree + && isTrialable == other.isTrialable + && monthlyPrice.equals(other.monthlyPrice) + && name.equals(other.name) + && oneTimePrice.equals(other.oneTimePrice) + && planType.equals(other.planType) + && trialDays.equals(other.trialDays) + && updatedAt.equals(other.updatedAt) + && versions.equals(other.versions) + && yearlyPrice.equals(other.yearlyPrice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.activeVersion, + this.audienceType, + this.billingProduct, + this.chargeType, + this.companyCount, + this.compatiblePlanIds, + this.controlledBy, + this.createdAt, + this.currencyPrices, + this.custom, + this.customPlanConfig, + this.description, + this.draftVersion, + this.entitlements, + this.features, + this.icon, + this.id, + this.includedCreditGrants, + this.isCustom, + this.isDefault, + this.isFree, + this.isTrialable, + this.monthlyPrice, + this.name, + this.oneTimePrice, + this.planType, + this.trialDays, + this.updatedAt, + this.versions, + this.yearlyPrice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ChargeTypeStage builder() { + return new Builder(); + } + + public interface ChargeTypeStage { + CompanyCountStage chargeType(@NotNull ChargeType chargeType); + + Builder from(PlanViewPublicResponseData other); + } + + public interface CompanyCountStage { + ControlledByStage companyCount(long companyCount); + } + + public interface ControlledByStage { + CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy); + } + + public interface CreatedAtStage { + CustomStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface CustomStage { + DescriptionStage custom(boolean custom); + } + + public interface DescriptionStage { + IconStage description(@NotNull String description); + } + + public interface IconStage { + IdStage icon(@NotNull String icon); + } + + public interface IdStage { + IsCustomStage id(@NotNull String id); + } + + public interface IsCustomStage { + IsDefaultStage isCustom(boolean isCustom); + } + + public interface IsDefaultStage { + IsFreeStage isDefault(boolean isDefault); + } + + public interface IsFreeStage { + IsTrialableStage isFree(boolean isFree); + } + + public interface IsTrialableStage { + NameStage isTrialable(boolean isTrialable); + } + + public interface NameStage { + PlanTypeStage name(@NotNull String name); + } + + public interface PlanTypeStage { + UpdatedAtStage planType(@NotNull PlanType planType); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + PlanViewPublicResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage activeVersion(Optional activeVersion); + + _FinalStage activeVersion(PlanVersionResponseData activeVersion); + + _FinalStage audienceType(Optional audienceType); + + _FinalStage audienceType(String audienceType); + + _FinalStage billingProduct(Optional billingProduct); + + _FinalStage billingProduct(BillingProductDetailResponseData billingProduct); + + _FinalStage compatiblePlanIds(List compatiblePlanIds); + + _FinalStage addCompatiblePlanIds(String compatiblePlanIds); + + _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds); + + _FinalStage currencyPrices(List currencyPrices); + + _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices); + + _FinalStage addAllCurrencyPrices(List currencyPrices); + + _FinalStage customPlanConfig(Optional customPlanConfig); + + _FinalStage customPlanConfig(CustomPlanConfig customPlanConfig); + + _FinalStage draftVersion(Optional draftVersion); + + _FinalStage draftVersion(PlanVersionResponseData draftVersion); + + _FinalStage entitlements(List entitlements); + + _FinalStage addEntitlements(PlanEntitlementResponseData entitlements); + + _FinalStage addAllEntitlements(List entitlements); + + _FinalStage features(List features); + + _FinalStage addFeatures(FeatureDetailResponseData features); + + _FinalStage addAllFeatures(List features); + + _FinalStage includedCreditGrants(List includedCreditGrants); + + _FinalStage addIncludedCreditGrants(PlanCreditGrantView includedCreditGrants); + + _FinalStage addAllIncludedCreditGrants(List includedCreditGrants); + + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice); + + _FinalStage oneTimePrice(Optional oneTimePrice); + + _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice); + + _FinalStage trialDays(Optional trialDays); + + _FinalStage trialDays(Long trialDays); + + _FinalStage versions(List versions); + + _FinalStage addVersions(PlanVersionResponseData versions); + + _FinalStage addAllVersions(List versions); + + _FinalStage yearlyPrice(Optional yearlyPrice); + + _FinalStage yearlyPrice(BillingPriceResponseData yearlyPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ChargeTypeStage, + CompanyCountStage, + ControlledByStage, + CreatedAtStage, + CustomStage, + DescriptionStage, + IconStage, + IdStage, + IsCustomStage, + IsDefaultStage, + IsFreeStage, + IsTrialableStage, + NameStage, + PlanTypeStage, + UpdatedAtStage, + _FinalStage { + private ChargeType chargeType; + + private long companyCount; + + private PlanControlledByType controlledBy; + + private OffsetDateTime createdAt; + + private boolean custom; + + private String description; + + private String icon; + + private String id; + + private boolean isCustom; + + private boolean isDefault; + + private boolean isFree; + + private boolean isTrialable; + + private String name; + + 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(); + + private Optional monthlyPrice = Optional.empty(); + + private List includedCreditGrants = new ArrayList<>(); + + private List features = new ArrayList<>(); + + private List entitlements = new ArrayList<>(); + + private Optional draftVersion = Optional.empty(); + + private Optional customPlanConfig = Optional.empty(); + + private List currencyPrices = new ArrayList<>(); + + private List compatiblePlanIds = new ArrayList<>(); + + private Optional billingProduct = Optional.empty(); + + private Optional audienceType = Optional.empty(); + + private Optional activeVersion = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlanViewPublicResponseData other) { + activeVersion(other.getActiveVersion()); + audienceType(other.getAudienceType()); + billingProduct(other.getBillingProduct()); + chargeType(other.getChargeType()); + companyCount(other.getCompanyCount()); + compatiblePlanIds(other.getCompatiblePlanIds()); + controlledBy(other.getControlledBy()); + createdAt(other.getCreatedAt()); + currencyPrices(other.getCurrencyPrices()); + custom(other.getCustom()); + customPlanConfig(other.getCustomPlanConfig()); + description(other.getDescription()); + draftVersion(other.getDraftVersion()); + entitlements(other.getEntitlements()); + features(other.getFeatures()); + icon(other.getIcon()); + id(other.getId()); + includedCreditGrants(other.getIncludedCreditGrants()); + isCustom(other.getIsCustom()); + isDefault(other.getIsDefault()); + isFree(other.getIsFree()); + isTrialable(other.getIsTrialable()); + monthlyPrice(other.getMonthlyPrice()); + name(other.getName()); + oneTimePrice(other.getOneTimePrice()); + 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 ChargeType chargeType) { + this.chargeType = Objects.requireNonNull(chargeType, "chargeType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("company_count") + public ControlledByStage companyCount(long companyCount) { + this.companyCount = companyCount; + return this; + } + + @java.lang.Override + @JsonSetter("controlled_by") + public CreatedAtStage controlledBy(@NotNull PlanControlledByType controlledBy) { + this.controlledBy = Objects.requireNonNull(controlledBy, "controlledBy must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created_at") + public CustomStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("custom") + public DescriptionStage custom(boolean custom) { + this.custom = custom; + return this; + } + + @java.lang.Override + @JsonSetter("description") + public IconStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("icon") + public IdStage icon(@NotNull String icon) { + this.icon = Objects.requireNonNull(icon, "icon must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IsCustomStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("is_custom") + public IsDefaultStage isCustom(boolean isCustom) { + this.isCustom = isCustom; + return this; + } + + @java.lang.Override + @JsonSetter("is_default") + public IsFreeStage isDefault(boolean isDefault) { + this.isDefault = isDefault; + return this; + } + + @java.lang.Override + @JsonSetter("is_free") + public IsTrialableStage isFree(boolean isFree) { + this.isFree = isFree; + return this; + } + + @java.lang.Override + @JsonSetter("is_trialable") + public NameStage isTrialable(boolean isTrialable) { + this.isTrialable = isTrialable; + 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 UpdatedAtStage planType(@NotNull PlanType planType) { + this.planType = Objects.requireNonNull(planType, "planType 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 yearlyPrice(BillingPriceResponseData yearlyPrice) { + this.yearlyPrice = Optional.ofNullable(yearlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) + public _FinalStage yearlyPrice(Optional yearlyPrice) { + this.yearlyPrice = yearlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage 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(Long trialDays) { + this.trialDays = Optional.ofNullable(trialDays); + return this; + } + + @java.lang.Override + @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) + public _FinalStage trialDays(Optional trialDays) { + this.trialDays = trialDays; + return this; + } + + @java.lang.Override + public _FinalStage oneTimePrice(BillingPriceResponseData oneTimePrice) { + this.oneTimePrice = Optional.ofNullable(oneTimePrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "one_time_price", nulls = Nulls.SKIP) + public _FinalStage oneTimePrice(Optional oneTimePrice) { + this.oneTimePrice = oneTimePrice; + return this; + } + + @java.lang.Override + public _FinalStage monthlyPrice(BillingPriceResponseData monthlyPrice) { + this.monthlyPrice = Optional.ofNullable(monthlyPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) + public _FinalStage monthlyPrice(Optional monthlyPrice) { + this.monthlyPrice = monthlyPrice; + return this; + } + + @java.lang.Override + public _FinalStage addAllIncludedCreditGrants(List includedCreditGrants) { + if (includedCreditGrants != null) { + this.includedCreditGrants.addAll(includedCreditGrants); + } + return this; + } + + @java.lang.Override + public _FinalStage addIncludedCreditGrants(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 addAllFeatures(List features) { + if (features != null) { + this.features.addAll(features); + } + return this; + } + + @java.lang.Override + public _FinalStage addFeatures(FeatureDetailResponseData features) { + this.features.add(features); + return this; + } + + @java.lang.Override + @JsonSetter(value = "features", nulls = Nulls.SKIP) + public _FinalStage features(List features) { + this.features.clear(); + if (features != null) { + this.features.addAll(features); + } + 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(PlanEntitlementResponseData 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 draftVersion(PlanVersionResponseData draftVersion) { + this.draftVersion = Optional.ofNullable(draftVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "draft_version", nulls = Nulls.SKIP) + public _FinalStage draftVersion(Optional draftVersion) { + this.draftVersion = draftVersion; + return this; + } + + @java.lang.Override + public _FinalStage customPlanConfig(CustomPlanConfig customPlanConfig) { + this.customPlanConfig = Optional.ofNullable(customPlanConfig); + return this; + } + + @java.lang.Override + @JsonSetter(value = "custom_plan_config", nulls = Nulls.SKIP) + public _FinalStage customPlanConfig(Optional customPlanConfig) { + this.customPlanConfig = customPlanConfig; + return this; + } + + @java.lang.Override + public _FinalStage addAllCurrencyPrices(List currencyPrices) { + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addCurrencyPrices(PlanCurrencyPricesResponseData currencyPrices) { + this.currencyPrices.add(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices.clear(); + if (currencyPrices != null) { + this.currencyPrices.addAll(currencyPrices); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllCompatiblePlanIds(List compatiblePlanIds) { + if (compatiblePlanIds != null) { + this.compatiblePlanIds.addAll(compatiblePlanIds); + } + return this; + } + + @java.lang.Override + public _FinalStage addCompatiblePlanIds(String compatiblePlanIds) { + this.compatiblePlanIds.add(compatiblePlanIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "compatible_plan_ids", nulls = Nulls.SKIP) + public _FinalStage compatiblePlanIds(List compatiblePlanIds) { + this.compatiblePlanIds.clear(); + if (compatiblePlanIds != null) { + this.compatiblePlanIds.addAll(compatiblePlanIds); + } + return this; + } + + @java.lang.Override + public _FinalStage billingProduct(BillingProductDetailResponseData billingProduct) { + this.billingProduct = Optional.ofNullable(billingProduct); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billing_product", nulls = Nulls.SKIP) + public _FinalStage billingProduct(Optional billingProduct) { + this.billingProduct = billingProduct; + return this; + } + + @java.lang.Override + public _FinalStage audienceType(String audienceType) { + this.audienceType = Optional.ofNullable(audienceType); + return this; + } + + @java.lang.Override + @JsonSetter(value = "audience_type", nulls = Nulls.SKIP) + public _FinalStage audienceType(Optional audienceType) { + this.audienceType = audienceType; + return this; + } + + @java.lang.Override + public _FinalStage activeVersion(PlanVersionResponseData activeVersion) { + this.activeVersion = Optional.ofNullable(activeVersion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active_version", nulls = Nulls.SKIP) + public _FinalStage activeVersion(Optional activeVersion) { + this.activeVersion = activeVersion; + return this; + } + + @java.lang.Override + public PlanViewPublicResponseData build() { + return new PlanViewPublicResponseData( + activeVersion, + audienceType, + billingProduct, + chargeType, + companyCount, + compatiblePlanIds, + controlledBy, + createdAt, + currencyPrices, + custom, + customPlanConfig, + description, + draftVersion, + entitlements, + features, + icon, + id, + includedCreditGrants, + isCustom, + isDefault, + isFree, + isTrialable, + monthlyPrice, + name, + oneTimePrice, + planType, + trialDays, + updatedAt, + versions, + yearlyPrice, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/PreviewObject.java b/src/main/java/com/schematic/api/types/PreviewObject.java index 696c7f0..bce89c9 100644 --- a/src/main/java/com/schematic/api/types/PreviewObject.java +++ b/src/main/java/com/schematic/api/types/PreviewObject.java @@ -109,6 +109,10 @@ public interface NameStage { public interface _FinalStage { PreviewObject build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -186,5 +190,17 @@ public _FinalStage description(Optional description) { public PreviewObject build() { return new PreviewObject(description, id, imageUrl, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PreviewObjectResponseData.java b/src/main/java/com/schematic/api/types/PreviewObjectResponseData.java index a33a4a8..5a69656 100644 --- a/src/main/java/com/schematic/api/types/PreviewObjectResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewObjectResponseData.java @@ -109,6 +109,10 @@ public interface NameStage { public interface _FinalStage { PreviewObjectResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -186,5 +190,17 @@ public _FinalStage description(Optional description) { public PreviewObjectResponseData build() { return new PreviewObjectResponseData(description, id, imageUrl, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionChangeResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionChangeResponseData.java index 66a4ba6..70b80ac 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionChangeResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionChangeResponseData.java @@ -24,13 +24,15 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PreviewSubscriptionChangeResponseData.Builder.class) public final class PreviewSubscriptionChangeResponseData { - private final int amountOff; + private final long amountOff; - private final int dueNow; + private final long dueNow; private final Optional finance; - private final int newCharges; + private final boolean isScheduledDowngrade; + + private final long newCharges; private final boolean paymentMethodRequired; @@ -40,7 +42,9 @@ public final class PreviewSubscriptionChangeResponseData { private final boolean promoCodeApplied; - private final int proration; + private final long proration; + + private final Optional scheduledChangeTime; private final Optional trialEnd; @@ -49,39 +53,43 @@ public final class PreviewSubscriptionChangeResponseData { private final Map additionalProperties; private PreviewSubscriptionChangeResponseData( - int amountOff, - int dueNow, + long amountOff, + long dueNow, Optional finance, - int newCharges, + boolean isScheduledDowngrade, + long newCharges, boolean paymentMethodRequired, double percentOff, OffsetDateTime periodStart, boolean promoCodeApplied, - int proration, + long proration, + Optional scheduledChangeTime, Optional trialEnd, List usageViolations, Map additionalProperties) { this.amountOff = amountOff; this.dueNow = dueNow; this.finance = finance; + this.isScheduledDowngrade = isScheduledDowngrade; this.newCharges = newCharges; this.paymentMethodRequired = paymentMethodRequired; this.percentOff = percentOff; this.periodStart = periodStart; this.promoCodeApplied = promoCodeApplied; this.proration = proration; + this.scheduledChangeTime = scheduledChangeTime; this.trialEnd = trialEnd; this.usageViolations = usageViolations; this.additionalProperties = additionalProperties; } @JsonProperty("amount_off") - public int getAmountOff() { + public long getAmountOff() { return amountOff; } @JsonProperty("due_now") - public int getDueNow() { + public long getDueNow() { return dueNow; } @@ -90,8 +98,13 @@ public Optional getFinance() { return finance; } + @JsonProperty("is_scheduled_downgrade") + public boolean getIsScheduledDowngrade() { + return isScheduledDowngrade; + } + @JsonProperty("new_charges") - public int getNewCharges() { + public long getNewCharges() { return newCharges; } @@ -116,10 +129,15 @@ public boolean getPromoCodeApplied() { } @JsonProperty("proration") - public int getProration() { + public long getProration() { return proration; } + @JsonProperty("scheduled_change_time") + public Optional getScheduledChangeTime() { + return scheduledChangeTime; + } + @JsonProperty("trial_end") public Optional getTrialEnd() { return trialEnd; @@ -146,12 +164,14 @@ private boolean equalTo(PreviewSubscriptionChangeResponseData other) { return amountOff == other.amountOff && dueNow == other.dueNow && finance.equals(other.finance) + && isScheduledDowngrade == other.isScheduledDowngrade && newCharges == other.newCharges && paymentMethodRequired == other.paymentMethodRequired && percentOff == other.percentOff && periodStart.equals(other.periodStart) && promoCodeApplied == other.promoCodeApplied && proration == other.proration + && scheduledChangeTime.equals(other.scheduledChangeTime) && trialEnd.equals(other.trialEnd) && usageViolations.equals(other.usageViolations); } @@ -162,12 +182,14 @@ public int hashCode() { this.amountOff, this.dueNow, this.finance, + this.isScheduledDowngrade, this.newCharges, this.paymentMethodRequired, this.percentOff, this.periodStart, this.promoCodeApplied, this.proration, + this.scheduledChangeTime, this.trialEnd, this.usageViolations); } @@ -182,17 +204,21 @@ public static AmountOffStage builder() { } public interface AmountOffStage { - DueNowStage amountOff(int amountOff); + DueNowStage amountOff(long amountOff); Builder from(PreviewSubscriptionChangeResponseData other); } public interface DueNowStage { - NewChargesStage dueNow(int dueNow); + IsScheduledDowngradeStage dueNow(long dueNow); + } + + public interface IsScheduledDowngradeStage { + NewChargesStage isScheduledDowngrade(boolean isScheduledDowngrade); } public interface NewChargesStage { - PaymentMethodRequiredStage newCharges(int newCharges); + PaymentMethodRequiredStage newCharges(long newCharges); } public interface PaymentMethodRequiredStage { @@ -212,16 +238,24 @@ public interface PromoCodeAppliedStage { } public interface ProrationStage { - _FinalStage proration(int proration); + _FinalStage proration(long proration); } public interface _FinalStage { PreviewSubscriptionChangeResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage finance(Optional finance); _FinalStage finance(PreviewSubscriptionFinanceResponseData finance); + _FinalStage scheduledChangeTime(Optional scheduledChangeTime); + + _FinalStage scheduledChangeTime(OffsetDateTime scheduledChangeTime); + _FinalStage trialEnd(Optional trialEnd); _FinalStage trialEnd(OffsetDateTime trialEnd); @@ -237,6 +271,7 @@ public interface _FinalStage { public static final class Builder implements AmountOffStage, DueNowStage, + IsScheduledDowngradeStage, NewChargesStage, PaymentMethodRequiredStage, PercentOffStage, @@ -244,11 +279,13 @@ public static final class Builder PromoCodeAppliedStage, ProrationStage, _FinalStage { - private int amountOff; + private long amountOff; + + private long dueNow; - private int dueNow; + private boolean isScheduledDowngrade; - private int newCharges; + private long newCharges; private boolean paymentMethodRequired; @@ -258,12 +295,14 @@ public static final class Builder private boolean promoCodeApplied; - private int proration; + private long proration; private List usageViolations = new ArrayList<>(); private Optional trialEnd = Optional.empty(); + private Optional scheduledChangeTime = Optional.empty(); + private Optional finance = Optional.empty(); @JsonAnySetter @@ -276,12 +315,14 @@ public Builder from(PreviewSubscriptionChangeResponseData other) { amountOff(other.getAmountOff()); dueNow(other.getDueNow()); finance(other.getFinance()); + isScheduledDowngrade(other.getIsScheduledDowngrade()); newCharges(other.getNewCharges()); paymentMethodRequired(other.getPaymentMethodRequired()); percentOff(other.getPercentOff()); periodStart(other.getPeriodStart()); promoCodeApplied(other.getPromoCodeApplied()); proration(other.getProration()); + scheduledChangeTime(other.getScheduledChangeTime()); trialEnd(other.getTrialEnd()); usageViolations(other.getUsageViolations()); return this; @@ -289,21 +330,28 @@ public Builder from(PreviewSubscriptionChangeResponseData other) { @java.lang.Override @JsonSetter("amount_off") - public DueNowStage amountOff(int amountOff) { + public DueNowStage amountOff(long amountOff) { this.amountOff = amountOff; return this; } @java.lang.Override @JsonSetter("due_now") - public NewChargesStage dueNow(int dueNow) { + public IsScheduledDowngradeStage dueNow(long dueNow) { this.dueNow = dueNow; return this; } + @java.lang.Override + @JsonSetter("is_scheduled_downgrade") + public NewChargesStage isScheduledDowngrade(boolean isScheduledDowngrade) { + this.isScheduledDowngrade = isScheduledDowngrade; + return this; + } + @java.lang.Override @JsonSetter("new_charges") - public PaymentMethodRequiredStage newCharges(int newCharges) { + public PaymentMethodRequiredStage newCharges(long newCharges) { this.newCharges = newCharges; return this; } @@ -338,7 +386,7 @@ public ProrationStage promoCodeApplied(boolean promoCodeApplied) { @java.lang.Override @JsonSetter("proration") - public _FinalStage proration(int proration) { + public _FinalStage proration(long proration) { this.proration = proration; return this; } @@ -380,6 +428,19 @@ public _FinalStage trialEnd(Optional trialEnd) { return this; } + @java.lang.Override + public _FinalStage scheduledChangeTime(OffsetDateTime scheduledChangeTime) { + this.scheduledChangeTime = Optional.ofNullable(scheduledChangeTime); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_change_time", nulls = Nulls.SKIP) + public _FinalStage scheduledChangeTime(Optional scheduledChangeTime) { + this.scheduledChangeTime = scheduledChangeTime; + return this; + } + @java.lang.Override public _FinalStage finance(PreviewSubscriptionFinanceResponseData finance) { this.finance = Optional.ofNullable(finance); @@ -399,15 +460,29 @@ public PreviewSubscriptionChangeResponseData build() { amountOff, dueNow, finance, + isScheduledDowngrade, newCharges, paymentMethodRequired, percentOff, periodStart, promoCodeApplied, proration, + scheduledChangeTime, trialEnd, usageViolations, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java index bb45182..8c005eb 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionFinanceResponseData.java @@ -24,11 +24,11 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PreviewSubscriptionFinanceResponseData.Builder.class) public final class PreviewSubscriptionFinanceResponseData { - private final int amountOff; + private final long amountOff; - private final int dueNow; + private final long dueNow; - private final int newCharges; + private final long newCharges; private final double percentOff; @@ -36,15 +36,15 @@ public final class PreviewSubscriptionFinanceResponseData { private final boolean promoCodeApplied; - private final int proration; + private final long proration; - private final Optional taxAmount; + private final Optional taxAmount; private final Optional taxDisplayName; private final boolean taxRequireBillingDetails; - private final int totalPerBillingPeriod; + private final long totalPerBillingPeriod; private final Optional trialEnd; @@ -53,17 +53,17 @@ public final class PreviewSubscriptionFinanceResponseData { private final Map additionalProperties; private PreviewSubscriptionFinanceResponseData( - int amountOff, - int dueNow, - int newCharges, + long amountOff, + long dueNow, + long newCharges, double percentOff, OffsetDateTime periodStart, boolean promoCodeApplied, - int proration, - Optional taxAmount, + long proration, + Optional taxAmount, Optional taxDisplayName, boolean taxRequireBillingDetails, - int totalPerBillingPeriod, + long totalPerBillingPeriod, Optional trialEnd, List upcomingInvoiceLineItems, Map additionalProperties) { @@ -84,17 +84,17 @@ private PreviewSubscriptionFinanceResponseData( } @JsonProperty("amount_off") - public int getAmountOff() { + public long getAmountOff() { return amountOff; } @JsonProperty("due_now") - public int getDueNow() { + public long getDueNow() { return dueNow; } @JsonProperty("new_charges") - public int getNewCharges() { + public long getNewCharges() { return newCharges; } @@ -114,12 +114,12 @@ public boolean getPromoCodeApplied() { } @JsonProperty("proration") - public int getProration() { + public long getProration() { return proration; } @JsonProperty("tax_amount") - public Optional getTaxAmount() { + public Optional getTaxAmount() { return taxAmount; } @@ -134,7 +134,7 @@ public boolean getTaxRequireBillingDetails() { } @JsonProperty("total_per_billing_period") - public int getTotalPerBillingPeriod() { + public long getTotalPerBillingPeriod() { return totalPerBillingPeriod; } @@ -204,17 +204,17 @@ public static AmountOffStage builder() { } public interface AmountOffStage { - DueNowStage amountOff(int amountOff); + DueNowStage amountOff(long amountOff); Builder from(PreviewSubscriptionFinanceResponseData other); } public interface DueNowStage { - NewChargesStage dueNow(int dueNow); + NewChargesStage dueNow(long dueNow); } public interface NewChargesStage { - PercentOffStage newCharges(int newCharges); + PercentOffStage newCharges(long newCharges); } public interface PercentOffStage { @@ -230,7 +230,7 @@ public interface PromoCodeAppliedStage { } public interface ProrationStage { - TaxRequireBillingDetailsStage proration(int proration); + TaxRequireBillingDetailsStage proration(long proration); } public interface TaxRequireBillingDetailsStage { @@ -238,15 +238,19 @@ public interface TaxRequireBillingDetailsStage { } public interface TotalPerBillingPeriodStage { - _FinalStage totalPerBillingPeriod(int totalPerBillingPeriod); + _FinalStage totalPerBillingPeriod(long totalPerBillingPeriod); } public interface _FinalStage { PreviewSubscriptionFinanceResponseData build(); - _FinalStage taxAmount(Optional taxAmount); + _FinalStage additionalProperty(String key, Object value); - _FinalStage taxAmount(Integer taxAmount); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage taxAmount(Optional taxAmount); + + _FinalStage taxAmount(Long taxAmount); _FinalStage taxDisplayName(Optional taxDisplayName); @@ -277,11 +281,11 @@ public static final class Builder TaxRequireBillingDetailsStage, TotalPerBillingPeriodStage, _FinalStage { - private int amountOff; + private long amountOff; - private int dueNow; + private long dueNow; - private int newCharges; + private long newCharges; private double percentOff; @@ -289,11 +293,11 @@ public static final class Builder private boolean promoCodeApplied; - private int proration; + private long proration; private boolean taxRequireBillingDetails; - private int totalPerBillingPeriod; + private long totalPerBillingPeriod; private List upcomingInvoiceLineItems = new ArrayList<>(); @@ -301,7 +305,7 @@ public static final class Builder private Optional taxDisplayName = Optional.empty(); - private Optional taxAmount = Optional.empty(); + private Optional taxAmount = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -328,21 +332,21 @@ public Builder from(PreviewSubscriptionFinanceResponseData other) { @java.lang.Override @JsonSetter("amount_off") - public DueNowStage amountOff(int amountOff) { + public DueNowStage amountOff(long amountOff) { this.amountOff = amountOff; return this; } @java.lang.Override @JsonSetter("due_now") - public NewChargesStage dueNow(int dueNow) { + public NewChargesStage dueNow(long dueNow) { this.dueNow = dueNow; return this; } @java.lang.Override @JsonSetter("new_charges") - public PercentOffStage newCharges(int newCharges) { + public PercentOffStage newCharges(long newCharges) { this.newCharges = newCharges; return this; } @@ -370,7 +374,7 @@ public ProrationStage promoCodeApplied(boolean promoCodeApplied) { @java.lang.Override @JsonSetter("proration") - public TaxRequireBillingDetailsStage proration(int proration) { + public TaxRequireBillingDetailsStage proration(long proration) { this.proration = proration; return this; } @@ -384,7 +388,7 @@ public TotalPerBillingPeriodStage taxRequireBillingDetails(boolean taxRequireBil @java.lang.Override @JsonSetter("total_per_billing_period") - public _FinalStage totalPerBillingPeriod(int totalPerBillingPeriod) { + public _FinalStage totalPerBillingPeriod(long totalPerBillingPeriod) { this.totalPerBillingPeriod = totalPerBillingPeriod; return this; } @@ -443,14 +447,14 @@ public _FinalStage taxDisplayName(Optional taxDisplayName) { } @java.lang.Override - public _FinalStage taxAmount(Integer taxAmount) { + public _FinalStage taxAmount(Long taxAmount) { this.taxAmount = Optional.ofNullable(taxAmount); return this; } @java.lang.Override @JsonSetter(value = "tax_amount", nulls = Nulls.SKIP) - public _FinalStage taxAmount(Optional taxAmount) { + public _FinalStage taxAmount(Optional taxAmount) { this.taxAmount = taxAmount; return this; } @@ -473,5 +477,17 @@ public PreviewSubscriptionFinanceResponseData build() { upcomingInvoiceLineItems, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PreviewSubscriptionUpcomingInvoiceLineItems.java b/src/main/java/com/schematic/api/types/PreviewSubscriptionUpcomingInvoiceLineItems.java index 561848b..8f573f4 100644 --- a/src/main/java/com/schematic/api/types/PreviewSubscriptionUpcomingInvoiceLineItems.java +++ b/src/main/java/com/schematic/api/types/PreviewSubscriptionUpcomingInvoiceLineItems.java @@ -19,7 +19,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PreviewSubscriptionUpcomingInvoiceLineItems.Builder.class) public final class PreviewSubscriptionUpcomingInvoiceLineItems { - private final int amount; + private final long amount; private final String description; @@ -27,16 +27,16 @@ public final class PreviewSubscriptionUpcomingInvoiceLineItems { private final boolean proration; - private final int quantity; + private final long quantity; private final Map additionalProperties; private PreviewSubscriptionUpcomingInvoiceLineItems( - int amount, + long amount, String description, String priceId, boolean proration, - int quantity, + long quantity, Map additionalProperties) { this.amount = amount; this.description = description; @@ -47,7 +47,7 @@ private PreviewSubscriptionUpcomingInvoiceLineItems( } @JsonProperty("amount") - public int getAmount() { + public long getAmount() { return amount; } @@ -67,7 +67,7 @@ public boolean getProration() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -106,7 +106,7 @@ public static AmountStage builder() { } public interface AmountStage { - DescriptionStage amount(int amount); + DescriptionStage amount(long amount); Builder from(PreviewSubscriptionUpcomingInvoiceLineItems other); } @@ -124,17 +124,21 @@ public interface ProrationStage { } public interface QuantityStage { - _FinalStage quantity(int quantity); + _FinalStage quantity(long quantity); } public interface _FinalStage { PreviewSubscriptionUpcomingInvoiceLineItems build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements AmountStage, DescriptionStage, PriceIdStage, ProrationStage, QuantityStage, _FinalStage { - private int amount; + private long amount; private String description; @@ -142,7 +146,7 @@ public static final class Builder private boolean proration; - private int quantity; + private long quantity; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -161,7 +165,7 @@ public Builder from(PreviewSubscriptionUpcomingInvoiceLineItems other) { @java.lang.Override @JsonSetter("amount") - public DescriptionStage amount(int amount) { + public DescriptionStage amount(long amount) { this.amount = amount; return this; } @@ -189,7 +193,7 @@ public QuantityStage proration(boolean proration) { @java.lang.Override @JsonSetter("quantity") - public _FinalStage quantity(int quantity) { + public _FinalStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -199,5 +203,17 @@ public PreviewSubscriptionUpcomingInvoiceLineItems build() { return new PreviewSubscriptionUpcomingInvoiceLineItems( amount, description, priceId, proration, quantity, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/PublicPlansResponseData.java b/src/main/java/com/schematic/api/types/PublicPlansResponseData.java new file mode 100644 index 0000000..b66524a --- /dev/null +++ b/src/main/java/com/schematic/api/types/PublicPlansResponseData.java @@ -0,0 +1,404 @@ +/** + * 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 = PublicPlansResponseData.Builder.class) +public final class PublicPlansResponseData { + private final List activeAddOns; + + private final List activePlans; + + private final List addOnCompatibilities; + + private final Optional capabilities; + + private final ComponentDisplaySettings displaySettings; + + private final boolean showAsMonthlyPrices; + + private final boolean showCredits; + + private final boolean showPeriodToggle; + + private final boolean showZeroPriceAsFree; + + private final Map additionalProperties; + + private PublicPlansResponseData( + List activeAddOns, + List activePlans, + List addOnCompatibilities, + Optional capabilities, + ComponentDisplaySettings displaySettings, + boolean showAsMonthlyPrices, + boolean showCredits, + boolean showPeriodToggle, + boolean showZeroPriceAsFree, + Map additionalProperties) { + this.activeAddOns = activeAddOns; + this.activePlans = activePlans; + this.addOnCompatibilities = addOnCompatibilities; + this.capabilities = capabilities; + this.displaySettings = displaySettings; + this.showAsMonthlyPrices = showAsMonthlyPrices; + this.showCredits = showCredits; + this.showPeriodToggle = showPeriodToggle; + this.showZeroPriceAsFree = showZeroPriceAsFree; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("active_add_ons") + public List getActiveAddOns() { + return activeAddOns; + } + + @JsonProperty("active_plans") + public List getActivePlans() { + return activePlans; + } + + @JsonProperty("add_on_compatibilities") + public List getAddOnCompatibilities() { + return addOnCompatibilities; + } + + @JsonProperty("capabilities") + public Optional getCapabilities() { + return capabilities; + } + + @JsonProperty("display_settings") + public ComponentDisplaySettings getDisplaySettings() { + return displaySettings; + } + + @JsonProperty("show_as_monthly_prices") + public boolean getShowAsMonthlyPrices() { + return showAsMonthlyPrices; + } + + @JsonProperty("show_credits") + public boolean getShowCredits() { + return showCredits; + } + + @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 PublicPlansResponseData && equalTo((PublicPlansResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PublicPlansResponseData other) { + return activeAddOns.equals(other.activeAddOns) + && activePlans.equals(other.activePlans) + && addOnCompatibilities.equals(other.addOnCompatibilities) + && capabilities.equals(other.capabilities) + && displaySettings.equals(other.displaySettings) + && showAsMonthlyPrices == other.showAsMonthlyPrices + && showCredits == other.showCredits + && showPeriodToggle == other.showPeriodToggle + && showZeroPriceAsFree == other.showZeroPriceAsFree; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.activeAddOns, + this.activePlans, + this.addOnCompatibilities, + this.capabilities, + this.displaySettings, + this.showAsMonthlyPrices, + this.showCredits, + this.showPeriodToggle, + this.showZeroPriceAsFree); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DisplaySettingsStage builder() { + return new Builder(); + } + + public interface DisplaySettingsStage { + ShowAsMonthlyPricesStage displaySettings(@NotNull ComponentDisplaySettings displaySettings); + + Builder from(PublicPlansResponseData other); + } + + public interface ShowAsMonthlyPricesStage { + ShowCreditsStage showAsMonthlyPrices(boolean showAsMonthlyPrices); + } + + public interface ShowCreditsStage { + ShowPeriodToggleStage showCredits(boolean showCredits); + } + + public interface ShowPeriodToggleStage { + ShowZeroPriceAsFreeStage showPeriodToggle(boolean showPeriodToggle); + } + + public interface ShowZeroPriceAsFreeStage { + _FinalStage showZeroPriceAsFree(boolean showZeroPriceAsFree); + } + + public interface _FinalStage { + PublicPlansResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage activeAddOns(List activeAddOns); + + _FinalStage addActiveAddOns(PlanViewPublicResponseData activeAddOns); + + _FinalStage addAllActiveAddOns(List activeAddOns); + + _FinalStage activePlans(List activePlans); + + _FinalStage addActivePlans(PlanViewPublicResponseData activePlans); + + _FinalStage addAllActivePlans(List activePlans); + + _FinalStage addOnCompatibilities(List addOnCompatibilities); + + _FinalStage addAddOnCompatibilities(CompatiblePlans addOnCompatibilities); + + _FinalStage addAllAddOnCompatibilities(List addOnCompatibilities); + + _FinalStage capabilities(Optional capabilities); + + _FinalStage capabilities(ComponentCapabilities capabilities); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DisplaySettingsStage, + ShowAsMonthlyPricesStage, + ShowCreditsStage, + ShowPeriodToggleStage, + ShowZeroPriceAsFreeStage, + _FinalStage { + private ComponentDisplaySettings displaySettings; + + private boolean showAsMonthlyPrices; + + private boolean showCredits; + + private boolean showPeriodToggle; + + private boolean showZeroPriceAsFree; + + private Optional capabilities = Optional.empty(); + + private List addOnCompatibilities = new ArrayList<>(); + + private List activePlans = new ArrayList<>(); + + private List activeAddOns = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PublicPlansResponseData other) { + activeAddOns(other.getActiveAddOns()); + activePlans(other.getActivePlans()); + addOnCompatibilities(other.getAddOnCompatibilities()); + capabilities(other.getCapabilities()); + displaySettings(other.getDisplaySettings()); + showAsMonthlyPrices(other.getShowAsMonthlyPrices()); + showCredits(other.getShowCredits()); + showPeriodToggle(other.getShowPeriodToggle()); + showZeroPriceAsFree(other.getShowZeroPriceAsFree()); + return this; + } + + @java.lang.Override + @JsonSetter("display_settings") + public ShowAsMonthlyPricesStage displaySettings(@NotNull ComponentDisplaySettings displaySettings) { + this.displaySettings = Objects.requireNonNull(displaySettings, "displaySettings 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) { + this.showCredits = showCredits; + 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 _FinalStage capabilities(ComponentCapabilities capabilities) { + this.capabilities = Optional.ofNullable(capabilities); + return this; + } + + @java.lang.Override + @JsonSetter(value = "capabilities", nulls = Nulls.SKIP) + public _FinalStage capabilities(Optional capabilities) { + this.capabilities = capabilities; + return this; + } + + @java.lang.Override + public _FinalStage addAllAddOnCompatibilities(List addOnCompatibilities) { + if (addOnCompatibilities != null) { + this.addOnCompatibilities.addAll(addOnCompatibilities); + } + return this; + } + + @java.lang.Override + public _FinalStage addAddOnCompatibilities(CompatiblePlans addOnCompatibilities) { + this.addOnCompatibilities.add(addOnCompatibilities); + return this; + } + + @java.lang.Override + @JsonSetter(value = "add_on_compatibilities", nulls = Nulls.SKIP) + public _FinalStage addOnCompatibilities(List addOnCompatibilities) { + this.addOnCompatibilities.clear(); + if (addOnCompatibilities != null) { + this.addOnCompatibilities.addAll(addOnCompatibilities); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllActivePlans(List activePlans) { + if (activePlans != null) { + this.activePlans.addAll(activePlans); + } + return this; + } + + @java.lang.Override + public _FinalStage addActivePlans(PlanViewPublicResponseData activePlans) { + this.activePlans.add(activePlans); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active_plans", nulls = Nulls.SKIP) + public _FinalStage activePlans(List activePlans) { + this.activePlans.clear(); + if (activePlans != null) { + this.activePlans.addAll(activePlans); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllActiveAddOns(List activeAddOns) { + if (activeAddOns != null) { + this.activeAddOns.addAll(activeAddOns); + } + return this; + } + + @java.lang.Override + public _FinalStage addActiveAddOns(PlanViewPublicResponseData activeAddOns) { + this.activeAddOns.add(activeAddOns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "active_add_ons", nulls = Nulls.SKIP) + public _FinalStage activeAddOns(List activeAddOns) { + this.activeAddOns.clear(); + if (activeAddOns != null) { + this.activeAddOns.addAll(activeAddOns); + } + return this; + } + + @java.lang.Override + public PublicPlansResponseData build() { + return new PublicPlansResponseData( + activeAddOns, + activePlans, + addOnCompatibilities, + capabilities, + displaySettings, + showAsMonthlyPrices, + showCredits, + showPeriodToggle, + showZeroPriceAsFree, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/QuickstartResp.java b/src/main/java/com/schematic/api/types/QuickstartResp.java index 49ace77..d1d0737 100644 --- a/src/main/java/com/schematic/api/types/QuickstartResp.java +++ b/src/main/java/com/schematic/api/types/QuickstartResp.java @@ -69,6 +69,10 @@ public interface OkStage { public interface _FinalStage { QuickstartResp build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -97,5 +101,17 @@ public _FinalStage ok(boolean ok) { public QuickstartResp build() { return new QuickstartResp(ok, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RawEventBatchResponseData.java b/src/main/java/com/schematic/api/types/RawEventBatchResponseData.java index 960a2d1..7b75597 100644 --- a/src/main/java/com/schematic/api/types/RawEventBatchResponseData.java +++ b/src/main/java/com/schematic/api/types/RawEventBatchResponseData.java @@ -102,5 +102,15 @@ public Builder addAllEvents(List events) { public RawEventBatchResponseData build() { return new RawEventBatchResponseData(events, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RawEventResponseData.java b/src/main/java/com/schematic/api/types/RawEventResponseData.java index cf1fdf0..8e59cef 100644 --- a/src/main/java/com/schematic/api/types/RawEventResponseData.java +++ b/src/main/java/com/schematic/api/types/RawEventResponseData.java @@ -124,6 +124,10 @@ public interface UserAgentStage { public interface _FinalStage { RawEventResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage eventId(Optional eventId); _FinalStage eventId(String eventId); @@ -211,5 +215,17 @@ public _FinalStage eventId(Optional eventId) { public RawEventResponseData build() { return new RawEventResponseData(capturedAt, eventId, remoteAddr, remoteIp, userAgent, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/Rule.java b/src/main/java/com/schematic/api/types/Rule.java index 489003e..7d7688f 100644 --- a/src/main/java/com/schematic/api/types/Rule.java +++ b/src/main/java/com/schematic/api/types/Rule.java @@ -37,7 +37,7 @@ public final class Rule { private final String name; - private final int priority; + private final long priority; private final RuleRuleType ruleType; @@ -53,7 +53,7 @@ private Rule( Optional flagId, String id, String name, - int priority, + long priority, RuleRuleType ruleType, boolean value, Map additionalProperties) { @@ -106,7 +106,7 @@ public String getName() { } @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -187,7 +187,7 @@ public interface NameStage { } public interface PriorityStage { - RuleTypeStage priority(int priority); + RuleTypeStage priority(long priority); } public interface RuleTypeStage { @@ -201,6 +201,10 @@ public interface ValueStage { public interface _FinalStage { Rule build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditionGroups(List conditionGroups); _FinalStage addConditionGroups(ConditionGroup conditionGroups); @@ -236,7 +240,7 @@ public static final class Builder private String name; - private int priority; + private long priority; private RuleRuleType ruleType; @@ -298,7 +302,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public RuleTypeStage priority(int priority) { + public RuleTypeStage priority(long priority) { this.priority = priority; return this; } @@ -393,5 +397,17 @@ public Rule build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java b/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java index 2971737..16d478a 100644 --- a/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleConditionDetailResponseData.java @@ -46,7 +46,7 @@ public final class RuleConditionDetailResponseData { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final String operator; @@ -80,7 +80,7 @@ private RuleConditionDetailResponseData( String id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, String operator, List resourceIds, List resources, @@ -171,7 +171,7 @@ public Optional getMetricPeriodMonthReset() { } @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -327,6 +327,10 @@ public interface UpdatedAtStage { public interface _FinalStage { RuleConditionDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage comparisonTrait(Optional comparisonTrait); _FinalStage comparisonTrait(EntityTraitDefinitionResponseData comparisonTrait); @@ -355,9 +359,9 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); - _FinalStage metricValue(Optional metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Long metricValue); _FinalStage resourceIds(List resourceIds); @@ -421,7 +425,7 @@ public static final class Builder private List resourceIds = new ArrayList<>(); - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -612,14 +616,14 @@ public _FinalStage resourceIds(List resourceIds) { } @java.lang.Override - public _FinalStage metricValue(Integer metricValue) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -741,5 +745,17 @@ public RuleConditionDetailResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleConditionGroupDetailResponseData.java b/src/main/java/com/schematic/api/types/RuleConditionGroupDetailResponseData.java index 2dbc94a..f6ba23b 100644 --- a/src/main/java/com/schematic/api/types/RuleConditionGroupDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleConditionGroupDetailResponseData.java @@ -156,6 +156,10 @@ public interface UpdatedAtStage { public interface _FinalStage { RuleConditionGroupDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditions(List conditions); _FinalStage addConditions(RuleConditionDetailResponseData conditions); @@ -278,5 +282,17 @@ public RuleConditionGroupDetailResponseData build() { return new RuleConditionGroupDetailResponseData( conditions, createdAt, environmentId, flagId, id, ruleId, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleConditionGroupResponseData.java b/src/main/java/com/schematic/api/types/RuleConditionGroupResponseData.java index 14ae8ba..22bf830 100644 --- a/src/main/java/com/schematic/api/types/RuleConditionGroupResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleConditionGroupResponseData.java @@ -142,6 +142,10 @@ public interface UpdatedAtStage { public interface _FinalStage { RuleConditionGroupResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage flagId(Optional flagId); _FinalStage flagId(String flagId); @@ -231,5 +235,17 @@ public RuleConditionGroupResponseData build() { return new RuleConditionGroupResponseData( createdAt, environmentId, flagId, id, ruleId, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleConditionResponseData.java b/src/main/java/com/schematic/api/types/RuleConditionResponseData.java index 8be4d73..0173dad 100644 --- a/src/main/java/com/schematic/api/types/RuleConditionResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleConditionResponseData.java @@ -44,7 +44,7 @@ public final class RuleConditionResponseData { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final String operator; @@ -73,7 +73,7 @@ private RuleConditionResponseData( String id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, String operator, List resourceIds, String ruleId, @@ -154,7 +154,7 @@ public Optional getMetricPeriodMonthReset() { } @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -294,6 +294,10 @@ public interface UpdatedAtStage { public interface _FinalStage { RuleConditionResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage comparisonTraitId(Optional comparisonTraitId); _FinalStage comparisonTraitId(String comparisonTraitId); @@ -318,9 +322,9 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(String metricPeriodMonthReset); - _FinalStage metricValue(Optional metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Long metricValue); _FinalStage resourceIds(List resourceIds); @@ -370,7 +374,7 @@ public static final class Builder private List resourceIds = new ArrayList<>(); - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -519,14 +523,14 @@ public _FinalStage resourceIds(List resourceIds) { } @java.lang.Override - public _FinalStage metricValue(Integer metricValue) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -632,5 +636,17 @@ public RuleConditionResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleDetailResponseData.java b/src/main/java/com/schematic/api/types/RuleDetailResponseData.java index 6e08c73..0db4fd0 100644 --- a/src/main/java/com/schematic/api/types/RuleDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleDetailResponseData.java @@ -38,7 +38,7 @@ public final class RuleDetailResponseData { private final String name; - private final int priority; + private final long priority; private final String ruleType; @@ -56,7 +56,7 @@ private RuleDetailResponseData( Optional flagId, String id, String name, - int priority, + long priority, String ruleType, OffsetDateTime updatedAt, boolean value, @@ -111,7 +111,7 @@ public String getName() { } @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -199,7 +199,7 @@ public interface NameStage { } public interface PriorityStage { - RuleTypeStage priority(int priority); + RuleTypeStage priority(long priority); } public interface RuleTypeStage { @@ -217,6 +217,10 @@ public interface ValueStage { public interface _FinalStage { RuleDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditionGroups(List conditionGroups); _FinalStage addConditionGroups(RuleConditionGroupDetailResponseData conditionGroups); @@ -253,7 +257,7 @@ public static final class Builder private String name; - private int priority; + private long priority; private String ruleType; @@ -318,7 +322,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public RuleTypeStage priority(int priority) { + public RuleTypeStage priority(long priority) { this.priority = priority; return this; } @@ -421,5 +425,17 @@ public RuleDetailResponseData build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleResponseData.java b/src/main/java/com/schematic/api/types/RuleResponseData.java index faf0c93..08c5a25 100644 --- a/src/main/java/com/schematic/api/types/RuleResponseData.java +++ b/src/main/java/com/schematic/api/types/RuleResponseData.java @@ -32,7 +32,7 @@ public final class RuleResponseData { private final String name; - private final int priority; + private final long priority; private final String ruleType; @@ -48,7 +48,7 @@ private RuleResponseData( Optional flagId, String id, String name, - int priority, + long priority, String ruleType, OffsetDateTime updatedAt, boolean value, @@ -91,7 +91,7 @@ public String getName() { } @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -175,7 +175,7 @@ public interface NameStage { } public interface PriorityStage { - RuleTypeStage priority(int priority); + RuleTypeStage priority(long priority); } public interface RuleTypeStage { @@ -193,6 +193,10 @@ public interface ValueStage { public interface _FinalStage { RuleResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage flagId(Optional flagId); _FinalStage flagId(String flagId); @@ -217,7 +221,7 @@ public static final class Builder private String name; - private int priority; + private long priority; private String ruleType; @@ -276,7 +280,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public RuleTypeStage priority(int priority) { + public RuleTypeStage priority(long priority) { this.priority = priority; return this; } @@ -329,5 +333,17 @@ public RuleResponseData build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RuleView.java b/src/main/java/com/schematic/api/types/RuleView.java index ee143ca..9e27c57 100644 --- a/src/main/java/com/schematic/api/types/RuleView.java +++ b/src/main/java/com/schematic/api/types/RuleView.java @@ -40,9 +40,7 @@ public final class RuleView { private final String name; - private final Optional planVersionId; - - private final int priority; + private final long priority; private final String ruleType; @@ -61,8 +59,7 @@ private RuleView( Optional flagId, String id, String name, - Optional planVersionId, - int priority, + long priority, String ruleType, OffsetDateTime updatedAt, boolean value, @@ -75,7 +72,6 @@ private RuleView( this.flagId = flagId; this.id = id; this.name = name; - this.planVersionId = planVersionId; this.priority = priority; this.ruleType = ruleType; this.updatedAt = updatedAt; @@ -123,13 +119,8 @@ public String getName() { return name; } - @JsonProperty("plan_version_id") - public Optional getPlanVersionId() { - return planVersionId; - } - @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -168,7 +159,6 @@ private boolean equalTo(RuleView other) { && 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) @@ -186,7 +176,6 @@ public int hashCode() { this.flagId, this.id, this.name, - this.planVersionId, this.priority, this.ruleType, this.updatedAt, @@ -225,7 +214,7 @@ public interface NameStage { } public interface PriorityStage { - RuleTypeStage priority(int priority); + RuleTypeStage priority(long priority); } public interface RuleTypeStage { @@ -243,6 +232,10 @@ public interface ValueStage { public interface _FinalStage { RuleView build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditionGroups(List conditionGroups); _FinalStage addConditionGroups(ConditionGroupView conditionGroups); @@ -258,10 +251,6 @@ public interface _FinalStage { _FinalStage flagId(Optional flagId); _FinalStage flagId(String flagId); - - _FinalStage planVersionId(Optional planVersionId); - - _FinalStage planVersionId(String planVersionId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -286,7 +275,7 @@ public static final class Builder private String name; - private int priority; + private long priority; private String ruleType; @@ -294,8 +283,6 @@ public static final class Builder private boolean value; - private Optional planVersionId = Optional.empty(); - private Optional flagId = Optional.empty(); private List conditions = new ArrayList<>(); @@ -317,7 +304,6 @@ public Builder from(RuleView other) { flagId(other.getFlagId()); id(other.getId()); name(other.getName()); - planVersionId(other.getPlanVersionId()); priority(other.getPriority()); ruleType(other.getRuleType()); updatedAt(other.getUpdatedAt()); @@ -362,7 +348,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public RuleTypeStage priority(int priority) { + public RuleTypeStage priority(long priority) { this.priority = priority; return this; } @@ -388,19 +374,6 @@ public _FinalStage value(boolean 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); @@ -473,12 +446,23 @@ public RuleView build() { flagId, id, name, - planVersionId, priority, ruleType, updatedAt, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesDetailResponseData.java b/src/main/java/com/schematic/api/types/RulesDetailResponseData.java index 7149598..67539f6 100644 --- a/src/main/java/com/schematic/api/types/RulesDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/RulesDetailResponseData.java @@ -128,5 +128,15 @@ public Builder addAllRules(List rules) { public RulesDetailResponseData build() { return new RulesDetailResponseData(flag, rules, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java index b6ffacd..6dfb440 100644 --- a/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java +++ b/src/main/java/com/schematic/api/types/RulesEngineSchemaVersion.java @@ -7,12 +7,12 @@ import com.fasterxml.jackson.annotation.JsonValue; public final class RulesEngineSchemaVersion { + public static final RulesEngineSchemaVersion V_5_F_633_CC_3 = + new RulesEngineSchemaVersion(Value.V_5_F_633_CC_3, "v5f633cc3"); + public static final RulesEngineSchemaVersion 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; @@ -46,10 +46,10 @@ public int hashCode() { public T visit(Visitor visitor) { switch (value) { + case V_5_F_633_CC_3: + return visitor.visitV5F633Cc3(); 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); @@ -59,17 +59,17 @@ public T visit(Visitor visitor) { @JsonCreator(mode = JsonCreator.Mode.DELEGATING) public static RulesEngineSchemaVersion valueOf(String value) { switch (value) { + case "v5f633cc3": + return V_5_F_633_CC_3; case "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, + V_5_F_633_CC_3, PLACEHOLDER_FOR_FERN_COMPATIBILITY, @@ -77,7 +77,7 @@ public enum Value { } public interface Visitor { - T visitV0F048Dd3(); + T visitV5F633Cc3(); T visitPlaceholderForFernCompatibility(); diff --git a/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java index 3ffa530..cf859ff 100644 --- a/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java +++ b/src/main/java/com/schematic/api/types/RulesengineCheckFlagResult.java @@ -28,9 +28,9 @@ public final class RulesengineCheckFlagResult { private final Optional err; - private final Optional featureAllocation; + private final Optional featureAllocation; - private final Optional featureUsage; + private final Optional featureUsage; private final Optional featureUsageEvent; @@ -58,8 +58,8 @@ private RulesengineCheckFlagResult( Optional companyId, Optional entitlement, Optional err, - Optional featureAllocation, - Optional featureUsage, + Optional featureAllocation, + Optional featureUsage, Optional featureUsageEvent, Optional featureUsagePeriod, Optional featureUsageResetAt, @@ -105,12 +105,12 @@ public Optional getErr() { } @JsonProperty("feature_allocation") - public Optional getFeatureAllocation() { + public Optional getFeatureAllocation() { return featureAllocation; } @JsonProperty("feature_usage") - public Optional getFeatureUsage() { + public Optional getFeatureUsage() { return featureUsage; } @@ -239,6 +239,10 @@ public interface ValueStage { public interface _FinalStage { RulesengineCheckFlagResult build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyId(Optional companyId); _FinalStage companyId(String companyId); @@ -251,13 +255,13 @@ public interface _FinalStage { _FinalStage err(String err); - _FinalStage featureAllocation(Optional featureAllocation); + _FinalStage featureAllocation(Optional featureAllocation); - _FinalStage featureAllocation(Integer featureAllocation); + _FinalStage featureAllocation(Long featureAllocation); - _FinalStage featureUsage(Optional featureUsage); + _FinalStage featureUsage(Optional featureUsage); - _FinalStage featureUsage(Integer featureUsage); + _FinalStage featureUsage(Long featureUsage); _FinalStage featureUsageEvent(Optional featureUsageEvent); @@ -310,9 +314,9 @@ public static final class Builder implements FlagKeyStage, ReasonStage, ValueSta private Optional featureUsageEvent = Optional.empty(); - private Optional featureUsage = Optional.empty(); + private Optional featureUsage = Optional.empty(); - private Optional featureAllocation = Optional.empty(); + private Optional featureAllocation = Optional.empty(); private Optional err = Optional.empty(); @@ -459,27 +463,27 @@ public _FinalStage featureUsageEvent(Optional featureUsageEvent) { } @java.lang.Override - public _FinalStage featureUsage(Integer featureUsage) { + public _FinalStage featureUsage(Long featureUsage) { this.featureUsage = Optional.ofNullable(featureUsage); return this; } @java.lang.Override @JsonSetter(value = "feature_usage", nulls = Nulls.SKIP) - public _FinalStage featureUsage(Optional featureUsage) { + public _FinalStage featureUsage(Optional featureUsage) { this.featureUsage = featureUsage; return this; } @java.lang.Override - public _FinalStage featureAllocation(Integer featureAllocation) { + public _FinalStage featureAllocation(Long featureAllocation) { this.featureAllocation = Optional.ofNullable(featureAllocation); return this; } @java.lang.Override @JsonSetter(value = "feature_allocation", nulls = Nulls.SKIP) - public _FinalStage featureAllocation(Optional featureAllocation) { + public _FinalStage featureAllocation(Optional featureAllocation) { this.featureAllocation = featureAllocation; return this; } @@ -543,5 +547,17 @@ public RulesengineCheckFlagResult build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineCompany.java b/src/main/java/com/schematic/api/types/RulesengineCompany.java index 64812a0..a11c6aa 100644 --- a/src/main/java/com/schematic/api/types/RulesengineCompany.java +++ b/src/main/java/com/schematic/api/types/RulesengineCompany.java @@ -230,6 +230,10 @@ public interface IdStage { public interface _FinalStage { RulesengineCompany build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage basePlanId(Optional basePlanId); _FinalStage basePlanId(String basePlanId); @@ -616,5 +620,17 @@ public RulesengineCompany build() { traits, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java b/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java index c413dc9..4d601e0 100644 --- a/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java +++ b/src/main/java/com/schematic/api/types/RulesengineCompanyMetric.java @@ -38,7 +38,7 @@ public final class RulesengineCompanyMetric { private final Optional validUntil; - private final int value; + private final long value; private final Map additionalProperties; @@ -51,7 +51,7 @@ private RulesengineCompanyMetric( RulesengineCompanyMetricMonthReset monthReset, RulesengineCompanyMetricPeriod period, Optional validUntil, - int value, + long value, Map additionalProperties) { this.accountId = accountId; this.companyId = companyId; @@ -106,7 +106,7 @@ public Optional getValidUntil() { } @JsonProperty("value") - public int getValue() { + public long getValue() { return value; } @@ -187,12 +187,16 @@ public interface PeriodStage { } public interface ValueStage { - _FinalStage value(int value); + _FinalStage value(long value); } public interface _FinalStage { RulesengineCompanyMetric build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage validUntil(Optional validUntil); _FinalStage validUntil(OffsetDateTime validUntil); @@ -223,7 +227,7 @@ public static final class Builder private RulesengineCompanyMetricPeriod period; - private int value; + private long value; private Optional validUntil = Optional.empty(); @@ -297,7 +301,7 @@ public ValueStage period(@NotNull RulesengineCompanyMetricPeriod period) { @java.lang.Override @JsonSetter("value") - public _FinalStage value(int value) { + public _FinalStage value(long value) { this.value = value; return this; } @@ -329,5 +333,17 @@ public RulesengineCompanyMetric build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineCondition.java b/src/main/java/com/schematic/api/types/RulesengineCondition.java index 47ba85c..b2a5d12 100644 --- a/src/main/java/com/schematic/api/types/RulesengineCondition.java +++ b/src/main/java/com/schematic/api/types/RulesengineCondition.java @@ -43,7 +43,7 @@ public final class RulesengineCondition { private final Optional metricPeriodMonthReset; - private final Optional metricValue; + private final Optional metricValue; private final RulesengineConditionOperator operator; @@ -66,7 +66,7 @@ private RulesengineCondition( String id, Optional metricPeriod, Optional metricPeriodMonthReset, - Optional metricValue, + Optional metricValue, RulesengineConditionOperator operator, List resourceIds, Optional traitDefinition, @@ -141,7 +141,7 @@ public Optional getMetricPeriodMonth } @JsonProperty("metric_value") - public Optional getMetricValue() { + public Optional getMetricValue() { return metricValue; } @@ -252,6 +252,10 @@ public interface TraitValueStage { public interface _FinalStage { RulesengineCondition build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage comparisonTraitDefinition(Optional comparisonTraitDefinition); _FinalStage comparisonTraitDefinition(RulesengineTraitDefinition comparisonTraitDefinition); @@ -276,9 +280,9 @@ public interface _FinalStage { _FinalStage metricPeriodMonthReset(RulesengineConditionMetricPeriodMonthReset metricPeriodMonthReset); - _FinalStage metricValue(Optional metricValue); + _FinalStage metricValue(Optional metricValue); - _FinalStage metricValue(Integer metricValue); + _FinalStage metricValue(Long metricValue); _FinalStage resourceIds(List resourceIds); @@ -316,7 +320,7 @@ public static final class Builder private List resourceIds = new ArrayList<>(); - private Optional metricValue = Optional.empty(); + private Optional metricValue = Optional.empty(); private Optional metricPeriodMonthReset = Optional.empty(); @@ -435,14 +439,14 @@ public _FinalStage resourceIds(List resourceIds) { } @java.lang.Override - public _FinalStage metricValue(Integer metricValue) { + public _FinalStage metricValue(Long metricValue) { this.metricValue = Optional.ofNullable(metricValue); return this; } @java.lang.Override @JsonSetter(value = "metric_value", nulls = Nulls.SKIP) - public _FinalStage metricValue(Optional metricValue) { + public _FinalStage metricValue(Optional metricValue) { this.metricValue = metricValue; return this; } @@ -546,5 +550,17 @@ public RulesengineCondition build() { traitValue, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java b/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java index 032a44c..97185ae 100644 --- a/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java +++ b/src/main/java/com/schematic/api/types/RulesengineConditionGroup.java @@ -102,5 +102,15 @@ public Builder addAllConditions(List conditions) { public RulesengineConditionGroup build() { return new RulesengineConditionGroup(conditions, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java index 53d6acb..a1c8a46 100644 --- a/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java +++ b/src/main/java/com/schematic/api/types/RulesengineFeatureEntitlement.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = RulesengineFeatureEntitlement.Builder.class) public final class RulesengineFeatureEntitlement { - private final Optional allocation; + private final Optional allocation; private final Optional creditId; @@ -44,16 +44,16 @@ public final class RulesengineFeatureEntitlement { private final Optional monthReset; - private final Optional softLimit; + private final Optional softLimit; - private final Optional usage; + private final Optional usage; private final RulesengineEntitlementValueType valueType; private final Map additionalProperties; private RulesengineFeatureEntitlement( - Optional allocation, + Optional allocation, Optional creditId, Optional creditRemaining, Optional creditTotal, @@ -64,8 +64,8 @@ private RulesengineFeatureEntitlement( Optional metricPeriod, Optional metricResetAt, Optional monthReset, - Optional softLimit, - Optional usage, + Optional softLimit, + Optional usage, RulesengineEntitlementValueType valueType, Map additionalProperties) { this.allocation = allocation; @@ -89,7 +89,7 @@ private RulesengineFeatureEntitlement( * @return If the company has a numeric entitlement for this feature, the allocated amount */ @JsonProperty("allocation") - public Optional getAllocation() { + public Optional getAllocation() { return allocation; } @@ -177,7 +177,7 @@ public Optional getMonthReset() { * @return For usage-based pricing, the soft limit for overage charges or the next tier boundary */ @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -185,10 +185,13 @@ public Optional getSoftLimit() { * @return If the company has a numeric entitlement for this feature, the current usage amount */ @JsonProperty("usage") - public Optional getUsage() { + public Optional getUsage() { return usage; } + /** + * @return The type of the entitlement value + */ @JsonProperty("value_type") public RulesengineEntitlementValueType getValueType() { return valueType; @@ -267,18 +270,25 @@ public interface FeatureKeyStage { } public interface ValueTypeStage { + /** + *

The type of the entitlement value

+ */ _FinalStage valueType(@NotNull RulesengineEntitlementValueType valueType); } public interface _FinalStage { RulesengineFeatureEntitlement build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

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

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

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

@@ -339,16 +349,16 @@ public interface _FinalStage { /** *

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

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

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

*/ - _FinalStage usage(Optional usage); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -359,9 +369,9 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private RulesengineEntitlementValueType valueType; - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional monthReset = Optional.empty(); @@ -379,7 +389,7 @@ public static final class Builder implements FeatureIdStage, FeatureKeyStage, Va private Optional creditId = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -429,6 +439,11 @@ public ValueTypeStage featureKey(@NotNull String featureKey) { return this; } + /** + *

The type of the entitlement value

+ *

The type of the entitlement value

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override @JsonSetter("value_type") public _FinalStage valueType(@NotNull RulesengineEntitlementValueType valueType) { @@ -441,7 +456,7 @@ public _FinalStage valueType(@NotNull RulesengineEntitlementValueType valueType) * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @@ -451,7 +466,7 @@ public _FinalStage usage(Integer usage) { */ @java.lang.Override @JsonSetter(value = "usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -461,7 +476,7 @@ public _FinalStage usage(Optional usage) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage softLimit(Integer softLimit) { + public _FinalStage softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @@ -471,7 +486,7 @@ public _FinalStage softLimit(Integer softLimit) { */ @java.lang.Override @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public _FinalStage softLimit(Optional softLimit) { + public _FinalStage softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } @@ -641,7 +656,7 @@ public _FinalStage creditId(Optional creditId) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @@ -651,7 +666,7 @@ public _FinalStage allocation(Integer allocation) { */ @java.lang.Override @JsonSetter(value = "allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -675,5 +690,17 @@ public RulesengineFeatureEntitlement build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineFlag.java b/src/main/java/com/schematic/api/types/RulesengineFlag.java index 2391f93..74b2a5d 100644 --- a/src/main/java/com/schematic/api/types/RulesengineFlag.java +++ b/src/main/java/com/schematic/api/types/RulesengineFlag.java @@ -142,6 +142,10 @@ public interface KeyStage { public interface _FinalStage { RulesengineFlag build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage rules(List rules); _FinalStage addRules(RulesengineRule rules); @@ -243,5 +247,17 @@ public _FinalStage rules(List rules) { public RulesengineFlag build() { return new RulesengineFlag(accountId, defaultValue, environmentId, id, key, rules, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineRule.java b/src/main/java/com/schematic/api/types/RulesengineRule.java index 1c61ec1..3929cc1 100644 --- a/src/main/java/com/schematic/api/types/RulesengineRule.java +++ b/src/main/java/com/schematic/api/types/RulesengineRule.java @@ -37,7 +37,7 @@ public final class RulesengineRule { private final String name; - private final int priority; + private final long priority; private final RulesengineRuleRuleType ruleType; @@ -53,7 +53,7 @@ private RulesengineRule( Optional flagId, String id, String name, - int priority, + long priority, RulesengineRuleRuleType ruleType, boolean value, Map additionalProperties) { @@ -106,7 +106,7 @@ public String getName() { } @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -187,7 +187,7 @@ public interface NameStage { } public interface PriorityStage { - RuleTypeStage priority(int priority); + RuleTypeStage priority(long priority); } public interface RuleTypeStage { @@ -201,6 +201,10 @@ public interface ValueStage { public interface _FinalStage { RulesengineRule build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditionGroups(List conditionGroups); _FinalStage addConditionGroups(RulesengineConditionGroup conditionGroups); @@ -236,7 +240,7 @@ public static final class Builder private String name; - private int priority; + private long priority; private RulesengineRuleRuleType ruleType; @@ -298,7 +302,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public RuleTypeStage priority(int priority) { + public RuleTypeStage priority(long priority) { this.priority = priority; return this; } @@ -393,5 +397,17 @@ public RulesengineRule build() { value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineSubscription.java b/src/main/java/com/schematic/api/types/RulesengineSubscription.java index 20ee719..18b65ec 100644 --- a/src/main/java/com/schematic/api/types/RulesengineSubscription.java +++ b/src/main/java/com/schematic/api/types/RulesengineSubscription.java @@ -96,6 +96,10 @@ public interface PeriodStartStage { public interface _FinalStage { RulesengineSubscription build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -144,5 +148,17 @@ public _FinalStage periodStart(@NotNull OffsetDateTime periodStart) { public RulesengineSubscription build() { return new RulesengineSubscription(id, periodEnd, periodStart, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineTrait.java b/src/main/java/com/schematic/api/types/RulesengineTrait.java index a4f4a60..b44c04c 100644 --- a/src/main/java/com/schematic/api/types/RulesengineTrait.java +++ b/src/main/java/com/schematic/api/types/RulesengineTrait.java @@ -84,6 +84,10 @@ public interface ValueStage { public interface _FinalStage { RulesengineTrait build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage traitDefinition(Optional traitDefinition); _FinalStage traitDefinition(RulesengineTraitDefinition traitDefinition); @@ -131,5 +135,17 @@ public _FinalStage traitDefinition(Optional traitDef public RulesengineTrait build() { return new RulesengineTrait(traitDefinition, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java b/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java index f0f01f7..a769679 100644 --- a/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java +++ b/src/main/java/com/schematic/api/types/RulesengineTraitDefinition.java @@ -100,6 +100,10 @@ public interface IdStage { public interface _FinalStage { RulesengineTraitDefinition build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -148,5 +152,17 @@ public _FinalStage id(@NotNull String id) { public RulesengineTraitDefinition build() { return new RulesengineTraitDefinition(comparableType, entityType, id, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/RulesengineUser.java b/src/main/java/com/schematic/api/types/RulesengineUser.java index 161e3ef..2a0c8bc 100644 --- a/src/main/java/com/schematic/api/types/RulesengineUser.java +++ b/src/main/java/com/schematic/api/types/RulesengineUser.java @@ -135,6 +135,10 @@ public interface IdStage { public interface _FinalStage { RulesengineUser build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage keys(Map keys); _FinalStage putAllKeys(Map keys); @@ -281,5 +285,17 @@ public _FinalStage keys(Map keys) { public RulesengineUser build() { return new RulesengineUser(accountId, environmentId, id, keys, rules, traits, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/ScheduledCheckoutResponseData.java b/src/main/java/com/schematic/api/types/ScheduledCheckoutResponseData.java new file mode 100644 index 0000000..8a6f805 --- /dev/null +++ b/src/main/java/com/schematic/api/types/ScheduledCheckoutResponseData.java @@ -0,0 +1,504 @@ +/** + * 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 = ScheduledCheckoutResponseData.Builder.class) +public final class ScheduledCheckoutResponseData { + private final String actorType; + + private final String companyId; + + private final Optional completedAt; + + private final OffsetDateTime createdAt; + + private final Optional errorMessage; + + private final OffsetDateTime executeAfter; + + private final String fromPlanId; + + private final String id; + + private final Optional scheduledInterval; + + private final Optional scheduledPrice; + + private final Optional startedAt; + + private final ScheduledCheckoutStatus status; + + private final String toPlanId; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private ScheduledCheckoutResponseData( + String actorType, + String companyId, + Optional completedAt, + OffsetDateTime createdAt, + Optional errorMessage, + OffsetDateTime executeAfter, + String fromPlanId, + String id, + Optional scheduledInterval, + Optional scheduledPrice, + Optional startedAt, + ScheduledCheckoutStatus status, + String toPlanId, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.actorType = actorType; + this.companyId = companyId; + this.completedAt = completedAt; + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.executeAfter = executeAfter; + this.fromPlanId = fromPlanId; + this.id = id; + this.scheduledInterval = scheduledInterval; + this.scheduledPrice = scheduledPrice; + this.startedAt = startedAt; + this.status = status; + this.toPlanId = toPlanId; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("actor_type") + public String getActorType() { + return actorType; + } + + @JsonProperty("company_id") + public String getCompanyId() { + return companyId; + } + + @JsonProperty("completed_at") + public Optional getCompletedAt() { + return completedAt; + } + + @JsonProperty("created_at") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + @JsonProperty("error_message") + public Optional getErrorMessage() { + return errorMessage; + } + + @JsonProperty("execute_after") + public OffsetDateTime getExecuteAfter() { + return executeAfter; + } + + @JsonProperty("from_plan_id") + public String getFromPlanId() { + return fromPlanId; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("scheduled_interval") + public Optional getScheduledInterval() { + return scheduledInterval; + } + + @JsonProperty("scheduled_price") + public Optional getScheduledPrice() { + return scheduledPrice; + } + + @JsonProperty("started_at") + public Optional getStartedAt() { + return startedAt; + } + + @JsonProperty("status") + public ScheduledCheckoutStatus getStatus() { + return status; + } + + @JsonProperty("to_plan_id") + public String getToPlanId() { + return toPlanId; + } + + @JsonProperty("updated_at") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ScheduledCheckoutResponseData && equalTo((ScheduledCheckoutResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ScheduledCheckoutResponseData other) { + return actorType.equals(other.actorType) + && companyId.equals(other.companyId) + && completedAt.equals(other.completedAt) + && createdAt.equals(other.createdAt) + && errorMessage.equals(other.errorMessage) + && executeAfter.equals(other.executeAfter) + && fromPlanId.equals(other.fromPlanId) + && id.equals(other.id) + && scheduledInterval.equals(other.scheduledInterval) + && scheduledPrice.equals(other.scheduledPrice) + && startedAt.equals(other.startedAt) + && status.equals(other.status) + && toPlanId.equals(other.toPlanId) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.actorType, + this.companyId, + this.completedAt, + this.createdAt, + this.errorMessage, + this.executeAfter, + this.fromPlanId, + this.id, + this.scheduledInterval, + this.scheduledPrice, + this.startedAt, + this.status, + this.toPlanId, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ActorTypeStage builder() { + return new Builder(); + } + + public interface ActorTypeStage { + CompanyIdStage actorType(@NotNull String actorType); + + Builder from(ScheduledCheckoutResponseData other); + } + + public interface CompanyIdStage { + CreatedAtStage companyId(@NotNull String companyId); + } + + public interface CreatedAtStage { + ExecuteAfterStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface ExecuteAfterStage { + FromPlanIdStage executeAfter(@NotNull OffsetDateTime executeAfter); + } + + public interface FromPlanIdStage { + IdStage fromPlanId(@NotNull String fromPlanId); + } + + public interface IdStage { + StatusStage id(@NotNull String id); + } + + public interface StatusStage { + ToPlanIdStage status(@NotNull ScheduledCheckoutStatus status); + } + + public interface ToPlanIdStage { + UpdatedAtStage toPlanId(@NotNull String toPlanId); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ScheduledCheckoutResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage completedAt(Optional completedAt); + + _FinalStage completedAt(OffsetDateTime completedAt); + + _FinalStage errorMessage(Optional errorMessage); + + _FinalStage errorMessage(String errorMessage); + + _FinalStage scheduledInterval(Optional scheduledInterval); + + _FinalStage scheduledInterval(String scheduledInterval); + + _FinalStage scheduledPrice(Optional scheduledPrice); + + _FinalStage scheduledPrice(Long scheduledPrice); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ActorTypeStage, + CompanyIdStage, + CreatedAtStage, + ExecuteAfterStage, + FromPlanIdStage, + IdStage, + StatusStage, + ToPlanIdStage, + UpdatedAtStage, + _FinalStage { + private String actorType; + + private String companyId; + + private OffsetDateTime createdAt; + + private OffsetDateTime executeAfter; + + private String fromPlanId; + + private String id; + + private ScheduledCheckoutStatus status; + + private String toPlanId; + + private OffsetDateTime updatedAt; + + private Optional startedAt = Optional.empty(); + + private Optional scheduledPrice = Optional.empty(); + + private Optional scheduledInterval = Optional.empty(); + + private Optional errorMessage = Optional.empty(); + + private Optional completedAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ScheduledCheckoutResponseData other) { + actorType(other.getActorType()); + companyId(other.getCompanyId()); + completedAt(other.getCompletedAt()); + createdAt(other.getCreatedAt()); + errorMessage(other.getErrorMessage()); + executeAfter(other.getExecuteAfter()); + fromPlanId(other.getFromPlanId()); + id(other.getId()); + scheduledInterval(other.getScheduledInterval()); + scheduledPrice(other.getScheduledPrice()); + startedAt(other.getStartedAt()); + status(other.getStatus()); + toPlanId(other.getToPlanId()); + updatedAt(other.getUpdatedAt()); + return this; + } + + @java.lang.Override + @JsonSetter("actor_type") + public CompanyIdStage actorType(@NotNull String actorType) { + this.actorType = Objects.requireNonNull(actorType, "actorType 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 ExecuteAfterStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("execute_after") + public FromPlanIdStage executeAfter(@NotNull OffsetDateTime executeAfter) { + this.executeAfter = Objects.requireNonNull(executeAfter, "executeAfter must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("from_plan_id") + public IdStage fromPlanId(@NotNull String fromPlanId) { + this.fromPlanId = Objects.requireNonNull(fromPlanId, "fromPlanId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("id") + public StatusStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("status") + public ToPlanIdStage status(@NotNull ScheduledCheckoutStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_id") + public UpdatedAtStage toPlanId(@NotNull String toPlanId) { + this.toPlanId = Objects.requireNonNull(toPlanId, "toPlanId 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 startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "started_at", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + @java.lang.Override + public _FinalStage scheduledPrice(Long scheduledPrice) { + this.scheduledPrice = Optional.ofNullable(scheduledPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_price", nulls = Nulls.SKIP) + public _FinalStage scheduledPrice(Optional scheduledPrice) { + this.scheduledPrice = scheduledPrice; + return this; + } + + @java.lang.Override + public _FinalStage scheduledInterval(String scheduledInterval) { + this.scheduledInterval = Optional.ofNullable(scheduledInterval); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_interval", nulls = Nulls.SKIP) + public _FinalStage scheduledInterval(Optional scheduledInterval) { + this.scheduledInterval = scheduledInterval; + return this; + } + + @java.lang.Override + public _FinalStage errorMessage(String errorMessage) { + this.errorMessage = Optional.ofNullable(errorMessage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "error_message", nulls = Nulls.SKIP) + public _FinalStage errorMessage(Optional errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + @java.lang.Override + public _FinalStage completedAt(OffsetDateTime completedAt) { + this.completedAt = Optional.ofNullable(completedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "completed_at", nulls = Nulls.SKIP) + public _FinalStage completedAt(Optional completedAt) { + this.completedAt = completedAt; + return this; + } + + @java.lang.Override + public ScheduledCheckoutResponseData build() { + return new ScheduledCheckoutResponseData( + actorType, + companyId, + completedAt, + createdAt, + errorMessage, + executeAfter, + fromPlanId, + id, + scheduledInterval, + scheduledPrice, + startedAt, + status, + toPlanId, + updatedAt, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/ScheduledCheckoutStatus.java b/src/main/java/com/schematic/api/types/ScheduledCheckoutStatus.java new file mode 100644 index 0000000..2effe6e --- /dev/null +++ b/src/main/java/com/schematic/api/types/ScheduledCheckoutStatus.java @@ -0,0 +1,114 @@ +/** + * 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 ScheduledCheckoutStatus { + public static final ScheduledCheckoutStatus SUCCESS = new ScheduledCheckoutStatus(Value.SUCCESS, "success"); + + public static final ScheduledCheckoutStatus PENDING = new ScheduledCheckoutStatus(Value.PENDING, "pending"); + + public static final ScheduledCheckoutStatus CANCELLED = new ScheduledCheckoutStatus(Value.CANCELLED, "cancelled"); + + public static final ScheduledCheckoutStatus ERROR = new ScheduledCheckoutStatus(Value.ERROR, "error"); + + public static final ScheduledCheckoutStatus EXECUTING = new ScheduledCheckoutStatus(Value.EXECUTING, "executing"); + + private final Value value; + + private final String string; + + ScheduledCheckoutStatus(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 ScheduledCheckoutStatus + && this.string.equals(((ScheduledCheckoutStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUCCESS: + return visitor.visitSuccess(); + case PENDING: + return visitor.visitPending(); + case CANCELLED: + return visitor.visitCancelled(); + case ERROR: + return visitor.visitError(); + case EXECUTING: + return visitor.visitExecuting(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ScheduledCheckoutStatus valueOf(String value) { + switch (value) { + case "success": + return SUCCESS; + case "pending": + return PENDING; + case "cancelled": + return CANCELLED; + case "error": + return ERROR; + case "executing": + return EXECUTING; + default: + return new ScheduledCheckoutStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + CANCELLED, + + ERROR, + + EXECUTING, + + PENDING, + + SUCCESS, + + UNKNOWN + } + + public interface Visitor { + T visitCancelled(); + + T visitError(); + + T visitExecuting(); + + T visitPending(); + + T visitSuccess(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/schematic/api/types/ScheduledDowngradeResponseData.java b/src/main/java/com/schematic/api/types/ScheduledDowngradeResponseData.java new file mode 100644 index 0000000..adda92f --- /dev/null +++ b/src/main/java/com/schematic/api/types/ScheduledDowngradeResponseData.java @@ -0,0 +1,408 @@ +/** + * 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 = ScheduledDowngradeResponseData.Builder.class) +public final class ScheduledDowngradeResponseData { + private final String currency; + + private final OffsetDateTime effectiveAfter; + + private final String fromPlanId; + + private final String fromPlanName; + + private final long fromSubscriptionPrice; + + private final String id; + + private final String interval; + + private final Optional scheduledInterval; + + private final Optional scheduledPrice; + + private final String toPlanId; + + private final String toPlanName; + + private final Map additionalProperties; + + private ScheduledDowngradeResponseData( + String currency, + OffsetDateTime effectiveAfter, + String fromPlanId, + String fromPlanName, + long fromSubscriptionPrice, + String id, + String interval, + Optional scheduledInterval, + Optional scheduledPrice, + String toPlanId, + String toPlanName, + Map additionalProperties) { + this.currency = currency; + this.effectiveAfter = effectiveAfter; + this.fromPlanId = fromPlanId; + this.fromPlanName = fromPlanName; + this.fromSubscriptionPrice = fromSubscriptionPrice; + this.id = id; + this.interval = interval; + this.scheduledInterval = scheduledInterval; + this.scheduledPrice = scheduledPrice; + this.toPlanId = toPlanId; + this.toPlanName = toPlanName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("currency") + public String getCurrency() { + return currency; + } + + @JsonProperty("effective_after") + public OffsetDateTime getEffectiveAfter() { + return effectiveAfter; + } + + @JsonProperty("from_plan_id") + public String getFromPlanId() { + return fromPlanId; + } + + @JsonProperty("from_plan_name") + public String getFromPlanName() { + return fromPlanName; + } + + @JsonProperty("from_subscription_price") + public long getFromSubscriptionPrice() { + return fromSubscriptionPrice; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("interval") + public String getInterval() { + return interval; + } + + @JsonProperty("scheduled_interval") + public Optional getScheduledInterval() { + return scheduledInterval; + } + + @JsonProperty("scheduled_price") + public Optional getScheduledPrice() { + return scheduledPrice; + } + + @JsonProperty("to_plan_id") + public String getToPlanId() { + return toPlanId; + } + + @JsonProperty("to_plan_name") + public String getToPlanName() { + return toPlanName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ScheduledDowngradeResponseData && equalTo((ScheduledDowngradeResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ScheduledDowngradeResponseData other) { + return currency.equals(other.currency) + && effectiveAfter.equals(other.effectiveAfter) + && fromPlanId.equals(other.fromPlanId) + && fromPlanName.equals(other.fromPlanName) + && fromSubscriptionPrice == other.fromSubscriptionPrice + && id.equals(other.id) + && interval.equals(other.interval) + && scheduledInterval.equals(other.scheduledInterval) + && scheduledPrice.equals(other.scheduledPrice) + && toPlanId.equals(other.toPlanId) + && toPlanName.equals(other.toPlanName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.currency, + this.effectiveAfter, + this.fromPlanId, + this.fromPlanName, + this.fromSubscriptionPrice, + this.id, + this.interval, + this.scheduledInterval, + this.scheduledPrice, + this.toPlanId, + this.toPlanName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CurrencyStage builder() { + return new Builder(); + } + + public interface CurrencyStage { + EffectiveAfterStage currency(@NotNull String currency); + + Builder from(ScheduledDowngradeResponseData other); + } + + public interface EffectiveAfterStage { + FromPlanIdStage effectiveAfter(@NotNull OffsetDateTime effectiveAfter); + } + + public interface FromPlanIdStage { + FromPlanNameStage fromPlanId(@NotNull String fromPlanId); + } + + public interface FromPlanNameStage { + FromSubscriptionPriceStage fromPlanName(@NotNull String fromPlanName); + } + + public interface FromSubscriptionPriceStage { + IdStage fromSubscriptionPrice(long fromSubscriptionPrice); + } + + public interface IdStage { + IntervalStage id(@NotNull String id); + } + + public interface IntervalStage { + ToPlanIdStage interval(@NotNull String interval); + } + + public interface ToPlanIdStage { + ToPlanNameStage toPlanId(@NotNull String toPlanId); + } + + public interface ToPlanNameStage { + _FinalStage toPlanName(@NotNull String toPlanName); + } + + public interface _FinalStage { + ScheduledDowngradeResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage scheduledInterval(Optional scheduledInterval); + + _FinalStage scheduledInterval(String scheduledInterval); + + _FinalStage scheduledPrice(Optional scheduledPrice); + + _FinalStage scheduledPrice(Long scheduledPrice); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements CurrencyStage, + EffectiveAfterStage, + FromPlanIdStage, + FromPlanNameStage, + FromSubscriptionPriceStage, + IdStage, + IntervalStage, + ToPlanIdStage, + ToPlanNameStage, + _FinalStage { + private String currency; + + private OffsetDateTime effectiveAfter; + + private String fromPlanId; + + private String fromPlanName; + + private long fromSubscriptionPrice; + + private String id; + + private String interval; + + private String toPlanId; + + private String toPlanName; + + private Optional scheduledPrice = Optional.empty(); + + private Optional scheduledInterval = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ScheduledDowngradeResponseData other) { + currency(other.getCurrency()); + effectiveAfter(other.getEffectiveAfter()); + fromPlanId(other.getFromPlanId()); + fromPlanName(other.getFromPlanName()); + fromSubscriptionPrice(other.getFromSubscriptionPrice()); + id(other.getId()); + interval(other.getInterval()); + scheduledInterval(other.getScheduledInterval()); + scheduledPrice(other.getScheduledPrice()); + toPlanId(other.getToPlanId()); + toPlanName(other.getToPlanName()); + return this; + } + + @java.lang.Override + @JsonSetter("currency") + public EffectiveAfterStage currency(@NotNull String currency) { + this.currency = Objects.requireNonNull(currency, "currency must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("effective_after") + public FromPlanIdStage effectiveAfter(@NotNull OffsetDateTime effectiveAfter) { + this.effectiveAfter = Objects.requireNonNull(effectiveAfter, "effectiveAfter must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("from_plan_id") + public FromPlanNameStage fromPlanId(@NotNull String fromPlanId) { + this.fromPlanId = Objects.requireNonNull(fromPlanId, "fromPlanId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("from_plan_name") + public FromSubscriptionPriceStage fromPlanName(@NotNull String fromPlanName) { + this.fromPlanName = Objects.requireNonNull(fromPlanName, "fromPlanName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("from_subscription_price") + public IdStage fromSubscriptionPrice(long fromSubscriptionPrice) { + this.fromSubscriptionPrice = fromSubscriptionPrice; + return this; + } + + @java.lang.Override + @JsonSetter("id") + public IntervalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("interval") + public ToPlanIdStage interval(@NotNull String interval) { + this.interval = Objects.requireNonNull(interval, "interval must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_id") + public ToPlanNameStage toPlanId(@NotNull String toPlanId) { + this.toPlanId = Objects.requireNonNull(toPlanId, "toPlanId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("to_plan_name") + public _FinalStage toPlanName(@NotNull String toPlanName) { + this.toPlanName = Objects.requireNonNull(toPlanName, "toPlanName must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage scheduledPrice(Long scheduledPrice) { + this.scheduledPrice = Optional.ofNullable(scheduledPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_price", nulls = Nulls.SKIP) + public _FinalStage scheduledPrice(Optional scheduledPrice) { + this.scheduledPrice = scheduledPrice; + return this; + } + + @java.lang.Override + public _FinalStage scheduledInterval(String scheduledInterval) { + this.scheduledInterval = Optional.ofNullable(scheduledInterval); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_interval", nulls = Nulls.SKIP) + public _FinalStage scheduledInterval(Optional scheduledInterval) { + this.scheduledInterval = scheduledInterval; + return this; + } + + @java.lang.Override + public ScheduledDowngradeResponseData build() { + return new ScheduledDowngradeResponseData( + currency, + effectiveAfter, + fromPlanId, + fromPlanName, + fromSubscriptionPrice, + id, + interval, + scheduledInterval, + scheduledPrice, + toPlanId, + toPlanName, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/SegmentStatusResp.java b/src/main/java/com/schematic/api/types/SegmentStatusResp.java index 95c5c22..5b40145 100644 --- a/src/main/java/com/schematic/api/types/SegmentStatusResp.java +++ b/src/main/java/com/schematic/api/types/SegmentStatusResp.java @@ -100,6 +100,10 @@ public interface EnvironmentIdStage { public interface _FinalStage { SegmentStatusResp build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage lastEventAt(Optional lastEventAt); _FinalStage lastEventAt(OffsetDateTime lastEventAt); @@ -157,5 +161,17 @@ public _FinalStage lastEventAt(Optional lastEventAt) { public SegmentStatusResp build() { return new SegmentStatusResp(connected, environmentId, lastEventAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.java b/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.java index 3799cd7..80134fd 100644 --- a/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.java +++ b/src/main/java/com/schematic/api/types/SkippedEntitlementErrorResponseData.java @@ -71,6 +71,10 @@ public interface MessageStage { public interface _FinalStage { SkippedEntitlementErrorResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -99,5 +103,17 @@ public _FinalStage message(@NotNull String message) { public SkippedEntitlementErrorResponseData build() { return new SkippedEntitlementErrorResponseData(message, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java index 63491cd..21a0461 100644 --- a/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/SkippedEntitlementResponseData.java @@ -114,6 +114,10 @@ public interface FeatureNameStage { public interface _FinalStage { SkippedEntitlementResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage errors(List errors); _FinalStage addErrors(SkippedEntitlementErrorResponseData errors); @@ -195,5 +199,17 @@ public SkippedEntitlementResponseData build() { return new SkippedEntitlementResponseData( entitlementId, errors, featureId, featureName, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/StripeEmbedInfo.java b/src/main/java/com/schematic/api/types/StripeEmbedInfo.java index 6b6694d..fbc8915 100644 --- a/src/main/java/com/schematic/api/types/StripeEmbedInfo.java +++ b/src/main/java/com/schematic/api/types/StripeEmbedInfo.java @@ -106,6 +106,10 @@ public interface SchematicPublishableKeyStage { public interface _FinalStage { StripeEmbedInfo build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage accountId(Optional accountId); _FinalStage accountId(String accountId); @@ -195,5 +199,17 @@ public StripeEmbedInfo build() { return new StripeEmbedInfo( accountId, publishableKey, schematicPublishableKey, setupIntentClientSecret, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java b/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java index 1a21731..c6972e8 100644 --- a/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java +++ b/src/main/java/com/schematic/api/types/SubscriptionTraitUpdate.java @@ -157,6 +157,10 @@ public interface ValueStage { public interface _FinalStage { SubscriptionTraitUpdate build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage hierarchy(List hierarchy); _FinalStage addHierarchy(String hierarchy); @@ -275,5 +279,17 @@ public SubscriptionTraitUpdate build() { return new SubscriptionTraitUpdate( featureId, hierarchy, reason, traitId, traitName, traitType, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/TemporaryAccessTokenResponseData.java b/src/main/java/com/schematic/api/types/TemporaryAccessTokenResponseData.java index e919f93..c1cd125 100644 --- a/src/main/java/com/schematic/api/types/TemporaryAccessTokenResponseData.java +++ b/src/main/java/com/schematic/api/types/TemporaryAccessTokenResponseData.java @@ -164,6 +164,10 @@ public interface UpdatedAtStage { public interface _FinalStage { TemporaryAccessTokenResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -261,5 +265,17 @@ public TemporaryAccessTokenResponseData build() { return new TemporaryAccessTokenResponseData( apiKeyId, createdAt, environmentId, expiredAt, id, resourceType, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/TraitDefinition.java b/src/main/java/com/schematic/api/types/TraitDefinition.java index 90e1a47..2766568 100644 --- a/src/main/java/com/schematic/api/types/TraitDefinition.java +++ b/src/main/java/com/schematic/api/types/TraitDefinition.java @@ -100,6 +100,10 @@ public interface IdStage { public interface _FinalStage { TraitDefinition build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -148,5 +152,17 @@ public _FinalStage id(@NotNull String id) { public TraitDefinition build() { return new TraitDefinition(comparableType, entityType, id, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdateAddOnRequestBody.java b/src/main/java/com/schematic/api/types/UpdateAddOnRequestBody.java index 2ebb74a..3ea0634 100644 --- a/src/main/java/com/schematic/api/types/UpdateAddOnRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateAddOnRequestBody.java @@ -82,6 +82,10 @@ public interface PriceIdStage { public interface _FinalStage { UpdateAddOnRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -120,5 +124,17 @@ public _FinalStage priceId(@NotNull String priceId) { public UpdateAddOnRequestBody build() { return new UpdateAddOnRequestBody(addOnId, priceId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java index 094d9f3..ba4b32f 100644 --- a/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateBillingPlanCreditGrantRequestBody.java @@ -23,7 +23,7 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional applyToExisting; - private final Optional autoTopupAmount; + private final Optional autoTopupAmount; private final Optional autoTopupAmountType; @@ -33,17 +33,17 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private final Optional autoTopupExpiryUnit; - private final Optional autoTopupExpiryUnitCount; + private final Optional autoTopupExpiryUnitCount; - private final Optional autoTopupThresholdPercent; + private final Optional autoTopupThresholdPercent; - private final Optional creditAmount; + private final Optional creditAmount; private final Optional expiryType; private final Optional expiryUnit; - private final Optional expiryUnitCount; + private final Optional expiryUnitCount; private final BillingPlanCreditGrantResetCadence resetCadence; @@ -55,17 +55,17 @@ public final class UpdateBillingPlanCreditGrantRequestBody { private UpdateBillingPlanCreditGrantRequestBody( Optional applyToExisting, - Optional autoTopupAmount, + Optional autoTopupAmount, Optional autoTopupAmountType, Optional autoTopupEnabled, Optional autoTopupExpiryType, Optional autoTopupExpiryUnit, - Optional autoTopupExpiryUnitCount, - Optional autoTopupThresholdPercent, - Optional creditAmount, + Optional autoTopupExpiryUnitCount, + Optional autoTopupThresholdPercent, + Optional creditAmount, Optional expiryType, Optional expiryUnit, - Optional expiryUnitCount, + Optional expiryUnitCount, BillingPlanCreditGrantResetCadence resetCadence, BillingPlanCreditGrantResetStart resetStart, Optional resetType, @@ -94,7 +94,7 @@ public Optional getApplyToExisting() { } @JsonProperty("auto_topup_amount") - public Optional getAutoTopupAmount() { + public Optional getAutoTopupAmount() { return autoTopupAmount; } @@ -119,17 +119,17 @@ public Optional getAutoTopupExpiryUnit() { } @JsonProperty("auto_topup_expiry_unit_count") - public Optional getAutoTopupExpiryUnitCount() { + public Optional getAutoTopupExpiryUnitCount() { return autoTopupExpiryUnitCount; } @JsonProperty("auto_topup_threshold_percent") - public Optional getAutoTopupThresholdPercent() { + public Optional getAutoTopupThresholdPercent() { return autoTopupThresholdPercent; } @JsonProperty("credit_amount") - public Optional getCreditAmount() { + public Optional getCreditAmount() { return creditAmount; } @@ -144,7 +144,7 @@ public Optional getExpiryUnit() { } @JsonProperty("expiry_unit_count") - public Optional getExpiryUnitCount() { + public Optional getExpiryUnitCount() { return expiryUnitCount; } @@ -235,13 +235,17 @@ public interface ResetStartStage { public interface _FinalStage { UpdateBillingPlanCreditGrantRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage applyToExisting(Optional applyToExisting); _FinalStage applyToExisting(Boolean applyToExisting); - _FinalStage autoTopupAmount(Optional autoTopupAmount); + _FinalStage autoTopupAmount(Optional autoTopupAmount); - _FinalStage autoTopupAmount(Integer autoTopupAmount); + _FinalStage autoTopupAmount(Long autoTopupAmount); _FinalStage autoTopupAmountType(Optional autoTopupAmountType); @@ -259,17 +263,17 @@ public interface _FinalStage { _FinalStage autoTopupExpiryUnit(BillingCreditExpiryUnit autoTopupExpiryUnit); - _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); + _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount); - _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount); + _FinalStage autoTopupExpiryUnitCount(Long autoTopupExpiryUnitCount); - _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); + _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent); - _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent); + _FinalStage autoTopupThresholdPercent(Long autoTopupThresholdPercent); - _FinalStage creditAmount(Optional creditAmount); + _FinalStage creditAmount(Optional creditAmount); - _FinalStage creditAmount(Integer creditAmount); + _FinalStage creditAmount(Long creditAmount); _FinalStage expiryType(Optional expiryType); @@ -279,9 +283,9 @@ public interface _FinalStage { _FinalStage expiryUnit(BillingCreditExpiryUnit expiryUnit); - _FinalStage expiryUnitCount(Optional expiryUnitCount); + _FinalStage expiryUnitCount(Optional expiryUnitCount); - _FinalStage expiryUnitCount(Integer expiryUnitCount); + _FinalStage expiryUnitCount(Long expiryUnitCount); _FinalStage resetType(Optional resetType); @@ -296,17 +300,17 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private Optional resetType = Optional.empty(); - private Optional expiryUnitCount = Optional.empty(); + private Optional expiryUnitCount = Optional.empty(); private Optional expiryUnit = Optional.empty(); private Optional expiryType = Optional.empty(); - private Optional creditAmount = Optional.empty(); + private Optional creditAmount = Optional.empty(); - private Optional autoTopupThresholdPercent = Optional.empty(); + private Optional autoTopupThresholdPercent = Optional.empty(); - private Optional autoTopupExpiryUnitCount = Optional.empty(); + private Optional autoTopupExpiryUnitCount = Optional.empty(); private Optional autoTopupExpiryUnit = Optional.empty(); @@ -316,7 +320,7 @@ public static final class Builder implements ResetCadenceStage, ResetStartStage, private Optional autoTopupAmountType = Optional.empty(); - private Optional autoTopupAmount = Optional.empty(); + private Optional autoTopupAmount = Optional.empty(); private Optional applyToExisting = Optional.empty(); @@ -373,14 +377,14 @@ public _FinalStage resetType(Optional resetType } @java.lang.Override - public _FinalStage expiryUnitCount(Integer expiryUnitCount) { + public _FinalStage expiryUnitCount(Long expiryUnitCount) { this.expiryUnitCount = Optional.ofNullable(expiryUnitCount); return this; } @java.lang.Override @JsonSetter(value = "expiry_unit_count", nulls = Nulls.SKIP) - public _FinalStage expiryUnitCount(Optional expiryUnitCount) { + public _FinalStage expiryUnitCount(Optional expiryUnitCount) { this.expiryUnitCount = expiryUnitCount; return this; } @@ -412,40 +416,40 @@ public _FinalStage expiryType(Optional expiryType) { } @java.lang.Override - public _FinalStage creditAmount(Integer creditAmount) { + public _FinalStage creditAmount(Long creditAmount) { this.creditAmount = Optional.ofNullable(creditAmount); return this; } @java.lang.Override @JsonSetter(value = "credit_amount", nulls = Nulls.SKIP) - public _FinalStage creditAmount(Optional creditAmount) { + public _FinalStage creditAmount(Optional creditAmount) { this.creditAmount = creditAmount; return this; } @java.lang.Override - public _FinalStage autoTopupThresholdPercent(Integer autoTopupThresholdPercent) { + public _FinalStage autoTopupThresholdPercent(Long 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) { + public _FinalStage autoTopupThresholdPercent(Optional autoTopupThresholdPercent) { this.autoTopupThresholdPercent = autoTopupThresholdPercent; return this; } @java.lang.Override - public _FinalStage autoTopupExpiryUnitCount(Integer autoTopupExpiryUnitCount) { + public _FinalStage autoTopupExpiryUnitCount(Long 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) { + public _FinalStage autoTopupExpiryUnitCount(Optional autoTopupExpiryUnitCount) { this.autoTopupExpiryUnitCount = autoTopupExpiryUnitCount; return this; } @@ -503,14 +507,14 @@ public _FinalStage autoTopupAmountType(Optional autoTopupAmountType) { } @java.lang.Override - public _FinalStage autoTopupAmount(Integer autoTopupAmount) { + public _FinalStage autoTopupAmount(Long autoTopupAmount) { this.autoTopupAmount = Optional.ofNullable(autoTopupAmount); return this; } @java.lang.Override @JsonSetter(value = "auto_topup_amount", nulls = Nulls.SKIP) - public _FinalStage autoTopupAmount(Optional autoTopupAmount) { + public _FinalStage autoTopupAmount(Optional autoTopupAmount) { this.autoTopupAmount = autoTopupAmount; return this; } @@ -548,5 +552,17 @@ public UpdateBillingPlanCreditGrantRequestBody build() { resetType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdateCreditBundleRequestBody.java b/src/main/java/com/schematic/api/types/UpdateCreditBundleRequestBody.java index b5a9a5a..499fc0f 100644 --- a/src/main/java/com/schematic/api/types/UpdateCreditBundleRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateCreditBundleRequestBody.java @@ -21,11 +21,11 @@ public final class UpdateCreditBundleRequestBody { private final String bundleId; - private final int quantity; + private final long quantity; private final Map additionalProperties; - private UpdateCreditBundleRequestBody(String bundleId, int quantity, Map additionalProperties) { + private UpdateCreditBundleRequestBody(String bundleId, long quantity, Map additionalProperties) { this.bundleId = bundleId; this.quantity = quantity; this.additionalProperties = additionalProperties; @@ -37,7 +37,7 @@ public String getBundleId() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -77,18 +77,22 @@ public interface BundleIdStage { } public interface QuantityStage { - _FinalStage quantity(int quantity); + _FinalStage quantity(long quantity); } public interface _FinalStage { UpdateCreditBundleRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements BundleIdStage, QuantityStage, _FinalStage { private String bundleId; - private int quantity; + private long quantity; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -111,7 +115,7 @@ public QuantityStage bundleId(@NotNull String bundleId) { @java.lang.Override @JsonSetter("quantity") - public _FinalStage quantity(int quantity) { + public _FinalStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -120,5 +124,17 @@ public _FinalStage quantity(int quantity) { public UpdateCreditBundleRequestBody build() { return new UpdateCreditBundleRequestBody(bundleId, quantity, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java b/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java index 59b1bb5..8ce9081 100644 --- a/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java +++ b/src/main/java/com/schematic/api/types/UpdateEntitlementReqCommon.java @@ -31,7 +31,7 @@ public final class UpdateEntitlementReqCommon { private final Optional valueCreditId; - private final Optional valueNumeric; + private final Optional valueNumeric; private final Optional valueTraitId; @@ -45,7 +45,7 @@ private UpdateEntitlementReqCommon( Optional metricPeriodMonthReset, Optional valueBool, Optional valueCreditId, - Optional valueNumeric, + Optional valueNumeric, Optional valueTraitId, EntitlementValueType valueType, Map additionalProperties) { @@ -86,7 +86,7 @@ public Optional getValueCreditId() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -153,6 +153,10 @@ public interface ValueTypeStage { public interface _FinalStage { UpdateEntitlementReqCommon build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditConsumptionRate(Optional creditConsumptionRate); _FinalStage creditConsumptionRate(Double creditConsumptionRate); @@ -174,9 +178,9 @@ _FinalStage metricPeriodMonthReset( _FinalStage valueCreditId(String valueCreditId); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage valueTraitId(Optional valueTraitId); @@ -189,7 +193,7 @@ public static final class Builder implements ValueTypeStage, _FinalStage { private Optional valueTraitId = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueCreditId = Optional.empty(); @@ -240,14 +244,14 @@ public _FinalStage valueTraitId(Optional valueTraitId) { } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -332,5 +336,17 @@ public UpdateEntitlementReqCommon build() { valueType, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdatePayInAdvanceRequestBody.java b/src/main/java/com/schematic/api/types/UpdatePayInAdvanceRequestBody.java index 415f97c..0989582 100644 --- a/src/main/java/com/schematic/api/types/UpdatePayInAdvanceRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdatePayInAdvanceRequestBody.java @@ -21,11 +21,11 @@ public final class UpdatePayInAdvanceRequestBody { private final String priceId; - private final int quantity; + private final long quantity; private final Map additionalProperties; - private UpdatePayInAdvanceRequestBody(String priceId, int quantity, Map additionalProperties) { + private UpdatePayInAdvanceRequestBody(String priceId, long quantity, Map additionalProperties) { this.priceId = priceId; this.quantity = quantity; this.additionalProperties = additionalProperties; @@ -37,7 +37,7 @@ public String getPriceId() { } @JsonProperty("quantity") - public int getQuantity() { + public long getQuantity() { return quantity; } @@ -77,18 +77,22 @@ public interface PriceIdStage { } public interface QuantityStage { - _FinalStage quantity(int quantity); + _FinalStage quantity(long quantity); } public interface _FinalStage { UpdatePayInAdvanceRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements PriceIdStage, QuantityStage, _FinalStage { private String priceId; - private int quantity; + private long quantity; @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -111,7 +115,7 @@ public QuantityStage priceId(@NotNull String priceId) { @java.lang.Override @JsonSetter("quantity") - public _FinalStage quantity(int quantity) { + public _FinalStage quantity(long quantity) { this.quantity = quantity; return this; } @@ -120,5 +124,17 @@ public _FinalStage quantity(int quantity) { public UpdatePayInAdvanceRequestBody build() { return new UpdatePayInAdvanceRequestBody(priceId, quantity, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java b/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java index 9351a37..1a63a28 100644 --- a/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdatePlanRequestBody.java @@ -93,6 +93,10 @@ public interface NameStage { public interface _FinalStage { UpdatePlanRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage description(Optional description); _FinalStage description(String description); @@ -160,5 +164,17 @@ public _FinalStage description(Optional description) { public UpdatePlanRequestBody build() { return new UpdatePlanRequestBody(description, icon, name, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdatePlanTraitTraitRequestBody.java b/src/main/java/com/schematic/api/types/UpdatePlanTraitTraitRequestBody.java index 0e43063..07b200f 100644 --- a/src/main/java/com/schematic/api/types/UpdatePlanTraitTraitRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdatePlanTraitTraitRequestBody.java @@ -83,6 +83,10 @@ public interface TraitValueStage { public interface _FinalStage { UpdatePlanTraitTraitRequestBody build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -121,5 +125,17 @@ public _FinalStage traitValue(@NotNull String traitValue) { public UpdatePlanTraitTraitRequestBody build() { return new UpdatePlanTraitTraitRequestBody(traitId, traitValue, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpdateRuleRequestBody.java b/src/main/java/com/schematic/api/types/UpdateRuleRequestBody.java index 36dd80f..c8c0682 100644 --- a/src/main/java/com/schematic/api/types/UpdateRuleRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpdateRuleRequestBody.java @@ -28,7 +28,7 @@ public final class UpdateRuleRequestBody { private final String name; - private final int priority; + private final long priority; private final boolean value; @@ -38,7 +38,7 @@ private UpdateRuleRequestBody( List conditionGroups, List conditions, String name, - int priority, + long priority, boolean value, Map additionalProperties) { this.conditionGroups = conditionGroups; @@ -65,7 +65,7 @@ public String getName() { } @JsonProperty("priority") - public int getPriority() { + public long getPriority() { return priority; } @@ -114,7 +114,7 @@ public interface NameStage { } public interface PriorityStage { - ValueStage priority(int priority); + ValueStage priority(long priority); } public interface ValueStage { @@ -124,6 +124,10 @@ public interface ValueStage { public interface _FinalStage { UpdateRuleRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage conditionGroups(List conditionGroups); _FinalStage addConditionGroups(CreateOrUpdateConditionGroupRequestBody conditionGroups); @@ -141,7 +145,7 @@ public interface _FinalStage { public static final class Builder implements NameStage, PriorityStage, ValueStage, _FinalStage { private String name; - private int priority; + private long priority; private boolean value; @@ -173,7 +177,7 @@ public PriorityStage name(@NotNull String name) { @java.lang.Override @JsonSetter("priority") - public ValueStage priority(int priority) { + public ValueStage priority(long priority) { this.priority = priority; return this; } @@ -237,5 +241,17 @@ public _FinalStage conditionGroups(List public UpdateRuleRequestBody build() { return new UpdateRuleRequestBody(conditionGroups, conditions, name, priority, value, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java b/src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java index 13da017..6578980 100644 --- a/src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertBillingProductRequestBody.java @@ -13,6 +13,7 @@ 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; @@ -27,19 +28,21 @@ public final class UpsertBillingProductRequestBody { private final Optional currency; + private final Optional> currencyPrices; + private final boolean isTrialable; - private final Optional monthlyPrice; + private final Optional monthlyPrice; private final Optional monthlyPriceId; - private final Optional oneTimePrice; + private final Optional oneTimePrice; private final Optional oneTimePriceId; - private final Optional trialDays; + private final Optional trialDays; - private final Optional yearlyPrice; + private final Optional yearlyPrice; private final Optional yearlyPriceId; @@ -49,18 +52,20 @@ private UpsertBillingProductRequestBody( Optional billingProductId, ChargeType chargeType, Optional currency, + Optional> currencyPrices, boolean isTrialable, - Optional monthlyPrice, + Optional monthlyPrice, Optional monthlyPriceId, - Optional oneTimePrice, + Optional oneTimePrice, Optional oneTimePriceId, - Optional trialDays, - Optional yearlyPrice, + Optional trialDays, + Optional yearlyPrice, Optional yearlyPriceId, Map additionalProperties) { this.billingProductId = billingProductId; this.chargeType = chargeType; this.currency = currency; + this.currencyPrices = currencyPrices; this.isTrialable = isTrialable; this.monthlyPrice = monthlyPrice; this.monthlyPriceId = monthlyPriceId; @@ -87,13 +92,18 @@ public Optional getCurrency() { return currency; } + @JsonProperty("currency_prices") + public Optional> getCurrencyPrices() { + return currencyPrices; + } + @JsonProperty("is_trialable") public boolean getIsTrialable() { return isTrialable; } @JsonProperty("monthly_price") - public Optional getMonthlyPrice() { + public Optional getMonthlyPrice() { return monthlyPrice; } @@ -103,7 +113,7 @@ public Optional getMonthlyPriceId() { } @JsonProperty("one_time_price") - public Optional getOneTimePrice() { + public Optional getOneTimePrice() { return oneTimePrice; } @@ -113,12 +123,12 @@ public Optional getOneTimePriceId() { } @JsonProperty("trial_days") - public Optional getTrialDays() { + public Optional getTrialDays() { return trialDays; } @JsonProperty("yearly_price") - public Optional getYearlyPrice() { + public Optional getYearlyPrice() { return yearlyPrice; } @@ -142,6 +152,7 @@ private boolean equalTo(UpsertBillingProductRequestBody other) { return billingProductId.equals(other.billingProductId) && chargeType.equals(other.chargeType) && currency.equals(other.currency) + && currencyPrices.equals(other.currencyPrices) && isTrialable == other.isTrialable && monthlyPrice.equals(other.monthlyPrice) && monthlyPriceId.equals(other.monthlyPriceId) @@ -158,6 +169,7 @@ public int hashCode() { this.billingProductId, this.chargeType, this.currency, + this.currencyPrices, this.isTrialable, this.monthlyPrice, this.monthlyPriceId, @@ -190,6 +202,10 @@ public interface IsTrialableStage { public interface _FinalStage { UpsertBillingProductRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage billingProductId(Optional billingProductId); _FinalStage billingProductId(String billingProductId); @@ -198,29 +214,33 @@ public interface _FinalStage { _FinalStage currency(String currency); - _FinalStage monthlyPrice(Optional monthlyPrice); + _FinalStage currencyPrices(Optional> currencyPrices); + + _FinalStage currencyPrices(List currencyPrices); - _FinalStage monthlyPrice(Integer monthlyPrice); + _FinalStage monthlyPrice(Optional monthlyPrice); + + _FinalStage monthlyPrice(Long monthlyPrice); _FinalStage monthlyPriceId(Optional monthlyPriceId); _FinalStage monthlyPriceId(String monthlyPriceId); - _FinalStage oneTimePrice(Optional oneTimePrice); + _FinalStage oneTimePrice(Optional oneTimePrice); - _FinalStage oneTimePrice(Integer oneTimePrice); + _FinalStage oneTimePrice(Long oneTimePrice); _FinalStage oneTimePriceId(Optional oneTimePriceId); _FinalStage oneTimePriceId(String oneTimePriceId); - _FinalStage trialDays(Optional trialDays); + _FinalStage trialDays(Optional trialDays); - _FinalStage trialDays(Integer trialDays); + _FinalStage trialDays(Long trialDays); - _FinalStage yearlyPrice(Optional yearlyPrice); + _FinalStage yearlyPrice(Optional yearlyPrice); - _FinalStage yearlyPrice(Integer yearlyPrice); + _FinalStage yearlyPrice(Long yearlyPrice); _FinalStage yearlyPriceId(Optional yearlyPriceId); @@ -235,17 +255,19 @@ public static final class Builder implements ChargeTypeStage, IsTrialableStage, private Optional yearlyPriceId = Optional.empty(); - private Optional yearlyPrice = Optional.empty(); + private Optional yearlyPrice = Optional.empty(); - private Optional trialDays = Optional.empty(); + private Optional trialDays = Optional.empty(); private Optional oneTimePriceId = Optional.empty(); - private Optional oneTimePrice = Optional.empty(); + private Optional oneTimePrice = Optional.empty(); private Optional monthlyPriceId = Optional.empty(); - private Optional monthlyPrice = Optional.empty(); + private Optional monthlyPrice = Optional.empty(); + + private Optional> currencyPrices = Optional.empty(); private Optional currency = Optional.empty(); @@ -261,6 +283,7 @@ public Builder from(UpsertBillingProductRequestBody other) { billingProductId(other.getBillingProductId()); chargeType(other.getChargeType()); currency(other.getCurrency()); + currencyPrices(other.getCurrencyPrices()); isTrialable(other.getIsTrialable()); monthlyPrice(other.getMonthlyPrice()); monthlyPriceId(other.getMonthlyPriceId()); @@ -300,27 +323,27 @@ public _FinalStage yearlyPriceId(Optional yearlyPriceId) { } @java.lang.Override - public _FinalStage yearlyPrice(Integer yearlyPrice) { + public _FinalStage yearlyPrice(Long yearlyPrice) { this.yearlyPrice = Optional.ofNullable(yearlyPrice); return this; } @java.lang.Override @JsonSetter(value = "yearly_price", nulls = Nulls.SKIP) - public _FinalStage yearlyPrice(Optional yearlyPrice) { + public _FinalStage yearlyPrice(Optional yearlyPrice) { this.yearlyPrice = yearlyPrice; return this; } @java.lang.Override - public _FinalStage trialDays(Integer trialDays) { + public _FinalStage trialDays(Long trialDays) { this.trialDays = Optional.ofNullable(trialDays); return this; } @java.lang.Override @JsonSetter(value = "trial_days", nulls = Nulls.SKIP) - public _FinalStage trialDays(Optional trialDays) { + public _FinalStage trialDays(Optional trialDays) { this.trialDays = trialDays; return this; } @@ -339,14 +362,14 @@ public _FinalStage oneTimePriceId(Optional oneTimePriceId) { } @java.lang.Override - public _FinalStage oneTimePrice(Integer oneTimePrice) { + public _FinalStage oneTimePrice(Long oneTimePrice) { this.oneTimePrice = Optional.ofNullable(oneTimePrice); return this; } @java.lang.Override @JsonSetter(value = "one_time_price", nulls = Nulls.SKIP) - public _FinalStage oneTimePrice(Optional oneTimePrice) { + public _FinalStage oneTimePrice(Optional oneTimePrice) { this.oneTimePrice = oneTimePrice; return this; } @@ -365,18 +388,31 @@ public _FinalStage monthlyPriceId(Optional monthlyPriceId) { } @java.lang.Override - public _FinalStage monthlyPrice(Integer monthlyPrice) { + public _FinalStage monthlyPrice(Long monthlyPrice) { this.monthlyPrice = Optional.ofNullable(monthlyPrice); return this; } @java.lang.Override @JsonSetter(value = "monthly_price", nulls = Nulls.SKIP) - public _FinalStage monthlyPrice(Optional monthlyPrice) { + public _FinalStage monthlyPrice(Optional monthlyPrice) { this.monthlyPrice = monthlyPrice; return this; } + @java.lang.Override + public _FinalStage currencyPrices(List currencyPrices) { + this.currencyPrices = Optional.ofNullable(currencyPrices); + return this; + } + + @java.lang.Override + @JsonSetter(value = "currency_prices", nulls = Nulls.SKIP) + public _FinalStage currencyPrices(Optional> currencyPrices) { + this.currencyPrices = currencyPrices; + return this; + } + @java.lang.Override public _FinalStage currency(String currency) { this.currency = Optional.ofNullable(currency); @@ -409,6 +445,7 @@ public UpsertBillingProductRequestBody build() { billingProductId, chargeType, currency, + currencyPrices, isTrialable, monthlyPrice, monthlyPriceId, @@ -419,5 +456,17 @@ public UpsertBillingProductRequestBody build() { yearlyPriceId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java b/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java index ab21a03..dfbeb19 100644 --- a/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertCompanyRequestBody.java @@ -31,6 +31,8 @@ public final class UpsertCompanyRequestBody { private final Optional name; + private final Optional preventKeyRemap; + private final Optional> traits; private final Optional updateOnly; @@ -42,6 +44,7 @@ private UpsertCompanyRequestBody( Map keys, Optional lastSeenAt, Optional name, + Optional preventKeyRemap, Optional> traits, Optional updateOnly, Map additionalProperties) { @@ -49,6 +52,7 @@ private UpsertCompanyRequestBody( this.keys = keys; this.lastSeenAt = lastSeenAt; this.name = name; + this.preventKeyRemap = preventKeyRemap; this.traits = traits; this.updateOnly = updateOnly; this.additionalProperties = additionalProperties; @@ -80,6 +84,11 @@ public Optional getName() { return name; } + @JsonProperty("prevent_key_remap") + public Optional getPreventKeyRemap() { + return preventKeyRemap; + } + /** * @return A map of trait names to trait values */ @@ -109,13 +118,15 @@ private boolean equalTo(UpsertCompanyRequestBody other) { && keys.equals(other.keys) && lastSeenAt.equals(other.lastSeenAt) && name.equals(other.name) + && preventKeyRemap.equals(other.preventKeyRemap) && traits.equals(other.traits) && updateOnly.equals(other.updateOnly); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.keys, this.lastSeenAt, this.name, this.traits, this.updateOnly); + return Objects.hash( + this.id, this.keys, this.lastSeenAt, this.name, this.preventKeyRemap, this.traits, this.updateOnly); } @java.lang.Override @@ -137,6 +148,8 @@ public static final class Builder { private Optional name = Optional.empty(); + private Optional preventKeyRemap = Optional.empty(); + private Optional> traits = Optional.empty(); private Optional updateOnly = Optional.empty(); @@ -151,6 +164,7 @@ public Builder from(UpsertCompanyRequestBody other) { keys(other.getKeys()); lastSeenAt(other.getLastSeenAt()); name(other.getName()); + preventKeyRemap(other.getPreventKeyRemap()); traits(other.getTraits()); updateOnly(other.getUpdateOnly()); return this; @@ -216,6 +230,17 @@ public Builder name(String name) { return this; } + @JsonSetter(value = "prevent_key_remap", nulls = Nulls.SKIP) + public Builder preventKeyRemap(Optional preventKeyRemap) { + this.preventKeyRemap = preventKeyRemap; + return this; + } + + public Builder preventKeyRemap(Boolean preventKeyRemap) { + this.preventKeyRemap = Optional.ofNullable(preventKeyRemap); + return this; + } + /** *

A map of trait names to trait values

*/ @@ -242,7 +267,18 @@ public Builder updateOnly(Boolean updateOnly) { } public UpsertCompanyRequestBody build() { - return new UpsertCompanyRequestBody(id, keys, lastSeenAt, name, traits, updateOnly, additionalProperties); + return new UpsertCompanyRequestBody( + id, keys, lastSeenAt, name, preventKeyRemap, traits, updateOnly, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; } } } diff --git a/src/main/java/com/schematic/api/types/UpsertTraitRequestBody.java b/src/main/java/com/schematic/api/types/UpsertTraitRequestBody.java index 857c4c8..b3395d6 100644 --- a/src/main/java/com/schematic/api/types/UpsertTraitRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertTraitRequestBody.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UpsertTraitRequestBody.Builder.class) public final class UpsertTraitRequestBody { - private final Optional incr; + private final Optional incr; private final Map keys; @@ -35,7 +35,7 @@ public final class UpsertTraitRequestBody { private final Map additionalProperties; private UpsertTraitRequestBody( - Optional incr, + Optional incr, Map keys, Optional set, String trait, @@ -53,7 +53,7 @@ private UpsertTraitRequestBody( * @return Amount to increment the trait by (positive or negative) */ @JsonProperty("incr") - public Optional getIncr() { + public Optional getIncr() { return incr; } @@ -134,12 +134,16 @@ public interface TraitStage { public interface _FinalStage { UpsertTraitRequestBody build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + /** *

Amount to increment the trait by (positive or negative)

*/ - _FinalStage incr(Optional incr); + _FinalStage incr(Optional incr); - _FinalStage incr(Integer incr); + _FinalStage incr(Long incr); /** *

Key/value pairs to identify a company or user

@@ -175,7 +179,7 @@ public static final class Builder implements TraitStage, _FinalStage { private Map keys = new LinkedHashMap<>(); - private Optional incr = Optional.empty(); + private Optional incr = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -284,7 +288,7 @@ public _FinalStage keys(Map keys) { * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage incr(Integer incr) { + public _FinalStage incr(Long incr) { this.incr = Optional.ofNullable(incr); return this; } @@ -294,7 +298,7 @@ public _FinalStage incr(Integer incr) { */ @java.lang.Override @JsonSetter(value = "incr", nulls = Nulls.SKIP) - public _FinalStage incr(Optional incr) { + public _FinalStage incr(Optional incr) { this.incr = incr; return this; } @@ -303,5 +307,17 @@ public _FinalStage incr(Optional incr) { public UpsertTraitRequestBody build() { return new UpsertTraitRequestBody(incr, keys, set, trait, updateOnly, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java b/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java index 89ac973..5949d24 100644 --- a/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertUserRequestBody.java @@ -386,5 +386,15 @@ public UpsertUserRequestBody build() { updateOnly, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java b/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java index 6a1a8e1..abd847b 100644 --- a/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java +++ b/src/main/java/com/schematic/api/types/UpsertUserSubRequestBody.java @@ -314,5 +314,15 @@ public UpsertUserSubRequestBody build() { return new UpsertUserSubRequestBody( companyId, companyIds, id, keys, lastSeenAt, name, traits, updateOnly, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java index bc55f53..66d3f77 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementRequestBody.java @@ -23,7 +23,7 @@ public final class UsageBasedEntitlementRequestBody { private final Optional billingProductId; - private final Optional billingThreshold; + private final Optional billingThreshold; private final Optional currency; @@ -31,7 +31,7 @@ public final class UsageBasedEntitlementRequestBody { private final Optional> monthlyPriceTiers; - private final Optional monthlyUnitPrice; + private final Optional monthlyUnitPrice; private final Optional monthlyUnitPriceDecimal; @@ -41,7 +41,7 @@ public final class UsageBasedEntitlementRequestBody { private final Optional> priceTiers; - private final Optional softLimit; + private final Optional softLimit; private final Optional tierMode; @@ -49,7 +49,7 @@ public final class UsageBasedEntitlementRequestBody { private final Optional> yearlyPriceTiers; - private final Optional yearlyUnitPrice; + private final Optional yearlyUnitPrice; private final Optional yearlyUnitPriceDecimal; @@ -57,20 +57,20 @@ public final class UsageBasedEntitlementRequestBody { private UsageBasedEntitlementRequestBody( Optional billingProductId, - Optional billingThreshold, + Optional billingThreshold, Optional currency, Optional monthlyMeteredPriceId, Optional> monthlyPriceTiers, - Optional monthlyUnitPrice, + Optional monthlyUnitPrice, Optional monthlyUnitPriceDecimal, Optional overageBillingProductId, Optional priceBehavior, Optional> priceTiers, - Optional softLimit, + Optional softLimit, Optional tierMode, Optional yearlyMeteredPriceId, Optional> yearlyPriceTiers, - Optional yearlyUnitPrice, + Optional yearlyUnitPrice, Optional yearlyUnitPriceDecimal, Map additionalProperties) { this.billingProductId = billingProductId; @@ -98,7 +98,7 @@ public Optional getBillingProductId() { } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -118,7 +118,7 @@ public Optional> getMonthlyPriceTiers() { } @JsonProperty("monthly_unit_price") - public Optional getMonthlyUnitPrice() { + public Optional getMonthlyUnitPrice() { return monthlyUnitPrice; } @@ -146,7 +146,7 @@ public Optional> getPriceTiers() { } @JsonProperty("soft_limit") - public Optional getSoftLimit() { + public Optional getSoftLimit() { return softLimit; } @@ -166,7 +166,7 @@ public Optional> getYearlyPriceTiers() { } @JsonProperty("yearly_unit_price") - public Optional getYearlyUnitPrice() { + public Optional getYearlyUnitPrice() { return yearlyUnitPrice; } @@ -239,7 +239,7 @@ public static Builder builder() { public static final class Builder { private Optional billingProductId = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); private Optional currency = Optional.empty(); @@ -247,7 +247,7 @@ public static final class Builder { private Optional> monthlyPriceTiers = Optional.empty(); - private Optional monthlyUnitPrice = Optional.empty(); + private Optional monthlyUnitPrice = Optional.empty(); private Optional monthlyUnitPriceDecimal = Optional.empty(); @@ -257,7 +257,7 @@ public static final class Builder { private Optional> priceTiers = Optional.empty(); - private Optional softLimit = Optional.empty(); + private Optional softLimit = Optional.empty(); private Optional tierMode = Optional.empty(); @@ -265,7 +265,7 @@ public static final class Builder { private Optional> yearlyPriceTiers = Optional.empty(); - private Optional yearlyUnitPrice = Optional.empty(); + private Optional yearlyUnitPrice = Optional.empty(); private Optional yearlyUnitPriceDecimal = Optional.empty(); @@ -306,12 +306,12 @@ public Builder billingProductId(String billingProductId) { } @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public Builder billingThreshold(Optional billingThreshold) { + public Builder billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } - public Builder billingThreshold(Integer billingThreshold) { + public Builder billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @@ -350,12 +350,12 @@ public Builder monthlyPriceTiers(List monthlyPriceTi } @JsonSetter(value = "monthly_unit_price", nulls = Nulls.SKIP) - public Builder monthlyUnitPrice(Optional monthlyUnitPrice) { + public Builder monthlyUnitPrice(Optional monthlyUnitPrice) { this.monthlyUnitPrice = monthlyUnitPrice; return this; } - public Builder monthlyUnitPrice(Integer monthlyUnitPrice) { + public Builder monthlyUnitPrice(Long monthlyUnitPrice) { this.monthlyUnitPrice = Optional.ofNullable(monthlyUnitPrice); return this; } @@ -408,12 +408,12 @@ public Builder priceTiers(List priceTiers) { } @JsonSetter(value = "soft_limit", nulls = Nulls.SKIP) - public Builder softLimit(Optional softLimit) { + public Builder softLimit(Optional softLimit) { this.softLimit = softLimit; return this; } - public Builder softLimit(Integer softLimit) { + public Builder softLimit(Long softLimit) { this.softLimit = Optional.ofNullable(softLimit); return this; } @@ -452,12 +452,12 @@ public Builder yearlyPriceTiers(List yearlyPriceTier } @JsonSetter(value = "yearly_unit_price", nulls = Nulls.SKIP) - public Builder yearlyUnitPrice(Optional yearlyUnitPrice) { + public Builder yearlyUnitPrice(Optional yearlyUnitPrice) { this.yearlyUnitPrice = yearlyUnitPrice; return this; } - public Builder yearlyUnitPrice(Integer yearlyUnitPrice) { + public Builder yearlyUnitPrice(Long yearlyUnitPrice) { this.yearlyUnitPrice = Optional.ofNullable(yearlyUnitPrice); return this; } @@ -493,5 +493,15 @@ public UsageBasedEntitlementRequestBody build() { yearlyUnitPriceDecimal, additionalProperties); } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java index 8c0b51d..ee231ee 100644 --- a/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java +++ b/src/main/java/com/schematic/api/types/UsageBasedEntitlementResponseData.java @@ -21,7 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = UsageBasedEntitlementResponseData.Builder.class) public final class UsageBasedEntitlementResponseData { - private final Optional billingThreshold; + private final Optional billingThreshold; private final Optional consumptionRate; @@ -39,7 +39,7 @@ public final class UsageBasedEntitlementResponseData { private final Optional valueBool; - private final Optional valueNumeric; + private final Optional valueNumeric; private final EntitlementValueType valueType; @@ -48,7 +48,7 @@ public final class UsageBasedEntitlementResponseData { private final Map additionalProperties; private UsageBasedEntitlementResponseData( - Optional billingThreshold, + Optional billingThreshold, Optional consumptionRate, String featureId, Optional meteredPrice, @@ -57,7 +57,7 @@ private UsageBasedEntitlementResponseData( Optional monthlyUsageBasedPrice, Optional priceBehavior, Optional valueBool, - Optional valueNumeric, + Optional valueNumeric, EntitlementValueType valueType, Optional yearlyUsageBasedPrice, Map additionalProperties) { @@ -77,7 +77,7 @@ private UsageBasedEntitlementResponseData( } @JsonProperty("billing_threshold") - public Optional getBillingThreshold() { + public Optional getBillingThreshold() { return billingThreshold; } @@ -122,7 +122,7 @@ public Optional getValueBool() { } @JsonProperty("value_numeric") - public Optional getValueNumeric() { + public Optional getValueNumeric() { return valueNumeric; } @@ -201,9 +201,13 @@ public interface ValueTypeStage { public interface _FinalStage { UsageBasedEntitlementResponseData build(); - _FinalStage billingThreshold(Optional billingThreshold); + _FinalStage additionalProperty(String key, Object value); - _FinalStage billingThreshold(Integer billingThreshold); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage billingThreshold(Optional billingThreshold); + + _FinalStage billingThreshold(Long billingThreshold); _FinalStage consumptionRate(Optional consumptionRate); @@ -233,9 +237,9 @@ public interface _FinalStage { _FinalStage valueBool(Boolean valueBool); - _FinalStage valueNumeric(Optional valueNumeric); + _FinalStage valueNumeric(Optional valueNumeric); - _FinalStage valueNumeric(Integer valueNumeric); + _FinalStage valueNumeric(Long valueNumeric); _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageBasedPrice); @@ -250,7 +254,7 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional yearlyUsageBasedPrice = Optional.empty(); - private Optional valueNumeric = Optional.empty(); + private Optional valueNumeric = Optional.empty(); private Optional valueBool = Optional.empty(); @@ -266,7 +270,7 @@ public static final class Builder implements FeatureIdStage, ValueTypeStage, _Fi private Optional consumptionRate = Optional.empty(); - private Optional billingThreshold = Optional.empty(); + private Optional billingThreshold = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -318,14 +322,14 @@ public _FinalStage yearlyUsageBasedPrice(Optional yearlyUsageB } @java.lang.Override - public _FinalStage valueNumeric(Integer valueNumeric) { + public _FinalStage valueNumeric(Long valueNumeric) { this.valueNumeric = Optional.ofNullable(valueNumeric); return this; } @java.lang.Override @JsonSetter(value = "value_numeric", nulls = Nulls.SKIP) - public _FinalStage valueNumeric(Optional valueNumeric) { + public _FinalStage valueNumeric(Optional valueNumeric) { this.valueNumeric = valueNumeric; return this; } @@ -422,14 +426,14 @@ public _FinalStage consumptionRate(Optional consumptionRate) { } @java.lang.Override - public _FinalStage billingThreshold(Integer billingThreshold) { + public _FinalStage billingThreshold(Long billingThreshold) { this.billingThreshold = Optional.ofNullable(billingThreshold); return this; } @java.lang.Override @JsonSetter(value = "billing_threshold", nulls = Nulls.SKIP) - public _FinalStage billingThreshold(Optional billingThreshold) { + public _FinalStage billingThreshold(Optional billingThreshold) { this.billingThreshold = billingThreshold; return this; } @@ -451,5 +455,17 @@ public UsageBasedEntitlementResponseData build() { yearlyUsageBasedPrice, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java b/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java index 690167c..db2e7aa 100644 --- a/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java +++ b/src/main/java/com/schematic/api/types/UsageTimeSeriesPointResponseData.java @@ -28,7 +28,7 @@ public final class UsageTimeSeriesPointResponseData { private final OffsetDateTime timestamp; - private final int usage; + private final long usage; private final Map additionalProperties; @@ -36,7 +36,7 @@ private UsageTimeSeriesPointResponseData( Optional periodEnd, Optional periodStart, OffsetDateTime timestamp, - int usage, + long usage, Map additionalProperties) { this.periodEnd = periodEnd; this.periodStart = periodStart; @@ -61,7 +61,7 @@ public OffsetDateTime getTimestamp() { } @JsonProperty("usage") - public int getUsage() { + public long getUsage() { return usage; } @@ -104,12 +104,16 @@ public interface TimestampStage { } public interface UsageStage { - _FinalStage usage(int usage); + _FinalStage usage(long usage); } public interface _FinalStage { UsageTimeSeriesPointResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage periodEnd(Optional periodEnd); _FinalStage periodEnd(OffsetDateTime periodEnd); @@ -123,7 +127,7 @@ public interface _FinalStage { public static final class Builder implements TimestampStage, UsageStage, _FinalStage { private OffsetDateTime timestamp; - private int usage; + private long usage; private Optional periodStart = Optional.empty(); @@ -152,7 +156,7 @@ public UsageStage timestamp(@NotNull OffsetDateTime timestamp) { @java.lang.Override @JsonSetter("usage") - public _FinalStage usage(int usage) { + public _FinalStage usage(long usage) { this.usage = usage; return this; } @@ -187,5 +191,17 @@ public _FinalStage periodEnd(Optional periodEnd) { public UsageTimeSeriesPointResponseData build() { return new UsageTimeSeriesPointResponseData(periodEnd, periodStart, timestamp, usage, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UserDetailResponseData.java b/src/main/java/com/schematic/api/types/UserDetailResponseData.java index 6a7614d..661a605 100644 --- a/src/main/java/com/schematic/api/types/UserDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/UserDetailResponseData.java @@ -198,6 +198,10 @@ public interface UpdatedAtStage { public interface _FinalStage { UserDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage companyMemberships(List companyMemberships); _FinalStage addCompanyMemberships(CompanyMembershipDetailResponseData companyMemberships); @@ -426,5 +430,17 @@ public UserDetailResponseData build() { updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/UserResponseData.java b/src/main/java/com/schematic/api/types/UserResponseData.java index 6f529f3..771cecc 100644 --- a/src/main/java/com/schematic/api/types/UserResponseData.java +++ b/src/main/java/com/schematic/api/types/UserResponseData.java @@ -142,6 +142,10 @@ public interface UpdatedAtStage { public interface _FinalStage { UserResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage lastSeenAt(Optional lastSeenAt); _FinalStage lastSeenAt(OffsetDateTime lastSeenAt); @@ -231,5 +235,17 @@ public UserResponseData build() { return new UserResponseData( createdAt, environmentId, id, lastSeenAt, name, updatedAt, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java b/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java index 90c59bd..0454bbd 100644 --- a/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java +++ b/src/main/java/com/schematic/api/types/WebFeatureUsageWebhookOutput.java @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = WebFeatureUsageWebhookOutput.Builder.class) public final class WebFeatureUsageWebhookOutput { - private final Optional allocation; + private final Optional allocation; private final Optional creditUsage; @@ -32,19 +32,19 @@ public final class WebFeatureUsageWebhookOutput { private final Optional metricResetAt; - private final Optional usage; + private final Optional usage; private final Optional company; private final Map additionalProperties; private WebFeatureUsageWebhookOutput( - Optional allocation, + Optional allocation, Optional creditUsage, String entitlement, Optional feature, Optional metricResetAt, - Optional usage, + Optional usage, Optional company, Map additionalProperties) { this.allocation = allocation; @@ -58,7 +58,7 @@ private WebFeatureUsageWebhookOutput( } @JsonProperty("Allocation") - public Optional getAllocation() { + public Optional getAllocation() { return allocation; } @@ -83,7 +83,7 @@ public Optional getMetricResetAt() { } @JsonProperty("Usage") - public Optional getUsage() { + public Optional getUsage() { return usage; } @@ -143,9 +143,13 @@ public interface EntitlementStage { public interface _FinalStage { WebFeatureUsageWebhookOutput build(); - _FinalStage allocation(Optional allocation); + _FinalStage additionalProperty(String key, Object value); - _FinalStage allocation(Integer allocation); + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage allocation(Optional allocation); + + _FinalStage allocation(Long allocation); _FinalStage creditUsage(Optional creditUsage); @@ -159,9 +163,9 @@ public interface _FinalStage { _FinalStage metricResetAt(OffsetDateTime metricResetAt); - _FinalStage usage(Optional usage); + _FinalStage usage(Optional usage); - _FinalStage usage(Integer usage); + _FinalStage usage(Long usage); _FinalStage company(Optional company); @@ -174,7 +178,7 @@ public static final class Builder implements EntitlementStage, _FinalStage { private Optional company = Optional.empty(); - private Optional usage = Optional.empty(); + private Optional usage = Optional.empty(); private Optional metricResetAt = Optional.empty(); @@ -182,7 +186,7 @@ public static final class Builder implements EntitlementStage, _FinalStage { private Optional creditUsage = Optional.empty(); - private Optional allocation = Optional.empty(); + private Optional allocation = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -222,14 +226,14 @@ public _FinalStage company(Optional company) { } @java.lang.Override - public _FinalStage usage(Integer usage) { + public _FinalStage usage(Long usage) { this.usage = Optional.ofNullable(usage); return this; } @java.lang.Override @JsonSetter(value = "Usage", nulls = Nulls.SKIP) - public _FinalStage usage(Optional usage) { + public _FinalStage usage(Optional usage) { this.usage = usage; return this; } @@ -274,14 +278,14 @@ public _FinalStage creditUsage(Optional creditUsage) { } @java.lang.Override - public _FinalStage allocation(Integer allocation) { + public _FinalStage allocation(Long allocation) { this.allocation = Optional.ofNullable(allocation); return this; } @java.lang.Override @JsonSetter(value = "Allocation", nulls = Nulls.SKIP) - public _FinalStage allocation(Optional allocation) { + public _FinalStage allocation(Optional allocation) { this.allocation = allocation; return this; } @@ -291,5 +295,17 @@ public WebFeatureUsageWebhookOutput build() { return new WebFeatureUsageWebhookOutput( allocation, creditUsage, entitlement, feature, metricResetAt, usage, company, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/WebScheduledDowngradeWebhookOutput.java b/src/main/java/com/schematic/api/types/WebScheduledDowngradeWebhookOutput.java new file mode 100644 index 0000000..68835ce --- /dev/null +++ b/src/main/java/com/schematic/api/types/WebScheduledDowngradeWebhookOutput.java @@ -0,0 +1,313 @@ +/** + * 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 = WebScheduledDowngradeWebhookOutput.Builder.class) +public final class WebScheduledDowngradeWebhookOutput { + private final Optional company; + + private final OffsetDateTime executeAfter; + + private final Optional fromPlan; + + private final String id; + + private final Optional scheduledInterval; + + private final Optional scheduledPrice; + + private final Optional toPlan; + + private final Map additionalProperties; + + private WebScheduledDowngradeWebhookOutput( + Optional company, + OffsetDateTime executeAfter, + Optional fromPlan, + String id, + Optional scheduledInterval, + Optional scheduledPrice, + Optional toPlan, + Map additionalProperties) { + this.company = company; + this.executeAfter = executeAfter; + this.fromPlan = fromPlan; + this.id = id; + this.scheduledInterval = scheduledInterval; + this.scheduledPrice = scheduledPrice; + this.toPlan = toPlan; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("company") + public Optional getCompany() { + return company; + } + + @JsonProperty("execute_after") + public OffsetDateTime getExecuteAfter() { + return executeAfter; + } + + @JsonProperty("from_plan") + public Optional getFromPlan() { + return fromPlan; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("scheduled_interval") + public Optional getScheduledInterval() { + return scheduledInterval; + } + + @JsonProperty("scheduled_price") + public Optional getScheduledPrice() { + return scheduledPrice; + } + + @JsonProperty("to_plan") + public Optional getToPlan() { + return toPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WebScheduledDowngradeWebhookOutput + && equalTo((WebScheduledDowngradeWebhookOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WebScheduledDowngradeWebhookOutput other) { + return company.equals(other.company) + && executeAfter.equals(other.executeAfter) + && fromPlan.equals(other.fromPlan) + && id.equals(other.id) + && scheduledInterval.equals(other.scheduledInterval) + && scheduledPrice.equals(other.scheduledPrice) + && toPlan.equals(other.toPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.company, + this.executeAfter, + this.fromPlan, + this.id, + this.scheduledInterval, + this.scheduledPrice, + this.toPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExecuteAfterStage builder() { + return new Builder(); + } + + public interface ExecuteAfterStage { + IdStage executeAfter(@NotNull OffsetDateTime executeAfter); + + Builder from(WebScheduledDowngradeWebhookOutput other); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + WebScheduledDowngradeWebhookOutput build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage company(Optional company); + + _FinalStage company(CompanyResponseData company); + + _FinalStage fromPlan(Optional fromPlan); + + _FinalStage fromPlan(PlanSnapshotView fromPlan); + + _FinalStage scheduledInterval(Optional scheduledInterval); + + _FinalStage scheduledInterval(String scheduledInterval); + + _FinalStage scheduledPrice(Optional scheduledPrice); + + _FinalStage scheduledPrice(Long scheduledPrice); + + _FinalStage toPlan(Optional toPlan); + + _FinalStage toPlan(PlanSnapshotView toPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExecuteAfterStage, IdStage, _FinalStage { + private OffsetDateTime executeAfter; + + private String id; + + private Optional toPlan = Optional.empty(); + + private Optional scheduledPrice = Optional.empty(); + + private Optional scheduledInterval = Optional.empty(); + + private Optional fromPlan = Optional.empty(); + + private Optional company = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WebScheduledDowngradeWebhookOutput other) { + company(other.getCompany()); + executeAfter(other.getExecuteAfter()); + fromPlan(other.getFromPlan()); + id(other.getId()); + scheduledInterval(other.getScheduledInterval()); + scheduledPrice(other.getScheduledPrice()); + toPlan(other.getToPlan()); + return this; + } + + @java.lang.Override + @JsonSetter("execute_after") + public IdStage executeAfter(@NotNull OffsetDateTime executeAfter) { + this.executeAfter = Objects.requireNonNull(executeAfter, "executeAfter 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 toPlan(PlanSnapshotView toPlan) { + this.toPlan = Optional.ofNullable(toPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "to_plan", nulls = Nulls.SKIP) + public _FinalStage toPlan(Optional toPlan) { + this.toPlan = toPlan; + return this; + } + + @java.lang.Override + public _FinalStage scheduledPrice(Long scheduledPrice) { + this.scheduledPrice = Optional.ofNullable(scheduledPrice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_price", nulls = Nulls.SKIP) + public _FinalStage scheduledPrice(Optional scheduledPrice) { + this.scheduledPrice = scheduledPrice; + return this; + } + + @java.lang.Override + public _FinalStage scheduledInterval(String scheduledInterval) { + this.scheduledInterval = Optional.ofNullable(scheduledInterval); + return this; + } + + @java.lang.Override + @JsonSetter(value = "scheduled_interval", nulls = Nulls.SKIP) + public _FinalStage scheduledInterval(Optional scheduledInterval) { + this.scheduledInterval = scheduledInterval; + return this; + } + + @java.lang.Override + public _FinalStage fromPlan(PlanSnapshotView fromPlan) { + this.fromPlan = Optional.ofNullable(fromPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "from_plan", nulls = Nulls.SKIP) + public _FinalStage fromPlan(Optional fromPlan) { + this.fromPlan = fromPlan; + return this; + } + + @java.lang.Override + public _FinalStage company(CompanyResponseData 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 WebScheduledDowngradeWebhookOutput build() { + return new WebScheduledDowngradeWebhookOutput( + company, + executeAfter, + fromPlan, + id, + scheduledInterval, + scheduledPrice, + toPlan, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java b/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java index 1a2787a..1216065 100644 --- a/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java +++ b/src/main/java/com/schematic/api/types/WebhookEventDetailResponseData.java @@ -30,7 +30,7 @@ public final class WebhookEventDetailResponseData { private final WebhookRequestType requestType; - private final Optional responseCode; + private final Optional responseCode; private final Optional sentAt; @@ -49,7 +49,7 @@ private WebhookEventDetailResponseData( String id, Optional payload, WebhookRequestType requestType, - Optional responseCode, + Optional responseCode, Optional sentAt, WebhookEventStatus status, OffsetDateTime updatedAt, @@ -90,7 +90,7 @@ public WebhookRequestType getRequestType() { } @JsonProperty("response_code") - public Optional getResponseCode() { + public Optional getResponseCode() { return responseCode; } @@ -196,13 +196,17 @@ public interface WebhookIdStage { public interface _FinalStage { WebhookEventDetailResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage payload(Optional payload); _FinalStage payload(String payload); - _FinalStage responseCode(Optional responseCode); + _FinalStage responseCode(Optional responseCode); - _FinalStage responseCode(Integer responseCode); + _FinalStage responseCode(Long responseCode); _FinalStage sentAt(Optional sentAt); @@ -238,7 +242,7 @@ public static final class Builder private Optional sentAt = Optional.empty(); - private Optional responseCode = Optional.empty(); + private Optional responseCode = Optional.empty(); private Optional payload = Optional.empty(); @@ -331,14 +335,14 @@ public _FinalStage sentAt(Optional sentAt) { } @java.lang.Override - public _FinalStage responseCode(Integer responseCode) { + public _FinalStage responseCode(Long responseCode) { this.responseCode = Optional.ofNullable(responseCode); return this; } @java.lang.Override @JsonSetter(value = "response_code", nulls = Nulls.SKIP) - public _FinalStage responseCode(Optional responseCode) { + public _FinalStage responseCode(Optional responseCode) { this.responseCode = responseCode; return this; } @@ -371,5 +375,17 @@ public WebhookEventDetailResponseData build() { webhookId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/WebhookEventResponseData.java b/src/main/java/com/schematic/api/types/WebhookEventResponseData.java index a5804cd..06e1018 100644 --- a/src/main/java/com/schematic/api/types/WebhookEventResponseData.java +++ b/src/main/java/com/schematic/api/types/WebhookEventResponseData.java @@ -30,7 +30,7 @@ public final class WebhookEventResponseData { private final WebhookRequestType requestType; - private final Optional responseCode; + private final Optional responseCode; private final Optional sentAt; @@ -47,7 +47,7 @@ private WebhookEventResponseData( String id, Optional payload, WebhookRequestType requestType, - Optional responseCode, + Optional responseCode, Optional sentAt, WebhookEventStatus status, OffsetDateTime updatedAt, @@ -86,7 +86,7 @@ public WebhookRequestType getRequestType() { } @JsonProperty("response_code") - public Optional getResponseCode() { + public Optional getResponseCode() { return responseCode; } @@ -185,13 +185,17 @@ public interface WebhookIdStage { public interface _FinalStage { WebhookEventResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage payload(Optional payload); _FinalStage payload(String payload); - _FinalStage responseCode(Optional responseCode); + _FinalStage responseCode(Optional responseCode); - _FinalStage responseCode(Integer responseCode); + _FinalStage responseCode(Long responseCode); _FinalStage sentAt(Optional sentAt); @@ -221,7 +225,7 @@ public static final class Builder private Optional sentAt = Optional.empty(); - private Optional responseCode = Optional.empty(); + private Optional responseCode = Optional.empty(); private Optional payload = Optional.empty(); @@ -300,14 +304,14 @@ public _FinalStage sentAt(Optional sentAt) { } @java.lang.Override - public _FinalStage responseCode(Integer responseCode) { + public _FinalStage responseCode(Long responseCode) { this.responseCode = Optional.ofNullable(responseCode); return this; } @java.lang.Override @JsonSetter(value = "response_code", nulls = Nulls.SKIP) - public _FinalStage responseCode(Optional responseCode) { + public _FinalStage responseCode(Optional responseCode) { this.responseCode = responseCode; return this; } @@ -339,5 +343,17 @@ public WebhookEventResponseData build() { webhookId, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/WebhookRequestType.java b/src/main/java/com/schematic/api/types/WebhookRequestType.java index 446aa0a..1007a2c 100644 --- a/src/main/java/com/schematic/api/types/WebhookRequestType.java +++ b/src/main/java/com/schematic/api/types/WebhookRequestType.java @@ -71,6 +71,9 @@ public final class WebhookRequestType { public static final WebhookRequestType PLAN_UPDATED = new WebhookRequestType(Value.PLAN_UPDATED, "plan.updated"); + public static final WebhookRequestType COMPANY_SCHEDULED_DOWNGRADE = + new WebhookRequestType(Value.COMPANY_SCHEDULED_DOWNGRADE, "company.scheduled_downgrade"); + public static final WebhookRequestType CREDIT_LIMIT_WARNING = new WebhookRequestType(Value.CREDIT_LIMIT_WARNING, "credit.limit.warning"); @@ -80,6 +83,9 @@ public final class WebhookRequestType { public static final WebhookRequestType ENTITLEMENT_SOFT_LIMIT_WARNING = new WebhookRequestType(Value.ENTITLEMENT_SOFT_LIMIT_WARNING, "entitlement.soft_limit.warning"); + public static final WebhookRequestType PLAN_VERSION_DELETED = + new WebhookRequestType(Value.PLAN_VERSION_DELETED, "plan_version.deleted"); + public static final WebhookRequestType COMPANY_PLAN_CHANGED = new WebhookRequestType(Value.COMPANY_PLAN_CHANGED, "company.plan_changed"); @@ -187,12 +193,16 @@ public T visit(Visitor visitor) { return visitor.visitEntitlementLimitWarning(); case PLAN_UPDATED: return visitor.visitPlanUpdated(); + case COMPANY_SCHEDULED_DOWNGRADE: + return visitor.visitCompanyScheduledDowngrade(); case CREDIT_LIMIT_WARNING: return visitor.visitCreditLimitWarning(); case FEATURE_CREATED: return visitor.visitFeatureCreated(); case ENTITLEMENT_SOFT_LIMIT_WARNING: return visitor.visitEntitlementSoftLimitWarning(); + case PLAN_VERSION_DELETED: + return visitor.visitPlanVersionDeleted(); case COMPANY_PLAN_CHANGED: return visitor.visitCompanyPlanChanged(); case COMPANY_UPDATED: @@ -270,12 +280,16 @@ public static WebhookRequestType valueOf(String value) { return ENTITLEMENT_LIMIT_WARNING; case "plan.updated": return PLAN_UPDATED; + case "company.scheduled_downgrade": + return COMPANY_SCHEDULED_DOWNGRADE; 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 "plan_version.deleted": + return PLAN_VERSION_DELETED; case "company.plan_changed": return COMPANY_PLAN_CHANGED; case "company.updated": @@ -318,6 +332,8 @@ public enum Value { COMPANY_PLAN_CHANGED, + COMPANY_SCHEDULED_DOWNGRADE, + COMPANY_UPDATED, CREDIT_LIMIT_REACHED, @@ -362,6 +378,8 @@ public enum Value { PLAN_UPDATED, + PLAN_VERSION_DELETED, + RULE_DELETED, TEST_SEND, @@ -396,6 +414,8 @@ public interface Visitor { T visitCompanyPlanChanged(); + T visitCompanyScheduledDowngrade(); + T visitCompanyUpdated(); T visitCreditLimitReached(); @@ -440,6 +460,8 @@ public interface Visitor { T visitPlanUpdated(); + T visitPlanVersionDeleted(); + T visitRuleDeleted(); T visitTestSend(); diff --git a/src/main/java/com/schematic/api/types/WebhookResponseData.java b/src/main/java/com/schematic/api/types/WebhookResponseData.java index 59a9b16..4c55a78 100644 --- a/src/main/java/com/schematic/api/types/WebhookResponseData.java +++ b/src/main/java/com/schematic/api/types/WebhookResponseData.java @@ -202,6 +202,10 @@ public interface UrlStage { public interface _FinalStage { WebhookResponseData build(); + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + _FinalStage creditTriggerConfigs(Optional> creditTriggerConfigs); _FinalStage creditTriggerConfigs(List creditTriggerConfigs); @@ -382,5 +386,17 @@ public WebhookResponseData build() { url, additionalProperties); } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } } } diff --git a/src/main/java/com/schematic/api/types/WhoAmIResponseData.java b/src/main/java/com/schematic/api/types/WhoAmIResponseData.java new file mode 100644 index 0000000..57c3d2c --- /dev/null +++ b/src/main/java/com/schematic/api/types/WhoAmIResponseData.java @@ -0,0 +1,384 @@ +/** + * 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 = WhoAmIResponseData.Builder.class) +public final class WhoAmIResponseData { + private final String accountId; + + private final String accountName; + + private final ActorType actorType; + + private final Optional apiKeyId; + + private final Optional environmentId; + + private final List environments; + + private final Optional stripeUserId; + + private final Optional userId; + + private final Optional userName; + + private final Map additionalProperties; + + private WhoAmIResponseData( + String accountId, + String accountName, + ActorType actorType, + Optional apiKeyId, + Optional environmentId, + List environments, + Optional stripeUserId, + Optional userId, + Optional userName, + Map additionalProperties) { + this.accountId = accountId; + this.accountName = accountName; + this.actorType = actorType; + this.apiKeyId = apiKeyId; + this.environmentId = environmentId; + this.environments = environments; + this.stripeUserId = stripeUserId; + this.userId = userId; + this.userName = userName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @JsonProperty("account_name") + public String getAccountName() { + return accountName; + } + + @JsonProperty("actor_type") + public ActorType getActorType() { + return actorType; + } + + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + @JsonProperty("environment_id") + public Optional getEnvironmentId() { + return environmentId; + } + + @JsonProperty("environments") + public List getEnvironments() { + return environments; + } + + @JsonProperty("stripe_user_id") + public Optional getStripeUserId() { + return stripeUserId; + } + + @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 WhoAmIResponseData && equalTo((WhoAmIResponseData) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WhoAmIResponseData other) { + return accountId.equals(other.accountId) + && accountName.equals(other.accountName) + && actorType.equals(other.actorType) + && apiKeyId.equals(other.apiKeyId) + && environmentId.equals(other.environmentId) + && environments.equals(other.environments) + && stripeUserId.equals(other.stripeUserId) + && userId.equals(other.userId) + && userName.equals(other.userName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.accountId, + this.accountName, + this.actorType, + this.apiKeyId, + this.environmentId, + this.environments, + this.stripeUserId, + this.userId, + this.userName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccountIdStage builder() { + return new Builder(); + } + + public interface AccountIdStage { + AccountNameStage accountId(@NotNull String accountId); + + Builder from(WhoAmIResponseData other); + } + + public interface AccountNameStage { + ActorTypeStage accountName(@NotNull String accountName); + } + + public interface ActorTypeStage { + _FinalStage actorType(@NotNull ActorType actorType); + } + + public interface _FinalStage { + WhoAmIResponseData build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage apiKeyId(Optional apiKeyId); + + _FinalStage apiKeyId(String apiKeyId); + + _FinalStage environmentId(Optional environmentId); + + _FinalStage environmentId(String environmentId); + + _FinalStage environments(List environments); + + _FinalStage addEnvironments(EnvironmentResponseData environments); + + _FinalStage addAllEnvironments(List environments); + + _FinalStage stripeUserId(Optional stripeUserId); + + _FinalStage stripeUserId(String stripeUserId); + + _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 AccountIdStage, AccountNameStage, ActorTypeStage, _FinalStage { + private String accountId; + + private String accountName; + + private ActorType actorType; + + private Optional userName = Optional.empty(); + + private Optional userId = Optional.empty(); + + private Optional stripeUserId = Optional.empty(); + + private List environments = new ArrayList<>(); + + private Optional environmentId = Optional.empty(); + + private Optional apiKeyId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WhoAmIResponseData other) { + accountId(other.getAccountId()); + accountName(other.getAccountName()); + actorType(other.getActorType()); + apiKeyId(other.getApiKeyId()); + environmentId(other.getEnvironmentId()); + environments(other.getEnvironments()); + stripeUserId(other.getStripeUserId()); + userId(other.getUserId()); + userName(other.getUserName()); + return this; + } + + @java.lang.Override + @JsonSetter("account_id") + public AccountNameStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("account_name") + public ActorTypeStage accountName(@NotNull String accountName) { + this.accountName = Objects.requireNonNull(accountName, "accountName must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("actor_type") + public _FinalStage actorType(@NotNull ActorType actorType) { + this.actorType = Objects.requireNonNull(actorType, "actorType 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 stripeUserId(String stripeUserId) { + this.stripeUserId = Optional.ofNullable(stripeUserId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripe_user_id", nulls = Nulls.SKIP) + public _FinalStage stripeUserId(Optional stripeUserId) { + this.stripeUserId = stripeUserId; + return this; + } + + @java.lang.Override + public _FinalStage addAllEnvironments(List environments) { + if (environments != null) { + this.environments.addAll(environments); + } + return this; + } + + @java.lang.Override + public _FinalStage addEnvironments(EnvironmentResponseData environments) { + this.environments.add(environments); + return this; + } + + @java.lang.Override + @JsonSetter(value = "environments", nulls = Nulls.SKIP) + public _FinalStage environments(List environments) { + this.environments.clear(); + if (environments != null) { + this.environments.addAll(environments); + } + 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 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 WhoAmIResponseData build() { + return new WhoAmIResponseData( + accountId, + accountName, + actorType, + apiKeyId, + environmentId, + environments, + stripeUserId, + userId, + userName, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/test/java/com/schematic/api/StreamTest.java b/src/test/java/com/schematic/api/StreamTest.java index 66e7cea..8300aef 100644 --- a/src/test/java/com/schematic/api/StreamTest.java +++ b/src/test/java/com/schematic/api/StreamTest.java @@ -9,6 +9,9 @@ import com.schematic.api.core.Stream; import java.io.IOException; import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -17,8 +20,9 @@ public final class StreamTest { @Test public void testJsonStream() { - List messages = List.of(Map.of("message", "hello"), Map.of("message", "world")); - List jsonStrings = messages.stream().map(StreamTest::mapToJson).collect(Collectors.toList()); + List> messages = + Arrays.asList(createMap("message", "hello"), createMap("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).collect(Collectors.toList()); String input = String.join("\n", jsonStrings); StringReader jsonInput = new StringReader(input); Stream jsonStream = Stream.fromJson(Map.class, jsonInput); @@ -33,8 +37,8 @@ public void testJsonStream() { @Test public void testSseStream() { - List events = List.of(Map.of("event", "start"), Map.of("event", "end")); - List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + List> events = Arrays.asList(createMap("event", "start"), createMap("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); String input = String.join("\n" + "\n", sseStrings); StringReader sseInput = new StringReader(input); Stream sseStream = Stream.fromSse(Map.class, sseInput); @@ -49,8 +53,9 @@ public void testSseStream() { @Test public void testSseStreamWithTerminator() { - List events = List.of(Map.of("message", "first"), Map.of("message", "second")); - List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + List> events = Arrays.asList(createMap("message", "first"), createMap("message", "second")); + List sseStrings = + new ArrayList<>(events.stream().map(StreamTest::mapToSse).collect(Collectors.toList())); sseStrings.add("data: [DONE]"); String input = String.join("\n" + "\n", sseStrings); StringReader sseInput = new StringReader(input); @@ -64,6 +69,25 @@ public void testSseStreamWithTerminator() { assertEquals(expectedEvents, actualEvents); } + @Test + public void testSseEventDiscriminatedStream() { + List sseStrings = Arrays.asList( + mapToSseWithEvent("start", createMap("status", "pending")), + mapToSseWithEvent("end", createMap("status", "complete"))); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSseWithEventDiscrimination(Map.class, sseInput, "event"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + // Event-level discrimination includes the event field in the parsed result + assertTrue(eventData.containsKey("event")); + assertTrue(eventData.containsKey("data")); + } + assertEquals(expectedEvents, actualEvents); + } + @Test public void testStreamResourceManagement() throws IOException { StringReader testInput = new StringReader("{\"test\":\"data\"}"); @@ -83,4 +107,14 @@ private static String mapToJson(Map map) { private static String mapToSse(Map map) { return "data: " + mapToJson(map); } + + private static String mapToSseWithEvent(String eventType, Map data) { + return "event: " + eventType + "\n" + "data: " + mapToJson(data); + } + + private static Map createMap(String key, String value) { + Map map = new HashMap<>(); + map.put(key, value); + return map; + } } From c01b4d50255943d4ea0cb4db7859dc4c413dd596 Mon Sep 17 00:00:00 2001 From: Ben Papillon Date: Tue, 31 Mar 2026 13:02:53 -0700 Subject: [PATCH 2/2] Fix tests --- src/test/java/com/schematic/api/TestSchematic.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/schematic/api/TestSchematic.java b/src/test/java/com/schematic/api/TestSchematic.java index 0830eb9..bf84587 100644 --- a/src/test/java/com/schematic/api/TestSchematic.java +++ b/src/test/java/com/schematic/api/TestSchematic.java @@ -11,6 +11,7 @@ import com.schematic.api.logger.SchematicLogger; import com.schematic.api.resources.features.FeaturesClient; import com.schematic.api.resources.features.types.CheckFlagResponse; +import com.schematic.api.types.CheckFlagRequestBody; import com.schematic.api.types.CheckFlagResponseData; import com.schematic.api.types.EventBodyIdentifyCompany; import java.time.Duration; @@ -49,7 +50,7 @@ void checkFlag_HandlesNullData() { CheckFlagResponse response = mock(CheckFlagResponse.class); when(response.getData()).thenReturn(null); - when(featuresClient.checkFlag(any(), any())).thenReturn(response); + when(featuresClient.checkFlag(any(), any(CheckFlagRequestBody.class))).thenReturn(response); boolean result = spySchematic.checkFlag("test_flag", null, null); @@ -71,7 +72,8 @@ void checkFlag_CachesResultIfNotCached() { .build()) .build(); - when(featuresClient.checkFlag(eq("test_flag"), any())).thenReturn(response); + when(featuresClient.checkFlag(eq("test_flag"), any(CheckFlagRequestBody.class))) + .thenReturn(response); boolean result = spySchematic.checkFlag("test_flag", null, null); @@ -118,7 +120,8 @@ void checkFlag_ReturnsDefaultOnError() { .logger(logger) .build()); when(spySchematic.features()).thenReturn(featuresClient); - when(featuresClient.checkFlag(any(), any())).thenThrow(new RuntimeException("API Error")); + when(featuresClient.checkFlag(any(), any(CheckFlagRequestBody.class))) + .thenThrow(new RuntimeException("API Error")); boolean result = spySchematic.checkFlag("error_flag", null, null);