@retab/node 0.0.48 → 0.0.52

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 (263) hide show
  1. package/README.md +8 -215
  2. package/dist/api/client.d.ts +2 -2
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +2 -2
  5. package/dist/api/documents/client.d.ts +3 -3
  6. package/dist/api/documents/client.d.ts.map +1 -1
  7. package/dist/api/documents/client.js +3 -3
  8. package/dist/api/projects/client.d.ts +15 -0
  9. package/dist/api/projects/client.d.ts.map +1 -0
  10. package/dist/api/projects/client.js +43 -0
  11. package/dist/api/projects/documents/client.d.ts +12 -0
  12. package/dist/api/projects/documents/client.d.ts.map +1 -0
  13. package/dist/api/projects/documents/client.js +39 -0
  14. package/dist/api/projects/iterations/client.d.ts +17 -0
  15. package/dist/api/projects/iterations/client.d.ts.map +1 -0
  16. package/dist/api/projects/iterations/client.js +64 -0
  17. package/dist/client.d.ts +1 -0
  18. package/dist/client.d.ts.map +1 -1
  19. package/dist/client.js +6 -1
  20. package/dist/generated_types.d.ts +17837 -40090
  21. package/dist/generated_types.d.ts.map +1 -1
  22. package/dist/generated_types.js +309 -979
  23. package/dist/index.d.ts +7 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/types.d.ts +188 -80
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/types.js +22 -1
  29. package/package.json +6 -9
  30. package/dist/api/consensus/client.d.ts +0 -7
  31. package/dist/api/consensus/client.d.ts.map +0 -1
  32. package/dist/api/consensus/client.js +0 -14
  33. package/dist/errors.d.ts +0 -34
  34. package/dist/errors.d.ts.map +0 -1
  35. package/dist/errors.js +0 -53
  36. package/dist/resource.d.ts +0 -12
  37. package/dist/resource.d.ts.map +0 -1
  38. package/dist/resource.js +0 -19
  39. package/dist/resources/consensus/completions.d.ts +0 -66
  40. package/dist/resources/consensus/completions.d.ts.map +0 -1
  41. package/dist/resources/consensus/completions.js +0 -84
  42. package/dist/resources/consensus/index.d.ts +0 -72
  43. package/dist/resources/consensus/index.d.ts.map +0 -1
  44. package/dist/resources/consensus/index.js +0 -76
  45. package/dist/resources/consensus/responses.d.ts +0 -69
  46. package/dist/resources/consensus/responses.d.ts.map +0 -1
  47. package/dist/resources/consensus/responses.js +0 -99
  48. package/dist/resources/documents/extractions.d.ts +0 -74
  49. package/dist/resources/documents/extractions.d.ts.map +0 -1
  50. package/dist/resources/documents/extractions.js +0 -196
  51. package/dist/resources/documents/index.d.ts +0 -21
  52. package/dist/resources/documents/index.d.ts.map +0 -1
  53. package/dist/resources/documents/index.js +0 -55
  54. package/dist/resources/evaluations/documents.d.ts +0 -40
  55. package/dist/resources/evaluations/documents.d.ts.map +0 -1
  56. package/dist/resources/evaluations/documents.js +0 -123
  57. package/dist/resources/evaluations/index.d.ts +0 -14
  58. package/dist/resources/evaluations/index.d.ts.map +0 -1
  59. package/dist/resources/evaluations/index.js +0 -17
  60. package/dist/resources/evaluations/iterations.d.ts +0 -50
  61. package/dist/resources/evaluations/iterations.d.ts.map +0 -1
  62. package/dist/resources/evaluations/iterations.js +0 -156
  63. package/dist/resources/files.d.ts +0 -82
  64. package/dist/resources/files.d.ts.map +0 -1
  65. package/dist/resources/files.js +0 -150
  66. package/dist/resources/finetuning.d.ts +0 -105
  67. package/dist/resources/finetuning.d.ts.map +0 -1
  68. package/dist/resources/finetuning.js +0 -181
  69. package/dist/resources/index.d.ts +0 -11
  70. package/dist/resources/index.d.ts.map +0 -1
  71. package/dist/resources/index.js +0 -10
  72. package/dist/resources/models.d.ts +0 -57
  73. package/dist/resources/models.d.ts.map +0 -1
  74. package/dist/resources/models.js +0 -72
  75. package/dist/resources/processors/automations/endpoints.d.ts +0 -90
  76. package/dist/resources/processors/automations/endpoints.d.ts.map +0 -1
  77. package/dist/resources/processors/automations/endpoints.js +0 -145
  78. package/dist/resources/processors/automations/index.d.ts +0 -7
  79. package/dist/resources/processors/automations/index.d.ts.map +0 -1
  80. package/dist/resources/processors/automations/index.js +0 -6
  81. package/dist/resources/processors/automations/links.d.ts +0 -90
  82. package/dist/resources/processors/automations/links.d.ts.map +0 -1
  83. package/dist/resources/processors/automations/links.js +0 -149
  84. package/dist/resources/processors/automations/logs.d.ts +0 -35
  85. package/dist/resources/processors/automations/logs.d.ts.map +0 -1
  86. package/dist/resources/processors/automations/logs.js +0 -60
  87. package/dist/resources/processors/automations/mailboxes.d.ts +0 -102
  88. package/dist/resources/processors/automations/mailboxes.d.ts.map +0 -1
  89. package/dist/resources/processors/automations/mailboxes.js +0 -157
  90. package/dist/resources/processors/automations/outlook.d.ts +0 -114
  91. package/dist/resources/processors/automations/outlook.d.ts.map +0 -1
  92. package/dist/resources/processors/automations/outlook.js +0 -170
  93. package/dist/resources/processors/automations/tests.d.ts +0 -58
  94. package/dist/resources/processors/automations/tests.d.ts.map +0 -1
  95. package/dist/resources/processors/automations/tests.js +0 -90
  96. package/dist/resources/processors/index.d.ts +0 -303
  97. package/dist/resources/processors/index.d.ts.map +0 -1
  98. package/dist/resources/processors/index.js +0 -261
  99. package/dist/resources/schemas.d.ts +0 -63
  100. package/dist/resources/schemas.d.ts.map +0 -1
  101. package/dist/resources/schemas.js +0 -183
  102. package/dist/resources/secrets/external_api_keys.d.ts +0 -61
  103. package/dist/resources/secrets/external_api_keys.d.ts.map +0 -1
  104. package/dist/resources/secrets/external_api_keys.js +0 -120
  105. package/dist/resources/secrets/index.d.ts +0 -14
  106. package/dist/resources/secrets/index.d.ts.map +0 -1
  107. package/dist/resources/secrets/index.js +0 -17
  108. package/dist/resources/secrets/webhooks.d.ts +0 -73
  109. package/dist/resources/secrets/webhooks.d.ts.map +0 -1
  110. package/dist/resources/secrets/webhooks.js +0 -145
  111. package/dist/resources/usage.d.ts +0 -223
  112. package/dist/resources/usage.d.ts.map +0 -1
  113. package/dist/resources/usage.js +0 -310
  114. package/dist/types/ai_models.d.ts +0 -389
  115. package/dist/types/ai_models.d.ts.map +0 -1
  116. package/dist/types/ai_models.js +0 -145
  117. package/dist/types/automations/cron.d.ts +0 -28
  118. package/dist/types/automations/cron.d.ts.map +0 -1
  119. package/dist/types/automations/cron.js +0 -1
  120. package/dist/types/automations/endpoints.d.ts +0 -13
  121. package/dist/types/automations/endpoints.d.ts.map +0 -1
  122. package/dist/types/automations/endpoints.js +0 -1
  123. package/dist/types/automations/index.d.ts +0 -7
  124. package/dist/types/automations/index.d.ts.map +0 -1
  125. package/dist/types/automations/index.js +0 -6
  126. package/dist/types/automations/links.d.ts +0 -15
  127. package/dist/types/automations/links.d.ts.map +0 -1
  128. package/dist/types/automations/links.js +0 -1
  129. package/dist/types/automations/mailboxes.d.ts +0 -18
  130. package/dist/types/automations/mailboxes.d.ts.map +0 -1
  131. package/dist/types/automations/mailboxes.js +0 -1
  132. package/dist/types/automations/outlook.d.ts +0 -37
  133. package/dist/types/automations/outlook.d.ts.map +0 -1
  134. package/dist/types/automations/outlook.js +0 -1
  135. package/dist/types/automations/webhooks.d.ts +0 -13
  136. package/dist/types/automations/webhooks.d.ts.map +0 -1
  137. package/dist/types/automations/webhooks.js +0 -1
  138. package/dist/types/browser_canvas.d.ts +0 -4
  139. package/dist/types/browser_canvas.d.ts.map +0 -1
  140. package/dist/types/browser_canvas.js +0 -2
  141. package/dist/types/chat.d.ts +0 -99
  142. package/dist/types/chat.d.ts.map +0 -1
  143. package/dist/types/chat.js +0 -20
  144. package/dist/types/consensus.d.ts +0 -10
  145. package/dist/types/consensus.d.ts.map +0 -1
  146. package/dist/types/consensus.js +0 -1
  147. package/dist/types/db/annotations.d.ts +0 -108
  148. package/dist/types/db/annotations.d.ts.map +0 -1
  149. package/dist/types/db/annotations.js +0 -6
  150. package/dist/types/db/files.d.ts +0 -133
  151. package/dist/types/db/files.d.ts.map +0 -1
  152. package/dist/types/db/files.js +0 -5
  153. package/dist/types/documents/extractions.d.ts +0 -1849
  154. package/dist/types/documents/extractions.d.ts.map +0 -1
  155. package/dist/types/documents/extractions.js +0 -211
  156. package/dist/types/documents/processing.d.ts +0 -249
  157. package/dist/types/documents/processing.d.ts.map +0 -1
  158. package/dist/types/documents/processing.js +0 -6
  159. package/dist/types/evaluations/iterations.d.ts +0 -41
  160. package/dist/types/evaluations/iterations.d.ts.map +0 -1
  161. package/dist/types/evaluations/iterations.js +0 -1
  162. package/dist/types/jobs/base.d.ts +0 -162
  163. package/dist/types/jobs/base.d.ts.map +0 -1
  164. package/dist/types/jobs/base.js +0 -6
  165. package/dist/types/jobs/specialized.d.ts +0 -200
  166. package/dist/types/jobs/specialized.d.ts.map +0 -1
  167. package/dist/types/jobs/specialized.js +0 -37
  168. package/dist/types/logs.d.ts +0 -92
  169. package/dist/types/logs.d.ts.map +0 -1
  170. package/dist/types/logs.js +0 -1
  171. package/dist/types/mime.d.ts +0 -426
  172. package/dist/types/mime.d.ts.map +0 -1
  173. package/dist/types/mime.js +0 -48
  174. package/dist/types/modalities.d.ts +0 -31
  175. package/dist/types/modalities.d.ts.map +0 -1
  176. package/dist/types/modalities.js +0 -109
  177. package/dist/types/pagination.d.ts +0 -5
  178. package/dist/types/pagination.d.ts.map +0 -1
  179. package/dist/types/pagination.js +0 -1
  180. package/dist/types/schemas/enhancement.d.ts +0 -250
  181. package/dist/types/schemas/enhancement.d.ts.map +0 -1
  182. package/dist/types/schemas/enhancement.js +0 -6
  183. package/dist/types/schemas/generate.d.ts +0 -160
  184. package/dist/types/schemas/generate.d.ts.map +0 -1
  185. package/dist/types/schemas/generate.js +0 -19
  186. package/dist/types/schemas/object.d.ts +0 -116
  187. package/dist/types/schemas/object.d.ts.map +0 -1
  188. package/dist/types/schemas/object.js +0 -861
  189. package/dist/types/secrets/external_api_keys.d.ts +0 -27
  190. package/dist/types/secrets/external_api_keys.d.ts.map +0 -1
  191. package/dist/types/secrets/external_api_keys.js +0 -11
  192. package/dist/types/secrets/index.d.ts +0 -2
  193. package/dist/types/secrets/index.d.ts.map +0 -1
  194. package/dist/types/secrets/index.js +0 -1
  195. package/dist/types/standards.d.ts +0 -37
  196. package/dist/types/standards.d.ts.map +0 -1
  197. package/dist/types/standards.js +0 -1
  198. package/dist/utils/ai_models.d.ts +0 -10
  199. package/dist/utils/ai_models.d.ts.map +0 -1
  200. package/dist/utils/ai_models.js +0 -183
  201. package/dist/utils/batch_processing.d.ts +0 -227
  202. package/dist/utils/batch_processing.d.ts.map +0 -1
  203. package/dist/utils/batch_processing.js +0 -268
  204. package/dist/utils/benchmarking.d.ts +0 -115
  205. package/dist/utils/benchmarking.d.ts.map +0 -1
  206. package/dist/utils/benchmarking.js +0 -355
  207. package/dist/utils/chat.d.ts +0 -70
  208. package/dist/utils/chat.d.ts.map +0 -1
  209. package/dist/utils/chat.js +0 -79
  210. package/dist/utils/cost_calculation.d.ts +0 -26
  211. package/dist/utils/cost_calculation.d.ts.map +0 -1
  212. package/dist/utils/cost_calculation.js +0 -99
  213. package/dist/utils/datasets.d.ts +0 -135
  214. package/dist/utils/datasets.d.ts.map +0 -1
  215. package/dist/utils/datasets.js +0 -359
  216. package/dist/utils/display.d.ts +0 -108
  217. package/dist/utils/display.d.ts.map +0 -1
  218. package/dist/utils/display.js +0 -244
  219. package/dist/utils/hash.d.ts +0 -18
  220. package/dist/utils/hash.d.ts.map +0 -1
  221. package/dist/utils/hash.js +0 -31
  222. package/dist/utils/hashing.d.ts +0 -18
  223. package/dist/utils/hashing.d.ts.map +0 -1
  224. package/dist/utils/hashing.js +0 -28
  225. package/dist/utils/index.d.ts +0 -8
  226. package/dist/utils/index.d.ts.map +0 -1
  227. package/dist/utils/index.js +0 -10
  228. package/dist/utils/json_schema.d.ts +0 -18
  229. package/dist/utils/json_schema.d.ts.map +0 -1
  230. package/dist/utils/json_schema.js +0 -334
  231. package/dist/utils/json_schema_utils.d.ts +0 -42
  232. package/dist/utils/json_schema_utils.d.ts.map +0 -1
  233. package/dist/utils/json_schema_utils.js +0 -212
  234. package/dist/utils/jsonl.d.ts +0 -60
  235. package/dist/utils/jsonl.d.ts.map +0 -1
  236. package/dist/utils/jsonl.js +0 -259
  237. package/dist/utils/mime.d.ts +0 -6
  238. package/dist/utils/mime.d.ts.map +0 -1
  239. package/dist/utils/mime.js +0 -129
  240. package/dist/utils/model_cards.d.ts +0 -219
  241. package/dist/utils/model_cards.d.ts.map +0 -1
  242. package/dist/utils/model_cards.js +0 -462
  243. package/dist/utils/prompt_optimization.d.ts +0 -96
  244. package/dist/utils/prompt_optimization.d.ts.map +0 -1
  245. package/dist/utils/prompt_optimization.js +0 -275
  246. package/dist/utils/responses.d.ts +0 -35
  247. package/dist/utils/responses.d.ts.map +0 -1
  248. package/dist/utils/responses.js +0 -37
  249. package/dist/utils/stream.d.ts +0 -13
  250. package/dist/utils/stream.d.ts.map +0 -1
  251. package/dist/utils/stream.js +0 -64
  252. package/dist/utils/stream_context_managers.d.ts +0 -147
  253. package/dist/utils/stream_context_managers.d.ts.map +0 -1
  254. package/dist/utils/stream_context_managers.js +0 -380
  255. package/dist/utils/usage.d.ts +0 -57
  256. package/dist/utils/usage.d.ts.map +0 -1
  257. package/dist/utils/usage.js +0 -97
  258. package/dist/utils/webhook_secrets.d.ts +0 -59
  259. package/dist/utils/webhook_secrets.d.ts.map +0 -1
  260. package/dist/utils/webhook_secrets.js +0 -107
  261. package/dist/utils/zod_to_json_schema.d.ts +0 -11
  262. package/dist/utils/zod_to_json_schema.d.ts.map +0 -1
  263. package/dist/utils/zod_to_json_schema.js +0 -123
@@ -1,310 +0,0 @@
1
- import { SyncAPIResource, AsyncAPIResource } from '../resource.js';
2
- // Global variable to track total cost
3
- let totalCost = 0.0;
4
- export class UsageMixin {
5
- prepareMonthlyCreditsUsage() {
6
- return {
7
- method: 'GET',
8
- url: '/v1/usage/monthly_credits',
9
- };
10
- }
11
- prepareTotal(params = {}) {
12
- const queryParams = {};
13
- if (params.start_date) {
14
- queryParams.start_date = params.start_date.toISOString();
15
- }
16
- if (params.end_date) {
17
- queryParams.end_date = params.end_date.toISOString();
18
- }
19
- return {
20
- method: 'GET',
21
- url: '/v1/usage/total',
22
- params: queryParams,
23
- };
24
- }
25
- prepareMailbox(params) {
26
- const queryParams = {};
27
- if (params.start_date) {
28
- queryParams.start_date = params.start_date.toISOString();
29
- }
30
- if (params.end_date) {
31
- queryParams.end_date = params.end_date.toISOString();
32
- }
33
- return {
34
- method: 'GET',
35
- url: `/v1/processors/automations/mailboxes/${params.email}/usage`,
36
- params: queryParams,
37
- };
38
- }
39
- prepareLink(params) {
40
- const queryParams = {};
41
- if (params.start_date) {
42
- queryParams.start_date = params.start_date.toISOString();
43
- }
44
- if (params.end_date) {
45
- queryParams.end_date = params.end_date.toISOString();
46
- }
47
- return {
48
- method: 'GET',
49
- url: `/v1/processors/automations/links/${params.link_id}/usage`,
50
- params: queryParams,
51
- };
52
- }
53
- prepareSchema(params) {
54
- const queryParams = {};
55
- if (params.start_date) {
56
- queryParams.start_date = params.start_date.toISOString();
57
- }
58
- if (params.end_date) {
59
- queryParams.end_date = params.end_date.toISOString();
60
- }
61
- return {
62
- method: 'GET',
63
- url: `/v1/schemas/${params.schema_id}/usage`,
64
- params: queryParams,
65
- };
66
- }
67
- prepareSchemaData(params) {
68
- const queryParams = {};
69
- if (params.start_date) {
70
- queryParams.start_date = params.start_date.toISOString();
71
- }
72
- if (params.end_date) {
73
- queryParams.end_date = params.end_date.toISOString();
74
- }
75
- return {
76
- method: 'GET',
77
- url: `/v1/schemas/${params.schema_data_id}/usage_data`,
78
- params: queryParams,
79
- };
80
- }
81
- prepareLog(params) {
82
- let logCompletionRequest;
83
- if (params.response_format && typeof params.response_format === 'object') {
84
- if ('json_schema' in params.response_format) {
85
- const jsonSchema = params.response_format.json_schema;
86
- if ('schema' in jsonSchema) {
87
- logCompletionRequest = {
88
- json_schema: jsonSchema.schema,
89
- completion: params.completion,
90
- };
91
- }
92
- else {
93
- throw new Error('Invalid response format');
94
- }
95
- }
96
- else {
97
- throw new Error('Invalid response format');
98
- }
99
- }
100
- else {
101
- throw new Error('Invalid response format');
102
- }
103
- return {
104
- method: 'POST',
105
- url: '/v1/usage/log',
106
- data: logCompletionRequest,
107
- };
108
- }
109
- }
110
- export class Usage extends SyncAPIResource {
111
- constructor() {
112
- super(...arguments);
113
- this.mixin = new UsageMixin();
114
- }
115
- /**
116
- * Get monthly credits usage information.
117
- * Credits are calculated dynamically based on MIME type and consumption.
118
- *
119
- * @returns Monthly usage data including credits consumed and limits
120
- * @throws RetabAPIError if the API request fails
121
- */
122
- monthlyCreditsUsage() {
123
- const request = this.mixin.prepareMonthlyCreditsUsage();
124
- const response = this._client._preparedRequest(request);
125
- return response;
126
- }
127
- /**
128
- * Get the total usage cost within an optional date range.
129
- *
130
- * @param start_date - Start date for usage calculation
131
- * @param end_date - End date for usage calculation
132
- * @returns The total usage cost
133
- */
134
- total(_params = {}) {
135
- return { value: totalCost, currency: 'USD' };
136
- }
137
- /**
138
- * Get the total usage cost for a mailbox within an optional date range.
139
- *
140
- * @param email - The email address of the mailbox
141
- * @param start_date - Start date for usage calculation
142
- * @param end_date - End date for usage calculation
143
- * @returns The total usage cost
144
- */
145
- mailbox(params) {
146
- const request = this.mixin.prepareMailbox(params);
147
- const response = this._client._preparedRequest(request);
148
- return response;
149
- }
150
- /**
151
- * Get the total usage cost for a link within an optional date range.
152
- *
153
- * @param link_id - The ID of the link
154
- * @param start_date - Start date for usage calculation
155
- * @param end_date - End date for usage calculation
156
- * @returns The total usage cost
157
- */
158
- link(params) {
159
- const request = this.mixin.prepareLink(params);
160
- const response = this._client._preparedRequest(request);
161
- return response;
162
- }
163
- /**
164
- * Get the total usage cost for a schema within an optional date range.
165
- *
166
- * @param schema_id - The ID of the schema
167
- * @param start_date - Start date for usage calculation
168
- * @param end_date - End date for usage calculation
169
- * @returns The total usage cost
170
- */
171
- schema(params) {
172
- const request = this.mixin.prepareSchema(params);
173
- const response = this._client._preparedRequest(request);
174
- return response;
175
- }
176
- /**
177
- * Get the total usage cost for a schema data within an optional date range.
178
- *
179
- * @param schema_data_id - The ID of the schema data
180
- * @param start_date - Start date for usage calculation
181
- * @param end_date - End date for usage calculation
182
- * @returns The total usage cost
183
- */
184
- schemaData(params) {
185
- const request = this.mixin.prepareSchemaData(params);
186
- const response = this._client._preparedRequest(request);
187
- return response;
188
- }
189
- /**
190
- * Logs an OpenAI request completion as an automation log to make usage calculation possible.
191
- *
192
- * Example:
193
- * ```typescript
194
- * const client = new OpenAI();
195
- * const completion = await client.beta.chat.completions.parse({
196
- * model: "gpt-4o-2024-08-06",
197
- * messages: [
198
- * {"role": "developer", "content": "Extract the event information."},
199
- * {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."},
200
- * ],
201
- * response_format: CalendarEvent,
202
- * });
203
- * reclient.usage.log({
204
- * response_format: CalendarEvent,
205
- * completion: completion
206
- * });
207
- * ```
208
- *
209
- * @param response_format - The response format of the OpenAI request
210
- * @param completion - The completion of the OpenAI request
211
- * @returns The automation log
212
- */
213
- log(params) {
214
- const request = this.mixin.prepareLog(params);
215
- const response = this._client._preparedRequest(request);
216
- return response;
217
- }
218
- }
219
- export class AsyncUsage extends AsyncAPIResource {
220
- constructor() {
221
- super(...arguments);
222
- this.mixin = new UsageMixin();
223
- }
224
- /**
225
- * Get monthly credits usage information asynchronously.
226
- * Credits are calculated dynamically based on MIME type and consumption.
227
- *
228
- * @returns Monthly usage data including credits consumed and limits
229
- * @throws RetabAPIError if the API request fails
230
- */
231
- async monthlyCreditsUsage() {
232
- const request = this.mixin.prepareMonthlyCreditsUsage();
233
- const response = await this._client._preparedRequest(request);
234
- return response;
235
- }
236
- /**
237
- * Get the total usage cost within an optional date range.
238
- *
239
- * @param start_date - Start date for usage calculation
240
- * @param end_date - End date for usage calculation
241
- * @returns The total usage cost
242
- */
243
- async total(_params = {}) {
244
- return { value: totalCost, currency: 'USD' };
245
- }
246
- /**
247
- * Get the total usage cost for a mailbox within an optional date range.
248
- *
249
- * @param email - The email address of the mailbox
250
- * @param start_date - Start date for usage calculation
251
- * @param end_date - End date for usage calculation
252
- * @returns The total usage cost
253
- */
254
- async mailbox(params) {
255
- const request = this.mixin.prepareMailbox(params);
256
- const response = await this._client._preparedRequest(request);
257
- return response;
258
- }
259
- /**
260
- * Get the total usage cost for a link within an optional date range.
261
- *
262
- * @param link_id - The ID of the link
263
- * @param start_date - Start date for usage calculation
264
- * @param end_date - End date for usage calculation
265
- * @returns The total usage cost
266
- */
267
- async link(params) {
268
- const request = this.mixin.prepareLink(params);
269
- const response = await this._client._preparedRequest(request);
270
- return response;
271
- }
272
- /**
273
- * Get the total usage cost for a schema within an optional date range.
274
- *
275
- * @param schema_id - The ID of the schema
276
- * @param start_date - Start date for usage calculation
277
- * @param end_date - End date for usage calculation
278
- * @returns The total usage cost
279
- */
280
- async schema(params) {
281
- const request = this.mixin.prepareSchema(params);
282
- const response = await this._client._preparedRequest(request);
283
- return response;
284
- }
285
- /**
286
- * Get the total usage cost for a schema data within an optional date range.
287
- *
288
- * @param schema_data_id - The ID of the schema data
289
- * @param start_date - Start date for usage calculation
290
- * @param end_date - End date for usage calculation
291
- * @returns The total usage cost
292
- */
293
- async schemaData(params) {
294
- const request = this.mixin.prepareSchemaData(params);
295
- const response = await this._client._preparedRequest(request);
296
- return response;
297
- }
298
- /**
299
- * Logs an OpenAI request completion as an automation log to make usage calculation possible.
300
- *
301
- * @param response_format - The response format of the OpenAI request
302
- * @param completion - The completion of the OpenAI request
303
- * @returns The automation log
304
- */
305
- async log(params) {
306
- const request = this.mixin.prepareLog(params);
307
- const response = await this._client._preparedRequest(request);
308
- return response;
309
- }
310
- }