From c6296e80142ad2fdc47a4c0264507b42b7f5c288 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 15:11:36 +0000 Subject: [PATCH 1/2] SDK regeneration --- .fern/metadata.json | 14 +- package.json | 4 +- reference.md | 614 +++++++++++++- src/BaseClient.ts | 4 +- src/Client.ts | 6 + .../resources/accesstokens/client/Client.ts | 2 +- src/api/resources/accounts/client/Client.ts | 30 +- src/api/resources/billing/client/Client.ts | 36 +- .../requests/CountBillingProductsRequest.ts | 3 + .../requests/ListBillingProductsRequest.ts | 3 + .../types/CountBillingProductsParams.ts | 2 + .../types/ListBillingProductsParams.ts | 2 + src/api/resources/checkout/client/Client.ts | 14 +- src/api/resources/companies/client/Client.ts | 55 +- src/api/resources/components/client/Client.ts | 11 +- .../componentspublic/client/Client.ts | 2 +- src/api/resources/credits/client/Client.ts | 179 +++- .../ListCompanyCreditBalancesRequest.ts | 11 + .../credits/client/requests/index.ts | 1 + .../types/ListCompanyCreditBalancesParams.ts | 8 + .../ListCompanyCreditBalancesResponse.ts | 9 + src/api/resources/credits/types/index.ts | 2 + .../resources/dataexports/client/Client.ts | 4 +- .../resources/entitlements/client/Client.ts | 32 +- src/api/resources/events/client/Client.ts | 14 +- .../client/requests/ListEventsRequest.ts | 2 + .../events/types/ListEventsParams.ts | 1 + src/api/resources/features/client/Client.ts | 30 +- src/api/resources/index.ts | 4 + src/api/resources/insights/client/Client.ts | 802 ++++++++++++++++++ src/api/resources/insights/client/index.ts | 1 + .../client/requests/GetActivityRequest.ts | 11 + ...nvironmentFeatureUsageTimeSeriesRequest.ts | 19 + ...tEnvironmentTraitUsageTimeSeriesRequest.ts | 19 + .../client/requests/GetPlanGrowthRequest.ts | 11 + .../requests/GetTopFeaturesByUsageRequest.ts | 15 + .../insights/client/requests/index.ts | 5 + src/api/resources/insights/exports.ts | 4 + src/api/resources/insights/index.ts | 2 + .../insights/types/GetActivityParams.ts | 8 + .../insights/types/GetActivityResponse.ts | 9 + ...EnvironmentFeatureUsageTimeSeriesParams.ts | 13 + ...vironmentFeatureUsageTimeSeriesResponse.ts | 9 + ...etEnvironmentTraitUsageTimeSeriesParams.ts | 13 + ...EnvironmentTraitUsageTimeSeriesResponse.ts | 9 + .../insights/types/GetPlanGrowthParams.ts | 8 + .../insights/types/GetPlanGrowthResponse.ts | 9 + .../insights/types/GetSummaryResponse.ts | 9 + .../types/GetTopFeaturesByUsageParams.ts | 10 + .../types/GetTopFeaturesByUsageResponse.ts | 9 + src/api/resources/insights/types/index.ts | 11 + .../integrationsapi/client/Client.ts | 668 ++++++++++++++- .../resources/integrationsapi/client/index.ts | 2 +- .../requests/ListIntegrationsRequest.ts | 27 + .../requests/StartDataImportRequestBody.ts | 15 + .../integrationsapi/client/requests/index.ts | 2 + .../types/ListIntegrationsParams.ts | 18 + .../types/ListIntegrationsResponse.ts | 9 + .../types/LoadSampleDataSetV2Response.ts | 9 + .../types/RunIntegrationResponse.ts | 9 + .../types/StartDataImportResponse.ts | 9 + .../types/UninstallIntegrationResponse.ts | 9 + .../resources/integrationsapi/types/index.ts | 6 + src/api/resources/planbundle/client/Client.ts | 4 +- src/api/resources/plangroups/client/Client.ts | 5 +- .../resources/planmigrations/client/Client.ts | 6 +- src/api/resources/plans/client/Client.ts | 26 +- .../CreateBillingLinkedPlanRequestBody.ts | 1 + .../scheduledcheckout/client/Client.ts | 7 +- src/api/resources/webhooks/client/Client.ts | 14 +- src/api/types/ActivityEntryResponseData.ts | 10 + src/api/types/ActivityResponseResponseData.ts | 7 + src/api/types/BillingCreditBundleView.ts | 2 +- src/api/types/BillingCreditView.ts | 1 + src/api/types/ClerkIntegrationConfig.ts | 8 + .../types/CompanyCreditBalanceResponseData.ts | 10 + src/api/types/CompanyMatchingCriteria.ts | 7 + src/api/types/CreateEventRequestBody.ts | 2 + src/api/types/CreditCurrencyPrice.ts | 8 + src/api/types/DataEventPayload.ts | 1 + ...nmentFeatureUsageTimeSeriesResponseData.ts | 9 + ...ronmentTraitUsageTimeSeriesResponseData.ts | 9 + .../EnvironmentUsagePointResponseData.ts | 6 + src/api/types/EventDetailResponseData.ts | 1 + src/api/types/EventResponseData.ts | 1 + src/api/types/InsightsSummaryResponseData.ts | 12 + src/api/types/IntegrationCapabilities.ts | 7 + src/api/types/IntegrationConfig.ts | 22 + src/api/types/IntegrationResponseData.ts | 11 + src/api/types/IntegrationState.ts | 8 + .../types/IntegrationsDataSetResponseData.ts | 5 + src/api/types/IntegrationsListResponseData.ts | 13 + src/api/types/IntegrationsResponseData.ts | 11 + src/api/types/MrrResponseData.ts | 6 + src/api/types/OrbIntegrationConfig.ts | 6 + src/api/types/PlanGrowthPointResponseData.ts | 8 + src/api/types/PlanGrowthResponseData.ts | 7 + src/api/types/RulesEngineSchemaVersion.ts | 2 +- src/api/types/StripeIntegrationConfig.ts | 18 + .../types/TopFeatureByUsageResponseData.ts | 10 + .../types/TopFeaturesByUsageResponseData.ts | 7 + src/api/types/index.ts | 24 + src/core/fetcher/Fetcher.ts | 17 +- src/core/schemas/builders/enum/enum.ts | 7 + src/core/schemas/builders/enum/index.ts | 2 +- .../builders/schema-utils/JsonError.ts | 3 +- .../builders/schema-utils/ParseError.ts | 3 +- .../types/CountBillingProductsParams.ts | 5 + .../types/ListBillingProductsParams.ts | 5 + .../types/ListCompanyCreditBalancesParams.ts | 18 + .../ListCompanyCreditBalancesResponse.ts | 22 + .../resources/credits/types/index.ts | 2 + .../events/types/ListEventsParams.ts | 2 + src/serialization/resources/index.ts | 3 + src/serialization/resources/insights/index.ts | 1 + .../insights/types/GetActivityParams.ts | 18 + .../insights/types/GetActivityResponse.ts | 22 + ...EnvironmentFeatureUsageTimeSeriesParams.ts | 25 + ...vironmentFeatureUsageTimeSeriesResponse.ts | 22 + ...etEnvironmentTraitUsageTimeSeriesParams.ts | 25 + ...EnvironmentTraitUsageTimeSeriesResponse.ts | 22 + .../insights/types/GetPlanGrowthParams.ts | 18 + .../insights/types/GetPlanGrowthResponse.ts | 22 + .../insights/types/GetSummaryResponse.ts | 21 + .../types/GetTopFeaturesByUsageParams.ts | 22 + .../types/GetTopFeaturesByUsageResponse.ts | 22 + .../resources/insights/types/index.ts | 11 + .../resources/integrationsapi/client/index.ts | 1 + .../requests/StartDataImportRequestBody.ts | 26 + .../integrationsapi/client/requests/index.ts | 1 + .../resources/integrationsapi/index.ts | 1 + .../types/ListIntegrationsParams.ts | 35 + .../types/ListIntegrationsResponse.ts | 22 + .../types/LoadSampleDataSetV2Response.ts | 21 + .../types/RunIntegrationResponse.ts | 21 + .../types/StartDataImportResponse.ts | 21 + .../types/UninstallIntegrationResponse.ts | 21 + .../resources/integrationsapi/types/index.ts | 6 + .../CreateBillingLinkedPlanRequestBody.ts | 5 + .../types/ActivityEntryResponseData.ts | 28 + .../types/ActivityResponseResponseData.ts | 19 + .../types/BillingCreditBundleView.ts | 7 +- src/serialization/types/BillingCreditView.ts | 3 + .../types/ClerkIntegrationConfig.ts | 20 + .../types/CompanyCreditBalanceResponseData.ts | 25 + .../types/CompanyMatchingCriteria.ts | 14 + .../types/CreateEventRequestBody.ts | 2 + .../types/CreditCurrencyPrice.ts | 21 + src/serialization/types/DataEventPayload.ts | 2 + ...nmentFeatureUsageTimeSeriesResponseData.ts | 23 + ...ronmentTraitUsageTimeSeriesResponseData.ts | 23 + .../EnvironmentUsagePointResponseData.ts | 20 + .../types/EventDetailResponseData.ts | 2 + src/serialization/types/EventResponseData.ts | 2 + .../types/InsightsSummaryResponseData.ts | 29 + .../types/IntegrationCapabilities.ts | 22 + src/serialization/types/IntegrationConfig.ts | 38 + .../types/IntegrationResponseData.ts | 28 + src/serialization/types/IntegrationState.ts | 12 + .../types/IntegrationsDataSetResponseData.ts | 18 + .../types/IntegrationsListResponseData.ts | 34 + .../types/IntegrationsResponseData.ts | 28 + src/serialization/types/MrrResponseData.ts | 20 + .../types/OrbIntegrationConfig.ts | 21 + .../types/PlanGrowthPointResponseData.ts | 24 + .../types/PlanGrowthResponseData.ts | 19 + .../types/RulesEngineSchemaVersion.ts | 4 +- .../types/StripeIntegrationConfig.ts | 30 + .../types/TopFeatureByUsageResponseData.ts | 28 + .../types/TopFeaturesByUsageResponseData.ts | 19 + src/serialization/types/index.ts | 24 + tests/unit/fetcher/redacting.test.ts | 106 +++ tests/wire/billing.test.ts | 6 + tests/wire/companies.test.ts | 54 ++ tests/wire/components.test.ts | 6 + tests/wire/credits.test.ts | 140 +++ tests/wire/events.test.ts | 7 + tests/wire/insights.test.ts | 732 ++++++++++++++++ tests/wire/integrationsapi.test.ts | 619 ++++++++++++++ yarn.lock | 150 ++-- 180 files changed, 5845 insertions(+), 315 deletions(-) create mode 100644 src/api/resources/credits/client/requests/ListCompanyCreditBalancesRequest.ts create mode 100644 src/api/resources/credits/types/ListCompanyCreditBalancesParams.ts create mode 100644 src/api/resources/credits/types/ListCompanyCreditBalancesResponse.ts create mode 100644 src/api/resources/insights/client/Client.ts create mode 100644 src/api/resources/insights/client/index.ts create mode 100644 src/api/resources/insights/client/requests/GetActivityRequest.ts create mode 100644 src/api/resources/insights/client/requests/GetEnvironmentFeatureUsageTimeSeriesRequest.ts create mode 100644 src/api/resources/insights/client/requests/GetEnvironmentTraitUsageTimeSeriesRequest.ts create mode 100644 src/api/resources/insights/client/requests/GetPlanGrowthRequest.ts create mode 100644 src/api/resources/insights/client/requests/GetTopFeaturesByUsageRequest.ts create mode 100644 src/api/resources/insights/client/requests/index.ts create mode 100644 src/api/resources/insights/exports.ts create mode 100644 src/api/resources/insights/index.ts create mode 100644 src/api/resources/insights/types/GetActivityParams.ts create mode 100644 src/api/resources/insights/types/GetActivityResponse.ts create mode 100644 src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts create mode 100644 src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts create mode 100644 src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts create mode 100644 src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts create mode 100644 src/api/resources/insights/types/GetPlanGrowthParams.ts create mode 100644 src/api/resources/insights/types/GetPlanGrowthResponse.ts create mode 100644 src/api/resources/insights/types/GetSummaryResponse.ts create mode 100644 src/api/resources/insights/types/GetTopFeaturesByUsageParams.ts create mode 100644 src/api/resources/insights/types/GetTopFeaturesByUsageResponse.ts create mode 100644 src/api/resources/insights/types/index.ts create mode 100644 src/api/resources/integrationsapi/client/requests/ListIntegrationsRequest.ts create mode 100644 src/api/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts create mode 100644 src/api/resources/integrationsapi/client/requests/index.ts create mode 100644 src/api/resources/integrationsapi/types/ListIntegrationsParams.ts create mode 100644 src/api/resources/integrationsapi/types/ListIntegrationsResponse.ts create mode 100644 src/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts create mode 100644 src/api/resources/integrationsapi/types/RunIntegrationResponse.ts create mode 100644 src/api/resources/integrationsapi/types/StartDataImportResponse.ts create mode 100644 src/api/resources/integrationsapi/types/UninstallIntegrationResponse.ts create mode 100644 src/api/types/ActivityEntryResponseData.ts create mode 100644 src/api/types/ActivityResponseResponseData.ts create mode 100644 src/api/types/ClerkIntegrationConfig.ts create mode 100644 src/api/types/CompanyCreditBalanceResponseData.ts create mode 100644 src/api/types/CompanyMatchingCriteria.ts create mode 100644 src/api/types/CreditCurrencyPrice.ts create mode 100644 src/api/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts create mode 100644 src/api/types/EnvironmentTraitUsageTimeSeriesResponseData.ts create mode 100644 src/api/types/EnvironmentUsagePointResponseData.ts create mode 100644 src/api/types/InsightsSummaryResponseData.ts create mode 100644 src/api/types/IntegrationCapabilities.ts create mode 100644 src/api/types/IntegrationConfig.ts create mode 100644 src/api/types/IntegrationResponseData.ts create mode 100644 src/api/types/IntegrationState.ts create mode 100644 src/api/types/IntegrationsDataSetResponseData.ts create mode 100644 src/api/types/IntegrationsListResponseData.ts create mode 100644 src/api/types/IntegrationsResponseData.ts create mode 100644 src/api/types/MrrResponseData.ts create mode 100644 src/api/types/OrbIntegrationConfig.ts create mode 100644 src/api/types/PlanGrowthPointResponseData.ts create mode 100644 src/api/types/PlanGrowthResponseData.ts create mode 100644 src/api/types/StripeIntegrationConfig.ts create mode 100644 src/api/types/TopFeatureByUsageResponseData.ts create mode 100644 src/api/types/TopFeaturesByUsageResponseData.ts create mode 100644 src/serialization/resources/credits/types/ListCompanyCreditBalancesParams.ts create mode 100644 src/serialization/resources/credits/types/ListCompanyCreditBalancesResponse.ts create mode 100644 src/serialization/resources/insights/index.ts create mode 100644 src/serialization/resources/insights/types/GetActivityParams.ts create mode 100644 src/serialization/resources/insights/types/GetActivityResponse.ts create mode 100644 src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts create mode 100644 src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts create mode 100644 src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts create mode 100644 src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts create mode 100644 src/serialization/resources/insights/types/GetPlanGrowthParams.ts create mode 100644 src/serialization/resources/insights/types/GetPlanGrowthResponse.ts create mode 100644 src/serialization/resources/insights/types/GetSummaryResponse.ts create mode 100644 src/serialization/resources/insights/types/GetTopFeaturesByUsageParams.ts create mode 100644 src/serialization/resources/insights/types/GetTopFeaturesByUsageResponse.ts create mode 100644 src/serialization/resources/insights/types/index.ts create mode 100644 src/serialization/resources/integrationsapi/client/index.ts create mode 100644 src/serialization/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts create mode 100644 src/serialization/resources/integrationsapi/client/requests/index.ts create mode 100644 src/serialization/resources/integrationsapi/types/ListIntegrationsParams.ts create mode 100644 src/serialization/resources/integrationsapi/types/ListIntegrationsResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts create mode 100644 src/serialization/resources/integrationsapi/types/RunIntegrationResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/StartDataImportResponse.ts create mode 100644 src/serialization/resources/integrationsapi/types/UninstallIntegrationResponse.ts create mode 100644 src/serialization/types/ActivityEntryResponseData.ts create mode 100644 src/serialization/types/ActivityResponseResponseData.ts create mode 100644 src/serialization/types/ClerkIntegrationConfig.ts create mode 100644 src/serialization/types/CompanyCreditBalanceResponseData.ts create mode 100644 src/serialization/types/CompanyMatchingCriteria.ts create mode 100644 src/serialization/types/CreditCurrencyPrice.ts create mode 100644 src/serialization/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts create mode 100644 src/serialization/types/EnvironmentTraitUsageTimeSeriesResponseData.ts create mode 100644 src/serialization/types/EnvironmentUsagePointResponseData.ts create mode 100644 src/serialization/types/InsightsSummaryResponseData.ts create mode 100644 src/serialization/types/IntegrationCapabilities.ts create mode 100644 src/serialization/types/IntegrationConfig.ts create mode 100644 src/serialization/types/IntegrationResponseData.ts create mode 100644 src/serialization/types/IntegrationState.ts create mode 100644 src/serialization/types/IntegrationsDataSetResponseData.ts create mode 100644 src/serialization/types/IntegrationsListResponseData.ts create mode 100644 src/serialization/types/IntegrationsResponseData.ts create mode 100644 src/serialization/types/MrrResponseData.ts create mode 100644 src/serialization/types/OrbIntegrationConfig.ts create mode 100644 src/serialization/types/PlanGrowthPointResponseData.ts create mode 100644 src/serialization/types/PlanGrowthResponseData.ts create mode 100644 src/serialization/types/StripeIntegrationConfig.ts create mode 100644 src/serialization/types/TopFeatureByUsageResponseData.ts create mode 100644 src/serialization/types/TopFeaturesByUsageResponseData.ts create mode 100644 tests/wire/insights.test.ts diff --git a/.fern/metadata.json b/.fern/metadata.json index 3619be57..064dc683 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "4.76.1", + "cliVersion": "5.6.0", "generatorName": "fernapi/fern-typescript-node-sdk", - "generatorVersion": "3.65.4", + "generatorVersion": "3.66.6", "generatorConfig": { "allowCustomFetcher": true, "includeApiReference": true, @@ -32,7 +32,7 @@ }, "devDependencies": { "esbuild": "^0.25.9", - "miniflare": "^4.20260305.0" + "miniflare": "^4.20260421.0" }, "scripts": { "build": "node build.js", @@ -52,6 +52,10 @@ ] } }, - "originGitCommit": "bc4c906cc55dca6e6d5e9213c5fb6a756783126b", - "sdkVersion": "1.4.6" + "originGitCommit": "e82d22946ead3625acd2ff64d8017582cdb1b791", + "originGitCommitIsDirty": false, + "invokedBy": "ci", + "requestedVersion": "1.4.7", + "ciProvider": "github", + "sdkVersion": "1.4.7" } diff --git a/package.json b/package.json index 419d5071..5cc67b0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@schematichq/schematic-typescript-node", - "version": "1.4.6", + "version": "1.4.7", "private": false, "repository": { "type": "git", @@ -46,7 +46,7 @@ "typescript": "~5.9.3", "@biomejs/biome": "2.4.10", "esbuild": "^0.25.9", - "miniflare": "^4.20260305.0" + "miniflare": "^4.20260421.0" }, "browser": { "fs": false, diff --git a/reference.md b/reference.md index 7f9183a1..f90d9d48 100644 --- a/reference.md +++ b/reference.md @@ -1893,6 +1893,7 @@ await client.billing.listBillingProducts({ priceUsageType: "licensed", providerType: "orb", q: "q", + recurringChargesOnly: true, withOneTimeCharges: true, withPricesOnly: true, withZeroPrice: true, @@ -1955,6 +1956,7 @@ await client.billing.countBillingProducts({ priceUsageType: "licensed", providerType: "orb", q: "q", + recurringChargesOnly: true, withOneTimeCharges: true, withPricesOnly: true, withZeroPrice: true, @@ -2330,6 +2332,57 @@ await client.credits.softDeleteBillingCredit("credit_id"); + + + + +
client.credits.listCompanyCreditBalances({ ...params }) -> Schematic.ListCompanyCreditBalancesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.credits.listCompanyCreditBalances({ + companyId: "company_id" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.ListCompanyCreditBalancesRequest` + +
+
+ +
+
+ +**requestOptions:** `CreditsClient.RequestOptions` + +
+
+
+
+ +
@@ -8784,6 +8837,7 @@ await client.events.listEvents({ eventSubtype: "event_subtype", eventTypes: ["flag_check"], flagId: "flag_id", + idempotencyKey: "idempotency_key", userId: "user_id", limit: 1000000, offset: 1000000 @@ -9904,8 +9958,8 @@ await client.features.countFlags({ -## integrationsapi -
client.integrationsapi.getIntegrationWebhookUrl(type) -> Schematic.GetIntegrationWebhookUrlResponse +## insights +
client.insights.getActivity({ ...params }) -> Schematic.GetActivityResponse
@@ -9918,7 +9972,9 @@ await client.features.countFlags({
```typescript -await client.integrationsapi.getIntegrationWebhookUrl("type"); +await client.insights.getActivity({ + limit: 1000000 +}); ```
@@ -9934,7 +9990,557 @@ await client.integrationsapi.getIntegrationWebhookUrl("type");
-**type:** `string` — type +**request:** `Schematic.GetActivityRequest` + +
+
+ +
+
+ +**requestOptions:** `InsightsClient.RequestOptions` + +
+
+ +
+ + + + +
+ +
client.insights.getEnvironmentFeatureUsageTimeSeries({ ...params }) -> Schematic.GetEnvironmentFeatureUsageTimeSeriesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.insights.getEnvironmentFeatureUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + granularity: "daily", + startTime: new Date("2024-01-15T09:30:00.000Z") +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.GetEnvironmentFeatureUsageTimeSeriesRequest` + +
+
+ +
+
+ +**requestOptions:** `InsightsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.insights.getPlanGrowth({ ...params }) -> Schematic.GetPlanGrowthResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.insights.getPlanGrowth({ + months: 1000000 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.GetPlanGrowthRequest` + +
+
+ +
+
+ +**requestOptions:** `InsightsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.insights.getSummary() -> Schematic.GetSummaryResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.insights.getSummary(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `InsightsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.insights.getTopFeaturesByUsage({ ...params }) -> Schematic.GetTopFeaturesByUsageResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.insights.getTopFeaturesByUsage({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + limit: 1000000, + startTime: new Date("2024-01-15T09:30:00.000Z") +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.GetTopFeaturesByUsageRequest` + +
+
+ +
+
+ +**requestOptions:** `InsightsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.insights.getEnvironmentTraitUsageTimeSeries({ ...params }) -> Schematic.GetEnvironmentTraitUsageTimeSeriesResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.insights.getEnvironmentTraitUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + granularity: "daily", + startTime: new Date("2024-01-15T09:30:00.000Z") +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.GetEnvironmentTraitUsageTimeSeriesRequest` + +
+
+ +
+
+ +**requestOptions:** `InsightsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +## integrationsapi +
client.integrationsapi.runIntegration(integration_id) -> Schematic.RunIntegrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.runIntegration("integration_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**integration_id:** `string` — integration_id + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.listIntegrations({ ...params }) -> Schematic.ListIntegrationsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.listIntegrations({ + billingOnly: true, + excludeIds: ["exclude_ids"], + id: "id", + state: "active", + type: "clerk", + limit: 1000000, + offset: 1000000 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.ListIntegrationsRequest` + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.getIntegrationWebhookUrl(type) -> Schematic.GetIntegrationWebhookUrlResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.getIntegrationWebhookUrl("type"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**type:** `string` — type + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.startDataImport({ ...params }) -> Schematic.StartDataImportResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.startDataImport({ + integrationId: "integration_id" +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.StartDataImportRequestBody` + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.loadSampleDataSetV2() -> Schematic.LoadSampleDataSetV2Response +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.loadSampleDataSetV2(); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `IntegrationsapiClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.integrationsapi.uninstallIntegration(integration_id) -> Schematic.UninstallIntegrationResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.integrationsapi.uninstallIntegration("integration_id"); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**integration_id:** `string` — integration_id
diff --git a/src/BaseClient.ts b/src/BaseClient.ts index ad96e79c..d08ba039 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -52,8 +52,8 @@ export function normalizeClientOptions { + return core.HttpResponsePromise.fromPromise(this.__listCompanyCreditBalances(request, requestOptions)); + } + + private async __listCompanyCreditBalances( + request: Schematic.ListCompanyCreditBalancesRequest, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const { companyId } = request; + const _queryParams: Record = { + company_id: companyId, + }; + 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/balance", + ), + 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.ListCompanyCreditBalancesResponse.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/balance"); + } + /** * @param {Schematic.ListCreditBundlesRequest} request * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. @@ -750,7 +887,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -889,7 +1025,7 @@ export class CreditsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateCreditBundleRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1018,7 +1154,7 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -1149,7 +1285,7 @@ export class CreditsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateCreditBundleDetailsRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -1286,7 +1422,7 @@ export class CreditsClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -1441,7 +1577,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1591,7 +1726,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1728,7 +1862,7 @@ export class CreditsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.ZeroOutGrantRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1869,7 +2003,7 @@ export class CreditsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateCompanyCreditGrant.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -2024,7 +2158,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2182,7 +2315,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2332,7 +2464,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2477,7 +2608,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2630,7 +2760,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2783,7 +2912,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2934,7 +3062,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -3074,7 +3201,7 @@ export class CreditsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateBillingPlanCreditGrantRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -3207,7 +3334,7 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -3338,7 +3465,7 @@ export class CreditsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateBillingPlanCreditGrantRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -3486,7 +3613,6 @@ export class CreditsClient { ), method: "DELETE", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -3642,7 +3768,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -3803,7 +3928,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -3959,7 +4083,6 @@ export class CreditsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) diff --git a/src/api/resources/credits/client/requests/ListCompanyCreditBalancesRequest.ts b/src/api/resources/credits/client/requests/ListCompanyCreditBalancesRequest.ts new file mode 100644 index 00000000..6b93bac6 --- /dev/null +++ b/src/api/resources/credits/client/requests/ListCompanyCreditBalancesRequest.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * companyId: "company_id" + * } + */ +export interface ListCompanyCreditBalancesRequest { + companyId: string; +} diff --git a/src/api/resources/credits/client/requests/index.ts b/src/api/resources/credits/client/requests/index.ts index 6c4916bb..f4a4cc67 100644 --- a/src/api/resources/credits/client/requests/index.ts +++ b/src/api/resources/credits/client/requests/index.ts @@ -12,6 +12,7 @@ export type { DeleteBillingPlanCreditGrantRequest } from "./DeleteBillingPlanCre export type { GetEnrichedCreditLedgerRequest } from "./GetEnrichedCreditLedgerRequest"; export type { ListBillingCreditsRequest } from "./ListBillingCreditsRequest"; export type { ListBillingPlanCreditGrantsRequest } from "./ListBillingPlanCreditGrantsRequest"; +export type { ListCompanyCreditBalancesRequest } from "./ListCompanyCreditBalancesRequest"; export type { ListCompanyGrantsRequest } from "./ListCompanyGrantsRequest"; export type { ListCreditBundlesRequest } from "./ListCreditBundlesRequest"; export type { ListCreditEventLedgerRequest } from "./ListCreditEventLedgerRequest"; diff --git a/src/api/resources/credits/types/ListCompanyCreditBalancesParams.ts b/src/api/resources/credits/types/ListCompanyCreditBalancesParams.ts new file mode 100644 index 00000000..2fa54fb6 --- /dev/null +++ b/src/api/resources/credits/types/ListCompanyCreditBalancesParams.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Input parameters + */ +export interface ListCompanyCreditBalancesParams { + companyId?: string; +} diff --git a/src/api/resources/credits/types/ListCompanyCreditBalancesResponse.ts b/src/api/resources/credits/types/ListCompanyCreditBalancesResponse.ts new file mode 100644 index 00000000..46c1a0da --- /dev/null +++ b/src/api/resources/credits/types/ListCompanyCreditBalancesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ListCompanyCreditBalancesResponse { + data: Schematic.CompanyCreditBalanceResponseData[]; + /** Input parameters */ + params: Schematic.ListCompanyCreditBalancesParams; +} diff --git a/src/api/resources/credits/types/index.ts b/src/api/resources/credits/types/index.ts index c4538cd1..53474a6b 100644 --- a/src/api/resources/credits/types/index.ts +++ b/src/api/resources/credits/types/index.ts @@ -28,6 +28,8 @@ export * from "./ListBillingCreditsParams"; export * from "./ListBillingCreditsResponse"; export * from "./ListBillingPlanCreditGrantsParams"; export * from "./ListBillingPlanCreditGrantsResponse"; +export * from "./ListCompanyCreditBalancesParams"; +export * from "./ListCompanyCreditBalancesResponse"; export * from "./ListCompanyGrantsParams"; export * from "./ListCompanyGrantsResponse"; export * from "./ListCreditBundlesParams"; diff --git a/src/api/resources/dataexports/client/Client.ts b/src/api/resources/dataexports/client/Client.ts index 9c983068..a52fce39 100644 --- a/src/api/resources/dataexports/client/Client.ts +++ b/src/api/resources/dataexports/client/Client.ts @@ -66,7 +66,7 @@ export class DataexportsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: { ...serializers.CreateDataExportRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), @@ -193,7 +193,7 @@ export class DataexportsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), responseType: "streaming", timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, diff --git a/src/api/resources/entitlements/client/Client.ts b/src/api/resources/entitlements/client/Client.ts index 4c470f52..2382e4e2 100644 --- a/src/api/resources/entitlements/client/Client.ts +++ b/src/api/resources/entitlements/client/Client.ts @@ -85,7 +85,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -223,7 +222,7 @@ export class EntitlementsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateCompanyOverrideRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -354,7 +353,7 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -484,7 +483,7 @@ export class EntitlementsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateCompanyOverrideRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -621,7 +620,7 @@ export class EntitlementsClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -776,7 +775,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -921,7 +919,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1066,7 +1063,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1227,7 +1223,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1376,7 +1371,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1526,7 +1520,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1671,7 +1664,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1816,7 +1808,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1987,7 +1978,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2125,7 +2115,7 @@ export class EntitlementsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreatePlanEntitlementRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -2256,7 +2246,7 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -2386,7 +2376,7 @@ export class EntitlementsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdatePlanEntitlementRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -2523,7 +2513,7 @@ export class EntitlementsClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -2665,7 +2655,7 @@ export class EntitlementsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateBillingLinkedPlanEntitlementRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -2840,7 +2830,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2977,7 +2966,7 @@ export class EntitlementsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.DuplicatePlanEntitlementsRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -3116,7 +3105,6 @@ export class EntitlementsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index 79b7109d..d3942171 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -67,7 +67,7 @@ export class EventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateEventBatchRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -209,7 +209,6 @@ export class EventsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -319,6 +318,7 @@ export class EventsClient { * eventSubtype: "event_subtype", * eventTypes: ["flag_check"], * flagId: "flag_id", + * idempotencyKey: "idempotency_key", * userId: "user_id", * limit: 1000000, * offset: 1000000 @@ -335,7 +335,7 @@ export class EventsClient { request: Schematic.ListEventsRequest = {}, requestOptions?: EventsClient.RequestOptions, ): Promise> { - const { companyId, eventSubtype, eventTypes, flagId, userId, limit, offset } = request; + const { companyId, eventSubtype, eventTypes, flagId, idempotencyKey, userId, limit, offset } = request; const _queryParams: Record = { company_id: companyId, event_subtype: eventSubtype, @@ -345,6 +345,7 @@ export class EventsClient { ? serializers.EventType.jsonOrThrow(eventTypes, { unrecognizedObjectKeys: "strip" }) : undefined, flag_id: flagId, + idempotency_key: idempotencyKey, user_id: userId, limit, offset, @@ -364,7 +365,6 @@ export class EventsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -500,7 +500,7 @@ export class EventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateEventRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -629,7 +629,7 @@ export class EventsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -742,7 +742,7 @@ export class EventsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, diff --git a/src/api/resources/events/client/requests/ListEventsRequest.ts b/src/api/resources/events/client/requests/ListEventsRequest.ts index 5eb26381..a7a08d5c 100644 --- a/src/api/resources/events/client/requests/ListEventsRequest.ts +++ b/src/api/resources/events/client/requests/ListEventsRequest.ts @@ -9,6 +9,7 @@ import type * as Schematic from "../../../../index"; * eventSubtype: "event_subtype", * eventTypes: ["flag_check"], * flagId: "flag_id", + * idempotencyKey: "idempotency_key", * userId: "user_id", * limit: 1000000, * offset: 1000000 @@ -19,6 +20,7 @@ export interface ListEventsRequest { eventSubtype?: string; eventTypes?: Schematic.EventType | Schematic.EventType[]; flagId?: string; + idempotencyKey?: string; userId?: string; /** Page limit (default 100) */ limit?: number; diff --git a/src/api/resources/events/types/ListEventsParams.ts b/src/api/resources/events/types/ListEventsParams.ts index 205d077e..9fe76856 100644 --- a/src/api/resources/events/types/ListEventsParams.ts +++ b/src/api/resources/events/types/ListEventsParams.ts @@ -10,6 +10,7 @@ export interface ListEventsParams { eventSubtype?: string; eventTypes?: Schematic.EventType[]; flagId?: string; + idempotencyKey?: string; /** Page limit (default 100) */ limit?: number; /** Page offset (default 0) */ diff --git a/src/api/resources/features/client/Client.ts b/src/api/resources/features/client/Client.ts index f934e65b..a477b46c 100644 --- a/src/api/resources/features/client/Client.ts +++ b/src/api/resources/features/client/Client.ts @@ -100,7 +100,6 @@ export class FeaturesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -238,7 +237,7 @@ export class FeaturesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateFeatureRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -367,7 +366,7 @@ export class FeaturesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -488,7 +487,7 @@ export class FeaturesClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateFeatureRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -618,7 +617,7 @@ export class FeaturesClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -753,7 +752,7 @@ export class FeaturesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateBillingLinkedFeatureRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -923,7 +922,6 @@ export class FeaturesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1070,7 +1068,6 @@ export class FeaturesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1210,7 +1207,7 @@ export class FeaturesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateFlagRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1339,7 +1336,7 @@ export class FeaturesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -1466,7 +1463,7 @@ export class FeaturesClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateFlagRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1596,7 +1593,7 @@ export class FeaturesClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -1746,7 +1743,7 @@ export class FeaturesClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateFlagRulesRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1880,7 +1877,7 @@ export class FeaturesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CheckFlagRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -2011,7 +2008,7 @@ export class FeaturesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CheckFlagRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -2144,7 +2141,7 @@ export class FeaturesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CheckFlagsBulkRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -2288,7 +2285,6 @@ export class FeaturesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index c9a6a94f..27aff446 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -33,7 +33,11 @@ export * from "./events/types"; export * as features from "./features"; export * from "./features/client/requests"; export * from "./features/types"; +export * as insights from "./insights"; +export * from "./insights/client/requests"; +export * from "./insights/types"; export * as integrationsapi from "./integrationsapi"; +export * from "./integrationsapi/client/requests"; export * from "./integrationsapi/types"; export * as planbundle from "./planbundle"; export * from "./planbundle/client/requests"; diff --git a/src/api/resources/insights/client/Client.ts b/src/api/resources/insights/client/Client.ts new file mode 100644 index 00000000..5daff2ba --- /dev/null +++ b/src/api/resources/insights/client/Client.ts @@ -0,0 +1,802 @@ +// This file was auto-generated by Fern from our API Definition. + +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient"; +import * as core from "../../../../core"; +import { mergeHeaders } from "../../../../core/headers"; +import * as environments from "../../../../environments"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError"; +import * as errors from "../../../../errors/index"; +import * as serializers from "../../../../serialization/index"; +import * as Schematic from "../../../index"; + +export declare namespace InsightsClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class InsightsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + + constructor(options: InsightsClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + /** + * @param {Schematic.GetActivityRequest} request + * @param {InsightsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.insights.getActivity({ + * limit: 1000000 + * }) + */ + public getActivity( + request: Schematic.GetActivityRequest = {}, + requestOptions?: InsightsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getActivity(request, requestOptions)); + } + + private async __getActivity( + request: Schematic.GetActivityRequest = {}, + requestOptions?: InsightsClient.RequestOptions, + ): Promise> { + const { limit } = request; + const _queryParams: Record = { + limit, + }; + 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, + "insights/activity", + ), + 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.GetActivityResponse.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", "/insights/activity"); + } + + /** + * @param {Schematic.GetEnvironmentFeatureUsageTimeSeriesRequest} request + * @param {InsightsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.insights.getEnvironmentFeatureUsageTimeSeries({ + * endTime: new Date("2024-01-15T09:30:00.000Z"), + * featureId: "feature_id", + * granularity: "daily", + * startTime: new Date("2024-01-15T09:30:00.000Z") + * }) + */ + public getEnvironmentFeatureUsageTimeSeries( + request: Schematic.GetEnvironmentFeatureUsageTimeSeriesRequest, + requestOptions?: InsightsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__getEnvironmentFeatureUsageTimeSeries(request, requestOptions), + ); + } + + private async __getEnvironmentFeatureUsageTimeSeries( + request: Schematic.GetEnvironmentFeatureUsageTimeSeriesRequest, + requestOptions?: InsightsClient.RequestOptions, + ): Promise> { + const { endTime, featureId, granularity, startTime } = request; + const _queryParams: Record = { + end_time: endTime.toISOString(), + feature_id: featureId, + granularity: + granularity != null + ? serializers.TimeSeriesGranularity.jsonOrThrow(granularity, { unrecognizedObjectKeys: "strip" }) + : undefined, + start_time: startTime.toISOString(), + }; + 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, + "insights/feature-usage-timeseries", + ), + 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.GetEnvironmentFeatureUsageTimeSeriesResponse.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", + "/insights/feature-usage-timeseries", + ); + } + + /** + * @param {Schematic.GetPlanGrowthRequest} request + * @param {InsightsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.insights.getPlanGrowth({ + * months: 1000000 + * }) + */ + public getPlanGrowth( + request: Schematic.GetPlanGrowthRequest = {}, + requestOptions?: InsightsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getPlanGrowth(request, requestOptions)); + } + + private async __getPlanGrowth( + request: Schematic.GetPlanGrowthRequest = {}, + requestOptions?: InsightsClient.RequestOptions, + ): Promise> { + const { months } = request; + const _queryParams: Record = { + months, + }; + 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, + "insights/plan-growth", + ), + 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.GetPlanGrowthResponse.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", "/insights/plan-growth"); + } + + /** + * @param {InsightsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.insights.getSummary() + */ + public getSummary( + requestOptions?: InsightsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getSummary(requestOptions)); + } + + private async __getSummary( + requestOptions?: InsightsClient.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, + "insights/summary", + ), + 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.GetSummaryResponse.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", "/insights/summary"); + } + + /** + * @param {Schematic.GetTopFeaturesByUsageRequest} request + * @param {InsightsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.insights.getTopFeaturesByUsage({ + * endTime: new Date("2024-01-15T09:30:00.000Z"), + * limit: 1000000, + * startTime: new Date("2024-01-15T09:30:00.000Z") + * }) + */ + public getTopFeaturesByUsage( + request: Schematic.GetTopFeaturesByUsageRequest, + requestOptions?: InsightsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getTopFeaturesByUsage(request, requestOptions)); + } + + private async __getTopFeaturesByUsage( + request: Schematic.GetTopFeaturesByUsageRequest, + requestOptions?: InsightsClient.RequestOptions, + ): Promise> { + const { endTime, limit, startTime } = request; + const _queryParams: Record = { + end_time: endTime.toISOString(), + limit, + start_time: startTime.toISOString(), + }; + 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, + "insights/top-features", + ), + 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.GetTopFeaturesByUsageResponse.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", "/insights/top-features"); + } + + /** + * @param {Schematic.GetEnvironmentTraitUsageTimeSeriesRequest} request + * @param {InsightsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.insights.getEnvironmentTraitUsageTimeSeries({ + * endTime: new Date("2024-01-15T09:30:00.000Z"), + * featureId: "feature_id", + * granularity: "daily", + * startTime: new Date("2024-01-15T09:30:00.000Z") + * }) + */ + public getEnvironmentTraitUsageTimeSeries( + request: Schematic.GetEnvironmentTraitUsageTimeSeriesRequest, + requestOptions?: InsightsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getEnvironmentTraitUsageTimeSeries(request, requestOptions)); + } + + private async __getEnvironmentTraitUsageTimeSeries( + request: Schematic.GetEnvironmentTraitUsageTimeSeriesRequest, + requestOptions?: InsightsClient.RequestOptions, + ): Promise> { + const { endTime, featureId, granularity, startTime } = request; + const _queryParams: Record = { + end_time: endTime.toISOString(), + feature_id: featureId, + granularity: + granularity != null + ? serializers.TimeSeriesGranularity.jsonOrThrow(granularity, { unrecognizedObjectKeys: "strip" }) + : undefined, + start_time: startTime.toISOString(), + }; + 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, + "insights/trait-usage-timeseries", + ), + 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.GetEnvironmentTraitUsageTimeSeriesResponse.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", + "/insights/trait-usage-timeseries", + ); + } +} diff --git a/src/api/resources/insights/client/index.ts b/src/api/resources/insights/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/insights/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/insights/client/requests/GetActivityRequest.ts b/src/api/resources/insights/client/requests/GetActivityRequest.ts new file mode 100644 index 00000000..d7eaf612 --- /dev/null +++ b/src/api/resources/insights/client/requests/GetActivityRequest.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * limit: 1000000 + * } + */ +export interface GetActivityRequest { + limit?: number; +} diff --git a/src/api/resources/insights/client/requests/GetEnvironmentFeatureUsageTimeSeriesRequest.ts b/src/api/resources/insights/client/requests/GetEnvironmentFeatureUsageTimeSeriesRequest.ts new file mode 100644 index 00000000..577fb1f0 --- /dev/null +++ b/src/api/resources/insights/client/requests/GetEnvironmentFeatureUsageTimeSeriesRequest.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * endTime: new Date("2024-01-15T09:30:00.000Z"), + * featureId: "feature_id", + * granularity: "daily", + * startTime: new Date("2024-01-15T09:30:00.000Z") + * } + */ +export interface GetEnvironmentFeatureUsageTimeSeriesRequest { + endTime: Date; + featureId: string; + granularity?: Schematic.TimeSeriesGranularity; + startTime: Date; +} diff --git a/src/api/resources/insights/client/requests/GetEnvironmentTraitUsageTimeSeriesRequest.ts b/src/api/resources/insights/client/requests/GetEnvironmentTraitUsageTimeSeriesRequest.ts new file mode 100644 index 00000000..306070fa --- /dev/null +++ b/src/api/resources/insights/client/requests/GetEnvironmentTraitUsageTimeSeriesRequest.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * endTime: new Date("2024-01-15T09:30:00.000Z"), + * featureId: "feature_id", + * granularity: "daily", + * startTime: new Date("2024-01-15T09:30:00.000Z") + * } + */ +export interface GetEnvironmentTraitUsageTimeSeriesRequest { + endTime: Date; + featureId: string; + granularity?: Schematic.TimeSeriesGranularity; + startTime: Date; +} diff --git a/src/api/resources/insights/client/requests/GetPlanGrowthRequest.ts b/src/api/resources/insights/client/requests/GetPlanGrowthRequest.ts new file mode 100644 index 00000000..e76d694f --- /dev/null +++ b/src/api/resources/insights/client/requests/GetPlanGrowthRequest.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * months: 1000000 + * } + */ +export interface GetPlanGrowthRequest { + months?: number; +} diff --git a/src/api/resources/insights/client/requests/GetTopFeaturesByUsageRequest.ts b/src/api/resources/insights/client/requests/GetTopFeaturesByUsageRequest.ts new file mode 100644 index 00000000..86deb6e8 --- /dev/null +++ b/src/api/resources/insights/client/requests/GetTopFeaturesByUsageRequest.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * @example + * { + * endTime: new Date("2024-01-15T09:30:00.000Z"), + * limit: 1000000, + * startTime: new Date("2024-01-15T09:30:00.000Z") + * } + */ +export interface GetTopFeaturesByUsageRequest { + endTime: Date; + limit?: number; + startTime: Date; +} diff --git a/src/api/resources/insights/client/requests/index.ts b/src/api/resources/insights/client/requests/index.ts new file mode 100644 index 00000000..add88c7f --- /dev/null +++ b/src/api/resources/insights/client/requests/index.ts @@ -0,0 +1,5 @@ +export type { GetActivityRequest } from "./GetActivityRequest"; +export type { GetEnvironmentFeatureUsageTimeSeriesRequest } from "./GetEnvironmentFeatureUsageTimeSeriesRequest"; +export type { GetEnvironmentTraitUsageTimeSeriesRequest } from "./GetEnvironmentTraitUsageTimeSeriesRequest"; +export type { GetPlanGrowthRequest } from "./GetPlanGrowthRequest"; +export type { GetTopFeaturesByUsageRequest } from "./GetTopFeaturesByUsageRequest"; diff --git a/src/api/resources/insights/exports.ts b/src/api/resources/insights/exports.ts new file mode 100644 index 00000000..2c9ec196 --- /dev/null +++ b/src/api/resources/insights/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { InsightsClient } from "./client/Client"; +export * from "./client/index"; diff --git a/src/api/resources/insights/index.ts b/src/api/resources/insights/index.ts new file mode 100644 index 00000000..d2ec2302 --- /dev/null +++ b/src/api/resources/insights/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./types"; diff --git a/src/api/resources/insights/types/GetActivityParams.ts b/src/api/resources/insights/types/GetActivityParams.ts new file mode 100644 index 00000000..8290cf7f --- /dev/null +++ b/src/api/resources/insights/types/GetActivityParams.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Input parameters + */ +export interface GetActivityParams { + limit?: number; +} diff --git a/src/api/resources/insights/types/GetActivityResponse.ts b/src/api/resources/insights/types/GetActivityResponse.ts new file mode 100644 index 00000000..c6a70383 --- /dev/null +++ b/src/api/resources/insights/types/GetActivityResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetActivityResponse { + data: Schematic.ActivityResponseResponseData; + /** Input parameters */ + params: Schematic.GetActivityParams; +} diff --git a/src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts b/src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts new file mode 100644 index 00000000..e118003d --- /dev/null +++ b/src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface GetEnvironmentFeatureUsageTimeSeriesParams { + endTime?: Date; + featureId?: string; + granularity?: Schematic.TimeSeriesGranularity; + startTime?: Date; +} diff --git a/src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts b/src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts new file mode 100644 index 00000000..fb2d1aaf --- /dev/null +++ b/src/api/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetEnvironmentFeatureUsageTimeSeriesResponse { + data: Schematic.EnvironmentFeatureUsageTimeSeriesResponseData; + /** Input parameters */ + params: Schematic.GetEnvironmentFeatureUsageTimeSeriesParams; +} diff --git a/src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts b/src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts new file mode 100644 index 00000000..b98029f9 --- /dev/null +++ b/src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface GetEnvironmentTraitUsageTimeSeriesParams { + endTime?: Date; + featureId?: string; + granularity?: Schematic.TimeSeriesGranularity; + startTime?: Date; +} diff --git a/src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts b/src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts new file mode 100644 index 00000000..5f712149 --- /dev/null +++ b/src/api/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetEnvironmentTraitUsageTimeSeriesResponse { + data: Schematic.EnvironmentTraitUsageTimeSeriesResponseData; + /** Input parameters */ + params: Schematic.GetEnvironmentTraitUsageTimeSeriesParams; +} diff --git a/src/api/resources/insights/types/GetPlanGrowthParams.ts b/src/api/resources/insights/types/GetPlanGrowthParams.ts new file mode 100644 index 00000000..a0891d81 --- /dev/null +++ b/src/api/resources/insights/types/GetPlanGrowthParams.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Input parameters + */ +export interface GetPlanGrowthParams { + months?: number; +} diff --git a/src/api/resources/insights/types/GetPlanGrowthResponse.ts b/src/api/resources/insights/types/GetPlanGrowthResponse.ts new file mode 100644 index 00000000..93cb9b71 --- /dev/null +++ b/src/api/resources/insights/types/GetPlanGrowthResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetPlanGrowthResponse { + data: Schematic.PlanGrowthResponseData; + /** Input parameters */ + params: Schematic.GetPlanGrowthParams; +} diff --git a/src/api/resources/insights/types/GetSummaryResponse.ts b/src/api/resources/insights/types/GetSummaryResponse.ts new file mode 100644 index 00000000..c1ad2e70 --- /dev/null +++ b/src/api/resources/insights/types/GetSummaryResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetSummaryResponse { + data: Schematic.InsightsSummaryResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/insights/types/GetTopFeaturesByUsageParams.ts b/src/api/resources/insights/types/GetTopFeaturesByUsageParams.ts new file mode 100644 index 00000000..1cd6a440 --- /dev/null +++ b/src/api/resources/insights/types/GetTopFeaturesByUsageParams.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Input parameters + */ +export interface GetTopFeaturesByUsageParams { + endTime?: Date; + limit?: number; + startTime?: Date; +} diff --git a/src/api/resources/insights/types/GetTopFeaturesByUsageResponse.ts b/src/api/resources/insights/types/GetTopFeaturesByUsageResponse.ts new file mode 100644 index 00000000..a2fb2c30 --- /dev/null +++ b/src/api/resources/insights/types/GetTopFeaturesByUsageResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface GetTopFeaturesByUsageResponse { + data: Schematic.TopFeaturesByUsageResponseData; + /** Input parameters */ + params: Schematic.GetTopFeaturesByUsageParams; +} diff --git a/src/api/resources/insights/types/index.ts b/src/api/resources/insights/types/index.ts new file mode 100644 index 00000000..035669c2 --- /dev/null +++ b/src/api/resources/insights/types/index.ts @@ -0,0 +1,11 @@ +export * from "./GetActivityParams"; +export * from "./GetActivityResponse"; +export * from "./GetEnvironmentFeatureUsageTimeSeriesParams"; +export * from "./GetEnvironmentFeatureUsageTimeSeriesResponse"; +export * from "./GetEnvironmentTraitUsageTimeSeriesParams"; +export * from "./GetEnvironmentTraitUsageTimeSeriesResponse"; +export * from "./GetPlanGrowthParams"; +export * from "./GetPlanGrowthResponse"; +export * from "./GetSummaryResponse"; +export * from "./GetTopFeaturesByUsageParams"; +export * from "./GetTopFeaturesByUsageResponse"; diff --git a/src/api/resources/integrationsapi/client/Client.ts b/src/api/resources/integrationsapi/client/Client.ts index 64c5fb45..defe1efc 100644 --- a/src/api/resources/integrationsapi/client/Client.ts +++ b/src/api/resources/integrationsapi/client/Client.ts @@ -23,6 +23,283 @@ export class IntegrationsapiClient { this._options = normalizeClientOptionsWithAuth(options); } + /** + * @param {string} integration_id - integration_id + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.integrationsapi.runIntegration("integration_id") + */ + public runIntegration( + integration_id: string, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__runIntegration(integration_id, requestOptions)); + } + + private async __runIntegration( + integration_id: string, + 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, + `integration/start/${core.url.encodePathParam(integration_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.RunIntegrationResponse.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", + "/integration/start/{integration_id}", + ); + } + + /** + * @param {Schematic.ListIntegrationsRequest} 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} + * + * @example + * await client.integrationsapi.listIntegrations({ + * billingOnly: true, + * excludeIds: ["exclude_ids"], + * id: "id", + * state: "active", + * type: "clerk", + * limit: 1000000, + * offset: 1000000 + * }) + */ + public listIntegrations( + request: Schematic.ListIntegrationsRequest = {}, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listIntegrations(request, requestOptions)); + } + + private async __listIntegrations( + request: Schematic.ListIntegrationsRequest = {}, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): Promise> { + const { billingOnly, excludeIds, id, state, type: type_, limit, offset } = request; + const _queryParams: Record = { + billing_only: billingOnly, + exclude_ids: excludeIds, + id, + state: + state != null + ? serializers.IntegrationState.jsonOrThrow(state, { unrecognizedObjectKeys: "strip" }) + : undefined, + type: + type_ != null + ? serializers.IntegrationType.jsonOrThrow(type_, { 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, + "integrations", + ), + 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.ListIntegrationsResponse.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", "/integrations"); + } + /** * @param {string} type - type * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. @@ -61,7 +338,7 @@ export class IntegrationsapiClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -143,4 +420,393 @@ export class IntegrationsapiClient { "/integrations/{type}/webhook-url", ); } + + /** + * @param {Schematic.StartDataImportRequestBody} 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} + * + * @example + * await client.integrationsapi.startDataImport({ + * integrationId: "integration_id" + * }) + */ + public startDataImport( + request: Schematic.StartDataImportRequestBody, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__startDataImport(request, requestOptions)); + } + + private async __startDataImport( + request: Schematic.StartDataImportRequestBody, + 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/start-data-import", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), + requestType: "json", + body: serializers.StartDataImportRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + 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.StartDataImportResponse.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/start-data-import", + ); + } + + /** + * @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.integrationsapi.loadSampleDataSetV2() + */ + public loadSampleDataSetV2( + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__loadSampleDataSetV2(requestOptions)); + } + + private async __loadSampleDataSetV2( + 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/dataset-sample-v2", + ), + 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.LoadSampleDataSetV2Response.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/dataset-sample-v2", + ); + } + + /** + * @param {string} integration_id - integration_id + * @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} + * + * @example + * await client.integrationsapi.uninstallIntegration("integration_id") + */ + public uninstallIntegration( + integration_id: string, + requestOptions?: IntegrationsapiClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__uninstallIntegration(integration_id, requestOptions)); + } + + private async __uninstallIntegration( + integration_id: string, + 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/uninstall/${core.url.encodePathParam(integration_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.UninstallIntegrationResponse.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", + "/integrations/uninstall/{integration_id}", + ); + } } diff --git a/src/api/resources/integrationsapi/client/index.ts b/src/api/resources/integrationsapi/client/index.ts index cb0ff5c3..415726b7 100644 --- a/src/api/resources/integrationsapi/client/index.ts +++ b/src/api/resources/integrationsapi/client/index.ts @@ -1 +1 @@ -export {}; +export * from "./requests"; diff --git a/src/api/resources/integrationsapi/client/requests/ListIntegrationsRequest.ts b/src/api/resources/integrationsapi/client/requests/ListIntegrationsRequest.ts new file mode 100644 index 00000000..00c28bc2 --- /dev/null +++ b/src/api/resources/integrationsapi/client/requests/ListIntegrationsRequest.ts @@ -0,0 +1,27 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * billingOnly: true, + * excludeIds: ["exclude_ids"], + * id: "id", + * state: "active", + * type: "clerk", + * limit: 1000000, + * offset: 1000000 + * } + */ +export interface ListIntegrationsRequest { + billingOnly?: boolean; + excludeIds?: string | string[]; + id?: string; + state?: Schematic.IntegrationState; + type?: Schematic.IntegrationType; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; +} diff --git a/src/api/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts b/src/api/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts new file mode 100644 index 00000000..84be91b8 --- /dev/null +++ b/src/api/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts @@ -0,0 +1,15 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * integrationId: "integration_id" + * } + */ +export interface StartDataImportRequestBody { + companyMatchingCriteria?: Schematic.CompanyMatchingCriteria; + companyMatchingField?: string; + integrationId: string; +} diff --git a/src/api/resources/integrationsapi/client/requests/index.ts b/src/api/resources/integrationsapi/client/requests/index.ts new file mode 100644 index 00000000..c4031dc4 --- /dev/null +++ b/src/api/resources/integrationsapi/client/requests/index.ts @@ -0,0 +1,2 @@ +export type { ListIntegrationsRequest } from "./ListIntegrationsRequest"; +export type { StartDataImportRequestBody } from "./StartDataImportRequestBody"; diff --git a/src/api/resources/integrationsapi/types/ListIntegrationsParams.ts b/src/api/resources/integrationsapi/types/ListIntegrationsParams.ts new file mode 100644 index 00000000..c687edc4 --- /dev/null +++ b/src/api/resources/integrationsapi/types/ListIntegrationsParams.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 ListIntegrationsParams { + billingOnly?: boolean; + excludeIds?: string[]; + id?: string; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + state?: Schematic.IntegrationState; + type?: Schematic.IntegrationType; +} diff --git a/src/api/resources/integrationsapi/types/ListIntegrationsResponse.ts b/src/api/resources/integrationsapi/types/ListIntegrationsResponse.ts new file mode 100644 index 00000000..6fa7a4df --- /dev/null +++ b/src/api/resources/integrationsapi/types/ListIntegrationsResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ListIntegrationsResponse { + data: Schematic.IntegrationsListResponseData[]; + /** Input parameters */ + params: Schematic.ListIntegrationsParams; +} diff --git a/src/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts b/src/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts new file mode 100644 index 00000000..40bf2b9c --- /dev/null +++ b/src/api/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface LoadSampleDataSetV2Response { + data: Schematic.IntegrationsDataSetResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/RunIntegrationResponse.ts b/src/api/resources/integrationsapi/types/RunIntegrationResponse.ts new file mode 100644 index 00000000..cd920245 --- /dev/null +++ b/src/api/resources/integrationsapi/types/RunIntegrationResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface RunIntegrationResponse { + data: Schematic.IntegrationsResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/StartDataImportResponse.ts b/src/api/resources/integrationsapi/types/StartDataImportResponse.ts new file mode 100644 index 00000000..b31b6105 --- /dev/null +++ b/src/api/resources/integrationsapi/types/StartDataImportResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface StartDataImportResponse { + data: Schematic.IntegrationsResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/UninstallIntegrationResponse.ts b/src/api/resources/integrationsapi/types/UninstallIntegrationResponse.ts new file mode 100644 index 00000000..278e0ae6 --- /dev/null +++ b/src/api/resources/integrationsapi/types/UninstallIntegrationResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface UninstallIntegrationResponse { + data: Schematic.DeleteResponse; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/integrationsapi/types/index.ts b/src/api/resources/integrationsapi/types/index.ts index 138b8227..4ea64f51 100644 --- a/src/api/resources/integrationsapi/types/index.ts +++ b/src/api/resources/integrationsapi/types/index.ts @@ -1 +1,7 @@ export * from "./GetIntegrationWebhookUrlResponse"; +export * from "./ListIntegrationsParams"; +export * from "./ListIntegrationsResponse"; +export * from "./LoadSampleDataSetV2Response"; +export * from "./RunIntegrationResponse"; +export * from "./StartDataImportResponse"; +export * from "./UninstallIntegrationResponse"; diff --git a/src/api/resources/planbundle/client/Client.ts b/src/api/resources/planbundle/client/Client.ts index 12d00759..f4ece89b 100644 --- a/src/api/resources/planbundle/client/Client.ts +++ b/src/api/resources/planbundle/client/Client.ts @@ -67,7 +67,7 @@ export class PlanbundleClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreatePlanBundleRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -205,7 +205,7 @@ export class PlanbundleClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdatePlanBundleRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, diff --git a/src/api/resources/plangroups/client/Client.ts b/src/api/resources/plangroups/client/Client.ts index 08c382ce..a12bdd3e 100644 --- a/src/api/resources/plangroups/client/Client.ts +++ b/src/api/resources/plangroups/client/Client.ts @@ -67,7 +67,6 @@ export class PlangroupsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -215,7 +214,7 @@ export class PlangroupsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreatePlanGroupRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -374,7 +373,7 @@ export class PlangroupsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdatePlanGroupRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, diff --git a/src/api/resources/planmigrations/client/Client.ts b/src/api/resources/planmigrations/client/Client.ts index 007e47a9..3684d6d9 100644 --- a/src/api/resources/planmigrations/client/Client.ts +++ b/src/api/resources/planmigrations/client/Client.ts @@ -81,7 +81,6 @@ export class PlanmigrationsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -238,7 +237,6 @@ export class PlanmigrationsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -391,7 +389,6 @@ export class PlanmigrationsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -523,7 +520,7 @@ export class PlanmigrationsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -660,7 +657,6 @@ export class PlanmigrationsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) diff --git a/src/api/resources/plans/client/Client.ts b/src/api/resources/plans/client/Client.ts index 9b956b2c..9efb7da9 100644 --- a/src/api/resources/plans/client/Client.ts +++ b/src/api/resources/plans/client/Client.ts @@ -70,7 +70,7 @@ export class PlansClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateCompanyPlansRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -230,7 +230,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -375,7 +374,7 @@ export class PlansClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.RetryCustomPlanBillingRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -517,7 +516,7 @@ export class PlansClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateCustomPlanRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -700,7 +699,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -838,7 +836,7 @@ export class PlansClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreatePlanRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -976,7 +974,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1104,7 +1101,7 @@ export class PlansClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdatePlanRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1234,7 +1231,7 @@ export class PlansClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -1369,7 +1366,7 @@ export class PlansClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpsertBillingProductRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1511,7 +1508,7 @@ export class PlansClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateBillingLinkedPlanRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", @@ -1655,7 +1652,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1805,7 +1801,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -1996,7 +1991,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2137,7 +2131,6 @@ export class PlansClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2279,7 +2272,6 @@ export class PlansClient { ), method: "DELETE", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -2423,7 +2415,7 @@ export class PlansClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.PublishPlanVersionRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, diff --git a/src/api/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts b/src/api/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts index 02e33d3c..57fad4bb 100644 --- a/src/api/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts +++ b/src/api/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts @@ -16,6 +16,7 @@ export interface CreateBillingLinkedPlanRequestBody { billingProvider: Schematic.BillingProviderType; description: string; externalResourceId: string; + externalResourceVersion?: string; icon?: Schematic.PlanIcon; name: string; planType: Schematic.PlanType; diff --git a/src/api/resources/scheduledcheckout/client/Client.ts b/src/api/resources/scheduledcheckout/client/Client.ts index 2e380b04..545f6e26 100644 --- a/src/api/resources/scheduledcheckout/client/Client.ts +++ b/src/api/resources/scheduledcheckout/client/Client.ts @@ -77,7 +77,6 @@ export class ScheduledcheckoutClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -216,7 +215,7 @@ export class ScheduledcheckoutClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateScheduledCheckoutRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -345,7 +344,7 @@ export class ScheduledcheckoutClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -473,7 +472,7 @@ export class ScheduledcheckoutClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateScheduledCheckoutRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts index 9d3943e4..75868f60 100644 --- a/src/api/resources/webhooks/client/Client.ts +++ b/src/api/resources/webhooks/client/Client.ts @@ -76,7 +76,6 @@ export class WebhooksClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -208,7 +207,7 @@ export class WebhooksClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -344,7 +343,6 @@ export class WebhooksClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -487,7 +485,6 @@ export class WebhooksClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) @@ -625,7 +622,7 @@ export class WebhooksClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.CreateWebhookRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -754,7 +751,7 @@ export class WebhooksClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -875,7 +872,7 @@ export class WebhooksClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", body: serializers.UpdateWebhookRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, @@ -1005,7 +1002,7 @@ export class WebhooksClient { ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + 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, @@ -1143,7 +1140,6 @@ export class WebhooksClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, queryString: core.url .queryBuilder() .addMany(_queryParams) diff --git a/src/api/types/ActivityEntryResponseData.ts b/src/api/types/ActivityEntryResponseData.ts new file mode 100644 index 00000000..593c86c0 --- /dev/null +++ b/src/api/types/ActivityEntryResponseData.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface ActivityEntryResponseData { + actorName: string; + method: string; + resourceName: string; + resourceType: string; + timestamp: Date; + title: string; +} diff --git a/src/api/types/ActivityResponseResponseData.ts b/src/api/types/ActivityResponseResponseData.ts new file mode 100644 index 00000000..e298c39f --- /dev/null +++ b/src/api/types/ActivityResponseResponseData.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface ActivityResponseResponseData { + entries: Schematic.ActivityEntryResponseData[]; +} diff --git a/src/api/types/BillingCreditBundleView.ts b/src/api/types/BillingCreditBundleView.ts index d6787fef..4b97c5f4 100644 --- a/src/api/types/BillingCreditBundleView.ts +++ b/src/api/types/BillingCreditBundleView.ts @@ -9,7 +9,7 @@ export interface BillingCreditBundleView { creditIcon?: string; creditId: string; creditName: string; - currencyPrices?: Schematic.CreditBundleCurrencyPrice[]; + currencyPrices: Schematic.CreditBundleCurrencyPrice[]; expiryType: Schematic.BillingCreditExpiryType; expiryUnit: Schematic.BillingCreditExpiryUnit; expiryUnitCount?: number; diff --git a/src/api/types/BillingCreditView.ts b/src/api/types/BillingCreditView.ts index 8a293b67..1f8fd8f2 100644 --- a/src/api/types/BillingCreditView.ts +++ b/src/api/types/BillingCreditView.ts @@ -7,6 +7,7 @@ export interface BillingCreditView { burnStrategy: Schematic.BillingCreditBurnStrategy; costEditable: boolean; createdAt: Date; + currencyPrices: Schematic.CreditCurrencyPrice[]; defaultExpiryUnit: Schematic.BillingCreditExpiryUnit; defaultExpiryUnitCount?: number; defaultRolloverPolicy: Schematic.BillingCreditRolloverPolicy; diff --git a/src/api/types/ClerkIntegrationConfig.ts b/src/api/types/ClerkIntegrationConfig.ts new file mode 100644 index 00000000..2191fea1 --- /dev/null +++ b/src/api/types/ClerkIntegrationConfig.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface ClerkIntegrationConfig { + /** Whether Schematic has received the first webhook event from Clerk after install */ + firstEventsReceived?: boolean; + /** URL configured on the Clerk webhook endpoint that delivers events to Schematic */ + webhookUrl?: string; +} diff --git a/src/api/types/CompanyCreditBalanceResponseData.ts b/src/api/types/CompanyCreditBalanceResponseData.ts new file mode 100644 index 00000000..664f358b --- /dev/null +++ b/src/api/types/CompanyCreditBalanceResponseData.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface CompanyCreditBalanceResponseData { + creditId: string; + remaining: number; + source: Schematic.BillingProviderType; + total?: number; +} diff --git a/src/api/types/CompanyMatchingCriteria.ts b/src/api/types/CompanyMatchingCriteria.ts new file mode 100644 index 00000000..1d3f68f3 --- /dev/null +++ b/src/api/types/CompanyMatchingCriteria.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export const CompanyMatchingCriteria = { + BillingMetaObject: "billing_meta_object", + ManualUpsert: "manual_upsert", +} as const; +export type CompanyMatchingCriteria = (typeof CompanyMatchingCriteria)[keyof typeof CompanyMatchingCriteria]; diff --git a/src/api/types/CreateEventRequestBody.ts b/src/api/types/CreateEventRequestBody.ts index a2d25235..41b23501 100644 --- a/src/api/types/CreateEventRequestBody.ts +++ b/src/api/types/CreateEventRequestBody.ts @@ -6,6 +6,8 @@ export interface CreateEventRequestBody { body?: Schematic.EventBody; /** Either 'identify' or 'track' */ eventType: Schematic.EventType; + /** Optional client-supplied key. Duplicate events with the same key (scoped to the environment) are dropped for 24h. */ + idempotencyKey?: string; /** Optionally provide a timestamp at which the event was sent to Schematic */ sentAt?: Date; } diff --git a/src/api/types/CreditCurrencyPrice.ts b/src/api/types/CreditCurrencyPrice.ts new file mode 100644 index 00000000..92ff3ad9 --- /dev/null +++ b/src/api/types/CreditCurrencyPrice.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface CreditCurrencyPrice { + currency: string; + price?: Schematic.BillingPriceView; +} diff --git a/src/api/types/DataEventPayload.ts b/src/api/types/DataEventPayload.ts index 934d5aaa..06397032 100644 --- a/src/api/types/DataEventPayload.ts +++ b/src/api/types/DataEventPayload.ts @@ -5,6 +5,7 @@ import type * as Schematic from "../index"; export interface DataEventPayload { apiKey: string; body?: Record; + idempotencyKey?: string; sentAt?: Date; type: Schematic.EventType; } diff --git a/src/api/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts b/src/api/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts new file mode 100644 index 00000000..7955b8f4 --- /dev/null +++ b/src/api/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface EnvironmentFeatureUsageTimeSeriesResponseData { + eventSubtype: string; + featureId: string; + points: Schematic.EnvironmentUsagePointResponseData[]; +} diff --git a/src/api/types/EnvironmentTraitUsageTimeSeriesResponseData.ts b/src/api/types/EnvironmentTraitUsageTimeSeriesResponseData.ts new file mode 100644 index 00000000..27e5f89c --- /dev/null +++ b/src/api/types/EnvironmentTraitUsageTimeSeriesResponseData.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface EnvironmentTraitUsageTimeSeriesResponseData { + featureId: string; + points: Schematic.EnvironmentUsagePointResponseData[]; + traitDefinitionId: string; +} diff --git a/src/api/types/EnvironmentUsagePointResponseData.ts b/src/api/types/EnvironmentUsagePointResponseData.ts new file mode 100644 index 00000000..c08a0bd0 --- /dev/null +++ b/src/api/types/EnvironmentUsagePointResponseData.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface EnvironmentUsagePointResponseData { + timestamp: Date; + usage: number; +} diff --git a/src/api/types/EventDetailResponseData.ts b/src/api/types/EventDetailResponseData.ts index 77c751a1..dbcc15f9 100644 --- a/src/api/types/EventDetailResponseData.ts +++ b/src/api/types/EventDetailResponseData.ts @@ -15,6 +15,7 @@ export interface EventDetailResponseData { featureIds: string[]; features: Schematic.PreviewObject[]; id: string; + idempotencyKey?: string; loadedAt?: Date; processedAt?: Date; quantity: number; diff --git a/src/api/types/EventResponseData.ts b/src/api/types/EventResponseData.ts index b2eab487..503d48ce 100644 --- a/src/api/types/EventResponseData.ts +++ b/src/api/types/EventResponseData.ts @@ -13,6 +13,7 @@ export interface EventResponseData { errorMessage?: string; featureIds: string[]; id: string; + idempotencyKey?: string; loadedAt?: Date; processedAt?: Date; quantity: number; diff --git a/src/api/types/InsightsSummaryResponseData.ts b/src/api/types/InsightsSummaryResponseData.ts new file mode 100644 index 00000000..03cbccb9 --- /dev/null +++ b/src/api/types/InsightsSummaryResponseData.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface InsightsSummaryResponseData { + activeCredits: number; + mrr: Schematic.MrrResponseData[]; + paidCompanies: number; + totalCompanies: number; + totalFeatures: number; + totalPlans: number; +} diff --git a/src/api/types/IntegrationCapabilities.ts b/src/api/types/IntegrationCapabilities.ts new file mode 100644 index 00000000..a9ea0a15 --- /dev/null +++ b/src/api/types/IntegrationCapabilities.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface IntegrationCapabilities { + authorPlans: boolean; + checkout: boolean; + editBilling: boolean; +} diff --git a/src/api/types/IntegrationConfig.ts b/src/api/types/IntegrationConfig.ts new file mode 100644 index 00000000..85d6ba45 --- /dev/null +++ b/src/api/types/IntegrationConfig.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export type IntegrationConfig = + | Schematic.IntegrationConfig.Clerk + | Schematic.IntegrationConfig.Orb + | Schematic.IntegrationConfig.Stripe; + +export namespace IntegrationConfig { + export interface Clerk extends Schematic.ClerkIntegrationConfig { + type: "clerk"; + } + + export interface Orb extends Schematic.OrbIntegrationConfig { + type: "orb"; + } + + export interface Stripe extends Schematic.StripeIntegrationConfig { + type: "stripe"; + } +} diff --git a/src/api/types/IntegrationResponseData.ts b/src/api/types/IntegrationResponseData.ts new file mode 100644 index 00000000..bba5c413 --- /dev/null +++ b/src/api/types/IntegrationResponseData.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface IntegrationResponseData { + createdAt: Date; + id: string; + state: Schematic.IntegrationState; + type: Schematic.IntegrationType; + updatedAt: Date; +} diff --git a/src/api/types/IntegrationState.ts b/src/api/types/IntegrationState.ts new file mode 100644 index 00000000..4a93bddd --- /dev/null +++ b/src/api/types/IntegrationState.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export const IntegrationState = { + Active: "active", + Created: "created", + Pending: "pending", +} as const; +export type IntegrationState = (typeof IntegrationState)[keyof typeof IntegrationState]; diff --git a/src/api/types/IntegrationsDataSetResponseData.ts b/src/api/types/IntegrationsDataSetResponseData.ts new file mode 100644 index 00000000..30b5d2c2 --- /dev/null +++ b/src/api/types/IntegrationsDataSetResponseData.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface IntegrationsDataSetResponseData { + keys: string[]; +} diff --git a/src/api/types/IntegrationsListResponseData.ts b/src/api/types/IntegrationsListResponseData.ts new file mode 100644 index 00000000..7c90afc5 --- /dev/null +++ b/src/api/types/IntegrationsListResponseData.ts @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface IntegrationsListResponseData { + capabilities: Schematic.IntegrationCapabilities; + config?: Schematic.IntegrationConfig; + id: string; + isAppInstall: boolean; + isConnectInstall: boolean; + state: Schematic.IntegrationState; + type: Schematic.IntegrationType; +} diff --git a/src/api/types/IntegrationsResponseData.ts b/src/api/types/IntegrationsResponseData.ts new file mode 100644 index 00000000..db5ff3fd --- /dev/null +++ b/src/api/types/IntegrationsResponseData.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface IntegrationsResponseData { + createdAt: Date; + id: string; + state: Schematic.IntegrationState; + type: Schematic.IntegrationType; + updatedAt: Date; +} diff --git a/src/api/types/MrrResponseData.ts b/src/api/types/MrrResponseData.ts new file mode 100644 index 00000000..debf9fb2 --- /dev/null +++ b/src/api/types/MrrResponseData.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface MrrResponseData { + amount: number; + currency: string; +} diff --git a/src/api/types/OrbIntegrationConfig.ts b/src/api/types/OrbIntegrationConfig.ts new file mode 100644 index 00000000..90d0abd1 --- /dev/null +++ b/src/api/types/OrbIntegrationConfig.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface OrbIntegrationConfig { + /** Schematic company key used to store Orb's external_customer_id; when unset, defaults to orb_external_customer_id */ + externalCustomerIdKey?: string; +} diff --git a/src/api/types/PlanGrowthPointResponseData.ts b/src/api/types/PlanGrowthPointResponseData.ts new file mode 100644 index 00000000..9f2701a5 --- /dev/null +++ b/src/api/types/PlanGrowthPointResponseData.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface PlanGrowthPointResponseData { + month: Date; + planId: string; + planName: string; + subscribers: number; +} diff --git a/src/api/types/PlanGrowthResponseData.ts b/src/api/types/PlanGrowthResponseData.ts new file mode 100644 index 00000000..22bc4d75 --- /dev/null +++ b/src/api/types/PlanGrowthResponseData.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface PlanGrowthResponseData { + points: Schematic.PlanGrowthPointResponseData[]; +} diff --git a/src/api/types/RulesEngineSchemaVersion.ts b/src/api/types/RulesEngineSchemaVersion.ts index 4c1cab90..8ce29d0a 100644 --- a/src/api/types/RulesEngineSchemaVersion.ts +++ b/src/api/types/RulesEngineSchemaVersion.ts @@ -2,7 +2,7 @@ /** The current schema version hash for rules engine types. The first enum value is always the current version. */ export const RulesEngineSchemaVersion = { - Vf05Bf5Da: "vf05bf5da", + V97288F60: "v97288f60", PlaceholderForFernCompatibility: "placeholder-for-fern-compatibility", } as const; export type RulesEngineSchemaVersion = (typeof RulesEngineSchemaVersion)[keyof typeof RulesEngineSchemaVersion]; diff --git a/src/api/types/StripeIntegrationConfig.ts b/src/api/types/StripeIntegrationConfig.ts new file mode 100644 index 00000000..65fdafaf --- /dev/null +++ b/src/api/types/StripeIntegrationConfig.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface StripeIntegrationConfig { + /** Connected Stripe account ID (acct_*) */ + accountId?: string; + /** Display name of the connected Stripe account */ + accountName?: 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 */ + isSandbox: boolean; + /** Whether the integration is connected to a live Stripe account */ + liveMode: boolean; + /** Onboarding URL returned during the v2 (Connect) install flow before activation */ + onboardUrl?: string; + /** Stripe integration config version (1 = legacy API key install, 2 = Connect/App install) */ + version: number; +} diff --git a/src/api/types/TopFeatureByUsageResponseData.ts b/src/api/types/TopFeatureByUsageResponseData.ts new file mode 100644 index 00000000..82588c50 --- /dev/null +++ b/src/api/types/TopFeatureByUsageResponseData.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface TopFeatureByUsageResponseData { + changePct?: number; + featureId: string; + featureName: string; + pluralName?: string; + priorUsage: number; + usage: number; +} diff --git a/src/api/types/TopFeaturesByUsageResponseData.ts b/src/api/types/TopFeaturesByUsageResponseData.ts new file mode 100644 index 00000000..6293e74e --- /dev/null +++ b/src/api/types/TopFeaturesByUsageResponseData.ts @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface TopFeaturesByUsageResponseData { + features: Schematic.TopFeatureByUsageResponseData[]; +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 92fca62f..91c17318 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,6 +1,8 @@ export * from "./AccountMemberPermission"; export * from "./AccountMemberResponseData"; export * from "./AccountMemberRole"; +export * from "./ActivityEntryResponseData"; +export * from "./ActivityResponseResponseData"; export * from "./ActorType"; export * from "./ApiError"; export * from "./ApiKeyCreateResponseData"; @@ -63,9 +65,12 @@ export * from "./CheckFlagsResponseData"; export * from "./CheckoutDataResponseData"; export * from "./CheckoutSettingsResponseData"; export * from "./CheckoutSubscription"; +export * from "./ClerkIntegrationConfig"; +export * from "./CompanyCreditBalanceResponseData"; export * from "./CompanyDetailResponseData"; export * from "./CompanyEventPeriodMetricsResponseData"; export * from "./CompanyLedgerResponseData"; +export * from "./CompanyMatchingCriteria"; export * from "./CompanyMembershipDetailResponseData"; export * from "./CompanyMembershipResponseData"; export * from "./CompanyOverrideNoteResponseData"; @@ -114,6 +119,7 @@ export * from "./CreditBundleCurrencyPriceRequestBody"; export * from "./CreditBundleCurrencyPriceResponseData"; export * from "./CreditBundlePurchaseResponseData"; export * from "./CreditCompanyGrantView"; +export * from "./CreditCurrencyPrice"; export * from "./CreditCurrencyPriceRequestBody"; export * from "./CreditCurrencyPriceResponseData"; export * from "./CreditEventLedgerResponseData"; @@ -162,8 +168,11 @@ export * from "./EntityTraitResponseData"; export * from "./EntityTraitValue"; export * from "./EntityType"; export * from "./EnvironmentDetailResponseData"; +export * from "./EnvironmentFeatureUsageTimeSeriesResponseData"; export * from "./EnvironmentResponseData"; +export * from "./EnvironmentTraitUsageTimeSeriesResponseData"; export * from "./EnvironmentType"; +export * from "./EnvironmentUsagePointResponseData"; export * from "./EventBody"; export * from "./EventBodyFlagCheck"; export * from "./EventBodyIdentify"; @@ -194,6 +203,14 @@ export * from "./FlagResponseData"; export * from "./FlagType"; export * from "./FlagView"; export * from "./GenericPreviewObject"; +export * from "./InsightsSummaryResponseData"; +export * from "./IntegrationCapabilities"; +export * from "./IntegrationConfig"; +export * from "./IntegrationResponseData"; +export * from "./IntegrationState"; +export * from "./IntegrationsDataSetResponseData"; +export * from "./IntegrationsListResponseData"; +export * from "./IntegrationsResponseData"; export * from "./IntegrationType"; export * from "./IntegrationWebhookUrlResponseData"; export * from "./InvoiceRequestBody"; @@ -208,6 +225,8 @@ export * from "./ManagePlanResponseResponseData"; export * from "./MeterRequestBody"; export * from "./MetricPeriod"; export * from "./MetricPeriodMonthReset"; +export * from "./MrrResponseData"; +export * from "./OrbIntegrationConfig"; export * from "./OrderedPlansInGroup"; export * from "./PaymentMethodRequestBody"; export * from "./PaymentMethodResponseData"; @@ -230,6 +249,8 @@ export * from "./PlanGroupDetailResponseData"; export * from "./PlanGroupPlanDetailResponseData"; export * from "./PlanGroupPlanEntitlementsOrder"; export * from "./PlanGroupResponseData"; +export * from "./PlanGrowthPointResponseData"; +export * from "./PlanGrowthResponseData"; export * from "./PlanIcon"; export * from "./PlanIssueResponseData"; export * from "./PlanResponseData"; @@ -295,12 +316,15 @@ export * from "./SkippedEntitlementErrorResponseData"; export * from "./SkippedEntitlementResponseData"; export * from "./SortDirection"; export * from "./StripeEmbedInfo"; +export * from "./StripeIntegrationConfig"; export * from "./SubscriptionStatus"; export * from "./SubscriptionTraitUpdate"; export * from "./SubscriptionType"; export * from "./TemporaryAccessTokenResourceType"; export * from "./TemporaryAccessTokenResponseData"; export * from "./TimeSeriesGranularity"; +export * from "./TopFeatureByUsageResponseData"; +export * from "./TopFeaturesByUsageResponseData"; export * from "./TraitDefinition"; export * from "./TraitDefinitionComparableType"; export * from "./TraitType"; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index a099cc2f..f59409ce 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -21,6 +21,11 @@ export declare namespace Fetcher { method: string; contentType?: string; headers?: Record; + /** + * @deprecated Prefer `queryString` (produced by `core.url.queryBuilder()`). + * Retained for backwards compatibility with custom fetchers and callers that + * still construct request args with a query-parameter object. + */ queryParameters?: Record; queryString?: string; body?: unknown; @@ -119,17 +124,15 @@ const SENSITIVE_QUERY_PARAMS = new Set([ "session-id", ]); -function redactQueryParameters(queryParameters?: Record): Record | undefined { +function redactQueryParameters( + queryParameters: Record | undefined, +): Record | undefined { if (queryParameters == null) { - return queryParameters; + return undefined; } const redacted: Record = {}; for (const [key, value] of Object.entries(queryParameters)) { - if (SENSITIVE_QUERY_PARAMS.has(key.toLowerCase())) { - redacted[key] = "[REDACTED]"; - } else { - redacted[key] = value; - } + redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value; } return redacted; } diff --git a/src/core/schemas/builders/enum/enum.ts b/src/core/schemas/builders/enum/enum.ts index c2c49a32..f163d0b5 100644 --- a/src/core/schemas/builders/enum/enum.ts +++ b/src/core/schemas/builders/enum/enum.ts @@ -41,3 +41,10 @@ export function enum_(values: E): Schema(values: E): Schema { + return enum_(values).transform({ + transform: (val) => val, + untransform: (val) => val, + }); +} diff --git a/src/core/schemas/builders/enum/index.ts b/src/core/schemas/builders/enum/index.ts index fe6faed9..6faa631e 100644 --- a/src/core/schemas/builders/enum/index.ts +++ b/src/core/schemas/builders/enum/index.ts @@ -1 +1 @@ -export { enum_ } from "./enum"; +export { enum_, forwardCompatibleEnum_ } from "./enum"; diff --git a/src/core/schemas/builders/schema-utils/JsonError.ts b/src/core/schemas/builders/schema-utils/JsonError.ts index 7573c76b..9f813059 100644 --- a/src/core/schemas/builders/schema-utils/JsonError.ts +++ b/src/core/schemas/builders/schema-utils/JsonError.ts @@ -4,6 +4,7 @@ import { stringifyValidationError } from "./stringifyValidationErrors"; export class JsonError extends Error { constructor(public readonly errors: ValidationError[]) { super(errors.map(stringifyValidationError).join("; ")); - Object.setPrototypeOf(this, JsonError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + this.name = this.constructor.name; } } diff --git a/src/core/schemas/builders/schema-utils/ParseError.ts b/src/core/schemas/builders/schema-utils/ParseError.ts index f1914b59..a643165c 100644 --- a/src/core/schemas/builders/schema-utils/ParseError.ts +++ b/src/core/schemas/builders/schema-utils/ParseError.ts @@ -4,6 +4,7 @@ import { stringifyValidationError } from "./stringifyValidationErrors"; export class ParseError extends Error { constructor(public readonly errors: ValidationError[]) { super(errors.map(stringifyValidationError).join("; ")); - Object.setPrototypeOf(this, ParseError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + this.name = this.constructor.name; } } diff --git a/src/serialization/resources/billing/types/CountBillingProductsParams.ts b/src/serialization/resources/billing/types/CountBillingProductsParams.ts index d7243278..65b8708b 100644 --- a/src/serialization/resources/billing/types/CountBillingProductsParams.ts +++ b/src/serialization/resources/billing/types/CountBillingProductsParams.ts @@ -18,6 +18,10 @@ export const CountBillingProductsParams: core.serialization.ObjectSchema< priceUsageType: core.serialization.property("price_usage_type", BillingPriceUsageType.optional()), providerType: core.serialization.property("provider_type", BillingProviderType.optional()), q: core.serialization.string().optional(), + recurringChargesOnly: core.serialization.property( + "recurring_charges_only", + core.serialization.boolean().optional(), + ), withOneTimeCharges: core.serialization.property("with_one_time_charges", core.serialization.boolean().optional()), withPricesOnly: core.serialization.property("with_prices_only", core.serialization.boolean().optional()), withZeroPrice: core.serialization.property("with_zero_price", core.serialization.boolean().optional()), @@ -34,6 +38,7 @@ export declare namespace CountBillingProductsParams { price_usage_type?: BillingPriceUsageType.Raw | null; provider_type?: BillingProviderType.Raw | null; q?: string | null; + recurring_charges_only?: boolean | null; with_one_time_charges?: boolean | null; with_prices_only?: boolean | null; with_zero_price?: boolean | null; diff --git a/src/serialization/resources/billing/types/ListBillingProductsParams.ts b/src/serialization/resources/billing/types/ListBillingProductsParams.ts index 925cc3c5..ca326a7a 100644 --- a/src/serialization/resources/billing/types/ListBillingProductsParams.ts +++ b/src/serialization/resources/billing/types/ListBillingProductsParams.ts @@ -18,6 +18,10 @@ export const ListBillingProductsParams: core.serialization.ObjectSchema< priceUsageType: core.serialization.property("price_usage_type", BillingPriceUsageType.optional()), providerType: core.serialization.property("provider_type", BillingProviderType.optional()), q: core.serialization.string().optional(), + recurringChargesOnly: core.serialization.property( + "recurring_charges_only", + core.serialization.boolean().optional(), + ), withOneTimeCharges: core.serialization.property("with_one_time_charges", core.serialization.boolean().optional()), withPricesOnly: core.serialization.property("with_prices_only", core.serialization.boolean().optional()), withZeroPrice: core.serialization.property("with_zero_price", core.serialization.boolean().optional()), @@ -34,6 +38,7 @@ export declare namespace ListBillingProductsParams { price_usage_type?: BillingPriceUsageType.Raw | null; provider_type?: BillingProviderType.Raw | null; q?: string | null; + recurring_charges_only?: boolean | null; with_one_time_charges?: boolean | null; with_prices_only?: boolean | null; with_zero_price?: boolean | null; diff --git a/src/serialization/resources/credits/types/ListCompanyCreditBalancesParams.ts b/src/serialization/resources/credits/types/ListCompanyCreditBalancesParams.ts new file mode 100644 index 00000000..95ec9616 --- /dev/null +++ b/src/serialization/resources/credits/types/ListCompanyCreditBalancesParams.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 ListCompanyCreditBalancesParams: core.serialization.ObjectSchema< + serializers.ListCompanyCreditBalancesParams.Raw, + Schematic.ListCompanyCreditBalancesParams +> = core.serialization.object({ + companyId: core.serialization.property("company_id", core.serialization.string().optional()), +}); + +export declare namespace ListCompanyCreditBalancesParams { + export interface Raw { + company_id?: string | null; + } +} diff --git a/src/serialization/resources/credits/types/ListCompanyCreditBalancesResponse.ts b/src/serialization/resources/credits/types/ListCompanyCreditBalancesResponse.ts new file mode 100644 index 00000000..10281c6b --- /dev/null +++ b/src/serialization/resources/credits/types/ListCompanyCreditBalancesResponse.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 { CompanyCreditBalanceResponseData } from "../../../types/CompanyCreditBalanceResponseData"; +import { ListCompanyCreditBalancesParams } from "./ListCompanyCreditBalancesParams"; + +export const ListCompanyCreditBalancesResponse: core.serialization.ObjectSchema< + serializers.ListCompanyCreditBalancesResponse.Raw, + Schematic.ListCompanyCreditBalancesResponse +> = core.serialization.object({ + data: core.serialization.list(CompanyCreditBalanceResponseData), + params: ListCompanyCreditBalancesParams, +}); + +export declare namespace ListCompanyCreditBalancesResponse { + export interface Raw { + data: CompanyCreditBalanceResponseData.Raw[]; + params: ListCompanyCreditBalancesParams.Raw; + } +} diff --git a/src/serialization/resources/credits/types/index.ts b/src/serialization/resources/credits/types/index.ts index c4538cd1..53474a6b 100644 --- a/src/serialization/resources/credits/types/index.ts +++ b/src/serialization/resources/credits/types/index.ts @@ -28,6 +28,8 @@ export * from "./ListBillingCreditsParams"; export * from "./ListBillingCreditsResponse"; export * from "./ListBillingPlanCreditGrantsParams"; export * from "./ListBillingPlanCreditGrantsResponse"; +export * from "./ListCompanyCreditBalancesParams"; +export * from "./ListCompanyCreditBalancesResponse"; export * from "./ListCompanyGrantsParams"; export * from "./ListCompanyGrantsResponse"; export * from "./ListCreditBundlesParams"; diff --git a/src/serialization/resources/events/types/ListEventsParams.ts b/src/serialization/resources/events/types/ListEventsParams.ts index e16e2444..9f085c98 100644 --- a/src/serialization/resources/events/types/ListEventsParams.ts +++ b/src/serialization/resources/events/types/ListEventsParams.ts @@ -13,6 +13,7 @@ export const ListEventsParams: core.serialization.ObjectSchema< eventSubtype: core.serialization.property("event_subtype", core.serialization.string().optional()), eventTypes: core.serialization.property("event_types", core.serialization.list(EventType).optional()), flagId: core.serialization.property("flag_id", core.serialization.string().optional()), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), limit: core.serialization.number().optional(), offset: core.serialization.number().optional(), userId: core.serialization.property("user_id", core.serialization.string().optional()), @@ -24,6 +25,7 @@ export declare namespace ListEventsParams { event_subtype?: string | null; event_types?: EventType.Raw[] | null; flag_id?: string | null; + idempotency_key?: string | null; limit?: number | null; offset?: number | null; user_id?: string | null; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index 712ea24f..820a1401 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -33,7 +33,10 @@ export * from "./events/types"; export * as features from "./features"; export * from "./features/client/requests"; export * from "./features/types"; +export * as insights from "./insights"; +export * from "./insights/types"; export * as integrationsapi from "./integrationsapi"; +export * from "./integrationsapi/client/requests"; export * from "./integrationsapi/types"; export * as planbundle from "./planbundle"; export * from "./planbundle/client/requests"; diff --git a/src/serialization/resources/insights/index.ts b/src/serialization/resources/insights/index.ts new file mode 100644 index 00000000..eea524d6 --- /dev/null +++ b/src/serialization/resources/insights/index.ts @@ -0,0 +1 @@ +export * from "./types"; diff --git a/src/serialization/resources/insights/types/GetActivityParams.ts b/src/serialization/resources/insights/types/GetActivityParams.ts new file mode 100644 index 00000000..225db66f --- /dev/null +++ b/src/serialization/resources/insights/types/GetActivityParams.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 GetActivityParams: core.serialization.ObjectSchema< + serializers.GetActivityParams.Raw, + Schematic.GetActivityParams +> = core.serialization.object({ + limit: core.serialization.number().optional(), +}); + +export declare namespace GetActivityParams { + export interface Raw { + limit?: number | null; + } +} diff --git a/src/serialization/resources/insights/types/GetActivityResponse.ts b/src/serialization/resources/insights/types/GetActivityResponse.ts new file mode 100644 index 00000000..73ffbb21 --- /dev/null +++ b/src/serialization/resources/insights/types/GetActivityResponse.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 { ActivityResponseResponseData } from "../../../types/ActivityResponseResponseData"; +import { GetActivityParams } from "./GetActivityParams"; + +export const GetActivityResponse: core.serialization.ObjectSchema< + serializers.GetActivityResponse.Raw, + Schematic.GetActivityResponse +> = core.serialization.object({ + data: ActivityResponseResponseData, + params: GetActivityParams, +}); + +export declare namespace GetActivityResponse { + export interface Raw { + data: ActivityResponseResponseData.Raw; + params: GetActivityParams.Raw; + } +} diff --git a/src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts b/src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.ts new file mode 100644 index 00000000..3eac4e81 --- /dev/null +++ b/src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesParams.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 { TimeSeriesGranularity } from "../../../types/TimeSeriesGranularity"; + +export const GetEnvironmentFeatureUsageTimeSeriesParams: core.serialization.ObjectSchema< + serializers.GetEnvironmentFeatureUsageTimeSeriesParams.Raw, + Schematic.GetEnvironmentFeatureUsageTimeSeriesParams +> = core.serialization.object({ + endTime: core.serialization.property("end_time", core.serialization.date().optional()), + featureId: core.serialization.property("feature_id", core.serialization.string().optional()), + granularity: TimeSeriesGranularity.optional(), + startTime: core.serialization.property("start_time", core.serialization.date().optional()), +}); + +export declare namespace GetEnvironmentFeatureUsageTimeSeriesParams { + export interface Raw { + end_time?: string | null; + feature_id?: string | null; + granularity?: TimeSeriesGranularity.Raw | null; + start_time?: string | null; + } +} diff --git a/src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts b/src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.ts new file mode 100644 index 00000000..c172c0b4 --- /dev/null +++ b/src/serialization/resources/insights/types/GetEnvironmentFeatureUsageTimeSeriesResponse.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 { EnvironmentFeatureUsageTimeSeriesResponseData } from "../../../types/EnvironmentFeatureUsageTimeSeriesResponseData"; +import { GetEnvironmentFeatureUsageTimeSeriesParams } from "./GetEnvironmentFeatureUsageTimeSeriesParams"; + +export const GetEnvironmentFeatureUsageTimeSeriesResponse: core.serialization.ObjectSchema< + serializers.GetEnvironmentFeatureUsageTimeSeriesResponse.Raw, + Schematic.GetEnvironmentFeatureUsageTimeSeriesResponse +> = core.serialization.object({ + data: EnvironmentFeatureUsageTimeSeriesResponseData, + params: GetEnvironmentFeatureUsageTimeSeriesParams, +}); + +export declare namespace GetEnvironmentFeatureUsageTimeSeriesResponse { + export interface Raw { + data: EnvironmentFeatureUsageTimeSeriesResponseData.Raw; + params: GetEnvironmentFeatureUsageTimeSeriesParams.Raw; + } +} diff --git a/src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts b/src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.ts new file mode 100644 index 00000000..63a238e8 --- /dev/null +++ b/src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesParams.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 { TimeSeriesGranularity } from "../../../types/TimeSeriesGranularity"; + +export const GetEnvironmentTraitUsageTimeSeriesParams: core.serialization.ObjectSchema< + serializers.GetEnvironmentTraitUsageTimeSeriesParams.Raw, + Schematic.GetEnvironmentTraitUsageTimeSeriesParams +> = core.serialization.object({ + endTime: core.serialization.property("end_time", core.serialization.date().optional()), + featureId: core.serialization.property("feature_id", core.serialization.string().optional()), + granularity: TimeSeriesGranularity.optional(), + startTime: core.serialization.property("start_time", core.serialization.date().optional()), +}); + +export declare namespace GetEnvironmentTraitUsageTimeSeriesParams { + export interface Raw { + end_time?: string | null; + feature_id?: string | null; + granularity?: TimeSeriesGranularity.Raw | null; + start_time?: string | null; + } +} diff --git a/src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts b/src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.ts new file mode 100644 index 00000000..15a3d4a6 --- /dev/null +++ b/src/serialization/resources/insights/types/GetEnvironmentTraitUsageTimeSeriesResponse.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 { EnvironmentTraitUsageTimeSeriesResponseData } from "../../../types/EnvironmentTraitUsageTimeSeriesResponseData"; +import { GetEnvironmentTraitUsageTimeSeriesParams } from "./GetEnvironmentTraitUsageTimeSeriesParams"; + +export const GetEnvironmentTraitUsageTimeSeriesResponse: core.serialization.ObjectSchema< + serializers.GetEnvironmentTraitUsageTimeSeriesResponse.Raw, + Schematic.GetEnvironmentTraitUsageTimeSeriesResponse +> = core.serialization.object({ + data: EnvironmentTraitUsageTimeSeriesResponseData, + params: GetEnvironmentTraitUsageTimeSeriesParams, +}); + +export declare namespace GetEnvironmentTraitUsageTimeSeriesResponse { + export interface Raw { + data: EnvironmentTraitUsageTimeSeriesResponseData.Raw; + params: GetEnvironmentTraitUsageTimeSeriesParams.Raw; + } +} diff --git a/src/serialization/resources/insights/types/GetPlanGrowthParams.ts b/src/serialization/resources/insights/types/GetPlanGrowthParams.ts new file mode 100644 index 00000000..23095db9 --- /dev/null +++ b/src/serialization/resources/insights/types/GetPlanGrowthParams.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 GetPlanGrowthParams: core.serialization.ObjectSchema< + serializers.GetPlanGrowthParams.Raw, + Schematic.GetPlanGrowthParams +> = core.serialization.object({ + months: core.serialization.number().optional(), +}); + +export declare namespace GetPlanGrowthParams { + export interface Raw { + months?: number | null; + } +} diff --git a/src/serialization/resources/insights/types/GetPlanGrowthResponse.ts b/src/serialization/resources/insights/types/GetPlanGrowthResponse.ts new file mode 100644 index 00000000..94e4dffc --- /dev/null +++ b/src/serialization/resources/insights/types/GetPlanGrowthResponse.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 { PlanGrowthResponseData } from "../../../types/PlanGrowthResponseData"; +import { GetPlanGrowthParams } from "./GetPlanGrowthParams"; + +export const GetPlanGrowthResponse: core.serialization.ObjectSchema< + serializers.GetPlanGrowthResponse.Raw, + Schematic.GetPlanGrowthResponse +> = core.serialization.object({ + data: PlanGrowthResponseData, + params: GetPlanGrowthParams, +}); + +export declare namespace GetPlanGrowthResponse { + export interface Raw { + data: PlanGrowthResponseData.Raw; + params: GetPlanGrowthParams.Raw; + } +} diff --git a/src/serialization/resources/insights/types/GetSummaryResponse.ts b/src/serialization/resources/insights/types/GetSummaryResponse.ts new file mode 100644 index 00000000..08b2b32a --- /dev/null +++ b/src/serialization/resources/insights/types/GetSummaryResponse.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 { InsightsSummaryResponseData } from "../../../types/InsightsSummaryResponseData"; + +export const GetSummaryResponse: core.serialization.ObjectSchema< + serializers.GetSummaryResponse.Raw, + Schematic.GetSummaryResponse +> = core.serialization.object({ + data: InsightsSummaryResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace GetSummaryResponse { + export interface Raw { + data: InsightsSummaryResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/insights/types/GetTopFeaturesByUsageParams.ts b/src/serialization/resources/insights/types/GetTopFeaturesByUsageParams.ts new file mode 100644 index 00000000..ecd1ec62 --- /dev/null +++ b/src/serialization/resources/insights/types/GetTopFeaturesByUsageParams.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 GetTopFeaturesByUsageParams: core.serialization.ObjectSchema< + serializers.GetTopFeaturesByUsageParams.Raw, + Schematic.GetTopFeaturesByUsageParams +> = core.serialization.object({ + endTime: core.serialization.property("end_time", core.serialization.date().optional()), + limit: core.serialization.number().optional(), + startTime: core.serialization.property("start_time", core.serialization.date().optional()), +}); + +export declare namespace GetTopFeaturesByUsageParams { + export interface Raw { + end_time?: string | null; + limit?: number | null; + start_time?: string | null; + } +} diff --git a/src/serialization/resources/insights/types/GetTopFeaturesByUsageResponse.ts b/src/serialization/resources/insights/types/GetTopFeaturesByUsageResponse.ts new file mode 100644 index 00000000..bdffc5dd --- /dev/null +++ b/src/serialization/resources/insights/types/GetTopFeaturesByUsageResponse.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 { TopFeaturesByUsageResponseData } from "../../../types/TopFeaturesByUsageResponseData"; +import { GetTopFeaturesByUsageParams } from "./GetTopFeaturesByUsageParams"; + +export const GetTopFeaturesByUsageResponse: core.serialization.ObjectSchema< + serializers.GetTopFeaturesByUsageResponse.Raw, + Schematic.GetTopFeaturesByUsageResponse +> = core.serialization.object({ + data: TopFeaturesByUsageResponseData, + params: GetTopFeaturesByUsageParams, +}); + +export declare namespace GetTopFeaturesByUsageResponse { + export interface Raw { + data: TopFeaturesByUsageResponseData.Raw; + params: GetTopFeaturesByUsageParams.Raw; + } +} diff --git a/src/serialization/resources/insights/types/index.ts b/src/serialization/resources/insights/types/index.ts new file mode 100644 index 00000000..035669c2 --- /dev/null +++ b/src/serialization/resources/insights/types/index.ts @@ -0,0 +1,11 @@ +export * from "./GetActivityParams"; +export * from "./GetActivityResponse"; +export * from "./GetEnvironmentFeatureUsageTimeSeriesParams"; +export * from "./GetEnvironmentFeatureUsageTimeSeriesResponse"; +export * from "./GetEnvironmentTraitUsageTimeSeriesParams"; +export * from "./GetEnvironmentTraitUsageTimeSeriesResponse"; +export * from "./GetPlanGrowthParams"; +export * from "./GetPlanGrowthResponse"; +export * from "./GetSummaryResponse"; +export * from "./GetTopFeaturesByUsageParams"; +export * from "./GetTopFeaturesByUsageResponse"; diff --git a/src/serialization/resources/integrationsapi/client/index.ts b/src/serialization/resources/integrationsapi/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/integrationsapi/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts b/src/serialization/resources/integrationsapi/client/requests/StartDataImportRequestBody.ts new file mode 100644 index 00000000..3dd88b6a --- /dev/null +++ b/src/serialization/resources/integrationsapi/client/requests/StartDataImportRequestBody.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"; +import { CompanyMatchingCriteria } from "../../../../types/CompanyMatchingCriteria"; + +export const StartDataImportRequestBody: core.serialization.Schema< + serializers.StartDataImportRequestBody.Raw, + Schematic.StartDataImportRequestBody +> = core.serialization.object({ + companyMatchingCriteria: core.serialization.property( + "company_matching_criteria", + CompanyMatchingCriteria.optional(), + ), + companyMatchingField: core.serialization.property("company_matching_field", core.serialization.string().optional()), + integrationId: core.serialization.property("integration_id", core.serialization.string()), +}); + +export declare namespace StartDataImportRequestBody { + export interface Raw { + company_matching_criteria?: CompanyMatchingCriteria.Raw | null; + company_matching_field?: string | null; + integration_id: string; + } +} diff --git a/src/serialization/resources/integrationsapi/client/requests/index.ts b/src/serialization/resources/integrationsapi/client/requests/index.ts new file mode 100644 index 00000000..3c15e6ae --- /dev/null +++ b/src/serialization/resources/integrationsapi/client/requests/index.ts @@ -0,0 +1 @@ +export { StartDataImportRequestBody } from "./StartDataImportRequestBody"; diff --git a/src/serialization/resources/integrationsapi/index.ts b/src/serialization/resources/integrationsapi/index.ts index eea524d6..d2ec2302 100644 --- a/src/serialization/resources/integrationsapi/index.ts +++ b/src/serialization/resources/integrationsapi/index.ts @@ -1 +1,2 @@ +export * from "./client"; export * from "./types"; diff --git a/src/serialization/resources/integrationsapi/types/ListIntegrationsParams.ts b/src/serialization/resources/integrationsapi/types/ListIntegrationsParams.ts new file mode 100644 index 00000000..e597a24a --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/ListIntegrationsParams.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 { IntegrationState } from "../../../types/IntegrationState"; +import { IntegrationType } from "../../../types/IntegrationType"; + +export const ListIntegrationsParams: core.serialization.ObjectSchema< + serializers.ListIntegrationsParams.Raw, + Schematic.ListIntegrationsParams +> = core.serialization.object({ + billingOnly: core.serialization.property("billing_only", core.serialization.boolean().optional()), + excludeIds: core.serialization.property( + "exclude_ids", + core.serialization.list(core.serialization.string()).optional(), + ), + id: core.serialization.string().optional(), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + state: IntegrationState.optional(), + type: IntegrationType.optional(), +}); + +export declare namespace ListIntegrationsParams { + export interface Raw { + billing_only?: boolean | null; + exclude_ids?: string[] | null; + id?: string | null; + limit?: number | null; + offset?: number | null; + state?: IntegrationState.Raw | null; + type?: IntegrationType.Raw | null; + } +} diff --git a/src/serialization/resources/integrationsapi/types/ListIntegrationsResponse.ts b/src/serialization/resources/integrationsapi/types/ListIntegrationsResponse.ts new file mode 100644 index 00000000..f45bb64b --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/ListIntegrationsResponse.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 { IntegrationsListResponseData } from "../../../types/IntegrationsListResponseData"; +import { ListIntegrationsParams } from "./ListIntegrationsParams"; + +export const ListIntegrationsResponse: core.serialization.ObjectSchema< + serializers.ListIntegrationsResponse.Raw, + Schematic.ListIntegrationsResponse +> = core.serialization.object({ + data: core.serialization.list(IntegrationsListResponseData), + params: ListIntegrationsParams, +}); + +export declare namespace ListIntegrationsResponse { + export interface Raw { + data: IntegrationsListResponseData.Raw[]; + params: ListIntegrationsParams.Raw; + } +} diff --git a/src/serialization/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts b/src/serialization/resources/integrationsapi/types/LoadSampleDataSetV2Response.ts new file mode 100644 index 00000000..fc01174f --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/LoadSampleDataSetV2Response.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 { IntegrationsDataSetResponseData } from "../../../types/IntegrationsDataSetResponseData"; + +export const LoadSampleDataSetV2Response: core.serialization.ObjectSchema< + serializers.LoadSampleDataSetV2Response.Raw, + Schematic.LoadSampleDataSetV2Response +> = core.serialization.object({ + data: IntegrationsDataSetResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace LoadSampleDataSetV2Response { + export interface Raw { + data: IntegrationsDataSetResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/RunIntegrationResponse.ts b/src/serialization/resources/integrationsapi/types/RunIntegrationResponse.ts new file mode 100644 index 00000000..f2cb2d7e --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/RunIntegrationResponse.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 { IntegrationsResponseData } from "../../../types/IntegrationsResponseData"; + +export const RunIntegrationResponse: core.serialization.ObjectSchema< + serializers.RunIntegrationResponse.Raw, + Schematic.RunIntegrationResponse +> = core.serialization.object({ + data: IntegrationsResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace RunIntegrationResponse { + export interface Raw { + data: IntegrationsResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/StartDataImportResponse.ts b/src/serialization/resources/integrationsapi/types/StartDataImportResponse.ts new file mode 100644 index 00000000..3b6cfa1f --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/StartDataImportResponse.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 { IntegrationsResponseData } from "../../../types/IntegrationsResponseData"; + +export const StartDataImportResponse: core.serialization.ObjectSchema< + serializers.StartDataImportResponse.Raw, + Schematic.StartDataImportResponse +> = core.serialization.object({ + data: IntegrationsResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace StartDataImportResponse { + export interface Raw { + data: IntegrationsResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/UninstallIntegrationResponse.ts b/src/serialization/resources/integrationsapi/types/UninstallIntegrationResponse.ts new file mode 100644 index 00000000..f96554cc --- /dev/null +++ b/src/serialization/resources/integrationsapi/types/UninstallIntegrationResponse.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 UninstallIntegrationResponse: core.serialization.ObjectSchema< + serializers.UninstallIntegrationResponse.Raw, + Schematic.UninstallIntegrationResponse +> = core.serialization.object({ + data: DeleteResponse, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace UninstallIntegrationResponse { + export interface Raw { + data: DeleteResponse.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/integrationsapi/types/index.ts b/src/serialization/resources/integrationsapi/types/index.ts index 138b8227..4ea64f51 100644 --- a/src/serialization/resources/integrationsapi/types/index.ts +++ b/src/serialization/resources/integrationsapi/types/index.ts @@ -1 +1,7 @@ export * from "./GetIntegrationWebhookUrlResponse"; +export * from "./ListIntegrationsParams"; +export * from "./ListIntegrationsResponse"; +export * from "./LoadSampleDataSetV2Response"; +export * from "./RunIntegrationResponse"; +export * from "./StartDataImportResponse"; +export * from "./UninstallIntegrationResponse"; diff --git a/src/serialization/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts b/src/serialization/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts index 2360b8c5..8cda2bea 100644 --- a/src/serialization/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts +++ b/src/serialization/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.ts @@ -14,6 +14,10 @@ export const CreateBillingLinkedPlanRequestBody: core.serialization.Schema< billingProvider: core.serialization.property("billing_provider", BillingProviderType), description: core.serialization.string(), externalResourceId: core.serialization.property("external_resource_id", core.serialization.string()), + externalResourceVersion: core.serialization.property( + "external_resource_version", + core.serialization.string().optional(), + ), icon: PlanIcon.optional(), name: core.serialization.string(), planType: core.serialization.property("plan_type", PlanType), @@ -24,6 +28,7 @@ export declare namespace CreateBillingLinkedPlanRequestBody { billing_provider: BillingProviderType.Raw; description: string; external_resource_id: string; + external_resource_version?: string | null; icon?: PlanIcon.Raw | null; name: string; plan_type: PlanType.Raw; diff --git a/src/serialization/types/ActivityEntryResponseData.ts b/src/serialization/types/ActivityEntryResponseData.ts new file mode 100644 index 00000000..60443d71 --- /dev/null +++ b/src/serialization/types/ActivityEntryResponseData.ts @@ -0,0 +1,28 @@ +// 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 ActivityEntryResponseData: core.serialization.ObjectSchema< + serializers.ActivityEntryResponseData.Raw, + Schematic.ActivityEntryResponseData +> = core.serialization.object({ + actorName: core.serialization.property("actor_name", core.serialization.string()), + method: core.serialization.string(), + resourceName: core.serialization.property("resource_name", core.serialization.string()), + resourceType: core.serialization.property("resource_type", core.serialization.string()), + timestamp: core.serialization.date(), + title: core.serialization.string(), +}); + +export declare namespace ActivityEntryResponseData { + export interface Raw { + actor_name: string; + method: string; + resource_name: string; + resource_type: string; + timestamp: string; + title: string; + } +} diff --git a/src/serialization/types/ActivityResponseResponseData.ts b/src/serialization/types/ActivityResponseResponseData.ts new file mode 100644 index 00000000..bb7e0efd --- /dev/null +++ b/src/serialization/types/ActivityResponseResponseData.ts @@ -0,0 +1,19 @@ +// 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 { ActivityEntryResponseData } from "./ActivityEntryResponseData"; + +export const ActivityResponseResponseData: core.serialization.ObjectSchema< + serializers.ActivityResponseResponseData.Raw, + Schematic.ActivityResponseResponseData +> = core.serialization.object({ + entries: core.serialization.list(ActivityEntryResponseData), +}); + +export declare namespace ActivityResponseResponseData { + export interface Raw { + entries: ActivityEntryResponseData.Raw[]; + } +} diff --git a/src/serialization/types/BillingCreditBundleView.ts b/src/serialization/types/BillingCreditBundleView.ts index bfdf16b4..8a2c96e0 100644 --- a/src/serialization/types/BillingCreditBundleView.ts +++ b/src/serialization/types/BillingCreditBundleView.ts @@ -20,10 +20,7 @@ export const BillingCreditBundleView: core.serialization.ObjectSchema< creditIcon: core.serialization.property("credit_icon", core.serialization.string().optional()), creditId: core.serialization.property("credit_id", core.serialization.string()), creditName: core.serialization.property("credit_name", core.serialization.string()), - currencyPrices: core.serialization.property( - "currency_prices", - core.serialization.list(CreditBundleCurrencyPrice).optional(), - ), + currencyPrices: core.serialization.property("currency_prices", core.serialization.list(CreditBundleCurrencyPrice)), expiryType: core.serialization.property("expiry_type", BillingCreditExpiryType), expiryUnit: core.serialization.property("expiry_unit", BillingCreditExpiryUnit), expiryUnitCount: core.serialization.property("expiry_unit_count", core.serialization.number().optional()), @@ -47,7 +44,7 @@ export declare namespace BillingCreditBundleView { credit_icon?: string | null; credit_id: string; credit_name: string; - currency_prices?: CreditBundleCurrencyPrice.Raw[] | null; + currency_prices: CreditBundleCurrencyPrice.Raw[]; expiry_type: BillingCreditExpiryType.Raw; expiry_unit: BillingCreditExpiryUnit.Raw; expiry_unit_count?: number | null; diff --git a/src/serialization/types/BillingCreditView.ts b/src/serialization/types/BillingCreditView.ts index 27732ab0..59cf524c 100644 --- a/src/serialization/types/BillingCreditView.ts +++ b/src/serialization/types/BillingCreditView.ts @@ -8,6 +8,7 @@ import { BillingCreditExpiryUnit } from "./BillingCreditExpiryUnit"; import { BillingCreditRolloverPolicy } from "./BillingCreditRolloverPolicy"; import { BillingPriceView } from "./BillingPriceView"; import { BillingProductResponseData } from "./BillingProductResponseData"; +import { CreditCurrencyPrice } from "./CreditCurrencyPrice"; export const BillingCreditView: core.serialization.ObjectSchema< serializers.BillingCreditView.Raw, @@ -17,6 +18,7 @@ export const BillingCreditView: core.serialization.ObjectSchema< burnStrategy: core.serialization.property("burn_strategy", BillingCreditBurnStrategy), costEditable: core.serialization.property("cost_editable", core.serialization.boolean()), createdAt: core.serialization.property("created_at", core.serialization.date()), + currencyPrices: core.serialization.property("currency_prices", core.serialization.list(CreditCurrencyPrice)), defaultExpiryUnit: core.serialization.property("default_expiry_unit", BillingCreditExpiryUnit), defaultExpiryUnitCount: core.serialization.property( "default_expiry_unit_count", @@ -43,6 +45,7 @@ export declare namespace BillingCreditView { burn_strategy: BillingCreditBurnStrategy.Raw; cost_editable: boolean; created_at: string; + currency_prices: CreditCurrencyPrice.Raw[]; default_expiry_unit: BillingCreditExpiryUnit.Raw; default_expiry_unit_count?: number | null; default_rollover_policy: BillingCreditRolloverPolicy.Raw; diff --git a/src/serialization/types/ClerkIntegrationConfig.ts b/src/serialization/types/ClerkIntegrationConfig.ts new file mode 100644 index 00000000..a8f0493d --- /dev/null +++ b/src/serialization/types/ClerkIntegrationConfig.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 ClerkIntegrationConfig: core.serialization.ObjectSchema< + serializers.ClerkIntegrationConfig.Raw, + Schematic.ClerkIntegrationConfig +> = core.serialization.object({ + firstEventsReceived: core.serialization.property("first_events_received", core.serialization.boolean().optional()), + webhookUrl: core.serialization.property("webhook_url", core.serialization.string().optional()), +}); + +export declare namespace ClerkIntegrationConfig { + export interface Raw { + first_events_received?: boolean | null; + webhook_url?: string | null; + } +} diff --git a/src/serialization/types/CompanyCreditBalanceResponseData.ts b/src/serialization/types/CompanyCreditBalanceResponseData.ts new file mode 100644 index 00000000..01843e29 --- /dev/null +++ b/src/serialization/types/CompanyCreditBalanceResponseData.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 { BillingProviderType } from "./BillingProviderType"; + +export const CompanyCreditBalanceResponseData: core.serialization.ObjectSchema< + serializers.CompanyCreditBalanceResponseData.Raw, + Schematic.CompanyCreditBalanceResponseData +> = core.serialization.object({ + creditId: core.serialization.property("credit_id", core.serialization.string()), + remaining: core.serialization.number(), + source: BillingProviderType, + total: core.serialization.number().optional(), +}); + +export declare namespace CompanyCreditBalanceResponseData { + export interface Raw { + credit_id: string; + remaining: number; + source: BillingProviderType.Raw; + total?: number | null; + } +} diff --git a/src/serialization/types/CompanyMatchingCriteria.ts b/src/serialization/types/CompanyMatchingCriteria.ts new file mode 100644 index 00000000..b3e4c369 --- /dev/null +++ b/src/serialization/types/CompanyMatchingCriteria.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 CompanyMatchingCriteria: core.serialization.Schema< + serializers.CompanyMatchingCriteria.Raw, + Schematic.CompanyMatchingCriteria +> = core.serialization.enum_(["billing_meta_object", "manual_upsert"]); + +export declare namespace CompanyMatchingCriteria { + export type Raw = "billing_meta_object" | "manual_upsert"; +} diff --git a/src/serialization/types/CreateEventRequestBody.ts b/src/serialization/types/CreateEventRequestBody.ts index e860a912..5bca6647 100644 --- a/src/serialization/types/CreateEventRequestBody.ts +++ b/src/serialization/types/CreateEventRequestBody.ts @@ -12,6 +12,7 @@ export const CreateEventRequestBody: core.serialization.ObjectSchema< > = core.serialization.object({ body: EventBody.optional(), eventType: core.serialization.property("event_type", EventType), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), sentAt: core.serialization.property("sent_at", core.serialization.date().optional()), }); @@ -19,6 +20,7 @@ export declare namespace CreateEventRequestBody { export interface Raw { body?: EventBody.Raw | null; event_type: EventType.Raw; + idempotency_key?: string | null; sent_at?: string | null; } } diff --git a/src/serialization/types/CreditCurrencyPrice.ts b/src/serialization/types/CreditCurrencyPrice.ts new file mode 100644 index 00000000..1310bf15 --- /dev/null +++ b/src/serialization/types/CreditCurrencyPrice.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 { BillingPriceView } from "./BillingPriceView"; + +export const CreditCurrencyPrice: core.serialization.ObjectSchema< + serializers.CreditCurrencyPrice.Raw, + Schematic.CreditCurrencyPrice +> = core.serialization.object({ + currency: core.serialization.string(), + price: BillingPriceView.optional(), +}); + +export declare namespace CreditCurrencyPrice { + export interface Raw { + currency: string; + price?: BillingPriceView.Raw | null; + } +} diff --git a/src/serialization/types/DataEventPayload.ts b/src/serialization/types/DataEventPayload.ts index ae3b790c..9f80118b 100644 --- a/src/serialization/types/DataEventPayload.ts +++ b/src/serialization/types/DataEventPayload.ts @@ -11,6 +11,7 @@ export const DataEventPayload: core.serialization.ObjectSchema< > = core.serialization.object({ apiKey: core.serialization.property("api_key", core.serialization.string()), body: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), sentAt: core.serialization.property("sent_at", core.serialization.date().optional()), type: EventType, }); @@ -19,6 +20,7 @@ export declare namespace DataEventPayload { export interface Raw { api_key: string; body?: Record | null; + idempotency_key?: string | null; sent_at?: string | null; type: EventType.Raw; } diff --git a/src/serialization/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts b/src/serialization/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts new file mode 100644 index 00000000..9479a78b --- /dev/null +++ b/src/serialization/types/EnvironmentFeatureUsageTimeSeriesResponseData.ts @@ -0,0 +1,23 @@ +// 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 { EnvironmentUsagePointResponseData } from "./EnvironmentUsagePointResponseData"; + +export const EnvironmentFeatureUsageTimeSeriesResponseData: core.serialization.ObjectSchema< + serializers.EnvironmentFeatureUsageTimeSeriesResponseData.Raw, + Schematic.EnvironmentFeatureUsageTimeSeriesResponseData +> = core.serialization.object({ + eventSubtype: core.serialization.property("event_subtype", core.serialization.string()), + featureId: core.serialization.property("feature_id", core.serialization.string()), + points: core.serialization.list(EnvironmentUsagePointResponseData), +}); + +export declare namespace EnvironmentFeatureUsageTimeSeriesResponseData { + export interface Raw { + event_subtype: string; + feature_id: string; + points: EnvironmentUsagePointResponseData.Raw[]; + } +} diff --git a/src/serialization/types/EnvironmentTraitUsageTimeSeriesResponseData.ts b/src/serialization/types/EnvironmentTraitUsageTimeSeriesResponseData.ts new file mode 100644 index 00000000..09f46ff9 --- /dev/null +++ b/src/serialization/types/EnvironmentTraitUsageTimeSeriesResponseData.ts @@ -0,0 +1,23 @@ +// 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 { EnvironmentUsagePointResponseData } from "./EnvironmentUsagePointResponseData"; + +export const EnvironmentTraitUsageTimeSeriesResponseData: core.serialization.ObjectSchema< + serializers.EnvironmentTraitUsageTimeSeriesResponseData.Raw, + Schematic.EnvironmentTraitUsageTimeSeriesResponseData +> = core.serialization.object({ + featureId: core.serialization.property("feature_id", core.serialization.string()), + points: core.serialization.list(EnvironmentUsagePointResponseData), + traitDefinitionId: core.serialization.property("trait_definition_id", core.serialization.string()), +}); + +export declare namespace EnvironmentTraitUsageTimeSeriesResponseData { + export interface Raw { + feature_id: string; + points: EnvironmentUsagePointResponseData.Raw[]; + trait_definition_id: string; + } +} diff --git a/src/serialization/types/EnvironmentUsagePointResponseData.ts b/src/serialization/types/EnvironmentUsagePointResponseData.ts new file mode 100644 index 00000000..ecc23a70 --- /dev/null +++ b/src/serialization/types/EnvironmentUsagePointResponseData.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 EnvironmentUsagePointResponseData: core.serialization.ObjectSchema< + serializers.EnvironmentUsagePointResponseData.Raw, + Schematic.EnvironmentUsagePointResponseData +> = core.serialization.object({ + timestamp: core.serialization.date(), + usage: core.serialization.number(), +}); + +export declare namespace EnvironmentUsagePointResponseData { + export interface Raw { + timestamp: string; + usage: number; + } +} diff --git a/src/serialization/types/EventDetailResponseData.ts b/src/serialization/types/EventDetailResponseData.ts index af8ae92a..5fd840a8 100644 --- a/src/serialization/types/EventDetailResponseData.ts +++ b/src/serialization/types/EventDetailResponseData.ts @@ -23,6 +23,7 @@ export const EventDetailResponseData: core.serialization.ObjectSchema< featureIds: core.serialization.property("feature_ids", core.serialization.list(core.serialization.string())), features: core.serialization.list(PreviewObject), id: core.serialization.string(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), loadedAt: core.serialization.property("loaded_at", core.serialization.date().optional()), processedAt: core.serialization.property("processed_at", core.serialization.date().optional()), quantity: core.serialization.number(), @@ -49,6 +50,7 @@ export declare namespace EventDetailResponseData { feature_ids: string[]; features: PreviewObject.Raw[]; id: string; + idempotency_key?: string | null; loaded_at?: string | null; processed_at?: string | null; quantity: number; diff --git a/src/serialization/types/EventResponseData.ts b/src/serialization/types/EventResponseData.ts index b6caa6a6..e89b9002 100644 --- a/src/serialization/types/EventResponseData.ts +++ b/src/serialization/types/EventResponseData.ts @@ -20,6 +20,7 @@ export const EventResponseData: core.serialization.ObjectSchema< errorMessage: core.serialization.property("error_message", core.serialization.string().optional()), featureIds: core.serialization.property("feature_ids", core.serialization.list(core.serialization.string())), id: core.serialization.string(), + idempotencyKey: core.serialization.property("idempotency_key", core.serialization.string().optional()), loadedAt: core.serialization.property("loaded_at", core.serialization.date().optional()), processedAt: core.serialization.property("processed_at", core.serialization.date().optional()), quantity: core.serialization.number(), @@ -43,6 +44,7 @@ export declare namespace EventResponseData { error_message?: string | null; feature_ids: string[]; id: string; + idempotency_key?: string | null; loaded_at?: string | null; processed_at?: string | null; quantity: number; diff --git a/src/serialization/types/InsightsSummaryResponseData.ts b/src/serialization/types/InsightsSummaryResponseData.ts new file mode 100644 index 00000000..950f9718 --- /dev/null +++ b/src/serialization/types/InsightsSummaryResponseData.ts @@ -0,0 +1,29 @@ +// 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 { MrrResponseData } from "./MrrResponseData"; + +export const InsightsSummaryResponseData: core.serialization.ObjectSchema< + serializers.InsightsSummaryResponseData.Raw, + Schematic.InsightsSummaryResponseData +> = core.serialization.object({ + activeCredits: core.serialization.property("active_credits", core.serialization.number()), + mrr: core.serialization.list(MrrResponseData), + paidCompanies: core.serialization.property("paid_companies", core.serialization.number()), + totalCompanies: core.serialization.property("total_companies", core.serialization.number()), + totalFeatures: core.serialization.property("total_features", core.serialization.number()), + totalPlans: core.serialization.property("total_plans", core.serialization.number()), +}); + +export declare namespace InsightsSummaryResponseData { + export interface Raw { + active_credits: number; + mrr: MrrResponseData.Raw[]; + paid_companies: number; + total_companies: number; + total_features: number; + total_plans: number; + } +} diff --git a/src/serialization/types/IntegrationCapabilities.ts b/src/serialization/types/IntegrationCapabilities.ts new file mode 100644 index 00000000..bdd31bda --- /dev/null +++ b/src/serialization/types/IntegrationCapabilities.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 IntegrationCapabilities: core.serialization.ObjectSchema< + serializers.IntegrationCapabilities.Raw, + Schematic.IntegrationCapabilities +> = core.serialization.object({ + authorPlans: core.serialization.property("author_plans", core.serialization.boolean()), + checkout: core.serialization.boolean(), + editBilling: core.serialization.property("edit_billing", core.serialization.boolean()), +}); + +export declare namespace IntegrationCapabilities { + export interface Raw { + author_plans: boolean; + checkout: boolean; + edit_billing: boolean; + } +} diff --git a/src/serialization/types/IntegrationConfig.ts b/src/serialization/types/IntegrationConfig.ts new file mode 100644 index 00000000..db62541d --- /dev/null +++ b/src/serialization/types/IntegrationConfig.ts @@ -0,0 +1,38 @@ +// 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 { ClerkIntegrationConfig } from "./ClerkIntegrationConfig"; +import { OrbIntegrationConfig } from "./OrbIntegrationConfig"; +import { StripeIntegrationConfig } from "./StripeIntegrationConfig"; + +export const IntegrationConfig: core.serialization.Schema< + serializers.IntegrationConfig.Raw, + Schematic.IntegrationConfig +> = core.serialization + .union("type", { + clerk: ClerkIntegrationConfig, + orb: OrbIntegrationConfig, + stripe: StripeIntegrationConfig, + }) + .transform({ + transform: (value) => value, + untransform: (value) => value, + }); + +export declare namespace IntegrationConfig { + export type Raw = IntegrationConfig.Clerk | IntegrationConfig.Orb | IntegrationConfig.Stripe; + + export interface Clerk extends ClerkIntegrationConfig.Raw { + type: "clerk"; + } + + export interface Orb extends OrbIntegrationConfig.Raw { + type: "orb"; + } + + export interface Stripe extends StripeIntegrationConfig.Raw { + type: "stripe"; + } +} diff --git a/src/serialization/types/IntegrationResponseData.ts b/src/serialization/types/IntegrationResponseData.ts new file mode 100644 index 00000000..80b8316e --- /dev/null +++ b/src/serialization/types/IntegrationResponseData.ts @@ -0,0 +1,28 @@ +// 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 { IntegrationState } from "./IntegrationState"; +import { IntegrationType } from "./IntegrationType"; + +export const IntegrationResponseData: core.serialization.ObjectSchema< + serializers.IntegrationResponseData.Raw, + Schematic.IntegrationResponseData +> = core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.date()), + id: core.serialization.string(), + state: IntegrationState, + type: IntegrationType, + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace IntegrationResponseData { + export interface Raw { + created_at: string; + id: string; + state: IntegrationState.Raw; + type: IntegrationType.Raw; + updated_at: string; + } +} diff --git a/src/serialization/types/IntegrationState.ts b/src/serialization/types/IntegrationState.ts new file mode 100644 index 00000000..7d0c035b --- /dev/null +++ b/src/serialization/types/IntegrationState.ts @@ -0,0 +1,12 @@ +// 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 IntegrationState: core.serialization.Schema = + core.serialization.enum_(["active", "created", "pending"]); + +export declare namespace IntegrationState { + export type Raw = "active" | "created" | "pending"; +} diff --git a/src/serialization/types/IntegrationsDataSetResponseData.ts b/src/serialization/types/IntegrationsDataSetResponseData.ts new file mode 100644 index 00000000..5584ca0c --- /dev/null +++ b/src/serialization/types/IntegrationsDataSetResponseData.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 IntegrationsDataSetResponseData: core.serialization.ObjectSchema< + serializers.IntegrationsDataSetResponseData.Raw, + Schematic.IntegrationsDataSetResponseData +> = core.serialization.object({ + keys: core.serialization.list(core.serialization.string()), +}); + +export declare namespace IntegrationsDataSetResponseData { + export interface Raw { + keys: string[]; + } +} diff --git a/src/serialization/types/IntegrationsListResponseData.ts b/src/serialization/types/IntegrationsListResponseData.ts new file mode 100644 index 00000000..e1d325ed --- /dev/null +++ b/src/serialization/types/IntegrationsListResponseData.ts @@ -0,0 +1,34 @@ +// 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 { IntegrationCapabilities } from "./IntegrationCapabilities"; +import { IntegrationConfig } from "./IntegrationConfig"; +import { IntegrationState } from "./IntegrationState"; +import { IntegrationType } from "./IntegrationType"; + +export const IntegrationsListResponseData: core.serialization.ObjectSchema< + serializers.IntegrationsListResponseData.Raw, + Schematic.IntegrationsListResponseData +> = core.serialization.object({ + capabilities: IntegrationCapabilities, + config: IntegrationConfig.optional(), + id: core.serialization.string(), + isAppInstall: core.serialization.property("is_app_install", core.serialization.boolean()), + isConnectInstall: core.serialization.property("is_connect_install", core.serialization.boolean()), + state: IntegrationState, + type: IntegrationType, +}); + +export declare namespace IntegrationsListResponseData { + export interface Raw { + capabilities: IntegrationCapabilities.Raw; + config?: IntegrationConfig.Raw | null; + id: string; + is_app_install: boolean; + is_connect_install: boolean; + state: IntegrationState.Raw; + type: IntegrationType.Raw; + } +} diff --git a/src/serialization/types/IntegrationsResponseData.ts b/src/serialization/types/IntegrationsResponseData.ts new file mode 100644 index 00000000..644411bc --- /dev/null +++ b/src/serialization/types/IntegrationsResponseData.ts @@ -0,0 +1,28 @@ +// 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 { IntegrationState } from "./IntegrationState"; +import { IntegrationType } from "./IntegrationType"; + +export const IntegrationsResponseData: core.serialization.ObjectSchema< + serializers.IntegrationsResponseData.Raw, + Schematic.IntegrationsResponseData +> = core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.date()), + id: core.serialization.string(), + state: IntegrationState, + type: IntegrationType, + updatedAt: core.serialization.property("updated_at", core.serialization.date()), +}); + +export declare namespace IntegrationsResponseData { + export interface Raw { + created_at: string; + id: string; + state: IntegrationState.Raw; + type: IntegrationType.Raw; + updated_at: string; + } +} diff --git a/src/serialization/types/MrrResponseData.ts b/src/serialization/types/MrrResponseData.ts new file mode 100644 index 00000000..d017dac6 --- /dev/null +++ b/src/serialization/types/MrrResponseData.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 MrrResponseData: core.serialization.ObjectSchema< + serializers.MrrResponseData.Raw, + Schematic.MrrResponseData +> = core.serialization.object({ + amount: core.serialization.number(), + currency: core.serialization.string(), +}); + +export declare namespace MrrResponseData { + export interface Raw { + amount: number; + currency: string; + } +} diff --git a/src/serialization/types/OrbIntegrationConfig.ts b/src/serialization/types/OrbIntegrationConfig.ts new file mode 100644 index 00000000..1b946a08 --- /dev/null +++ b/src/serialization/types/OrbIntegrationConfig.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"; + +export const OrbIntegrationConfig: core.serialization.ObjectSchema< + serializers.OrbIntegrationConfig.Raw, + Schematic.OrbIntegrationConfig +> = core.serialization.object({ + externalCustomerIdKey: core.serialization.property( + "external_customer_id_key", + core.serialization.string().optional(), + ), +}); + +export declare namespace OrbIntegrationConfig { + export interface Raw { + external_customer_id_key?: string | null; + } +} diff --git a/src/serialization/types/PlanGrowthPointResponseData.ts b/src/serialization/types/PlanGrowthPointResponseData.ts new file mode 100644 index 00000000..7921e012 --- /dev/null +++ b/src/serialization/types/PlanGrowthPointResponseData.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 PlanGrowthPointResponseData: core.serialization.ObjectSchema< + serializers.PlanGrowthPointResponseData.Raw, + Schematic.PlanGrowthPointResponseData +> = core.serialization.object({ + month: core.serialization.date(), + planId: core.serialization.property("plan_id", core.serialization.string()), + planName: core.serialization.property("plan_name", core.serialization.string()), + subscribers: core.serialization.number(), +}); + +export declare namespace PlanGrowthPointResponseData { + export interface Raw { + month: string; + plan_id: string; + plan_name: string; + subscribers: number; + } +} diff --git a/src/serialization/types/PlanGrowthResponseData.ts b/src/serialization/types/PlanGrowthResponseData.ts new file mode 100644 index 00000000..cf35de97 --- /dev/null +++ b/src/serialization/types/PlanGrowthResponseData.ts @@ -0,0 +1,19 @@ +// 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 { PlanGrowthPointResponseData } from "./PlanGrowthPointResponseData"; + +export const PlanGrowthResponseData: core.serialization.ObjectSchema< + serializers.PlanGrowthResponseData.Raw, + Schematic.PlanGrowthResponseData +> = core.serialization.object({ + points: core.serialization.list(PlanGrowthPointResponseData), +}); + +export declare namespace PlanGrowthResponseData { + export interface Raw { + points: PlanGrowthPointResponseData.Raw[]; + } +} diff --git a/src/serialization/types/RulesEngineSchemaVersion.ts b/src/serialization/types/RulesEngineSchemaVersion.ts index 9d75815a..4438b75d 100644 --- a/src/serialization/types/RulesEngineSchemaVersion.ts +++ b/src/serialization/types/RulesEngineSchemaVersion.ts @@ -7,8 +7,8 @@ import type * as serializers from "../index"; export const RulesEngineSchemaVersion: core.serialization.Schema< serializers.RulesEngineSchemaVersion.Raw, Schematic.RulesEngineSchemaVersion -> = core.serialization.enum_(["vf05bf5da", "placeholder-for-fern-compatibility"]); +> = core.serialization.enum_(["v97288f60", "placeholder-for-fern-compatibility"]); export declare namespace RulesEngineSchemaVersion { - export type Raw = "vf05bf5da" | "placeholder-for-fern-compatibility"; + export type Raw = "v97288f60" | "placeholder-for-fern-compatibility"; } diff --git a/src/serialization/types/StripeIntegrationConfig.ts b/src/serialization/types/StripeIntegrationConfig.ts new file mode 100644 index 00000000..9a794bf1 --- /dev/null +++ b/src/serialization/types/StripeIntegrationConfig.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"; + +export const StripeIntegrationConfig: core.serialization.ObjectSchema< + serializers.StripeIntegrationConfig.Raw, + Schematic.StripeIntegrationConfig +> = core.serialization.object({ + accountId: core.serialization.property("account_id", core.serialization.string().optional()), + accountName: core.serialization.property("account_name", 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()), + onboardUrl: core.serialization.property("onboard_url", core.serialization.string().optional()), + version: core.serialization.number(), +}); + +export declare namespace StripeIntegrationConfig { + export interface Raw { + account_id?: string | null; + account_name?: string | null; + company_update_only?: boolean | null; + is_sandbox: boolean; + live_mode: boolean; + onboard_url?: string | null; + version: number; + } +} diff --git a/src/serialization/types/TopFeatureByUsageResponseData.ts b/src/serialization/types/TopFeatureByUsageResponseData.ts new file mode 100644 index 00000000..26dcd7ff --- /dev/null +++ b/src/serialization/types/TopFeatureByUsageResponseData.ts @@ -0,0 +1,28 @@ +// 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 TopFeatureByUsageResponseData: core.serialization.ObjectSchema< + serializers.TopFeatureByUsageResponseData.Raw, + Schematic.TopFeatureByUsageResponseData +> = core.serialization.object({ + changePct: core.serialization.property("change_pct", core.serialization.number().optional()), + featureId: core.serialization.property("feature_id", core.serialization.string()), + featureName: core.serialization.property("feature_name", core.serialization.string()), + pluralName: core.serialization.property("plural_name", core.serialization.string().optional()), + priorUsage: core.serialization.property("prior_usage", core.serialization.number()), + usage: core.serialization.number(), +}); + +export declare namespace TopFeatureByUsageResponseData { + export interface Raw { + change_pct?: number | null; + feature_id: string; + feature_name: string; + plural_name?: string | null; + prior_usage: number; + usage: number; + } +} diff --git a/src/serialization/types/TopFeaturesByUsageResponseData.ts b/src/serialization/types/TopFeaturesByUsageResponseData.ts new file mode 100644 index 00000000..aa629b9e --- /dev/null +++ b/src/serialization/types/TopFeaturesByUsageResponseData.ts @@ -0,0 +1,19 @@ +// 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 { TopFeatureByUsageResponseData } from "./TopFeatureByUsageResponseData"; + +export const TopFeaturesByUsageResponseData: core.serialization.ObjectSchema< + serializers.TopFeaturesByUsageResponseData.Raw, + Schematic.TopFeaturesByUsageResponseData +> = core.serialization.object({ + features: core.serialization.list(TopFeatureByUsageResponseData), +}); + +export declare namespace TopFeaturesByUsageResponseData { + export interface Raw { + features: TopFeatureByUsageResponseData.Raw[]; + } +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 92fca62f..91c17318 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -1,6 +1,8 @@ export * from "./AccountMemberPermission"; export * from "./AccountMemberResponseData"; export * from "./AccountMemberRole"; +export * from "./ActivityEntryResponseData"; +export * from "./ActivityResponseResponseData"; export * from "./ActorType"; export * from "./ApiError"; export * from "./ApiKeyCreateResponseData"; @@ -63,9 +65,12 @@ export * from "./CheckFlagsResponseData"; export * from "./CheckoutDataResponseData"; export * from "./CheckoutSettingsResponseData"; export * from "./CheckoutSubscription"; +export * from "./ClerkIntegrationConfig"; +export * from "./CompanyCreditBalanceResponseData"; export * from "./CompanyDetailResponseData"; export * from "./CompanyEventPeriodMetricsResponseData"; export * from "./CompanyLedgerResponseData"; +export * from "./CompanyMatchingCriteria"; export * from "./CompanyMembershipDetailResponseData"; export * from "./CompanyMembershipResponseData"; export * from "./CompanyOverrideNoteResponseData"; @@ -114,6 +119,7 @@ export * from "./CreditBundleCurrencyPriceRequestBody"; export * from "./CreditBundleCurrencyPriceResponseData"; export * from "./CreditBundlePurchaseResponseData"; export * from "./CreditCompanyGrantView"; +export * from "./CreditCurrencyPrice"; export * from "./CreditCurrencyPriceRequestBody"; export * from "./CreditCurrencyPriceResponseData"; export * from "./CreditEventLedgerResponseData"; @@ -162,8 +168,11 @@ export * from "./EntityTraitResponseData"; export * from "./EntityTraitValue"; export * from "./EntityType"; export * from "./EnvironmentDetailResponseData"; +export * from "./EnvironmentFeatureUsageTimeSeriesResponseData"; export * from "./EnvironmentResponseData"; +export * from "./EnvironmentTraitUsageTimeSeriesResponseData"; export * from "./EnvironmentType"; +export * from "./EnvironmentUsagePointResponseData"; export * from "./EventBody"; export * from "./EventBodyFlagCheck"; export * from "./EventBodyIdentify"; @@ -194,6 +203,14 @@ export * from "./FlagResponseData"; export * from "./FlagType"; export * from "./FlagView"; export * from "./GenericPreviewObject"; +export * from "./InsightsSummaryResponseData"; +export * from "./IntegrationCapabilities"; +export * from "./IntegrationConfig"; +export * from "./IntegrationResponseData"; +export * from "./IntegrationState"; +export * from "./IntegrationsDataSetResponseData"; +export * from "./IntegrationsListResponseData"; +export * from "./IntegrationsResponseData"; export * from "./IntegrationType"; export * from "./IntegrationWebhookUrlResponseData"; export * from "./InvoiceRequestBody"; @@ -208,6 +225,8 @@ export * from "./ManagePlanResponseResponseData"; export * from "./MeterRequestBody"; export * from "./MetricPeriod"; export * from "./MetricPeriodMonthReset"; +export * from "./MrrResponseData"; +export * from "./OrbIntegrationConfig"; export * from "./OrderedPlansInGroup"; export * from "./PaymentMethodRequestBody"; export * from "./PaymentMethodResponseData"; @@ -230,6 +249,8 @@ export * from "./PlanGroupDetailResponseData"; export * from "./PlanGroupPlanDetailResponseData"; export * from "./PlanGroupPlanEntitlementsOrder"; export * from "./PlanGroupResponseData"; +export * from "./PlanGrowthPointResponseData"; +export * from "./PlanGrowthResponseData"; export * from "./PlanIcon"; export * from "./PlanIssueResponseData"; export * from "./PlanResponseData"; @@ -295,12 +316,15 @@ export * from "./SkippedEntitlementErrorResponseData"; export * from "./SkippedEntitlementResponseData"; export * from "./SortDirection"; export * from "./StripeEmbedInfo"; +export * from "./StripeIntegrationConfig"; export * from "./SubscriptionStatus"; export * from "./SubscriptionTraitUpdate"; export * from "./SubscriptionType"; export * from "./TemporaryAccessTokenResourceType"; export * from "./TemporaryAccessTokenResponseData"; export * from "./TimeSeriesGranularity"; +export * from "./TopFeatureByUsageResponseData"; +export * from "./TopFeaturesByUsageResponseData"; export * from "./TraitDefinition"; export * from "./TraitDefinitionComparableType"; export * from "./TraitType"; diff --git a/tests/unit/fetcher/redacting.test.ts b/tests/unit/fetcher/redacting.test.ts index 884ce4cc..5bd45133 100644 --- a/tests/unit/fetcher/redacting.test.ts +++ b/tests/unit/fetcher/redacting.test.ts @@ -703,6 +703,112 @@ describe("Redacting Logic", () => { }); }); + describe("Query String Redaction", () => { + it("should redact api_key in queryString via URL", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryString: "api_key=secret-key&page=1", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]&page=1", + }), + ); + }); + + it("should redact multiple sensitive params in queryString", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryString: "token=t&password=p&page=1", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?token=[REDACTED]&password=[REDACTED]&page=1", + }), + ); + }); + + it("should not redact non-sensitive params in queryString", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryString: "page=1&limit=10&sort=name", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?page=1&limit=10&sort=name", + }), + ); + }); + + it("should prefer queryString over queryParameters when both provided", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryString: "page=1", + queryParameters: { api_key: "secret-key" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?page=1", + queryParameters: expect.objectContaining({ + api_key: "[REDACTED]", + }), + }), + ); + }); + }); + describe("URL Redaction", () => { it("should redact credentials in URL", async () => { const mockLogger = createMockLogger(); diff --git a/tests/wire/billing.test.ts b/tests/wire/billing.test.ts index cccec919..05d1390e 100644 --- a/tests/wire/billing.test.ts +++ b/tests/wire/billing.test.ts @@ -3197,6 +3197,7 @@ describe("BillingClient", () => { price_usage_type: "licensed", provider_type: "orb", q: "q", + recurring_charges_only: true, with_one_time_charges: true, with_prices_only: true, with_zero_price: true, @@ -3213,6 +3214,7 @@ describe("BillingClient", () => { priceUsageType: "licensed", providerType: "orb", q: "q", + recurringChargesOnly: true, withOneTimeCharges: true, withPricesOnly: true, withZeroPrice: true, @@ -3258,6 +3260,7 @@ describe("BillingClient", () => { priceUsageType: "licensed", providerType: "orb", q: "q", + recurringChargesOnly: true, withOneTimeCharges: true, withPricesOnly: true, withZeroPrice: true, @@ -3346,6 +3349,7 @@ describe("BillingClient", () => { price_usage_type: "licensed", provider_type: "orb", q: "q", + recurring_charges_only: true, with_one_time_charges: true, with_prices_only: true, with_zero_price: true, @@ -3368,6 +3372,7 @@ describe("BillingClient", () => { priceUsageType: "licensed", providerType: "orb", q: "q", + recurringChargesOnly: true, withOneTimeCharges: true, withPricesOnly: true, withZeroPrice: true, @@ -3388,6 +3393,7 @@ describe("BillingClient", () => { priceUsageType: "licensed", providerType: "orb", q: "q", + recurringChargesOnly: true, withOneTimeCharges: true, withPricesOnly: true, withZeroPrice: true, diff --git a/tests/wire/companies.test.ts b/tests/wire/companies.test.ts index 4a4f6956..f91cb245 100644 --- a/tests/wire/companies.test.ts +++ b/tests/wire/companies.test.ts @@ -3528,6 +3528,7 @@ describe("CompaniesClient", () => { 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", @@ -3608,6 +3609,7 @@ describe("CompaniesClient", () => { 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", @@ -3702,6 +3704,7 @@ describe("CompaniesClient", () => { 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", @@ -3782,6 +3785,7 @@ describe("CompaniesClient", () => { 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", @@ -4631,6 +4635,7 @@ describe("CompaniesClient", () => { 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", @@ -4711,6 +4716,7 @@ describe("CompaniesClient", () => { 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", @@ -5137,6 +5143,14 @@ describe("CompaniesClient", () => { 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", @@ -5222,6 +5236,14 @@ describe("CompaniesClient", () => { 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", @@ -5321,6 +5343,14 @@ describe("CompaniesClient", () => { 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", @@ -5406,6 +5436,14 @@ describe("CompaniesClient", () => { 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", @@ -6274,6 +6312,14 @@ describe("CompaniesClient", () => { 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", @@ -6359,6 +6405,14 @@ describe("CompaniesClient", () => { 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", diff --git a/tests/wire/components.test.ts b/tests/wire/components.test.ts index 39df38cc..877596e2 100644 --- a/tests/wire/components.test.ts +++ b/tests/wire/components.test.ts @@ -1347,6 +1347,7 @@ describe("ComponentsClient", () => { created_at: "2024-01-15T09:30:00Z", credit_id: "credit_id", credit_name: "credit_name", + currency_prices: [{ currency: "currency" }], expiry_type: "duration", expiry_unit: "billing_periods", has_grants: true, @@ -2605,6 +2606,11 @@ describe("ComponentsClient", () => { createdAt: new Date("2024-01-15T09:30:00.000Z"), creditId: "credit_id", creditName: "credit_name", + currencyPrices: [ + { + currency: "currency", + }, + ], expiryType: "duration", expiryUnit: "billing_periods", hasGrants: true, diff --git a/tests/wire/credits.test.ts b/tests/wire/credits.test.ts index 7130c360..728ce36a 100644 --- a/tests/wire/credits.test.ts +++ b/tests/wire/credits.test.ts @@ -950,6 +950,146 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("listCompanyCreditBalances (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: [{ credit_id: "credit_id", remaining: 1.1, source: "orb", total: 1.1 }], + params: { company_id: "company_id" }, + }; + + server + .mockEndpoint() + .get("/billing/credits/balance") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.listCompanyCreditBalances({ + companyId: "company_id", + }); + expect(response).toEqual({ + data: [ + { + creditId: "credit_id", + remaining: 1.1, + source: "orb", + total: 1.1, + }, + ], + params: { + companyId: "company_id", + }, + }); + }); + + test("listCompanyCreditBalances (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/balance") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCompanyCreditBalances({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("listCompanyCreditBalances (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/balance") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCompanyCreditBalances({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("listCompanyCreditBalances (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/balance") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCompanyCreditBalances({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("listCompanyCreditBalances (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/balance") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCompanyCreditBalances({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("listCompanyCreditBalances (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/balance") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCompanyCreditBalances({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("listCreditBundles (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); diff --git a/tests/wire/events.test.ts b/tests/wire/events.test.ts index 9ff09c71..45fd7fa0 100644 --- a/tests/wire/events.test.ts +++ b/tests/wire/events.test.ts @@ -322,6 +322,7 @@ describe("EventsClient", () => { feature_ids: ["feature_ids"], features: [{ id: "id", name: "name" }], id: "id", + idempotency_key: "idempotency_key", loaded_at: "2024-01-15T09:30:00Z", quantity: 1000000, sent_at: "2024-01-15T09:30:00Z", @@ -337,6 +338,7 @@ describe("EventsClient", () => { event_subtype: "event_subtype", event_types: ["flag_check"], flag_id: "flag_id", + idempotency_key: "idempotency_key", limit: 1000000, offset: 1000000, user_id: "user_id", @@ -350,6 +352,7 @@ describe("EventsClient", () => { eventSubtype: "event_subtype", eventTypes: ["flag_check"], flagId: "flag_id", + idempotencyKey: "idempotency_key", userId: "user_id", limit: 1000000, offset: 1000000, @@ -378,6 +381,7 @@ describe("EventsClient", () => { }, ], id: "id", + idempotencyKey: "idempotency_key", loadedAt: new Date("2024-01-15T09:30:00.000Z"), quantity: 1000000, sentAt: new Date("2024-01-15T09:30:00.000Z"), @@ -396,6 +400,7 @@ describe("EventsClient", () => { eventSubtype: "event_subtype", eventTypes: ["flag_check"], flagId: "flag_id", + idempotencyKey: "idempotency_key", limit: 1000000, offset: 1000000, userId: "user_id", @@ -636,6 +641,7 @@ describe("EventsClient", () => { feature_ids: ["feature_ids"], features: [{ id: "id", name: "name" }], id: "id", + idempotency_key: "idempotency_key", loaded_at: "2024-01-15T09:30:00Z", quantity: 1000000, sent_at: "2024-01-15T09:30:00Z", @@ -676,6 +682,7 @@ describe("EventsClient", () => { }, ], id: "id", + idempotencyKey: "idempotency_key", loadedAt: new Date("2024-01-15T09:30:00.000Z"), quantity: 1000000, sentAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/insights.test.ts b/tests/wire/insights.test.ts new file mode 100644 index 00000000..cd5a26b8 --- /dev/null +++ b/tests/wire/insights.test.ts @@ -0,0 +1,732 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Schematic from "../../src/api/index"; +import { SchematicClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("InsightsClient", () => { + test("getActivity (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + entries: [ + { + actor_name: "actor_name", + method: "method", + resource_name: "resource_name", + resource_type: "resource_type", + timestamp: "2024-01-15T09:30:00Z", + title: "title", + }, + ], + }, + params: { limit: 1000000 }, + }; + + server.mockEndpoint().get("/insights/activity").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.insights.getActivity({ + limit: 1000000, + }); + expect(response).toEqual({ + data: { + entries: [ + { + actorName: "actor_name", + method: "method", + resourceName: "resource_name", + resourceType: "resource_type", + timestamp: new Date("2024-01-15T09:30:00.000Z"), + title: "title", + }, + ], + }, + params: { + limit: 1000000, + }, + }); + }); + + test("getActivity (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/activity").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getActivity(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getActivity (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/activity").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getActivity(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getActivity (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/activity").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getActivity(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getActivity (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/activity").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getActivity(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getEnvironmentFeatureUsageTimeSeries (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + event_subtype: "event_subtype", + feature_id: "feature_id", + points: [{ timestamp: "2024-01-15T09:30:00Z", usage: 1000000 }], + }, + params: { + end_time: "2024-01-15T09:30:00Z", + feature_id: "feature_id", + granularity: "daily", + start_time: "2024-01-15T09:30:00Z", + }, + }; + + server + .mockEndpoint() + .get("/insights/feature-usage-timeseries") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.insights.getEnvironmentFeatureUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + granularity: "daily", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + expect(response).toEqual({ + data: { + eventSubtype: "event_subtype", + featureId: "feature_id", + points: [ + { + timestamp: new Date("2024-01-15T09:30:00.000Z"), + usage: 1000000, + }, + ], + }, + params: { + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + granularity: "daily", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }, + }); + }); + + test("getEnvironmentFeatureUsageTimeSeries (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/feature-usage-timeseries") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentFeatureUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getEnvironmentFeatureUsageTimeSeries (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/feature-usage-timeseries") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentFeatureUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getEnvironmentFeatureUsageTimeSeries (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/feature-usage-timeseries") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentFeatureUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getEnvironmentFeatureUsageTimeSeries (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/feature-usage-timeseries") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentFeatureUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getPlanGrowth (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + points: [ + { month: "2024-01-15T09:30:00Z", plan_id: "plan_id", plan_name: "plan_name", subscribers: 1000000 }, + ], + }, + params: { months: 1000000 }, + }; + + server + .mockEndpoint() + .get("/insights/plan-growth") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.insights.getPlanGrowth({ + months: 1000000, + }); + expect(response).toEqual({ + data: { + points: [ + { + month: new Date("2024-01-15T09:30:00.000Z"), + planId: "plan_id", + planName: "plan_name", + subscribers: 1000000, + }, + ], + }, + params: { + months: 1000000, + }, + }); + }); + + test("getPlanGrowth (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/plan-growth") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getPlanGrowth(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getPlanGrowth (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/plan-growth") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getPlanGrowth(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getPlanGrowth (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/plan-growth") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getPlanGrowth(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getPlanGrowth (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/plan-growth") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getPlanGrowth(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getSummary (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + active_credits: 1.1, + mrr: [{ amount: 1000000, currency: "currency" }], + paid_companies: 1000000, + total_companies: 1000000, + total_features: 1000000, + total_plans: 1000000, + }, + params: { key: "value" }, + }; + + server.mockEndpoint().get("/insights/summary").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.insights.getSummary(); + expect(response).toEqual({ + data: { + activeCredits: 1.1, + mrr: [ + { + amount: 1000000, + currency: "currency", + }, + ], + paidCompanies: 1000000, + totalCompanies: 1000000, + totalFeatures: 1000000, + totalPlans: 1000000, + }, + params: { + key: "value", + }, + }); + }); + + test("getSummary (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/summary").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getSummary(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getSummary (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/summary").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getSummary(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getSummary (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/summary").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getSummary(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getSummary (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/insights/summary").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.insights.getSummary(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getTopFeaturesByUsage (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + features: [ + { feature_id: "feature_id", feature_name: "feature_name", prior_usage: 1000000, usage: 1000000 }, + ], + }, + params: { end_time: "2024-01-15T09:30:00Z", limit: 1000000, start_time: "2024-01-15T09:30:00Z" }, + }; + + server + .mockEndpoint() + .get("/insights/top-features") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.insights.getTopFeaturesByUsage({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + limit: 1000000, + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + expect(response).toEqual({ + data: { + features: [ + { + featureId: "feature_id", + featureName: "feature_name", + priorUsage: 1000000, + usage: 1000000, + }, + ], + }, + params: { + endTime: new Date("2024-01-15T09:30:00.000Z"), + limit: 1000000, + startTime: new Date("2024-01-15T09:30:00.000Z"), + }, + }); + }); + + test("getTopFeaturesByUsage (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/top-features") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getTopFeaturesByUsage({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getTopFeaturesByUsage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/top-features") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getTopFeaturesByUsage({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getTopFeaturesByUsage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/top-features") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getTopFeaturesByUsage({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getTopFeaturesByUsage (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/top-features") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getTopFeaturesByUsage({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("getEnvironmentTraitUsageTimeSeries (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + feature_id: "feature_id", + points: [{ timestamp: "2024-01-15T09:30:00Z", usage: 1000000 }], + trait_definition_id: "trait_definition_id", + }, + params: { + end_time: "2024-01-15T09:30:00Z", + feature_id: "feature_id", + granularity: "daily", + start_time: "2024-01-15T09:30:00Z", + }, + }; + + server + .mockEndpoint() + .get("/insights/trait-usage-timeseries") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.insights.getEnvironmentTraitUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + granularity: "daily", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + expect(response).toEqual({ + data: { + featureId: "feature_id", + points: [ + { + timestamp: new Date("2024-01-15T09:30:00.000Z"), + usage: 1000000, + }, + ], + traitDefinitionId: "trait_definition_id", + }, + params: { + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + granularity: "daily", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }, + }); + }); + + test("getEnvironmentTraitUsageTimeSeries (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/trait-usage-timeseries") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentTraitUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("getEnvironmentTraitUsageTimeSeries (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/trait-usage-timeseries") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentTraitUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("getEnvironmentTraitUsageTimeSeries (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/trait-usage-timeseries") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentTraitUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("getEnvironmentTraitUsageTimeSeries (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/insights/trait-usage-timeseries") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.insights.getEnvironmentTraitUsageTimeSeries({ + endTime: new Date("2024-01-15T09:30:00.000Z"), + featureId: "feature_id", + startTime: new Date("2024-01-15T09:30:00.000Z"), + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); +}); diff --git a/tests/wire/integrationsapi.test.ts b/tests/wire/integrationsapi.test.ts index 1fc4eb4b..bdb9fa7a 100644 --- a/tests/wire/integrationsapi.test.ts +++ b/tests/wire/integrationsapi.test.ts @@ -5,6 +5,253 @@ import { SchematicClient } from "../../src/Client"; import { mockServerPool } from "../mock-server/MockServerPool"; describe("IntegrationsapiClient", () => { + test("runIntegration (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { + created_at: "2024-01-15T09:30:00Z", + id: "id", + state: "active", + type: "clerk", + updated_at: "2024-01-15T09:30:00Z", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .get("/integration/start/integration_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.runIntegration("integration_id"); + expect(response).toEqual({ + data: { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + state: "active", + type: "clerk", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + params: { + key: "value", + }, + }); + }); + + test("runIntegration (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integration/start/integration_id") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.runIntegration("integration_id"); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("runIntegration (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integration/start/integration_id") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.runIntegration("integration_id"); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("runIntegration (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integration/start/integration_id") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.runIntegration("integration_id"); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("runIntegration (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .get("/integration/start/integration_id") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.runIntegration("integration_id"); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("listIntegrations (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: [ + { + capabilities: { author_plans: true, checkout: true, edit_billing: true }, + config: { type: "clerk" }, + id: "id", + is_app_install: true, + is_connect_install: true, + state: "active", + type: "clerk", + }, + ], + params: { + billing_only: true, + exclude_ids: ["exclude_ids"], + id: "id", + limit: 1000000, + offset: 1000000, + state: "active", + type: "clerk", + }, + }; + + server.mockEndpoint().get("/integrations").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); + + const response = await client.integrationsapi.listIntegrations({ + billingOnly: true, + excludeIds: ["exclude_ids"], + id: "id", + state: "active", + type: "clerk", + limit: 1000000, + offset: 1000000, + }); + expect(response).toEqual({ + data: [ + { + capabilities: { + authorPlans: true, + checkout: true, + editBilling: true, + }, + config: { + type: "clerk", + }, + id: "id", + isAppInstall: true, + isConnectInstall: true, + state: "active", + type: "clerk", + }, + ], + params: { + billingOnly: true, + excludeIds: ["exclude_ids"], + id: "id", + limit: 1000000, + offset: 1000000, + state: "active", + type: "clerk", + }, + }); + }); + + test("listIntegrations (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").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.integrationsapi.listIntegrations(); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("listIntegrations (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").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.integrationsapi.listIntegrations(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("listIntegrations (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").respondWith().statusCode(403).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.integrationsapi.listIntegrations(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("listIntegrations (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").respondWith().statusCode(404).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.integrationsapi.listIntegrations(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("listIntegrations (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server.mockEndpoint().get("/integrations").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.integrationsapi.listIntegrations(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("getIntegrationWebhookUrl (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); @@ -106,4 +353,376 @@ describe("IntegrationsapiClient", () => { return await client.integrationsapi.getIntegrationWebhookUrl("type"); }).rejects.toThrow(Schematic.InternalServerError); }); + + test("startDataImport (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { integration_id: "integration_id" }; + const rawResponseBody = { + data: { + created_at: "2024-01-15T09:30:00Z", + id: "id", + state: "active", + type: "clerk", + updated_at: "2024-01-15T09:30:00Z", + }, + params: { key: "value" }, + }; + + server + .mockEndpoint() + .post("/integrations/start-data-import") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.startDataImport({ + integrationId: "integration_id", + }); + expect(response).toEqual({ + data: { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + id: "id", + state: "active", + type: "clerk", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + params: { + key: "value", + }, + }); + }); + + test("startDataImport (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { integration_id: "integration_id" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/start-data-import") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.startDataImport({ + integrationId: "integration_id", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("startDataImport (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { integration_id: "integration_id" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/start-data-import") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.startDataImport({ + integrationId: "integration_id", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("startDataImport (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { integration_id: "integration_id" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/start-data-import") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.startDataImport({ + integrationId: "integration_id", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("startDataImport (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { integration_id: "integration_id" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/start-data-import") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.startDataImport({ + integrationId: "integration_id", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("startDataImport (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { integration_id: "integration_id" }; + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .post("/integrations/start-data-import") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.startDataImport({ + integrationId: "integration_id", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("loadSampleDataSetV2 (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { data: { keys: ["keys"] }, params: { key: "value" } }; + + server + .mockEndpoint() + .get("/integrations/stripe/dataset-sample-v2") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.loadSampleDataSetV2(); + expect(response).toEqual({ + data: { + keys: ["keys"], + }, + params: { + key: "value", + }, + }); + }); + + test("loadSampleDataSetV2 (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/dataset-sample-v2") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.loadSampleDataSetV2(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("loadSampleDataSetV2 (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/dataset-sample-v2") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.loadSampleDataSetV2(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("loadSampleDataSetV2 (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/dataset-sample-v2") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.loadSampleDataSetV2(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("loadSampleDataSetV2 (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/dataset-sample-v2") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.loadSampleDataSetV2(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("uninstallIntegration (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("/integrations/uninstall/integration_id") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.integrationsapi.uninstallIntegration("integration_id"); + expect(response).toEqual({ + data: { + deleted: true, + }, + params: { + key: "value", + }, + }); + }); + + test("uninstallIntegration (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/integrations/uninstall/integration_id") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.uninstallIntegration("integration_id"); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("uninstallIntegration (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/integrations/uninstall/integration_id") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.uninstallIntegration("integration_id"); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("uninstallIntegration (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/integrations/uninstall/integration_id") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.uninstallIntegration("integration_id"); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("uninstallIntegration (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/integrations/uninstall/integration_id") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.uninstallIntegration("integration_id"); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("uninstallIntegration (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + + server + .mockEndpoint() + .delete("/integrations/uninstall/integration_id") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.integrationsapi.uninstallIntegration("integration_id"); + }).rejects.toThrow(Schematic.InternalServerError); + }); }); diff --git a/yarn.lock b/yarn.lock index 15841a9a..ebebe7aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,9 +12,9 @@ picocolors "^1.1.1" "@babel/compat-data@^7.28.6": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.0.tgz#00d03e8c0ac24dd9be942c5370990cbe1f17d88d" - integrity sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg== + version "7.29.3" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.29.3.tgz#e3f5347f0589596c91d227ccb6a541d37fb1307b" + integrity sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": version "7.29.0" @@ -110,9 +110,9 @@ "@babel/types" "^7.29.0" "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.28.6", "@babel/parser@^7.29.0": - version "7.29.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.2.tgz#58bd50b9a7951d134988a1ae177a35ef9a703ba1" - integrity sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA== + version "7.29.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.29.3.tgz#116f70a77958307fceac27747573032f8a62f88e" + integrity sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA== dependencies: "@babel/types" "^7.29.0" @@ -338,30 +338,30 @@ dependencies: statuses "^2.0.1" -"@cloudflare/workerd-darwin-64@1.20260421.1": - version "1.20260421.1" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260421.1.tgz#35227b588ca6416cffcbf7cf562b700f38253cc4" - integrity sha512-DLU5ZTZ1VHeZZnj0PuVJEMHKGisfLe2XShyImP5P/PPj/m/t7CLEJmPiI7FMxvT7ynArkckJl7m+Z5x7u4Kkdw== +"@cloudflare/workerd-darwin-64@1.20260430.1": + version "1.20260430.1" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260430.1.tgz#1dbf994e7a02d5014254e237fb28157309401a5e" + integrity sha512-ADohZUHf7NBvPp2PdZig2Opxx+hDkk3ve7jrTne3JRx9kDSB73zc4LzcEeEN8LKkbAcqZmvfRJfpChSlusu0lA== -"@cloudflare/workerd-darwin-arm64@1.20260421.1": - version "1.20260421.1" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20260421.1.tgz#8c011faff6bf4ee112b6b69a4b81473c8d10f309" - integrity sha512-Trotq3xRAkIcpC505WoxM8+kIH4JIvOJCNuRatyHcz9uF5S+ukgiVUFUlM+GIjw1uCM/Bda2St+vSniX1RZdpw== +"@cloudflare/workerd-darwin-arm64@1.20260430.1": + version "1.20260430.1" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20260430.1.tgz#6e9953dfa763eb946f65fdfb77597668a6f21077" + integrity sha512-/DoYC/1wHs+YRZzzqSQg1/EHB4hiv1yV5U8FnmapRRIzVaPtnt+ApeOXeMrIdKidgKOI8TqQzgBU8xbIM7Cl4Q== -"@cloudflare/workerd-linux-64@1.20260421.1": - version "1.20260421.1" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20260421.1.tgz#b6d4fa15df4dfaeb36aa945eab6bec7f258d396c" - integrity sha512-938QjUv0z+QqK6BAvgwX/lCIZ2b224ZXoXtGTbhyNVMhB+mt4Dj24cj9qca4ekNXjVM7uTKp1yOHZO97fVSacw== +"@cloudflare/workerd-linux-64@1.20260430.1": + version "1.20260430.1" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20260430.1.tgz#638efe9cc38c6ba31d1de5d09cbb3e7e9d30bb6f" + integrity sha512-koJhBWvEVZPKCVFtMLp2iMHlYr+lFCF47wGbnlKdHVlemV0zTxJEyHI8aLlrhPLhBmOmYLp46rXw09/qJkRIhQ== -"@cloudflare/workerd-linux-arm64@1.20260421.1": - version "1.20260421.1" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20260421.1.tgz#f7368ffe9d6100a51aa93bd13ebd5a3e189c4469" - integrity sha512-YI4+mLfwnJcKJ+iPyxzx+tp2Jy4o29BxBPSQGZxl/AZyvZ9eTKsmNZmtjEiT4i3O/M0tdO/B/d9ESDHbRCs2rQ== +"@cloudflare/workerd-linux-arm64@1.20260430.1": + version "1.20260430.1" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20260430.1.tgz#05940bc745d4c70eccb8341ef9bd30e72faa1d93" + integrity sha512-hMdapNAzNQZDXGGkg4Slydc3fRJP5FUZLJVVcZCW/+imhhJro9Z1rv5n/wfR+txKoSWhTYR8eOp8Pyi2bzLzlw== -"@cloudflare/workerd-windows-64@1.20260421.1": - version "1.20260421.1" - resolved "https://registry.yarnpkg.com/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20260421.1.tgz#0f2780fec52af191df47f7eec244cf7e5b0f50eb" - integrity sha512-q1SFgwlNH9lFmw74vh7EJbJtduo92Nx51mNOfd3/u6pux6AldcwRviYzKEEv3FEbtv6OBB7J8D5f8vtZj7Z6Sg== +"@cloudflare/workerd-windows-64@1.20260430.1": + version "1.20260430.1" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20260430.1.tgz#5240fb60d9f2879d70e1a106fbcea2a3f9295efe" + integrity sha512-jS3ffixjb5USOwz4frw4WzCz0HrjVxkgyU3WiYb06N7hBAfN6eOrveAJ4QRef0+suK4V1vQFoB1oKdRBsXe9Dw== "@cspotcode/source-map-support@0.8.1": version "0.8.1" @@ -1030,9 +1030,9 @@ integrity sha512-BMq1K3DsElxDWawkX6eLg9+CKJrTVGCBAWVuHXVUV2u0s2711qiChLSId6ikYPfxhdYocLNt3wWwSvDiTvFabw== "@tootallnate/once@2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" - integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + version "2.0.1" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.1.tgz#35adc6222e3662fa2222ce123b961476a746b9ea" + integrity sha512-HqmEUIGRJ5fSXchkVgR5F7qn48bDBzv0kWj/Kfu5e6uci4UlEeng4331LnBkWffb++Ei3FOVLxo8JJWMFBDMeQ== "@types/babel__core@^7.1.14": version "7.20.5" @@ -1394,9 +1394,9 @@ ajv-keywords@^5.1.0: fast-deep-equal "^3.1.3" ajv@^8.0.0, ajv@^8.9.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.18.0.tgz#8864186b6738d003eb3a933172bb3833e10cefbc" - integrity sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A== + version "8.20.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.20.0.tgz#304b3636add88ba7d936760dd50ece006dea95f9" + integrity sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA== dependencies: fast-deep-equal "^3.1.3" fast-uri "^3.0.1" @@ -1521,9 +1521,9 @@ base64-js@^1.3.1: integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== baseline-browser-mapping@^2.10.12: - version "2.10.21" - resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.21.tgz#136f9f181ee0d7ca6e3edbf42d9559763d2c1141" - integrity sha512-Q+rUQ7Uz8AHM7DEaNdwvfFCTq7a43lNTzuS94eiWqwyxfV/wJv+oUivef51T91mmRY4d4A1u9rcSvkeufCVXlA== + version "2.10.27" + resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.27.tgz#fee941c2a0b42cdf83c6427e4c830b1d0bdab2c3" + integrity sha512-zEs/ufmZoUd7WftKpKyXaT6RFxpQ5Qm9xytKRHvJfxFV9DFJkZph9RvJ1LcOUi0Z1ZVijMte65JbILeV+8QQEA== brace-expansion@^1.1.7: version "1.1.14" @@ -1602,9 +1602,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001782: - version "1.0.30001790" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001790.tgz#04660c7de15f445d86dd10ac88a8936ac0698e45" - integrity sha512-bOoxfJPyYo+ds6W0YfptaCWbFnJYjh2Y1Eow5lRv+vI2u8ganPZqNm1JwNh0t2ELQCqIWg4B3dWEusgAmsoyOw== + version "1.0.30001791" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001791.tgz#dfb93d85c40ad380c57123e72e10f3c575786b51" + integrity sha512-yk0l/YSrOnFZk3UROpDLQD9+kC1l4meK/wed583AXrzoarMGJcbRi2Q4RaUYbKxYAsZ8sWmaSa/DsLmdBeI1vQ== chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" @@ -1809,9 +1809,9 @@ dunder-proto@^1.0.1: gopd "^1.2.0" electron-to-chromium@^1.5.328: - version "1.5.344" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.344.tgz#6437cc08a7d9b914a98120e182f37793c9eaffd4" - integrity sha512-4MxfbmNDm+KPh066EZy+eUnkcDPcZ35wNmOWzFuh/ijvHsve6kbLTLURy88uCNK5FbpN+yk2nQY6BYh1GEt+wg== + version "1.5.349" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.349.tgz#9b9c6a6d84d1107557c18a9336099ce0ee890e5b" + integrity sha512-QsWVGyRuY07Aqb234QytTfwd5d9AJlfNIQ5wIOl1L+PZDzI9d9+Fn0FRale/QYlFxt/bUnB0/nLd1jFPGxGK1A== emittery@^0.13.1: version "0.13.1" @@ -1859,9 +1859,9 @@ es-errors@^1.3.0: integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== es-module-lexer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-2.0.0.tgz#f657cd7a9448dcdda9c070a3cb75e5dc1e85f5b1" - integrity sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw== + version "2.1.0" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-2.1.0.tgz#1dfcbb5ea3bbfb63f28e1fc3676c3676d1c9624c" + integrity sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ== es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: version "1.1.1" @@ -2020,9 +2020,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.0" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.0.tgz#66eecff6c764c0df9b762e62ca7edcfb53b4edfa" - integrity sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA== + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.1.tgz#dd085fec2494a2a33bac6e61277374669e1dd774" + integrity sha512-h2r7rcm6Ee/J8o0LD5djLuFVcfbZxhvho4vvsbeV0aMvXjUgqv4YpxpkEx0d68l6+IleVfLAdVEfhR7QNMkGHQ== fb-watchman@^2.0.0: version "2.0.2" @@ -2833,9 +2833,9 @@ lines-and-columns@^1.1.6: integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== loader-runner@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.1.tgz#6c76ed29b0ccce9af379208299f07f876de737e3" - integrity sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q== + version "4.3.2" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.2.tgz#9913d3a15971f8f635915e601fb5c9d495d918e9" + integrity sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w== locate-path@^5.0.0: version "5.0.0" @@ -2915,15 +2915,15 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -miniflare@^4.20260305.0: - version "4.20260421.0" - resolved "https://registry.yarnpkg.com/miniflare/-/miniflare-4.20260421.0.tgz#adadc9c24f19423bda916c17e477c274830023cb" - integrity sha512-7ZkNQ7brgQ2hh5ha9iQCDUjxBkLvuiG2VdDns9esRL8O8lXg+MoP6E0dO1rtp+ZY2I+vV1tPWr6td5IojkewLw== +miniflare@^4.20260421.0: + version "4.20260430.0" + resolved "https://registry.yarnpkg.com/miniflare/-/miniflare-4.20260430.0.tgz#a0fa385c7ef397eead1219635b2ca09eb82195a7" + integrity sha512-MWvMm3Siho9Yj7lbJZidLs8hbrRvIcOrif2mnsHQZdvoKfedpea+GaN8XJxbpRcq0B2WzNI1BB1ihdnqes3/ZA== dependencies: "@cspotcode/source-map-support" "0.8.1" sharp "^0.34.5" undici "7.24.8" - workerd "1.20260421.1" + workerd "1.20260430.1" ws "8.18.0" youch "4.1.0-beta.10" @@ -3494,17 +3494,17 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -tldts-core@^7.0.28: - version "7.0.28" - resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-7.0.28.tgz#28c256edae2ed177b2a8338a51caf81d41580ecf" - integrity sha512-7W5Efjhsc3chVdFhqtaU0KtK32J37Zcr9RKtID54nG+tIpcY79CQK/veYPODxtD/LJ4Lue66jvrQzIX2Z2/pUQ== +tldts-core@^7.0.30: + version "7.0.30" + resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-7.0.30.tgz#c495dba27778f2220bea94f3f6399005c7aca61c" + integrity sha512-uiHN8PIB1VmWyS98eZYja4xzlYqeFZVjb4OuYlJQnZAuJhMw4PbKQOKgHKhBdJR3FE/t5mUQ1Kd80++B+qhD1Q== tldts@^7.0.5: - version "7.0.28" - resolved "https://registry.yarnpkg.com/tldts/-/tldts-7.0.28.tgz#5a5bb26ef3f70008d88c6e53ff58cd59ed8d4c68" - integrity sha512-+Zg3vWhRUv8B1maGSTFdev9mjoo8Etn2Ayfs4cnjlD3CsGkxXX4QyW3j2WJ0wdjYcYmy7Lx2RDsZMhgCWafKIw== + version "7.0.30" + resolved "https://registry.yarnpkg.com/tldts/-/tldts-7.0.30.tgz#497cea8d610953222f9dcb3ceb07c7207efcd816" + integrity sha512-ELrFxuqsDdHUwoh0XxDbxuLD3Wnz49Z57IFvTtvWy1hJdcMZjXLIuonjilCiWHlT2GbE4Wlv1wKVTzDFnXH1aw== dependencies: - tldts-core "^7.0.28" + tldts-core "^7.0.30" tmpl@1.0.5: version "1.0.5" @@ -3681,9 +3681,9 @@ webidl-conversions@^7.0.0: integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== webpack-sources@^3.3.4: - version "3.4.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.4.0.tgz#67cdfdff349ff1e3e7ca5c1ed6a2802b84cf6cf5" - integrity sha512-gHwIe1cgBvvfLeu1Yz/dcFpmHfKDVxxyqI+kzqmuxZED81z2ChxpyqPaWcNqigPywhaEke7AjSGga+kxY55gjQ== + version "3.4.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.4.1.tgz#009d110999ebd9fb3a6fa8d32eec6f84d940e65d" + integrity sha512-eACpxRN02yaawnt+uUNIF7Qje6A9zArxBbcAJjK1PK3S9Ycg5jIuJ8pW4q8EMnwNZCEGltcjkRx1QzOxOkKD8A== webpack@^5.105.4: version "5.106.2" @@ -3755,16 +3755,16 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== -workerd@1.20260421.1: - version "1.20260421.1" - resolved "https://registry.yarnpkg.com/workerd/-/workerd-1.20260421.1.tgz#922f46fcf3fc1598531df26060a66cac0cb107d8" - integrity sha512-zTYD+xFR4d7TUCxsyl7FTPth9a8CDgk8pM7xUWbJxo0SGUx+2e5C7Q5LrramBZwmuAErtzXmOjlQ15PtkPAhZA== +workerd@1.20260430.1: + version "1.20260430.1" + resolved "https://registry.yarnpkg.com/workerd/-/workerd-1.20260430.1.tgz#b7749f5b4036e3477dcb0c71eea151ed5dfda46b" + integrity sha512-KEgIWyiw3Jmn+DCd/L3ePo5fmiiYb/UcwKvDWPf/nLLOiwShDFzDSsegU5NY/JcwgvO/QsLHVi2FYrbkcXNY5Q== optionalDependencies: - "@cloudflare/workerd-darwin-64" "1.20260421.1" - "@cloudflare/workerd-darwin-arm64" "1.20260421.1" - "@cloudflare/workerd-linux-64" "1.20260421.1" - "@cloudflare/workerd-linux-arm64" "1.20260421.1" - "@cloudflare/workerd-windows-64" "1.20260421.1" + "@cloudflare/workerd-darwin-64" "1.20260430.1" + "@cloudflare/workerd-darwin-arm64" "1.20260430.1" + "@cloudflare/workerd-linux-64" "1.20260430.1" + "@cloudflare/workerd-linux-arm64" "1.20260430.1" + "@cloudflare/workerd-windows-64" "1.20260430.1" wrap-ansi@^6.2.0: version "6.2.0" From 01c9a5a73c5c07688fb71f933f2a779a71795a0e Mon Sep 17 00:00:00 2001 From: Christopher Brady Date: Mon, 4 May 2026 10:06:09 -0600 Subject: [PATCH 2/2] use node 22 in ci --- .github/workflows/ci.yml | 8 ++++++++ .github/workflows/cloudflare.yml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fba36730..4a1e8091 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,8 @@ jobs: - name: Set up node uses: actions/setup-node@v6 + with: + node-version: '22' - name: Download WASM binary run: ./scripts/download-wasm.sh @@ -44,6 +46,8 @@ jobs: - name: Set up node uses: actions/setup-node@v6 + with: + node-version: '22' - name: Download WASM binary run: ./scripts/download-wasm.sh @@ -63,6 +67,8 @@ jobs: - name: Set up node uses: actions/setup-node@v6 + with: + node-version: '22' - name: Download WASM binary run: ./scripts/download-wasm.sh @@ -100,6 +106,8 @@ jobs: - name: Set up node uses: actions/setup-node@v6 + with: + node-version: '22' - name: Download WASM binary run: ./scripts/download-wasm.sh diff --git a/.github/workflows/cloudflare.yml b/.github/workflows/cloudflare.yml index f0c0579f..d9e78648 100644 --- a/.github/workflows/cloudflare.yml +++ b/.github/workflows/cloudflare.yml @@ -11,6 +11,8 @@ jobs: - name: Set up node uses: actions/setup-node@v6 + with: + node-version: '22' - name: Download WASM binary run: ./scripts/download-wasm.sh