@factify/sdk 0.3.11 → 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 (138) 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/createorganizationrequest.d.ts +2 -2
  14. package/dist/commonjs/models/components/createorganizationrequest.d.ts.map +1 -1
  15. package/dist/commonjs/models/components/createorganizationrequest.js +1 -1
  16. package/dist/commonjs/models/components/createorganizationrequest.js.map +1 -1
  17. package/dist/commonjs/models/components/dailyusage.d.ts +20 -0
  18. package/dist/commonjs/models/components/dailyusage.d.ts.map +1 -0
  19. package/dist/commonjs/models/components/dailyusage.js +58 -0
  20. package/dist/commonjs/models/components/dailyusage.js.map +1 -0
  21. package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts +17 -0
  22. package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts.map +1 -0
  23. package/dist/commonjs/models/components/getorganizationquotaresponse.js +52 -0
  24. package/dist/commonjs/models/components/getorganizationquotaresponse.js.map +1 -0
  25. package/dist/commonjs/models/components/getusagehistoryresponse.d.ts +25 -0
  26. package/dist/commonjs/models/components/getusagehistoryresponse.d.ts.map +1 -0
  27. package/dist/commonjs/models/components/getusagehistoryresponse.js +61 -0
  28. package/dist/commonjs/models/components/getusagehistoryresponse.js.map +1 -0
  29. package/dist/commonjs/models/components/index.d.ts +5 -0
  30. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  31. package/dist/commonjs/models/components/index.js +5 -0
  32. package/dist/commonjs/models/components/index.js.map +1 -1
  33. package/dist/commonjs/models/components/organizationquota.d.ts +52 -0
  34. package/dist/commonjs/models/components/organizationquota.d.ts.map +1 -0
  35. package/dist/commonjs/models/components/organizationquota.js +71 -0
  36. package/dist/commonjs/models/components/organizationquota.js.map +1 -0
  37. package/dist/commonjs/models/components/quotatier.d.ts +17 -0
  38. package/dist/commonjs/models/components/quotatier.d.ts.map +1 -0
  39. package/dist/commonjs/models/components/quotatier.js +51 -0
  40. package/dist/commonjs/models/components/quotatier.js.map +1 -0
  41. package/dist/commonjs/models/operations/getorganizationquota.d.ts +34 -0
  42. package/dist/commonjs/models/operations/getorganizationquota.d.ts.map +1 -0
  43. package/dist/commonjs/models/operations/getorganizationquota.js +73 -0
  44. package/dist/commonjs/models/operations/getorganizationquota.js.map +1 -0
  45. package/dist/commonjs/models/operations/getusagehistory.d.ts +41 -0
  46. package/dist/commonjs/models/operations/getusagehistory.d.ts.map +1 -0
  47. package/dist/commonjs/models/operations/getusagehistory.js +77 -0
  48. package/dist/commonjs/models/operations/getusagehistory.js.map +1 -0
  49. package/dist/commonjs/models/operations/index.d.ts +2 -0
  50. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  51. package/dist/commonjs/models/operations/index.js +2 -0
  52. package/dist/commonjs/models/operations/index.js.map +1 -1
  53. package/dist/commonjs/sdk/quota.d.ts +19 -0
  54. package/dist/commonjs/sdk/quota.d.ts.map +1 -0
  55. package/dist/commonjs/sdk/quota.js +32 -0
  56. package/dist/commonjs/sdk/quota.js.map +1 -0
  57. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  58. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  59. package/dist/commonjs/sdk/sdk.js +4 -0
  60. package/dist/commonjs/sdk/sdk.js.map +1 -1
  61. package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts +18 -0
  62. package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts.map +1 -0
  63. package/dist/esm/funcs/quotaGetOrganizationQuota.js +88 -0
  64. package/dist/esm/funcs/quotaGetOrganizationQuota.js.map +1 -0
  65. package/dist/esm/funcs/quotaGetUsageHistory.d.ts +18 -0
  66. package/dist/esm/funcs/quotaGetUsageHistory.d.ts.map +1 -0
  67. package/dist/esm/funcs/quotaGetUsageHistory.js +90 -0
  68. package/dist/esm/funcs/quotaGetUsageHistory.js.map +1 -0
  69. package/dist/esm/lib/config.d.ts +3 -3
  70. package/dist/esm/lib/config.js +3 -3
  71. package/dist/esm/lib/config.js.map +1 -1
  72. package/dist/esm/models/components/createorganizationrequest.d.ts +2 -2
  73. package/dist/esm/models/components/createorganizationrequest.d.ts.map +1 -1
  74. package/dist/esm/models/components/createorganizationrequest.js +1 -1
  75. package/dist/esm/models/components/createorganizationrequest.js.map +1 -1
  76. package/dist/esm/models/components/dailyusage.d.ts +20 -0
  77. package/dist/esm/models/components/dailyusage.d.ts.map +1 -0
  78. package/dist/esm/models/components/dailyusage.js +21 -0
  79. package/dist/esm/models/components/dailyusage.js.map +1 -0
  80. package/dist/esm/models/components/getorganizationquotaresponse.d.ts +17 -0
  81. package/dist/esm/models/components/getorganizationquotaresponse.d.ts.map +1 -0
  82. package/dist/esm/models/components/getorganizationquotaresponse.js +15 -0
  83. package/dist/esm/models/components/getorganizationquotaresponse.js.map +1 -0
  84. package/dist/esm/models/components/getusagehistoryresponse.d.ts +25 -0
  85. package/dist/esm/models/components/getusagehistoryresponse.d.ts.map +1 -0
  86. package/dist/esm/models/components/getusagehistoryresponse.js +24 -0
  87. package/dist/esm/models/components/getusagehistoryresponse.js.map +1 -0
  88. package/dist/esm/models/components/index.d.ts +5 -0
  89. package/dist/esm/models/components/index.d.ts.map +1 -1
  90. package/dist/esm/models/components/index.js +5 -0
  91. package/dist/esm/models/components/index.js.map +1 -1
  92. package/dist/esm/models/components/organizationquota.d.ts +52 -0
  93. package/dist/esm/models/components/organizationquota.d.ts.map +1 -0
  94. package/dist/esm/models/components/organizationquota.js +34 -0
  95. package/dist/esm/models/components/organizationquota.js.map +1 -0
  96. package/dist/esm/models/components/quotatier.d.ts +17 -0
  97. package/dist/esm/models/components/quotatier.d.ts.map +1 -0
  98. package/dist/esm/models/components/quotatier.js +15 -0
  99. package/dist/esm/models/components/quotatier.js.map +1 -0
  100. package/dist/esm/models/operations/getorganizationquota.d.ts +34 -0
  101. package/dist/esm/models/operations/getorganizationquota.d.ts.map +1 -0
  102. package/dist/esm/models/operations/getorganizationquota.js +35 -0
  103. package/dist/esm/models/operations/getorganizationquota.js.map +1 -0
  104. package/dist/esm/models/operations/getusagehistory.d.ts +41 -0
  105. package/dist/esm/models/operations/getusagehistory.d.ts.map +1 -0
  106. package/dist/esm/models/operations/getusagehistory.js +39 -0
  107. package/dist/esm/models/operations/getusagehistory.js.map +1 -0
  108. package/dist/esm/models/operations/index.d.ts +2 -0
  109. package/dist/esm/models/operations/index.d.ts.map +1 -1
  110. package/dist/esm/models/operations/index.js +2 -0
  111. package/dist/esm/models/operations/index.js.map +1 -1
  112. package/dist/esm/sdk/quota.d.ts +19 -0
  113. package/dist/esm/sdk/quota.d.ts.map +1 -0
  114. package/dist/esm/sdk/quota.js +28 -0
  115. package/dist/esm/sdk/quota.js.map +1 -0
  116. package/dist/esm/sdk/sdk.d.ts +3 -0
  117. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  118. package/dist/esm/sdk/sdk.js +4 -0
  119. package/dist/esm/sdk/sdk.js.map +1 -1
  120. package/examples/package-lock.json +1 -1
  121. package/jsr.json +1 -1
  122. package/openapi.json +483 -18
  123. package/package.json +1 -1
  124. package/src/funcs/quotaGetOrganizationQuota.ts +182 -0
  125. package/src/funcs/quotaGetUsageHistory.ts +184 -0
  126. package/src/lib/config.ts +3 -3
  127. package/src/models/components/createorganizationrequest.ts +3 -3
  128. package/src/models/components/dailyusage.ts +48 -0
  129. package/src/models/components/getorganizationquotaresponse.ts +41 -0
  130. package/src/models/components/getusagehistoryresponse.ts +58 -0
  131. package/src/models/components/index.ts +5 -0
  132. package/src/models/components/organizationquota.ts +95 -0
  133. package/src/models/components/quotatier.ts +24 -0
  134. package/src/models/operations/getorganizationquota.ts +93 -0
  135. package/src/models/operations/getusagehistory.ts +100 -0
  136. package/src/models/operations/index.ts +2 -0
  137. package/src/sdk/quota.ts +45 -0
  138. package/src/sdk/sdk.ts +6 -0
@@ -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";
@@ -0,0 +1,45 @@
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
+ }
package/src/sdk/sdk.ts CHANGED
@@ -8,6 +8,7 @@ import { Documents } from "./documents.js";
8
8
  import { EntryPages } from "./entrypages.js";
9
9
  import { Organizations } from "./organizations.js";
10
10
  import { Policies } from "./policies.js";
11
+ import { Quota } from "./quota.js";
11
12
  import { Versions } from "./versions.js";
12
13
 
13
14
  export class Factify extends ClientSDK {
@@ -40,4 +41,9 @@ export class Factify extends ClientSDK {
40
41
  get organizations(): Organizations {
41
42
  return (this._organizations ??= new Organizations(this._options));
42
43
  }
44
+
45
+ private _quota?: Quota;
46
+ get quota(): Quota {
47
+ return (this._quota ??= new Quota(this._options));
48
+ }
43
49
  }