@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,108 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import * as runtime from '../runtime';
24
+ import { MarketHistoryResponseFromJSON, } from '../models/MarketHistoryResponse';
25
+ /**
26
+ *
27
+ */
28
+ export class MarketApi extends runtime.BaseAPI {
29
+ /**
30
+ * Creates request options for getMarketHistory without sending the request
31
+ */
32
+ getMarketHistoryRequestOpts(requestParameters) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ if (requestParameters['gpuModel'] == null) {
35
+ throw new runtime.RequiredError('gpuModel', 'Required parameter "gpuModel" was null or undefined when calling getMarketHistory().');
36
+ }
37
+ const queryParameters = {};
38
+ if (requestParameters['gpuModel'] != null) {
39
+ queryParameters['gpu_model'] = requestParameters['gpuModel'];
40
+ }
41
+ if (requestParameters['region'] != null) {
42
+ queryParameters['region'] = requestParameters['region'];
43
+ }
44
+ if (requestParameters['capacityClass'] != null) {
45
+ queryParameters['capacity_class'] = requestParameters['capacityClass'];
46
+ }
47
+ if (requestParameters['bucket'] != null) {
48
+ queryParameters['bucket'] = requestParameters['bucket'];
49
+ }
50
+ if (requestParameters['from'] != null) {
51
+ queryParameters['from'] = requestParameters['from'].toISOString();
52
+ }
53
+ if (requestParameters['to'] != null) {
54
+ queryParameters['to'] = requestParameters['to'].toISOString();
55
+ }
56
+ const headerParameters = {};
57
+ if (this.configuration && this.configuration.accessToken) {
58
+ const token = this.configuration.accessToken;
59
+ const tokenString = yield token("bearerAuth", []);
60
+ if (tokenString) {
61
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
62
+ }
63
+ }
64
+ let urlPath = `/market-history`;
65
+ return {
66
+ path: urlPath,
67
+ method: 'GET',
68
+ headers: headerParameters,
69
+ query: queryParameters,
70
+ };
71
+ });
72
+ }
73
+ /**
74
+ * 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.
75
+ * Get a GPU\'s price and availability over time
76
+ */
77
+ getMarketHistoryRaw(requestParameters, initOverrides) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const requestOptions = yield this.getMarketHistoryRequestOpts(requestParameters);
80
+ const response = yield this.request(requestOptions, initOverrides);
81
+ return new runtime.JSONApiResponse(response, (jsonValue) => MarketHistoryResponseFromJSON(jsonValue));
82
+ });
83
+ }
84
+ /**
85
+ * 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.
86
+ * Get a GPU\'s price and availability over time
87
+ */
88
+ getMarketHistory(requestParameters, initOverrides) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const response = yield this.getMarketHistoryRaw(requestParameters, initOverrides);
91
+ return yield response.value();
92
+ });
93
+ }
94
+ }
95
+ /**
96
+ * @export
97
+ */
98
+ export const GetMarketHistoryCapacityClassEnum = {
99
+ Secure: 'secure',
100
+ Community: 'community'
101
+ };
102
+ /**
103
+ * @export
104
+ */
105
+ export const GetMarketHistoryBucketEnum = {
106
+ _15m: '15m',
107
+ _1d: '1d'
108
+ };
@@ -0,0 +1,109 @@
1
+ /**
2
+ * GPU.ai Public Developer API
3
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: support@gpu.ai
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import { type WatchRule } from '../models/WatchRule';
14
+ import { type WatchRuleCreate } from '../models/WatchRuleCreate';
15
+ import { type WatchRulePage } from '../models/WatchRulePage';
16
+ import { type WatchRuleUpdate } from '../models/WatchRuleUpdate';
17
+ export interface CreateWatchRuleRequest {
18
+ watchRuleCreate: WatchRuleCreate;
19
+ idempotencyKey?: string;
20
+ }
21
+ export interface DeleteWatchRuleRequest {
22
+ id: string;
23
+ }
24
+ export interface GetWatchRuleRequest {
25
+ id: string;
26
+ }
27
+ export interface ListWatchRulesRequest {
28
+ cursor?: string;
29
+ limit?: number;
30
+ }
31
+ export interface UpdateWatchRuleRequest {
32
+ id: string;
33
+ watchRuleUpdate: WatchRuleUpdate;
34
+ }
35
+ /**
36
+ *
37
+ */
38
+ export declare class WatchApi extends runtime.BaseAPI {
39
+ /**
40
+ * Creates request options for createWatchRule without sending the request
41
+ */
42
+ createWatchRuleRequestOpts(requestParameters: CreateWatchRuleRequest): Promise<runtime.RequestOpts>;
43
+ /**
44
+ * 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.
45
+ * Create a watch rule
46
+ */
47
+ createWatchRuleRaw(requestParameters: CreateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>>;
48
+ /**
49
+ * 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.
50
+ * Create a watch rule
51
+ */
52
+ createWatchRule(requestParameters: CreateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule>;
53
+ /**
54
+ * Creates request options for deleteWatchRule without sending the request
55
+ */
56
+ deleteWatchRuleRequestOpts(requestParameters: DeleteWatchRuleRequest): Promise<runtime.RequestOpts>;
57
+ /**
58
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
59
+ * Delete a watch rule
60
+ */
61
+ deleteWatchRuleRaw(requestParameters: DeleteWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
62
+ /**
63
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
64
+ * Delete a watch rule
65
+ */
66
+ deleteWatchRule(requestParameters: DeleteWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
67
+ /**
68
+ * Creates request options for getWatchRule without sending the request
69
+ */
70
+ getWatchRuleRequestOpts(requestParameters: GetWatchRuleRequest): Promise<runtime.RequestOpts>;
71
+ /**
72
+ * 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.
73
+ * Get a watch rule
74
+ */
75
+ getWatchRuleRaw(requestParameters: GetWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>>;
76
+ /**
77
+ * 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.
78
+ * Get a watch rule
79
+ */
80
+ getWatchRule(requestParameters: GetWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule>;
81
+ /**
82
+ * Creates request options for listWatchRules without sending the request
83
+ */
84
+ listWatchRulesRequestOpts(requestParameters: ListWatchRulesRequest): Promise<runtime.RequestOpts>;
85
+ /**
86
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
87
+ * List watch rules
88
+ */
89
+ listWatchRulesRaw(requestParameters: ListWatchRulesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRulePage>>;
90
+ /**
91
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
92
+ * List watch rules
93
+ */
94
+ listWatchRules(requestParameters?: ListWatchRulesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRulePage>;
95
+ /**
96
+ * Creates request options for updateWatchRule without sending the request
97
+ */
98
+ updateWatchRuleRequestOpts(requestParameters: UpdateWatchRuleRequest): Promise<runtime.RequestOpts>;
99
+ /**
100
+ * 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.
101
+ * Update a watch rule
102
+ */
103
+ updateWatchRuleRaw(requestParameters: UpdateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>>;
104
+ /**
105
+ * 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.
106
+ * Update a watch rule
107
+ */
108
+ updateWatchRule(requestParameters: UpdateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule>;
109
+ }
@@ -0,0 +1,282 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import * as runtime from '../runtime';
24
+ import { WatchRuleFromJSON, } from '../models/WatchRule';
25
+ import { WatchRuleCreateToJSON, } from '../models/WatchRuleCreate';
26
+ import { WatchRulePageFromJSON, } from '../models/WatchRulePage';
27
+ import { WatchRuleUpdateToJSON, } from '../models/WatchRuleUpdate';
28
+ /**
29
+ *
30
+ */
31
+ export class WatchApi extends runtime.BaseAPI {
32
+ /**
33
+ * Creates request options for createWatchRule without sending the request
34
+ */
35
+ createWatchRuleRequestOpts(requestParameters) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ if (requestParameters['watchRuleCreate'] == null) {
38
+ throw new runtime.RequiredError('watchRuleCreate', 'Required parameter "watchRuleCreate" was null or undefined when calling createWatchRule().');
39
+ }
40
+ const queryParameters = {};
41
+ const headerParameters = {};
42
+ headerParameters['Content-Type'] = 'application/json';
43
+ if (requestParameters['idempotencyKey'] != null) {
44
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
45
+ }
46
+ if (this.configuration && this.configuration.accessToken) {
47
+ const token = this.configuration.accessToken;
48
+ const tokenString = yield token("bearerAuth", []);
49
+ if (tokenString) {
50
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
51
+ }
52
+ }
53
+ let urlPath = `/watch-rules`;
54
+ return {
55
+ path: urlPath,
56
+ method: 'POST',
57
+ headers: headerParameters,
58
+ query: queryParameters,
59
+ body: WatchRuleCreateToJSON(requestParameters['watchRuleCreate']),
60
+ };
61
+ });
62
+ }
63
+ /**
64
+ * 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.
65
+ * Create a watch rule
66
+ */
67
+ createWatchRuleRaw(requestParameters, initOverrides) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const requestOptions = yield this.createWatchRuleRequestOpts(requestParameters);
70
+ const response = yield this.request(requestOptions, initOverrides);
71
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
72
+ });
73
+ }
74
+ /**
75
+ * 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.
76
+ * Create a watch rule
77
+ */
78
+ createWatchRule(requestParameters, initOverrides) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const response = yield this.createWatchRuleRaw(requestParameters, initOverrides);
81
+ return yield response.value();
82
+ });
83
+ }
84
+ /**
85
+ * Creates request options for deleteWatchRule without sending the request
86
+ */
87
+ deleteWatchRuleRequestOpts(requestParameters) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ if (requestParameters['id'] == null) {
90
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteWatchRule().');
91
+ }
92
+ const queryParameters = {};
93
+ const headerParameters = {};
94
+ if (this.configuration && this.configuration.accessToken) {
95
+ const token = this.configuration.accessToken;
96
+ const tokenString = yield token("bearerAuth", []);
97
+ if (tokenString) {
98
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
99
+ }
100
+ }
101
+ let urlPath = `/watch-rules/{id}`;
102
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
103
+ return {
104
+ path: urlPath,
105
+ method: 'DELETE',
106
+ headers: headerParameters,
107
+ query: queryParameters,
108
+ };
109
+ });
110
+ }
111
+ /**
112
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
113
+ * Delete a watch rule
114
+ */
115
+ deleteWatchRuleRaw(requestParameters, initOverrides) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const requestOptions = yield this.deleteWatchRuleRequestOpts(requestParameters);
118
+ const response = yield this.request(requestOptions, initOverrides);
119
+ return new runtime.VoidApiResponse(response);
120
+ });
121
+ }
122
+ /**
123
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
124
+ * Delete a watch rule
125
+ */
126
+ deleteWatchRule(requestParameters, initOverrides) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ yield this.deleteWatchRuleRaw(requestParameters, initOverrides);
129
+ });
130
+ }
131
+ /**
132
+ * Creates request options for getWatchRule without sending the request
133
+ */
134
+ getWatchRuleRequestOpts(requestParameters) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ if (requestParameters['id'] == null) {
137
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getWatchRule().');
138
+ }
139
+ const queryParameters = {};
140
+ const headerParameters = {};
141
+ if (this.configuration && this.configuration.accessToken) {
142
+ const token = this.configuration.accessToken;
143
+ const tokenString = yield token("bearerAuth", []);
144
+ if (tokenString) {
145
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
146
+ }
147
+ }
148
+ let urlPath = `/watch-rules/{id}`;
149
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
150
+ return {
151
+ path: urlPath,
152
+ method: 'GET',
153
+ headers: headerParameters,
154
+ query: queryParameters,
155
+ };
156
+ });
157
+ }
158
+ /**
159
+ * 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.
160
+ * Get a watch rule
161
+ */
162
+ getWatchRuleRaw(requestParameters, initOverrides) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ const requestOptions = yield this.getWatchRuleRequestOpts(requestParameters);
165
+ const response = yield this.request(requestOptions, initOverrides);
166
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
167
+ });
168
+ }
169
+ /**
170
+ * 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.
171
+ * Get a watch rule
172
+ */
173
+ getWatchRule(requestParameters, initOverrides) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ const response = yield this.getWatchRuleRaw(requestParameters, initOverrides);
176
+ return yield response.value();
177
+ });
178
+ }
179
+ /**
180
+ * Creates request options for listWatchRules without sending the request
181
+ */
182
+ listWatchRulesRequestOpts(requestParameters) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ const queryParameters = {};
185
+ if (requestParameters['cursor'] != null) {
186
+ queryParameters['cursor'] = requestParameters['cursor'];
187
+ }
188
+ if (requestParameters['limit'] != null) {
189
+ queryParameters['limit'] = requestParameters['limit'];
190
+ }
191
+ const headerParameters = {};
192
+ if (this.configuration && this.configuration.accessToken) {
193
+ const token = this.configuration.accessToken;
194
+ const tokenString = yield token("bearerAuth", []);
195
+ if (tokenString) {
196
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
197
+ }
198
+ }
199
+ let urlPath = `/watch-rules`;
200
+ return {
201
+ path: urlPath,
202
+ method: 'GET',
203
+ headers: headerParameters,
204
+ query: queryParameters,
205
+ };
206
+ });
207
+ }
208
+ /**
209
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
210
+ * List watch rules
211
+ */
212
+ listWatchRulesRaw(requestParameters, initOverrides) {
213
+ return __awaiter(this, void 0, void 0, function* () {
214
+ const requestOptions = yield this.listWatchRulesRequestOpts(requestParameters);
215
+ const response = yield this.request(requestOptions, initOverrides);
216
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRulePageFromJSON(jsonValue));
217
+ });
218
+ }
219
+ /**
220
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
221
+ * List watch rules
222
+ */
223
+ listWatchRules() {
224
+ return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
225
+ const response = yield this.listWatchRulesRaw(requestParameters, initOverrides);
226
+ return yield response.value();
227
+ });
228
+ }
229
+ /**
230
+ * Creates request options for updateWatchRule without sending the request
231
+ */
232
+ updateWatchRuleRequestOpts(requestParameters) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ if (requestParameters['id'] == null) {
235
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling updateWatchRule().');
236
+ }
237
+ if (requestParameters['watchRuleUpdate'] == null) {
238
+ throw new runtime.RequiredError('watchRuleUpdate', 'Required parameter "watchRuleUpdate" was null or undefined when calling updateWatchRule().');
239
+ }
240
+ const queryParameters = {};
241
+ const headerParameters = {};
242
+ headerParameters['Content-Type'] = 'application/json';
243
+ if (this.configuration && this.configuration.accessToken) {
244
+ const token = this.configuration.accessToken;
245
+ const tokenString = yield token("bearerAuth", []);
246
+ if (tokenString) {
247
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
248
+ }
249
+ }
250
+ let urlPath = `/watch-rules/{id}`;
251
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
252
+ return {
253
+ path: urlPath,
254
+ method: 'PATCH',
255
+ headers: headerParameters,
256
+ query: queryParameters,
257
+ body: WatchRuleUpdateToJSON(requestParameters['watchRuleUpdate']),
258
+ };
259
+ });
260
+ }
261
+ /**
262
+ * 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.
263
+ * Update a watch rule
264
+ */
265
+ updateWatchRuleRaw(requestParameters, initOverrides) {
266
+ return __awaiter(this, void 0, void 0, function* () {
267
+ const requestOptions = yield this.updateWatchRuleRequestOpts(requestParameters);
268
+ const response = yield this.request(requestOptions, initOverrides);
269
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
270
+ });
271
+ }
272
+ /**
273
+ * 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.
274
+ * Update a watch rule
275
+ */
276
+ updateWatchRule(requestParameters, initOverrides) {
277
+ return __awaiter(this, void 0, void 0, function* () {
278
+ const response = yield this.updateWatchRuleRaw(requestParameters, initOverrides);
279
+ return yield response.value();
280
+ });
281
+ }
282
+ }
@@ -1,3 +1,4 @@
1
+ export * from './AutolaunchApi';
1
2
  export * from './BillingApi';
2
3
  export * from './CommunityApi';
3
4
  export * from './EnvironmentsApi';
@@ -5,6 +6,7 @@ export * from './FineTuningApi';
5
6
  export * from './GpuTypesApi';
6
7
  export * from './InferenceApi';
7
8
  export * from './InstancesApi';
9
+ export * from './MarketApi';
8
10
  export * from './MetaApi';
9
11
  export * from './OperationsApi';
10
12
  export * from './PricingApi';
@@ -12,4 +14,5 @@ export * from './RegistryCredentialsApi';
12
14
  export * from './SshKeysApi';
13
15
  export * from './TemplatesApi';
14
16
  export * from './UsageApi';
17
+ export * from './WatchApi';
15
18
  export * from './WebhooksApi';
@@ -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';