@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.
- package/README.md +7 -0
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.d.ts +18 -0
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.d.ts.map +1 -0
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.js +124 -0
- package/dist/commonjs/funcs/quotaGetOrganizationQuota.js.map +1 -0
- package/dist/commonjs/funcs/quotaGetUsageHistory.d.ts +18 -0
- package/dist/commonjs/funcs/quotaGetUsageHistory.d.ts.map +1 -0
- package/dist/commonjs/funcs/quotaGetUsageHistory.js +126 -0
- package/dist/commonjs/funcs/quotaGetUsageHistory.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/components/dailyusage.d.ts +20 -0
- package/dist/commonjs/models/components/dailyusage.d.ts.map +1 -0
- package/dist/commonjs/models/components/dailyusage.js +58 -0
- package/dist/commonjs/models/components/dailyusage.js.map +1 -0
- package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts +17 -0
- package/dist/commonjs/models/components/getorganizationquotaresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/getorganizationquotaresponse.js +52 -0
- package/dist/commonjs/models/components/getorganizationquotaresponse.js.map +1 -0
- package/dist/commonjs/models/components/getusagehistoryresponse.d.ts +25 -0
- package/dist/commonjs/models/components/getusagehistoryresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/getusagehistoryresponse.js +61 -0
- package/dist/commonjs/models/components/getusagehistoryresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +5 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +5 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/organizationquota.d.ts +52 -0
- package/dist/commonjs/models/components/organizationquota.d.ts.map +1 -0
- package/dist/commonjs/models/components/organizationquota.js +71 -0
- package/dist/commonjs/models/components/organizationquota.js.map +1 -0
- package/dist/commonjs/models/components/quotatier.d.ts +17 -0
- package/dist/commonjs/models/components/quotatier.d.ts.map +1 -0
- package/dist/commonjs/models/components/quotatier.js +51 -0
- package/dist/commonjs/models/components/quotatier.js.map +1 -0
- package/dist/commonjs/models/operations/getorganizationquota.d.ts +34 -0
- package/dist/commonjs/models/operations/getorganizationquota.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getorganizationquota.js +73 -0
- package/dist/commonjs/models/operations/getorganizationquota.js.map +1 -0
- package/dist/commonjs/models/operations/getusagehistory.d.ts +41 -0
- package/dist/commonjs/models/operations/getusagehistory.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getusagehistory.js +77 -0
- package/dist/commonjs/models/operations/getusagehistory.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/sdk/quota.d.ts +19 -0
- package/dist/commonjs/sdk/quota.d.ts.map +1 -0
- package/dist/commonjs/sdk/quota.js +32 -0
- package/dist/commonjs/sdk/quota.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts +18 -0
- package/dist/esm/funcs/quotaGetOrganizationQuota.d.ts.map +1 -0
- package/dist/esm/funcs/quotaGetOrganizationQuota.js +88 -0
- package/dist/esm/funcs/quotaGetOrganizationQuota.js.map +1 -0
- package/dist/esm/funcs/quotaGetUsageHistory.d.ts +18 -0
- package/dist/esm/funcs/quotaGetUsageHistory.d.ts.map +1 -0
- package/dist/esm/funcs/quotaGetUsageHistory.js +90 -0
- package/dist/esm/funcs/quotaGetUsageHistory.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/components/dailyusage.d.ts +20 -0
- package/dist/esm/models/components/dailyusage.d.ts.map +1 -0
- package/dist/esm/models/components/dailyusage.js +21 -0
- package/dist/esm/models/components/dailyusage.js.map +1 -0
- package/dist/esm/models/components/getorganizationquotaresponse.d.ts +17 -0
- package/dist/esm/models/components/getorganizationquotaresponse.d.ts.map +1 -0
- package/dist/esm/models/components/getorganizationquotaresponse.js +15 -0
- package/dist/esm/models/components/getorganizationquotaresponse.js.map +1 -0
- package/dist/esm/models/components/getusagehistoryresponse.d.ts +25 -0
- package/dist/esm/models/components/getusagehistoryresponse.d.ts.map +1 -0
- package/dist/esm/models/components/getusagehistoryresponse.js +24 -0
- package/dist/esm/models/components/getusagehistoryresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +5 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +5 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/organizationquota.d.ts +52 -0
- package/dist/esm/models/components/organizationquota.d.ts.map +1 -0
- package/dist/esm/models/components/organizationquota.js +34 -0
- package/dist/esm/models/components/organizationquota.js.map +1 -0
- package/dist/esm/models/components/quotatier.d.ts +17 -0
- package/dist/esm/models/components/quotatier.d.ts.map +1 -0
- package/dist/esm/models/components/quotatier.js +15 -0
- package/dist/esm/models/components/quotatier.js.map +1 -0
- package/dist/esm/models/operations/getorganizationquota.d.ts +34 -0
- package/dist/esm/models/operations/getorganizationquota.d.ts.map +1 -0
- package/dist/esm/models/operations/getorganizationquota.js +35 -0
- package/dist/esm/models/operations/getorganizationquota.js.map +1 -0
- package/dist/esm/models/operations/getusagehistory.d.ts +41 -0
- package/dist/esm/models/operations/getusagehistory.d.ts.map +1 -0
- package/dist/esm/models/operations/getusagehistory.js +39 -0
- package/dist/esm/models/operations/getusagehistory.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/sdk/quota.d.ts +19 -0
- package/dist/esm/sdk/quota.d.ts.map +1 -0
- package/dist/esm/sdk/quota.js +28 -0
- package/dist/esm/sdk/quota.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/openapi.json +338 -0
- package/package.json +1 -1
- package/src/funcs/quotaGetOrganizationQuota.ts +182 -0
- package/src/funcs/quotaGetUsageHistory.ts +184 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/dailyusage.ts +48 -0
- package/src/models/components/getorganizationquotaresponse.ts +41 -0
- package/src/models/components/getusagehistoryresponse.ts +58 -0
- package/src/models/components/index.ts +5 -0
- package/src/models/components/organizationquota.ts +95 -0
- package/src/models/components/quotatier.ts +24 -0
- package/src/models/operations/getorganizationquota.ts +93 -0
- package/src/models/operations/getusagehistory.ts +100 -0
- package/src/models/operations/index.ts +2 -0
- package/src/sdk/quota.ts +45 -0
- package/src/sdk/sdk.ts +6 -0
package/openapi.json
CHANGED
|
@@ -479,6 +479,27 @@
|
|
|
479
479
|
"title": "CreateVersionRequest",
|
|
480
480
|
"type": "object"
|
|
481
481
|
},
|
|
482
|
+
"DailyUsage": {
|
|
483
|
+
"additionalProperties": false,
|
|
484
|
+
"description": "DailyUsage represents usage for a single day.",
|
|
485
|
+
"properties": {
|
|
486
|
+
"date": {
|
|
487
|
+
"description": "The date (YYYY-MM-DD format).",
|
|
488
|
+
"example": "2026-01-15",
|
|
489
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|
|
490
|
+
"title": "date",
|
|
491
|
+
"type": "string"
|
|
492
|
+
},
|
|
493
|
+
"request_count": {
|
|
494
|
+
"description": "Request count for this day.",
|
|
495
|
+
"format": "int32",
|
|
496
|
+
"title": "request_count",
|
|
497
|
+
"type": "integer"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
"title": "DailyUsage",
|
|
501
|
+
"type": "object"
|
|
502
|
+
},
|
|
482
503
|
"DetachPolicyRequest": {
|
|
483
504
|
"additionalProperties": false,
|
|
484
505
|
"description": "DetachPolicyRequest identifies a policy to detach from a document.",
|
|
@@ -730,6 +751,35 @@
|
|
|
730
751
|
"title": "GetDocumentResponse",
|
|
731
752
|
"type": "object"
|
|
732
753
|
},
|
|
754
|
+
"GetOrganizationQuotaRequest": {
|
|
755
|
+
"additionalProperties": false,
|
|
756
|
+
"description": "GetOrganizationQuotaRequest is a request to get quota status.",
|
|
757
|
+
"properties": {
|
|
758
|
+
"organization_id": {
|
|
759
|
+
"description": "Optional: organization ID to query. If not provided, uses the caller's organization.\n Only admins can query other organizations.",
|
|
760
|
+
"example": "org_01h2xcejqtf2nbrexx3vqjhp41",
|
|
761
|
+
"nullable": true,
|
|
762
|
+
"pattern": "^org_[0-9a-hjkmnp-tv-z]{26}$",
|
|
763
|
+
"title": "organization_id",
|
|
764
|
+
"type": "string"
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
"title": "GetOrganizationQuotaRequest",
|
|
768
|
+
"type": "object"
|
|
769
|
+
},
|
|
770
|
+
"GetOrganizationQuotaResponse": {
|
|
771
|
+
"additionalProperties": false,
|
|
772
|
+
"description": "GetOrganizationQuotaResponse returns the quota status.",
|
|
773
|
+
"properties": {
|
|
774
|
+
"quota": {
|
|
775
|
+
"$ref": "#/components/schemas/OrganizationQuota",
|
|
776
|
+
"description": "The organization's quota status.",
|
|
777
|
+
"title": "quota"
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
"title": "GetOrganizationQuotaResponse",
|
|
781
|
+
"type": "object"
|
|
782
|
+
},
|
|
733
783
|
"GetOrganizationRequest": {
|
|
734
784
|
"additionalProperties": false,
|
|
735
785
|
"description": "GetOrganizationRequest identifies an organization to retrieve.",
|
|
@@ -763,6 +813,69 @@
|
|
|
763
813
|
"title": "GetOrganizationResponse",
|
|
764
814
|
"type": "object"
|
|
765
815
|
},
|
|
816
|
+
"GetUsageHistoryRequest": {
|
|
817
|
+
"additionalProperties": false,
|
|
818
|
+
"description": "GetUsageHistoryRequest is a request to get usage history.\ndate_range_valid // end_date must be after start_date\n",
|
|
819
|
+
"properties": {
|
|
820
|
+
"end_date": {
|
|
821
|
+
"description": "End date for the history (exclusive, YYYY-MM-DD format).",
|
|
822
|
+
"example": "2026-02-01",
|
|
823
|
+
"maxLength": 10,
|
|
824
|
+
"minLength": 10,
|
|
825
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|
|
826
|
+
"title": "end_date",
|
|
827
|
+
"type": "string"
|
|
828
|
+
},
|
|
829
|
+
"organization_id": {
|
|
830
|
+
"description": "Optional: organization ID to query. If not provided, uses the caller's organization.",
|
|
831
|
+
"example": "org_01h2xcejqtf2nbrexx3vqjhp41",
|
|
832
|
+
"nullable": true,
|
|
833
|
+
"pattern": "^org_[0-9a-hjkmnp-tv-z]{26}$",
|
|
834
|
+
"title": "organization_id",
|
|
835
|
+
"type": "string"
|
|
836
|
+
},
|
|
837
|
+
"start_date": {
|
|
838
|
+
"description": "Start date for the history (inclusive, YYYY-MM-DD format).",
|
|
839
|
+
"example": "2026-01-01",
|
|
840
|
+
"maxLength": 10,
|
|
841
|
+
"minLength": 10,
|
|
842
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|
|
843
|
+
"title": "start_date",
|
|
844
|
+
"type": "string"
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
"title": "GetUsageHistoryRequest",
|
|
848
|
+
"type": "object"
|
|
849
|
+
},
|
|
850
|
+
"GetUsageHistoryResponse": {
|
|
851
|
+
"additionalProperties": false,
|
|
852
|
+
"description": "GetUsageHistoryResponse returns usage history.",
|
|
853
|
+
"properties": {
|
|
854
|
+
"daily_usage": {
|
|
855
|
+
"description": "Daily usage records.",
|
|
856
|
+
"items": {
|
|
857
|
+
"$ref": "#/components/schemas/DailyUsage"
|
|
858
|
+
},
|
|
859
|
+
"title": "daily_usage",
|
|
860
|
+
"type": "array"
|
|
861
|
+
},
|
|
862
|
+
"organization_id": {
|
|
863
|
+
"description": "The organization ID.",
|
|
864
|
+
"example": "org_01h2xcejqtf2nbrexx3vqjhp41",
|
|
865
|
+
"pattern": "^org_[0-9a-hjkmnp-tv-z]{26}$",
|
|
866
|
+
"title": "organization_id",
|
|
867
|
+
"type": "string"
|
|
868
|
+
},
|
|
869
|
+
"total_requests": {
|
|
870
|
+
"description": "Total requests in the period.",
|
|
871
|
+
"format": "int32",
|
|
872
|
+
"title": "total_requests",
|
|
873
|
+
"type": "integer"
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
"title": "GetUsageHistoryResponse",
|
|
877
|
+
"type": "object"
|
|
878
|
+
},
|
|
766
879
|
"GetVersionRequest": {
|
|
767
880
|
"additionalProperties": false,
|
|
768
881
|
"description": "GetVersionRequest identifies a specific version to retrieve.",
|
|
@@ -1095,6 +1208,67 @@
|
|
|
1095
1208
|
"title": "Organization",
|
|
1096
1209
|
"type": "object"
|
|
1097
1210
|
},
|
|
1211
|
+
"OrganizationQuota": {
|
|
1212
|
+
"additionalProperties": false,
|
|
1213
|
+
"description": "OrganizationQuota represents the quota status for an organization.",
|
|
1214
|
+
"properties": {
|
|
1215
|
+
"current_usage": {
|
|
1216
|
+
"description": "Current usage in the billing period.",
|
|
1217
|
+
"format": "int32",
|
|
1218
|
+
"title": "current_usage",
|
|
1219
|
+
"type": "integer"
|
|
1220
|
+
},
|
|
1221
|
+
"effective_limit": {
|
|
1222
|
+
"description": "The effective monthly limit (considers custom_limit if set).",
|
|
1223
|
+
"format": "int32",
|
|
1224
|
+
"title": "effective_limit",
|
|
1225
|
+
"type": "integer"
|
|
1226
|
+
},
|
|
1227
|
+
"is_exceeded": {
|
|
1228
|
+
"description": "Whether quota is exceeded.",
|
|
1229
|
+
"title": "is_exceeded",
|
|
1230
|
+
"type": "boolean"
|
|
1231
|
+
},
|
|
1232
|
+
"organization_id": {
|
|
1233
|
+
"description": "The organization ID.\n Pattern: org_[0-9a-hjkmnp-tv-z]{26}",
|
|
1234
|
+
"example": "org_01h2xcejqtf2nbrexx3vqjhp41",
|
|
1235
|
+
"pattern": "^org_[0-9a-hjkmnp-tv-z]{26}$",
|
|
1236
|
+
"title": "organization_id",
|
|
1237
|
+
"type": "string"
|
|
1238
|
+
},
|
|
1239
|
+
"period_start": {
|
|
1240
|
+
"description": "Start of current billing period.",
|
|
1241
|
+
"format": "date-time",
|
|
1242
|
+
"title": "period_start",
|
|
1243
|
+
"type": "string"
|
|
1244
|
+
},
|
|
1245
|
+
"remaining": {
|
|
1246
|
+
"description": "Remaining requests in the billing period.",
|
|
1247
|
+
"format": "int32",
|
|
1248
|
+
"title": "remaining",
|
|
1249
|
+
"type": "integer"
|
|
1250
|
+
},
|
|
1251
|
+
"reset_at": {
|
|
1252
|
+
"description": "When the quota resets (start of next billing period).",
|
|
1253
|
+
"format": "date-time",
|
|
1254
|
+
"title": "reset_at",
|
|
1255
|
+
"type": "string"
|
|
1256
|
+
},
|
|
1257
|
+
"tier": {
|
|
1258
|
+
"$ref": "#/components/schemas/QuotaTier",
|
|
1259
|
+
"description": "The quota tier (free or custom).",
|
|
1260
|
+
"title": "tier"
|
|
1261
|
+
},
|
|
1262
|
+
"usage_percent": {
|
|
1263
|
+
"description": "Usage as a percentage (0-100+).",
|
|
1264
|
+
"format": "int32",
|
|
1265
|
+
"title": "usage_percent",
|
|
1266
|
+
"type": "integer"
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
"title": "OrganizationQuota",
|
|
1270
|
+
"type": "object"
|
|
1271
|
+
},
|
|
1098
1272
|
"Pagination": {
|
|
1099
1273
|
"additionalProperties": false,
|
|
1100
1274
|
"description": "Pagination contains cursor-based pagination metadata.\n Follows Google AIP-158 for pagination field naming.",
|
|
@@ -1160,6 +1334,16 @@
|
|
|
1160
1334
|
"failed"
|
|
1161
1335
|
]
|
|
1162
1336
|
},
|
|
1337
|
+
"QuotaTier": {
|
|
1338
|
+
"description": "QuotaTier represents the organization's quota tier.",
|
|
1339
|
+
"enum": [
|
|
1340
|
+
"QUOTA_TIER_UNSPECIFIED",
|
|
1341
|
+
"QUOTA_TIER_FREE",
|
|
1342
|
+
"QUOTA_TIER_CUSTOM"
|
|
1343
|
+
],
|
|
1344
|
+
"title": "QuotaTier",
|
|
1345
|
+
"type": "string"
|
|
1346
|
+
},
|
|
1163
1347
|
"RevokeApiKeyRequest": {
|
|
1164
1348
|
"additionalProperties": false,
|
|
1165
1349
|
"description": "RevokeApiKeyRequest identifies an API key to revoke.",
|
|
@@ -2746,6 +2930,156 @@
|
|
|
2746
2930
|
]
|
|
2747
2931
|
}
|
|
2748
2932
|
},
|
|
2933
|
+
"/v1beta/quota": {
|
|
2934
|
+
"get": {
|
|
2935
|
+
"description": "Returns the current quota status for an organization including usage, limits, tier, and reset date.",
|
|
2936
|
+
"operationId": "getOrganizationQuota",
|
|
2937
|
+
"parameters": [
|
|
2938
|
+
{
|
|
2939
|
+
"description": "Optional: organization ID to query. If not provided, uses the caller's organization.\n Only admins can query other organizations.",
|
|
2940
|
+
"in": "query",
|
|
2941
|
+
"name": "organization_id",
|
|
2942
|
+
"schema": {
|
|
2943
|
+
"description": "Optional: organization ID to query. If not provided, uses the caller's organization.\n Only admins can query other organizations.",
|
|
2944
|
+
"example": "org_01h2xcejqtf2nbrexx3vqjhp41",
|
|
2945
|
+
"pattern": "^org_[0-9a-hjkmnp-tv-z]{26}$",
|
|
2946
|
+
"title": "organization_id",
|
|
2947
|
+
"type": "string"
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
],
|
|
2951
|
+
"responses": {
|
|
2952
|
+
"200": {
|
|
2953
|
+
"content": {
|
|
2954
|
+
"application/json": {
|
|
2955
|
+
"schema": {
|
|
2956
|
+
"$ref": "#/components/schemas/GetOrganizationQuotaResponse"
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
},
|
|
2960
|
+
"description": "Success"
|
|
2961
|
+
},
|
|
2962
|
+
"400": {
|
|
2963
|
+
"$ref": "#/components/responses/BadRequest"
|
|
2964
|
+
},
|
|
2965
|
+
"401": {
|
|
2966
|
+
"$ref": "#/components/responses/Unauthorized"
|
|
2967
|
+
},
|
|
2968
|
+
"403": {
|
|
2969
|
+
"$ref": "#/components/responses/Forbidden"
|
|
2970
|
+
},
|
|
2971
|
+
"404": {
|
|
2972
|
+
"$ref": "#/components/responses/NotFound"
|
|
2973
|
+
},
|
|
2974
|
+
"429": {
|
|
2975
|
+
"$ref": "#/components/responses/RateLimitExceeded"
|
|
2976
|
+
},
|
|
2977
|
+
"500": {
|
|
2978
|
+
"$ref": "#/components/responses/InternalServerError"
|
|
2979
|
+
}
|
|
2980
|
+
},
|
|
2981
|
+
"summary": "Get organization quota status",
|
|
2982
|
+
"tags": [
|
|
2983
|
+
"Quota"
|
|
2984
|
+
],
|
|
2985
|
+
"x-codeSamples": [
|
|
2986
|
+
{
|
|
2987
|
+
"lang": "typescript",
|
|
2988
|
+
"label": "getOrganizationQuota",
|
|
2989
|
+
"source": "import { Factify } from \"@factify/sdk\";\n\nconst factify = new Factify({\n bearerAuth: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await factify.quota.getOrganizationQuota({\n organizationId: \"org_01h2xcejqtf2nbrexx3vqjhp41\",\n });\n\n console.log(result);\n}\n\nrun();"
|
|
2990
|
+
}
|
|
2991
|
+
]
|
|
2992
|
+
}
|
|
2993
|
+
},
|
|
2994
|
+
"/v1beta/quota/usage": {
|
|
2995
|
+
"get": {
|
|
2996
|
+
"description": "Returns daily usage records for an organization within a specified date range.",
|
|
2997
|
+
"operationId": "getUsageHistory",
|
|
2998
|
+
"parameters": [
|
|
2999
|
+
{
|
|
3000
|
+
"description": "Optional: organization ID to query. If not provided, uses the caller's organization.",
|
|
3001
|
+
"in": "query",
|
|
3002
|
+
"name": "organization_id",
|
|
3003
|
+
"schema": {
|
|
3004
|
+
"description": "Optional: organization ID to query. If not provided, uses the caller's organization.",
|
|
3005
|
+
"example": "org_01h2xcejqtf2nbrexx3vqjhp41",
|
|
3006
|
+
"pattern": "^org_[0-9a-hjkmnp-tv-z]{26}$",
|
|
3007
|
+
"title": "organization_id",
|
|
3008
|
+
"type": "string"
|
|
3009
|
+
}
|
|
3010
|
+
},
|
|
3011
|
+
{
|
|
3012
|
+
"description": "Start date for the history (inclusive, YYYY-MM-DD format).",
|
|
3013
|
+
"in": "query",
|
|
3014
|
+
"name": "start_date",
|
|
3015
|
+
"schema": {
|
|
3016
|
+
"description": "Start date for the history (inclusive, YYYY-MM-DD format).",
|
|
3017
|
+
"example": "2026-01-01",
|
|
3018
|
+
"maxLength": 10,
|
|
3019
|
+
"minLength": 10,
|
|
3020
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|
|
3021
|
+
"title": "start_date",
|
|
3022
|
+
"type": "string"
|
|
3023
|
+
}
|
|
3024
|
+
},
|
|
3025
|
+
{
|
|
3026
|
+
"description": "End date for the history (exclusive, YYYY-MM-DD format).",
|
|
3027
|
+
"in": "query",
|
|
3028
|
+
"name": "end_date",
|
|
3029
|
+
"schema": {
|
|
3030
|
+
"description": "End date for the history (exclusive, YYYY-MM-DD format).",
|
|
3031
|
+
"example": "2026-02-01",
|
|
3032
|
+
"maxLength": 10,
|
|
3033
|
+
"minLength": 10,
|
|
3034
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|
|
3035
|
+
"title": "end_date",
|
|
3036
|
+
"type": "string"
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
],
|
|
3040
|
+
"responses": {
|
|
3041
|
+
"200": {
|
|
3042
|
+
"content": {
|
|
3043
|
+
"application/json": {
|
|
3044
|
+
"schema": {
|
|
3045
|
+
"$ref": "#/components/schemas/GetUsageHistoryResponse"
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
},
|
|
3049
|
+
"description": "Success"
|
|
3050
|
+
},
|
|
3051
|
+
"400": {
|
|
3052
|
+
"$ref": "#/components/responses/BadRequest"
|
|
3053
|
+
},
|
|
3054
|
+
"401": {
|
|
3055
|
+
"$ref": "#/components/responses/Unauthorized"
|
|
3056
|
+
},
|
|
3057
|
+
"403": {
|
|
3058
|
+
"$ref": "#/components/responses/Forbidden"
|
|
3059
|
+
},
|
|
3060
|
+
"404": {
|
|
3061
|
+
"$ref": "#/components/responses/NotFound"
|
|
3062
|
+
},
|
|
3063
|
+
"429": {
|
|
3064
|
+
"$ref": "#/components/responses/RateLimitExceeded"
|
|
3065
|
+
},
|
|
3066
|
+
"500": {
|
|
3067
|
+
"$ref": "#/components/responses/InternalServerError"
|
|
3068
|
+
}
|
|
3069
|
+
},
|
|
3070
|
+
"summary": "Get usage history",
|
|
3071
|
+
"tags": [
|
|
3072
|
+
"Quota"
|
|
3073
|
+
],
|
|
3074
|
+
"x-codeSamples": [
|
|
3075
|
+
{
|
|
3076
|
+
"lang": "typescript",
|
|
3077
|
+
"label": "getUsageHistory",
|
|
3078
|
+
"source": "import { Factify } from \"@factify/sdk\";\n\nconst factify = new Factify({\n bearerAuth: \"\u003cYOUR_BEARER_TOKEN_HERE\u003e\",\n});\n\nasync function run() {\n const result = await factify.quota.getUsageHistory({\n organizationId: \"org_01h2xcejqtf2nbrexx3vqjhp41\",\n startDate: \"2026-01-01\",\n endDate: \"2026-02-01\",\n });\n\n console.log(result);\n}\n\nrun();"
|
|
3079
|
+
}
|
|
3080
|
+
]
|
|
3081
|
+
}
|
|
3082
|
+
},
|
|
2749
3083
|
"/v1beta/versions/{version_id}": {
|
|
2750
3084
|
"get": {
|
|
2751
3085
|
"description": "Retrieve a specific version by ID.",
|
|
@@ -2929,6 +3263,10 @@
|
|
|
2929
3263
|
"description": "Generate and manage API keys for authentication.",
|
|
2930
3264
|
"name": "API Keys"
|
|
2931
3265
|
},
|
|
3266
|
+
{
|
|
3267
|
+
"description": "Query API usage and quota information for your organization.",
|
|
3268
|
+
"name": "Quota"
|
|
3269
|
+
},
|
|
2932
3270
|
{
|
|
2933
3271
|
"description": "Attach and manage access policies for documents.",
|
|
2934
3272
|
"name": "Policies"
|
package/package.json
CHANGED
|
@@ -0,0 +1,182 @@
|
|
|
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 organization quota status
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Returns the current quota status for an organization including usage, limits, tier, and reset date.
|
|
34
|
+
*/
|
|
35
|
+
export function quotaGetOrganizationQuota(
|
|
36
|
+
client: FactifyCore,
|
|
37
|
+
request?: operations.GetOrganizationQuotaRequest | undefined,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.GetOrganizationQuotaResponse,
|
|
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.GetOrganizationQuotaRequest | undefined,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
operations.GetOrganizationQuotaResponse,
|
|
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.GetOrganizationQuotaRequest$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")();
|
|
97
|
+
|
|
98
|
+
const query = encodeFormQuery({
|
|
99
|
+
"organization_id": payload?.organization_id,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
107
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
108
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
109
|
+
|
|
110
|
+
const context = {
|
|
111
|
+
options: client._options,
|
|
112
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
113
|
+
operationID: "getOrganizationQuota",
|
|
114
|
+
oAuth2Scopes: null,
|
|
115
|
+
|
|
116
|
+
resolvedSecurity: requestSecurity,
|
|
117
|
+
|
|
118
|
+
securitySource: client._options.bearerAuth,
|
|
119
|
+
retryConfig: options?.retries
|
|
120
|
+
|| client._options.retryConfig
|
|
121
|
+
|| { strategy: "none" },
|
|
122
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const requestRes = client._createRequest(context, {
|
|
126
|
+
security: requestSecurity,
|
|
127
|
+
method: "GET",
|
|
128
|
+
baseURL: options?.serverURL,
|
|
129
|
+
path: path,
|
|
130
|
+
headers: headers,
|
|
131
|
+
query: query,
|
|
132
|
+
body: body,
|
|
133
|
+
userAgent: client._options.userAgent,
|
|
134
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
135
|
+
}, options);
|
|
136
|
+
if (!requestRes.ok) {
|
|
137
|
+
return [requestRes, { status: "invalid" }];
|
|
138
|
+
}
|
|
139
|
+
const req = requestRes.value;
|
|
140
|
+
|
|
141
|
+
const doResult = await client._do(req, {
|
|
142
|
+
context,
|
|
143
|
+
errorCodes: ["400", "401", "403", "404", "429", "4XX", "500", "5XX"],
|
|
144
|
+
retryConfig: context.retryConfig,
|
|
145
|
+
retryCodes: context.retryCodes,
|
|
146
|
+
});
|
|
147
|
+
if (!doResult.ok) {
|
|
148
|
+
return [doResult, { status: "request-error", request: req }];
|
|
149
|
+
}
|
|
150
|
+
const response = doResult.value;
|
|
151
|
+
|
|
152
|
+
const responseFields = {
|
|
153
|
+
HttpMeta: { Response: response, Request: req },
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const [result] = await M.match<
|
|
157
|
+
operations.GetOrganizationQuotaResponse,
|
|
158
|
+
| errors.ErrorT
|
|
159
|
+
| FactifyError
|
|
160
|
+
| ResponseValidationError
|
|
161
|
+
| ConnectionError
|
|
162
|
+
| RequestAbortedError
|
|
163
|
+
| RequestTimeoutError
|
|
164
|
+
| InvalidRequestError
|
|
165
|
+
| UnexpectedClientError
|
|
166
|
+
| SDKValidationError
|
|
167
|
+
>(
|
|
168
|
+
M.json(200, operations.GetOrganizationQuotaResponse$inboundSchema, {
|
|
169
|
+
key: "GetOrganizationQuotaResponse",
|
|
170
|
+
}),
|
|
171
|
+
M.jsonErr([400, 401, 403, 404], errors.ErrorT$inboundSchema),
|
|
172
|
+
M.jsonErr(429, errors.ErrorT$inboundSchema, { hdrs: true }),
|
|
173
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail("5XX"),
|
|
176
|
+
)(response, req, { extraFields: responseFields });
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|