@gpuai/sdk 0.3.17 → 0.4.0

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 (152) hide show
  1. package/.openapi-generator/FILES +40 -0
  2. package/README.md +36 -2
  3. package/dist/apis/BillingApi.d.ts +70 -0
  4. package/dist/apis/BillingApi.js +197 -0
  5. package/dist/apis/FunctionsApi.d.ts +228 -0
  6. package/dist/apis/FunctionsApi.js +627 -0
  7. package/dist/apis/index.d.ts +1 -0
  8. package/dist/apis/index.js +1 -0
  9. package/dist/esm/apis/BillingApi.d.ts +70 -0
  10. package/dist/esm/apis/BillingApi.js +197 -0
  11. package/dist/esm/apis/FunctionsApi.d.ts +228 -0
  12. package/dist/esm/apis/FunctionsApi.js +623 -0
  13. package/dist/esm/apis/index.d.ts +1 -0
  14. package/dist/esm/apis/index.js +1 -0
  15. package/dist/esm/models/AutolaunchRule.d.ts +4 -2
  16. package/dist/esm/models/BillingDetails.d.ts +98 -0
  17. package/dist/esm/models/BillingDetails.js +85 -0
  18. package/dist/esm/models/CreateFunctionRequest.d.ts +32 -0
  19. package/dist/esm/models/CreateFunctionRequest.js +43 -0
  20. package/dist/esm/models/CreateFunctionRunRequest.d.ts +38 -0
  21. package/dist/esm/models/CreateFunctionRunRequest.js +45 -0
  22. package/dist/esm/models/CreateFunctionVersionRequest.d.ts +110 -0
  23. package/dist/esm/models/CreateFunctionVersionRequest.js +79 -0
  24. package/dist/esm/models/Function.d.ts +163 -0
  25. package/dist/esm/models/Function.js +109 -0
  26. package/dist/esm/models/FunctionList.d.ts +33 -0
  27. package/dist/esm/models/FunctionList.js +44 -0
  28. package/dist/esm/models/FunctionReplicaCounts.d.ts +44 -0
  29. package/dist/esm/models/FunctionReplicaCounts.js +51 -0
  30. package/dist/esm/models/FunctionRun.d.ts +130 -0
  31. package/dist/esm/models/FunctionRun.js +94 -0
  32. package/dist/esm/models/FunctionRunError.d.ts +44 -0
  33. package/dist/esm/models/FunctionRunError.js +49 -0
  34. package/dist/esm/models/FunctionRunList.d.ts +39 -0
  35. package/dist/esm/models/FunctionRunList.js +48 -0
  36. package/dist/esm/models/FunctionRunLogChunk.d.ts +59 -0
  37. package/dist/esm/models/FunctionRunLogChunk.js +63 -0
  38. package/dist/esm/models/FunctionRunLogs.d.ts +45 -0
  39. package/dist/esm/models/FunctionRunLogs.js +52 -0
  40. package/dist/esm/models/FunctionUpload.d.ts +51 -0
  41. package/dist/esm/models/FunctionUpload.js +59 -0
  42. package/dist/esm/models/FunctionVersion.d.ts +137 -0
  43. package/dist/esm/models/FunctionVersion.js +109 -0
  44. package/dist/esm/models/Invoice.d.ts +68 -0
  45. package/dist/esm/models/Invoice.js +67 -0
  46. package/dist/esm/models/InvoiceList.d.ts +45 -0
  47. package/dist/esm/models/InvoiceList.js +50 -0
  48. package/dist/esm/models/ModelPricing.d.ts +46 -0
  49. package/dist/esm/models/ModelPricing.js +21 -0
  50. package/dist/esm/models/ModelRate.d.ts +62 -0
  51. package/dist/esm/models/ModelRate.js +51 -0
  52. package/dist/esm/models/PeakWindow.d.ts +38 -0
  53. package/dist/esm/models/PeakWindow.js +47 -0
  54. package/dist/esm/models/UpdateBillingDetailsRequest.d.ts +80 -0
  55. package/dist/esm/models/UpdateBillingDetailsRequest.js +57 -0
  56. package/dist/esm/models/index.d.ts +19 -0
  57. package/dist/esm/models/index.js +19 -0
  58. package/dist/esm/runtime.js +1 -1
  59. package/dist/models/AutolaunchRule.d.ts +4 -2
  60. package/dist/models/BillingDetails.d.ts +98 -0
  61. package/dist/models/BillingDetails.js +92 -0
  62. package/dist/models/CreateFunctionRequest.d.ts +32 -0
  63. package/dist/models/CreateFunctionRequest.js +50 -0
  64. package/dist/models/CreateFunctionRunRequest.d.ts +38 -0
  65. package/dist/models/CreateFunctionRunRequest.js +52 -0
  66. package/dist/models/CreateFunctionVersionRequest.d.ts +110 -0
  67. package/dist/models/CreateFunctionVersionRequest.js +86 -0
  68. package/dist/models/Function.d.ts +163 -0
  69. package/dist/models/Function.js +117 -0
  70. package/dist/models/FunctionList.d.ts +33 -0
  71. package/dist/models/FunctionList.js +51 -0
  72. package/dist/models/FunctionReplicaCounts.d.ts +44 -0
  73. package/dist/models/FunctionReplicaCounts.js +58 -0
  74. package/dist/models/FunctionRun.d.ts +130 -0
  75. package/dist/models/FunctionRun.js +102 -0
  76. package/dist/models/FunctionRunError.d.ts +44 -0
  77. package/dist/models/FunctionRunError.js +56 -0
  78. package/dist/models/FunctionRunList.d.ts +39 -0
  79. package/dist/models/FunctionRunList.js +55 -0
  80. package/dist/models/FunctionRunLogChunk.d.ts +59 -0
  81. package/dist/models/FunctionRunLogChunk.js +71 -0
  82. package/dist/models/FunctionRunLogs.d.ts +45 -0
  83. package/dist/models/FunctionRunLogs.js +59 -0
  84. package/dist/models/FunctionUpload.d.ts +51 -0
  85. package/dist/models/FunctionUpload.js +67 -0
  86. package/dist/models/FunctionVersion.d.ts +137 -0
  87. package/dist/models/FunctionVersion.js +117 -0
  88. package/dist/models/Invoice.d.ts +68 -0
  89. package/dist/models/Invoice.js +74 -0
  90. package/dist/models/InvoiceList.d.ts +45 -0
  91. package/dist/models/InvoiceList.js +57 -0
  92. package/dist/models/ModelPricing.d.ts +46 -0
  93. package/dist/models/ModelPricing.js +22 -0
  94. package/dist/models/ModelRate.d.ts +62 -0
  95. package/dist/models/ModelRate.js +58 -0
  96. package/dist/models/PeakWindow.d.ts +38 -0
  97. package/dist/models/PeakWindow.js +54 -0
  98. package/dist/models/UpdateBillingDetailsRequest.d.ts +80 -0
  99. package/dist/models/UpdateBillingDetailsRequest.js +64 -0
  100. package/dist/models/index.d.ts +19 -0
  101. package/dist/models/index.js +19 -0
  102. package/dist/runtime.js +1 -1
  103. package/docs/AutolaunchApi.md +1 -1
  104. package/docs/BillingApi.md +299 -0
  105. package/docs/BillingDetails.md +56 -0
  106. package/docs/CreateFunctionRequest.md +34 -0
  107. package/docs/CreateFunctionRunRequest.md +36 -0
  108. package/docs/CreateFunctionVersionRequest.md +60 -0
  109. package/docs/Function.md +75 -0
  110. package/docs/FunctionList.md +34 -0
  111. package/docs/FunctionReplicaCounts.md +39 -0
  112. package/docs/FunctionRun.md +63 -0
  113. package/docs/FunctionRunError.md +38 -0
  114. package/docs/FunctionRunList.md +36 -0
  115. package/docs/FunctionRunLogChunk.md +40 -0
  116. package/docs/FunctionRunLogs.md +38 -0
  117. package/docs/FunctionUpload.md +38 -0
  118. package/docs/FunctionVersion.md +66 -0
  119. package/docs/FunctionsApi.md +880 -0
  120. package/docs/Invoice.md +46 -0
  121. package/docs/InvoiceList.md +38 -0
  122. package/docs/ModelPricing.md +12 -0
  123. package/docs/ModelRate.md +45 -0
  124. package/docs/PeakWindow.md +37 -0
  125. package/docs/UpdateBillingDetailsRequest.md +50 -0
  126. package/package.json +1 -1
  127. package/src/apis/BillingApi.ts +247 -0
  128. package/src/apis/FunctionsApi.ts +828 -0
  129. package/src/apis/index.ts +1 -0
  130. package/src/models/AutolaunchRule.ts +4 -2
  131. package/src/models/BillingDetails.ts +164 -0
  132. package/src/models/CreateFunctionRequest.ts +66 -0
  133. package/src/models/CreateFunctionRunRequest.ts +74 -0
  134. package/src/models/CreateFunctionVersionRequest.ts +175 -0
  135. package/src/models/Function.ts +255 -0
  136. package/src/models/FunctionList.ts +74 -0
  137. package/src/models/FunctionReplicaCounts.ts +84 -0
  138. package/src/models/FunctionRun.ts +207 -0
  139. package/src/models/FunctionRunError.ts +83 -0
  140. package/src/models/FunctionRunList.ts +83 -0
  141. package/src/models/FunctionRunLogChunk.ts +105 -0
  142. package/src/models/FunctionRunLogs.ts +92 -0
  143. package/src/models/FunctionUpload.ts +96 -0
  144. package/src/models/FunctionVersion.ts +226 -0
  145. package/src/models/Invoice.ts +120 -0
  146. package/src/models/InvoiceList.ts +91 -0
  147. package/src/models/ModelPricing.ts +74 -0
  148. package/src/models/ModelRate.ts +105 -0
  149. package/src/models/PeakWindow.ts +75 -0
  150. package/src/models/UpdateBillingDetailsRequest.ts +129 -0
  151. package/src/models/index.ts +19 -0
  152. package/src/runtime.ts +1 -1
@@ -0,0 +1,46 @@
1
+
2
+ # Invoice
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `id` | string
10
+ `number` | string
11
+ `issuedAt` | Date
12
+ `amountCents` | number
13
+ `currency` | string
14
+ `paymentMethod` | string
15
+ `description` | string
16
+
17
+ ## Example
18
+
19
+ ```typescript
20
+ import type { Invoice } from '@gpuai/sdk'
21
+
22
+ // TODO: Update the object below with actual values
23
+ const example = {
24
+ "id": null,
25
+ "number": GPUAI-000123,
26
+ "issuedAt": null,
27
+ "amountCents": null,
28
+ "currency": usd,
29
+ "paymentMethod": Card,
30
+ "description": null,
31
+ } satisfies Invoice
32
+
33
+ console.log(example)
34
+
35
+ // Convert the instance to a JSON string
36
+ const exampleJSON: string = JSON.stringify(example)
37
+ console.log(exampleJSON)
38
+
39
+ // Parse the JSON string back to an object
40
+ const exampleParsed = JSON.parse(exampleJSON) as Invoice
41
+ console.log(exampleParsed)
42
+ ```
43
+
44
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
45
+
46
+
@@ -0,0 +1,38 @@
1
+
2
+ # InvoiceList
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `invoices` | [Array<Invoice>](Invoice.md)
10
+ `hasMore` | boolean
11
+ `nextCursor` | string
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { InvoiceList } from '@gpuai/sdk'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "invoices": null,
21
+ "hasMore": null,
22
+ "nextCursor": null,
23
+ } satisfies InvoiceList
24
+
25
+ console.log(example)
26
+
27
+ // Convert the instance to a JSON string
28
+ const exampleJSON: string = JSON.stringify(example)
29
+ console.log(exampleJSON)
30
+
31
+ // Parse the JSON string back to an object
32
+ const exampleParsed = JSON.parse(exampleJSON) as InvoiceList
33
+ console.log(exampleParsed)
34
+ ```
35
+
36
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
37
+
38
+
@@ -9,12 +9,18 @@ Name | Type
9
9
  `currency` | string
10
10
  `inputPer1mTokensCents` | number
11
11
  `outputPer1mTokensCents` | number
12
+ `cachedInputPer1mTokensMicrocents` | number
13
+ `cachedInputPer1mTokensCents` | number
12
14
  `perImageCents` | number
13
15
  `perImageMicrocents` | number
14
16
  `perMpxlMicrocents` | number
15
17
  `perVideoMicrocents` | number
16
18
  `perVideoSecondCents` | number
17
19
  `perVideoSecondMicrocents` | number
20
+ `period` | string
21
+ `peakWindowsUtc` | [Array<PeakWindow>](PeakWindow.md)
22
+ `peak` | [ModelRate](ModelRate.md)
23
+ `offPeak` | [ModelRate](ModelRate.md)
18
24
 
19
25
  ## Example
20
26
 
@@ -26,12 +32,18 @@ const example = {
26
32
  "currency": null,
27
33
  "inputPer1mTokensCents": null,
28
34
  "outputPer1mTokensCents": null,
35
+ "cachedInputPer1mTokensMicrocents": null,
36
+ "cachedInputPer1mTokensCents": null,
29
37
  "perImageCents": null,
30
38
  "perImageMicrocents": null,
31
39
  "perMpxlMicrocents": null,
32
40
  "perVideoMicrocents": null,
33
41
  "perVideoSecondCents": null,
34
42
  "perVideoSecondMicrocents": null,
43
+ "period": null,
44
+ "peakWindowsUtc": null,
45
+ "peak": null,
46
+ "offPeak": null,
35
47
  } satisfies ModelPricing
36
48
 
37
49
  console.log(example)
@@ -0,0 +1,45 @@
1
+
2
+ # ModelRate
3
+
4
+ One per-1M-token rate triple, in rounded cents and exact micro-cents (1e-6 cent). Prefer the micro-cent fields for arithmetic; cached rates are routinely sub-cent and their cents field is then omitted.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `inputPer1mTokensCents` | number
11
+ `inputPer1mTokensMicrocents` | number
12
+ `cachedInputPer1mTokensCents` | number
13
+ `cachedInputPer1mTokensMicrocents` | number
14
+ `outputPer1mTokensCents` | number
15
+ `outputPer1mTokensMicrocents` | number
16
+
17
+ ## Example
18
+
19
+ ```typescript
20
+ import type { ModelRate } from '@gpuai/sdk'
21
+
22
+ // TODO: Update the object below with actual values
23
+ const example = {
24
+ "inputPer1mTokensCents": null,
25
+ "inputPer1mTokensMicrocents": null,
26
+ "cachedInputPer1mTokensCents": null,
27
+ "cachedInputPer1mTokensMicrocents": null,
28
+ "outputPer1mTokensCents": null,
29
+ "outputPer1mTokensMicrocents": null,
30
+ } satisfies ModelRate
31
+
32
+ console.log(example)
33
+
34
+ // Convert the instance to a JSON string
35
+ const exampleJSON: string = JSON.stringify(example)
36
+ console.log(exampleJSON)
37
+
38
+ // Parse the JSON string back to an object
39
+ const exampleParsed = JSON.parse(exampleJSON) as ModelRate
40
+ console.log(exampleParsed)
41
+ ```
42
+
43
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
44
+
45
+
@@ -0,0 +1,37 @@
1
+
2
+ # PeakWindow
3
+
4
+ One daily UTC time range during which a model\'s peak rates apply.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `start` | string
11
+ `end` | string
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { PeakWindow } from '@gpuai/sdk'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "start": null,
21
+ "end": null,
22
+ } satisfies PeakWindow
23
+
24
+ console.log(example)
25
+
26
+ // Convert the instance to a JSON string
27
+ const exampleJSON: string = JSON.stringify(example)
28
+ console.log(exampleJSON)
29
+
30
+ // Parse the JSON string back to an object
31
+ const exampleParsed = JSON.parse(exampleJSON) as PeakWindow
32
+ console.log(exampleParsed)
33
+ ```
34
+
35
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
36
+
37
+
@@ -0,0 +1,50 @@
1
+
2
+ # UpdateBillingDetailsRequest
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `legalName` | string
10
+ `addressLine1` | string
11
+ `addressLine2` | string
12
+ `city` | string
13
+ `region` | string
14
+ `postalCode` | string
15
+ `country` | string
16
+ `taxIdType` | string
17
+ `taxId` | string
18
+
19
+ ## Example
20
+
21
+ ```typescript
22
+ import type { UpdateBillingDetailsRequest } from '@gpuai/sdk'
23
+
24
+ // TODO: Update the object below with actual values
25
+ const example = {
26
+ "legalName": null,
27
+ "addressLine1": null,
28
+ "addressLine2": null,
29
+ "city": null,
30
+ "region": null,
31
+ "postalCode": null,
32
+ "country": null,
33
+ "taxIdType": null,
34
+ "taxId": null,
35
+ } satisfies UpdateBillingDetailsRequest
36
+
37
+ console.log(example)
38
+
39
+ // Convert the instance to a JSON string
40
+ const exampleJSON: string = JSON.stringify(example)
41
+ console.log(exampleJSON)
42
+
43
+ // Parse the JSON string back to an object
44
+ const exampleParsed = JSON.parse(exampleJSON) as UpdateBillingDetailsRequest
45
+ console.log(exampleParsed)
46
+ ```
47
+
48
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
49
+
50
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpuai/sdk",
3
- "version": "0.3.17",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript SDK for the GPU.ai Public Developer API",
5
5
  "author": "GPU.ai Support <support@gpu.ai>",
6
6
  "repository": {
@@ -18,6 +18,11 @@ import {
18
18
  BalanceFromJSON,
19
19
  BalanceToJSON,
20
20
  } from '../models/Balance';
21
+ import {
22
+ type BillingDetails,
23
+ BillingDetailsFromJSON,
24
+ BillingDetailsToJSON,
25
+ } from '../models/BillingDetails';
21
26
  import {
22
27
  type CreateCryptoDepositRequest,
23
28
  CreateCryptoDepositRequestFromJSON,
@@ -28,6 +33,11 @@ import {
28
33
  CryptoDepositFromJSON,
29
34
  CryptoDepositToJSON,
30
35
  } from '../models/CryptoDeposit';
36
+ import {
37
+ type InvoiceList,
38
+ InvoiceListFromJSON,
39
+ InvoiceListToJSON,
40
+ } from '../models/InvoiceList';
31
41
  import {
32
42
  type ListDeposits200Response,
33
43
  ListDeposits200ResponseFromJSON,
@@ -43,6 +53,11 @@ import {
43
53
  SpendingLimitFromJSON,
44
54
  SpendingLimitToJSON,
45
55
  } from '../models/SpendingLimit';
56
+ import {
57
+ type UpdateBillingDetailsRequest,
58
+ UpdateBillingDetailsRequestFromJSON,
59
+ UpdateBillingDetailsRequestToJSON,
60
+ } from '../models/UpdateBillingDetailsRequest';
46
61
  import {
47
62
  type UpdateSpendingLimitRequest,
48
63
  UpdateSpendingLimitRequestFromJSON,
@@ -53,10 +68,24 @@ export interface CreateCryptoDepositOperationRequest {
53
68
  createCryptoDepositRequest: CreateCryptoDepositRequest;
54
69
  }
55
70
 
71
+ export interface DownloadInvoicePdfRequest {
72
+ id: string;
73
+ }
74
+
56
75
  export interface GetDepositRequest {
57
76
  id: string;
58
77
  }
59
78
 
79
+ export interface ListInvoicesRequest {
80
+ limit?: number;
81
+ cursor?: string;
82
+ }
83
+
84
+ export interface UpdateBillingDetailsOperationRequest {
85
+ updateBillingDetailsRequest: UpdateBillingDetailsRequest;
86
+ idempotencyKey?: string;
87
+ }
88
+
60
89
  export interface UpdateSpendingLimitOperationRequest {
61
90
  updateSpendingLimitRequest: UpdateSpendingLimitRequest;
62
91
  }
@@ -123,6 +152,61 @@ export class BillingApi extends runtime.BaseAPI {
123
152
  return await response.value();
124
153
  }
125
154
 
155
+ /**
156
+ * Creates request options for downloadInvoicePdf without sending the request
157
+ */
158
+ async downloadInvoicePdfRequestOpts(requestParameters: DownloadInvoicePdfRequest): Promise<runtime.RequestOpts> {
159
+ if (requestParameters['id'] == null) {
160
+ throw new runtime.RequiredError(
161
+ 'id',
162
+ 'Required parameter "id" was null or undefined when calling downloadInvoicePdf().'
163
+ );
164
+ }
165
+
166
+ const queryParameters: any = {};
167
+
168
+ const headerParameters: runtime.HTTPHeaders = {};
169
+
170
+ if (this.configuration && this.configuration.accessToken) {
171
+ const token = this.configuration.accessToken;
172
+ const tokenString = await token("bearerAuth", []);
173
+
174
+ if (tokenString) {
175
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
176
+ }
177
+ }
178
+
179
+ let urlPath = `/billing/invoices/{id}/pdf`;
180
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
181
+
182
+ return {
183
+ path: urlPath,
184
+ method: 'GET',
185
+ headers: headerParameters,
186
+ query: queryParameters,
187
+ };
188
+ }
189
+
190
+ /**
191
+ * Returns one invoice as a PDF, including the organization\'s billing details and full Tax ID. Requires the `billing:read` scope. An invoice belonging to another organization returns the same 404 as one that does not exist.
192
+ * Download an invoice PDF
193
+ */
194
+ async downloadInvoicePdfRaw(requestParameters: DownloadInvoicePdfRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>> {
195
+ const requestOptions = await this.downloadInvoicePdfRequestOpts(requestParameters);
196
+ const response = await this.request(requestOptions, initOverrides);
197
+
198
+ return new runtime.BlobApiResponse(response);
199
+ }
200
+
201
+ /**
202
+ * Returns one invoice as a PDF, including the organization\'s billing details and full Tax ID. Requires the `billing:read` scope. An invoice belonging to another organization returns the same 404 as one that does not exist.
203
+ * Download an invoice PDF
204
+ */
205
+ async downloadInvoicePdf(requestParameters: DownloadInvoicePdfRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob> {
206
+ const response = await this.downloadInvoicePdfRaw(requestParameters, initOverrides);
207
+ return await response.value();
208
+ }
209
+
126
210
  /**
127
211
  * Creates request options for getBalance without sending the request
128
212
  */
@@ -170,6 +254,53 @@ export class BillingApi extends runtime.BaseAPI {
170
254
  return await response.value();
171
255
  }
172
256
 
257
+ /**
258
+ * Creates request options for getBillingDetails without sending the request
259
+ */
260
+ async getBillingDetailsRequestOpts(): Promise<runtime.RequestOpts> {
261
+ const queryParameters: any = {};
262
+
263
+ const headerParameters: runtime.HTTPHeaders = {};
264
+
265
+ if (this.configuration && this.configuration.accessToken) {
266
+ const token = this.configuration.accessToken;
267
+ const tokenString = await token("bearerAuth", []);
268
+
269
+ if (tokenString) {
270
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
271
+ }
272
+ }
273
+
274
+ let urlPath = `/billing/details`;
275
+
276
+ return {
277
+ path: urlPath,
278
+ method: 'GET',
279
+ headers: headerParameters,
280
+ query: queryParameters,
281
+ };
282
+ }
283
+
284
+ /**
285
+ * Returns the company name, address and Tax ID printed on the organization\'s invoices. Requires the `billing:read` scope. The Tax ID is stored encrypted and is only ever returned masked (`tax_id_masked`); the full value is printed on the organization\'s own invoice PDFs and nowhere else.
286
+ * Get billing details
287
+ */
288
+ async getBillingDetailsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BillingDetails>> {
289
+ const requestOptions = await this.getBillingDetailsRequestOpts();
290
+ const response = await this.request(requestOptions, initOverrides);
291
+
292
+ return new runtime.JSONApiResponse(response, (jsonValue) => BillingDetailsFromJSON(jsonValue));
293
+ }
294
+
295
+ /**
296
+ * Returns the company name, address and Tax ID printed on the organization\'s invoices. Requires the `billing:read` scope. The Tax ID is stored encrypted and is only ever returned masked (`tax_id_masked`); the full value is printed on the organization\'s own invoice PDFs and nowhere else.
297
+ * Get billing details
298
+ */
299
+ async getBillingDetails(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BillingDetails> {
300
+ const response = await this.getBillingDetailsRaw(initOverrides);
301
+ return await response.value();
302
+ }
303
+
173
304
  /**
174
305
  * Creates request options for getDeposit without sending the request
175
306
  */
@@ -319,6 +450,122 @@ export class BillingApi extends runtime.BaseAPI {
319
450
  return await response.value();
320
451
  }
321
452
 
453
+ /**
454
+ * Creates request options for listInvoices without sending the request
455
+ */
456
+ async listInvoicesRequestOpts(requestParameters: ListInvoicesRequest): Promise<runtime.RequestOpts> {
457
+ const queryParameters: any = {};
458
+
459
+ if (requestParameters['limit'] != null) {
460
+ queryParameters['limit'] = requestParameters['limit'];
461
+ }
462
+
463
+ if (requestParameters['cursor'] != null) {
464
+ queryParameters['cursor'] = requestParameters['cursor'];
465
+ }
466
+
467
+ const headerParameters: runtime.HTTPHeaders = {};
468
+
469
+ if (this.configuration && this.configuration.accessToken) {
470
+ const token = this.configuration.accessToken;
471
+ const tokenString = await token("bearerAuth", []);
472
+
473
+ if (tokenString) {
474
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
475
+ }
476
+ }
477
+
478
+ let urlPath = `/billing/invoices`;
479
+
480
+ return {
481
+ path: urlPath,
482
+ method: 'GET',
483
+ headers: headerParameters,
484
+ query: queryParameters,
485
+ };
486
+ }
487
+
488
+ /**
489
+ * Returns the organization\'s invoices, newest first. Every payment (card purchase, auto-pay top up, stablecoin deposit) has one; promotional credit does not. Requires the `billing:read` scope.
490
+ * List invoices
491
+ */
492
+ async listInvoicesRaw(requestParameters: ListInvoicesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InvoiceList>> {
493
+ const requestOptions = await this.listInvoicesRequestOpts(requestParameters);
494
+ const response = await this.request(requestOptions, initOverrides);
495
+
496
+ return new runtime.JSONApiResponse(response, (jsonValue) => InvoiceListFromJSON(jsonValue));
497
+ }
498
+
499
+ /**
500
+ * Returns the organization\'s invoices, newest first. Every payment (card purchase, auto-pay top up, stablecoin deposit) has one; promotional credit does not. Requires the `billing:read` scope.
501
+ * List invoices
502
+ */
503
+ async listInvoices(requestParameters: ListInvoicesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InvoiceList> {
504
+ const response = await this.listInvoicesRaw(requestParameters, initOverrides);
505
+ return await response.value();
506
+ }
507
+
508
+ /**
509
+ * Creates request options for updateBillingDetails without sending the request
510
+ */
511
+ async updateBillingDetailsRequestOpts(requestParameters: UpdateBillingDetailsOperationRequest): Promise<runtime.RequestOpts> {
512
+ if (requestParameters['updateBillingDetailsRequest'] == null) {
513
+ throw new runtime.RequiredError(
514
+ 'updateBillingDetailsRequest',
515
+ 'Required parameter "updateBillingDetailsRequest" was null or undefined when calling updateBillingDetails().'
516
+ );
517
+ }
518
+
519
+ const queryParameters: any = {};
520
+
521
+ const headerParameters: runtime.HTTPHeaders = {};
522
+
523
+ headerParameters['Content-Type'] = 'application/json';
524
+
525
+ if (requestParameters['idempotencyKey'] != null) {
526
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
527
+ }
528
+
529
+ if (this.configuration && this.configuration.accessToken) {
530
+ const token = this.configuration.accessToken;
531
+ const tokenString = await token("bearerAuth", []);
532
+
533
+ if (tokenString) {
534
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
535
+ }
536
+ }
537
+
538
+ let urlPath = `/billing/details`;
539
+
540
+ return {
541
+ path: urlPath,
542
+ method: 'PATCH',
543
+ headers: headerParameters,
544
+ query: queryParameters,
545
+ body: UpdateBillingDetailsRequestToJSON(requestParameters['updateBillingDetailsRequest']),
546
+ };
547
+ }
548
+
549
+ /**
550
+ * Updates the billing details printed on invoices. Requires the `billing:write` scope and an org admin\'s key. Omitted fields keep their value. `tax_id` replaces the stored Tax ID (and needs `tax_id_type` unless one is already stored); an empty `tax_id` removes it. Returns 503 `tax-id-unavailable` when this deployment cannot store a Tax ID.
551
+ * Update billing details
552
+ */
553
+ async updateBillingDetailsRaw(requestParameters: UpdateBillingDetailsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<BillingDetails>> {
554
+ const requestOptions = await this.updateBillingDetailsRequestOpts(requestParameters);
555
+ const response = await this.request(requestOptions, initOverrides);
556
+
557
+ return new runtime.JSONApiResponse(response, (jsonValue) => BillingDetailsFromJSON(jsonValue));
558
+ }
559
+
560
+ /**
561
+ * Updates the billing details printed on invoices. Requires the `billing:write` scope and an org admin\'s key. Omitted fields keep their value. `tax_id` replaces the stored Tax ID (and needs `tax_id_type` unless one is already stored); an empty `tax_id` removes it. Returns 503 `tax-id-unavailable` when this deployment cannot store a Tax ID.
562
+ * Update billing details
563
+ */
564
+ async updateBillingDetails(requestParameters: UpdateBillingDetailsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<BillingDetails> {
565
+ const response = await this.updateBillingDetailsRaw(requestParameters, initOverrides);
566
+ return await response.value();
567
+ }
568
+
322
569
  /**
323
570
  * Creates request options for updateSpendingLimit without sending the request
324
571
  */