@factify/sdk 0.3.12 → 0.3.13-rc.1

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.
Files changed (129) hide show
  1. package/README.md +7 -0
  2. package/dist/commonjs/funcs/quotaGetOrganizationQuota.d.ts +18 -0
  3. package/dist/commonjs/funcs/quotaGetOrganizationQuota.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/quotaGetOrganizationQuota.js +124 -0
  5. package/dist/commonjs/funcs/quotaGetOrganizationQuota.js.map +1 -0
  6. package/dist/commonjs/funcs/quotaGetUsageHistory.d.ts +18 -0
  7. package/dist/commonjs/funcs/quotaGetUsageHistory.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/quotaGetUsageHistory.js +126 -0
  9. package/dist/commonjs/funcs/quotaGetUsageHistory.js.map +1 -0
  10. package/dist/commonjs/lib/config.d.ts +3 -3
  11. package/dist/commonjs/lib/config.js +3 -3
  12. package/dist/commonjs/lib/config.js.map +1 -1
  13. package/dist/commonjs/models/components/dailyusage.d.ts +20 -0
  14. package/dist/commonjs/models/components/dailyusage.d.ts.map +1 -0
  15. package/dist/commonjs/models/components/dailyusage.js +58 -0
  16. package/dist/commonjs/models/components/dailyusage.js.map +1 -0
  17. package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts +17 -0
  18. package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts.map +1 -0
  19. package/dist/commonjs/models/components/getorganizationquotaresponse.js +52 -0
  20. package/dist/commonjs/models/components/getorganizationquotaresponse.js.map +1 -0
  21. package/dist/commonjs/models/components/getusagehistoryresponse.d.ts +25 -0
  22. package/dist/commonjs/models/components/getusagehistoryresponse.d.ts.map +1 -0
  23. package/dist/commonjs/models/components/getusagehistoryresponse.js +61 -0
  24. package/dist/commonjs/models/components/getusagehistoryresponse.js.map +1 -0
  25. package/dist/commonjs/models/components/index.d.ts +5 -0
  26. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  27. package/dist/commonjs/models/components/index.js +5 -0
  28. package/dist/commonjs/models/components/index.js.map +1 -1
  29. package/dist/commonjs/models/components/organizationquota.d.ts +52 -0
  30. package/dist/commonjs/models/components/organizationquota.d.ts.map +1 -0
  31. package/dist/commonjs/models/components/organizationquota.js +71 -0
  32. package/dist/commonjs/models/components/organizationquota.js.map +1 -0
  33. package/dist/commonjs/models/components/quotatier.d.ts +17 -0
  34. package/dist/commonjs/models/components/quotatier.d.ts.map +1 -0
  35. package/dist/commonjs/models/components/quotatier.js +51 -0
  36. package/dist/commonjs/models/components/quotatier.js.map +1 -0
  37. package/dist/commonjs/models/operations/getorganizationquota.d.ts +34 -0
  38. package/dist/commonjs/models/operations/getorganizationquota.d.ts.map +1 -0
  39. package/dist/commonjs/models/operations/getorganizationquota.js +73 -0
  40. package/dist/commonjs/models/operations/getorganizationquota.js.map +1 -0
  41. package/dist/commonjs/models/operations/getusagehistory.d.ts +41 -0
  42. package/dist/commonjs/models/operations/getusagehistory.d.ts.map +1 -0
  43. package/dist/commonjs/models/operations/getusagehistory.js +77 -0
  44. package/dist/commonjs/models/operations/getusagehistory.js.map +1 -0
  45. package/dist/commonjs/models/operations/index.d.ts +2 -0
  46. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  47. package/dist/commonjs/models/operations/index.js +2 -0
  48. package/dist/commonjs/models/operations/index.js.map +1 -1
  49. package/dist/commonjs/sdk/quota.d.ts +19 -0
  50. package/dist/commonjs/sdk/quota.d.ts.map +1 -0
  51. package/dist/commonjs/sdk/quota.js +32 -0
  52. package/dist/commonjs/sdk/quota.js.map +1 -0
  53. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  54. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  55. package/dist/commonjs/sdk/sdk.js +4 -0
  56. package/dist/commonjs/sdk/sdk.js.map +1 -1
  57. package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts +18 -0
  58. package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts.map +1 -0
  59. package/dist/esm/funcs/quotaGetOrganizationQuota.js +88 -0
  60. package/dist/esm/funcs/quotaGetOrganizationQuota.js.map +1 -0
  61. package/dist/esm/funcs/quotaGetUsageHistory.d.ts +18 -0
  62. package/dist/esm/funcs/quotaGetUsageHistory.d.ts.map +1 -0
  63. package/dist/esm/funcs/quotaGetUsageHistory.js +90 -0
  64. package/dist/esm/funcs/quotaGetUsageHistory.js.map +1 -0
  65. package/dist/esm/lib/config.d.ts +3 -3
  66. package/dist/esm/lib/config.js +3 -3
  67. package/dist/esm/lib/config.js.map +1 -1
  68. package/dist/esm/models/components/dailyusage.d.ts +20 -0
  69. package/dist/esm/models/components/dailyusage.d.ts.map +1 -0
  70. package/dist/esm/models/components/dailyusage.js +21 -0
  71. package/dist/esm/models/components/dailyusage.js.map +1 -0
  72. package/dist/esm/models/components/getorganizationquotaresponse.d.ts +17 -0
  73. package/dist/esm/models/components/getorganizationquotaresponse.d.ts.map +1 -0
  74. package/dist/esm/models/components/getorganizationquotaresponse.js +15 -0
  75. package/dist/esm/models/components/getorganizationquotaresponse.js.map +1 -0
  76. package/dist/esm/models/components/getusagehistoryresponse.d.ts +25 -0
  77. package/dist/esm/models/components/getusagehistoryresponse.d.ts.map +1 -0
  78. package/dist/esm/models/components/getusagehistoryresponse.js +24 -0
  79. package/dist/esm/models/components/getusagehistoryresponse.js.map +1 -0
  80. package/dist/esm/models/components/index.d.ts +5 -0
  81. package/dist/esm/models/components/index.d.ts.map +1 -1
  82. package/dist/esm/models/components/index.js +5 -0
  83. package/dist/esm/models/components/index.js.map +1 -1
  84. package/dist/esm/models/components/organizationquota.d.ts +52 -0
  85. package/dist/esm/models/components/organizationquota.d.ts.map +1 -0
  86. package/dist/esm/models/components/organizationquota.js +34 -0
  87. package/dist/esm/models/components/organizationquota.js.map +1 -0
  88. package/dist/esm/models/components/quotatier.d.ts +17 -0
  89. package/dist/esm/models/components/quotatier.d.ts.map +1 -0
  90. package/dist/esm/models/components/quotatier.js +15 -0
  91. package/dist/esm/models/components/quotatier.js.map +1 -0
  92. package/dist/esm/models/operations/getorganizationquota.d.ts +34 -0
  93. package/dist/esm/models/operations/getorganizationquota.d.ts.map +1 -0
  94. package/dist/esm/models/operations/getorganizationquota.js +35 -0
  95. package/dist/esm/models/operations/getorganizationquota.js.map +1 -0
  96. package/dist/esm/models/operations/getusagehistory.d.ts +41 -0
  97. package/dist/esm/models/operations/getusagehistory.d.ts.map +1 -0
  98. package/dist/esm/models/operations/getusagehistory.js +39 -0
  99. package/dist/esm/models/operations/getusagehistory.js.map +1 -0
  100. package/dist/esm/models/operations/index.d.ts +2 -0
  101. package/dist/esm/models/operations/index.d.ts.map +1 -1
  102. package/dist/esm/models/operations/index.js +2 -0
  103. package/dist/esm/models/operations/index.js.map +1 -1
  104. package/dist/esm/sdk/quota.d.ts +19 -0
  105. package/dist/esm/sdk/quota.d.ts.map +1 -0
  106. package/dist/esm/sdk/quota.js +28 -0
  107. package/dist/esm/sdk/quota.js.map +1 -0
  108. package/dist/esm/sdk/sdk.d.ts +3 -0
  109. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  110. package/dist/esm/sdk/sdk.js +4 -0
  111. package/dist/esm/sdk/sdk.js.map +1 -1
  112. package/examples/package-lock.json +1 -1
  113. package/jsr.json +1 -1
  114. package/openapi.json +338 -0
  115. package/package.json +1 -1
  116. package/src/funcs/quotaGetOrganizationQuota.ts +182 -0
  117. package/src/funcs/quotaGetUsageHistory.ts +184 -0
  118. package/src/lib/config.ts +3 -3
  119. package/src/models/components/dailyusage.ts +48 -0
  120. package/src/models/components/getorganizationquotaresponse.ts +41 -0
  121. package/src/models/components/getusagehistoryresponse.ts +58 -0
  122. package/src/models/components/index.ts +5 -0
  123. package/src/models/components/organizationquota.ts +95 -0
  124. package/src/models/components/quotatier.ts +24 -0
  125. package/src/models/operations/getorganizationquota.ts +93 -0
  126. package/src/models/operations/getusagehistory.ts +100 -0
  127. package/src/models/operations/index.ts +2 -0
  128. package/src/sdk/quota.ts +45 -0
  129. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,184 @@
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
+ }
package/src/lib/config.ts CHANGED
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "1.0.0",
68
- sdkVersion: "0.3.12",
69
- genVersion: "2.795.8",
70
- userAgent: "speakeasy-sdk/typescript 0.3.12 2.795.8 1.0.0 @factify/sdk",
68
+ sdkVersion: "0.3.13-rc.1",
69
+ genVersion: "2.799.0",
70
+ userAgent: "speakeasy-sdk/typescript 0.3.13-rc.1 2.799.0 1.0.0 @factify/sdk",
71
71
  } as const;
@@ -0,0 +1,48 @@
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
+ }
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,58 @@
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
+ }
@@ -11,13 +11,16 @@ export * from "./createdocumentresponse.js";
11
11
  export * from "./createorganizationrequest.js";
12
12
  export * from "./createorganizationresponse.js";
13
13
  export * from "./createversionrequest.js";
14
+ export * from "./dailyusage.js";
14
15
  export * from "./document.js";
15
16
  export * from "./documentpolicy.js";
16
17
  export * from "./empty.js";
17
18
  export * from "./error.js";
18
19
  export * from "./generateentrypageresponse.js";
19
20
  export * from "./getdocumentresponse.js";
21
+ export * from "./getorganizationquotaresponse.js";
20
22
  export * from "./getorganizationresponse.js";
23
+ export * from "./getusagehistoryresponse.js";
21
24
  export * from "./httpmetadata.js";
22
25
  export * from "./listapikeysresponse.js";
23
26
  export * from "./listdocumentpoliciesresponse.js";
@@ -25,9 +28,11 @@ export * from "./listdocumentsresponse.js";
25
28
  export * from "./listorganizationsresponse.js";
26
29
  export * from "./listversionsresponse.js";
27
30
  export * from "./organization.js";
31
+ export * from "./organizationquota.js";
28
32
  export * from "./pagination.js";
29
33
  export * from "./policy.js";
30
34
  export * from "./processingstatus.js";
35
+ export * from "./quotatier.js";
31
36
  export * from "./revokeapikeyresponse.js";
32
37
  export * from "./security.js";
33
38
  export * from "./updatedocumentresponse.js";
@@ -0,0 +1,95 @@
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
+ }
@@ -0,0 +1,24 @@
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);
@@ -0,0 +1,93 @@
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
+ }
@@ -0,0 +1,100 @@
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
+ }
@@ -11,6 +11,8 @@ export * from "./detachdocumentpolicy.js";
11
11
  export * from "./generatedocumententrypage.js";
12
12
  export * from "./getdocument.js";
13
13
  export * from "./getorganization.js";
14
+ export * from "./getorganizationquota.js";
15
+ export * from "./getusagehistory.js";
14
16
  export * from "./getversion.js";
15
17
  export * from "./listapikeys.js";
16
18
  export * from "./listdocumentpolicies.js";