@factify/sdk 0.3.13-rc.1 → 0.3.14-rc.2
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 +0 -7
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/index.d.ts +0 -5
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +0 -5
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +0 -2
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +0 -2
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/sdk/sdk.d.ts +0 -3
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +0 -4
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/index.d.ts +0 -5
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +0 -5
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +0 -2
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +0 -2
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/sdk/sdk.d.ts +0 -3
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +0 -4
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/openapi.json +0 -338
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/index.ts +0 -5
- package/src/models/operations/index.ts +0 -2
- package/src/sdk/sdk.ts +0 -6
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.d.ts +0 -18
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.d.ts.map +0 -1
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.js +0 -124
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.js.map +0 -1
- package/dist/commonjs/funcs/quotaGetUsageHistory.d.ts +0 -18
- package/dist/commonjs/funcs/quotaGetUsageHistory.d.ts.map +0 -1
- package/dist/commonjs/funcs/quotaGetUsageHistory.js +0 -126
- package/dist/commonjs/funcs/quotaGetUsageHistory.js.map +0 -1
- package/dist/commonjs/models/components/dailyusage.d.ts +0 -20
- package/dist/commonjs/models/components/dailyusage.d.ts.map +0 -1
- package/dist/commonjs/models/components/dailyusage.js +0 -58
- package/dist/commonjs/models/components/dailyusage.js.map +0 -1
- package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts +0 -17
- package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts.map +0 -1
- package/dist/commonjs/models/components/getorganizationquotaresponse.js +0 -52
- package/dist/commonjs/models/components/getorganizationquotaresponse.js.map +0 -1
- package/dist/commonjs/models/components/getusagehistoryresponse.d.ts +0 -25
- package/dist/commonjs/models/components/getusagehistoryresponse.d.ts.map +0 -1
- package/dist/commonjs/models/components/getusagehistoryresponse.js +0 -61
- package/dist/commonjs/models/components/getusagehistoryresponse.js.map +0 -1
- package/dist/commonjs/models/components/organizationquota.d.ts +0 -52
- package/dist/commonjs/models/components/organizationquota.d.ts.map +0 -1
- package/dist/commonjs/models/components/organizationquota.js +0 -71
- package/dist/commonjs/models/components/organizationquota.js.map +0 -1
- package/dist/commonjs/models/components/quotatier.d.ts +0 -17
- package/dist/commonjs/models/components/quotatier.d.ts.map +0 -1
- package/dist/commonjs/models/components/quotatier.js +0 -51
- package/dist/commonjs/models/components/quotatier.js.map +0 -1
- package/dist/commonjs/models/operations/getorganizationquota.d.ts +0 -34
- package/dist/commonjs/models/operations/getorganizationquota.d.ts.map +0 -1
- package/dist/commonjs/models/operations/getorganizationquota.js +0 -73
- package/dist/commonjs/models/operations/getorganizationquota.js.map +0 -1
- package/dist/commonjs/models/operations/getusagehistory.d.ts +0 -41
- package/dist/commonjs/models/operations/getusagehistory.d.ts.map +0 -1
- package/dist/commonjs/models/operations/getusagehistory.js +0 -77
- package/dist/commonjs/models/operations/getusagehistory.js.map +0 -1
- package/dist/commonjs/sdk/quota.d.ts +0 -19
- package/dist/commonjs/sdk/quota.d.ts.map +0 -1
- package/dist/commonjs/sdk/quota.js +0 -32
- package/dist/commonjs/sdk/quota.js.map +0 -1
- package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts +0 -18
- package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts.map +0 -1
- package/dist/esm/funcs/quotaGetOrganizationQuota.js +0 -88
- package/dist/esm/funcs/quotaGetOrganizationQuota.js.map +0 -1
- package/dist/esm/funcs/quotaGetUsageHistory.d.ts +0 -18
- package/dist/esm/funcs/quotaGetUsageHistory.d.ts.map +0 -1
- package/dist/esm/funcs/quotaGetUsageHistory.js +0 -90
- package/dist/esm/funcs/quotaGetUsageHistory.js.map +0 -1
- package/dist/esm/models/components/dailyusage.d.ts +0 -20
- package/dist/esm/models/components/dailyusage.d.ts.map +0 -1
- package/dist/esm/models/components/dailyusage.js +0 -21
- package/dist/esm/models/components/dailyusage.js.map +0 -1
- package/dist/esm/models/components/getorganizationquotaresponse.d.ts +0 -17
- package/dist/esm/models/components/getorganizationquotaresponse.d.ts.map +0 -1
- package/dist/esm/models/components/getorganizationquotaresponse.js +0 -15
- package/dist/esm/models/components/getorganizationquotaresponse.js.map +0 -1
- package/dist/esm/models/components/getusagehistoryresponse.d.ts +0 -25
- package/dist/esm/models/components/getusagehistoryresponse.d.ts.map +0 -1
- package/dist/esm/models/components/getusagehistoryresponse.js +0 -24
- package/dist/esm/models/components/getusagehistoryresponse.js.map +0 -1
- package/dist/esm/models/components/organizationquota.d.ts +0 -52
- package/dist/esm/models/components/organizationquota.d.ts.map +0 -1
- package/dist/esm/models/components/organizationquota.js +0 -34
- package/dist/esm/models/components/organizationquota.js.map +0 -1
- package/dist/esm/models/components/quotatier.d.ts +0 -17
- package/dist/esm/models/components/quotatier.d.ts.map +0 -1
- package/dist/esm/models/components/quotatier.js +0 -15
- package/dist/esm/models/components/quotatier.js.map +0 -1
- package/dist/esm/models/operations/getorganizationquota.d.ts +0 -34
- package/dist/esm/models/operations/getorganizationquota.d.ts.map +0 -1
- package/dist/esm/models/operations/getorganizationquota.js +0 -35
- package/dist/esm/models/operations/getorganizationquota.js.map +0 -1
- package/dist/esm/models/operations/getusagehistory.d.ts +0 -41
- package/dist/esm/models/operations/getusagehistory.d.ts.map +0 -1
- package/dist/esm/models/operations/getusagehistory.js +0 -39
- package/dist/esm/models/operations/getusagehistory.js.map +0 -1
- package/dist/esm/sdk/quota.d.ts +0 -19
- package/dist/esm/sdk/quota.d.ts.map +0 -1
- package/dist/esm/sdk/quota.js +0 -28
- package/dist/esm/sdk/quota.js.map +0 -1
- package/src/funcs/quotaGetOrganizationQuota.ts +0 -182
- package/src/funcs/quotaGetUsageHistory.ts +0 -184
- package/src/models/components/dailyusage.ts +0 -48
- package/src/models/components/getorganizationquotaresponse.ts +0 -41
- package/src/models/components/getusagehistoryresponse.ts +0 -58
- package/src/models/components/organizationquota.ts +0 -95
- package/src/models/components/quotatier.ts +0 -24
- package/src/models/operations/getorganizationquota.ts +0 -93
- package/src/models/operations/getusagehistory.ts +0 -100
- package/src/sdk/quota.ts +0 -45
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { FactifyCore } from "../core.js";
|
|
7
|
-
import { encodeFormQuery } from "../lib/encodings.js";
|
|
8
|
-
import * as M from "../lib/matchers.js";
|
|
9
|
-
import { compactMap } from "../lib/primitives.js";
|
|
10
|
-
import { safeParse } from "../lib/schemas.js";
|
|
11
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
-
import { pathToFunc } from "../lib/url.js";
|
|
14
|
-
import { FactifyError } from "../models/errors/factifyerror.js";
|
|
15
|
-
import {
|
|
16
|
-
ConnectionError,
|
|
17
|
-
InvalidRequestError,
|
|
18
|
-
RequestAbortedError,
|
|
19
|
-
RequestTimeoutError,
|
|
20
|
-
UnexpectedClientError,
|
|
21
|
-
} from "../models/errors/httpclienterrors.js";
|
|
22
|
-
import * as errors from "../models/errors/index.js";
|
|
23
|
-
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
-
import * as operations from "../models/operations/index.js";
|
|
26
|
-
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
-
import { Result } from "../types/fp.js";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get usage history
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Returns daily usage records for an organization within a specified date range.
|
|
34
|
-
*/
|
|
35
|
-
export function quotaGetUsageHistory(
|
|
36
|
-
client: FactifyCore,
|
|
37
|
-
request?: operations.GetUsageHistoryRequest | undefined,
|
|
38
|
-
options?: RequestOptions,
|
|
39
|
-
): APIPromise<
|
|
40
|
-
Result<
|
|
41
|
-
operations.GetUsageHistoryResponse,
|
|
42
|
-
| errors.ErrorT
|
|
43
|
-
| FactifyError
|
|
44
|
-
| ResponseValidationError
|
|
45
|
-
| ConnectionError
|
|
46
|
-
| RequestAbortedError
|
|
47
|
-
| RequestTimeoutError
|
|
48
|
-
| InvalidRequestError
|
|
49
|
-
| UnexpectedClientError
|
|
50
|
-
| SDKValidationError
|
|
51
|
-
>
|
|
52
|
-
> {
|
|
53
|
-
return new APIPromise($do(
|
|
54
|
-
client,
|
|
55
|
-
request,
|
|
56
|
-
options,
|
|
57
|
-
));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function $do(
|
|
61
|
-
client: FactifyCore,
|
|
62
|
-
request?: operations.GetUsageHistoryRequest | undefined,
|
|
63
|
-
options?: RequestOptions,
|
|
64
|
-
): Promise<
|
|
65
|
-
[
|
|
66
|
-
Result<
|
|
67
|
-
operations.GetUsageHistoryResponse,
|
|
68
|
-
| errors.ErrorT
|
|
69
|
-
| FactifyError
|
|
70
|
-
| ResponseValidationError
|
|
71
|
-
| ConnectionError
|
|
72
|
-
| RequestAbortedError
|
|
73
|
-
| RequestTimeoutError
|
|
74
|
-
| InvalidRequestError
|
|
75
|
-
| UnexpectedClientError
|
|
76
|
-
| SDKValidationError
|
|
77
|
-
>,
|
|
78
|
-
APICall,
|
|
79
|
-
]
|
|
80
|
-
> {
|
|
81
|
-
const parsed = safeParse(
|
|
82
|
-
request,
|
|
83
|
-
(value) =>
|
|
84
|
-
z.parse(
|
|
85
|
-
z.optional(operations.GetUsageHistoryRequest$outboundSchema),
|
|
86
|
-
value,
|
|
87
|
-
),
|
|
88
|
-
"Input validation failed",
|
|
89
|
-
);
|
|
90
|
-
if (!parsed.ok) {
|
|
91
|
-
return [parsed, { status: "invalid" }];
|
|
92
|
-
}
|
|
93
|
-
const payload = parsed.value;
|
|
94
|
-
const body = null;
|
|
95
|
-
|
|
96
|
-
const path = pathToFunc("/v1beta/quota/usage")();
|
|
97
|
-
|
|
98
|
-
const query = encodeFormQuery({
|
|
99
|
-
"end_date": payload?.end_date,
|
|
100
|
-
"organization_id": payload?.organization_id,
|
|
101
|
-
"start_date": payload?.start_date,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const headers = new Headers(compactMap({
|
|
105
|
-
Accept: "application/json",
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
109
|
-
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
110
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
111
|
-
|
|
112
|
-
const context = {
|
|
113
|
-
options: client._options,
|
|
114
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
115
|
-
operationID: "getUsageHistory",
|
|
116
|
-
oAuth2Scopes: null,
|
|
117
|
-
|
|
118
|
-
resolvedSecurity: requestSecurity,
|
|
119
|
-
|
|
120
|
-
securitySource: client._options.bearerAuth,
|
|
121
|
-
retryConfig: options?.retries
|
|
122
|
-
|| client._options.retryConfig
|
|
123
|
-
|| { strategy: "none" },
|
|
124
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const requestRes = client._createRequest(context, {
|
|
128
|
-
security: requestSecurity,
|
|
129
|
-
method: "GET",
|
|
130
|
-
baseURL: options?.serverURL,
|
|
131
|
-
path: path,
|
|
132
|
-
headers: headers,
|
|
133
|
-
query: query,
|
|
134
|
-
body: body,
|
|
135
|
-
userAgent: client._options.userAgent,
|
|
136
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
137
|
-
}, options);
|
|
138
|
-
if (!requestRes.ok) {
|
|
139
|
-
return [requestRes, { status: "invalid" }];
|
|
140
|
-
}
|
|
141
|
-
const req = requestRes.value;
|
|
142
|
-
|
|
143
|
-
const doResult = await client._do(req, {
|
|
144
|
-
context,
|
|
145
|
-
errorCodes: ["400", "401", "403", "404", "429", "4XX", "500", "5XX"],
|
|
146
|
-
retryConfig: context.retryConfig,
|
|
147
|
-
retryCodes: context.retryCodes,
|
|
148
|
-
});
|
|
149
|
-
if (!doResult.ok) {
|
|
150
|
-
return [doResult, { status: "request-error", request: req }];
|
|
151
|
-
}
|
|
152
|
-
const response = doResult.value;
|
|
153
|
-
|
|
154
|
-
const responseFields = {
|
|
155
|
-
HttpMeta: { Response: response, Request: req },
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const [result] = await M.match<
|
|
159
|
-
operations.GetUsageHistoryResponse,
|
|
160
|
-
| errors.ErrorT
|
|
161
|
-
| FactifyError
|
|
162
|
-
| ResponseValidationError
|
|
163
|
-
| ConnectionError
|
|
164
|
-
| RequestAbortedError
|
|
165
|
-
| RequestTimeoutError
|
|
166
|
-
| InvalidRequestError
|
|
167
|
-
| UnexpectedClientError
|
|
168
|
-
| SDKValidationError
|
|
169
|
-
>(
|
|
170
|
-
M.json(200, operations.GetUsageHistoryResponse$inboundSchema, {
|
|
171
|
-
key: "GetUsageHistoryResponse",
|
|
172
|
-
}),
|
|
173
|
-
M.jsonErr([400, 401, 403, 404], errors.ErrorT$inboundSchema),
|
|
174
|
-
M.jsonErr(429, errors.ErrorT$inboundSchema, { hdrs: true }),
|
|
175
|
-
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
176
|
-
M.fail("4XX"),
|
|
177
|
-
M.fail("5XX"),
|
|
178
|
-
)(response, req, { extraFields: responseFields });
|
|
179
|
-
if (!result.ok) {
|
|
180
|
-
return [result, { status: "complete", request: req, response }];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return [result, { status: "complete", request: req, response }];
|
|
184
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import * as types from "../../types/primitives.js";
|
|
10
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* DailyUsage represents usage for a single day.
|
|
14
|
-
*/
|
|
15
|
-
export type DailyUsage = {
|
|
16
|
-
/**
|
|
17
|
-
* The date (YYYY-MM-DD format).
|
|
18
|
-
*/
|
|
19
|
-
date?: string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Request count for this day.
|
|
22
|
-
*/
|
|
23
|
-
requestCount?: number | undefined;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/** @internal */
|
|
27
|
-
export const DailyUsage$inboundSchema: z.ZodMiniType<DailyUsage, unknown> = z
|
|
28
|
-
.pipe(
|
|
29
|
-
z.object({
|
|
30
|
-
date: types.optional(types.string()),
|
|
31
|
-
request_count: types.optional(types.number()),
|
|
32
|
-
}),
|
|
33
|
-
z.transform((v) => {
|
|
34
|
-
return remap$(v, {
|
|
35
|
-
"request_count": "requestCount",
|
|
36
|
-
});
|
|
37
|
-
}),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export function dailyUsageFromJSON(
|
|
41
|
-
jsonString: string,
|
|
42
|
-
): SafeParseResult<DailyUsage, SDKValidationError> {
|
|
43
|
-
return safeParse(
|
|
44
|
-
jsonString,
|
|
45
|
-
(x) => DailyUsage$inboundSchema.parse(JSON.parse(x)),
|
|
46
|
-
`Failed to parse 'DailyUsage' from JSON`,
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
-
import * as types from "../../types/primitives.js";
|
|
9
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
-
import {
|
|
11
|
-
OrganizationQuota,
|
|
12
|
-
OrganizationQuota$inboundSchema,
|
|
13
|
-
} from "./organizationquota.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* GetOrganizationQuotaResponse returns the quota status.
|
|
17
|
-
*/
|
|
18
|
-
export type GetOrganizationQuotaResponse = {
|
|
19
|
-
/**
|
|
20
|
-
* OrganizationQuota represents the quota status for an organization.
|
|
21
|
-
*/
|
|
22
|
-
quota?: OrganizationQuota | undefined;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/** @internal */
|
|
26
|
-
export const GetOrganizationQuotaResponse$inboundSchema: z.ZodMiniType<
|
|
27
|
-
GetOrganizationQuotaResponse,
|
|
28
|
-
unknown
|
|
29
|
-
> = z.object({
|
|
30
|
-
quota: types.optional(OrganizationQuota$inboundSchema),
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export function getOrganizationQuotaResponseFromJSON(
|
|
34
|
-
jsonString: string,
|
|
35
|
-
): SafeParseResult<GetOrganizationQuotaResponse, SDKValidationError> {
|
|
36
|
-
return safeParse(
|
|
37
|
-
jsonString,
|
|
38
|
-
(x) => GetOrganizationQuotaResponse$inboundSchema.parse(JSON.parse(x)),
|
|
39
|
-
`Failed to parse 'GetOrganizationQuotaResponse' from JSON`,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import * as types from "../../types/primitives.js";
|
|
10
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
-
import { DailyUsage, DailyUsage$inboundSchema } from "./dailyusage.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* GetUsageHistoryResponse returns usage history.
|
|
15
|
-
*/
|
|
16
|
-
export type GetUsageHistoryResponse = {
|
|
17
|
-
/**
|
|
18
|
-
* Daily usage records.
|
|
19
|
-
*/
|
|
20
|
-
dailyUsage?: Array<DailyUsage> | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* The organization ID.
|
|
23
|
-
*/
|
|
24
|
-
organizationId?: string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Total requests in the period.
|
|
27
|
-
*/
|
|
28
|
-
totalRequests?: number | undefined;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/** @internal */
|
|
32
|
-
export const GetUsageHistoryResponse$inboundSchema: z.ZodMiniType<
|
|
33
|
-
GetUsageHistoryResponse,
|
|
34
|
-
unknown
|
|
35
|
-
> = z.pipe(
|
|
36
|
-
z.object({
|
|
37
|
-
daily_usage: types.optional(z.array(DailyUsage$inboundSchema)),
|
|
38
|
-
organization_id: types.optional(types.string()),
|
|
39
|
-
total_requests: types.optional(types.number()),
|
|
40
|
-
}),
|
|
41
|
-
z.transform((v) => {
|
|
42
|
-
return remap$(v, {
|
|
43
|
-
"daily_usage": "dailyUsage",
|
|
44
|
-
"organization_id": "organizationId",
|
|
45
|
-
"total_requests": "totalRequests",
|
|
46
|
-
});
|
|
47
|
-
}),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export function getUsageHistoryResponseFromJSON(
|
|
51
|
-
jsonString: string,
|
|
52
|
-
): SafeParseResult<GetUsageHistoryResponse, SDKValidationError> {
|
|
53
|
-
return safeParse(
|
|
54
|
-
jsonString,
|
|
55
|
-
(x) => GetUsageHistoryResponse$inboundSchema.parse(JSON.parse(x)),
|
|
56
|
-
`Failed to parse 'GetUsageHistoryResponse' from JSON`,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import * as types from "../../types/primitives.js";
|
|
10
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
-
import { QuotaTier, QuotaTier$inboundSchema } from "./quotatier.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* OrganizationQuota represents the quota status for an organization.
|
|
15
|
-
*/
|
|
16
|
-
export type OrganizationQuota = {
|
|
17
|
-
/**
|
|
18
|
-
* Current usage in the billing period.
|
|
19
|
-
*/
|
|
20
|
-
currentUsage?: number | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* The effective monthly limit (considers custom_limit if set).
|
|
23
|
-
*/
|
|
24
|
-
effectiveLimit?: number | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Whether quota is exceeded.
|
|
27
|
-
*/
|
|
28
|
-
isExceeded?: boolean | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* The organization ID.
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Pattern: org_[0-9a-hjkmnp-tv-z]{26}
|
|
34
|
-
*/
|
|
35
|
-
organizationId?: string | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Start of current billing period.
|
|
38
|
-
*/
|
|
39
|
-
periodStart?: Date | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Remaining requests in the billing period.
|
|
42
|
-
*/
|
|
43
|
-
remaining?: number | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* When the quota resets (start of next billing period).
|
|
46
|
-
*/
|
|
47
|
-
resetAt?: Date | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* QuotaTier represents the organization's quota tier.
|
|
50
|
-
*/
|
|
51
|
-
tier?: QuotaTier | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Usage as a percentage (0-100+).
|
|
54
|
-
*/
|
|
55
|
-
usagePercent?: number | undefined;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** @internal */
|
|
59
|
-
export const OrganizationQuota$inboundSchema: z.ZodMiniType<
|
|
60
|
-
OrganizationQuota,
|
|
61
|
-
unknown
|
|
62
|
-
> = z.pipe(
|
|
63
|
-
z.object({
|
|
64
|
-
current_usage: types.optional(types.number()),
|
|
65
|
-
effective_limit: types.optional(types.number()),
|
|
66
|
-
is_exceeded: types.optional(types.boolean()),
|
|
67
|
-
organization_id: types.optional(types.string()),
|
|
68
|
-
period_start: types.optional(types.date()),
|
|
69
|
-
remaining: types.optional(types.number()),
|
|
70
|
-
reset_at: types.optional(types.date()),
|
|
71
|
-
tier: types.optional(QuotaTier$inboundSchema),
|
|
72
|
-
usage_percent: types.optional(types.number()),
|
|
73
|
-
}),
|
|
74
|
-
z.transform((v) => {
|
|
75
|
-
return remap$(v, {
|
|
76
|
-
"current_usage": "currentUsage",
|
|
77
|
-
"effective_limit": "effectiveLimit",
|
|
78
|
-
"is_exceeded": "isExceeded",
|
|
79
|
-
"organization_id": "organizationId",
|
|
80
|
-
"period_start": "periodStart",
|
|
81
|
-
"reset_at": "resetAt",
|
|
82
|
-
"usage_percent": "usagePercent",
|
|
83
|
-
});
|
|
84
|
-
}),
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
export function organizationQuotaFromJSON(
|
|
88
|
-
jsonString: string,
|
|
89
|
-
): SafeParseResult<OrganizationQuota, SDKValidationError> {
|
|
90
|
-
return safeParse(
|
|
91
|
-
jsonString,
|
|
92
|
-
(x) => OrganizationQuota$inboundSchema.parse(JSON.parse(x)),
|
|
93
|
-
`Failed to parse 'OrganizationQuota' from JSON`,
|
|
94
|
-
);
|
|
95
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import * as openEnums from "../../types/enums.js";
|
|
7
|
-
import { OpenEnum } from "../../types/enums.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* QuotaTier represents the organization's quota tier.
|
|
11
|
-
*/
|
|
12
|
-
export const QuotaTier = {
|
|
13
|
-
QuotaTierUnspecified: "QUOTA_TIER_UNSPECIFIED",
|
|
14
|
-
QuotaTierFree: "QUOTA_TIER_FREE",
|
|
15
|
-
QuotaTierCustom: "QUOTA_TIER_CUSTOM",
|
|
16
|
-
} as const;
|
|
17
|
-
/**
|
|
18
|
-
* QuotaTier represents the organization's quota tier.
|
|
19
|
-
*/
|
|
20
|
-
export type QuotaTier = OpenEnum<typeof QuotaTier>;
|
|
21
|
-
|
|
22
|
-
/** @internal */
|
|
23
|
-
export const QuotaTier$inboundSchema: z.ZodMiniType<QuotaTier, unknown> =
|
|
24
|
-
openEnums.inboundSchema(QuotaTier);
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import * as types from "../../types/primitives.js";
|
|
10
|
-
import * as components from "../components/index.js";
|
|
11
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
|
-
|
|
13
|
-
export type GetOrganizationQuotaRequest = {
|
|
14
|
-
/**
|
|
15
|
-
* Optional: organization ID to query. If not provided, uses the caller's organization.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Only admins can query other organizations.
|
|
19
|
-
*/
|
|
20
|
-
organizationId?: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type GetOrganizationQuotaResponse = {
|
|
24
|
-
httpMeta: components.HTTPMetadata;
|
|
25
|
-
/**
|
|
26
|
-
* Success
|
|
27
|
-
*/
|
|
28
|
-
getOrganizationQuotaResponse?:
|
|
29
|
-
| components.GetOrganizationQuotaResponse
|
|
30
|
-
| undefined;
|
|
31
|
-
headers: { [k: string]: Array<string> };
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** @internal */
|
|
35
|
-
export type GetOrganizationQuotaRequest$Outbound = {
|
|
36
|
-
organization_id?: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/** @internal */
|
|
40
|
-
export const GetOrganizationQuotaRequest$outboundSchema: z.ZodMiniType<
|
|
41
|
-
GetOrganizationQuotaRequest$Outbound,
|
|
42
|
-
GetOrganizationQuotaRequest
|
|
43
|
-
> = z.pipe(
|
|
44
|
-
z.object({
|
|
45
|
-
organizationId: z.optional(z.string()),
|
|
46
|
-
}),
|
|
47
|
-
z.transform((v) => {
|
|
48
|
-
return remap$(v, {
|
|
49
|
-
organizationId: "organization_id",
|
|
50
|
-
});
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
export function getOrganizationQuotaRequestToJSON(
|
|
55
|
-
getOrganizationQuotaRequest: GetOrganizationQuotaRequest,
|
|
56
|
-
): string {
|
|
57
|
-
return JSON.stringify(
|
|
58
|
-
GetOrganizationQuotaRequest$outboundSchema.parse(
|
|
59
|
-
getOrganizationQuotaRequest,
|
|
60
|
-
),
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** @internal */
|
|
65
|
-
export const GetOrganizationQuotaResponse$inboundSchema: z.ZodMiniType<
|
|
66
|
-
GetOrganizationQuotaResponse,
|
|
67
|
-
unknown
|
|
68
|
-
> = z.pipe(
|
|
69
|
-
z.object({
|
|
70
|
-
HttpMeta: components.HTTPMetadata$inboundSchema,
|
|
71
|
-
GetOrganizationQuotaResponse: types.optional(
|
|
72
|
-
components.GetOrganizationQuotaResponse$inboundSchema,
|
|
73
|
-
),
|
|
74
|
-
Headers: z._default(z.record(z.string(), z.array(z.string())), {}),
|
|
75
|
-
}),
|
|
76
|
-
z.transform((v) => {
|
|
77
|
-
return remap$(v, {
|
|
78
|
-
"HttpMeta": "httpMeta",
|
|
79
|
-
"GetOrganizationQuotaResponse": "getOrganizationQuotaResponse",
|
|
80
|
-
"Headers": "headers",
|
|
81
|
-
});
|
|
82
|
-
}),
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
export function getOrganizationQuotaResponseFromJSON(
|
|
86
|
-
jsonString: string,
|
|
87
|
-
): SafeParseResult<GetOrganizationQuotaResponse, SDKValidationError> {
|
|
88
|
-
return safeParse(
|
|
89
|
-
jsonString,
|
|
90
|
-
(x) => GetOrganizationQuotaResponse$inboundSchema.parse(JSON.parse(x)),
|
|
91
|
-
`Failed to parse 'GetOrganizationQuotaResponse' from JSON`,
|
|
92
|
-
);
|
|
93
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import * as types from "../../types/primitives.js";
|
|
10
|
-
import * as components from "../components/index.js";
|
|
11
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
|
-
|
|
13
|
-
export type GetUsageHistoryRequest = {
|
|
14
|
-
/**
|
|
15
|
-
* Optional: organization ID to query. If not provided, uses the caller's organization.
|
|
16
|
-
*/
|
|
17
|
-
organizationId?: string | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Start date for the history (inclusive, YYYY-MM-DD format).
|
|
20
|
-
*/
|
|
21
|
-
startDate?: string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* End date for the history (exclusive, YYYY-MM-DD format).
|
|
24
|
-
*/
|
|
25
|
-
endDate?: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type GetUsageHistoryResponse = {
|
|
29
|
-
httpMeta: components.HTTPMetadata;
|
|
30
|
-
/**
|
|
31
|
-
* Success
|
|
32
|
-
*/
|
|
33
|
-
getUsageHistoryResponse?: components.GetUsageHistoryResponse | undefined;
|
|
34
|
-
headers: { [k: string]: Array<string> };
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** @internal */
|
|
38
|
-
export type GetUsageHistoryRequest$Outbound = {
|
|
39
|
-
organization_id?: string | undefined;
|
|
40
|
-
start_date?: string | undefined;
|
|
41
|
-
end_date?: string | undefined;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** @internal */
|
|
45
|
-
export const GetUsageHistoryRequest$outboundSchema: z.ZodMiniType<
|
|
46
|
-
GetUsageHistoryRequest$Outbound,
|
|
47
|
-
GetUsageHistoryRequest
|
|
48
|
-
> = z.pipe(
|
|
49
|
-
z.object({
|
|
50
|
-
organizationId: z.optional(z.string()),
|
|
51
|
-
startDate: z.optional(z.string()),
|
|
52
|
-
endDate: z.optional(z.string()),
|
|
53
|
-
}),
|
|
54
|
-
z.transform((v) => {
|
|
55
|
-
return remap$(v, {
|
|
56
|
-
organizationId: "organization_id",
|
|
57
|
-
startDate: "start_date",
|
|
58
|
-
endDate: "end_date",
|
|
59
|
-
});
|
|
60
|
-
}),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
export function getUsageHistoryRequestToJSON(
|
|
64
|
-
getUsageHistoryRequest: GetUsageHistoryRequest,
|
|
65
|
-
): string {
|
|
66
|
-
return JSON.stringify(
|
|
67
|
-
GetUsageHistoryRequest$outboundSchema.parse(getUsageHistoryRequest),
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** @internal */
|
|
72
|
-
export const GetUsageHistoryResponse$inboundSchema: z.ZodMiniType<
|
|
73
|
-
GetUsageHistoryResponse,
|
|
74
|
-
unknown
|
|
75
|
-
> = z.pipe(
|
|
76
|
-
z.object({
|
|
77
|
-
HttpMeta: components.HTTPMetadata$inboundSchema,
|
|
78
|
-
GetUsageHistoryResponse: types.optional(
|
|
79
|
-
components.GetUsageHistoryResponse$inboundSchema,
|
|
80
|
-
),
|
|
81
|
-
Headers: z._default(z.record(z.string(), z.array(z.string())), {}),
|
|
82
|
-
}),
|
|
83
|
-
z.transform((v) => {
|
|
84
|
-
return remap$(v, {
|
|
85
|
-
"HttpMeta": "httpMeta",
|
|
86
|
-
"GetUsageHistoryResponse": "getUsageHistoryResponse",
|
|
87
|
-
"Headers": "headers",
|
|
88
|
-
});
|
|
89
|
-
}),
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
export function getUsageHistoryResponseFromJSON(
|
|
93
|
-
jsonString: string,
|
|
94
|
-
): SafeParseResult<GetUsageHistoryResponse, SDKValidationError> {
|
|
95
|
-
return safeParse(
|
|
96
|
-
jsonString,
|
|
97
|
-
(x) => GetUsageHistoryResponse$inboundSchema.parse(JSON.parse(x)),
|
|
98
|
-
`Failed to parse 'GetUsageHistoryResponse' from JSON`,
|
|
99
|
-
);
|
|
100
|
-
}
|
package/src/sdk/quota.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { quotaGetOrganizationQuota } from "../funcs/quotaGetOrganizationQuota.js";
|
|
6
|
-
import { quotaGetUsageHistory } from "../funcs/quotaGetUsageHistory.js";
|
|
7
|
-
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
8
|
-
import * as operations from "../models/operations/index.js";
|
|
9
|
-
import { unwrapAsync } from "../types/fp.js";
|
|
10
|
-
|
|
11
|
-
export class Quota extends ClientSDK {
|
|
12
|
-
/**
|
|
13
|
-
* Get organization quota status
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Returns the current quota status for an organization including usage, limits, tier, and reset date.
|
|
17
|
-
*/
|
|
18
|
-
async getOrganizationQuota(
|
|
19
|
-
request?: operations.GetOrganizationQuotaRequest | undefined,
|
|
20
|
-
options?: RequestOptions,
|
|
21
|
-
): Promise<operations.GetOrganizationQuotaResponse> {
|
|
22
|
-
return unwrapAsync(quotaGetOrganizationQuota(
|
|
23
|
-
this,
|
|
24
|
-
request,
|
|
25
|
-
options,
|
|
26
|
-
));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get usage history
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Returns daily usage records for an organization within a specified date range.
|
|
34
|
-
*/
|
|
35
|
-
async getUsageHistory(
|
|
36
|
-
request?: operations.GetUsageHistoryRequest | undefined,
|
|
37
|
-
options?: RequestOptions,
|
|
38
|
-
): Promise<operations.GetUsageHistoryResponse> {
|
|
39
|
-
return unwrapAsync(quotaGetUsageHistory(
|
|
40
|
-
this,
|
|
41
|
-
request,
|
|
42
|
-
options,
|
|
43
|
-
));
|
|
44
|
-
}
|
|
45
|
-
}
|