warpmetal 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/api.js CHANGED
@@ -128,19 +128,19 @@ export class WarpMetalClient {
128
128
  }
129
129
 
130
130
  health() {
131
- return this.request("GET", "/api/health");
131
+ return this.request("GET", "/health");
132
132
  }
133
133
 
134
134
  catalog() {
135
- return this.request("GET", "/api/catalog");
135
+ return this.request("GET", "/catalog");
136
136
  }
137
137
 
138
138
  prepareOrder(body, idempotencyKey) {
139
- return this.request("POST", "/api/orders", { body, idempotencyKey });
139
+ return this.request("POST", "/orders", { body, idempotencyKey });
140
140
  }
141
141
 
142
142
  getTask(taskId, token) {
143
- return this.request("GET", `/api/tasks/${encodeURIComponent(taskId)}`, {
143
+ return this.request("GET", `/tasks/${encodeURIComponent(taskId)}`, {
144
144
  token,
145
145
  });
146
146
  }
@@ -157,7 +157,7 @@ export class WarpMetalClient {
157
157
  issueSshChallenge(serverId) {
158
158
  return this.request(
159
159
  "POST",
160
- `/api/servers/${encodeURIComponent(serverId)}/auth/challenges`,
160
+ `/servers/${encodeURIComponent(serverId)}/auth/challenges`,
161
161
  { body: {} },
162
162
  );
163
163
  }
@@ -165,21 +165,69 @@ export class WarpMetalClient {
165
165
  exchangeSshChallenge(serverId, challengeId, signature) {
166
166
  return this.request(
167
167
  "POST",
168
- `/api/servers/${encodeURIComponent(serverId)}/auth/tokens`,
168
+ `/servers/${encodeURIComponent(serverId)}/auth/tokens`,
169
169
  { body: { challengeId, signature } },
170
170
  );
171
171
  }
172
172
 
173
173
  getServer(serverId, token) {
174
- return this.request("GET", `/api/servers/${encodeURIComponent(serverId)}`, {
174
+ return this.request("GET", `/servers/${encodeURIComponent(serverId)}`, {
175
175
  token,
176
176
  });
177
177
  }
178
178
 
179
+ getRenewalPolicy(serverId, token) {
180
+ return this.request(
181
+ "GET",
182
+ `/servers/${encodeURIComponent(serverId)}/renewal-policy`,
183
+ { token },
184
+ );
185
+ }
186
+
187
+ putRenewalPolicy(serverId, body, token) {
188
+ return this.request(
189
+ "PUT",
190
+ `/servers/${encodeURIComponent(serverId)}/renewal-policy`,
191
+ { body, token },
192
+ );
193
+ }
194
+
195
+ deleteRenewalPolicy(serverId, token) {
196
+ return this.request(
197
+ "DELETE",
198
+ `/servers/${encodeURIComponent(serverId)}/renewal-policy`,
199
+ { token },
200
+ );
201
+ }
202
+
203
+ getNotifications(serverId, token) {
204
+ return this.request(
205
+ "GET",
206
+ `/servers/${encodeURIComponent(serverId)}/notifications`,
207
+ { token },
208
+ );
209
+ }
210
+
211
+ putNotifications(serverId, body, token) {
212
+ return this.request(
213
+ "PUT",
214
+ `/servers/${encodeURIComponent(serverId)}/notifications`,
215
+ { body, token },
216
+ );
217
+ }
218
+
219
+ renewalCheckout(planId, { bodyText, token, paymentSignature }) {
220
+ return this.checkout(`/checkout/${encodeURIComponent(planId)}/renew`, {
221
+ bodyText,
222
+ token,
223
+ paymentSignature,
224
+ });
225
+ }
226
+
179
227
  powerServer(serverId, action, token, idempotencyKey) {
180
228
  return this.request(
181
229
  "POST",
182
- `/api/servers/${encodeURIComponent(serverId)}/power`,
230
+ `/servers/${encodeURIComponent(serverId)}/power`,
183
231
  {
184
232
  body: { action },
185
233
  token,
@@ -191,7 +239,7 @@ export class WarpMetalClient {
191
239
  reloadServer(serverId, body, token, idempotencyKey) {
192
240
  return this.request(
193
241
  "POST",
194
- `/api/servers/${encodeURIComponent(serverId)}/reload`,
242
+ `/servers/${encodeURIComponent(serverId)}/reload`,
195
243
  {
196
244
  body,
197
245
  token,
@@ -203,7 +251,7 @@ export class WarpMetalClient {
203
251
  getOperation(operationId, token) {
204
252
  return this.request(
205
253
  "GET",
206
- `/api/operations/${encodeURIComponent(operationId)}`,
254
+ `/operations/${encodeURIComponent(operationId)}`,
207
255
  {
208
256
  token,
209
257
  },
@@ -213,7 +261,7 @@ export class WarpMetalClient {
213
261
  enableRuntime(serverId, token, idempotencyKey) {
214
262
  return this.request(
215
263
  "POST",
216
- `/api/servers/${encodeURIComponent(serverId)}/runtime/enable`,
264
+ `/servers/${encodeURIComponent(serverId)}/runtime/enable`,
217
265
  {
218
266
  body: {},
219
267
  token,
@@ -225,7 +273,7 @@ export class WarpMetalClient {
225
273
  getRuntime(serverId, token) {
226
274
  return this.request(
227
275
  "GET",
228
- `/api/servers/${encodeURIComponent(serverId)}/runtime`,
276
+ `/servers/${encodeURIComponent(serverId)}/runtime`,
229
277
  { token },
230
278
  );
231
279
  }
@@ -233,7 +281,7 @@ export class WarpMetalClient {
233
281
  bootstrapRuntime(serverId, token, idempotencyKey) {
234
282
  return this.request(
235
283
  "POST",
236
- `/api/servers/${encodeURIComponent(serverId)}/runtime/bootstrap`,
284
+ `/servers/${encodeURIComponent(serverId)}/runtime/bootstrap`,
237
285
  { body: {}, token, idempotencyKey },
238
286
  );
239
287
  }
@@ -241,7 +289,7 @@ export class WarpMetalClient {
241
289
  listSandboxes(serverId, token) {
242
290
  return this.request(
243
291
  "GET",
244
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes`,
292
+ `/servers/${encodeURIComponent(serverId)}/sandboxes`,
245
293
  { token },
246
294
  );
247
295
  }
@@ -249,7 +297,7 @@ export class WarpMetalClient {
249
297
  createSandboxes(serverId, sandboxes, token, idempotencyKey) {
250
298
  return this.request(
251
299
  "POST",
252
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes`,
300
+ `/servers/${encodeURIComponent(serverId)}/sandboxes`,
253
301
  {
254
302
  body: { sandboxes },
255
303
  token,
@@ -261,7 +309,7 @@ export class WarpMetalClient {
261
309
  getSandbox(serverId, sandboxId, token) {
262
310
  return this.request(
263
311
  "GET",
264
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}`,
312
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}`,
265
313
  { token },
266
314
  );
267
315
  }
@@ -269,7 +317,7 @@ export class WarpMetalClient {
269
317
  sandboxAction(serverId, sandboxId, action, token, idempotencyKey) {
270
318
  return this.request(
271
319
  "POST",
272
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/actions`,
320
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/actions`,
273
321
  { body: { action }, token, idempotencyKey },
274
322
  );
275
323
  }
@@ -277,7 +325,7 @@ export class WarpMetalClient {
277
325
  deleteSandbox(serverId, sandboxId, token, idempotencyKey) {
278
326
  return this.request(
279
327
  "POST",
280
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/delete`,
328
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/delete`,
281
329
  { body: { confirm: "DELETE" }, token, idempotencyKey },
282
330
  );
283
331
  }
@@ -285,7 +333,7 @@ export class WarpMetalClient {
285
333
  listAccessGrants(serverId, sandboxId, token) {
286
334
  return this.request(
287
335
  "GET",
288
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants`,
336
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants`,
289
337
  { token },
290
338
  );
291
339
  }
@@ -293,7 +341,7 @@ export class WarpMetalClient {
293
341
  createAccessGrant(serverId, sandboxId, body, token, idempotencyKey) {
294
342
  return this.request(
295
343
  "POST",
296
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants`,
344
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants`,
297
345
  { body, token, idempotencyKey },
298
346
  );
299
347
  }
@@ -301,7 +349,7 @@ export class WarpMetalClient {
301
349
  getAccessGrant(serverId, sandboxId, grantId, token) {
302
350
  return this.request(
303
351
  "GET",
304
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants/${encodeURIComponent(grantId)}`,
352
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants/${encodeURIComponent(grantId)}`,
305
353
  { token },
306
354
  );
307
355
  }
@@ -309,7 +357,7 @@ export class WarpMetalClient {
309
357
  revokeAccessGrant(serverId, sandboxId, grantId, token, idempotencyKey) {
310
358
  return this.request(
311
359
  "POST",
312
- `/api/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants/${encodeURIComponent(grantId)}/revoke`,
360
+ `/servers/${encodeURIComponent(serverId)}/sandboxes/${encodeURIComponent(sandboxId)}/access-grants/${encodeURIComponent(grantId)}/revoke`,
313
361
  { body: { confirm: "REVOKE" }, token, idempotencyKey },
314
362
  );
315
363
  }