From 11011c483ed124e356453504b435bef6245c85b2 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Sat, 5 Sep 2026 07:11:40 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-typescript-node-sdk: 3.90.0 --- .fern/metadata.json | 8 +- package.json | 5 +- reference.md | 1047 +++++++++++++++-- src/BaseClient.ts | 4 +- src/api/errors/PaymentRequiredError.ts | 24 + src/api/errors/index.ts | 1 + .../UpdateOnboardingStateRequestBody.ts | 1 + src/api/resources/billing/client/Client.ts | 301 +++++ .../ListCompanyBillingProfilesRequest.ts | 23 + .../UpdateCompanyBillingProfileRequestBody.ts | 18 + .../billing/client/requests/index.ts | 2 + .../types/ListCompanyBillingProfilesParams.ts | 16 + .../ListCompanyBillingProfilesResponse.ts | 9 + .../UpdateCompanyBillingProfileResponse.ts | 9 + src/api/resources/billing/types/index.ts | 3 + src/api/resources/credits/client/Client.ts | 896 ++++++++++++++ .../CountCreditSpendPoliciesRequest.ts | 27 + .../CreateCreditSpendPolicyRequestBody.ts | 19 + .../ListCreditSpendPoliciesRequest.ts | 27 + .../UpdateCreditSpendPolicyRequestBody.ts | 10 + .../credits/client/requests/index.ts | 4 + .../types/CountCreditSpendPoliciesParams.ts | 18 + .../types/CountCreditSpendPoliciesResponse.ts | 9 + .../types/CreateCreditSpendPolicyResponse.ts | 9 + .../types/DeleteCreditSpendPolicyResponse.ts | 9 + .../types/GetCreditSpendPolicyResponse.ts | 9 + .../types/ListCreditSpendPoliciesParams.ts | 18 + .../types/ListCreditSpendPoliciesResponse.ts | 9 + .../types/UpdateCreditSpendPolicyResponse.ts | 9 + src/api/resources/credits/types/index.ts | 8 + src/api/resources/events/client/Client.ts | 382 ++++++ ...psertOtlpEnvironmentSettingsRequestBody.ts | 15 + .../resources/events/client/requests/index.ts | 1 + .../DeleteOtlpEnvironmentSettingsResponse.ts | 9 + .../GetOtlpEnvironmentSettingsResponse.ts | 9 + .../UpsertOtlpEnvironmentSettingsResponse.ts | 9 + src/api/resources/events/types/index.ts | 3 + .../integrationsapi/client/Client.ts | 646 ++++++++++ .../ClaimStripeSandboxKeysRequestBody.ts | 11 + .../InstallStripeSandboxRequestBody.ts | 14 + .../integrationsapi/client/requests/index.ts | 2 + .../types/ClaimStripeSandboxKeysResponse.ts | 9 + .../GetStripeSandboxClaimLinkResponse.ts | 9 + .../types/GetStripeSandboxKeysResponse.ts | 9 + .../InstallStripeClaimableSandboxResponse.ts | 9 + .../ListStripeSandboxCountriesResponse.ts | 9 + .../resources/integrationsapi/types/index.ts | 5 + .../ClaimedStripeSandboxKeysResponseData.ts | 7 + .../CompanyBillingProfileResponseData.ts | 20 + src/api/types/CompanyDetailResponseData.ts | 2 + src/api/types/CompanyOverrideResponseData.ts | 2 + .../types/CreditSpendPolicyResponseData.ts | 15 + src/api/types/CreditSpendPolicyScope.ts | 8 + src/api/types/EventBodyInference.ts | 6 +- src/api/types/GetOnboardingStateResp.ts | 1 + .../OtlpEnvironmentSettingsResponseData.ts | 12 + .../types/RuleConditionDetailResponseData.ts | 1 + .../RuleConditionPlanVersionResponseData.ts | 10 + src/api/types/StripeIntegrationConfig.ts | 6 + src/api/types/StripeSandboxClaimLink.ts | 8 + .../StripeSandboxCountriesResponseData.ts | 5 + .../types/StripeSandboxInstallResponseData.ts | 13 + .../types/StripeSandboxKeysResponseData.ts | 7 + src/api/types/index.ts | 10 + .../UpdateOnboardingStateRequestBody.ts | 2 + .../UpdateCompanyBillingProfileRequestBody.ts | 30 + .../billing/client/requests/index.ts | 1 + .../types/ListCompanyBillingProfilesParams.ts | 27 + .../ListCompanyBillingProfilesResponse.ts | 22 + .../UpdateCompanyBillingProfileResponse.ts | 21 + .../resources/billing/types/index.ts | 3 + .../CreateCreditSpendPolicyRequestBody.ts | 26 + .../UpdateCreditSpendPolicyRequestBody.ts | 20 + .../credits/client/requests/index.ts | 2 + .../types/CountCreditSpendPoliciesParams.ts | 31 + .../types/CountCreditSpendPoliciesResponse.ts | 22 + .../types/CreateCreditSpendPolicyResponse.ts | 21 + .../types/DeleteCreditSpendPolicyResponse.ts | 21 + .../types/GetCreditSpendPolicyResponse.ts | 21 + .../types/ListCreditSpendPoliciesParams.ts | 31 + .../types/ListCreditSpendPoliciesResponse.ts | 22 + .../types/UpdateCreditSpendPolicyResponse.ts | 21 + .../resources/credits/types/index.ts | 8 + ...psertOtlpEnvironmentSettingsRequestBody.ts | 26 + .../resources/events/client/requests/index.ts | 1 + .../DeleteOtlpEnvironmentSettingsResponse.ts | 21 + .../GetOtlpEnvironmentSettingsResponse.ts | 21 + .../UpsertOtlpEnvironmentSettingsResponse.ts | 21 + .../resources/events/types/index.ts | 3 + .../ClaimStripeSandboxKeysRequestBody.ts | 18 + .../InstallStripeSandboxRequestBody.ts | 24 + .../integrationsapi/client/requests/index.ts | 2 + .../types/ClaimStripeSandboxKeysResponse.ts | 21 + .../GetStripeSandboxClaimLinkResponse.ts | 21 + .../types/GetStripeSandboxKeysResponse.ts | 21 + .../InstallStripeClaimableSandboxResponse.ts | 21 + .../ListStripeSandboxCountriesResponse.ts | 21 + .../resources/integrationsapi/types/index.ts | 5 + .../ClaimedStripeSandboxKeysResponseData.ts | 22 + .../CompanyBillingProfileResponseData.ts | 47 + .../types/CompanyDetailResponseData.ts | 8 + .../types/CompanyOverrideResponseData.ts | 5 + .../types/CreditSpendPolicyResponseData.ts | 35 + .../types/CreditSpendPolicyScope.ts | 14 + src/serialization/types/EventBodyInference.ts | 5 + .../types/GetOnboardingStateResp.ts | 2 + .../OtlpEnvironmentSettingsResponseData.ts | 32 + .../types/RuleConditionDetailResponseData.ts | 6 + .../RuleConditionPlanVersionResponseData.ts | 25 + .../types/StripeIntegrationConfig.ts | 12 + .../types/StripeSandboxClaimLink.ts | 24 + .../StripeSandboxCountriesResponseData.ts | 18 + .../types/StripeSandboxInstallResponseData.ts | 32 + .../types/StripeSandboxKeysResponseData.ts | 22 + src/serialization/types/index.ts | 10 + tests/wire/accounts.test.ts | 4 + tests/wire/billing.test.ts | 304 +++++ tests/wire/checkout.test.ts | 144 +++ tests/wire/companies.test.ts | 380 ++++++ tests/wire/components.test.ts | 48 + tests/wire/credits.test.ts | 920 ++++++++++++++- tests/wire/entitlements.test.ts | 654 +++++++++- tests/wire/events.test.ts | 331 ++++++ tests/wire/integrationsapi.test.ts | 661 +++++++++++ tests/wire/plans.test.ts | 106 ++ yarn.lock | 70 +- 126 files changed, 8195 insertions(+), 181 deletions(-) create mode 100644 src/api/errors/PaymentRequiredError.ts create mode 100644 src/api/resources/billing/client/requests/ListCompanyBillingProfilesRequest.ts create mode 100644 src/api/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts create mode 100644 src/api/resources/billing/types/ListCompanyBillingProfilesParams.ts create mode 100644 src/api/resources/billing/types/ListCompanyBillingProfilesResponse.ts create mode 100644 src/api/resources/billing/types/UpdateCompanyBillingProfileResponse.ts create mode 100644 src/api/resources/credits/client/requests/CountCreditSpendPoliciesRequest.ts create mode 100644 src/api/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts create mode 100644 src/api/resources/credits/client/requests/ListCreditSpendPoliciesRequest.ts create mode 100644 src/api/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts create mode 100644 src/api/resources/credits/types/CountCreditSpendPoliciesParams.ts create mode 100644 src/api/resources/credits/types/CountCreditSpendPoliciesResponse.ts create mode 100644 src/api/resources/credits/types/CreateCreditSpendPolicyResponse.ts create mode 100644 src/api/resources/credits/types/DeleteCreditSpendPolicyResponse.ts create mode 100644 src/api/resources/credits/types/GetCreditSpendPolicyResponse.ts create mode 100644 src/api/resources/credits/types/ListCreditSpendPoliciesParams.ts create mode 100644 src/api/resources/credits/types/ListCreditSpendPoliciesResponse.ts create mode 100644 src/api/resources/credits/types/UpdateCreditSpendPolicyResponse.ts create mode 100644 src/api/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts create mode 100644 src/api/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts create mode 100644 src/api/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts create mode 100644 src/api/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts create mode 100644 src/api/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts create mode 100644 src/api/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts create mode 100644 src/api/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts create mode 100644 src/api/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts create mode 100644 src/api/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts create mode 100644 src/api/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts create mode 100644 src/api/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts create mode 100644 src/api/types/ClaimedStripeSandboxKeysResponseData.ts create mode 100644 src/api/types/CompanyBillingProfileResponseData.ts create mode 100644 src/api/types/CreditSpendPolicyResponseData.ts create mode 100644 src/api/types/CreditSpendPolicyScope.ts create mode 100644 src/api/types/OtlpEnvironmentSettingsResponseData.ts create mode 100644 src/api/types/RuleConditionPlanVersionResponseData.ts create mode 100644 src/api/types/StripeSandboxClaimLink.ts create mode 100644 src/api/types/StripeSandboxCountriesResponseData.ts create mode 100644 src/api/types/StripeSandboxInstallResponseData.ts create mode 100644 src/api/types/StripeSandboxKeysResponseData.ts create mode 100644 src/serialization/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts create mode 100644 src/serialization/resources/billing/types/ListCompanyBillingProfilesParams.ts create mode 100644 src/serialization/resources/billing/types/ListCompanyBillingProfilesResponse.ts create mode 100644 src/serialization/resources/billing/types/UpdateCompanyBillingProfileResponse.ts create mode 100644 src/serialization/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts create mode 100644 src/serialization/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts create mode 100644 src/serialization/resources/credits/types/CountCreditSpendPoliciesParams.ts create mode 100644 src/serialization/resources/credits/types/CountCreditSpendPoliciesResponse.ts create mode 100644 src/serialization/resources/credits/types/CreateCreditSpendPolicyResponse.ts create mode 100644 src/serialization/resources/credits/types/DeleteCreditSpendPolicyResponse.ts create mode 100644 src/serialization/resources/credits/types/GetCreditSpendPolicyResponse.ts create mode 100644 src/serialization/resources/credits/types/ListCreditSpendPoliciesParams.ts create mode 100644 src/serialization/resources/credits/types/ListCreditSpendPoliciesResponse.ts create mode 100644 src/serialization/resources/credits/types/UpdateCreditSpendPolicyResponse.ts create mode 100644 src/serialization/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts create mode 100644 src/serialization/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts create mode 100644 src/serialization/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts create mode 100644 src/serialization/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts create mode 100644 src/serialization/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts create mode 100644 src/serialization/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts create mode 100644 src/serialization/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts create mode 100644 src/serialization/types/ClaimedStripeSandboxKeysResponseData.ts create mode 100644 src/serialization/types/CompanyBillingProfileResponseData.ts create mode 100644 src/serialization/types/CreditSpendPolicyResponseData.ts create mode 100644 src/serialization/types/CreditSpendPolicyScope.ts create mode 100644 src/serialization/types/OtlpEnvironmentSettingsResponseData.ts create mode 100644 src/serialization/types/RuleConditionPlanVersionResponseData.ts create mode 100644 src/serialization/types/StripeSandboxClaimLink.ts create mode 100644 src/serialization/types/StripeSandboxCountriesResponseData.ts create mode 100644 src/serialization/types/StripeSandboxInstallResponseData.ts create mode 100644 src/serialization/types/StripeSandboxKeysResponseData.ts diff --git a/.fern/metadata.json b/.fern/metadata.json index c82cc117..c50fd4be 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { "cliVersion": "5.50.0", "generatorName": "fernapi/fern-typescript-node-sdk", - "generatorVersion": "3.88.3", + "generatorVersion": "3.90.0", "generatorConfig": { "allowCustomFetcher": true, "includeApiReference": true, @@ -53,10 +53,10 @@ ] } }, - "originGitCommit": "686551a0297d2f37075b3586b030ff32be5c94f7", + "originGitCommit": "31f498c0a9babdc0eec5ae88e1212a254b2f2561", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "1.5.11", + "requestedVersion": "1.5.12", "ciProvider": "github", - "sdkVersion": "1.5.11" + "sdkVersion": "1.5.12" } diff --git a/package.json b/package.json index 84df190d..d779590c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@schematichq/schematic-typescript-node", - "version": "1.5.11", + "version": "1.5.12", "private": false, "repository": { "type": "git", @@ -57,9 +57,6 @@ "crypto": false, "timers": false }, - "resolutions": { - "undici": "7.29.0" - }, "packageManager": "yarn@1.22.22", "engines": { "node": ">=18.0.0" diff --git a/reference.md b/reference.md index 95eb181f..26f221a5 100644 --- a/reference.md +++ b/reference.md @@ -2382,6 +2382,120 @@ await client.billing.countBillingProducts({ + + + + +
client.billing.listCompanyBillingProfiles({ ...params }) -> Schematic.ListCompanyBillingProfilesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.billing.listCompanyBillingProfiles({ + companyId: "company_id", + isDefault: true, + providerType: "metronome", + limit: 1000000, + offset: 1000000 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.ListCompanyBillingProfilesRequest` + +
+
+ +
+
+ +**requestOptions:** `BillingClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.billing.updateCompanyBillingProfile(billing_profile_id, { ...params }) -> Schematic.UpdateCompanyBillingProfileResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**billing_profile_id:** `string` — billing_profile_id + +
+
+ +
+
+ +**request:** `Schematic.UpdateCompanyBillingProfileRequestBody` + +
+
+ +
+
+ +**requestOptions:** `BillingClient.RequestOptions` + +
+
+
+
+ +
@@ -3991,7 +4105,7 @@ await client.credits.countBillingPlanCreditGrants({ -
client.credits.listCreditEventLedger({ ...params }) -> Schematic.ListCreditEventLedgerResponse +
client.credits.listCreditSpendPolicies({ ...params }) -> Schematic.ListCreditSpendPoliciesResponse
@@ -4004,13 +4118,12 @@ await client.credits.countBillingPlanCreditGrants({
```typescript -await client.credits.listCreditEventLedger({ +await client.credits.listCreditSpendPolicies({ billingCreditId: "billing_credit_id", companyId: "company_id", - endTime: "end_time", - eventType: "grant", - featureId: "feature_id", - startTime: "start_time", + scopeType: "company", + userId: "user_id", + userIds: ["user_ids"], limit: 1000000, offset: 1000000 }); @@ -4029,7 +4142,7 @@ await client.credits.listCreditEventLedger({
-**request:** `Schematic.ListCreditEventLedgerRequest` +**request:** `Schematic.ListCreditSpendPoliciesRequest`
@@ -4049,7 +4162,7 @@ await client.credits.listCreditEventLedger({
-
client.credits.countCreditEventLedger({ ...params }) -> Schematic.CountCreditEventLedgerResponse +
client.credits.createCreditSpendPolicy({ ...params }) -> Schematic.CreateCreditSpendPolicyResponse
@@ -4062,15 +4175,9 @@ await client.credits.listCreditEventLedger({
```typescript -await client.credits.countCreditEventLedger({ +await client.credits.createCreditSpendPolicy({ billingCreditId: "billing_credit_id", - companyId: "company_id", - endTime: "end_time", - eventType: "grant", - featureId: "feature_id", - startTime: "start_time", - limit: 1000000, - offset: 1000000 + maxPerDraw: 1.1 }); ``` @@ -4087,7 +4194,7 @@ await client.credits.countCreditEventLedger({
-**request:** `Schematic.CountCreditEventLedgerRequest` +**request:** `Schematic.CreateCreditSpendPolicyRequestBody`
@@ -4107,8 +4214,7 @@ await client.credits.countCreditEventLedger({
-## catalogs -
client.catalogs.listCatalogs({ ...params }) -> Schematic.ListCatalogsResponse +
client.credits.getCreditSpendPolicy(spend_policy_id) -> Schematic.GetCreditSpendPolicyResponse
@@ -4121,12 +4227,7 @@ await client.credits.countCreditEventLedger({
```typescript -await client.catalogs.listCatalogs({ - isDefault: true, - q: "q", - limit: 1000000, - offset: 1000000 -}); +await client.credits.getCreditSpendPolicy("spend_policy_id"); ```
@@ -4142,7 +4243,7 @@ await client.catalogs.listCatalogs({
-**request:** `Schematic.ListCatalogsRequest` +**spend_policy_id:** `string` — spend_policy_id
@@ -4150,7 +4251,7 @@ await client.catalogs.listCatalogs({
-**requestOptions:** `CatalogsClient.RequestOptions` +**requestOptions:** `CreditsClient.RequestOptions`
@@ -4162,7 +4263,7 @@ await client.catalogs.listCatalogs({
-
client.catalogs.createCatalog({ ...params }) -> Schematic.CreateCatalogResponse +
client.credits.updateCreditSpendPolicy(spend_policy_id, { ...params }) -> Schematic.UpdateCreditSpendPolicyResponse
@@ -4175,9 +4276,7 @@ await client.catalogs.listCatalogs({
```typescript -await client.catalogs.createCatalog({ - name: "name" -}); +await client.credits.updateCreditSpendPolicy("spend_policy_id"); ```
@@ -4193,7 +4292,7 @@ await client.catalogs.createCatalog({
-**request:** `Schematic.CreateCatalogRequestBody` +**spend_policy_id:** `string` — spend_policy_id
@@ -4201,7 +4300,15 @@ await client.catalogs.createCatalog({
-**requestOptions:** `CatalogsClient.RequestOptions` +**request:** `Schematic.UpdateCreditSpendPolicyRequestBody` + +
+
+ +
+
+ +**requestOptions:** `CreditsClient.RequestOptions`
@@ -4213,7 +4320,7 @@ await client.catalogs.createCatalog({
-
client.catalogs.getCatalog(catalog_id) -> Schematic.GetCatalogResponse +
client.credits.deleteCreditSpendPolicy(spend_policy_id) -> Schematic.DeleteCreditSpendPolicyResponse
@@ -4226,7 +4333,7 @@ await client.catalogs.createCatalog({
```typescript -await client.catalogs.getCatalog("catalog_id"); +await client.credits.deleteCreditSpendPolicy("spend_policy_id"); ```
@@ -4242,7 +4349,7 @@ await client.catalogs.getCatalog("catalog_id");
-**catalog_id:** `string` — catalog_id +**spend_policy_id:** `string` — spend_policy_id
@@ -4250,7 +4357,7 @@ await client.catalogs.getCatalog("catalog_id");
-**requestOptions:** `CatalogsClient.RequestOptions` +**requestOptions:** `CreditsClient.RequestOptions`
@@ -4262,7 +4369,7 @@ await client.catalogs.getCatalog("catalog_id");
-
client.catalogs.updateCatalog(catalog_id, { ...params }) -> Schematic.UpdateCatalogResponse +
client.credits.countCreditSpendPolicies({ ...params }) -> Schematic.CountCreditSpendPoliciesResponse
@@ -4275,7 +4382,15 @@ await client.catalogs.getCatalog("catalog_id");
```typescript -await client.catalogs.updateCatalog("catalog_id"); +await client.credits.countCreditSpendPolicies({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + scopeType: "company", + userId: "user_id", + userIds: ["user_ids"], + limit: 1000000, + offset: 1000000 +}); ```
@@ -4291,15 +4406,7 @@ await client.catalogs.updateCatalog("catalog_id");
-**catalog_id:** `string` — catalog_id - -
-
- -
-
- -**request:** `Schematic.UpdateCatalogRequestBody` +**request:** `Schematic.CountCreditSpendPoliciesRequest`
@@ -4307,7 +4414,7 @@ await client.catalogs.updateCatalog("catalog_id");
-**requestOptions:** `CatalogsClient.RequestOptions` +**requestOptions:** `CreditsClient.RequestOptions`
@@ -4319,7 +4426,7 @@ await client.catalogs.updateCatalog("catalog_id");
-
client.catalogs.deleteCatalog(catalog_id) -> Schematic.DeleteCatalogResponse +
client.credits.listCreditEventLedger({ ...params }) -> Schematic.ListCreditEventLedgerResponse
@@ -4332,7 +4439,16 @@ await client.catalogs.updateCatalog("catalog_id");
```typescript -await client.catalogs.deleteCatalog("catalog_id"); +await client.credits.listCreditEventLedger({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + startTime: "start_time", + limit: 1000000, + offset: 1000000 +}); ```
@@ -4348,7 +4464,7 @@ await client.catalogs.deleteCatalog("catalog_id");
-**catalog_id:** `string` — catalog_id +**request:** `Schematic.ListCreditEventLedgerRequest`
@@ -4356,7 +4472,7 @@ await client.catalogs.deleteCatalog("catalog_id");
-**requestOptions:** `CatalogsClient.RequestOptions` +**requestOptions:** `CreditsClient.RequestOptions`
@@ -4368,7 +4484,7 @@ await client.catalogs.deleteCatalog("catalog_id");
-
client.catalogs.getConfiguration(catalog_id) -> Schematic.GetConfigurationResponse +
client.credits.countCreditEventLedger({ ...params }) -> Schematic.CountCreditEventLedgerResponse
@@ -4381,7 +4497,16 @@ await client.catalogs.deleteCatalog("catalog_id");
```typescript -await client.catalogs.getConfiguration("catalog_id"); +await client.credits.countCreditEventLedger({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + startTime: "start_time", + limit: 1000000, + offset: 1000000 +}); ```
@@ -4397,7 +4522,7 @@ await client.catalogs.getConfiguration("catalog_id");
-**catalog_id:** `string` — catalog_id +**request:** `Schematic.CountCreditEventLedgerRequest`
@@ -4405,7 +4530,7 @@ await client.catalogs.getConfiguration("catalog_id");
-**requestOptions:** `CatalogsClient.RequestOptions` +**requestOptions:** `CreditsClient.RequestOptions`
@@ -4417,7 +4542,8 @@ await client.catalogs.getConfiguration("catalog_id");
-
client.catalogs.updateConfiguration(catalog_id, { ...params }) -> Schematic.UpdateConfigurationResponse +## catalogs +
client.catalogs.listCatalogs({ ...params }) -> Schematic.ListCatalogsResponse
@@ -4430,7 +4556,12 @@ await client.catalogs.getConfiguration("catalog_id");
```typescript -await client.catalogs.updateConfiguration("catalog_id"); +await client.catalogs.listCatalogs({ + isDefault: true, + q: "q", + limit: 1000000, + offset: 1000000 +}); ```
@@ -4446,15 +4577,7 @@ await client.catalogs.updateConfiguration("catalog_id");
-**catalog_id:** `string` — catalog_id - -
-
- -
-
- -**request:** `Schematic.UpdateCatalogConfigurationRequestBody` +**request:** `Schematic.ListCatalogsRequest`
@@ -4474,7 +4597,7 @@ await client.catalogs.updateConfiguration("catalog_id");
-
client.catalogs.getCreditBundlesInCatalog(catalog_id) -> Schematic.GetCreditBundlesInCatalogResponse +
client.catalogs.createCatalog({ ...params }) -> Schematic.CreateCatalogResponse
@@ -4487,7 +4610,9 @@ await client.catalogs.updateConfiguration("catalog_id");
```typescript -await client.catalogs.getCreditBundlesInCatalog("catalog_id"); +await client.catalogs.createCatalog({ + name: "name" +}); ```
@@ -4503,7 +4628,7 @@ await client.catalogs.getCreditBundlesInCatalog("catalog_id");
-**catalog_id:** `string` — catalog_id +**request:** `Schematic.CreateCatalogRequestBody`
@@ -4523,7 +4648,7 @@ await client.catalogs.getCreditBundlesInCatalog("catalog_id");
-
client.catalogs.addCreditBundle(catalog_id, credit_bundle_id) -> void +
client.catalogs.getCatalog(catalog_id) -> Schematic.GetCatalogResponse
@@ -4536,7 +4661,7 @@ await client.catalogs.getCreditBundlesInCatalog("catalog_id");
```typescript -await client.catalogs.addCreditBundle("catalog_id", "credit_bundle_id"); +await client.catalogs.getCatalog("catalog_id"); ```
@@ -4560,14 +4685,6 @@ await client.catalogs.addCreditBundle("catalog_id", "credit_bundle_id");
-**credit_bundle_id:** `string` — credit_bundle_id - -
-
- -
-
- **requestOptions:** `CatalogsClient.RequestOptions`
@@ -4580,7 +4697,7 @@ await client.catalogs.addCreditBundle("catalog_id", "credit_bundle_id");
-
client.catalogs.removeCreditBundle(catalog_id, credit_bundle_id) -> void +
client.catalogs.updateCatalog(catalog_id, { ...params }) -> Schematic.UpdateCatalogResponse
@@ -4593,7 +4710,7 @@ await client.catalogs.addCreditBundle("catalog_id", "credit_bundle_id");
```typescript -await client.catalogs.removeCreditBundle("catalog_id", "credit_bundle_id"); +await client.catalogs.updateCatalog("catalog_id"); ```
@@ -4617,7 +4734,7 @@ await client.catalogs.removeCreditBundle("catalog_id", "credit_bundle_id");
-**credit_bundle_id:** `string` — credit_bundle_id +**request:** `Schematic.UpdateCatalogRequestBody`
@@ -4637,7 +4754,7 @@ await client.catalogs.removeCreditBundle("catalog_id", "credit_bundle_id");
-
client.catalogs.getDerivedFeatures(catalog_id) -> Schematic.GetDerivedFeaturesResponse +
client.catalogs.deleteCatalog(catalog_id) -> Schematic.DeleteCatalogResponse
@@ -4650,7 +4767,325 @@ await client.catalogs.removeCreditBundle("catalog_id", "credit_bundle_id");
```typescript -await client.catalogs.getDerivedFeatures("catalog_id"); +await client.catalogs.deleteCatalog("catalog_id"); + +``` +
+
+ + + +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalog_id:** `string` — catalog_id + +
+
+ +
+
+ +**requestOptions:** `CatalogsClient.RequestOptions` + +
+
+
+
+ + + + +
+ +
client.catalogs.getConfiguration(catalog_id) -> Schematic.GetConfigurationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalogs.getConfiguration("catalog_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalog_id:** `string` — catalog_id + +
+
+ +
+
+ +**requestOptions:** `CatalogsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.catalogs.updateConfiguration(catalog_id, { ...params }) -> Schematic.UpdateConfigurationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalogs.updateConfiguration("catalog_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalog_id:** `string` — catalog_id + +
+
+ +
+
+ +**request:** `Schematic.UpdateCatalogConfigurationRequestBody` + +
+
+ +
+
+ +**requestOptions:** `CatalogsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.catalogs.getCreditBundlesInCatalog(catalog_id) -> Schematic.GetCreditBundlesInCatalogResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalogs.getCreditBundlesInCatalog("catalog_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalog_id:** `string` — catalog_id + +
+
+ +
+
+ +**requestOptions:** `CatalogsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.catalogs.addCreditBundle(catalog_id, credit_bundle_id) -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalogs.addCreditBundle("catalog_id", "credit_bundle_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalog_id:** `string` — catalog_id + +
+
+ +
+
+ +**credit_bundle_id:** `string` — credit_bundle_id + +
+
+ +
+
+ +**requestOptions:** `CatalogsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.catalogs.removeCreditBundle(catalog_id, credit_bundle_id) -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalogs.removeCreditBundle("catalog_id", "credit_bundle_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**catalog_id:** `string` — catalog_id + +
+
+ +
+
+ +**credit_bundle_id:** `string` — credit_bundle_id + +
+
+ +
+
+ +**requestOptions:** `CatalogsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.catalogs.getDerivedFeatures(catalog_id) -> Schematic.GetDerivedFeaturesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.catalogs.getDerivedFeatures("catalog_id"); ```
@@ -11008,7 +11443,170 @@ await client.events.createEventBatch({
-
client.events.getEventSummaries({ ...params }) -> Schematic.GetEventSummariesResponse +
client.events.getEventSummaries({ ...params }) -> Schematic.GetEventSummariesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.getEventSummaries({ + q: "q", + eventSubtypes: ["event_subtypes"], + limit: 1000000, + offset: 1000000 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.GetEventSummariesRequest` + +
+
+ +
+
+ +**requestOptions:** `EventsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.events.listEvents({ ...params }) -> Schematic.ListEventsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.listEvents({ + companyId: "company_id", + eventSubtype: "event_subtype", + eventTypes: ["flag_check"], + flagId: "flag_id", + idempotencyKey: "idempotency_key", + userId: "user_id", + limit: 1000000, + offset: 1000000 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.ListEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `EventsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.events.createEvent({ ...params }) -> Schematic.CreateEventResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.createEvent({ + eventType: "flag_check" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.CreateEventRequestBody` + +
+
+ +
+
+ +**requestOptions:** `EventsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.events.getEvent(event_id) -> Schematic.GetEventResponse
@@ -11021,12 +11619,7 @@ await client.events.createEventBatch({
```typescript -await client.events.getEventSummaries({ - q: "q", - eventSubtypes: ["event_subtypes"], - limit: 1000000, - offset: 1000000 -}); +await client.events.getEvent("event_id"); ```
@@ -11042,7 +11635,7 @@ await client.events.getEventSummaries({
-**request:** `Schematic.GetEventSummariesRequest` +**event_id:** `string` — event_id
@@ -11062,7 +11655,7 @@ await client.events.getEventSummaries({
-
client.events.listEvents({ ...params }) -> Schematic.ListEventsResponse +
client.events.getOtlpEnvironmentSettings() -> Schematic.GetOtlpEnvironmentSettingsResponse
@@ -11075,16 +11668,7 @@ await client.events.getEventSummaries({
```typescript -await client.events.listEvents({ - companyId: "company_id", - eventSubtype: "event_subtype", - eventTypes: ["flag_check"], - flagId: "flag_id", - idempotencyKey: "idempotency_key", - userId: "user_id", - limit: 1000000, - offset: 1000000 -}); +await client.events.getOtlpEnvironmentSettings(); ```
@@ -11100,14 +11684,6 @@ await client.events.listEvents({
-**request:** `Schematic.ListEventsRequest` - -
-
- -
-
- **requestOptions:** `EventsClient.RequestOptions`
@@ -11120,7 +11696,7 @@ await client.events.listEvents({
-
client.events.createEvent({ ...params }) -> Schematic.CreateEventResponse +
client.events.upsertOtlpEnvironmentSettings({ ...params }) -> Schematic.UpsertOtlpEnvironmentSettingsResponse
@@ -11133,8 +11709,8 @@ await client.events.listEvents({
```typescript -await client.events.createEvent({ - eventType: "flag_check" +await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true }); ``` @@ -11151,7 +11727,7 @@ await client.events.createEvent({
-**request:** `Schematic.CreateEventRequestBody` +**request:** `Schematic.UpsertOtlpEnvironmentSettingsRequestBody`
@@ -11171,7 +11747,7 @@ await client.events.createEvent({
-
client.events.getEvent(event_id) -> Schematic.GetEventResponse +
client.events.deleteOtlpEnvironmentSettings() -> Schematic.DeleteOtlpEnvironmentSettingsResponse
@@ -11184,7 +11760,7 @@ await client.events.createEvent({
```typescript -await client.events.getEvent("event_id"); +await client.events.deleteOtlpEnvironmentSettings(); ```
@@ -11200,14 +11776,6 @@ await client.events.getEvent("event_id");
-**event_id:** `string` — event_id - -
-
- -
-
- **requestOptions:** `EventsClient.RequestOptions`
@@ -12803,6 +13371,139 @@ await client.integrationsapi.loadSampleDataSet();
+ +
+
+ +
client.integrationsapi.getStripeSandboxClaimLink() -> Schematic.GetStripeSandboxClaimLinkResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.getStripeSandboxClaimLink(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.getStripeSandboxKeys() -> Schematic.GetStripeSandboxKeysResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.getStripeSandboxKeys(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.claimStripeSandboxKeys({ ...params }) -> Schematic.ClaimStripeSandboxKeysResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.claimStripeSandboxKeys({ + token: "token" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.ClaimStripeSandboxKeysRequestBody` + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ +
@@ -12905,6 +13606,98 @@ await client.integrationsapi.installStripe({ + + +
+ +
client.integrationsapi.installStripeClaimableSandbox({ ...params }) -> Schematic.InstallStripeClaimableSandboxResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.installStripeClaimableSandbox({ + email: "email" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.InstallStripeSandboxRequestBody` + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.listStripeSandboxCountries() -> Schematic.ListStripeSandboxCountriesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.listStripeSandboxCountries(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ +
diff --git a/src/BaseClient.ts b/src/BaseClient.ts index 243ba69d..906e05ac 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -66,8 +66,8 @@ export function normalizeClientOptions { + return core.HttpResponsePromise.fromPromise(this.__listCompanyBillingProfiles(request, requestOptions)); + } + + private async __listCompanyBillingProfiles( + request: Schematic.ListCompanyBillingProfilesRequest = {}, + requestOptions?: BillingClient.RequestOptions, + ): Promise> { + const { companyId, isDefault, providerType, limit, offset } = request; + const _queryParams: Record = { + company_id: companyId, + is_default: isDefault, + provider_type: + providerType != null + ? serializers.BillingProviderType.jsonOrThrow(providerType, { unrecognizedObjectKeys: "strip" }) + : undefined, + limit, + offset, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "billing/profiles", + ), + method: "GET", + headers: _headers, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.ListCompanyBillingProfilesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/billing/profiles"); + } + + /** + * @param {string} billing_profile_id - billing_profile_id + * @param {Schematic.UpdateCompanyBillingProfileRequestBody} request + * @param {BillingClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.billing.updateCompanyBillingProfile("billing_profile_id", { + * collectionMethod: "charge_automatically" + * }) + */ + public updateCompanyBillingProfile( + billing_profile_id: string, + request: Schematic.UpdateCompanyBillingProfileRequestBody, + requestOptions?: BillingClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__updateCompanyBillingProfile(billing_profile_id, request, requestOptions), + ); + } + + private async __updateCompanyBillingProfile( + billing_profile_id: string, + request: Schematic.UpdateCompanyBillingProfileRequestBody, + requestOptions?: BillingClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + `billing/profiles/${core.url.encodePathParam(billing_profile_id)}`, + ), + method: "PUT", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: mergeAdditionalBodyParameters( + serializers.UpdateCompanyBillingProfileRequestBody.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + requestOptions?.additionalBodyParameters, + ), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.UpdateCompanyBillingProfileResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PUT", + "/billing/profiles/{billing_profile_id}", + ); + } + /** * @param {Schematic.CreateBillingSubscriptionRequestBody} request * @param {BillingClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/billing/client/requests/ListCompanyBillingProfilesRequest.ts b/src/api/resources/billing/client/requests/ListCompanyBillingProfilesRequest.ts new file mode 100644 index 00000000..56e8f42c --- /dev/null +++ b/src/api/resources/billing/client/requests/ListCompanyBillingProfilesRequest.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * companyId: "company_id", + * isDefault: true, + * providerType: "metronome", + * limit: 1000000, + * offset: 1000000 + * } + */ +export interface ListCompanyBillingProfilesRequest { + companyId?: string; + isDefault?: boolean; + providerType?: Schematic.BillingProviderType; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; +} diff --git a/src/api/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts b/src/api/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts new file mode 100644 index 00000000..690249ec --- /dev/null +++ b/src/api/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * collectionMethod: "charge_automatically" + * } + */ +export interface UpdateCompanyBillingProfileRequestBody { + collectionMethod: Schematic.BillingCollectionMethod; + daysUntilDue?: number; + isDefault?: boolean; + name?: string; + paymentMethodId?: string; + prorationBehavior?: Schematic.ProrationBehavior; +} diff --git a/src/api/resources/billing/client/requests/index.ts b/src/api/resources/billing/client/requests/index.ts index fc3aa928..9ebade65 100644 --- a/src/api/resources/billing/client/requests/index.ts +++ b/src/api/resources/billing/client/requests/index.ts @@ -11,8 +11,10 @@ export type { CreatePaymentMethodRequestBody } from "./CreatePaymentMethodReques export type { ListBillingPricesRequest } from "./ListBillingPricesRequest"; export type { ListBillingProductPricesRequest } from "./ListBillingProductPricesRequest"; export type { ListBillingProductsRequest } from "./ListBillingProductsRequest"; +export type { ListCompanyBillingProfilesRequest } from "./ListCompanyBillingProfilesRequest"; export type { ListCouponsRequest } from "./ListCouponsRequest"; export type { ListCustomersWithSubscriptionsRequest } from "./ListCustomersWithSubscriptionsRequest"; export type { ListInvoicesRequest } from "./ListInvoicesRequest"; export type { ListMetersRequest } from "./ListMetersRequest"; export type { ListPaymentMethodsRequest } from "./ListPaymentMethodsRequest"; +export type { UpdateCompanyBillingProfileRequestBody } from "./UpdateCompanyBillingProfileRequestBody"; diff --git a/src/api/resources/billing/types/ListCompanyBillingProfilesParams.ts b/src/api/resources/billing/types/ListCompanyBillingProfilesParams.ts new file mode 100644 index 00000000..b17a1b1a --- /dev/null +++ b/src/api/resources/billing/types/ListCompanyBillingProfilesParams.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface ListCompanyBillingProfilesParams { + companyId?: string; + isDefault?: boolean; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + providerType?: Schematic.BillingProviderType; +} diff --git a/src/api/resources/billing/types/ListCompanyBillingProfilesResponse.ts b/src/api/resources/billing/types/ListCompanyBillingProfilesResponse.ts new file mode 100644 index 00000000..63ae1bab --- /dev/null +++ b/src/api/resources/billing/types/ListCompanyBillingProfilesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ListCompanyBillingProfilesResponse { + data: Schematic.CompanyBillingProfileResponseData[]; + /** Input parameters */ + params: Schematic.ListCompanyBillingProfilesParams; +} diff --git a/src/api/resources/billing/types/UpdateCompanyBillingProfileResponse.ts b/src/api/resources/billing/types/UpdateCompanyBillingProfileResponse.ts new file mode 100644 index 00000000..c047c38b --- /dev/null +++ b/src/api/resources/billing/types/UpdateCompanyBillingProfileResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface UpdateCompanyBillingProfileResponse { + data: Schematic.CompanyBillingProfileResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/billing/types/index.ts b/src/api/resources/billing/types/index.ts index 7e9332c9..5fa2d7b3 100644 --- a/src/api/resources/billing/types/index.ts +++ b/src/api/resources/billing/types/index.ts @@ -14,6 +14,8 @@ export * from "./ListBillingProductPricesParams"; export * from "./ListBillingProductPricesResponse"; export * from "./ListBillingProductsParams"; export * from "./ListBillingProductsResponse"; +export * from "./ListCompanyBillingProfilesParams"; +export * from "./ListCompanyBillingProfilesResponse"; export * from "./ListCouponsParams"; export * from "./ListCouponsResponse"; export * from "./ListCustomersWithSubscriptionsParams"; @@ -24,6 +26,7 @@ export * from "./ListMetersParams"; export * from "./ListMetersResponse"; export * from "./ListPaymentMethodsParams"; export * from "./ListPaymentMethodsResponse"; +export * from "./UpdateCompanyBillingProfileResponse"; export * from "./UpsertBillingCouponResponse"; export * from "./UpsertBillingCustomerResponse"; export * from "./UpsertBillingMeterResponse"; diff --git a/src/api/resources/credits/client/Client.ts b/src/api/resources/credits/client/Client.ts index 7428e3ad..53f1f50a 100644 --- a/src/api/resources/credits/client/Client.ts +++ b/src/api/resources/credits/client/Client.ts @@ -2764,6 +2764,7 @@ export class CreditsClient { * * @throws {@link Schematic.BadRequestError} * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.PaymentRequiredError} * @throws {@link Schematic.ForbiddenError} * @throws {@link Schematic.NotFoundError} * @throws {@link Schematic.InternalServerError} @@ -2853,6 +2854,17 @@ export class CreditsClient { }), _response.rawResponse, ); + case 402: + throw new Schematic.PaymentRequiredError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); case 403: throw new Schematic.ForbiddenError( serializers.ApiError.parseOrThrow(_response.error.body, { @@ -2905,6 +2917,7 @@ export class CreditsClient { * * @throws {@link Schematic.BadRequestError} * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.PaymentRequiredError} * @throws {@link Schematic.ForbiddenError} * @throws {@link Schematic.NotFoundError} * @throws {@link Schematic.InternalServerError} @@ -2994,6 +3007,17 @@ export class CreditsClient { }), _response.rawResponse, ); + case 402: + throw new Schematic.PaymentRequiredError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); case 403: throw new Schematic.ForbiddenError( serializers.ApiError.parseOrThrow(_response.error.body, { @@ -4073,6 +4097,878 @@ export class CreditsClient { ); } + /** + * @param {Schematic.ListCreditSpendPoliciesRequest} request + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.credits.listCreditSpendPolicies({ + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * scopeType: "company", + * userId: "user_id", + * userIds: ["user_ids"], + * limit: 1000000, + * offset: 1000000 + * }) + */ + public listCreditSpendPolicies( + request: Schematic.ListCreditSpendPoliciesRequest = {}, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listCreditSpendPolicies(request, requestOptions)); + } + + private async __listCreditSpendPolicies( + request: Schematic.ListCreditSpendPoliciesRequest = {}, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const { billingCreditId, companyId, scopeType, userId, userIds, limit, offset } = request; + const _queryParams: Record = { + billing_credit_id: billingCreditId, + company_id: companyId, + scope_type: + scopeType != null + ? serializers.CreditSpendPolicyScope.jsonOrThrow(scopeType, { unrecognizedObjectKeys: "strip" }) + : undefined, + user_id: userId, + user_ids: userIds, + limit, + offset, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "billing/credits/spend-policies", + ), + method: "GET", + headers: _headers, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.ListCreditSpendPoliciesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/billing/credits/spend-policies", + ); + } + + /** + * @param {Schematic.CreateCreditSpendPolicyRequestBody} request + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.credits.createCreditSpendPolicy({ + * billingCreditId: "billing_credit_id", + * maxPerDraw: 1.1 + * }) + */ + public createCreditSpendPolicy( + request: Schematic.CreateCreditSpendPolicyRequestBody, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createCreditSpendPolicy(request, requestOptions)); + } + + private async __createCreditSpendPolicy( + request: Schematic.CreateCreditSpendPolicyRequestBody, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "billing/credits/spend-policies", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: mergeAdditionalBodyParameters( + serializers.CreateCreditSpendPolicyRequestBody.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + requestOptions?.additionalBodyParameters, + ), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.CreateCreditSpendPolicyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/billing/credits/spend-policies", + ); + } + + /** + * @param {string} spend_policy_id - spend_policy_id + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.credits.getCreditSpendPolicy("spend_policy_id") + */ + public getCreditSpendPolicy( + spend_policy_id: string, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getCreditSpendPolicy(spend_policy_id, requestOptions)); + } + + private async __getCreditSpendPolicy( + spend_policy_id: string, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + `billing/credits/spend-policies/${core.url.encodePathParam(spend_policy_id)}`, + ), + method: "GET", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.GetCreditSpendPolicyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/billing/credits/spend-policies/{spend_policy_id}", + ); + } + + /** + * @param {string} spend_policy_id - spend_policy_id + * @param {Schematic.UpdateCreditSpendPolicyRequestBody} request + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.credits.updateCreditSpendPolicy("spend_policy_id") + */ + public updateCreditSpendPolicy( + spend_policy_id: string, + request: Schematic.UpdateCreditSpendPolicyRequestBody = {}, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__updateCreditSpendPolicy(spend_policy_id, request, requestOptions), + ); + } + + private async __updateCreditSpendPolicy( + spend_policy_id: string, + request: Schematic.UpdateCreditSpendPolicyRequestBody = {}, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + `billing/credits/spend-policies/${core.url.encodePathParam(spend_policy_id)}`, + ), + method: "PUT", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: mergeAdditionalBodyParameters( + serializers.UpdateCreditSpendPolicyRequestBody.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + requestOptions?.additionalBodyParameters, + ), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.UpdateCreditSpendPolicyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PUT", + "/billing/credits/spend-policies/{spend_policy_id}", + ); + } + + /** + * @param {string} spend_policy_id - spend_policy_id + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.credits.deleteCreditSpendPolicy("spend_policy_id") + */ + public deleteCreditSpendPolicy( + spend_policy_id: string, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteCreditSpendPolicy(spend_policy_id, requestOptions)); + } + + private async __deleteCreditSpendPolicy( + spend_policy_id: string, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + `billing/credits/spend-policies/${core.url.encodePathParam(spend_policy_id)}`, + ), + method: "DELETE", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.DeleteCreditSpendPolicyResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/billing/credits/spend-policies/{spend_policy_id}", + ); + } + + /** + * @param {Schematic.CountCreditSpendPoliciesRequest} request + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.credits.countCreditSpendPolicies({ + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * scopeType: "company", + * userId: "user_id", + * userIds: ["user_ids"], + * limit: 1000000, + * offset: 1000000 + * }) + */ + public countCreditSpendPolicies( + request: Schematic.CountCreditSpendPoliciesRequest = {}, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__countCreditSpendPolicies(request, requestOptions)); + } + + private async __countCreditSpendPolicies( + request: Schematic.CountCreditSpendPoliciesRequest = {}, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const { billingCreditId, companyId, scopeType, userId, userIds, limit, offset } = request; + const _queryParams: Record = { + billing_credit_id: billingCreditId, + company_id: companyId, + scope_type: + scopeType != null + ? serializers.CreditSpendPolicyScope.jsonOrThrow(scopeType, { unrecognizedObjectKeys: "strip" }) + : undefined, + user_id: userId, + user_ids: userIds, + limit, + offset, + }; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "billing/credits/spend-policies/count", + ), + method: "GET", + headers: _headers, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.CountCreditSpendPoliciesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/billing/credits/spend-policies/count", + ); + } + /** * @param {Schematic.ListCreditEventLedgerRequest} request * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/credits/client/requests/CountCreditSpendPoliciesRequest.ts b/src/api/resources/credits/client/requests/CountCreditSpendPoliciesRequest.ts new file mode 100644 index 00000000..82a6de7d --- /dev/null +++ b/src/api/resources/credits/client/requests/CountCreditSpendPoliciesRequest.ts @@ -0,0 +1,27 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * scopeType: "company", + * userId: "user_id", + * userIds: ["user_ids"], + * limit: 1000000, + * offset: 1000000 + * } + */ +export interface CountCreditSpendPoliciesRequest { + billingCreditId?: string; + companyId?: string; + scopeType?: Schematic.CreditSpendPolicyScope; + userId?: string; + userIds?: string | string[]; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; +} diff --git a/src/api/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts b/src/api/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts new file mode 100644 index 00000000..60a28c83 --- /dev/null +++ b/src/api/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * billingCreditId: "billing_credit_id", + * maxPerDraw: 1.1 + * } + */ +export interface CreateCreditSpendPolicyRequestBody { + billingCreditId: string; + /** The company the cap applies to. Set exactly one of company_id and user_id. */ + companyId?: string; + label?: string; + /** The largest number of credits a single draw may spend. */ + maxPerDraw: number; + /** The user the cap applies to. Set exactly one of company_id and user_id. */ + userId?: string; +} diff --git a/src/api/resources/credits/client/requests/ListCreditSpendPoliciesRequest.ts b/src/api/resources/credits/client/requests/ListCreditSpendPoliciesRequest.ts new file mode 100644 index 00000000..19f11ae6 --- /dev/null +++ b/src/api/resources/credits/client/requests/ListCreditSpendPoliciesRequest.ts @@ -0,0 +1,27 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * scopeType: "company", + * userId: "user_id", + * userIds: ["user_ids"], + * limit: 1000000, + * offset: 1000000 + * } + */ +export interface ListCreditSpendPoliciesRequest { + billingCreditId?: string; + companyId?: string; + scopeType?: Schematic.CreditSpendPolicyScope; + userId?: string; + userIds?: string | string[]; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; +} diff --git a/src/api/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts b/src/api/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts new file mode 100644 index 00000000..243af906 --- /dev/null +++ b/src/api/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * {} + */ +export interface UpdateCreditSpendPolicyRequestBody { + label?: string; + maxPerDraw?: number; +} diff --git a/src/api/resources/credits/client/requests/index.ts b/src/api/resources/credits/client/requests/index.ts index 3c019166..3da0aed6 100644 --- a/src/api/resources/credits/client/requests/index.ts +++ b/src/api/resources/credits/client/requests/index.ts @@ -5,9 +5,11 @@ export type { CountBillingPlanCreditGrantsRequest } from "./CountBillingPlanCred export type { CountCompanyGrantsRequest } from "./CountCompanyGrantsRequest"; export type { CountCreditBundlesRequest } from "./CountCreditBundlesRequest"; export type { CountCreditEventLedgerRequest } from "./CountCreditEventLedgerRequest"; +export type { CountCreditSpendPoliciesRequest } from "./CountCreditSpendPoliciesRequest"; export type { CreateBillingCreditRequestBody } from "./CreateBillingCreditRequestBody"; export type { CreateCompanyCreditGrant } from "./CreateCompanyCreditGrant"; export type { CreateCreditBundleRequestBody } from "./CreateCreditBundleRequestBody"; +export type { CreateCreditSpendPolicyRequestBody } from "./CreateCreditSpendPolicyRequestBody"; export type { DeleteBillingPlanCreditGrantRequest } from "./DeleteBillingPlanCreditGrantRequest"; export type { ExtendCreditLeaseRequestBody } from "./ExtendCreditLeaseRequestBody"; export type { ListBillingCreditsRequest } from "./ListBillingCreditsRequest"; @@ -16,7 +18,9 @@ export type { ListCompanyCreditBalancesRequest } from "./ListCompanyCreditBalanc export type { ListCompanyGrantsRequest } from "./ListCompanyGrantsRequest"; export type { ListCreditBundlesRequest } from "./ListCreditBundlesRequest"; export type { ListCreditEventLedgerRequest } from "./ListCreditEventLedgerRequest"; +export type { ListCreditSpendPoliciesRequest } from "./ListCreditSpendPoliciesRequest"; export type { ListGrantsForCreditRequest } from "./ListGrantsForCreditRequest"; export type { UpdateBillingCreditRequestBody } from "./UpdateBillingCreditRequestBody"; export type { UpdateCreditBundleDetailsRequestBody } from "./UpdateCreditBundleDetailsRequestBody"; +export type { UpdateCreditSpendPolicyRequestBody } from "./UpdateCreditSpendPolicyRequestBody"; export type { ZeroOutGrantRequestBody } from "./ZeroOutGrantRequestBody"; diff --git a/src/api/resources/credits/types/CountCreditSpendPoliciesParams.ts b/src/api/resources/credits/types/CountCreditSpendPoliciesParams.ts new file mode 100644 index 00000000..f69267d2 --- /dev/null +++ b/src/api/resources/credits/types/CountCreditSpendPoliciesParams.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface CountCreditSpendPoliciesParams { + billingCreditId?: string; + companyId?: string; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + scopeType?: Schematic.CreditSpendPolicyScope; + userId?: string; + userIds?: string[]; +} diff --git a/src/api/resources/credits/types/CountCreditSpendPoliciesResponse.ts b/src/api/resources/credits/types/CountCreditSpendPoliciesResponse.ts new file mode 100644 index 00000000..7fc50bdc --- /dev/null +++ b/src/api/resources/credits/types/CountCreditSpendPoliciesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface CountCreditSpendPoliciesResponse { + data: Schematic.CountResponse; + /** Input parameters */ + params: Schematic.CountCreditSpendPoliciesParams; +} diff --git a/src/api/resources/credits/types/CreateCreditSpendPolicyResponse.ts b/src/api/resources/credits/types/CreateCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..f7f21416 --- /dev/null +++ b/src/api/resources/credits/types/CreateCreditSpendPolicyResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface CreateCreditSpendPolicyResponse { + data: Schematic.CreditSpendPolicyResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/credits/types/DeleteCreditSpendPolicyResponse.ts b/src/api/resources/credits/types/DeleteCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..4ae4b8e4 --- /dev/null +++ b/src/api/resources/credits/types/DeleteCreditSpendPolicyResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface DeleteCreditSpendPolicyResponse { + data: Schematic.DeleteResponse; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/credits/types/GetCreditSpendPolicyResponse.ts b/src/api/resources/credits/types/GetCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..f03ff954 --- /dev/null +++ b/src/api/resources/credits/types/GetCreditSpendPolicyResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetCreditSpendPolicyResponse { + data: Schematic.CreditSpendPolicyResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/credits/types/ListCreditSpendPoliciesParams.ts b/src/api/resources/credits/types/ListCreditSpendPoliciesParams.ts new file mode 100644 index 00000000..862184b3 --- /dev/null +++ b/src/api/resources/credits/types/ListCreditSpendPoliciesParams.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface ListCreditSpendPoliciesParams { + billingCreditId?: string; + companyId?: string; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + scopeType?: Schematic.CreditSpendPolicyScope; + userId?: string; + userIds?: string[]; +} diff --git a/src/api/resources/credits/types/ListCreditSpendPoliciesResponse.ts b/src/api/resources/credits/types/ListCreditSpendPoliciesResponse.ts new file mode 100644 index 00000000..2b91160b --- /dev/null +++ b/src/api/resources/credits/types/ListCreditSpendPoliciesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ListCreditSpendPoliciesResponse { + data: Schematic.CreditSpendPolicyResponseData[]; + /** Input parameters */ + params: Schematic.ListCreditSpendPoliciesParams; +} diff --git a/src/api/resources/credits/types/UpdateCreditSpendPolicyResponse.ts b/src/api/resources/credits/types/UpdateCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..1b3e908c --- /dev/null +++ b/src/api/resources/credits/types/UpdateCreditSpendPolicyResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface UpdateCreditSpendPolicyResponse { + data: Schematic.CreditSpendPolicyResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/credits/types/index.ts b/src/api/resources/credits/types/index.ts index 2e92a33a..f55d471c 100644 --- a/src/api/resources/credits/types/index.ts +++ b/src/api/resources/credits/types/index.ts @@ -11,14 +11,19 @@ export * from "./CountCreditBundlesParams"; export * from "./CountCreditBundlesResponse"; export * from "./CountCreditEventLedgerParams"; export * from "./CountCreditEventLedgerResponse"; +export * from "./CountCreditSpendPoliciesParams"; +export * from "./CountCreditSpendPoliciesResponse"; export * from "./CreateBillingCreditResponse"; export * from "./CreateBillingPlanCreditGrantResponse"; export * from "./CreateCreditBundleResponse"; +export * from "./CreateCreditSpendPolicyResponse"; export * from "./DeleteBillingPlanCreditGrantParams"; export * from "./DeleteBillingPlanCreditGrantResponse"; export * from "./DeleteCreditBundleResponse"; +export * from "./DeleteCreditSpendPolicyResponse"; export * from "./ExtendCreditLeaseResponse"; export * from "./GetCreditBundleResponse"; +export * from "./GetCreditSpendPolicyResponse"; export * from "./GetSingleBillingCreditResponse"; export * from "./GetSingleBillingPlanCreditGrantResponse"; export * from "./GrantBillingCreditsToCompanyResponse"; @@ -34,6 +39,8 @@ export * from "./ListCreditBundlesParams"; export * from "./ListCreditBundlesResponse"; export * from "./ListCreditEventLedgerParams"; export * from "./ListCreditEventLedgerResponse"; +export * from "./ListCreditSpendPoliciesParams"; +export * from "./ListCreditSpendPoliciesResponse"; export * from "./ListGrantsForCreditParams"; export * from "./ListGrantsForCreditResponse"; export * from "./ReleaseCreditLeaseResponse"; @@ -41,4 +48,5 @@ export * from "./SoftDeleteBillingCreditResponse"; export * from "./UpdateBillingCreditResponse"; export * from "./UpdateBillingPlanCreditGrantResponse"; export * from "./UpdateCreditBundleDetailsResponse"; +export * from "./UpdateCreditSpendPolicyResponse"; export * from "./ZeroOutGrantResponse"; diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index 8ab61512..71a9bccd 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -724,6 +724,388 @@ export class EventsClient { return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/events/{event_id}"); } + /** + * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.events.getOtlpEnvironmentSettings() + */ + public getOtlpEnvironmentSettings( + requestOptions?: EventsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getOtlpEnvironmentSettings(requestOptions)); + } + + private async __getOtlpEnvironmentSettings( + requestOptions?: EventsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "otlp/settings", + ), + method: "GET", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.GetOtlpEnvironmentSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/otlp/settings"); + } + + /** + * @param {Schematic.UpsertOtlpEnvironmentSettingsRequestBody} request + * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.events.upsertOtlpEnvironmentSettings({ + * toolEventsEnabled: true + * }) + */ + public upsertOtlpEnvironmentSettings( + request: Schematic.UpsertOtlpEnvironmentSettingsRequestBody, + requestOptions?: EventsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__upsertOtlpEnvironmentSettings(request, requestOptions)); + } + + private async __upsertOtlpEnvironmentSettings( + request: Schematic.UpsertOtlpEnvironmentSettingsRequestBody, + requestOptions?: EventsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "otlp/settings", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: mergeAdditionalBodyParameters( + serializers.UpsertOtlpEnvironmentSettingsRequestBody.jsonOrThrow(request, { + unrecognizedObjectKeys: "strip", + }), + requestOptions?.additionalBodyParameters, + ), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.UpsertOtlpEnvironmentSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/otlp/settings"); + } + + /** + * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.events.deleteOtlpEnvironmentSettings() + */ + public deleteOtlpEnvironmentSettings( + requestOptions?: EventsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteOtlpEnvironmentSettings(requestOptions)); + } + + private async __deleteOtlpEnvironmentSettings( + requestOptions?: EventsClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "otlp/settings", + ), + method: "DELETE", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.DeleteOtlpEnvironmentSettingsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/otlp/settings"); + } + /** * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. * diff --git a/src/api/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts b/src/api/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts new file mode 100644 index 00000000..1e19c220 --- /dev/null +++ b/src/api/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * toolEventsEnabled: true + * } + */ +export interface UpsertOtlpEnvironmentSettingsRequestBody { + companyAttribute?: string; + companyKey?: string; + toolEventsEnabled: boolean; + userAttribute?: string; + userKey?: string; +} diff --git a/src/api/resources/events/client/requests/index.ts b/src/api/resources/events/client/requests/index.ts index 5a36c08e..2a53be06 100644 --- a/src/api/resources/events/client/requests/index.ts +++ b/src/api/resources/events/client/requests/index.ts @@ -1,3 +1,4 @@ export type { CreateEventBatchRequestBody } from "./CreateEventBatchRequestBody"; export type { GetEventSummariesRequest } from "./GetEventSummariesRequest"; export type { ListEventsRequest } from "./ListEventsRequest"; +export type { UpsertOtlpEnvironmentSettingsRequestBody } from "./UpsertOtlpEnvironmentSettingsRequestBody"; diff --git a/src/api/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts b/src/api/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts new file mode 100644 index 00000000..329f8016 --- /dev/null +++ b/src/api/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface DeleteOtlpEnvironmentSettingsResponse { + data: Schematic.DeleteResponse; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts b/src/api/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts new file mode 100644 index 00000000..91c48f48 --- /dev/null +++ b/src/api/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetOtlpEnvironmentSettingsResponse { + data: Schematic.OtlpEnvironmentSettingsResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts b/src/api/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts new file mode 100644 index 00000000..e7b47969 --- /dev/null +++ b/src/api/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface UpsertOtlpEnvironmentSettingsResponse { + data: Schematic.OtlpEnvironmentSettingsResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/events/types/index.ts b/src/api/resources/events/types/index.ts index 421f16fb..3ed83d82 100644 --- a/src/api/resources/events/types/index.ts +++ b/src/api/resources/events/types/index.ts @@ -1,8 +1,11 @@ export * from "./CreateEventBatchResponse"; export * from "./CreateEventResponse"; +export * from "./DeleteOtlpEnvironmentSettingsResponse"; export * from "./GetEventResponse"; export * from "./GetEventSummariesParams"; export * from "./GetEventSummariesResponse"; +export * from "./GetOtlpEnvironmentSettingsResponse"; export * from "./GetSegmentIntegrationStatusResponse"; export * from "./ListEventsParams"; export * from "./ListEventsResponse"; +export * from "./UpsertOtlpEnvironmentSettingsResponse"; diff --git a/src/api/resources/integrationsapi/client/Client.ts b/src/api/resources/integrationsapi/client/Client.ts index 5143f235..e22d0317 100644 --- a/src/api/resources/integrationsapi/client/Client.ts +++ b/src/api/resources/integrationsapi/client/Client.ts @@ -829,6 +829,389 @@ export class IntegrationsapiClient { ); } + /** + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.integrationsapi.getStripeSandboxClaimLink() + */ + public getStripeSandboxClaimLink( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getStripeSandboxClaimLink(requestOptions)); + } + + private async __getStripeSandboxClaimLink( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "integrations/stripe/sandbox/claim-link", + ), + method: "GET", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.GetStripeSandboxClaimLinkResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/integrations/stripe/sandbox/claim-link", + ); + } + + /** + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.integrationsapi.getStripeSandboxKeys() + */ + public getStripeSandboxKeys( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getStripeSandboxKeys(requestOptions)); + } + + private async __getStripeSandboxKeys( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "integrations/stripe/sandbox/keys", + ), + method: "GET", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.GetStripeSandboxKeysResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/integrations/stripe/sandbox/keys", + ); + } + + /** + * @param {Schematic.ClaimStripeSandboxKeysRequestBody} request + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.integrationsapi.claimStripeSandboxKeys({ + * token: "token" + * }) + */ + public claimStripeSandboxKeys( + request: Schematic.ClaimStripeSandboxKeysRequestBody, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__claimStripeSandboxKeys(request, requestOptions)); + } + + private async __claimStripeSandboxKeys( + request: Schematic.ClaimStripeSandboxKeysRequestBody, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "integrations/stripe/sandbox/keys/claim", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: mergeAdditionalBodyParameters( + serializers.ClaimStripeSandboxKeysRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestOptions?.additionalBodyParameters, + ), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.ClaimStripeSandboxKeysResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/integrations/stripe/sandbox/keys/claim", + ); + } + /** * @param {Schematic.InstallIntegrationRequestBody} request * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. @@ -1115,6 +1498,269 @@ export class IntegrationsapiClient { ); } + /** + * @param {Schematic.InstallStripeSandboxRequestBody} request + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.integrationsapi.installStripeClaimableSandbox({ + * email: "email" + * }) + */ + public installStripeClaimableSandbox( + request: Schematic.InstallStripeSandboxRequestBody, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__installStripeClaimableSandbox(request, requestOptions)); + } + + private async __installStripeClaimableSandbox( + request: Schematic.InstallStripeSandboxRequestBody, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "integrations/stripe/v2/sandbox", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: mergeAdditionalBodyParameters( + serializers.InstallStripeSandboxRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + requestOptions?.additionalBodyParameters, + ), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.InstallStripeClaimableSandboxResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/integrations/stripe/v2/sandbox", + ); + } + + /** + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * @throws {@link errors.SchematicError} + * @throws {@link errors.SchematicTimeoutError} + * + * @example + * await client.integrationsapi.listStripeSandboxCountries() + */ + public listStripeSandboxCountries( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listStripeSandboxCountries(requestOptions)); + } + + private async __listStripeSandboxCountries( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "integrations/stripe/v2/sandbox-countries", + ), + method: "GET", + headers: _headers, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.ListStripeSandboxCountriesResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/integrations/stripe/v2/sandbox-countries", + ); + } + /** * @param {string} integration_id - integration_id * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts b/src/api/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts new file mode 100644 index 00000000..2dbe821d --- /dev/null +++ b/src/api/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * token: "token" + * } + */ +export interface ClaimStripeSandboxKeysRequestBody { + token: string; +} diff --git a/src/api/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts b/src/api/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts new file mode 100644 index 00000000..7bcde347 --- /dev/null +++ b/src/api/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * email: "email" + * } + */ +export interface InstallStripeSandboxRequestBody { + country?: string; + email: string; + name?: string; + seedSampleData?: boolean; +} diff --git a/src/api/resources/integrationsapi/client/requests/index.ts b/src/api/resources/integrationsapi/client/requests/index.ts index c4031dc4..eba3e6b5 100644 --- a/src/api/resources/integrationsapi/client/requests/index.ts +++ b/src/api/resources/integrationsapi/client/requests/index.ts @@ -1,2 +1,4 @@ +export type { ClaimStripeSandboxKeysRequestBody } from "./ClaimStripeSandboxKeysRequestBody"; +export type { InstallStripeSandboxRequestBody } from "./InstallStripeSandboxRequestBody"; export type { ListIntegrationsRequest } from "./ListIntegrationsRequest"; export type { StartDataImportRequestBody } from "./StartDataImportRequestBody"; diff --git a/src/api/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts b/src/api/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts new file mode 100644 index 00000000..04e8c07f --- /dev/null +++ b/src/api/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ClaimStripeSandboxKeysResponse { + data: Schematic.ClaimedStripeSandboxKeysResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts b/src/api/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts new file mode 100644 index 00000000..b8403e32 --- /dev/null +++ b/src/api/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetStripeSandboxClaimLinkResponse { + data: Schematic.StripeSandboxClaimLink; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts b/src/api/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts new file mode 100644 index 00000000..5a061ef2 --- /dev/null +++ b/src/api/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetStripeSandboxKeysResponse { + data: Schematic.ClaimedStripeSandboxKeysResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts b/src/api/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts new file mode 100644 index 00000000..06dff8dc --- /dev/null +++ b/src/api/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface InstallStripeClaimableSandboxResponse { + data: Schematic.StripeSandboxInstallResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts b/src/api/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts new file mode 100644 index 00000000..31739cae --- /dev/null +++ b/src/api/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ListStripeSandboxCountriesResponse { + data: Schematic.StripeSandboxCountriesResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/index.ts b/src/api/resources/integrationsapi/types/index.ts index 3c4b71a4..3835c1ba 100644 --- a/src/api/resources/integrationsapi/types/index.ts +++ b/src/api/resources/integrationsapi/types/index.ts @@ -1,9 +1,14 @@ export * from "./AssumeStripeInstalledResponse"; +export * from "./ClaimStripeSandboxKeysResponse"; export * from "./GetIntegrationWebhookUrlResponse"; +export * from "./GetStripeSandboxClaimLinkResponse"; +export * from "./GetStripeSandboxKeysResponse"; export * from "./InstallIntegrationResponse"; +export * from "./InstallStripeClaimableSandboxResponse"; export * from "./InstallStripeResponse"; export * from "./ListIntegrationsParams"; export * from "./ListIntegrationsResponse"; +export * from "./ListStripeSandboxCountriesResponse"; export * from "./LoadSampleDataSetResponse"; export * from "./RunIntegrationResponse"; export * from "./StartDataImportResponse"; diff --git a/src/api/types/ClaimedStripeSandboxKeysResponseData.ts b/src/api/types/ClaimedStripeSandboxKeysResponseData.ts new file mode 100644 index 00000000..90342d33 --- /dev/null +++ b/src/api/types/ClaimedStripeSandboxKeysResponseData.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface ClaimedStripeSandboxKeysResponseData { + publishable: string; + sandboxId: string; + secret: string; +} diff --git a/src/api/types/CompanyBillingProfileResponseData.ts b/src/api/types/CompanyBillingProfileResponseData.ts new file mode 100644 index 00000000..61f81774 --- /dev/null +++ b/src/api/types/CompanyBillingProfileResponseData.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface CompanyBillingProfileResponseData { + accountId: string; + billingCustomerId?: string; + collectionMethod: Schematic.BillingCollectionMethod; + companyId: string; + createdAt: Date; + daysUntilDue?: number; + environmentId: string; + id: string; + isDefault: boolean; + name?: string; + paymentMethodId?: string; + prorationBehavior?: Schematic.ProrationBehavior; + providerType: Schematic.BillingProviderType; + updatedAt: Date; +} diff --git a/src/api/types/CompanyDetailResponseData.ts b/src/api/types/CompanyDetailResponseData.ts index aaec8c3d..7c12b495 100644 --- a/src/api/types/CompanyDetailResponseData.ts +++ b/src/api/types/CompanyDetailResponseData.ts @@ -5,6 +5,8 @@ import type * as Schematic from "../index"; export interface CompanyDetailResponseData { addOns: Schematic.CompanyPlanWithBillingSubView[]; billingCreditBalances?: Record; + billingProfile?: Schematic.CompanyBillingProfileResponseData; + billingProfiles?: Schematic.CompanyBillingProfileResponseData[]; billingSubscription?: Schematic.BillingSubscriptionView; billingSubscriptions: Schematic.BillingSubscriptionView[]; createdAt: Date; diff --git a/src/api/types/CompanyOverrideResponseData.ts b/src/api/types/CompanyOverrideResponseData.ts index ad78e24a..924d4fb0 100644 --- a/src/api/types/CompanyOverrideResponseData.ts +++ b/src/api/types/CompanyOverrideResponseData.ts @@ -19,6 +19,8 @@ export interface CompanyOverrideResponseData { ruleIdUsageExceeded?: string; updatedAt: Date; valueBool?: boolean; + valueCredit?: Schematic.BillingCreditResponseData; + valueCreditId?: string; valueNumeric?: number; valueTrait?: Schematic.EntityTraitDefinitionResponseData; valueTraitId?: string; diff --git a/src/api/types/CreditSpendPolicyResponseData.ts b/src/api/types/CreditSpendPolicyResponseData.ts new file mode 100644 index 00000000..b30575a1 --- /dev/null +++ b/src/api/types/CreditSpendPolicyResponseData.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface CreditSpendPolicyResponseData { + billingCreditId: string; + companyId?: string; + createdAt: Date; + id: string; + label?: string; + maxPerDraw?: number; + scopeType: Schematic.CreditSpendPolicyScope; + updatedAt: Date; + userId?: string; +} diff --git a/src/api/types/CreditSpendPolicyScope.ts b/src/api/types/CreditSpendPolicyScope.ts new file mode 100644 index 00000000..16ab934d --- /dev/null +++ b/src/api/types/CreditSpendPolicyScope.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export const CreditSpendPolicyScope = { + Company: "company", + User: "user", + Group: "group", +} as const; +export type CreditSpendPolicyScope = (typeof CreditSpendPolicyScope)[keyof typeof CreditSpendPolicyScope]; diff --git a/src/api/types/EventBodyInference.ts b/src/api/types/EventBodyInference.ts index 13546c06..ed70210d 100644 --- a/src/api/types/EventBodyInference.ts +++ b/src/api/types/EventBodyInference.ts @@ -1,7 +1,9 @@ // This file was auto-generated by Fern from our API Definition. export interface EventBodyInference { - /** Number of input tokens served from cache */ + /** Number of input tokens written to a prompt cache; a subset of input_tokens */ + cacheCreationInputTokens?: number; + /** Number of input tokens served from cache; a subset of input_tokens */ cachedInputTokens?: number; /** Key-value pairs to identify the company associated with the inference event */ company: Record; @@ -11,7 +13,7 @@ export interface EventBodyInference { currency?: string; /** Optional track event name to fan out for usage-based billing */ event?: string; - /** Number of input tokens for the inference request */ + /** Total number of input tokens for the inference request, including those served from and written to a prompt cache */ inputTokens: number; /** The inference operation; defaults to 'chat' */ operation?: string; diff --git a/src/api/types/GetOnboardingStateResp.ts b/src/api/types/GetOnboardingStateResp.ts index 96aedc54..31249da0 100644 --- a/src/api/types/GetOnboardingStateResp.ts +++ b/src/api/types/GetOnboardingStateResp.ts @@ -4,6 +4,7 @@ import type * as Schematic from "../index"; export interface GetOnboardingStateResp { agentConnectedAt?: Date; + country?: string; dismissedAt?: Date; environmentId?: string; milestones: Schematic.OnboardingMilestoneView[]; diff --git a/src/api/types/OtlpEnvironmentSettingsResponseData.ts b/src/api/types/OtlpEnvironmentSettingsResponseData.ts new file mode 100644 index 00000000..5320255d --- /dev/null +++ b/src/api/types/OtlpEnvironmentSettingsResponseData.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface OtlpEnvironmentSettingsResponseData { + companyAttribute?: string; + companyKey?: string; + createdAt: Date; + environmentId: string; + toolEventsEnabled: boolean; + updatedAt: Date; + userAttribute?: string; + userKey?: string; +} diff --git a/src/api/types/RuleConditionDetailResponseData.ts b/src/api/types/RuleConditionDetailResponseData.ts index 73053ae3..950eb7f5 100644 --- a/src/api/types/RuleConditionDetailResponseData.ts +++ b/src/api/types/RuleConditionDetailResponseData.ts @@ -16,6 +16,7 @@ export interface RuleConditionDetailResponseData { metricPeriodMonthReset?: Schematic.MetricPeriodMonthReset; metricValue?: number; operator: Schematic.ComparableOperator; + planVersions?: Schematic.RuleConditionPlanVersionResponseData[]; resourceIds: string[]; resources: Schematic.PreviewObjectResponseData[]; ruleId: string; diff --git a/src/api/types/RuleConditionPlanVersionResponseData.ts b/src/api/types/RuleConditionPlanVersionResponseData.ts new file mode 100644 index 00000000..bc96054b --- /dev/null +++ b/src/api/types/RuleConditionPlanVersionResponseData.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface RuleConditionPlanVersionResponseData { + id: string; + name: string; + status: Schematic.PlanVersionStatus; + version: number; +} diff --git a/src/api/types/StripeIntegrationConfig.ts b/src/api/types/StripeIntegrationConfig.ts index 9092df41..e9a30de9 100644 --- a/src/api/types/StripeIntegrationConfig.ts +++ b/src/api/types/StripeIntegrationConfig.ts @@ -5,6 +5,12 @@ export interface StripeIntegrationConfig { accountId?: string; /** Display name of the connected Stripe account */ accountName?: string; + /** When Stripe deletes the sandbox if nobody claims it, 60 days from creation; absent on sandboxes created before it was recorded */ + claimableSandboxExpiresAt?: Date; + /** Stripe claimable sandbox this connection was provisioned from; absent for an OAuth connect */ + claimableSandboxId?: string; + /** Stripe's claim status for the sandbox: unclaimed, claimed, or live */ + claimableSandboxStatus?: string; /** When importing Stripe customers, only update existing companies, do not create new companies */ companyUpdateOnly?: boolean; /** Whether the integration is connected to a Stripe sandbox account */ diff --git a/src/api/types/StripeSandboxClaimLink.ts b/src/api/types/StripeSandboxClaimLink.ts new file mode 100644 index 00000000..da3a12fe --- /dev/null +++ b/src/api/types/StripeSandboxClaimLink.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StripeSandboxClaimLink { + claimUrl: string; + expiresAt?: Date; + sandboxId: string; + status: string; +} diff --git a/src/api/types/StripeSandboxCountriesResponseData.ts b/src/api/types/StripeSandboxCountriesResponseData.ts new file mode 100644 index 00000000..aceb61f7 --- /dev/null +++ b/src/api/types/StripeSandboxCountriesResponseData.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StripeSandboxCountriesResponseData { + countries: string[]; +} diff --git a/src/api/types/StripeSandboxInstallResponseData.ts b/src/api/types/StripeSandboxInstallResponseData.ts new file mode 100644 index 00000000..5a8d30de --- /dev/null +++ b/src/api/types/StripeSandboxInstallResponseData.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface StripeSandboxInstallResponseData { + apiKeys?: Schematic.StripeSandboxKeysResponseData; + claimUrl: string; + claimUrlExpiresAt?: Date; + expiresAt?: Date; + install: Schematic.IntegrationInstallResponseData; + sandboxId: string; + stripeAccountId: string; +} diff --git a/src/api/types/StripeSandboxKeysResponseData.ts b/src/api/types/StripeSandboxKeysResponseData.ts new file mode 100644 index 00000000..da5879e4 --- /dev/null +++ b/src/api/types/StripeSandboxKeysResponseData.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StripeSandboxKeysResponseData { + mcp: string; + publishable: string; + secret: string; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 6e7d3cb9..f54b90e5 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -89,6 +89,7 @@ export * from "./CheckoutFieldValue"; export * from "./CheckoutFieldWithValue"; export * from "./CheckoutSettingsResponseData"; export * from "./CheckoutSubscription"; +export * from "./ClaimedStripeSandboxKeysResponseData"; export * from "./ClerkIntegrationConfig"; export * from "./CompanyBillingAddressView"; export * from "./CompanyBillingCheckoutSettings"; @@ -96,6 +97,7 @@ export * from "./CompanyBillingDetailsResponseData"; export * from "./CompanyBillingDetailsView"; export * from "./CompanyBillingEntityResponseData"; export * from "./CompanyBillingEntitySubscriptionResponseData"; +export * from "./CompanyBillingProfileResponseData"; export * from "./CompanyCreditBalance"; export * from "./CompanyCreditBalanceResponseData"; export * from "./CompanyDetailResponseData"; @@ -165,6 +167,8 @@ export * from "./CreditGrantDetail"; export * from "./CreditGrantExpiryRequestBody"; export * from "./CreditGrantSortOrder"; export * from "./CreditLeaseResponseData"; +export * from "./CreditSpendPolicyResponseData"; +export * from "./CreditSpendPolicyScope"; export * from "./CreditsAutoTopupCompanySummary"; export * from "./CreditsAutoTopupCreditSummary"; export * from "./CreditsAutoTopupHardFailure"; @@ -293,6 +297,7 @@ export * from "./OnboardingStripeImport"; export * from "./OnboardingTrack"; export * from "./OrbIntegrationConfig"; export * from "./OrderedPlansInGroup"; +export * from "./OtlpEnvironmentSettingsResponseData"; export * from "./PaymentMethodRequestBody"; export * from "./PaymentMethodResponseData"; export * from "./PendingMigrationResponseData"; @@ -357,6 +362,7 @@ export * from "./Rule"; export * from "./RuleConditionDetailResponseData"; export * from "./RuleConditionGroupDetailResponseData"; export * from "./RuleConditionGroupResponseData"; +export * from "./RuleConditionPlanVersionResponseData"; export * from "./RuleConditionResponseData"; export * from "./RuleDetailResponseData"; export * from "./RuleResponseData"; @@ -394,6 +400,10 @@ export * from "./SkippedEntitlementResponseData"; export * from "./SortDirection"; export * from "./StripeEmbedInfo"; export * from "./StripeIntegrationConfig"; +export * from "./StripeSandboxClaimLink"; +export * from "./StripeSandboxCountriesResponseData"; +export * from "./StripeSandboxInstallResponseData"; +export * from "./StripeSandboxKeysResponseData"; export * from "./SubscriptionStatus"; export * from "./SubscriptionTraitUpdate"; export * from "./SubscriptionType"; diff --git a/src/serialization/resources/accounts/client/requests/UpdateOnboardingStateRequestBody.ts b/src/serialization/resources/accounts/client/requests/UpdateOnboardingStateRequestBody.ts index abaae39d..fa20843a 100644 --- a/src/serialization/resources/accounts/client/requests/UpdateOnboardingStateRequestBody.ts +++ b/src/serialization/resources/accounts/client/requests/UpdateOnboardingStateRequestBody.ts @@ -10,6 +10,7 @@ export const UpdateOnboardingStateRequestBody: core.serialization.Schema< serializers.UpdateOnboardingStateRequestBody.Raw, Schematic.UpdateOnboardingStateRequestBody > = core.serialization.object({ + country: core.serialization.string().optional(), dismissed: core.serialization.boolean().optional(), path: OnboardingPath.optional(), pricingPageUrl: core.serialization.property("pricing_page_url", core.serialization.string().optional()), @@ -19,6 +20,7 @@ export const UpdateOnboardingStateRequestBody: core.serialization.Schema< export declare namespace UpdateOnboardingStateRequestBody { export interface Raw { + country?: string | null; dismissed?: boolean | null; path?: OnboardingPath.Raw | null; pricing_page_url?: string | null; diff --git a/src/serialization/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts b/src/serialization/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts new file mode 100644 index 00000000..b11634ec --- /dev/null +++ b/src/serialization/resources/billing/client/requests/UpdateCompanyBillingProfileRequestBody.ts @@ -0,0 +1,30 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; +import { BillingCollectionMethod } from "../../../../types/BillingCollectionMethod"; +import { ProrationBehavior } from "../../../../types/ProrationBehavior"; + +export const UpdateCompanyBillingProfileRequestBody: core.serialization.Schema< + serializers.UpdateCompanyBillingProfileRequestBody.Raw, + Schematic.UpdateCompanyBillingProfileRequestBody +> = core.serialization.object({ + collectionMethod: core.serialization.property("collection_method", BillingCollectionMethod), + daysUntilDue: core.serialization.property("days_until_due", core.serialization.number().optional()), + isDefault: core.serialization.property("is_default", core.serialization.boolean().optional()), + name: core.serialization.string().optional(), + paymentMethodId: core.serialization.property("payment_method_id", core.serialization.string().optional()), + prorationBehavior: core.serialization.property("proration_behavior", ProrationBehavior.optional()), +}); + +export declare namespace UpdateCompanyBillingProfileRequestBody { + export interface Raw { + collection_method: BillingCollectionMethod.Raw; + days_until_due?: number | null; + is_default?: boolean | null; + name?: string | null; + payment_method_id?: string | null; + proration_behavior?: ProrationBehavior.Raw | null; + } +} diff --git a/src/serialization/resources/billing/client/requests/index.ts b/src/serialization/resources/billing/client/requests/index.ts index ae39129e..2e05f983 100644 --- a/src/serialization/resources/billing/client/requests/index.ts +++ b/src/serialization/resources/billing/client/requests/index.ts @@ -6,3 +6,4 @@ export { CreateCouponRequestBody } from "./CreateCouponRequestBody"; export { CreateInvoiceRequestBody } from "./CreateInvoiceRequestBody"; export { CreateMeterRequestBody } from "./CreateMeterRequestBody"; export { CreatePaymentMethodRequestBody } from "./CreatePaymentMethodRequestBody"; +export { UpdateCompanyBillingProfileRequestBody } from "./UpdateCompanyBillingProfileRequestBody"; diff --git a/src/serialization/resources/billing/types/ListCompanyBillingProfilesParams.ts b/src/serialization/resources/billing/types/ListCompanyBillingProfilesParams.ts new file mode 100644 index 00000000..f4a414ae --- /dev/null +++ b/src/serialization/resources/billing/types/ListCompanyBillingProfilesParams.ts @@ -0,0 +1,27 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { BillingProviderType } from "../../../types/BillingProviderType"; + +export const ListCompanyBillingProfilesParams: core.serialization.ObjectSchema< + serializers.ListCompanyBillingProfilesParams.Raw, + Schematic.ListCompanyBillingProfilesParams +> = core.serialization.object({ + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + isDefault: core.serialization.property("is_default", core.serialization.boolean().optional()), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + providerType: core.serialization.property("provider_type", BillingProviderType.optional()), +}); + +export declare namespace ListCompanyBillingProfilesParams { + export interface Raw { + company_id?: string | null; + is_default?: boolean | null; + limit?: number | null; + offset?: number | null; + provider_type?: BillingProviderType.Raw | null; + } +} diff --git a/src/serialization/resources/billing/types/ListCompanyBillingProfilesResponse.ts b/src/serialization/resources/billing/types/ListCompanyBillingProfilesResponse.ts new file mode 100644 index 00000000..eee33642 --- /dev/null +++ b/src/serialization/resources/billing/types/ListCompanyBillingProfilesResponse.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CompanyBillingProfileResponseData } from "../../../types/CompanyBillingProfileResponseData"; +import { ListCompanyBillingProfilesParams } from "./ListCompanyBillingProfilesParams"; + +export const ListCompanyBillingProfilesResponse: core.serialization.ObjectSchema< + serializers.ListCompanyBillingProfilesResponse.Raw, + Schematic.ListCompanyBillingProfilesResponse +> = core.serialization.object({ + data: core.serialization.list(CompanyBillingProfileResponseData), + params: ListCompanyBillingProfilesParams, +}); + +export declare namespace ListCompanyBillingProfilesResponse { + export interface Raw { + data: CompanyBillingProfileResponseData.Raw[]; + params: ListCompanyBillingProfilesParams.Raw; + } +} diff --git a/src/serialization/resources/billing/types/UpdateCompanyBillingProfileResponse.ts b/src/serialization/resources/billing/types/UpdateCompanyBillingProfileResponse.ts new file mode 100644 index 00000000..4f8f88fc --- /dev/null +++ b/src/serialization/resources/billing/types/UpdateCompanyBillingProfileResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CompanyBillingProfileResponseData } from "../../../types/CompanyBillingProfileResponseData"; + +export const UpdateCompanyBillingProfileResponse: core.serialization.ObjectSchema< + serializers.UpdateCompanyBillingProfileResponse.Raw, + Schematic.UpdateCompanyBillingProfileResponse +> = core.serialization.object({ + data: CompanyBillingProfileResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace UpdateCompanyBillingProfileResponse { + export interface Raw { + data: CompanyBillingProfileResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/billing/types/index.ts b/src/serialization/resources/billing/types/index.ts index 7e9332c9..5fa2d7b3 100644 --- a/src/serialization/resources/billing/types/index.ts +++ b/src/serialization/resources/billing/types/index.ts @@ -14,6 +14,8 @@ export * from "./ListBillingProductPricesParams"; export * from "./ListBillingProductPricesResponse"; export * from "./ListBillingProductsParams"; export * from "./ListBillingProductsResponse"; +export * from "./ListCompanyBillingProfilesParams"; +export * from "./ListCompanyBillingProfilesResponse"; export * from "./ListCouponsParams"; export * from "./ListCouponsResponse"; export * from "./ListCustomersWithSubscriptionsParams"; @@ -24,6 +26,7 @@ export * from "./ListMetersParams"; export * from "./ListMetersResponse"; export * from "./ListPaymentMethodsParams"; export * from "./ListPaymentMethodsResponse"; +export * from "./UpdateCompanyBillingProfileResponse"; export * from "./UpsertBillingCouponResponse"; export * from "./UpsertBillingCustomerResponse"; export * from "./UpsertBillingMeterResponse"; diff --git a/src/serialization/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts b/src/serialization/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts new file mode 100644 index 00000000..1e39f973 --- /dev/null +++ b/src/serialization/resources/credits/client/requests/CreateCreditSpendPolicyRequestBody.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; + +export const CreateCreditSpendPolicyRequestBody: core.serialization.Schema< + serializers.CreateCreditSpendPolicyRequestBody.Raw, + Schematic.CreateCreditSpendPolicyRequestBody +> = core.serialization.object({ + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string()), + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + label: core.serialization.string().optional(), + maxPerDraw: core.serialization.property("max_per_draw", core.serialization.number()), + userId: core.serialization.property("user_id", core.serialization.string().optional()), +}); + +export declare namespace CreateCreditSpendPolicyRequestBody { + export interface Raw { + billing_credit_id: string; + company_id?: string | null; + label?: string | null; + max_per_draw: number; + user_id?: string | null; + } +} diff --git a/src/serialization/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts b/src/serialization/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts new file mode 100644 index 00000000..45d76ca8 --- /dev/null +++ b/src/serialization/resources/credits/client/requests/UpdateCreditSpendPolicyRequestBody.ts @@ -0,0 +1,20 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; + +export const UpdateCreditSpendPolicyRequestBody: core.serialization.Schema< + serializers.UpdateCreditSpendPolicyRequestBody.Raw, + Schematic.UpdateCreditSpendPolicyRequestBody +> = core.serialization.object({ + label: core.serialization.string().optional(), + maxPerDraw: core.serialization.property("max_per_draw", core.serialization.number().optional()), +}); + +export declare namespace UpdateCreditSpendPolicyRequestBody { + export interface Raw { + label?: string | null; + max_per_draw?: number | null; + } +} diff --git a/src/serialization/resources/credits/client/requests/index.ts b/src/serialization/resources/credits/client/requests/index.ts index 010270c7..d71ca06d 100644 --- a/src/serialization/resources/credits/client/requests/index.ts +++ b/src/serialization/resources/credits/client/requests/index.ts @@ -2,7 +2,9 @@ export { AcquireCreditLeaseRequestBody } from "./AcquireCreditLeaseRequestBody"; export { CreateBillingCreditRequestBody } from "./CreateBillingCreditRequestBody"; export { CreateCompanyCreditGrant } from "./CreateCompanyCreditGrant"; export { CreateCreditBundleRequestBody } from "./CreateCreditBundleRequestBody"; +export { CreateCreditSpendPolicyRequestBody } from "./CreateCreditSpendPolicyRequestBody"; export { ExtendCreditLeaseRequestBody } from "./ExtendCreditLeaseRequestBody"; export { UpdateBillingCreditRequestBody } from "./UpdateBillingCreditRequestBody"; export { UpdateCreditBundleDetailsRequestBody } from "./UpdateCreditBundleDetailsRequestBody"; +export { UpdateCreditSpendPolicyRequestBody } from "./UpdateCreditSpendPolicyRequestBody"; export { ZeroOutGrantRequestBody } from "./ZeroOutGrantRequestBody"; diff --git a/src/serialization/resources/credits/types/CountCreditSpendPoliciesParams.ts b/src/serialization/resources/credits/types/CountCreditSpendPoliciesParams.ts new file mode 100644 index 00000000..0fee30f2 --- /dev/null +++ b/src/serialization/resources/credits/types/CountCreditSpendPoliciesParams.ts @@ -0,0 +1,31 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditSpendPolicyScope } from "../../../types/CreditSpendPolicyScope"; + +export const CountCreditSpendPoliciesParams: core.serialization.ObjectSchema< + serializers.CountCreditSpendPoliciesParams.Raw, + Schematic.CountCreditSpendPoliciesParams +> = core.serialization.object({ + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string().optional()), + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + scopeType: core.serialization.property("scope_type", CreditSpendPolicyScope.optional()), + userId: core.serialization.property("user_id", core.serialization.string().optional()), + userIds: core.serialization.property("user_ids", core.serialization.list(core.serialization.string()).optional()), +}); + +export declare namespace CountCreditSpendPoliciesParams { + export interface Raw { + billing_credit_id?: string | null; + company_id?: string | null; + limit?: number | null; + offset?: number | null; + scope_type?: CreditSpendPolicyScope.Raw | null; + user_id?: string | null; + user_ids?: string[] | null; + } +} diff --git a/src/serialization/resources/credits/types/CountCreditSpendPoliciesResponse.ts b/src/serialization/resources/credits/types/CountCreditSpendPoliciesResponse.ts new file mode 100644 index 00000000..1c4acb21 --- /dev/null +++ b/src/serialization/resources/credits/types/CountCreditSpendPoliciesResponse.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CountResponse } from "../../../types/CountResponse"; +import { CountCreditSpendPoliciesParams } from "./CountCreditSpendPoliciesParams"; + +export const CountCreditSpendPoliciesResponse: core.serialization.ObjectSchema< + serializers.CountCreditSpendPoliciesResponse.Raw, + Schematic.CountCreditSpendPoliciesResponse +> = core.serialization.object({ + data: CountResponse, + params: CountCreditSpendPoliciesParams, +}); + +export declare namespace CountCreditSpendPoliciesResponse { + export interface Raw { + data: CountResponse.Raw; + params: CountCreditSpendPoliciesParams.Raw; + } +} diff --git a/src/serialization/resources/credits/types/CreateCreditSpendPolicyResponse.ts b/src/serialization/resources/credits/types/CreateCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..ceb25da9 --- /dev/null +++ b/src/serialization/resources/credits/types/CreateCreditSpendPolicyResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditSpendPolicyResponseData } from "../../../types/CreditSpendPolicyResponseData"; + +export const CreateCreditSpendPolicyResponse: core.serialization.ObjectSchema< + serializers.CreateCreditSpendPolicyResponse.Raw, + Schematic.CreateCreditSpendPolicyResponse +> = core.serialization.object({ + data: CreditSpendPolicyResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace CreateCreditSpendPolicyResponse { + export interface Raw { + data: CreditSpendPolicyResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/credits/types/DeleteCreditSpendPolicyResponse.ts b/src/serialization/resources/credits/types/DeleteCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..3da848fd --- /dev/null +++ b/src/serialization/resources/credits/types/DeleteCreditSpendPolicyResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { DeleteResponse } from "../../../types/DeleteResponse"; + +export const DeleteCreditSpendPolicyResponse: core.serialization.ObjectSchema< + serializers.DeleteCreditSpendPolicyResponse.Raw, + Schematic.DeleteCreditSpendPolicyResponse +> = core.serialization.object({ + data: DeleteResponse, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace DeleteCreditSpendPolicyResponse { + export interface Raw { + data: DeleteResponse.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/credits/types/GetCreditSpendPolicyResponse.ts b/src/serialization/resources/credits/types/GetCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..ca226f6b --- /dev/null +++ b/src/serialization/resources/credits/types/GetCreditSpendPolicyResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditSpendPolicyResponseData } from "../../../types/CreditSpendPolicyResponseData"; + +export const GetCreditSpendPolicyResponse: core.serialization.ObjectSchema< + serializers.GetCreditSpendPolicyResponse.Raw, + Schematic.GetCreditSpendPolicyResponse +> = core.serialization.object({ + data: CreditSpendPolicyResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace GetCreditSpendPolicyResponse { + export interface Raw { + data: CreditSpendPolicyResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/credits/types/ListCreditSpendPoliciesParams.ts b/src/serialization/resources/credits/types/ListCreditSpendPoliciesParams.ts new file mode 100644 index 00000000..d4e3047d --- /dev/null +++ b/src/serialization/resources/credits/types/ListCreditSpendPoliciesParams.ts @@ -0,0 +1,31 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditSpendPolicyScope } from "../../../types/CreditSpendPolicyScope"; + +export const ListCreditSpendPoliciesParams: core.serialization.ObjectSchema< + serializers.ListCreditSpendPoliciesParams.Raw, + Schematic.ListCreditSpendPoliciesParams +> = core.serialization.object({ + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string().optional()), + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + scopeType: core.serialization.property("scope_type", CreditSpendPolicyScope.optional()), + userId: core.serialization.property("user_id", core.serialization.string().optional()), + userIds: core.serialization.property("user_ids", core.serialization.list(core.serialization.string()).optional()), +}); + +export declare namespace ListCreditSpendPoliciesParams { + export interface Raw { + billing_credit_id?: string | null; + company_id?: string | null; + limit?: number | null; + offset?: number | null; + scope_type?: CreditSpendPolicyScope.Raw | null; + user_id?: string | null; + user_ids?: string[] | null; + } +} diff --git a/src/serialization/resources/credits/types/ListCreditSpendPoliciesResponse.ts b/src/serialization/resources/credits/types/ListCreditSpendPoliciesResponse.ts new file mode 100644 index 00000000..9fe19495 --- /dev/null +++ b/src/serialization/resources/credits/types/ListCreditSpendPoliciesResponse.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditSpendPolicyResponseData } from "../../../types/CreditSpendPolicyResponseData"; +import { ListCreditSpendPoliciesParams } from "./ListCreditSpendPoliciesParams"; + +export const ListCreditSpendPoliciesResponse: core.serialization.ObjectSchema< + serializers.ListCreditSpendPoliciesResponse.Raw, + Schematic.ListCreditSpendPoliciesResponse +> = core.serialization.object({ + data: core.serialization.list(CreditSpendPolicyResponseData), + params: ListCreditSpendPoliciesParams, +}); + +export declare namespace ListCreditSpendPoliciesResponse { + export interface Raw { + data: CreditSpendPolicyResponseData.Raw[]; + params: ListCreditSpendPoliciesParams.Raw; + } +} diff --git a/src/serialization/resources/credits/types/UpdateCreditSpendPolicyResponse.ts b/src/serialization/resources/credits/types/UpdateCreditSpendPolicyResponse.ts new file mode 100644 index 00000000..b27c0631 --- /dev/null +++ b/src/serialization/resources/credits/types/UpdateCreditSpendPolicyResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditSpendPolicyResponseData } from "../../../types/CreditSpendPolicyResponseData"; + +export const UpdateCreditSpendPolicyResponse: core.serialization.ObjectSchema< + serializers.UpdateCreditSpendPolicyResponse.Raw, + Schematic.UpdateCreditSpendPolicyResponse +> = core.serialization.object({ + data: CreditSpendPolicyResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace UpdateCreditSpendPolicyResponse { + export interface Raw { + data: CreditSpendPolicyResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/credits/types/index.ts b/src/serialization/resources/credits/types/index.ts index 2e92a33a..f55d471c 100644 --- a/src/serialization/resources/credits/types/index.ts +++ b/src/serialization/resources/credits/types/index.ts @@ -11,14 +11,19 @@ export * from "./CountCreditBundlesParams"; export * from "./CountCreditBundlesResponse"; export * from "./CountCreditEventLedgerParams"; export * from "./CountCreditEventLedgerResponse"; +export * from "./CountCreditSpendPoliciesParams"; +export * from "./CountCreditSpendPoliciesResponse"; export * from "./CreateBillingCreditResponse"; export * from "./CreateBillingPlanCreditGrantResponse"; export * from "./CreateCreditBundleResponse"; +export * from "./CreateCreditSpendPolicyResponse"; export * from "./DeleteBillingPlanCreditGrantParams"; export * from "./DeleteBillingPlanCreditGrantResponse"; export * from "./DeleteCreditBundleResponse"; +export * from "./DeleteCreditSpendPolicyResponse"; export * from "./ExtendCreditLeaseResponse"; export * from "./GetCreditBundleResponse"; +export * from "./GetCreditSpendPolicyResponse"; export * from "./GetSingleBillingCreditResponse"; export * from "./GetSingleBillingPlanCreditGrantResponse"; export * from "./GrantBillingCreditsToCompanyResponse"; @@ -34,6 +39,8 @@ export * from "./ListCreditBundlesParams"; export * from "./ListCreditBundlesResponse"; export * from "./ListCreditEventLedgerParams"; export * from "./ListCreditEventLedgerResponse"; +export * from "./ListCreditSpendPoliciesParams"; +export * from "./ListCreditSpendPoliciesResponse"; export * from "./ListGrantsForCreditParams"; export * from "./ListGrantsForCreditResponse"; export * from "./ReleaseCreditLeaseResponse"; @@ -41,4 +48,5 @@ export * from "./SoftDeleteBillingCreditResponse"; export * from "./UpdateBillingCreditResponse"; export * from "./UpdateBillingPlanCreditGrantResponse"; export * from "./UpdateCreditBundleDetailsResponse"; +export * from "./UpdateCreditSpendPolicyResponse"; export * from "./ZeroOutGrantResponse"; diff --git a/src/serialization/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts b/src/serialization/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts new file mode 100644 index 00000000..bf0ebc8c --- /dev/null +++ b/src/serialization/resources/events/client/requests/UpsertOtlpEnvironmentSettingsRequestBody.ts @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; + +export const UpsertOtlpEnvironmentSettingsRequestBody: core.serialization.Schema< + serializers.UpsertOtlpEnvironmentSettingsRequestBody.Raw, + Schematic.UpsertOtlpEnvironmentSettingsRequestBody +> = core.serialization.object({ + companyAttribute: core.serialization.property("company_attribute", core.serialization.string().optional()), + companyKey: core.serialization.property("company_key", core.serialization.string().optional()), + toolEventsEnabled: core.serialization.property("tool_events_enabled", core.serialization.boolean()), + userAttribute: core.serialization.property("user_attribute", core.serialization.string().optional()), + userKey: core.serialization.property("user_key", core.serialization.string().optional()), +}); + +export declare namespace UpsertOtlpEnvironmentSettingsRequestBody { + export interface Raw { + company_attribute?: string | null; + company_key?: string | null; + tool_events_enabled: boolean; + user_attribute?: string | null; + user_key?: string | null; + } +} diff --git a/src/serialization/resources/events/client/requests/index.ts b/src/serialization/resources/events/client/requests/index.ts index b63138cc..e8553efa 100644 --- a/src/serialization/resources/events/client/requests/index.ts +++ b/src/serialization/resources/events/client/requests/index.ts @@ -1 +1,2 @@ export { CreateEventBatchRequestBody } from "./CreateEventBatchRequestBody"; +export { UpsertOtlpEnvironmentSettingsRequestBody } from "./UpsertOtlpEnvironmentSettingsRequestBody"; diff --git a/src/serialization/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts b/src/serialization/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts new file mode 100644 index 00000000..355c3ce4 --- /dev/null +++ b/src/serialization/resources/events/types/DeleteOtlpEnvironmentSettingsResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { DeleteResponse } from "../../../types/DeleteResponse"; + +export const DeleteOtlpEnvironmentSettingsResponse: core.serialization.ObjectSchema< + serializers.DeleteOtlpEnvironmentSettingsResponse.Raw, + Schematic.DeleteOtlpEnvironmentSettingsResponse +> = core.serialization.object({ + data: DeleteResponse, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace DeleteOtlpEnvironmentSettingsResponse { + export interface Raw { + data: DeleteResponse.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts b/src/serialization/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts new file mode 100644 index 00000000..a4463f35 --- /dev/null +++ b/src/serialization/resources/events/types/GetOtlpEnvironmentSettingsResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { OtlpEnvironmentSettingsResponseData } from "../../../types/OtlpEnvironmentSettingsResponseData"; + +export const GetOtlpEnvironmentSettingsResponse: core.serialization.ObjectSchema< + serializers.GetOtlpEnvironmentSettingsResponse.Raw, + Schematic.GetOtlpEnvironmentSettingsResponse +> = core.serialization.object({ + data: OtlpEnvironmentSettingsResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace GetOtlpEnvironmentSettingsResponse { + export interface Raw { + data: OtlpEnvironmentSettingsResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts b/src/serialization/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts new file mode 100644 index 00000000..510d9573 --- /dev/null +++ b/src/serialization/resources/events/types/UpsertOtlpEnvironmentSettingsResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { OtlpEnvironmentSettingsResponseData } from "../../../types/OtlpEnvironmentSettingsResponseData"; + +export const UpsertOtlpEnvironmentSettingsResponse: core.serialization.ObjectSchema< + serializers.UpsertOtlpEnvironmentSettingsResponse.Raw, + Schematic.UpsertOtlpEnvironmentSettingsResponse +> = core.serialization.object({ + data: OtlpEnvironmentSettingsResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace UpsertOtlpEnvironmentSettingsResponse { + export interface Raw { + data: OtlpEnvironmentSettingsResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/events/types/index.ts b/src/serialization/resources/events/types/index.ts index 421f16fb..3ed83d82 100644 --- a/src/serialization/resources/events/types/index.ts +++ b/src/serialization/resources/events/types/index.ts @@ -1,8 +1,11 @@ export * from "./CreateEventBatchResponse"; export * from "./CreateEventResponse"; +export * from "./DeleteOtlpEnvironmentSettingsResponse"; export * from "./GetEventResponse"; export * from "./GetEventSummariesParams"; export * from "./GetEventSummariesResponse"; +export * from "./GetOtlpEnvironmentSettingsResponse"; export * from "./GetSegmentIntegrationStatusResponse"; export * from "./ListEventsParams"; export * from "./ListEventsResponse"; +export * from "./UpsertOtlpEnvironmentSettingsResponse"; diff --git a/src/serialization/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts b/src/serialization/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts new file mode 100644 index 00000000..98c493c2 --- /dev/null +++ b/src/serialization/resources/integrationsapi/client/requests/ClaimStripeSandboxKeysRequestBody.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; + +export const ClaimStripeSandboxKeysRequestBody: core.serialization.Schema< + serializers.ClaimStripeSandboxKeysRequestBody.Raw, + Schematic.ClaimStripeSandboxKeysRequestBody +> = core.serialization.object({ + token: core.serialization.string(), +}); + +export declare namespace ClaimStripeSandboxKeysRequestBody { + export interface Raw { + token: string; + } +} diff --git a/src/serialization/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts b/src/serialization/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts new file mode 100644 index 00000000..563586c8 --- /dev/null +++ b/src/serialization/resources/integrationsapi/client/requests/InstallStripeSandboxRequestBody.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; + +export const InstallStripeSandboxRequestBody: core.serialization.Schema< + serializers.InstallStripeSandboxRequestBody.Raw, + Schematic.InstallStripeSandboxRequestBody +> = core.serialization.object({ + country: core.serialization.string().optional(), + email: core.serialization.string(), + name: core.serialization.string().optional(), + seedSampleData: core.serialization.property("seed_sample_data", core.serialization.boolean().optional()), +}); + +export declare namespace InstallStripeSandboxRequestBody { + export interface Raw { + country?: string | null; + email: string; + name?: string | null; + seed_sample_data?: boolean | null; + } +} diff --git a/src/serialization/resources/integrationsapi/client/requests/index.ts b/src/serialization/resources/integrationsapi/client/requests/index.ts index 3c15e6ae..aff599c3 100644 --- a/src/serialization/resources/integrationsapi/client/requests/index.ts +++ b/src/serialization/resources/integrationsapi/client/requests/index.ts @@ -1 +1,3 @@ +export { ClaimStripeSandboxKeysRequestBody } from "./ClaimStripeSandboxKeysRequestBody"; +export { InstallStripeSandboxRequestBody } from "./InstallStripeSandboxRequestBody"; export { StartDataImportRequestBody } from "./StartDataImportRequestBody"; diff --git a/src/serialization/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts b/src/serialization/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts new file mode 100644 index 00000000..ced992b4 --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/ClaimStripeSandboxKeysResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { ClaimedStripeSandboxKeysResponseData } from "../../../types/ClaimedStripeSandboxKeysResponseData"; + +export const ClaimStripeSandboxKeysResponse: core.serialization.ObjectSchema< + serializers.ClaimStripeSandboxKeysResponse.Raw, + Schematic.ClaimStripeSandboxKeysResponse +> = core.serialization.object({ + data: ClaimedStripeSandboxKeysResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace ClaimStripeSandboxKeysResponse { + export interface Raw { + data: ClaimedStripeSandboxKeysResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts b/src/serialization/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts new file mode 100644 index 00000000..57ffffc7 --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/GetStripeSandboxClaimLinkResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { StripeSandboxClaimLink } from "../../../types/StripeSandboxClaimLink"; + +export const GetStripeSandboxClaimLinkResponse: core.serialization.ObjectSchema< + serializers.GetStripeSandboxClaimLinkResponse.Raw, + Schematic.GetStripeSandboxClaimLinkResponse +> = core.serialization.object({ + data: StripeSandboxClaimLink, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace GetStripeSandboxClaimLinkResponse { + export interface Raw { + data: StripeSandboxClaimLink.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts b/src/serialization/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts new file mode 100644 index 00000000..ef0c212f --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/GetStripeSandboxKeysResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { ClaimedStripeSandboxKeysResponseData } from "../../../types/ClaimedStripeSandboxKeysResponseData"; + +export const GetStripeSandboxKeysResponse: core.serialization.ObjectSchema< + serializers.GetStripeSandboxKeysResponse.Raw, + Schematic.GetStripeSandboxKeysResponse +> = core.serialization.object({ + data: ClaimedStripeSandboxKeysResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace GetStripeSandboxKeysResponse { + export interface Raw { + data: ClaimedStripeSandboxKeysResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts b/src/serialization/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts new file mode 100644 index 00000000..a9b5f7d4 --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/InstallStripeClaimableSandboxResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { StripeSandboxInstallResponseData } from "../../../types/StripeSandboxInstallResponseData"; + +export const InstallStripeClaimableSandboxResponse: core.serialization.ObjectSchema< + serializers.InstallStripeClaimableSandboxResponse.Raw, + Schematic.InstallStripeClaimableSandboxResponse +> = core.serialization.object({ + data: StripeSandboxInstallResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace InstallStripeClaimableSandboxResponse { + export interface Raw { + data: StripeSandboxInstallResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts b/src/serialization/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts new file mode 100644 index 00000000..dacacd18 --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/ListStripeSandboxCountriesResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { StripeSandboxCountriesResponseData } from "../../../types/StripeSandboxCountriesResponseData"; + +export const ListStripeSandboxCountriesResponse: core.serialization.ObjectSchema< + serializers.ListStripeSandboxCountriesResponse.Raw, + Schematic.ListStripeSandboxCountriesResponse +> = core.serialization.object({ + data: StripeSandboxCountriesResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace ListStripeSandboxCountriesResponse { + export interface Raw { + data: StripeSandboxCountriesResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/index.ts b/src/serialization/resources/integrationsapi/types/index.ts index 3c4b71a4..3835c1ba 100644 --- a/src/serialization/resources/integrationsapi/types/index.ts +++ b/src/serialization/resources/integrationsapi/types/index.ts @@ -1,9 +1,14 @@ export * from "./AssumeStripeInstalledResponse"; +export * from "./ClaimStripeSandboxKeysResponse"; export * from "./GetIntegrationWebhookUrlResponse"; +export * from "./GetStripeSandboxClaimLinkResponse"; +export * from "./GetStripeSandboxKeysResponse"; export * from "./InstallIntegrationResponse"; +export * from "./InstallStripeClaimableSandboxResponse"; export * from "./InstallStripeResponse"; export * from "./ListIntegrationsParams"; export * from "./ListIntegrationsResponse"; +export * from "./ListStripeSandboxCountriesResponse"; export * from "./LoadSampleDataSetResponse"; export * from "./RunIntegrationResponse"; export * from "./StartDataImportResponse"; diff --git a/src/serialization/types/ClaimedStripeSandboxKeysResponseData.ts b/src/serialization/types/ClaimedStripeSandboxKeysResponseData.ts new file mode 100644 index 00000000..83eebeff --- /dev/null +++ b/src/serialization/types/ClaimedStripeSandboxKeysResponseData.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const ClaimedStripeSandboxKeysResponseData: core.serialization.ObjectSchema< + serializers.ClaimedStripeSandboxKeysResponseData.Raw, + Schematic.ClaimedStripeSandboxKeysResponseData +> = core.serialization.object({ + publishable: core.serialization.string(), + sandboxId: core.serialization.property("sandbox_id", core.serialization.string()), + secret: core.serialization.string(), +}); + +export declare namespace ClaimedStripeSandboxKeysResponseData { + export interface Raw { + publishable: string; + sandbox_id: string; + secret: string; + } +} diff --git a/src/serialization/types/CompanyBillingProfileResponseData.ts b/src/serialization/types/CompanyBillingProfileResponseData.ts new file mode 100644 index 00000000..0a2e15f4 --- /dev/null +++ b/src/serialization/types/CompanyBillingProfileResponseData.ts @@ -0,0 +1,47 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { BillingCollectionMethod } from "./BillingCollectionMethod"; +import { BillingProviderType } from "./BillingProviderType"; +import { ProrationBehavior } from "./ProrationBehavior"; + +export const CompanyBillingProfileResponseData: core.serialization.ObjectSchema< + serializers.CompanyBillingProfileResponseData.Raw, + Schematic.CompanyBillingProfileResponseData +> = core.serialization.object({ + accountId: core.serialization.property("account_id", core.serialization.string()), + billingCustomerId: core.serialization.property("billing_customer_id", core.serialization.string().optional()), + collectionMethod: core.serialization.property("collection_method", BillingCollectionMethod), + companyId: core.serialization.property("company_id", core.serialization.string()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + daysUntilDue: core.serialization.property("days_until_due", core.serialization.number().optional()), + environmentId: core.serialization.property("environment_id", core.serialization.string()), + id: core.serialization.string(), + isDefault: core.serialization.property("is_default", core.serialization.boolean()), + name: core.serialization.string().optional(), + paymentMethodId: core.serialization.property("payment_method_id", core.serialization.string().optional()), + prorationBehavior: core.serialization.property("proration_behavior", ProrationBehavior.optional()), + providerType: core.serialization.property("provider_type", BillingProviderType), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace CompanyBillingProfileResponseData { + export interface Raw { + account_id: string; + billing_customer_id?: string | null; + collection_method: BillingCollectionMethod.Raw; + company_id: string; + created_at: string; + days_until_due?: number | null; + environment_id: string; + id: string; + is_default: boolean; + name?: string | null; + payment_method_id?: string | null; + proration_behavior?: ProrationBehavior.Raw | null; + provider_type: BillingProviderType.Raw; + updated_at: string; + } +} diff --git a/src/serialization/types/CompanyDetailResponseData.ts b/src/serialization/types/CompanyDetailResponseData.ts index 5483195e..ab368c46 100644 --- a/src/serialization/types/CompanyDetailResponseData.ts +++ b/src/serialization/types/CompanyDetailResponseData.ts @@ -4,6 +4,7 @@ import type * as Schematic from "../../api/index"; import * as core from "../../core"; import type * as serializers from "../index"; import { BillingSubscriptionView } from "./BillingSubscriptionView"; +import { CompanyBillingProfileResponseData } from "./CompanyBillingProfileResponseData"; import { CompanyEventPeriodMetricsResponseData } from "./CompanyEventPeriodMetricsResponseData"; import { CompanyPlanWithBillingSubView } from "./CompanyPlanWithBillingSubView"; import { CustomPlanBillingResponseData } from "./CustomPlanBillingResponseData"; @@ -25,6 +26,11 @@ export const CompanyDetailResponseData: core.serialization.ObjectSchema< "billing_credit_balances", core.serialization.record(core.serialization.string(), core.serialization.number()).optional(), ), + billingProfile: core.serialization.property("billing_profile", CompanyBillingProfileResponseData.optional()), + billingProfiles: core.serialization.property( + "billing_profiles", + core.serialization.list(CompanyBillingProfileResponseData).optional(), + ), billingSubscription: core.serialization.property("billing_subscription", BillingSubscriptionView.optional()), billingSubscriptions: core.serialization.property( "billing_subscriptions", @@ -60,6 +66,8 @@ export declare namespace CompanyDetailResponseData { export interface Raw { add_ons: CompanyPlanWithBillingSubView.Raw[]; billing_credit_balances?: Record | null; + billing_profile?: CompanyBillingProfileResponseData.Raw | null; + billing_profiles?: CompanyBillingProfileResponseData.Raw[] | null; billing_subscription?: BillingSubscriptionView.Raw | null; billing_subscriptions: BillingSubscriptionView.Raw[]; created_at: string; diff --git a/src/serialization/types/CompanyOverrideResponseData.ts b/src/serialization/types/CompanyOverrideResponseData.ts index bdc4c395..95856238 100644 --- a/src/serialization/types/CompanyOverrideResponseData.ts +++ b/src/serialization/types/CompanyOverrideResponseData.ts @@ -3,6 +3,7 @@ import type * as Schematic from "../../api/index"; import * as core from "../../core"; import type * as serializers from "../index"; +import { BillingCreditResponseData } from "./BillingCreditResponseData"; import { CompanyDetailResponseData } from "./CompanyDetailResponseData"; import { CompanyOverrideNoteResponseData } from "./CompanyOverrideNoteResponseData"; import { EntitlementValueType } from "./EntitlementValueType"; @@ -31,6 +32,8 @@ export const CompanyOverrideResponseData: core.serialization.ObjectSchema< ruleIdUsageExceeded: core.serialization.property("rule_id_usage_exceeded", core.serialization.string().optional()), updatedAt: core.serialization.property("updated_at", core.serialization.date()), valueBool: core.serialization.property("value_bool", core.serialization.boolean().optional()), + valueCredit: core.serialization.property("value_credit", BillingCreditResponseData.optional()), + valueCreditId: core.serialization.property("value_credit_id", core.serialization.string().optional()), valueNumeric: core.serialization.property("value_numeric", core.serialization.number().optional()), valueTrait: core.serialization.property("value_trait", EntityTraitDefinitionResponseData.optional()), valueTraitId: core.serialization.property("value_trait_id", core.serialization.string().optional()), @@ -55,6 +58,8 @@ export declare namespace CompanyOverrideResponseData { rule_id_usage_exceeded?: string | null; updated_at: string; value_bool?: boolean | null; + value_credit?: BillingCreditResponseData.Raw | null; + value_credit_id?: string | null; value_numeric?: number | null; value_trait?: EntityTraitDefinitionResponseData.Raw | null; value_trait_id?: string | null; diff --git a/src/serialization/types/CreditSpendPolicyResponseData.ts b/src/serialization/types/CreditSpendPolicyResponseData.ts new file mode 100644 index 00000000..9f1bc294 --- /dev/null +++ b/src/serialization/types/CreditSpendPolicyResponseData.ts @@ -0,0 +1,35 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { CreditSpendPolicyScope } from "./CreditSpendPolicyScope"; + +export const CreditSpendPolicyResponseData: core.serialization.ObjectSchema< + serializers.CreditSpendPolicyResponseData.Raw, + Schematic.CreditSpendPolicyResponseData +> = core.serialization.object({ + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string()), + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + id: core.serialization.string(), + label: core.serialization.string().optional(), + maxPerDraw: core.serialization.property("max_per_draw", core.serialization.number().optional()), + scopeType: core.serialization.property("scope_type", CreditSpendPolicyScope), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + userId: core.serialization.property("user_id", core.serialization.string().optional()), +}); + +export declare namespace CreditSpendPolicyResponseData { + export interface Raw { + billing_credit_id: string; + company_id?: string | null; + created_at: string; + id: string; + label?: string | null; + max_per_draw?: number | null; + scope_type: CreditSpendPolicyScope.Raw; + updated_at: string; + user_id?: string | null; + } +} diff --git a/src/serialization/types/CreditSpendPolicyScope.ts b/src/serialization/types/CreditSpendPolicyScope.ts new file mode 100644 index 00000000..4be0f45a --- /dev/null +++ b/src/serialization/types/CreditSpendPolicyScope.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const CreditSpendPolicyScope: core.serialization.Schema< + serializers.CreditSpendPolicyScope.Raw, + Schematic.CreditSpendPolicyScope +> = core.serialization.enum_(["company", "user", "group"]); + +export declare namespace CreditSpendPolicyScope { + export type Raw = "company" | "user" | "group"; +} diff --git a/src/serialization/types/EventBodyInference.ts b/src/serialization/types/EventBodyInference.ts index 898174a7..5ec6b863 100644 --- a/src/serialization/types/EventBodyInference.ts +++ b/src/serialization/types/EventBodyInference.ts @@ -8,6 +8,10 @@ export const EventBodyInference: core.serialization.ObjectSchema< serializers.EventBodyInference.Raw, Schematic.EventBodyInference > = core.serialization.object({ + cacheCreationInputTokens: core.serialization.property( + "cache_creation_input_tokens", + core.serialization.number().optional(), + ), cachedInputTokens: core.serialization.property("cached_input_tokens", core.serialization.number().optional()), company: core.serialization.record(core.serialization.string(), core.serialization.string()), cost: core.serialization.string().optional(), @@ -26,6 +30,7 @@ export const EventBodyInference: core.serialization.ObjectSchema< export declare namespace EventBodyInference { export interface Raw { + cache_creation_input_tokens?: number | null; cached_input_tokens?: number | null; company: Record; cost?: string | null; diff --git a/src/serialization/types/GetOnboardingStateResp.ts b/src/serialization/types/GetOnboardingStateResp.ts index cae18d26..9c69b39d 100644 --- a/src/serialization/types/GetOnboardingStateResp.ts +++ b/src/serialization/types/GetOnboardingStateResp.ts @@ -15,6 +15,7 @@ export const GetOnboardingStateResp: core.serialization.ObjectSchema< Schematic.GetOnboardingStateResp > = core.serialization.object({ agentConnectedAt: core.serialization.property("agent_connected_at", core.serialization.date().optional()), + country: core.serialization.string().optional(), dismissedAt: core.serialization.property("dismissed_at", core.serialization.date().optional()), environmentId: core.serialization.property("environment_id", core.serialization.string().optional()), milestones: core.serialization.list(OnboardingMilestoneView), @@ -30,6 +31,7 @@ export const GetOnboardingStateResp: core.serialization.ObjectSchema< export declare namespace GetOnboardingStateResp { export interface Raw { agent_connected_at?: string | null; + country?: string | null; dismissed_at?: string | null; environment_id?: string | null; milestones: OnboardingMilestoneView.Raw[]; diff --git a/src/serialization/types/OtlpEnvironmentSettingsResponseData.ts b/src/serialization/types/OtlpEnvironmentSettingsResponseData.ts new file mode 100644 index 00000000..68645de9 --- /dev/null +++ b/src/serialization/types/OtlpEnvironmentSettingsResponseData.ts @@ -0,0 +1,32 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const OtlpEnvironmentSettingsResponseData: core.serialization.ObjectSchema< + serializers.OtlpEnvironmentSettingsResponseData.Raw, + Schematic.OtlpEnvironmentSettingsResponseData +> = core.serialization.object({ + companyAttribute: core.serialization.property("company_attribute", core.serialization.string().optional()), + companyKey: core.serialization.property("company_key", core.serialization.string().optional()), + createdAt: core.serialization.property("created_at", core.serialization.date()), + environmentId: core.serialization.property("environment_id", core.serialization.string()), + toolEventsEnabled: core.serialization.property("tool_events_enabled", core.serialization.boolean()), + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + userAttribute: core.serialization.property("user_attribute", core.serialization.string().optional()), + userKey: core.serialization.property("user_key", core.serialization.string().optional()), +}); + +export declare namespace OtlpEnvironmentSettingsResponseData { + export interface Raw { + company_attribute?: string | null; + company_key?: string | null; + created_at: string; + environment_id: string; + tool_events_enabled: boolean; + updated_at: string; + user_attribute?: string | null; + user_key?: string | null; + } +} diff --git a/src/serialization/types/RuleConditionDetailResponseData.ts b/src/serialization/types/RuleConditionDetailResponseData.ts index 7424c50a..56d878c0 100644 --- a/src/serialization/types/RuleConditionDetailResponseData.ts +++ b/src/serialization/types/RuleConditionDetailResponseData.ts @@ -10,6 +10,7 @@ import { EntityType } from "./EntityType"; import { MetricPeriod } from "./MetricPeriod"; import { MetricPeriodMonthReset } from "./MetricPeriodMonthReset"; import { PreviewObjectResponseData } from "./PreviewObjectResponseData"; +import { RuleConditionPlanVersionResponseData } from "./RuleConditionPlanVersionResponseData"; export const RuleConditionDetailResponseData: core.serialization.ObjectSchema< serializers.RuleConditionDetailResponseData.Raw, @@ -28,6 +29,10 @@ export const RuleConditionDetailResponseData: core.serialization.ObjectSchema< metricPeriodMonthReset: core.serialization.property("metric_period_month_reset", MetricPeriodMonthReset.optional()), metricValue: core.serialization.property("metric_value", core.serialization.number().optional()), operator: ComparableOperator, + planVersions: core.serialization.property( + "plan_versions", + core.serialization.list(RuleConditionPlanVersionResponseData).optional(), + ), resourceIds: core.serialization.property("resource_ids", core.serialization.list(core.serialization.string())), resources: core.serialization.list(PreviewObjectResponseData), ruleId: core.serialization.property("rule_id", core.serialization.string()), @@ -53,6 +58,7 @@ export declare namespace RuleConditionDetailResponseData { metric_period_month_reset?: MetricPeriodMonthReset.Raw | null; metric_value?: number | null; operator: ComparableOperator.Raw; + plan_versions?: RuleConditionPlanVersionResponseData.Raw[] | null; resource_ids: string[]; resources: PreviewObjectResponseData.Raw[]; rule_id: string; diff --git a/src/serialization/types/RuleConditionPlanVersionResponseData.ts b/src/serialization/types/RuleConditionPlanVersionResponseData.ts new file mode 100644 index 00000000..5bf073f6 --- /dev/null +++ b/src/serialization/types/RuleConditionPlanVersionResponseData.ts @@ -0,0 +1,25 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { PlanVersionStatus } from "./PlanVersionStatus"; + +export const RuleConditionPlanVersionResponseData: core.serialization.ObjectSchema< + serializers.RuleConditionPlanVersionResponseData.Raw, + Schematic.RuleConditionPlanVersionResponseData +> = core.serialization.object({ + id: core.serialization.string(), + name: core.serialization.string(), + status: PlanVersionStatus, + version: core.serialization.number(), +}); + +export declare namespace RuleConditionPlanVersionResponseData { + export interface Raw { + id: string; + name: string; + status: PlanVersionStatus.Raw; + version: number; + } +} diff --git a/src/serialization/types/StripeIntegrationConfig.ts b/src/serialization/types/StripeIntegrationConfig.ts index 52ae8ce7..ebe29be8 100644 --- a/src/serialization/types/StripeIntegrationConfig.ts +++ b/src/serialization/types/StripeIntegrationConfig.ts @@ -10,6 +10,15 @@ export const StripeIntegrationConfig: core.serialization.ObjectSchema< > = core.serialization.object({ accountId: core.serialization.property("account_id", core.serialization.string().optional()), accountName: core.serialization.property("account_name", core.serialization.string().optional()), + claimableSandboxExpiresAt: core.serialization.property( + "claimable_sandbox_expires_at", + core.serialization.date().optional(), + ), + claimableSandboxId: core.serialization.property("claimable_sandbox_id", core.serialization.string().optional()), + claimableSandboxStatus: core.serialization.property( + "claimable_sandbox_status", + core.serialization.string().optional(), + ), companyUpdateOnly: core.serialization.property("company_update_only", core.serialization.boolean().optional()), isSandbox: core.serialization.property("is_sandbox", core.serialization.boolean()), liveMode: core.serialization.property("live_mode", core.serialization.boolean()), @@ -21,6 +30,9 @@ export declare namespace StripeIntegrationConfig { export interface Raw { account_id?: string | null; account_name?: string | null; + claimable_sandbox_expires_at?: string | null; + claimable_sandbox_id?: string | null; + claimable_sandbox_status?: string | null; company_update_only?: boolean | null; is_sandbox: boolean; live_mode: boolean; diff --git a/src/serialization/types/StripeSandboxClaimLink.ts b/src/serialization/types/StripeSandboxClaimLink.ts new file mode 100644 index 00000000..13e25639 --- /dev/null +++ b/src/serialization/types/StripeSandboxClaimLink.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const StripeSandboxClaimLink: core.serialization.ObjectSchema< + serializers.StripeSandboxClaimLink.Raw, + Schematic.StripeSandboxClaimLink +> = core.serialization.object({ + claimUrl: core.serialization.property("claim_url", core.serialization.string()), + expiresAt: core.serialization.property("expires_at", core.serialization.date().optional()), + sandboxId: core.serialization.property("sandbox_id", core.serialization.string()), + status: core.serialization.string(), +}); + +export declare namespace StripeSandboxClaimLink { + export interface Raw { + claim_url: string; + expires_at?: string | null; + sandbox_id: string; + status: string; + } +} diff --git a/src/serialization/types/StripeSandboxCountriesResponseData.ts b/src/serialization/types/StripeSandboxCountriesResponseData.ts new file mode 100644 index 00000000..7b92e46f --- /dev/null +++ b/src/serialization/types/StripeSandboxCountriesResponseData.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const StripeSandboxCountriesResponseData: core.serialization.ObjectSchema< + serializers.StripeSandboxCountriesResponseData.Raw, + Schematic.StripeSandboxCountriesResponseData +> = core.serialization.object({ + countries: core.serialization.list(core.serialization.string()), +}); + +export declare namespace StripeSandboxCountriesResponseData { + export interface Raw { + countries: string[]; + } +} diff --git a/src/serialization/types/StripeSandboxInstallResponseData.ts b/src/serialization/types/StripeSandboxInstallResponseData.ts new file mode 100644 index 00000000..e8cd2a99 --- /dev/null +++ b/src/serialization/types/StripeSandboxInstallResponseData.ts @@ -0,0 +1,32 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { IntegrationInstallResponseData } from "./IntegrationInstallResponseData"; +import { StripeSandboxKeysResponseData } from "./StripeSandboxKeysResponseData"; + +export const StripeSandboxInstallResponseData: core.serialization.ObjectSchema< + serializers.StripeSandboxInstallResponseData.Raw, + Schematic.StripeSandboxInstallResponseData +> = core.serialization.object({ + apiKeys: core.serialization.property("api_keys", StripeSandboxKeysResponseData.optional()), + claimUrl: core.serialization.property("claim_url", core.serialization.string()), + claimUrlExpiresAt: core.serialization.property("claim_url_expires_at", core.serialization.date().optional()), + expiresAt: core.serialization.property("expires_at", core.serialization.date().optional()), + install: IntegrationInstallResponseData, + sandboxId: core.serialization.property("sandbox_id", core.serialization.string()), + stripeAccountId: core.serialization.property("stripe_account_id", core.serialization.string()), +}); + +export declare namespace StripeSandboxInstallResponseData { + export interface Raw { + api_keys?: StripeSandboxKeysResponseData.Raw | null; + claim_url: string; + claim_url_expires_at?: string | null; + expires_at?: string | null; + install: IntegrationInstallResponseData.Raw; + sandbox_id: string; + stripe_account_id: string; + } +} diff --git a/src/serialization/types/StripeSandboxKeysResponseData.ts b/src/serialization/types/StripeSandboxKeysResponseData.ts new file mode 100644 index 00000000..9bfcd7f7 --- /dev/null +++ b/src/serialization/types/StripeSandboxKeysResponseData.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const StripeSandboxKeysResponseData: core.serialization.ObjectSchema< + serializers.StripeSandboxKeysResponseData.Raw, + Schematic.StripeSandboxKeysResponseData +> = core.serialization.object({ + mcp: core.serialization.string(), + publishable: core.serialization.string(), + secret: core.serialization.string(), +}); + +export declare namespace StripeSandboxKeysResponseData { + export interface Raw { + mcp: string; + publishable: string; + secret: string; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 6e7d3cb9..f54b90e5 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -89,6 +89,7 @@ export * from "./CheckoutFieldValue"; export * from "./CheckoutFieldWithValue"; export * from "./CheckoutSettingsResponseData"; export * from "./CheckoutSubscription"; +export * from "./ClaimedStripeSandboxKeysResponseData"; export * from "./ClerkIntegrationConfig"; export * from "./CompanyBillingAddressView"; export * from "./CompanyBillingCheckoutSettings"; @@ -96,6 +97,7 @@ export * from "./CompanyBillingDetailsResponseData"; export * from "./CompanyBillingDetailsView"; export * from "./CompanyBillingEntityResponseData"; export * from "./CompanyBillingEntitySubscriptionResponseData"; +export * from "./CompanyBillingProfileResponseData"; export * from "./CompanyCreditBalance"; export * from "./CompanyCreditBalanceResponseData"; export * from "./CompanyDetailResponseData"; @@ -165,6 +167,8 @@ export * from "./CreditGrantDetail"; export * from "./CreditGrantExpiryRequestBody"; export * from "./CreditGrantSortOrder"; export * from "./CreditLeaseResponseData"; +export * from "./CreditSpendPolicyResponseData"; +export * from "./CreditSpendPolicyScope"; export * from "./CreditsAutoTopupCompanySummary"; export * from "./CreditsAutoTopupCreditSummary"; export * from "./CreditsAutoTopupHardFailure"; @@ -293,6 +297,7 @@ export * from "./OnboardingStripeImport"; export * from "./OnboardingTrack"; export * from "./OrbIntegrationConfig"; export * from "./OrderedPlansInGroup"; +export * from "./OtlpEnvironmentSettingsResponseData"; export * from "./PaymentMethodRequestBody"; export * from "./PaymentMethodResponseData"; export * from "./PendingMigrationResponseData"; @@ -357,6 +362,7 @@ export * from "./Rule"; export * from "./RuleConditionDetailResponseData"; export * from "./RuleConditionGroupDetailResponseData"; export * from "./RuleConditionGroupResponseData"; +export * from "./RuleConditionPlanVersionResponseData"; export * from "./RuleConditionResponseData"; export * from "./RuleDetailResponseData"; export * from "./RuleResponseData"; @@ -394,6 +400,10 @@ export * from "./SkippedEntitlementResponseData"; export * from "./SortDirection"; export * from "./StripeEmbedInfo"; export * from "./StripeIntegrationConfig"; +export * from "./StripeSandboxClaimLink"; +export * from "./StripeSandboxCountriesResponseData"; +export * from "./StripeSandboxInstallResponseData"; +export * from "./StripeSandboxKeysResponseData"; export * from "./SubscriptionStatus"; export * from "./SubscriptionTraitUpdate"; export * from "./SubscriptionType"; diff --git a/tests/wire/accounts.test.ts b/tests/wire/accounts.test.ts index 28eebd1f..73ca7e54 100644 --- a/tests/wire/accounts.test.ts +++ b/tests/wire/accounts.test.ts @@ -2403,6 +2403,7 @@ describe("AccountsClient", () => { const rawResponseBody = { data: { agent_connected_at: "2024-01-15T09:30:00Z", + country: "country", dismissed_at: "2024-01-15T09:30:00Z", environment_id: "environment_id", milestones: [{ id: "evaluated", missing: ["connect_agent"], progress: 1.1 }], @@ -2423,6 +2424,7 @@ describe("AccountsClient", () => { expect(response).toEqual({ data: { agentConnectedAt: new Date("2024-01-15T09:30:00.000Z"), + country: "country", dismissedAt: new Date("2024-01-15T09:30:00.000Z"), environmentId: "environment_id", milestones: [ @@ -2510,6 +2512,7 @@ describe("AccountsClient", () => { const rawResponseBody = { data: { agent_connected_at: "2024-01-15T09:30:00Z", + country: "country", dismissed_at: "2024-01-15T09:30:00Z", environment_id: "environment_id", milestones: [{ id: "evaluated", missing: ["connect_agent"], progress: 1.1 }], @@ -2537,6 +2540,7 @@ describe("AccountsClient", () => { expect(response).toEqual({ data: { agentConnectedAt: new Date("2024-01-15T09:30:00.000Z"), + country: "country", dismissedAt: new Date("2024-01-15T09:30:00.000Z"), environmentId: "environment_id", milestones: [ diff --git a/tests/wire/billing.test.ts b/tests/wire/billing.test.ts index f7c3b475..12d3b324 100644 --- a/tests/wire/billing.test.ts +++ b/tests/wire/billing.test.ts @@ -4005,6 +4005,310 @@ describe("BillingClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("listCompanyBillingProfiles (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: [ + { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], + params: { + company_id: "company_id", + is_default: true, + limit: 1000000, + offset: 1000000, + provider_type: "metronome", + }, + }; + + server.mockEndpoint().get("/billing/profiles").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.billing.listCompanyBillingProfiles({ + companyId: "company_id", + isDefault: true, + providerType: "metronome", + limit: 1000000, + offset: 1000000, + }); + expect(response).toEqual({ + data: [ + { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + params: { + companyId: "company_id", + isDefault: true, + limit: 1000000, + offset: 1000000, + providerType: "metronome", + }, + }); + }); + + test("listCompanyBillingProfiles (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/billing/profiles").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.billing.listCompanyBillingProfiles(); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("listCompanyBillingProfiles (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/billing/profiles").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.billing.listCompanyBillingProfiles(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("listCompanyBillingProfiles (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/billing/profiles").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.billing.listCompanyBillingProfiles(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("listCompanyBillingProfiles (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/billing/profiles").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.billing.listCompanyBillingProfiles(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("listCompanyBillingProfiles (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/billing/profiles").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.billing.listCompanyBillingProfiles(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("updateCompanyBillingProfile (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { collection_method: "charge_automatically" }; + const rawResponseBody = { + data: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .put("/billing/profiles/billing_profile_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically", + }); + expect(response).toEqual({ + data: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + params: { + key: "value", + }, + }); + }); + + test("updateCompanyBillingProfile (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { collection_method: "charge_automatically" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/profiles/billing_profile_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("updateCompanyBillingProfile (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { collection_method: "charge_automatically" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/profiles/billing_profile_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("updateCompanyBillingProfile (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { collection_method: "charge_automatically" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/profiles/billing_profile_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("updateCompanyBillingProfile (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { collection_method: "charge_automatically" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/profiles/billing_profile_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("updateCompanyBillingProfile (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { collection_method: "charge_automatically" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/profiles/billing_profile_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.billing.updateCompanyBillingProfile("billing_profile_id", { + collectionMethod: "charge_automatically", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("upsertBillingSubscription (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); diff --git a/tests/wire/checkout.test.ts b/tests/wire/checkout.test.ts index e2699d1c..a0b0b78b 100644 --- a/tests/wire/checkout.test.ts +++ b/tests/wire/checkout.test.ts @@ -1039,6 +1039,30 @@ describe("CheckoutClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -2147,6 +2171,30 @@ describe("CheckoutClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -4078,6 +4126,30 @@ describe("CheckoutClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -4407,6 +4479,30 @@ describe("CheckoutClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -5635,6 +5731,30 @@ describe("CheckoutClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -5941,6 +6061,30 @@ describe("CheckoutClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/companies.test.ts b/tests/wire/companies.test.ts index 3be53d1a..85f63a73 100644 --- a/tests/wire/companies.test.ts +++ b/tests/wire/companies.test.ts @@ -38,6 +38,30 @@ describe("CompaniesClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -378,6 +402,30 @@ describe("CompaniesClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -773,6 +821,35 @@ describe("CompaniesClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { application_id: "application_id", cancel_at: 1000000, @@ -1134,6 +1211,35 @@ describe("CompaniesClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { applicationId: "application_id", cancelAt: 1000000, @@ -1621,6 +1727,35 @@ describe("CompaniesClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { application_id: "application_id", cancel_at: 1000000, @@ -1977,6 +2112,35 @@ describe("CompaniesClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { applicationId: "application_id", cancelAt: 1000000, @@ -2695,6 +2859,35 @@ describe("CompaniesClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { application_id: "application_id", cancel_at: 1000000, @@ -3056,6 +3249,35 @@ describe("CompaniesClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { applicationId: "application_id", cancelAt: 1000000, @@ -4079,6 +4301,56 @@ describe("CompaniesClient", () => { }, ], billing_credit_balances: { billing_credit_balances: 1.1 }, + billing_profile: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { application_id: "application_id", cancel_at: 1000000, @@ -5850,6 +6122,56 @@ describe("CompaniesClient", () => { billingCreditBalances: { billing_credit_balances: 1.1, }, + billingProfile: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { applicationId: "application_id", cancelAt: 1000000, @@ -8565,6 +8887,35 @@ describe("CompaniesClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { application_id: "application_id", cancel_at: 1000000, @@ -8927,6 +9278,35 @@ describe("CompaniesClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { applicationId: "application_id", cancelAt: 1000000, diff --git a/tests/wire/components.test.ts b/tests/wire/components.test.ts index 9333a457..ee20a5c2 100644 --- a/tests/wire/components.test.ts +++ b/tests/wire/components.test.ts @@ -1264,6 +1264,30 @@ describe("ComponentsClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -2660,6 +2684,30 @@ describe("ComponentsClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/credits.test.ts b/tests/wire/credits.test.ts index 6440ab83..ad33fa07 100644 --- a/tests/wire/credits.test.ts +++ b/tests/wire/credits.test.ts @@ -3811,6 +3811,30 @@ describe("CreditsClient", () => { const rawRequestBody = { company_id: "company_id", credit_type_id: "credit_type_id", requested_amount: 1.1 }; const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .post("/billing/credits/lease") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(402) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.acquireCreditLease({ + companyId: "company_id", + creditTypeId: "credit_type_id", + requestedAmount: 1.1, + }); + }).rejects.toThrow(Schematic.PaymentRequiredError); + }); + + test("acquireCreditLease (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { company_id: "company_id", credit_type_id: "credit_type_id", requested_amount: 1.1 }; + const rawResponseBody = { error: "error" }; + server .mockEndpoint() .post("/billing/credits/lease") @@ -3829,7 +3853,7 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.ForbiddenError); }); - test("acquireCreditLease (5)", async () => { + test("acquireCreditLease (6)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { company_id: "company_id", credit_type_id: "credit_type_id", requested_amount: 1.1 }; @@ -3853,7 +3877,7 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.NotFoundError); }); - test("acquireCreditLease (6)", async () => { + test("acquireCreditLease (7)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { company_id: "company_id", credit_type_id: "credit_type_id", requested_amount: 1.1 }; @@ -3976,6 +4000,28 @@ describe("CreditsClient", () => { const rawRequestBody = { additional_amount: 1.1 }; const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .put("/billing/credits/lease/lease_id/extend") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(402) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.extendCreditLease("lease_id", { + additionalAmount: 1.1, + }); + }).rejects.toThrow(Schematic.PaymentRequiredError); + }); + + test("extendCreditLease (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { additional_amount: 1.1 }; + const rawResponseBody = { error: "error" }; + server .mockEndpoint() .put("/billing/credits/lease/lease_id/extend") @@ -3992,7 +4038,7 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.ForbiddenError); }); - test("extendCreditLease (5)", async () => { + test("extendCreditLease (6)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { additional_amount: 1.1 }; @@ -4014,7 +4060,7 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.NotFoundError); }); - test("extendCreditLease (6)", async () => { + test("extendCreditLease (7)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { additional_amount: 1.1 }; @@ -5619,6 +5665,872 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("listCreditSpendPolicies (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: [ + { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + id: "id", + label: "label", + max_per_draw: 1.1, + scope_type: "company", + updated_at: "2024-01-15T09:30:00Z", + user_id: "user_id", + }, + ], + params: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + limit: 1000000, + offset: 1000000, + scope_type: "company", + user_id: "user_id", + user_ids: ["user_ids"], + }, + }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.listCreditSpendPolicies({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + scopeType: "company", + userId: "user_id", + userIds: ["user_ids"], + limit: 1000000, + offset: 1000000, + }); + expect(response).toEqual({ + data: [ + { + billingCreditId: "billing_credit_id", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + label: "label", + maxPerDraw: 1.1, + scopeType: "company", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + userId: "user_id", + }, + ], + params: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + limit: 1000000, + offset: 1000000, + scopeType: "company", + userId: "user_id", + userIds: ["user_ids"], + }, + }); + }); + + test("listCreditSpendPolicies (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditSpendPolicies(); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("listCreditSpendPolicies (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditSpendPolicies(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("listCreditSpendPolicies (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditSpendPolicies(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("listCreditSpendPolicies (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditSpendPolicies(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("listCreditSpendPolicies (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditSpendPolicies(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("createCreditSpendPolicy (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { billing_credit_id: "billing_credit_id", max_per_draw: 1.1 }; + const rawResponseBody = { + data: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + id: "id", + label: "label", + max_per_draw: 1.1, + scope_type: "company", + updated_at: "2024-01-15T09:30:00Z", + user_id: "user_id", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .post("/billing/credits/spend-policies") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.createCreditSpendPolicy({ + billingCreditId: "billing_credit_id", + maxPerDraw: 1.1, + }); + expect(response).toEqual({ + data: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + label: "label", + maxPerDraw: 1.1, + scopeType: "company", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + userId: "user_id", + }, + params: { + key: "value", + }, + }); + }); + + test("createCreditSpendPolicy (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { billing_credit_id: "billing_credit_id", max_per_draw: 1.1 }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/billing/credits/spend-policies") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.createCreditSpendPolicy({ + billingCreditId: "billing_credit_id", + maxPerDraw: 1.1, + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("createCreditSpendPolicy (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { billing_credit_id: "billing_credit_id", max_per_draw: 1.1 }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/billing/credits/spend-policies") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.createCreditSpendPolicy({ + billingCreditId: "billing_credit_id", + maxPerDraw: 1.1, + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("createCreditSpendPolicy (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { billing_credit_id: "billing_credit_id", max_per_draw: 1.1 }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/billing/credits/spend-policies") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.createCreditSpendPolicy({ + billingCreditId: "billing_credit_id", + maxPerDraw: 1.1, + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("createCreditSpendPolicy (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { billing_credit_id: "billing_credit_id", max_per_draw: 1.1 }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/billing/credits/spend-policies") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.createCreditSpendPolicy({ + billingCreditId: "billing_credit_id", + maxPerDraw: 1.1, + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("createCreditSpendPolicy (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { billing_credit_id: "billing_credit_id", max_per_draw: 1.1 }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/billing/credits/spend-policies") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.createCreditSpendPolicy({ + billingCreditId: "billing_credit_id", + maxPerDraw: 1.1, + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getCreditSpendPolicy (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + id: "id", + label: "label", + max_per_draw: 1.1, + scope_type: "company", + updated_at: "2024-01-15T09:30:00Z", + user_id: "user_id", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.getCreditSpendPolicy("spend_policy_id"); + expect(response).toEqual({ + data: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + label: "label", + maxPerDraw: 1.1, + scopeType: "company", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + userId: "user_id", + }, + params: { + key: "value", + }, + }); + }); + + test("getCreditSpendPolicy (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.getCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getCreditSpendPolicy (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.getCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getCreditSpendPolicy (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.getCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getCreditSpendPolicy (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.getCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("updateCreditSpendPolicy (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { + data: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + id: "id", + label: "label", + max_per_draw: 1.1, + scope_type: "company", + updated_at: "2024-01-15T09:30:00Z", + user_id: "user_id", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .put("/billing/credits/spend-policies/spend_policy_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.updateCreditSpendPolicy("spend_policy_id"); + expect(response).toEqual({ + data: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + label: "label", + maxPerDraw: 1.1, + scopeType: "company", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + userId: "user_id", + }, + params: { + key: "value", + }, + }); + }); + + test("updateCreditSpendPolicy (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/credits/spend-policies/spend_policy_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.updateCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("updateCreditSpendPolicy (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/credits/spend-policies/spend_policy_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.updateCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("updateCreditSpendPolicy (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/credits/spend-policies/spend_policy_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.updateCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("updateCreditSpendPolicy (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/credits/spend-policies/spend_policy_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.updateCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("updateCreditSpendPolicy (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .put("/billing/credits/spend-policies/spend_policy_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.updateCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("deleteCreditSpendPolicy (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { data: { deleted: true }, params: { key: "value" } }; + + server + .mockEndpoint() + .delete("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.deleteCreditSpendPolicy("spend_policy_id"); + expect(response).toEqual({ + data: { + deleted: true, + }, + params: { + key: "value", + }, + }); + }); + + test("deleteCreditSpendPolicy (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.deleteCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("deleteCreditSpendPolicy (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.deleteCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("deleteCreditSpendPolicy (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.deleteCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("deleteCreditSpendPolicy (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.deleteCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("deleteCreditSpendPolicy (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/billing/credits/spend-policies/spend_policy_id") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.deleteCreditSpendPolicy("spend_policy_id"); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("countCreditSpendPolicies (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { count: 1000000 }, + params: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + limit: 1000000, + offset: 1000000, + scope_type: "company", + user_id: "user_id", + user_ids: ["user_ids"], + }, + }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/count") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.countCreditSpendPolicies({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + scopeType: "company", + userId: "user_id", + userIds: ["user_ids"], + limit: 1000000, + offset: 1000000, + }); + expect(response).toEqual({ + data: { + count: 1000000, + }, + params: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + limit: 1000000, + offset: 1000000, + scopeType: "company", + userId: "user_id", + userIds: ["user_ids"], + }, + }); + }); + + test("countCreditSpendPolicies (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/count") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditSpendPolicies(); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("countCreditSpendPolicies (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/count") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditSpendPolicies(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("countCreditSpendPolicies (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/count") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditSpendPolicies(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("countCreditSpendPolicies (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/count") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditSpendPolicies(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("countCreditSpendPolicies (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/billing/credits/spend-policies/count") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditSpendPolicies(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("listCreditEventLedger (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); diff --git a/tests/wire/entitlements.test.ts b/tests/wire/entitlements.test.ts index b4c3b24d..5edac2be 100644 --- a/tests/wire/entitlements.test.ts +++ b/tests/wire/entitlements.test.ts @@ -228,6 +228,19 @@ describe("EntitlementsClient", () => { rule_id_usage_exceeded: "rule_id_usage_exceeded", updated_at: "2024-01-15T09:30:00Z", value_bool: true, + value_credit: { + burn_strategy: "expiration_priority", + cost_editable: true, + created_at: "2024-01-15T09:30:00Z", + currency_prices: [{ currency: "currency" }], + default_expiry_unit: "billing_periods", + default_rollover_policy: "expire", + description: "description", + id: "id", + name: "name", + updated_at: "2024-01-15T09:30:00Z", + }, + value_credit_id: "value_credit_id", value_numeric: 1000000, value_trait: { created_at: "2024-01-15T09:30:00Z", @@ -498,6 +511,23 @@ describe("EntitlementsClient", () => { ruleIdUsageExceeded: "rule_id_usage_exceeded", updatedAt: new Date("2024-01-15T09:30:00.000Z"), valueBool: true, + valueCredit: { + burnStrategy: "expiration_priority", + costEditable: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + currencyPrices: [ + { + currency: "currency", + }, + ], + defaultExpiryUnit: "billing_periods", + defaultRolloverPolicy: "expire", + description: "description", + id: "id", + name: "name", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + valueCreditId: "value_credit_id", valueNumeric: 1000000, valueTrait: { createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -624,6 +654,30 @@ describe("EntitlementsClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -922,6 +976,46 @@ describe("EntitlementsClient", () => { rule_id_usage_exceeded: "rule_id_usage_exceeded", updated_at: "2024-01-15T09:30:00Z", value_bool: true, + value_credit: { + burn_strategy: "expiration_priority", + cost_editable: true, + created_at: "2024-01-15T09:30:00Z", + currency_prices: [{ currency: "currency" }], + default_expiry_unit: "billing_periods", + default_expiry_unit_count: 1000000, + default_rollover_policy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + plural_name: "plural_name", + price: { + currency: "currency", + external_price_id: "external_price_id", + id: "id", + interval: "day", + interval_count: 1000000, + price: 1000000, + provider_type: "metronome", + scheme: "per_unit", + }, + product: { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + external_id: "external_id", + is_active: true, + name: "name", + price: 1.1, + product_id: "product_id", + provider_type: "metronome", + quantity: 1.1, + updated_at: "2024-01-15T09:30:00Z", + }, + singular_name: "singular_name", + updated_at: "2024-01-15T09:30:00Z", + }, + value_credit_id: "value_credit_id", value_numeric: 1000000, value_trait: { created_at: "2024-01-15T09:30:00Z", @@ -983,6 +1077,30 @@ describe("EntitlementsClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -1294,6 +1412,50 @@ describe("EntitlementsClient", () => { ruleIdUsageExceeded: "rule_id_usage_exceeded", updatedAt: new Date("2024-01-15T09:30:00.000Z"), valueBool: true, + valueCredit: { + burnStrategy: "expiration_priority", + costEditable: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + currencyPrices: [ + { + currency: "currency", + }, + ], + defaultExpiryUnit: "billing_periods", + defaultExpiryUnitCount: 1000000, + defaultRolloverPolicy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + pluralName: "plural_name", + price: { + currency: "currency", + externalPriceId: "external_price_id", + id: "id", + interval: "day", + intervalCount: 1000000, + price: 1000000, + providerType: "metronome", + scheme: "per_unit", + }, + product: { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + externalId: "external_id", + isActive: true, + name: "name", + price: 1.1, + productId: "product_id", + providerType: "metronome", + quantity: 1.1, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + singularName: "singular_name", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + valueCreditId: "value_credit_id", valueNumeric: 1000000, valueTrait: { createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -1466,6 +1628,30 @@ describe("EntitlementsClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -1764,6 +1950,46 @@ describe("EntitlementsClient", () => { rule_id_usage_exceeded: "rule_id_usage_exceeded", updated_at: "2024-01-15T09:30:00Z", value_bool: true, + value_credit: { + burn_strategy: "expiration_priority", + cost_editable: true, + created_at: "2024-01-15T09:30:00Z", + currency_prices: [{ currency: "currency" }], + default_expiry_unit: "billing_periods", + default_expiry_unit_count: 1000000, + default_rollover_policy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + plural_name: "plural_name", + price: { + currency: "currency", + external_price_id: "external_price_id", + id: "id", + interval: "day", + interval_count: 1000000, + price: 1000000, + provider_type: "metronome", + scheme: "per_unit", + }, + product: { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + external_id: "external_id", + is_active: true, + name: "name", + price: 1.1, + product_id: "product_id", + provider_type: "metronome", + quantity: 1.1, + updated_at: "2024-01-15T09:30:00Z", + }, + singular_name: "singular_name", + updated_at: "2024-01-15T09:30:00Z", + }, + value_credit_id: "value_credit_id", value_numeric: 1000000, value_trait: { created_at: "2024-01-15T09:30:00Z", @@ -1820,6 +2046,30 @@ describe("EntitlementsClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -2131,6 +2381,50 @@ describe("EntitlementsClient", () => { ruleIdUsageExceeded: "rule_id_usage_exceeded", updatedAt: new Date("2024-01-15T09:30:00.000Z"), valueBool: true, + valueCredit: { + burnStrategy: "expiration_priority", + costEditable: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + currencyPrices: [ + { + currency: "currency", + }, + ], + defaultExpiryUnit: "billing_periods", + defaultExpiryUnitCount: 1000000, + defaultRolloverPolicy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + pluralName: "plural_name", + price: { + currency: "currency", + externalPriceId: "external_price_id", + id: "id", + interval: "day", + intervalCount: 1000000, + price: 1000000, + providerType: "metronome", + scheme: "per_unit", + }, + product: { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + externalId: "external_id", + isActive: true, + name: "name", + price: 1.1, + productId: "product_id", + providerType: "metronome", + quantity: 1.1, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + singularName: "singular_name", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + valueCreditId: "value_credit_id", valueNumeric: 1000000, valueTrait: { createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -2259,6 +2553,30 @@ describe("EntitlementsClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -2557,6 +2875,46 @@ describe("EntitlementsClient", () => { rule_id_usage_exceeded: "rule_id_usage_exceeded", updated_at: "2024-01-15T09:30:00Z", value_bool: true, + value_credit: { + burn_strategy: "expiration_priority", + cost_editable: true, + created_at: "2024-01-15T09:30:00Z", + currency_prices: [{ currency: "currency" }], + default_expiry_unit: "billing_periods", + default_expiry_unit_count: 1000000, + default_rollover_policy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + plural_name: "plural_name", + price: { + currency: "currency", + external_price_id: "external_price_id", + id: "id", + interval: "day", + interval_count: 1000000, + price: 1000000, + provider_type: "metronome", + scheme: "per_unit", + }, + product: { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + external_id: "external_id", + is_active: true, + name: "name", + price: 1.1, + product_id: "product_id", + provider_type: "metronome", + quantity: 1.1, + updated_at: "2024-01-15T09:30:00Z", + }, + singular_name: "singular_name", + updated_at: "2024-01-15T09:30:00Z", + }, + value_credit_id: "value_credit_id", value_numeric: 1000000, value_trait: { created_at: "2024-01-15T09:30:00Z", @@ -2613,9 +2971,33 @@ describe("EntitlementsClient", () => { name: "name", }, ], - billingCreditBalances: { - key: 1.1, - }, + billingCreditBalances: { + key: 1.1, + }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -2927,6 +3309,50 @@ describe("EntitlementsClient", () => { ruleIdUsageExceeded: "rule_id_usage_exceeded", updatedAt: new Date("2024-01-15T09:30:00.000Z"), valueBool: true, + valueCredit: { + burnStrategy: "expiration_priority", + costEditable: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + currencyPrices: [ + { + currency: "currency", + }, + ], + defaultExpiryUnit: "billing_periods", + defaultExpiryUnitCount: 1000000, + defaultRolloverPolicy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + pluralName: "plural_name", + price: { + currency: "currency", + externalPriceId: "external_price_id", + id: "id", + interval: "day", + intervalCount: 1000000, + price: 1000000, + providerType: "metronome", + scheme: "per_unit", + }, + product: { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + externalId: "external_id", + isActive: true, + name: "name", + price: 1.1, + productId: "product_id", + providerType: "metronome", + quantity: 1.1, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + singularName: "singular_name", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + valueCreditId: "value_credit_id", valueNumeric: 1000000, valueTrait: { createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -9384,6 +9810,18 @@ describe("EntitlementsClient", () => { { id: "id", included_credit_grants: [], name: "name" }, ], billing_credit_balances: { billing_credit_balances: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -9668,6 +10106,46 @@ describe("EntitlementsClient", () => { rule_id_usage_exceeded: "rule_id_usage_exceeded", updated_at: "2024-01-15T09:30:00Z", value_bool: true, + value_credit: { + burn_strategy: "expiration_priority", + cost_editable: true, + created_at: "2024-01-15T09:30:00Z", + currency_prices: [{ currency: "currency" }, { currency: "currency" }], + default_expiry_unit: "billing_periods", + default_expiry_unit_count: 1000000, + default_rollover_policy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + plural_name: "plural_name", + price: { + currency: "currency", + external_price_id: "external_price_id", + id: "id", + interval: "day", + interval_count: 1000000, + price: 1000000, + provider_type: "metronome", + scheme: "per_unit", + }, + product: { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + external_id: "external_id", + is_active: true, + name: "name", + price: 1.1, + product_id: "product_id", + provider_type: "metronome", + quantity: 1.1, + updated_at: "2024-01-15T09:30:00Z", + }, + singular_name: "singular_name", + updated_at: "2024-01-15T09:30:00Z", + }, + value_credit_id: "value_credit_id", value_numeric: 1000000, value_trait: { created_at: "2024-01-15T09:30:00Z", @@ -10334,6 +10812,18 @@ describe("EntitlementsClient", () => { { id: "id", included_credit_grants: [], name: "name" }, ], billing_credit_balances: { billing_credit_balances: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -10618,6 +11108,46 @@ describe("EntitlementsClient", () => { rule_id_usage_exceeded: "rule_id_usage_exceeded", updated_at: "2024-01-15T09:30:00Z", value_bool: true, + value_credit: { + burn_strategy: "expiration_priority", + cost_editable: true, + created_at: "2024-01-15T09:30:00Z", + currency_prices: [{ currency: "currency" }, { currency: "currency" }], + default_expiry_unit: "billing_periods", + default_expiry_unit_count: 1000000, + default_rollover_policy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + plural_name: "plural_name", + price: { + currency: "currency", + external_price_id: "external_price_id", + id: "id", + interval: "day", + interval_count: 1000000, + price: 1000000, + provider_type: "metronome", + scheme: "per_unit", + }, + product: { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + external_id: "external_id", + is_active: true, + name: "name", + price: 1.1, + product_id: "product_id", + provider_type: "metronome", + quantity: 1.1, + updated_at: "2024-01-15T09:30:00Z", + }, + singular_name: "singular_name", + updated_at: "2024-01-15T09:30:00Z", + }, + value_credit_id: "value_credit_id", value_numeric: 1000000, value_trait: { created_at: "2024-01-15T09:30:00Z", @@ -11309,6 +11839,18 @@ describe("EntitlementsClient", () => { billingCreditBalances: { billing_credit_balances: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -11615,6 +12157,53 @@ describe("EntitlementsClient", () => { ruleIdUsageExceeded: "rule_id_usage_exceeded", updatedAt: new Date("2024-01-15T09:30:00.000Z"), valueBool: true, + valueCredit: { + burnStrategy: "expiration_priority", + costEditable: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + currencyPrices: [ + { + currency: "currency", + }, + { + currency: "currency", + }, + ], + defaultExpiryUnit: "billing_periods", + defaultExpiryUnitCount: 1000000, + defaultRolloverPolicy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + pluralName: "plural_name", + price: { + currency: "currency", + externalPriceId: "external_price_id", + id: "id", + interval: "day", + intervalCount: 1000000, + price: 1000000, + providerType: "metronome", + scheme: "per_unit", + }, + product: { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + externalId: "external_id", + isActive: true, + name: "name", + price: 1.1, + productId: "product_id", + providerType: "metronome", + quantity: 1.1, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + singularName: "singular_name", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + valueCreditId: "value_credit_id", valueNumeric: 1000000, valueTrait: { createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -12318,6 +12907,18 @@ describe("EntitlementsClient", () => { billingCreditBalances: { billing_credit_balances: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), @@ -12624,6 +13225,53 @@ describe("EntitlementsClient", () => { ruleIdUsageExceeded: "rule_id_usage_exceeded", updatedAt: new Date("2024-01-15T09:30:00.000Z"), valueBool: true, + valueCredit: { + burnStrategy: "expiration_priority", + costEditable: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + currencyPrices: [ + { + currency: "currency", + }, + { + currency: "currency", + }, + ], + defaultExpiryUnit: "billing_periods", + defaultExpiryUnitCount: 1000000, + defaultRolloverPolicy: "expire", + description: "description", + icon: "icon", + id: "id", + name: "name", + pluralName: "plural_name", + price: { + currency: "currency", + externalPriceId: "external_price_id", + id: "id", + interval: "day", + intervalCount: 1000000, + price: 1000000, + providerType: "metronome", + scheme: "per_unit", + }, + product: { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + externalId: "external_id", + isActive: true, + name: "name", + price: 1.1, + productId: "product_id", + providerType: "metronome", + quantity: 1.1, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + singularName: "singular_name", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + valueCreditId: "value_credit_id", valueNumeric: 1000000, valueTrait: { createdAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/events.test.ts b/tests/wire/events.test.ts index f412ef88..695d502a 100644 --- a/tests/wire/events.test.ts +++ b/tests/wire/events.test.ts @@ -819,6 +819,337 @@ describe("EventsClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("getOTLPEnvironmentSettings (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + company_attribute: "company_attribute", + company_key: "company_key", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + tool_events_enabled: true, + updated_at: "2024-01-15T09:30:00Z", + user_attribute: "user_attribute", + user_key: "user_key", + }, + params: { key: "value" }, + }; + + server.mockEndpoint().get("/otlp/settings").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.events.getOtlpEnvironmentSettings(); + expect(response).toEqual({ + data: { + companyAttribute: "company_attribute", + companyKey: "company_key", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + toolEventsEnabled: true, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + userAttribute: "user_attribute", + userKey: "user_key", + }, + params: { + key: "value", + }, + }); + }); + + test("getOTLPEnvironmentSettings (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/otlp/settings").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.getOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getOTLPEnvironmentSettings (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/otlp/settings").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.getOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getOTLPEnvironmentSettings (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/otlp/settings").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.getOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getOTLPEnvironmentSettings (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/otlp/settings").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.getOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("upsertOTLPEnvironmentSettings (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { tool_events_enabled: true }; + const rawResponseBody = { + data: { + company_attribute: "company_attribute", + company_key: "company_key", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + tool_events_enabled: true, + updated_at: "2024-01-15T09:30:00Z", + user_attribute: "user_attribute", + user_key: "user_key", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .post("/otlp/settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true, + }); + expect(response).toEqual({ + data: { + companyAttribute: "company_attribute", + companyKey: "company_key", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + toolEventsEnabled: true, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + userAttribute: "user_attribute", + userKey: "user_key", + }, + params: { + key: "value", + }, + }); + }); + + test("upsertOTLPEnvironmentSettings (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { tool_events_enabled: true }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/otlp/settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true, + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("upsertOTLPEnvironmentSettings (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { tool_events_enabled: true }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/otlp/settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true, + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("upsertOTLPEnvironmentSettings (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { tool_events_enabled: true }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/otlp/settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true, + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("upsertOTLPEnvironmentSettings (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { tool_events_enabled: true }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/otlp/settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true, + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("upsertOTLPEnvironmentSettings (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { tool_events_enabled: true }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/otlp/settings") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.events.upsertOtlpEnvironmentSettings({ + toolEventsEnabled: true, + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("deleteOTLPEnvironmentSettings (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { data: { deleted: true }, params: { key: "value" } }; + + server.mockEndpoint().delete("/otlp/settings").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.events.deleteOtlpEnvironmentSettings(); + expect(response).toEqual({ + data: { + deleted: true, + }, + params: { + key: "value", + }, + }); + }); + + test("deleteOTLPEnvironmentSettings (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().delete("/otlp/settings").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.deleteOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("deleteOTLPEnvironmentSettings (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().delete("/otlp/settings").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.deleteOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("deleteOTLPEnvironmentSettings (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().delete("/otlp/settings").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.deleteOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("deleteOTLPEnvironmentSettings (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().delete("/otlp/settings").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.deleteOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("deleteOTLPEnvironmentSettings (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().delete("/otlp/settings").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.events.deleteOtlpEnvironmentSettings(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("getSegmentIntegrationStatus (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); diff --git a/tests/wire/integrationsapi.test.ts b/tests/wire/integrationsapi.test.ts index 2d9d820a..cb2e33b8 100644 --- a/tests/wire/integrationsapi.test.ts +++ b/tests/wire/integrationsapi.test.ts @@ -795,6 +795,367 @@ describe("IntegrationsapiClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("getStripeSandboxClaimLink (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + claim_url: "claim_url", + expires_at: "2024-01-15T09:30:00Z", + sandbox_id: "sandbox_id", + status: "status", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/claim-link") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.getStripeSandboxClaimLink(); + expect(response).toEqual({ + data: { + claimUrl: "claim_url", + expiresAt: new Date("2024-01-15T09:30:00.000Z"), + sandboxId: "sandbox_id", + status: "status", + }, + params: { + key: "value", + }, + }); + }); + + test("getStripeSandboxClaimLink (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/claim-link") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxClaimLink(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getStripeSandboxClaimLink (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/claim-link") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxClaimLink(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getStripeSandboxClaimLink (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/claim-link") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxClaimLink(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getStripeSandboxClaimLink (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/claim-link") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxClaimLink(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getStripeSandboxKeys (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { publishable: "publishable", sandbox_id: "sandbox_id", secret: "secret" }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/keys") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.getStripeSandboxKeys(); + expect(response).toEqual({ + data: { + publishable: "publishable", + sandboxId: "sandbox_id", + secret: "secret", + }, + params: { + key: "value", + }, + }); + }); + + test("getStripeSandboxKeys (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/keys") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxKeys(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getStripeSandboxKeys (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/keys") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxKeys(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getStripeSandboxKeys (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/keys") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxKeys(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getStripeSandboxKeys (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/sandbox/keys") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.getStripeSandboxKeys(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("claimStripeSandboxKeys (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { token: "token" }; + const rawResponseBody = { + data: { publishable: "publishable", sandbox_id: "sandbox_id", secret: "secret" }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .post("/integrations/stripe/sandbox/keys/claim") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.claimStripeSandboxKeys({ + token: "token", + }); + expect(response).toEqual({ + data: { + publishable: "publishable", + sandboxId: "sandbox_id", + secret: "secret", + }, + params: { + key: "value", + }, + }); + }); + + test("claimStripeSandboxKeys (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { token: "x" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/sandbox/keys/claim") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.claimStripeSandboxKeys({ + token: "x", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("claimStripeSandboxKeys (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { token: "x" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/sandbox/keys/claim") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.claimStripeSandboxKeys({ + token: "x", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("claimStripeSandboxKeys (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { token: "x" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/sandbox/keys/claim") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.claimStripeSandboxKeys({ + token: "x", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("claimStripeSandboxKeys (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { token: "x" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/sandbox/keys/claim") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.claimStripeSandboxKeys({ + token: "x", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("claimStripeSandboxKeys (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { token: "x" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/sandbox/keys/claim") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.claimStripeSandboxKeys({ + token: "x", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("assumeStripeInstalled (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); @@ -1169,6 +1530,306 @@ describe("IntegrationsapiClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("installStripeClaimableSandbox (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { email: "email" }; + const rawResponseBody = { + data: { + api_keys: { mcp: "mcp", publishable: "publishable", secret: "secret" }, + claim_url: "claim_url", + claim_url_expires_at: "2024-01-15T09:30:00Z", + expires_at: "2024-01-15T09:30:00Z", + install: { + capabilities: { author_plans: true, checkout: true, edit_billing: true }, + config: { + created_at: "2024-01-15T09:30:00Z", + id: "id", + integration_id: "integration_id", + is_app_install: true, + is_connect_install: true, + live_mode: true, + updated_at: "2024-01-15T09:30:00Z", + }, + integration: { + created_at: "2024-01-15T09:30:00Z", + id: "id", + state: "active", + type: "clerk", + updated_at: "2024-01-15T09:30:00Z", + }, + }, + sandbox_id: "sandbox_id", + stripe_account_id: "stripe_account_id", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .post("/integrations/stripe/v2/sandbox") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.installStripeClaimableSandbox({ + email: "email", + }); + expect(response).toEqual({ + data: { + apiKeys: { + mcp: "mcp", + publishable: "publishable", + secret: "secret", + }, + claimUrl: "claim_url", + claimUrlExpiresAt: new Date("2024-01-15T09:30:00.000Z"), + expiresAt: new Date("2024-01-15T09:30:00.000Z"), + install: { + capabilities: { + authorPlans: true, + checkout: true, + editBilling: true, + }, + config: { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + integrationId: "integration_id", + isAppInstall: true, + isConnectInstall: true, + liveMode: true, + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + integration: { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + state: "active", + type: "clerk", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + }, + sandboxId: "sandbox_id", + stripeAccountId: "stripe_account_id", + }, + params: { + key: "value", + }, + }); + }); + + test("installStripeClaimableSandbox (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { email: "email" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/v2/sandbox") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.installStripeClaimableSandbox({ + email: "email", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("installStripeClaimableSandbox (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { email: "email" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/v2/sandbox") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.installStripeClaimableSandbox({ + email: "email", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("installStripeClaimableSandbox (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { email: "email" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/v2/sandbox") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.installStripeClaimableSandbox({ + email: "email", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("installStripeClaimableSandbox (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { email: "email" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/v2/sandbox") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.installStripeClaimableSandbox({ + email: "email", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("installStripeClaimableSandbox (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { email: "email" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/stripe/v2/sandbox") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.installStripeClaimableSandbox({ + email: "email", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("listStripeSandboxCountries (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { data: { countries: ["countries"] }, params: { key: "value" } }; + + server + .mockEndpoint() + .get("/integrations/stripe/v2/sandbox-countries") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.listStripeSandboxCountries(); + expect(response).toEqual({ + data: { + countries: ["countries"], + }, + params: { + key: "value", + }, + }); + }); + + test("listStripeSandboxCountries (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/v2/sandbox-countries") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.listStripeSandboxCountries(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("listStripeSandboxCountries (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/v2/sandbox-countries") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.listStripeSandboxCountries(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("listStripeSandboxCountries (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/v2/sandbox-countries") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.listStripeSandboxCountries(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("listStripeSandboxCountries (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integrations/stripe/v2/sandbox-countries") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.listStripeSandboxCountries(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("uninstallIntegration (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); diff --git a/tests/wire/plans.test.ts b/tests/wire/plans.test.ts index e654e745..feca3e4a 100644 --- a/tests/wire/plans.test.ts +++ b/tests/wire/plans.test.ts @@ -37,6 +37,35 @@ describe("PlansClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + billing_customer_id: "billing_customer_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + days_until_due: 1000000, + environment_id: "environment_id", + id: "id", + is_default: true, + name: "name", + payment_method_id: "payment_method_id", + proration_behavior: "create_prorations", + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { application_id: "application_id", cancel_at: 1000000, @@ -396,6 +425,35 @@ describe("PlansClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + billingCustomerId: "billing_customer_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + daysUntilDue: 1000000, + environmentId: "environment_id", + id: "id", + isDefault: true, + name: "name", + paymentMethodId: "payment_method_id", + prorationBehavior: "create_prorations", + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { applicationId: "application_id", cancelAt: 1000000, @@ -5835,6 +5893,30 @@ describe("PlansClient", () => { }, ], billing_credit_balances: { key: 1.1 }, + billing_profile: { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + billing_profiles: [ + { + account_id: "account_id", + collection_method: "charge_automatically", + company_id: "company_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + is_default: true, + provider_type: "metronome", + updated_at: "2024-01-15T09:30:00Z", + }, + ], billing_subscription: { cancel_at_period_end: true, created_at: "2024-01-15T09:30:00Z", @@ -6142,6 +6224,30 @@ describe("PlansClient", () => { billingCreditBalances: { key: 1.1, }, + billingProfile: { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + billingProfiles: [ + { + accountId: "account_id", + collectionMethod: "charge_automatically", + companyId: "company_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + isDefault: true, + providerType: "metronome", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], billingSubscription: { cancelAtPeriodEnd: true, createdAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/yarn.lock b/yarn.lock index e80853df..182558b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1182,9 +1182,9 @@ form-data "^4.0.4" "@types/node@*": - version "26.4.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-26.4.0.tgz#4c4ca071c42241fe602741d02999f16b4e64c468" - integrity sha512-faiGnoIrLH/V8cibOMEAZ8pMw6oXqSukl29ra4mN8GdaB2ZewzeaLj+INpV5N+Z1eKWzY+IzaIZH2EIR6YZRNQ== + version "26.4.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.4.1.tgz#3d8dc80515894958448ee266cf5d6bc3e5205bd5" + integrity sha512-k97ENvZWtvA6yqz5/FS6a7duDgOPEeOQOc2iKS/nY6mX6qJUKtLnWzQS+Xj6tXweyj6ZcTAK2Qecetnvi9nCLA== dependencies: undici-types "~8.3.0" @@ -1547,10 +1547,10 @@ base64-js@^1.3.1: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -baseline-browser-mapping@^2.11.12: - version "2.11.20" - resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz#26078c7a4b08299656ea7ddceaebec955dc44303" - integrity sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw== +baseline-browser-mapping@^2.11.20: + version "2.11.21" + resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.21.tgz#99af73cb8e54007e4f5345e132278e26c2662f2c" + integrity sha512-uh8vpY/1/YyFkunIDFH/12p7/7VdPKA1hejMVEbdkEaWnUz0Hesvx5EbiU6XxjyHZIOju+ZMbQJkRh+es3/spQ== brace-expansion@^1.1.7: version "1.1.18" @@ -1568,15 +1568,15 @@ braces@^3.0.3: fill-range "^7.1.1" browserslist@^4.24.0, browserslist@^4.28.1: - version "4.28.8" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.8.tgz#a3c79ceb70028527e5da7dafc887f3200b5168c0" - integrity sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA== + version "4.28.9" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.9.tgz#07ce6b449b90af880eb9bfb7cd39372cc4f71c8c" + integrity sha512-EWazOblFYUvlGZcfGhPUPmYh3nikUxBVb+y9MJun5f3hBi812X+8MSQTujLBtgK3cf51fJWbWfOjyeO954d+Eg== dependencies: - baseline-browser-mapping "^2.11.12" - caniuse-lite "^1.0.30001809" - electron-to-chromium "^1.5.402" - node-releases "^2.0.53" - update-browserslist-db "^1.3.0" + baseline-browser-mapping "^2.11.20" + caniuse-lite "^1.0.30001810" + electron-to-chromium "^1.5.420" + node-releases "^2.0.54" + update-browserslist-db "^1.3.2" bs-logger@^0.2.6: version "0.2.6" @@ -1628,7 +1628,7 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001809: +caniuse-lite@^1.0.30001810: version "1.0.30001810" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz#4970b477dea3278374de9bc43aa8f5d39fc3cda2" integrity sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg== @@ -1840,10 +1840,10 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" -electron-to-chromium@^1.5.402: - version "1.5.417" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.417.tgz#5c2feb4670edfadf88c86c51886675802f584975" - integrity sha512-4T+DTDWuMPM4aHlHwWdAVCVWwp7LDilnhzkj+c/Lbj91XSQrLuOmZSLtS9Q4iIqjlPUbPOnC624zDVVHCHaolQ== +electron-to-chromium@^1.5.420: + version "1.5.422" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.422.tgz#e27fb1ca0e6bef612a647022e1469701fea9ee1f" + integrity sha512-UvA/32XqrLDdZSn7Jllo1AYNcWji/G0d5M0GTViE7KoGBiMunw3a34Sb2KO4ZZyrSEhqsxFoVhWWJshdyfKqJA== emittery@^0.13.1: version "0.13.1" @@ -2032,9 +2032,9 @@ fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-uri@^3.0.1: - version "3.1.6" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.6.tgz#bfdd308ef763f835fed059f3c6c925f708e33e3a" - integrity sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q== + version "3.1.7" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.7.tgz#743157d957f3cbb4c65310e033dc2ad4ad7dc60a" + integrity sha512-dOvZVzjdZdz7phd9v6jCbwxrBW3fK6n8Rc0CtdmM4bumzMnxywBYhuph6J819RRw/ku+rLbelwfMunktuzVVHg== fb-watchman@^2.0.0: version "2.0.2" @@ -2947,9 +2947,9 @@ minimist@^1.2.5: integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minimizer-webpack-plugin@^5.7.0: - version "5.8.0" - resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.8.0.tgz#744f0e28da888aa1708e2be32b4ddcf2eeb09e58" - integrity sha512-2cT9+goJfBhtMz+gJqejSf09ClgmYhPhccRb/fb0ztVbixt0BkO8mRuI26FoPPuUNkRk6iEDryWAIouc5W8eJA== + version "5.9.0" + resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.9.0.tgz#06c5ade7d028f3ff63321eab87f9c8c20bfa5ee8" + integrity sha512-OASqv+dewv8vjkOBjqMOHvxUaXhtGBLZAXq7JbmYE8TSzBvOswiGq5JcBdc8ypuLL/8YUT1OEyupga6/iqdyTA== dependencies: "@jridgewell/trace-mapping" "^0.3.31" jest-worker "^27.4.5" @@ -3013,7 +3013,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-releases@^2.0.53: +node-releases@^2.0.54: version "2.0.54" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.54.tgz#09af17d5647aa9f221ec5cf2becb95b68a981afe" integrity sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ== @@ -3636,17 +3636,17 @@ undici-types@~8.3.0: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.3.0.tgz#44e9fc9f3244648cdea35e4f9bb2d681e9410809" integrity sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ== -undici@7.28.0, undici@7.29.0: - version "7.29.0" - resolved "https://registry.yarnpkg.com/undici/-/undici-7.29.0.tgz#ae0f6f62e06e057a9cbb7b2b5fde2bb74f791b8f" - integrity sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw== +undici@7.28.0: + version "7.28.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-7.28.0.tgz#97d64564198b285bc281f0e8e29597e3d11fe7ec" + integrity sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA== universalify@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== -update-browserslist-db@^1.3.0: +update-browserslist-db@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz#9d99fbff56c50bb11ba5fd35cece5916da595836" integrity sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw== @@ -3708,9 +3708,9 @@ webpack-sources@^3.5.1: integrity sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw== webpack@^5.105.4: - version "5.110.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.110.2.tgz#ef23a0e62fe5e1ba71b033e3505b7f005d8d5c6e" - integrity sha512-TciLrfM7zgEjqGdY851HkirDsSPQgTFsWQpl9oHqMAMYsHhEC0bKjscvjpnz+pzx10hLC8qISApGrsnrCP4UtQ== + version "5.110.3" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.110.3.tgz#e122b66f6226b7af8f209b6102cd13238c4813a8" + integrity sha512-GuizBzRvo9YPpyoNMf3ag7AzxbaW85qrRSqTha345KyJbAFPt3/cMzBM0h+RWg7SK/7DdzRLINP3LvQ0hvr4hg== dependencies: "@types/estree" "^1.0.8" "@types/json-schema" "^7.0.15" From 459148fe14b11543838446556b9579d31c82bcd5 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Sat, 5 Sep 2026 07:11:41 +0000 Subject: [PATCH 2/2] [fern-replay] Applied customizations Patches applied (1): - patch-7a37bae5: chore(deps): resolve dependabot security alerts (#156) --- .fern/replay.lock | 78 +++++++++++++++++++++++++---------------------- package.json | 3 ++ yarn.lock | 8 ++--- 3 files changed, 49 insertions(+), 40 deletions(-) diff --git a/.fern/replay.lock b/.fern/replay.lock index 3264e8cb..10113f55 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -60,20 +60,26 @@ generations: cli_version: unknown generator_versions: fernapi/fern-typescript-node-sdk: 3.88.3 -current_generation: 1ddbfa34c9d81f17bce913c7f1633cc61befa9c8 + - commit_sha: fa73b5974a0dfce6574addee87bbf343665a68f6 + tree_hash: 1aa2148e778c69ab211e7576c5ee347ee46e11cf + timestamp: 2026-09-05T07:11:38.230Z + cli_version: unknown + generator_versions: + fernapi/fern-typescript-node-sdk: 3.90.0 +current_generation: fa73b5974a0dfce6574addee87bbf343665a68f6 patches: - id: patch-7a37bae5 content_hash: sha256:d668134d32b63ddb680e8e6c5c499b6e6871061c050e7aad130e876c514bc8ef original_commit: 7a37bae547cd7e3acf4123558f38a67e8de1449b original_message: "chore(deps): resolve dependabot security alerts (#156)" original_author: Orbit - base_generation: 1ddbfa34c9d81f17bce913c7f1633cc61befa9c8 + base_generation: fa73b5974a0dfce6574addee87bbf343665a68f6 files: - package.json - yarn.lock patch_content: | diff --git a/package.json b/package.json - index e9dd4f5..84df190 100644 + index d779590..e6c1d02 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,9 @@ @@ -87,7 +93,7 @@ patches: "engines": { "node": ">=18.0.0" diff --git a/yarn.lock b/yarn.lock - index 88ec73a..e80853d 100644 + index 182558b..ec63c7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3636,10 +3636,10 @@ undici-types@~8.3.0: @@ -109,7 +115,7 @@ patches: package.json: | { "name": "@schematichq/schematic-typescript-node", - "version": "1.5.11", + "version": "1.5.12", "private": false, "repository": { "type": "git", @@ -1369,9 +1375,9 @@ patches: form-data "^4.0.4" "@types/node@*": - version "26.4.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-26.4.0.tgz#4c4ca071c42241fe602741d02999f16b4e64c468" - integrity sha512-faiGnoIrLH/V8cibOMEAZ8pMw6oXqSukl29ra4mN8GdaB2ZewzeaLj+INpV5N+Z1eKWzY+IzaIZH2EIR6YZRNQ== + version "26.4.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-26.4.1.tgz#3d8dc80515894958448ee266cf5d6bc3e5205bd5" + integrity sha512-k97ENvZWtvA6yqz5/FS6a7duDgOPEeOQOc2iKS/nY6mX6qJUKtLnWzQS+Xj6tXweyj6ZcTAK2Qecetnvi9nCLA== dependencies: undici-types "~8.3.0" @@ -1734,10 +1740,10 @@ patches: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - baseline-browser-mapping@^2.11.12: - version "2.11.20" - resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz#26078c7a4b08299656ea7ddceaebec955dc44303" - integrity sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw== + baseline-browser-mapping@^2.11.20: + version "2.11.21" + resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.21.tgz#99af73cb8e54007e4f5345e132278e26c2662f2c" + integrity sha512-uh8vpY/1/YyFkunIDFH/12p7/7VdPKA1hejMVEbdkEaWnUz0Hesvx5EbiU6XxjyHZIOju+ZMbQJkRh+es3/spQ== brace-expansion@^1.1.7: version "1.1.18" @@ -1755,15 +1761,15 @@ patches: fill-range "^7.1.1" browserslist@^4.24.0, browserslist@^4.28.1: - version "4.28.8" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.8.tgz#a3c79ceb70028527e5da7dafc887f3200b5168c0" - integrity sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA== + version "4.28.9" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.9.tgz#07ce6b449b90af880eb9bfb7cd39372cc4f71c8c" + integrity sha512-EWazOblFYUvlGZcfGhPUPmYh3nikUxBVb+y9MJun5f3hBi812X+8MSQTujLBtgK3cf51fJWbWfOjyeO954d+Eg== dependencies: - baseline-browser-mapping "^2.11.12" - caniuse-lite "^1.0.30001809" - electron-to-chromium "^1.5.402" - node-releases "^2.0.53" - update-browserslist-db "^1.3.0" + baseline-browser-mapping "^2.11.20" + caniuse-lite "^1.0.30001810" + electron-to-chromium "^1.5.420" + node-releases "^2.0.54" + update-browserslist-db "^1.3.2" bs-logger@^0.2.6: version "0.2.6" @@ -1815,7 +1821,7 @@ patches: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - caniuse-lite@^1.0.30001809: + caniuse-lite@^1.0.30001810: version "1.0.30001810" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz#4970b477dea3278374de9bc43aa8f5d39fc3cda2" integrity sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg== @@ -2027,10 +2033,10 @@ patches: es-errors "^1.3.0" gopd "^1.2.0" - electron-to-chromium@^1.5.402: - version "1.5.417" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.417.tgz#5c2feb4670edfadf88c86c51886675802f584975" - integrity sha512-4T+DTDWuMPM4aHlHwWdAVCVWwp7LDilnhzkj+c/Lbj91XSQrLuOmZSLtS9Q4iIqjlPUbPOnC624zDVVHCHaolQ== + electron-to-chromium@^1.5.420: + version "1.5.422" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.422.tgz#e27fb1ca0e6bef612a647022e1469701fea9ee1f" + integrity sha512-UvA/32XqrLDdZSn7Jllo1AYNcWji/G0d5M0GTViE7KoGBiMunw3a34Sb2KO4ZZyrSEhqsxFoVhWWJshdyfKqJA== emittery@^0.13.1: version "0.13.1" @@ -2219,9 +2225,9 @@ patches: integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-uri@^3.0.1: - version "3.1.6" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.6.tgz#bfdd308ef763f835fed059f3c6c925f708e33e3a" - integrity sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q== + version "3.1.7" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.7.tgz#743157d957f3cbb4c65310e033dc2ad4ad7dc60a" + integrity sha512-dOvZVzjdZdz7phd9v6jCbwxrBW3fK6n8Rc0CtdmM4bumzMnxywBYhuph6J819RRw/ku+rLbelwfMunktuzVVHg== fb-watchman@^2.0.0: version "2.0.2" @@ -3134,9 +3140,9 @@ patches: integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minimizer-webpack-plugin@^5.7.0: - version "5.8.0" - resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.8.0.tgz#744f0e28da888aa1708e2be32b4ddcf2eeb09e58" - integrity sha512-2cT9+goJfBhtMz+gJqejSf09ClgmYhPhccRb/fb0ztVbixt0BkO8mRuI26FoPPuUNkRk6iEDryWAIouc5W8eJA== + version "5.9.0" + resolved "https://registry.yarnpkg.com/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.9.0.tgz#06c5ade7d028f3ff63321eab87f9c8c20bfa5ee8" + integrity sha512-OASqv+dewv8vjkOBjqMOHvxUaXhtGBLZAXq7JbmYE8TSzBvOswiGq5JcBdc8ypuLL/8YUT1OEyupga6/iqdyTA== dependencies: "@jridgewell/trace-mapping" "^0.3.31" jest-worker "^27.4.5" @@ -3200,7 +3206,7 @@ patches: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== - node-releases@^2.0.53: + node-releases@^2.0.54: version "2.0.54" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.54.tgz#09af17d5647aa9f221ec5cf2becb95b68a981afe" integrity sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ== @@ -3833,7 +3839,7 @@ patches: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - update-browserslist-db@^1.3.0: + update-browserslist-db@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz#9d99fbff56c50bb11ba5fd35cece5916da595836" integrity sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw== @@ -3895,9 +3901,9 @@ patches: integrity sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw== webpack@^5.105.4: - version "5.110.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.110.2.tgz#ef23a0e62fe5e1ba71b033e3505b7f005d8d5c6e" - integrity sha512-TciLrfM7zgEjqGdY851HkirDsSPQgTFsWQpl9oHqMAMYsHhEC0bKjscvjpnz+pzx10hLC8qISApGrsnrCP4UtQ== + version "5.110.3" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.110.3.tgz#e122b66f6226b7af8f209b6102cd13238c4813a8" + integrity sha512-GuizBzRvo9YPpyoNMf3ag7AzxbaW85qrRSqTha345KyJbAFPt3/cMzBM0h+RWg7SK/7DdzRLINP3LvQ0hvr4hg== dependencies: "@types/estree" "^1.0.8" "@types/json-schema" "^7.0.15" diff --git a/package.json b/package.json index d779590c..e6c1d02e 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,9 @@ "crypto": false, "timers": false }, + "resolutions": { + "undici": "7.29.0" + }, "packageManager": "yarn@1.22.22", "engines": { "node": ">=18.0.0" diff --git a/yarn.lock b/yarn.lock index 182558b7..ec63c7cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3636,10 +3636,10 @@ undici-types@~8.3.0: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.3.0.tgz#44e9fc9f3244648cdea35e4f9bb2d681e9410809" integrity sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ== -undici@7.28.0: - version "7.28.0" - resolved "https://registry.yarnpkg.com/undici/-/undici-7.28.0.tgz#97d64564198b285bc281f0e8e29597e3d11fe7ec" - integrity sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA== +undici@7.28.0, undici@7.29.0: + version "7.29.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-7.29.0.tgz#ae0f6f62e06e057a9cbb7b2b5fde2bb74f791b8f" + integrity sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw== universalify@^0.2.0: version "0.2.0"