@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,114 @@
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 { mapValues } from '../runtime';
16
+ /**
17
+ * The organization's credit balance with its auto-pay configuration and live burn rate. Mirrors the dashboard's balance contract field for field. No payment-instrument detail appears here — saved cards live behind separate admin-only routes.
18
+ *
19
+ * @export
20
+ * @interface Balance
21
+ */
22
+ export interface Balance {
23
+ /**
24
+ * Remaining credit in USD cents. May be negative when usage has outrun the balance.
25
+ * @type {number}
26
+ * @memberof Balance
27
+ */
28
+ balanceCents: number;
29
+ /**
30
+ * The same figure in dollars, for display.
31
+ * @type {number}
32
+ * @memberof Balance
33
+ */
34
+ balanceDollars: number;
35
+ /**
36
+ *
37
+ * @type {boolean}
38
+ * @memberof Balance
39
+ */
40
+ autoPayEnabled: boolean;
41
+ /**
42
+ * Auto-pay triggers when the balance falls below this. Meaningful only when auto_pay_enabled.
43
+ * @type {number}
44
+ * @memberof Balance
45
+ */
46
+ autoPayThresholdCents: number;
47
+ /**
48
+ * Amount auto-pay charges when it triggers. Meaningful only when auto_pay_enabled.
49
+ * @type {number}
50
+ * @memberof Balance
51
+ */
52
+ autoPayAmountCents: number;
53
+ /**
54
+ * Live burn rate in USD cents per hour: the committed hourly price of every instance that is live, counted from launch — so instances still creating, provisioning or booting are included, not only those that have reached running. 0 when nothing is live.
55
+ *
56
+ * `null` means the burn rate could not be determined. Treat that as unknown, never as 0: reading an unavailable burn rate as "nothing running" reports unbounded runway to an organization that may be minutes from empty.
57
+ * @type {number}
58
+ * @memberof Balance
59
+ */
60
+ burnCentsPerHour: number | null;
61
+ }
62
+
63
+ /**
64
+ * Check if a given object implements the Balance interface.
65
+ */
66
+ export function instanceOfBalance(value: object): value is Balance {
67
+ if ((!('balanceCents' in (value as Record<string, any>)) && !('balance_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['balanceCents'] === undefined && (value as Record<string, any>)['balance_cents'] === undefined)) return false;
68
+ if ((!('balanceDollars' in (value as Record<string, any>)) && !('balance_dollars' in (value as Record<string, any>))) || ((value as Record<string, any>)['balanceDollars'] === undefined && (value as Record<string, any>)['balance_dollars'] === undefined)) return false;
69
+ if ((!('autoPayEnabled' in (value as Record<string, any>)) && !('auto_pay_enabled' in (value as Record<string, any>))) || ((value as Record<string, any>)['autoPayEnabled'] === undefined && (value as Record<string, any>)['auto_pay_enabled'] === undefined)) return false;
70
+ if ((!('autoPayThresholdCents' in (value as Record<string, any>)) && !('auto_pay_threshold_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['autoPayThresholdCents'] === undefined && (value as Record<string, any>)['auto_pay_threshold_cents'] === undefined)) return false;
71
+ if ((!('autoPayAmountCents' in (value as Record<string, any>)) && !('auto_pay_amount_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['autoPayAmountCents'] === undefined && (value as Record<string, any>)['auto_pay_amount_cents'] === undefined)) return false;
72
+ if ((!('burnCentsPerHour' in (value as Record<string, any>)) && !('burn_cents_per_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['burnCentsPerHour'] === undefined && (value as Record<string, any>)['burn_cents_per_hour'] === undefined)) return false;
73
+ return true;
74
+ }
75
+
76
+ export function BalanceFromJSON(json: any): Balance {
77
+ return BalanceFromJSONTyped(json, false);
78
+ }
79
+
80
+ export function BalanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): Balance {
81
+ if (json == null) {
82
+ return json;
83
+ }
84
+ return {
85
+
86
+ 'balanceCents': json['balance_cents'],
87
+ 'balanceDollars': json['balance_dollars'],
88
+ 'autoPayEnabled': json['auto_pay_enabled'],
89
+ 'autoPayThresholdCents': json['auto_pay_threshold_cents'],
90
+ 'autoPayAmountCents': json['auto_pay_amount_cents'],
91
+ 'burnCentsPerHour': json['burn_cents_per_hour'],
92
+ };
93
+ }
94
+
95
+ export function BalanceToJSON(json: any): Balance {
96
+ return BalanceToJSONTyped(json, false);
97
+ }
98
+
99
+ export function BalanceToJSONTyped(value?: Balance | null, ignoreDiscriminator: boolean = false): any {
100
+ if (value == null) {
101
+ return value;
102
+ }
103
+
104
+ return {
105
+
106
+ 'balance_cents': value['balanceCents'],
107
+ 'balance_dollars': value['balanceDollars'],
108
+ 'auto_pay_enabled': value['autoPayEnabled'],
109
+ 'auto_pay_threshold_cents': value['autoPayThresholdCents'],
110
+ 'auto_pay_amount_cents': value['autoPayAmountCents'],
111
+ 'burn_cents_per_hour': value['burnCentsPerHour'],
112
+ };
113
+ }
114
+
@@ -0,0 +1,103 @@
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 { mapValues } from '../runtime';
16
+ /**
17
+ * One bucket of a price/stock series.
18
+ *
19
+ * The nullability of `price_per_gpu_hour` and `available_count` is the contract, not a convenience: a real 0 is a bucket we sampled and found sold out, and null is a bucket we never successfully sampled. A client that coerces null to 0 will report GPU.ai's own polling outages as supplier stockouts, and must not interpolate across a null.
20
+ *
21
+ * @export
22
+ * @interface MarketHistoryPoint
23
+ */
24
+ export interface MarketHistoryPoint {
25
+ /**
26
+ * Start of the bucket, UTC, aligned to the bucket width.
27
+ * @type {Date}
28
+ * @memberof MarketHistoryPoint
29
+ */
30
+ bucketTs: Date;
31
+ /**
32
+ * GPU.ai's floor per-GPU hourly rate for this bucket, or null if we did not sample this bucket. Null is NOT zero.
33
+ * @type {number}
34
+ * @memberof MarketHistoryPoint
35
+ */
36
+ pricePerGpuHour: number | null;
37
+ /**
38
+ * Obtainable units across every matching offer in this bucket. 0 means we sampled and the market was sold out; null means we did not sample this bucket.
39
+ * @type {number}
40
+ * @memberof MarketHistoryPoint
41
+ */
42
+ availableCount: number | null;
43
+ /**
44
+ * Whole-node hourly price the per-GPU rate was divided out of. Present only when the bucket's floor came from a multi-GPU node; absent for single-GPU capacity.
45
+ * @type {number}
46
+ * @memberof MarketHistoryPoint
47
+ */
48
+ nodePricePerHour?: number;
49
+ /**
50
+ * GPUs in that node. Present only alongside `node_price_per_hour`, and it is what lets a renderer qualify a derived rate as "(from an 8-GPU node)" rather than implying single-GPU rentability.
51
+ * @type {number}
52
+ * @memberof MarketHistoryPoint
53
+ */
54
+ gpuCount?: number;
55
+ }
56
+
57
+ /**
58
+ * Check if a given object implements the MarketHistoryPoint interface.
59
+ */
60
+ export function instanceOfMarketHistoryPoint(value: object): value is MarketHistoryPoint {
61
+ if ((!('bucketTs' in (value as Record<string, any>)) && !('bucket_ts' in (value as Record<string, any>))) || ((value as Record<string, any>)['bucketTs'] === undefined && (value as Record<string, any>)['bucket_ts'] === undefined)) return false;
62
+ if ((!('pricePerGpuHour' in (value as Record<string, any>)) && !('price_per_gpu_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['pricePerGpuHour'] === undefined && (value as Record<string, any>)['price_per_gpu_hour'] === undefined)) return false;
63
+ if ((!('availableCount' in (value as Record<string, any>)) && !('available_count' in (value as Record<string, any>))) || ((value as Record<string, any>)['availableCount'] === undefined && (value as Record<string, any>)['available_count'] === undefined)) return false;
64
+ return true;
65
+ }
66
+
67
+ export function MarketHistoryPointFromJSON(json: any): MarketHistoryPoint {
68
+ return MarketHistoryPointFromJSONTyped(json, false);
69
+ }
70
+
71
+ export function MarketHistoryPointFromJSONTyped(json: any, ignoreDiscriminator: boolean): MarketHistoryPoint {
72
+ if (json == null) {
73
+ return json;
74
+ }
75
+ return {
76
+
77
+ 'bucketTs': (new Date(json['bucket_ts'])),
78
+ 'pricePerGpuHour': json['price_per_gpu_hour'],
79
+ 'availableCount': json['available_count'],
80
+ 'nodePricePerHour': json['node_price_per_hour'] == null ? undefined : json['node_price_per_hour'],
81
+ 'gpuCount': json['gpu_count'] == null ? undefined : json['gpu_count'],
82
+ };
83
+ }
84
+
85
+ export function MarketHistoryPointToJSON(json: any): MarketHistoryPoint {
86
+ return MarketHistoryPointToJSONTyped(json, false);
87
+ }
88
+
89
+ export function MarketHistoryPointToJSONTyped(value?: MarketHistoryPoint | null, ignoreDiscriminator: boolean = false): any {
90
+ if (value == null) {
91
+ return value;
92
+ }
93
+
94
+ return {
95
+
96
+ 'bucket_ts': value['bucketTs'].toISOString(),
97
+ 'price_per_gpu_hour': value['pricePerGpuHour'],
98
+ 'available_count': value['availableCount'],
99
+ 'node_price_per_hour': value['nodePricePerHour'],
100
+ 'gpu_count': value['gpuCount'],
101
+ };
102
+ }
103
+
@@ -0,0 +1,113 @@
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 { mapValues } from '../runtime';
16
+ import type { MarketHistoryPoint } from './MarketHistoryPoint';
17
+ import {
18
+ MarketHistoryPointFromJSON,
19
+ MarketHistoryPointFromJSONTyped,
20
+ MarketHistoryPointToJSON,
21
+ MarketHistoryPointToJSONTyped,
22
+ } from './MarketHistoryPoint';
23
+
24
+ /**
25
+ * A price/stock series for one (gpu_model, region, capacity_class) key.
26
+ *
27
+ * Points cover the FULL bucket grid across the requested window, including the buckets we did not sample — a gap therefore has visible width rather than disappearing between two adjacent points.
28
+ *
29
+ * @export
30
+ * @interface MarketHistoryResponse
31
+ */
32
+ export interface MarketHistoryResponse {
33
+ /**
34
+ *
35
+ * @type {string}
36
+ * @memberof MarketHistoryResponse
37
+ */
38
+ gpuModel: string;
39
+ /**
40
+ * Echoes the request. Empty means the series is MERGED across every region, the same thing it meant on the way in.
41
+ * @type {string}
42
+ * @memberof MarketHistoryResponse
43
+ */
44
+ region: string;
45
+ /**
46
+ * Echoes the request. Empty means the series is merged across both classes.
47
+ * @type {string}
48
+ * @memberof MarketHistoryResponse
49
+ */
50
+ capacityClass: string;
51
+ /**
52
+ * Resolution the server actually answered at. Echoed because the wide views downsample at query time, so a client must never assume 900.
53
+ * @type {number}
54
+ * @memberof MarketHistoryResponse
55
+ */
56
+ bucketSeconds: number;
57
+ /**
58
+ *
59
+ * @type {Array<MarketHistoryPoint>}
60
+ * @memberof MarketHistoryResponse
61
+ */
62
+ points: Array<MarketHistoryPoint>;
63
+ }
64
+
65
+ /**
66
+ * Check if a given object implements the MarketHistoryResponse interface.
67
+ */
68
+ export function instanceOfMarketHistoryResponse(value: object): value is MarketHistoryResponse {
69
+ if ((!('gpuModel' in (value as Record<string, any>)) && !('gpu_model' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuModel'] === undefined && (value as Record<string, any>)['gpu_model'] === undefined)) return false;
70
+ if (!('region' in value) || value['region'] === undefined) return false;
71
+ if ((!('capacityClass' in (value as Record<string, any>)) && !('capacity_class' in (value as Record<string, any>))) || ((value as Record<string, any>)['capacityClass'] === undefined && (value as Record<string, any>)['capacity_class'] === undefined)) return false;
72
+ if ((!('bucketSeconds' in (value as Record<string, any>)) && !('bucket_seconds' in (value as Record<string, any>))) || ((value as Record<string, any>)['bucketSeconds'] === undefined && (value as Record<string, any>)['bucket_seconds'] === undefined)) return false;
73
+ if (!('points' in value) || value['points'] === undefined) return false;
74
+ return true;
75
+ }
76
+
77
+ export function MarketHistoryResponseFromJSON(json: any): MarketHistoryResponse {
78
+ return MarketHistoryResponseFromJSONTyped(json, false);
79
+ }
80
+
81
+ export function MarketHistoryResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): MarketHistoryResponse {
82
+ if (json == null) {
83
+ return json;
84
+ }
85
+ return {
86
+
87
+ 'gpuModel': json['gpu_model'],
88
+ 'region': json['region'],
89
+ 'capacityClass': json['capacity_class'],
90
+ 'bucketSeconds': json['bucket_seconds'],
91
+ 'points': ((json['points'] as Array<any>).map(MarketHistoryPointFromJSON)),
92
+ };
93
+ }
94
+
95
+ export function MarketHistoryResponseToJSON(json: any): MarketHistoryResponse {
96
+ return MarketHistoryResponseToJSONTyped(json, false);
97
+ }
98
+
99
+ export function MarketHistoryResponseToJSONTyped(value?: MarketHistoryResponse | null, ignoreDiscriminator: boolean = false): any {
100
+ if (value == null) {
101
+ return value;
102
+ }
103
+
104
+ return {
105
+
106
+ 'gpu_model': value['gpuModel'],
107
+ 'region': value['region'],
108
+ 'capacity_class': value['capacityClass'],
109
+ 'bucket_seconds': value['bucketSeconds'],
110
+ 'points': ((value['points'] as Array<any>).map(MarketHistoryPointToJSON)),
111
+ };
112
+ }
113
+
@@ -78,6 +78,7 @@ export const ProblemCodeEnum = {
78
78
  InsufficientBalance: 'insufficient_balance',
79
79
  QuotaExceeded: 'quota_exceeded',
80
80
  RateLimited: 'rate_limited',
81
+ CreatorCheckUnavailable: 'creator_check_unavailable',
81
82
  InternalError: 'internal_error',
82
83
  OperationFailed: 'operation_failed'
83
84
  } as const;
@@ -0,0 +1,219 @@
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 { mapValues } from '../runtime';
16
+ /**
17
+ * A rule that notifies when the market moves on a GPU model. It carries no upstream supplier identity of any kind, and no delivery address — those are properties of the resource, not of a particular response.
18
+ *
19
+ * @export
20
+ * @interface WatchRule
21
+ */
22
+ export interface WatchRule {
23
+ /**
24
+ *
25
+ * @type {string}
26
+ * @memberof WatchRule
27
+ */
28
+ id: string;
29
+ /**
30
+ * The GPU model the rule watches, e.g. "H100".
31
+ * @type {string}
32
+ * @memberof WatchRule
33
+ */
34
+ gpuModel: string;
35
+ /**
36
+ * Canonical region the rule is narrowed to, or null for every region.
37
+ * @type {string}
38
+ * @memberof WatchRule
39
+ */
40
+ region: string | null;
41
+ /**
42
+ * Capacity class the rule is narrowed to, or null for both.
43
+ * @type {WatchRuleCapacityClassEnum}
44
+ * @memberof WatchRule
45
+ */
46
+ capacityClass: WatchRuleCapacityClassEnum | null;
47
+ /**
48
+ *
49
+ * @type {WatchRuleConditionKindEnum}
50
+ * @memberof WatchRule
51
+ */
52
+ conditionKind: WatchRuleConditionKindEnum;
53
+ /**
54
+ * Per-GPU hourly price for price_under, or a unit count for count_at_least. Null for in_stock, which takes no threshold.
55
+ *
56
+ * @type {number}
57
+ * @memberof WatchRule
58
+ */
59
+ threshold: number | null;
60
+ /**
61
+ * armed = the condition is currently false and the next transition to true will alert. fired = it has alerted and has not yet re-armed.
62
+ *
63
+ * @type {WatchRuleStateEnum}
64
+ * @memberof WatchRule
65
+ */
66
+ state: WatchRuleStateEnum;
67
+ /**
68
+ *
69
+ * @type {Date}
70
+ * @memberof WatchRule
71
+ */
72
+ lastFiredAt: Date | null;
73
+ /**
74
+ * While set, the rule will not re-fire even if the condition re-crosses — the quiet window that stops a boundary-hugging signal alerting on every crossing.
75
+ *
76
+ * @type {Date}
77
+ * @memberof WatchRule
78
+ */
79
+ quietUntil: Date | null;
80
+ /**
81
+ * Id of a webhook endpoint registered by this organization, or null to deliver to every registered endpoint. Never a URL.
82
+ *
83
+ * @type {string}
84
+ * @memberof WatchRule
85
+ */
86
+ webhookEndpointOverrideId: string | null;
87
+ /**
88
+ *
89
+ * @type {boolean}
90
+ * @memberof WatchRule
91
+ */
92
+ enabled: boolean;
93
+ /**
94
+ * Why an automatically disabled rule was disabled — for example its creator no longer belongs to the organization.
95
+ *
96
+ * @type {string}
97
+ * @memberof WatchRule
98
+ */
99
+ deactivatedReason: string | null;
100
+ /**
101
+ *
102
+ * @type {Date}
103
+ * @memberof WatchRule
104
+ */
105
+ createdAt: Date;
106
+ /**
107
+ *
108
+ * @type {Date}
109
+ * @memberof WatchRule
110
+ */
111
+ updatedAt: Date;
112
+ }
113
+
114
+
115
+ /**
116
+ * @export
117
+ */
118
+ export const WatchRuleCapacityClassEnum = {
119
+ Secure: 'secure',
120
+ Community: 'community'
121
+ } as const;
122
+ export type WatchRuleCapacityClassEnum = typeof WatchRuleCapacityClassEnum[keyof typeof WatchRuleCapacityClassEnum];
123
+
124
+ /**
125
+ * @export
126
+ */
127
+ export const WatchRuleConditionKindEnum = {
128
+ PriceUnder: 'price_under',
129
+ InStock: 'in_stock',
130
+ CountAtLeast: 'count_at_least'
131
+ } as const;
132
+ export type WatchRuleConditionKindEnum = typeof WatchRuleConditionKindEnum[keyof typeof WatchRuleConditionKindEnum];
133
+
134
+ /**
135
+ * @export
136
+ */
137
+ export const WatchRuleStateEnum = {
138
+ Armed: 'armed',
139
+ Fired: 'fired'
140
+ } as const;
141
+ export type WatchRuleStateEnum = typeof WatchRuleStateEnum[keyof typeof WatchRuleStateEnum];
142
+
143
+
144
+ /**
145
+ * Check if a given object implements the WatchRule interface.
146
+ */
147
+ export function instanceOfWatchRule(value: object): value is WatchRule {
148
+ if (!('id' in value) || value['id'] === undefined) return false;
149
+ if ((!('gpuModel' in (value as Record<string, any>)) && !('gpu_model' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuModel'] === undefined && (value as Record<string, any>)['gpu_model'] === undefined)) return false;
150
+ if (!('region' in value) || value['region'] === undefined) return false;
151
+ if ((!('capacityClass' in (value as Record<string, any>)) && !('capacity_class' in (value as Record<string, any>))) || ((value as Record<string, any>)['capacityClass'] === undefined && (value as Record<string, any>)['capacity_class'] === undefined)) return false;
152
+ if ((!('conditionKind' in (value as Record<string, any>)) && !('condition_kind' in (value as Record<string, any>))) || ((value as Record<string, any>)['conditionKind'] === undefined && (value as Record<string, any>)['condition_kind'] === undefined)) return false;
153
+ if (!('threshold' in value) || value['threshold'] === undefined) return false;
154
+ if (!('state' in value) || value['state'] === undefined) return false;
155
+ if ((!('lastFiredAt' in (value as Record<string, any>)) && !('last_fired_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['lastFiredAt'] === undefined && (value as Record<string, any>)['last_fired_at'] === undefined)) return false;
156
+ if ((!('quietUntil' in (value as Record<string, any>)) && !('quiet_until' in (value as Record<string, any>))) || ((value as Record<string, any>)['quietUntil'] === undefined && (value as Record<string, any>)['quiet_until'] === undefined)) return false;
157
+ if ((!('webhookEndpointOverrideId' in (value as Record<string, any>)) && !('webhook_endpoint_override_id' in (value as Record<string, any>))) || ((value as Record<string, any>)['webhookEndpointOverrideId'] === undefined && (value as Record<string, any>)['webhook_endpoint_override_id'] === undefined)) return false;
158
+ if (!('enabled' in value) || value['enabled'] === undefined) return false;
159
+ if ((!('deactivatedReason' in (value as Record<string, any>)) && !('deactivated_reason' in (value as Record<string, any>))) || ((value as Record<string, any>)['deactivatedReason'] === undefined && (value as Record<string, any>)['deactivated_reason'] === undefined)) return false;
160
+ if ((!('createdAt' in (value as Record<string, any>)) && !('created_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['createdAt'] === undefined && (value as Record<string, any>)['created_at'] === undefined)) return false;
161
+ if ((!('updatedAt' in (value as Record<string, any>)) && !('updated_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['updatedAt'] === undefined && (value as Record<string, any>)['updated_at'] === undefined)) return false;
162
+ return true;
163
+ }
164
+
165
+ export function WatchRuleFromJSON(json: any): WatchRule {
166
+ return WatchRuleFromJSONTyped(json, false);
167
+ }
168
+
169
+ export function WatchRuleFromJSONTyped(json: any, ignoreDiscriminator: boolean): WatchRule {
170
+ if (json == null) {
171
+ return json;
172
+ }
173
+ return {
174
+
175
+ 'id': json['id'],
176
+ 'gpuModel': json['gpu_model'],
177
+ 'region': json['region'],
178
+ 'capacityClass': json['capacity_class'],
179
+ 'conditionKind': json['condition_kind'],
180
+ 'threshold': json['threshold'],
181
+ 'state': json['state'],
182
+ 'lastFiredAt': (json['last_fired_at'] == null ? null : new Date(json['last_fired_at'])),
183
+ 'quietUntil': (json['quiet_until'] == null ? null : new Date(json['quiet_until'])),
184
+ 'webhookEndpointOverrideId': json['webhook_endpoint_override_id'],
185
+ 'enabled': json['enabled'],
186
+ 'deactivatedReason': json['deactivated_reason'],
187
+ 'createdAt': (new Date(json['created_at'])),
188
+ 'updatedAt': (new Date(json['updated_at'])),
189
+ };
190
+ }
191
+
192
+ export function WatchRuleToJSON(json: any): WatchRule {
193
+ return WatchRuleToJSONTyped(json, false);
194
+ }
195
+
196
+ export function WatchRuleToJSONTyped(value?: WatchRule | null, ignoreDiscriminator: boolean = false): any {
197
+ if (value == null) {
198
+ return value;
199
+ }
200
+
201
+ return {
202
+
203
+ 'id': value['id'],
204
+ 'gpu_model': value['gpuModel'],
205
+ 'region': value['region'],
206
+ 'capacity_class': value['capacityClass'],
207
+ 'condition_kind': value['conditionKind'],
208
+ 'threshold': value['threshold'],
209
+ 'state': value['state'],
210
+ 'last_fired_at': value['lastFiredAt'] == null ? value['lastFiredAt'] : value['lastFiredAt'].toISOString(),
211
+ 'quiet_until': value['quietUntil'] == null ? value['quietUntil'] : value['quietUntil'].toISOString(),
212
+ 'webhook_endpoint_override_id': value['webhookEndpointOverrideId'],
213
+ 'enabled': value['enabled'],
214
+ 'deactivated_reason': value['deactivatedReason'],
215
+ 'created_at': value['createdAt'].toISOString(),
216
+ 'updated_at': value['updatedAt'].toISOString(),
217
+ };
218
+ }
219
+