@gpuai/sdk 0.3.13 → 0.3.15

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 (108) hide show
  1. package/.openapi-generator/FILES +28 -0
  2. package/README.md +34 -9
  3. package/dist/apis/AutolaunchApi.d.ts +109 -0
  4. package/dist/apis/AutolaunchApi.js +286 -0
  5. package/dist/apis/BillingApi.d.ts +15 -0
  6. package/dist/apis/BillingApi.js +45 -0
  7. package/dist/apis/MarketApi.d.ts +56 -0
  8. package/dist/apis/MarketApi.js +112 -0
  9. package/dist/apis/WatchApi.d.ts +109 -0
  10. package/dist/apis/WatchApi.js +286 -0
  11. package/dist/apis/index.d.ts +3 -0
  12. package/dist/apis/index.js +3 -0
  13. package/dist/esm/apis/AutolaunchApi.d.ts +109 -0
  14. package/dist/esm/apis/AutolaunchApi.js +282 -0
  15. package/dist/esm/apis/BillingApi.d.ts +15 -0
  16. package/dist/esm/apis/BillingApi.js +45 -0
  17. package/dist/esm/apis/MarketApi.d.ts +56 -0
  18. package/dist/esm/apis/MarketApi.js +108 -0
  19. package/dist/esm/apis/WatchApi.d.ts +109 -0
  20. package/dist/esm/apis/WatchApi.js +282 -0
  21. package/dist/esm/apis/index.d.ts +3 -0
  22. package/dist/esm/apis/index.js +3 -0
  23. package/dist/esm/models/AutolaunchRule.d.ts +181 -0
  24. package/dist/esm/models/AutolaunchRule.js +142 -0
  25. package/dist/esm/models/AutolaunchRuleCreate.d.ts +105 -0
  26. package/dist/esm/models/AutolaunchRuleCreate.js +84 -0
  27. package/dist/esm/models/AutolaunchRuleDisarm.d.ts +34 -0
  28. package/dist/esm/models/AutolaunchRuleDisarm.js +43 -0
  29. package/dist/esm/models/AutolaunchRulePage.d.ts +39 -0
  30. package/dist/esm/models/AutolaunchRulePage.js +48 -0
  31. package/dist/esm/models/Balance.d.ts +65 -0
  32. package/dist/esm/models/Balance.js +63 -0
  33. package/dist/esm/models/MarketHistoryPoint.d.ts +59 -0
  34. package/dist/esm/models/MarketHistoryPoint.js +55 -0
  35. package/dist/esm/models/MarketHistoryResponse.d.ts +60 -0
  36. package/dist/esm/models/MarketHistoryResponse.js +60 -0
  37. package/dist/esm/models/Problem.d.ts +1 -0
  38. package/dist/esm/models/Problem.js +1 -0
  39. package/dist/esm/models/WatchRule.d.ts +141 -0
  40. package/dist/esm/models/WatchRule.js +117 -0
  41. package/dist/esm/models/WatchRuleCreate.d.ts +87 -0
  42. package/dist/esm/models/WatchRuleCreate.js +72 -0
  43. package/dist/esm/models/WatchRulePage.d.ts +39 -0
  44. package/dist/esm/models/WatchRulePage.js +48 -0
  45. package/dist/esm/models/WatchRuleUpdate.d.ts +86 -0
  46. package/dist/esm/models/WatchRuleUpdate.js +68 -0
  47. package/dist/esm/models/index.d.ts +11 -0
  48. package/dist/esm/models/index.js +11 -0
  49. package/dist/models/AutolaunchRule.d.ts +181 -0
  50. package/dist/models/AutolaunchRule.js +150 -0
  51. package/dist/models/AutolaunchRuleCreate.d.ts +105 -0
  52. package/dist/models/AutolaunchRuleCreate.js +92 -0
  53. package/dist/models/AutolaunchRuleDisarm.d.ts +34 -0
  54. package/dist/models/AutolaunchRuleDisarm.js +50 -0
  55. package/dist/models/AutolaunchRulePage.d.ts +39 -0
  56. package/dist/models/AutolaunchRulePage.js +55 -0
  57. package/dist/models/Balance.d.ts +65 -0
  58. package/dist/models/Balance.js +70 -0
  59. package/dist/models/MarketHistoryPoint.d.ts +59 -0
  60. package/dist/models/MarketHistoryPoint.js +62 -0
  61. package/dist/models/MarketHistoryResponse.d.ts +60 -0
  62. package/dist/models/MarketHistoryResponse.js +67 -0
  63. package/dist/models/Problem.d.ts +1 -0
  64. package/dist/models/Problem.js +1 -0
  65. package/dist/models/WatchRule.d.ts +141 -0
  66. package/dist/models/WatchRule.js +125 -0
  67. package/dist/models/WatchRuleCreate.d.ts +87 -0
  68. package/dist/models/WatchRuleCreate.js +80 -0
  69. package/dist/models/WatchRulePage.d.ts +39 -0
  70. package/dist/models/WatchRulePage.js +55 -0
  71. package/dist/models/WatchRuleUpdate.d.ts +86 -0
  72. package/dist/models/WatchRuleUpdate.js +76 -0
  73. package/dist/models/index.d.ts +11 -0
  74. package/dist/models/index.js +11 -0
  75. package/docs/AutolaunchApi.md +390 -0
  76. package/docs/AutolaunchRule.md +69 -0
  77. package/docs/AutolaunchRuleCreate.md +50 -0
  78. package/docs/AutolaunchRuleDisarm.md +35 -0
  79. package/docs/AutolaunchRulePage.md +36 -0
  80. package/docs/Balance.md +45 -0
  81. package/docs/BillingApi.md +66 -0
  82. package/docs/MarketApi.md +98 -0
  83. package/docs/MarketHistoryPoint.md +43 -0
  84. package/docs/MarketHistoryResponse.md +43 -0
  85. package/docs/WatchApi.md +389 -0
  86. package/docs/WatchRule.md +61 -0
  87. package/docs/WatchRuleCreate.md +46 -0
  88. package/docs/WatchRulePage.md +36 -0
  89. package/docs/WatchRuleUpdate.md +47 -0
  90. package/package.json +1 -1
  91. package/src/apis/AutolaunchApi.ts +360 -0
  92. package/src/apis/BillingApi.ts +52 -0
  93. package/src/apis/MarketApi.ts +136 -0
  94. package/src/apis/WatchApi.ts +360 -0
  95. package/src/apis/index.ts +3 -0
  96. package/src/models/AutolaunchRule.ts +270 -0
  97. package/src/models/AutolaunchRuleCreate.ts +162 -0
  98. package/src/models/AutolaunchRuleDisarm.ts +68 -0
  99. package/src/models/AutolaunchRulePage.ts +83 -0
  100. package/src/models/Balance.ts +114 -0
  101. package/src/models/MarketHistoryPoint.ts +103 -0
  102. package/src/models/MarketHistoryResponse.ts +113 -0
  103. package/src/models/Problem.ts +1 -0
  104. package/src/models/WatchRule.ts +219 -0
  105. package/src/models/WatchRuleCreate.ts +138 -0
  106. package/src/models/WatchRulePage.ts +83 -0
  107. package/src/models/WatchRuleUpdate.ts +135 -0
  108. package/src/models/index.ts +11 -0
@@ -0,0 +1,136 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import * as runtime from '../runtime';
16
+ import {
17
+ type MarketHistoryResponse,
18
+ MarketHistoryResponseFromJSON,
19
+ MarketHistoryResponseToJSON,
20
+ } from '../models/MarketHistoryResponse';
21
+ import {
22
+ type Problem,
23
+ ProblemFromJSON,
24
+ ProblemToJSON,
25
+ } from '../models/Problem';
26
+
27
+ export interface GetMarketHistoryRequest {
28
+ gpuModel: string;
29
+ region?: string;
30
+ capacityClass?: GetMarketHistoryCapacityClassEnum;
31
+ bucket?: GetMarketHistoryBucketEnum;
32
+ from?: Date;
33
+ to?: Date;
34
+ }
35
+
36
+ /**
37
+ *
38
+ */
39
+ export class MarketApi extends runtime.BaseAPI {
40
+
41
+ /**
42
+ * Creates request options for getMarketHistory without sending the request
43
+ */
44
+ async getMarketHistoryRequestOpts(requestParameters: GetMarketHistoryRequest): Promise<runtime.RequestOpts> {
45
+ if (requestParameters['gpuModel'] == null) {
46
+ throw new runtime.RequiredError(
47
+ 'gpuModel',
48
+ 'Required parameter "gpuModel" was null or undefined when calling getMarketHistory().'
49
+ );
50
+ }
51
+
52
+ const queryParameters: any = {};
53
+
54
+ if (requestParameters['gpuModel'] != null) {
55
+ queryParameters['gpu_model'] = requestParameters['gpuModel'];
56
+ }
57
+
58
+ if (requestParameters['region'] != null) {
59
+ queryParameters['region'] = requestParameters['region'];
60
+ }
61
+
62
+ if (requestParameters['capacityClass'] != null) {
63
+ queryParameters['capacity_class'] = requestParameters['capacityClass'];
64
+ }
65
+
66
+ if (requestParameters['bucket'] != null) {
67
+ queryParameters['bucket'] = requestParameters['bucket'];
68
+ }
69
+
70
+ if (requestParameters['from'] != null) {
71
+ queryParameters['from'] = (requestParameters['from'] as any).toISOString();
72
+ }
73
+
74
+ if (requestParameters['to'] != null) {
75
+ queryParameters['to'] = (requestParameters['to'] as any).toISOString();
76
+ }
77
+
78
+ const headerParameters: runtime.HTTPHeaders = {};
79
+
80
+ if (this.configuration && this.configuration.accessToken) {
81
+ const token = this.configuration.accessToken;
82
+ const tokenString = await token("bearerAuth", []);
83
+
84
+ if (tokenString) {
85
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
86
+ }
87
+ }
88
+
89
+ let urlPath = `/market-history`;
90
+
91
+ return {
92
+ path: urlPath,
93
+ method: 'GET',
94
+ headers: headerParameters,
95
+ query: queryParameters,
96
+ };
97
+ }
98
+
99
+ /**
100
+ * Returns GPU.ai\'s own price and obtainable capacity for one GPU model over a window, at 15-minute or daily resolution. Requires the `market:read` scope (or `full_access`). THE NULL CONTRACT. `price_per_gpu_hour` and `available_count` are nullable, and the two states are different facts that must not be collapsed: * a real `0` means we sampled that bucket and the market was sold out; * `null` means we did NOT sample that bucket — a failed poll, a skipped cycle, an incident on our side. It says nothing about supply. The response materializes the full bucket grid across the window, so a gap has visible width. Do not interpolate across a null: that asserts a continuity the data does not have, and reading one as a zero reports our own outages as supplier stockouts. PER-GPU NORMALIZATION. `price_per_gpu_hour` is always a per-GPU rate. When it was divided out of a whole-node price, `node_price_per_hour` and `gpu_count` are present and describe that derivation; they are absent for single-GPU capacity. A per-GPU figure presented without that context implies single-GPU rentability that whole-node capacity does not offer. WINDOW CAPS. `bucket=1d` is capped at 365 days (the retention window). `bucket=15m` is capped at 90 days when BOTH `region` and `capacity_class` are supplied, and at 31 days when either is omitted, because an unscoped 15-minute series scans every region and class in every bucket. An over-wide window is a 400 naming the cap and both escapes, never a silent truncation. This series carries no upstream supplier identity of any kind: the price is GPU.ai\'s own floor and the count is an aggregate.
101
+ * Get a GPU\'s price and availability over time
102
+ */
103
+ async getMarketHistoryRaw(requestParameters: GetMarketHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MarketHistoryResponse>> {
104
+ const requestOptions = await this.getMarketHistoryRequestOpts(requestParameters);
105
+ const response = await this.request(requestOptions, initOverrides);
106
+
107
+ return new runtime.JSONApiResponse(response, (jsonValue) => MarketHistoryResponseFromJSON(jsonValue));
108
+ }
109
+
110
+ /**
111
+ * Returns GPU.ai\'s own price and obtainable capacity for one GPU model over a window, at 15-minute or daily resolution. Requires the `market:read` scope (or `full_access`). THE NULL CONTRACT. `price_per_gpu_hour` and `available_count` are nullable, and the two states are different facts that must not be collapsed: * a real `0` means we sampled that bucket and the market was sold out; * `null` means we did NOT sample that bucket — a failed poll, a skipped cycle, an incident on our side. It says nothing about supply. The response materializes the full bucket grid across the window, so a gap has visible width. Do not interpolate across a null: that asserts a continuity the data does not have, and reading one as a zero reports our own outages as supplier stockouts. PER-GPU NORMALIZATION. `price_per_gpu_hour` is always a per-GPU rate. When it was divided out of a whole-node price, `node_price_per_hour` and `gpu_count` are present and describe that derivation; they are absent for single-GPU capacity. A per-GPU figure presented without that context implies single-GPU rentability that whole-node capacity does not offer. WINDOW CAPS. `bucket=1d` is capped at 365 days (the retention window). `bucket=15m` is capped at 90 days when BOTH `region` and `capacity_class` are supplied, and at 31 days when either is omitted, because an unscoped 15-minute series scans every region and class in every bucket. An over-wide window is a 400 naming the cap and both escapes, never a silent truncation. This series carries no upstream supplier identity of any kind: the price is GPU.ai\'s own floor and the count is an aggregate.
112
+ * Get a GPU\'s price and availability over time
113
+ */
114
+ async getMarketHistory(requestParameters: GetMarketHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MarketHistoryResponse> {
115
+ const response = await this.getMarketHistoryRaw(requestParameters, initOverrides);
116
+ return await response.value();
117
+ }
118
+
119
+ }
120
+
121
+ /**
122
+ * @export
123
+ */
124
+ export const GetMarketHistoryCapacityClassEnum = {
125
+ Secure: 'secure',
126
+ Community: 'community'
127
+ } as const;
128
+ export type GetMarketHistoryCapacityClassEnum = typeof GetMarketHistoryCapacityClassEnum[keyof typeof GetMarketHistoryCapacityClassEnum];
129
+ /**
130
+ * @export
131
+ */
132
+ export const GetMarketHistoryBucketEnum = {
133
+ _15m: '15m',
134
+ _1d: '1d'
135
+ } as const;
136
+ export type GetMarketHistoryBucketEnum = typeof GetMarketHistoryBucketEnum[keyof typeof GetMarketHistoryBucketEnum];
@@ -0,0 +1,360 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import * as runtime from '../runtime';
16
+ import {
17
+ type Problem,
18
+ ProblemFromJSON,
19
+ ProblemToJSON,
20
+ } from '../models/Problem';
21
+ import {
22
+ type WatchRule,
23
+ WatchRuleFromJSON,
24
+ WatchRuleToJSON,
25
+ } from '../models/WatchRule';
26
+ import {
27
+ type WatchRuleCreate,
28
+ WatchRuleCreateFromJSON,
29
+ WatchRuleCreateToJSON,
30
+ } from '../models/WatchRuleCreate';
31
+ import {
32
+ type WatchRulePage,
33
+ WatchRulePageFromJSON,
34
+ WatchRulePageToJSON,
35
+ } from '../models/WatchRulePage';
36
+ import {
37
+ type WatchRuleUpdate,
38
+ WatchRuleUpdateFromJSON,
39
+ WatchRuleUpdateToJSON,
40
+ } from '../models/WatchRuleUpdate';
41
+
42
+ export interface CreateWatchRuleRequest {
43
+ watchRuleCreate: WatchRuleCreate;
44
+ idempotencyKey?: string;
45
+ }
46
+
47
+ export interface DeleteWatchRuleRequest {
48
+ id: string;
49
+ }
50
+
51
+ export interface GetWatchRuleRequest {
52
+ id: string;
53
+ }
54
+
55
+ export interface ListWatchRulesRequest {
56
+ cursor?: string;
57
+ limit?: number;
58
+ }
59
+
60
+ export interface UpdateWatchRuleRequest {
61
+ id: string;
62
+ watchRuleUpdate: WatchRuleUpdate;
63
+ }
64
+
65
+ /**
66
+ *
67
+ */
68
+ export class WatchApi extends runtime.BaseAPI {
69
+
70
+ /**
71
+ * Creates request options for createWatchRule without sending the request
72
+ */
73
+ async createWatchRuleRequestOpts(requestParameters: CreateWatchRuleRequest): Promise<runtime.RequestOpts> {
74
+ if (requestParameters['watchRuleCreate'] == null) {
75
+ throw new runtime.RequiredError(
76
+ 'watchRuleCreate',
77
+ 'Required parameter "watchRuleCreate" was null or undefined when calling createWatchRule().'
78
+ );
79
+ }
80
+
81
+ const queryParameters: any = {};
82
+
83
+ const headerParameters: runtime.HTTPHeaders = {};
84
+
85
+ headerParameters['Content-Type'] = 'application/json';
86
+
87
+ if (requestParameters['idempotencyKey'] != null) {
88
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
89
+ }
90
+
91
+ if (this.configuration && this.configuration.accessToken) {
92
+ const token = this.configuration.accessToken;
93
+ const tokenString = await token("bearerAuth", []);
94
+
95
+ if (tokenString) {
96
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
97
+ }
98
+ }
99
+
100
+ let urlPath = `/watch-rules`;
101
+
102
+ return {
103
+ path: urlPath,
104
+ method: 'POST',
105
+ headers: headerParameters,
106
+ query: queryParameters,
107
+ body: WatchRuleCreateToJSON(requestParameters['watchRuleCreate']),
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Creates a rule that notifies you when the market moves on a GPU model. Requires the `watch:write` scope (or `full_access`). A watch rule ONLY notifies. It cannot launch capacity and cannot spend money: there is no field on this resource that provisions anything. Automatic launching is a separate resource with its own spend-consent gate. Targeting is dimensional — a GPU model plus optional canonical region and capacity class. It is deliberately NOT possible to pin a rule to a specific catalog listing: listing identity is unstable, so a pinned rule can silently match nothing and never fire. Delivery is to the organization\'s registered webhook endpoints, plus an email to the rule\'s creator. `webhook_endpoint_override_id` routes one rule to one specific endpoint and is the id of an endpoint already registered via `/webhook-endpoints` — the resource accepts no URL of any kind. Organizations are limited to 50 ENABLED rules; the 422 names the limit.
113
+ * Create a watch rule
114
+ */
115
+ async createWatchRuleRaw(requestParameters: CreateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>> {
116
+ const requestOptions = await this.createWatchRuleRequestOpts(requestParameters);
117
+ const response = await this.request(requestOptions, initOverrides);
118
+
119
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
120
+ }
121
+
122
+ /**
123
+ * Creates a rule that notifies you when the market moves on a GPU model. Requires the `watch:write` scope (or `full_access`). A watch rule ONLY notifies. It cannot launch capacity and cannot spend money: there is no field on this resource that provisions anything. Automatic launching is a separate resource with its own spend-consent gate. Targeting is dimensional — a GPU model plus optional canonical region and capacity class. It is deliberately NOT possible to pin a rule to a specific catalog listing: listing identity is unstable, so a pinned rule can silently match nothing and never fire. Delivery is to the organization\'s registered webhook endpoints, plus an email to the rule\'s creator. `webhook_endpoint_override_id` routes one rule to one specific endpoint and is the id of an endpoint already registered via `/webhook-endpoints` — the resource accepts no URL of any kind. Organizations are limited to 50 ENABLED rules; the 422 names the limit.
124
+ * Create a watch rule
125
+ */
126
+ async createWatchRule(requestParameters: CreateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule> {
127
+ const response = await this.createWatchRuleRaw(requestParameters, initOverrides);
128
+ return await response.value();
129
+ }
130
+
131
+ /**
132
+ * Creates request options for deleteWatchRule without sending the request
133
+ */
134
+ async deleteWatchRuleRequestOpts(requestParameters: DeleteWatchRuleRequest): Promise<runtime.RequestOpts> {
135
+ if (requestParameters['id'] == null) {
136
+ throw new runtime.RequiredError(
137
+ 'id',
138
+ 'Required parameter "id" was null or undefined when calling deleteWatchRule().'
139
+ );
140
+ }
141
+
142
+ const queryParameters: any = {};
143
+
144
+ const headerParameters: runtime.HTTPHeaders = {};
145
+
146
+ if (this.configuration && this.configuration.accessToken) {
147
+ const token = this.configuration.accessToken;
148
+ const tokenString = await token("bearerAuth", []);
149
+
150
+ if (tokenString) {
151
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
152
+ }
153
+ }
154
+
155
+ let urlPath = `/watch-rules/{id}`;
156
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
157
+
158
+ return {
159
+ path: urlPath,
160
+ method: 'DELETE',
161
+ headers: headerParameters,
162
+ query: queryParameters,
163
+ };
164
+ }
165
+
166
+ /**
167
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
168
+ * Delete a watch rule
169
+ */
170
+ async deleteWatchRuleRaw(requestParameters: DeleteWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
171
+ const requestOptions = await this.deleteWatchRuleRequestOpts(requestParameters);
172
+ const response = await this.request(requestOptions, initOverrides);
173
+
174
+ return new runtime.VoidApiResponse(response);
175
+ }
176
+
177
+ /**
178
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
179
+ * Delete a watch rule
180
+ */
181
+ async deleteWatchRule(requestParameters: DeleteWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
182
+ await this.deleteWatchRuleRaw(requestParameters, initOverrides);
183
+ }
184
+
185
+ /**
186
+ * Creates request options for getWatchRule without sending the request
187
+ */
188
+ async getWatchRuleRequestOpts(requestParameters: GetWatchRuleRequest): Promise<runtime.RequestOpts> {
189
+ if (requestParameters['id'] == null) {
190
+ throw new runtime.RequiredError(
191
+ 'id',
192
+ 'Required parameter "id" was null or undefined when calling getWatchRule().'
193
+ );
194
+ }
195
+
196
+ const queryParameters: any = {};
197
+
198
+ const headerParameters: runtime.HTTPHeaders = {};
199
+
200
+ if (this.configuration && this.configuration.accessToken) {
201
+ const token = this.configuration.accessToken;
202
+ const tokenString = await token("bearerAuth", []);
203
+
204
+ if (tokenString) {
205
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
206
+ }
207
+ }
208
+
209
+ let urlPath = `/watch-rules/{id}`;
210
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
211
+
212
+ return {
213
+ path: urlPath,
214
+ method: 'GET',
215
+ headers: headerParameters,
216
+ query: queryParameters,
217
+ };
218
+ }
219
+
220
+ /**
221
+ * Fetches one watch rule. Requires the `watch:read` scope (or `full_access`). A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
222
+ * Get a watch rule
223
+ */
224
+ async getWatchRuleRaw(requestParameters: GetWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>> {
225
+ const requestOptions = await this.getWatchRuleRequestOpts(requestParameters);
226
+ const response = await this.request(requestOptions, initOverrides);
227
+
228
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
229
+ }
230
+
231
+ /**
232
+ * Fetches one watch rule. Requires the `watch:read` scope (or `full_access`). A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
233
+ * Get a watch rule
234
+ */
235
+ async getWatchRule(requestParameters: GetWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule> {
236
+ const response = await this.getWatchRuleRaw(requestParameters, initOverrides);
237
+ return await response.value();
238
+ }
239
+
240
+ /**
241
+ * Creates request options for listWatchRules without sending the request
242
+ */
243
+ async listWatchRulesRequestOpts(requestParameters: ListWatchRulesRequest): Promise<runtime.RequestOpts> {
244
+ const queryParameters: any = {};
245
+
246
+ if (requestParameters['cursor'] != null) {
247
+ queryParameters['cursor'] = requestParameters['cursor'];
248
+ }
249
+
250
+ if (requestParameters['limit'] != null) {
251
+ queryParameters['limit'] = requestParameters['limit'];
252
+ }
253
+
254
+ const headerParameters: runtime.HTTPHeaders = {};
255
+
256
+ if (this.configuration && this.configuration.accessToken) {
257
+ const token = this.configuration.accessToken;
258
+ const tokenString = await token("bearerAuth", []);
259
+
260
+ if (tokenString) {
261
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
262
+ }
263
+ }
264
+
265
+ let urlPath = `/watch-rules`;
266
+
267
+ return {
268
+ path: urlPath,
269
+ method: 'GET',
270
+ headers: headerParameters,
271
+ query: queryParameters,
272
+ };
273
+ }
274
+
275
+ /**
276
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
277
+ * List watch rules
278
+ */
279
+ async listWatchRulesRaw(requestParameters: ListWatchRulesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRulePage>> {
280
+ const requestOptions = await this.listWatchRulesRequestOpts(requestParameters);
281
+ const response = await this.request(requestOptions, initOverrides);
282
+
283
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRulePageFromJSON(jsonValue));
284
+ }
285
+
286
+ /**
287
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
288
+ * List watch rules
289
+ */
290
+ async listWatchRules(requestParameters: ListWatchRulesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRulePage> {
291
+ const response = await this.listWatchRulesRaw(requestParameters, initOverrides);
292
+ return await response.value();
293
+ }
294
+
295
+ /**
296
+ * Creates request options for updateWatchRule without sending the request
297
+ */
298
+ async updateWatchRuleRequestOpts(requestParameters: UpdateWatchRuleRequest): Promise<runtime.RequestOpts> {
299
+ if (requestParameters['id'] == null) {
300
+ throw new runtime.RequiredError(
301
+ 'id',
302
+ 'Required parameter "id" was null or undefined when calling updateWatchRule().'
303
+ );
304
+ }
305
+
306
+ if (requestParameters['watchRuleUpdate'] == null) {
307
+ throw new runtime.RequiredError(
308
+ 'watchRuleUpdate',
309
+ 'Required parameter "watchRuleUpdate" was null or undefined when calling updateWatchRule().'
310
+ );
311
+ }
312
+
313
+ const queryParameters: any = {};
314
+
315
+ const headerParameters: runtime.HTTPHeaders = {};
316
+
317
+ headerParameters['Content-Type'] = 'application/json';
318
+
319
+ if (this.configuration && this.configuration.accessToken) {
320
+ const token = this.configuration.accessToken;
321
+ const tokenString = await token("bearerAuth", []);
322
+
323
+ if (tokenString) {
324
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
325
+ }
326
+ }
327
+
328
+ let urlPath = `/watch-rules/{id}`;
329
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
330
+
331
+ return {
332
+ path: urlPath,
333
+ method: 'PATCH',
334
+ headers: headerParameters,
335
+ query: queryParameters,
336
+ body: WatchRuleUpdateToJSON(requestParameters['watchRuleUpdate']),
337
+ };
338
+ }
339
+
340
+ /**
341
+ * Partially updates a watch rule. Requires the `watch:write` scope (or `full_access`). An ABSENT key keeps the stored value; an explicit `null` on `region`, `capacity_class` or `webhook_endpoint_override_id` CLEARS it back to \"any\" / \"organization default\". The two are distinguished by which keys the body carries, so send only the keys you mean to change. Editing a rule RE-ARMS it: the fired latch describes the condition that was replaced, so carrying it across an edit would suppress the first alert on the new one.
342
+ * Update a watch rule
343
+ */
344
+ async updateWatchRuleRaw(requestParameters: UpdateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>> {
345
+ const requestOptions = await this.updateWatchRuleRequestOpts(requestParameters);
346
+ const response = await this.request(requestOptions, initOverrides);
347
+
348
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
349
+ }
350
+
351
+ /**
352
+ * Partially updates a watch rule. Requires the `watch:write` scope (or `full_access`). An ABSENT key keeps the stored value; an explicit `null` on `region`, `capacity_class` or `webhook_endpoint_override_id` CLEARS it back to \"any\" / \"organization default\". The two are distinguished by which keys the body carries, so send only the keys you mean to change. Editing a rule RE-ARMS it: the fired latch describes the condition that was replaced, so carrying it across an edit would suppress the first alert on the new one.
353
+ * Update a watch rule
354
+ */
355
+ async updateWatchRule(requestParameters: UpdateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule> {
356
+ const response = await this.updateWatchRuleRaw(requestParameters, initOverrides);
357
+ return await response.value();
358
+ }
359
+
360
+ }
package/src/apis/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export * from './AutolaunchApi';
3
4
  export * from './BillingApi';
4
5
  export * from './CommunityApi';
5
6
  export * from './EnvironmentsApi';
@@ -7,6 +8,7 @@ export * from './FineTuningApi';
7
8
  export * from './GpuTypesApi';
8
9
  export * from './InferenceApi';
9
10
  export * from './InstancesApi';
11
+ export * from './MarketApi';
10
12
  export * from './MetaApi';
11
13
  export * from './OperationsApi';
12
14
  export * from './PricingApi';
@@ -14,4 +16,5 @@ export * from './RegistryCredentialsApi';
14
16
  export * from './SshKeysApi';
15
17
  export * from './TemplatesApi';
16
18
  export * from './UsageApi';
19
+ export * from './WatchApi';
17
20
  export * from './WebhooksApi';