@schematichq/schematic-typescript-node 1.4.7 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -6
- package/dist/api/resources/accounts/client/Client.d.ts +20 -0
- package/dist/api/resources/accounts/client/requests/CountAccountMembersRequest.d.ts +18 -0
- package/dist/api/resources/accounts/client/requests/index.d.ts +1 -0
- package/dist/api/resources/accounts/types/CountAccountMembersParams.d.ts +12 -0
- package/dist/api/resources/accounts/types/CountAccountMembersResponse.d.ts +6 -0
- package/dist/api/resources/accounts/types/index.d.ts +2 -0
- package/dist/api/resources/billing/client/Client.d.ts +6 -6
- package/dist/api/resources/billing/client/requests/CountBillingProductsRequest.d.ts +1 -1
- package/dist/api/resources/billing/client/requests/CountCustomersRequest.d.ts +1 -1
- package/dist/api/resources/billing/client/requests/ListBillingPricesRequest.d.ts +1 -1
- package/dist/api/resources/billing/client/requests/ListBillingProductPricesRequest.d.ts +1 -1
- package/dist/api/resources/billing/client/requests/ListBillingProductsRequest.d.ts +1 -1
- package/dist/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.d.ts +1 -1
- package/dist/api/resources/checkout/client/Client.d.ts +16 -0
- package/dist/api/resources/entitlements/client/Client.d.ts +3 -3
- package/dist/api/resources/entitlements/client/requests/CountFeatureUsageRequest.d.ts +1 -1
- package/dist/api/resources/entitlements/client/requests/CreateBillingLinkedPlanEntitlementRequestBody.d.ts +1 -1
- package/dist/api/resources/entitlements/client/requests/ListFeatureUsageRequest.d.ts +1 -1
- package/dist/api/resources/features/client/Client.d.ts +3 -3
- package/dist/api/resources/features/client/requests/CountFeaturesRequest.d.ts +1 -1
- package/dist/api/resources/features/client/requests/CreateBillingLinkedFeatureRequestBody.d.ts +1 -1
- package/dist/api/resources/features/client/requests/ListFeaturesRequest.d.ts +1 -1
- package/dist/api/resources/integrationsapi/client/Client.d.ts +54 -3
- package/dist/api/resources/integrationsapi/types/AssumeStripeInstalledResponse.d.ts +6 -0
- package/dist/api/resources/integrationsapi/types/InstallIntegrationResponse.d.ts +6 -0
- package/dist/api/resources/integrationsapi/types/InstallStripeResponse.d.ts +6 -0
- package/dist/api/resources/integrationsapi/types/{LoadSampleDataSetV2Response.d.ts → LoadSampleDataSetResponse.d.ts} +1 -1
- package/dist/api/resources/integrationsapi/types/index.d.ts +4 -1
- package/dist/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +1 -0
- package/dist/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +1 -0
- package/dist/api/resources/plans/client/Client.d.ts +1 -1
- package/dist/api/resources/plans/client/requests/CreateBillingLinkedPlanRequestBody.d.ts +1 -1
- package/dist/api/types/AccountMemberResponseData.d.ts +2 -0
- package/dist/api/types/BillingCreditGrantReason.d.ts +1 -0
- package/dist/api/types/BillingCreditGrantResponseData.d.ts +4 -0
- package/dist/api/types/BillingCreditLedgerAuthority.d.ts +6 -0
- package/dist/api/types/BillingCreditView.d.ts +1 -0
- package/dist/api/types/BillingPlanCreditGrantResponseData.d.ts +2 -0
- package/dist/api/types/BillingProviderType.d.ts +1 -0
- package/dist/api/types/ChangeSubscriptionInternalRequestBody.d.ts +1 -0
- package/dist/api/types/ChangeSubscriptionRequestBody.d.ts +1 -0
- package/dist/api/types/CheckoutDataResponseData.d.ts +1 -0
- package/dist/api/types/CheckoutFieldInput.d.ts +8 -0
- package/dist/api/types/CheckoutFieldResponseData.d.ts +12 -0
- package/dist/api/types/CheckoutFieldValue.d.ts +4 -0
- package/dist/api/types/CheckoutFieldWithValue.d.ts +9 -0
- package/dist/api/types/CompanyCreditBalanceResponseData.d.ts +2 -0
- package/dist/api/types/CompanyPlanCreditGrantView.d.ts +1 -0
- package/dist/api/types/ComponentHydrateResponseData.d.ts +1 -0
- package/dist/api/types/ComponentPreviewResponseData.d.ts +1 -0
- package/dist/api/types/CreateBillingPlanCreditGrantRequestBody.d.ts +2 -0
- package/dist/api/types/CreditCompanyGrantView.d.ts +3 -0
- package/dist/api/types/CreditEventLedgerResponseData.d.ts +1 -0
- package/dist/api/types/CreditUsageReason.d.ts +8 -0
- package/dist/api/types/EventDetailResponseData.d.ts +1 -0
- package/dist/api/types/EventResponseData.d.ts +1 -0
- package/dist/api/types/InstallIntegrationRequestBody.d.ts +9 -0
- package/dist/api/types/IntegrationConfig.d.ts +4 -1
- package/dist/api/types/IntegrationInstallConfig.d.ts +13 -0
- package/dist/api/types/IntegrationInstallResponseData.d.ts +6 -0
- package/dist/api/types/IntegrationType.d.ts +1 -0
- package/dist/api/types/ManagePlanRequest.d.ts +1 -0
- package/dist/api/types/MetronomeIntegrationConfig.d.ts +1 -0
- package/dist/api/types/MigrationErrorCode.d.ts +1 -0
- package/dist/api/types/PlanCreditGrantView.d.ts +1 -0
- package/dist/api/types/PlanGroupDetailResponseData.d.ts +1 -0
- package/dist/api/types/UpdateBillingPlanCreditGrantRequestBody.d.ts +2 -0
- package/dist/api/types/index.d.ts +10 -0
- package/dist/cache/redis.d.ts +29 -2
- package/dist/credits/check.d.ts +49 -0
- package/dist/credits/index.d.ts +7 -0
- package/dist/credits/lease-manager.d.ts +68 -0
- package/dist/credits/lease-store.d.ts +133 -0
- package/dist/credits/redis-lease-store.d.ts +30 -0
- package/dist/credits/redis-reservation-store.d.ts +46 -0
- package/dist/credits/reservation-store.d.ts +64 -0
- package/dist/credits/track.d.ts +44 -0
- package/dist/credits/types.d.ts +175 -0
- package/dist/datastream/datastream-client.d.ts +19 -3
- package/dist/datastream/merge.d.ts +5 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +85 -3
- package/dist/rules-engine.d.ts +3 -1
- package/dist/serialization/resources/accounts/types/CountAccountMembersParams.d.ts +12 -0
- package/dist/serialization/resources/accounts/types/CountAccountMembersResponse.d.ts +12 -0
- package/dist/serialization/resources/accounts/types/index.d.ts +2 -0
- package/dist/serialization/resources/integrationsapi/types/AssumeStripeInstalledResponse.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/types/InstallIntegrationResponse.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/types/InstallStripeResponse.d.ts +11 -0
- package/dist/serialization/resources/integrationsapi/types/{LoadSampleDataSetV2Response.d.ts → LoadSampleDataSetResponse.d.ts} +2 -2
- package/dist/serialization/resources/integrationsapi/types/index.d.ts +4 -1
- package/dist/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.d.ts +2 -0
- package/dist/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.d.ts +2 -0
- package/dist/serialization/types/AccountMemberResponseData.d.ts +2 -0
- package/dist/serialization/types/BillingCreditGrantReason.d.ts +1 -1
- package/dist/serialization/types/BillingCreditGrantResponseData.d.ts +3 -0
- package/dist/serialization/types/BillingCreditLedgerAuthority.d.ts +7 -0
- package/dist/serialization/types/BillingCreditView.d.ts +2 -0
- package/dist/serialization/types/BillingPlanCreditGrantResponseData.d.ts +1 -0
- package/dist/serialization/types/BillingProviderType.d.ts +1 -1
- package/dist/serialization/types/ChangeSubscriptionInternalRequestBody.d.ts +2 -0
- package/dist/serialization/types/ChangeSubscriptionRequestBody.d.ts +2 -0
- package/dist/serialization/types/CheckoutDataResponseData.d.ts +2 -0
- package/dist/serialization/types/CheckoutFieldInput.d.ts +14 -0
- package/dist/serialization/types/CheckoutFieldResponseData.d.ts +18 -0
- package/dist/serialization/types/CheckoutFieldValue.d.ts +10 -0
- package/dist/serialization/types/CheckoutFieldWithValue.d.ts +15 -0
- package/dist/serialization/types/CompanyCreditBalanceResponseData.d.ts +2 -0
- package/dist/serialization/types/CompanyPlanCreditGrantView.d.ts +1 -0
- package/dist/serialization/types/ComponentHydrateResponseData.d.ts +2 -0
- package/dist/serialization/types/ComponentPreviewResponseData.d.ts +2 -0
- package/dist/serialization/types/CreateBillingPlanCreditGrantRequestBody.d.ts +1 -0
- package/dist/serialization/types/CreditCompanyGrantView.d.ts +3 -0
- package/dist/serialization/types/CreditEventLedgerResponseData.d.ts +2 -0
- package/dist/serialization/types/CreditUsageReason.d.ts +7 -0
- package/dist/serialization/types/EventDetailResponseData.d.ts +1 -0
- package/dist/serialization/types/EventResponseData.d.ts +1 -0
- package/dist/serialization/types/InstallIntegrationRequestBody.d.ts +16 -0
- package/dist/serialization/types/IntegrationConfig.d.ts +5 -1
- package/dist/serialization/types/IntegrationInstallConfig.d.ts +20 -0
- package/dist/serialization/types/IntegrationInstallResponseData.d.ts +14 -0
- package/dist/serialization/types/IntegrationType.d.ts +1 -1
- package/dist/serialization/types/ManagePlanRequest.d.ts +2 -0
- package/dist/serialization/types/MetronomeIntegrationConfig.d.ts +7 -0
- package/dist/serialization/types/MigrationErrorCode.d.ts +1 -1
- package/dist/serialization/types/PlanCreditGrantView.d.ts +1 -0
- package/dist/serialization/types/PlanGroupDetailResponseData.d.ts +2 -0
- package/dist/serialization/types/UpdateBillingPlanCreditGrantRequestBody.d.ts +1 -0
- package/dist/serialization/types/index.d.ts +10 -0
- package/dist/wasm/rulesengine.js +5 -5
- package/dist/wrapper.d.ts +158 -6
- package/package.json +5 -4
- package/dist/wasm/rulesengine_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -96,17 +96,17 @@ class CustomLogger implements Logger {
|
|
|
96
96
|
// Your custom error logging logic
|
|
97
97
|
console.error(`[ERROR] ${message}`, ...args);
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
warn(message: string, ...args: any[]): void {
|
|
101
101
|
// Your custom warning logging logic
|
|
102
102
|
console.warn(`[WARN] ${message}`, ...args);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
info(message: string, ...args: any[]): void {
|
|
106
106
|
// Your custom info logging logic
|
|
107
107
|
console.info(`[INFO] ${message}`, ...args);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
debug(message: string, ...args: any[]): void {
|
|
111
111
|
// Your custom debug logging logic
|
|
112
112
|
console.debug(`[DEBUG] ${message}`, ...args);
|
|
@@ -683,7 +683,7 @@ export default {
|
|
|
683
683
|
ttl: 1000 * 60 * 60, // 1 hour cache TTL
|
|
684
684
|
keyPrefix: 'schematic:', // Optional prefix for KV keys
|
|
685
685
|
});
|
|
686
|
-
|
|
686
|
+
|
|
687
687
|
// Initialize Schematic with the KV cache
|
|
688
688
|
const schematic = new SchematicClient({
|
|
689
689
|
apiKey: env.SCHEMATIC_API_KEY,
|
|
@@ -691,10 +691,10 @@ export default {
|
|
|
691
691
|
flagChecks: [cache],
|
|
692
692
|
}
|
|
693
693
|
});
|
|
694
|
-
|
|
694
|
+
|
|
695
695
|
// Your application logic...
|
|
696
696
|
// ...
|
|
697
|
-
|
|
697
|
+
|
|
698
698
|
// Don't forget to close the client when done
|
|
699
699
|
schematic.close();
|
|
700
700
|
}
|
|
@@ -798,6 +798,111 @@ const client = new SchematicClient({
|
|
|
798
798
|
| `replicatorHealthCheck` | `number` | 30000 | Health check polling interval in milliseconds |
|
|
799
799
|
| `cacheTTL` | `number` | 24 hours | Cache TTL in milliseconds |
|
|
800
800
|
|
|
801
|
+
## Credit Leases and Reservations
|
|
802
|
+
|
|
803
|
+
For features metered by credit burndown (e.g. inference tokens), the SDK can enforce credit balances locally — without a Schematic API call on every check — using a lease-and-reservation system:
|
|
804
|
+
|
|
805
|
+
- A **lease** is a tranche of credits acquired transactionally from Schematic's API. It functions as a hold against the company's credit balance until it is consumed, released, or expires.
|
|
806
|
+
- A **reservation** is a client-side hold carved out of the lease at check time, sized to the upper bound of the operation's usage. This protects against races and over-spend between the check and the eventual usage report.
|
|
807
|
+
- When the work completes, a track call reports actual usage; the difference between reserved and actual usage is refunded to the lease.
|
|
808
|
+
|
|
809
|
+
> **Requirements:** Credit leases require [DataStream](#datastream) (or [Replicator Mode](#replicator-mode)) — lease-bearing checks are evaluated locally against cached flag and company state. In a horizontally-scaled deployment, a shared Redis backend is also required so that all SDK instances gate against the same lease balance; without one, lease state is per-process.
|
|
810
|
+
|
|
811
|
+
### Setup
|
|
812
|
+
|
|
813
|
+
```ts
|
|
814
|
+
import { createClient } from "redis";
|
|
815
|
+
import { SchematicClient } from "@schematichq/schematic-typescript-node";
|
|
816
|
+
|
|
817
|
+
const redisClient = createClient({ url: "redis://localhost:6379" });
|
|
818
|
+
await redisClient.connect();
|
|
819
|
+
|
|
820
|
+
const client = new SchematicClient({
|
|
821
|
+
apiKey: process.env.SCHEMATIC_API_KEY,
|
|
822
|
+
useDataStream: true,
|
|
823
|
+
dataStream: {
|
|
824
|
+
redisClient, // also backs lease + reservation state automatically
|
|
825
|
+
},
|
|
826
|
+
creditLeases: {
|
|
827
|
+
defaultLeaseDuration: 5 * 60 * 1000, // lease lifetime (ms)
|
|
828
|
+
defaultReservationTTL: 60 * 1000, // how long a reservation is held if not settled by a track (ms)
|
|
829
|
+
defaultLeaseSize: 10_000, // credits requested per lease
|
|
830
|
+
lowWaterMark: 0.25, // extend the lease in the background when its balance dips below this fraction
|
|
831
|
+
},
|
|
832
|
+
});
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
When `dataStream.redisClient` is configured, lease and reservation state automatically lives in the same Redis, with atomic reservations driven by Lua scripts — no additional configuration needed. To point lease state at a *different* Redis, set `creditLeases.redisClient` explicitly.
|
|
836
|
+
|
|
837
|
+
### Checking and tracking
|
|
838
|
+
|
|
839
|
+
`check()` reserves the operation's upper-bound usage against the lease and returns a reservation handle; `trackWithReservation()` settles it with actual usage:
|
|
840
|
+
|
|
841
|
+
```ts
|
|
842
|
+
// Per-request: reserve up to maxTokens against the lease.
|
|
843
|
+
const result = await client.check(
|
|
844
|
+
{ company: { id: "your-company-id" } },
|
|
845
|
+
"inference",
|
|
846
|
+
{
|
|
847
|
+
usage: maxTokens, // upper bound for this operation
|
|
848
|
+
eventSubtype: "inference_tokens", // the metered event
|
|
849
|
+
},
|
|
850
|
+
);
|
|
851
|
+
if (!result.allowed) {
|
|
852
|
+
throw new Error("credit balance exceeded");
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
const inference = await runInference(/* ... */);
|
|
856
|
+
|
|
857
|
+
// Report actual usage; the unused slice of the reservation is refunded to the lease.
|
|
858
|
+
await client.trackWithReservation(result.reservation!, inference.tokensUsed);
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
If the caller never settles a reservation, it expires after `defaultReservationTTL` and its credits are returned to the lease. If the work outlives the reservation's TTL, `trackWithReservation` still bills the usage — the track event carries a deterministic idempotency key, so duplicate or recovery emits never double-bill. However, the local lease balance is not re-debited on that late settle (the expired reservation's hold was already swept back to the lease), so it reads high until the lease rolls over. **Set `defaultReservationTTL` above the longest expected gap between `check()` and `trackWithReservation()`** to keep the local balance accurate.
|
|
862
|
+
|
|
863
|
+
### Pre-warming
|
|
864
|
+
|
|
865
|
+
To avoid paying the lease-acquire round trip on a session's first check, pre-warm leases when the user is identified:
|
|
866
|
+
|
|
867
|
+
```ts
|
|
868
|
+
await client.identify(
|
|
869
|
+
{
|
|
870
|
+
keys: { userId: "your-user-id" },
|
|
871
|
+
company: { keys: { id: "your-company-id" } },
|
|
872
|
+
},
|
|
873
|
+
{ prewarm: ["credit-type-id"] }, // credit type IDs to acquire leases for
|
|
874
|
+
);
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
Or call `client.prewarm(evalCtx, creditTypeIds)` directly.
|
|
878
|
+
|
|
879
|
+
### Failure behavior
|
|
880
|
+
|
|
881
|
+
By default, a check that cannot be gated (API unreachable, Redis down, lease exhausted) **fails closed** (`allowed: false`). Override per check for callers where letting traffic through is preferable to a denial:
|
|
882
|
+
|
|
883
|
+
```ts
|
|
884
|
+
const result = await client.check(evalCtx, "inference", {
|
|
885
|
+
usage: maxTokens,
|
|
886
|
+
eventSubtype: "inference_tokens",
|
|
887
|
+
onAcquireFailure: "fail-open",
|
|
888
|
+
});
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
`fail-open` does not skip evaluation: the flag's rules still run with the credit balance assumed sufficient, so plan targeting, overrides, and all non-credit conditions still apply — only the credit gate is bypassed.
|
|
892
|
+
|
|
893
|
+
### Configuration options
|
|
894
|
+
|
|
895
|
+
| Option | Type | Default | Description |
|
|
896
|
+
|---|---|---|---|
|
|
897
|
+
| `defaultLeaseDuration` | `number` | 5 minutes | Lease lifetime in milliseconds |
|
|
898
|
+
| `defaultReservationTTL` | `number` | 60 seconds | How long an unsettled reservation is held (ms); set above your longest expected work duration |
|
|
899
|
+
| `defaultLeaseSize` | `number` | 10000 | Credits requested per lease acquire/extend |
|
|
900
|
+
| `lowWaterMark` | `number` | 0.25 | Extend in the background when the lease balance dips below this fraction |
|
|
901
|
+
| `sweepIntervalMs` | `number` | 1000 | Sweep interval for expired reservations (ms) |
|
|
902
|
+
| `redisClient` | `RedisClient` | `dataStream.redisClient` | Redis client for lease + reservation state |
|
|
903
|
+
| `redisKeyPrefix` | `string` | `dataStream.redisKeyPrefix` | Key prefix for lease + reservation keys |
|
|
904
|
+
| `overrides` | `object` | — | Per-credit-type overrides of the above (keyed by credit type ID) |
|
|
905
|
+
|
|
801
906
|
## Testing
|
|
802
907
|
|
|
803
908
|
### Offline mode
|
|
@@ -44,6 +44,26 @@ export declare class AccountsClient {
|
|
|
44
44
|
*/
|
|
45
45
|
getAccountMember(account_member_id: string, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<Schematic.GetAccountMemberResponse>;
|
|
46
46
|
private __getAccountMember;
|
|
47
|
+
/**
|
|
48
|
+
* @param {Schematic.CountAccountMembersRequest} request
|
|
49
|
+
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
50
|
+
*
|
|
51
|
+
* @throws {@link Schematic.BadRequestError}
|
|
52
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
53
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
54
|
+
* @throws {@link Schematic.NotFoundError}
|
|
55
|
+
* @throws {@link Schematic.InternalServerError}
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* await client.accounts.countAccountMembers({
|
|
59
|
+
* ids: ["ids"],
|
|
60
|
+
* q: "q",
|
|
61
|
+
* limit: 1000000,
|
|
62
|
+
* offset: 1000000
|
|
63
|
+
* })
|
|
64
|
+
*/
|
|
65
|
+
countAccountMembers(request?: Schematic.CountAccountMembersRequest, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<Schematic.CountAccountMembersResponse>;
|
|
66
|
+
private __countAccountMembers;
|
|
47
67
|
/**
|
|
48
68
|
* @param {Schematic.ListApiKeysRequest} request
|
|
49
69
|
* @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* ids: ["ids"],
|
|
5
|
+
* q: "q",
|
|
6
|
+
* limit: 1000000,
|
|
7
|
+
* offset: 1000000
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface CountAccountMembersRequest {
|
|
11
|
+
ids?: string | string[];
|
|
12
|
+
/** Search filter */
|
|
13
|
+
q?: string;
|
|
14
|
+
/** Page limit (default 100) */
|
|
15
|
+
limit?: number;
|
|
16
|
+
/** Page offset (default 0) */
|
|
17
|
+
offset?: number;
|
|
18
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { CountAccountMembersRequest } from "./CountAccountMembersRequest";
|
|
1
2
|
export type { CountApiKeysRequest } from "./CountApiKeysRequest";
|
|
2
3
|
export type { CountAuditLogsRequest } from "./CountAuditLogsRequest";
|
|
3
4
|
export type { CreateApiKeyRequestBody } from "./CreateApiKeyRequestBody";
|
|
@@ -90,7 +90,7 @@ export declare class BillingClient {
|
|
|
90
90
|
* await client.billing.listCustomersWithSubscriptions({
|
|
91
91
|
* companyIds: ["company_ids"],
|
|
92
92
|
* name: "name",
|
|
93
|
-
* providerType: "
|
|
93
|
+
* providerType: "metronome",
|
|
94
94
|
* q: "q",
|
|
95
95
|
* limit: 1000000,
|
|
96
96
|
* offset: 1000000
|
|
@@ -112,7 +112,7 @@ export declare class BillingClient {
|
|
|
112
112
|
* await client.billing.countCustomers({
|
|
113
113
|
* companyIds: ["company_ids"],
|
|
114
114
|
* name: "name",
|
|
115
|
-
* providerType: "
|
|
115
|
+
* providerType: "metronome",
|
|
116
116
|
* q: "q",
|
|
117
117
|
* limit: 1000000,
|
|
118
118
|
* offset: 1000000
|
|
@@ -278,7 +278,7 @@ export declare class BillingClient {
|
|
|
278
278
|
* price: 1000000,
|
|
279
279
|
* productId: "product_id",
|
|
280
280
|
* productIds: ["product_ids"],
|
|
281
|
-
* providerType: "
|
|
281
|
+
* providerType: "metronome",
|
|
282
282
|
* q: "q",
|
|
283
283
|
* tiersMode: "graduated",
|
|
284
284
|
* usageType: "licensed",
|
|
@@ -353,7 +353,7 @@ export declare class BillingClient {
|
|
|
353
353
|
* price: 1000000,
|
|
354
354
|
* productId: "product_id",
|
|
355
355
|
* productIds: ["product_ids"],
|
|
356
|
-
* providerType: "
|
|
356
|
+
* providerType: "metronome",
|
|
357
357
|
* q: "q",
|
|
358
358
|
* tiersMode: "graduated",
|
|
359
359
|
* usageType: "licensed",
|
|
@@ -413,7 +413,7 @@ export declare class BillingClient {
|
|
|
413
413
|
* isActive: true,
|
|
414
414
|
* name: "name",
|
|
415
415
|
* priceUsageType: "licensed",
|
|
416
|
-
* providerType: "
|
|
416
|
+
* providerType: "metronome",
|
|
417
417
|
* q: "q",
|
|
418
418
|
* recurringChargesOnly: true,
|
|
419
419
|
* withOneTimeCharges: true,
|
|
@@ -442,7 +442,7 @@ export declare class BillingClient {
|
|
|
442
442
|
* isActive: true,
|
|
443
443
|
* name: "name",
|
|
444
444
|
* priceUsageType: "licensed",
|
|
445
|
-
* providerType: "
|
|
445
|
+
* providerType: "metronome",
|
|
446
446
|
* q: "q",
|
|
447
447
|
* recurringChargesOnly: true,
|
|
448
448
|
* withOneTimeCharges: true,
|
|
@@ -11,7 +11,7 @@ import type * as Schematic from "../../../../index";
|
|
|
11
11
|
* price: 1000000,
|
|
12
12
|
* productId: "product_id",
|
|
13
13
|
* productIds: ["product_ids"],
|
|
14
|
-
* providerType: "
|
|
14
|
+
* providerType: "metronome",
|
|
15
15
|
* q: "q",
|
|
16
16
|
* tiersMode: "graduated",
|
|
17
17
|
* usageType: "licensed",
|
|
@@ -11,7 +11,7 @@ import type * as Schematic from "../../../../index";
|
|
|
11
11
|
* price: 1000000,
|
|
12
12
|
* productId: "product_id",
|
|
13
13
|
* productIds: ["product_ids"],
|
|
14
|
-
* providerType: "
|
|
14
|
+
* providerType: "metronome",
|
|
15
15
|
* q: "q",
|
|
16
16
|
* tiersMode: "graduated",
|
|
17
17
|
* usageType: "licensed",
|
|
@@ -34,6 +34,10 @@ export declare class CheckoutClient {
|
|
|
34
34
|
* bundleId: "bundle_id",
|
|
35
35
|
* quantity: 1000000
|
|
36
36
|
* }],
|
|
37
|
+
* customFieldValues: [{
|
|
38
|
+
* id: "id",
|
|
39
|
+
* value: "value"
|
|
40
|
+
* }],
|
|
37
41
|
* newPlanId: "new_plan_id",
|
|
38
42
|
* newPriceId: "new_price_id",
|
|
39
43
|
* payInAdvance: [{
|
|
@@ -86,6 +90,10 @@ export declare class CheckoutClient {
|
|
|
86
90
|
* bundleId: "bundle_id",
|
|
87
91
|
* quantity: 1000000
|
|
88
92
|
* }],
|
|
93
|
+
* customFieldValues: [{
|
|
94
|
+
* id: "id",
|
|
95
|
+
* value: "value"
|
|
96
|
+
* }],
|
|
89
97
|
* newPlanId: "new_plan_id",
|
|
90
98
|
* newPriceId: "new_price_id",
|
|
91
99
|
* payInAdvance: [{
|
|
@@ -117,6 +125,10 @@ export declare class CheckoutClient {
|
|
|
117
125
|
* bundleId: "bundle_id",
|
|
118
126
|
* quantity: 1000000
|
|
119
127
|
* }],
|
|
128
|
+
* customFieldValues: [{
|
|
129
|
+
* id: "id",
|
|
130
|
+
* value: "value"
|
|
131
|
+
* }],
|
|
120
132
|
* payInAdvanceEntitlements: [{
|
|
121
133
|
* priceId: "price_id",
|
|
122
134
|
* quantity: 1000000
|
|
@@ -145,6 +157,10 @@ export declare class CheckoutClient {
|
|
|
145
157
|
* bundleId: "bundle_id",
|
|
146
158
|
* quantity: 1000000
|
|
147
159
|
* }],
|
|
160
|
+
* customFieldValues: [{
|
|
161
|
+
* id: "id",
|
|
162
|
+
* value: "value"
|
|
163
|
+
* }],
|
|
148
164
|
* payInAdvanceEntitlements: [{
|
|
149
165
|
* priceId: "price_id",
|
|
150
166
|
* quantity: 1000000
|
|
@@ -181,7 +181,7 @@ export declare class EntitlementsClient {
|
|
|
181
181
|
* companyId: "company_id",
|
|
182
182
|
* featureIds: ["feature_ids"],
|
|
183
183
|
* includeUsageAggregation: true,
|
|
184
|
-
* managedBy: "
|
|
184
|
+
* managedBy: "metronome",
|
|
185
185
|
* q: "q",
|
|
186
186
|
* withoutNegativeEntitlements: true,
|
|
187
187
|
* limit: 1000000,
|
|
@@ -225,7 +225,7 @@ export declare class EntitlementsClient {
|
|
|
225
225
|
* companyId: "company_id",
|
|
226
226
|
* featureIds: ["feature_ids"],
|
|
227
227
|
* includeUsageAggregation: true,
|
|
228
|
-
* managedBy: "
|
|
228
|
+
* managedBy: "metronome",
|
|
229
229
|
* q: "q",
|
|
230
230
|
* withoutNegativeEntitlements: true,
|
|
231
231
|
* limit: 1000000,
|
|
@@ -379,7 +379,7 @@ export declare class EntitlementsClient {
|
|
|
379
379
|
*
|
|
380
380
|
* @example
|
|
381
381
|
* await client.entitlements.upsertPlanEntitlementForBillingProduct({
|
|
382
|
-
* billingProvider: "
|
|
382
|
+
* billingProvider: "metronome",
|
|
383
383
|
* externalResourceId: "external_resource_id",
|
|
384
384
|
* featureId: "feature_id",
|
|
385
385
|
* planId: "plan_id",
|
|
@@ -5,7 +5,7 @@ import type * as Schematic from "../../../../index";
|
|
|
5
5
|
* companyId: "company_id",
|
|
6
6
|
* featureIds: ["feature_ids"],
|
|
7
7
|
* includeUsageAggregation: true,
|
|
8
|
-
* managedBy: "
|
|
8
|
+
* managedBy: "metronome",
|
|
9
9
|
* q: "q",
|
|
10
10
|
* withoutNegativeEntitlements: true,
|
|
11
11
|
* limit: 1000000,
|
|
@@ -5,7 +5,7 @@ import type * as Schematic from "../../../../index";
|
|
|
5
5
|
* companyId: "company_id",
|
|
6
6
|
* featureIds: ["feature_ids"],
|
|
7
7
|
* includeUsageAggregation: true,
|
|
8
|
-
* managedBy: "
|
|
8
|
+
* managedBy: "metronome",
|
|
9
9
|
* q: "q",
|
|
10
10
|
* withoutNegativeEntitlements: true,
|
|
11
11
|
* limit: 1000000,
|
|
@@ -25,7 +25,7 @@ export declare class FeaturesClient {
|
|
|
25
25
|
* booleanRequireEvent: true,
|
|
26
26
|
* featureType: ["boolean"],
|
|
27
27
|
* ids: ["ids"],
|
|
28
|
-
* managedBy: "
|
|
28
|
+
* managedBy: "metronome",
|
|
29
29
|
* planVersionId: "plan_version_id",
|
|
30
30
|
* q: "q",
|
|
31
31
|
* withoutCompanyOverrideFor: "without_company_override_for",
|
|
@@ -112,7 +112,7 @@ export declare class FeaturesClient {
|
|
|
112
112
|
*
|
|
113
113
|
* @example
|
|
114
114
|
* await client.features.upsertFeatureForBillingProduct({
|
|
115
|
-
* billingProvider: "
|
|
115
|
+
* billingProvider: "metronome",
|
|
116
116
|
* description: "description",
|
|
117
117
|
* externalResourceId: "external_resource_id",
|
|
118
118
|
* featureType: "boolean",
|
|
@@ -136,7 +136,7 @@ export declare class FeaturesClient {
|
|
|
136
136
|
* booleanRequireEvent: true,
|
|
137
137
|
* featureType: ["boolean"],
|
|
138
138
|
* ids: ["ids"],
|
|
139
|
-
* managedBy: "
|
|
139
|
+
* managedBy: "metronome",
|
|
140
140
|
* planVersionId: "plan_version_id",
|
|
141
141
|
* q: "q",
|
|
142
142
|
* withoutCompanyOverrideFor: "without_company_override_for",
|
|
@@ -5,7 +5,7 @@ import type * as Schematic from "../../../../index";
|
|
|
5
5
|
* booleanRequireEvent: true,
|
|
6
6
|
* featureType: ["boolean"],
|
|
7
7
|
* ids: ["ids"],
|
|
8
|
-
* managedBy: "
|
|
8
|
+
* managedBy: "metronome",
|
|
9
9
|
* planVersionId: "plan_version_id",
|
|
10
10
|
* q: "q",
|
|
11
11
|
* withoutCompanyOverrideFor: "without_company_override_for",
|
|
@@ -5,7 +5,7 @@ import type * as Schematic from "../../../../index";
|
|
|
5
5
|
* booleanRequireEvent: true,
|
|
6
6
|
* featureType: ["boolean"],
|
|
7
7
|
* ids: ["ids"],
|
|
8
|
-
* managedBy: "
|
|
8
|
+
* managedBy: "metronome",
|
|
9
9
|
* planVersionId: "plan_version_id",
|
|
10
10
|
* q: "q",
|
|
11
11
|
* withoutCompanyOverrideFor: "without_company_override_for",
|
|
@@ -61,6 +61,23 @@ export declare class IntegrationsapiClient {
|
|
|
61
61
|
*/
|
|
62
62
|
getIntegrationWebhookUrl(type: string, requestOptions?: IntegrationsapiClient.RequestOptions): core.HttpResponsePromise<Schematic.GetIntegrationWebhookUrlResponse>;
|
|
63
63
|
private __getIntegrationWebhookUrl;
|
|
64
|
+
/**
|
|
65
|
+
* @param {Schematic.InstallIntegrationRequestBody} request
|
|
66
|
+
* @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
|
+
*
|
|
68
|
+
* @throws {@link Schematic.BadRequestError}
|
|
69
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
70
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
71
|
+
* @throws {@link Schematic.NotFoundError}
|
|
72
|
+
* @throws {@link Schematic.InternalServerError}
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* await client.integrationsapi.installIntegration({
|
|
76
|
+
* type: "clerk"
|
|
77
|
+
* })
|
|
78
|
+
*/
|
|
79
|
+
installIntegration(request: Schematic.InstallIntegrationRequestBody, requestOptions?: IntegrationsapiClient.RequestOptions): core.HttpResponsePromise<Schematic.InstallIntegrationResponse>;
|
|
80
|
+
private __installIntegration;
|
|
64
81
|
/**
|
|
65
82
|
* @param {Schematic.StartDataImportRequestBody} request
|
|
66
83
|
* @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -87,10 +104,44 @@ export declare class IntegrationsapiClient {
|
|
|
87
104
|
* @throws {@link Schematic.InternalServerError}
|
|
88
105
|
*
|
|
89
106
|
* @example
|
|
90
|
-
* await client.integrationsapi.
|
|
107
|
+
* await client.integrationsapi.loadSampleDataSet()
|
|
108
|
+
*/
|
|
109
|
+
loadSampleDataSet(requestOptions?: IntegrationsapiClient.RequestOptions): core.HttpResponsePromise<Schematic.LoadSampleDataSetResponse>;
|
|
110
|
+
private __loadSampleDataSet;
|
|
111
|
+
/**
|
|
112
|
+
* @param {Schematic.InstallIntegrationRequestBody} request
|
|
113
|
+
* @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
114
|
+
*
|
|
115
|
+
* @throws {@link Schematic.BadRequestError}
|
|
116
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
117
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
118
|
+
* @throws {@link Schematic.NotFoundError}
|
|
119
|
+
* @throws {@link Schematic.InternalServerError}
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* await client.integrationsapi.assumeStripeInstalled({
|
|
123
|
+
* type: "clerk"
|
|
124
|
+
* })
|
|
125
|
+
*/
|
|
126
|
+
assumeStripeInstalled(request: Schematic.InstallIntegrationRequestBody, requestOptions?: IntegrationsapiClient.RequestOptions): core.HttpResponsePromise<Schematic.AssumeStripeInstalledResponse>;
|
|
127
|
+
private __assumeStripeInstalled;
|
|
128
|
+
/**
|
|
129
|
+
* @param {Schematic.InstallIntegrationRequestBody} request
|
|
130
|
+
* @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
131
|
+
*
|
|
132
|
+
* @throws {@link Schematic.BadRequestError}
|
|
133
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
134
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
135
|
+
* @throws {@link Schematic.NotFoundError}
|
|
136
|
+
* @throws {@link Schematic.InternalServerError}
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* await client.integrationsapi.installStripe({
|
|
140
|
+
* type: "clerk"
|
|
141
|
+
* })
|
|
91
142
|
*/
|
|
92
|
-
|
|
93
|
-
private
|
|
143
|
+
installStripe(request: Schematic.InstallIntegrationRequestBody, requestOptions?: IntegrationsapiClient.RequestOptions): core.HttpResponsePromise<Schematic.InstallStripeResponse>;
|
|
144
|
+
private __installStripe;
|
|
94
145
|
/**
|
|
95
146
|
* @param {string} integration_id - integration_id
|
|
96
147
|
* @param {IntegrationsapiClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export * from "./AssumeStripeInstalledResponse";
|
|
1
2
|
export * from "./GetIntegrationWebhookUrlResponse";
|
|
3
|
+
export * from "./InstallIntegrationResponse";
|
|
4
|
+
export * from "./InstallStripeResponse";
|
|
2
5
|
export * from "./ListIntegrationsParams";
|
|
3
6
|
export * from "./ListIntegrationsResponse";
|
|
4
|
-
export * from "./
|
|
7
|
+
export * from "./LoadSampleDataSetResponse";
|
|
5
8
|
export * from "./RunIntegrationResponse";
|
|
6
9
|
export * from "./StartDataImportResponse";
|
|
7
10
|
export * from "./UninstallIntegrationResponse";
|
|
@@ -35,6 +35,7 @@ export interface CreatePlanGroupRequestBody {
|
|
|
35
35
|
checkoutCollectAddress: boolean;
|
|
36
36
|
checkoutCollectEmail: boolean;
|
|
37
37
|
checkoutCollectPhone: boolean;
|
|
38
|
+
customCheckoutFields?: Schematic.CheckoutFieldInput[];
|
|
38
39
|
customPlanConfig?: Schematic.CustomPlanConfig;
|
|
39
40
|
customPlanId?: string;
|
|
40
41
|
enableTaxCollection: boolean;
|
|
@@ -35,6 +35,7 @@ export interface UpdatePlanGroupRequestBody {
|
|
|
35
35
|
checkoutCollectAddress: boolean;
|
|
36
36
|
checkoutCollectEmail: boolean;
|
|
37
37
|
checkoutCollectPhone: boolean;
|
|
38
|
+
customCheckoutFields?: Schematic.CheckoutFieldInput[];
|
|
38
39
|
customPlanConfig?: Schematic.CustomPlanConfig;
|
|
39
40
|
customPlanId?: string;
|
|
40
41
|
enableTaxCollection: boolean;
|