@scaleway/sdk-qaas 2.2.0 → 2.3.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.
@@ -1,635 +1,404 @@
1
- import { API as API$1, validatePathParam, waitForResource, urlParams, resolveOneOf, enrichForPagination } from "@scaleway/sdk-client";
2
- import { JOB_TRANSIENT_STATUSES, SESSION_TRANSIENT_STATUSES, PROCESS_TRANSIENT_STATUSES, BOOKING_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { unmarshalJob, unmarshalListJobsResponse, unmarshalListJobResultsResponse, marshalCreateJobRequest, marshalUpdateJobRequest, unmarshalJobCircuit, unmarshalPlatform, unmarshalListPlatformsResponse, unmarshalSession, unmarshalListSessionsResponse, marshalCreateSessionRequest, marshalUpdateSessionRequest, unmarshalListSessionACLsResponse, marshalCreateProcessRequest, unmarshalProcess, unmarshalListProcessesResponse, marshalUpdateProcessRequest, unmarshalListProcessResultsResponse, unmarshalApplication, unmarshalListApplicationsResponse, unmarshalBooking, unmarshalListBookingsResponse, marshalUpdateBookingRequest, marshalCreateModelRequest, unmarshalModel, unmarshalListModelsResponse } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Get job information. Retrieve information about the provided **job ID**, mainly used to get the current status.
10
- *
11
- * @param request - The request {@link GetJobRequest}
12
- * @returns A Promise of Job
13
- */
14
- getJob = (request) => this.client.fetch(
15
- {
16
- method: "GET",
17
- path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}`
18
- },
19
- unmarshalJob
20
- );
21
- /**
22
- * Waits for {@link Job} to be in a final state.
23
- *
24
- * @param request - The request {@link GetJobRequest}
25
- * @param options - The waiting options
26
- * @returns A Promise of Job
27
- */
28
- waitForJob = (request, options) => waitForResource(
29
- options?.stop ?? ((res) => Promise.resolve(!JOB_TRANSIENT_STATUSES.includes(res.status))),
30
- this.getJob,
31
- request,
32
- options
33
- );
34
- pageOfListJobs = (request = {}) => this.client.fetch(
35
- {
36
- method: "GET",
37
- path: `/qaas/v1alpha1/jobs`,
38
- urlParams: urlParams(
39
- ["order_by", request.orderBy],
40
- ["page", request.page],
41
- [
42
- "page_size",
43
- request.pageSize ?? this.client.settings.defaultPageSize
44
- ],
45
- ["tags", request.tags],
46
- ...Object.entries(
47
- resolveOneOf([
48
- { param: "session_id", value: request.sessionId },
49
- {
50
- default: this.client.settings.defaultProjectId,
51
- param: "project_id",
52
- value: request.projectId
53
- }
54
- ])
55
- )
56
- )
57
- },
58
- unmarshalListJobsResponse
59
- );
60
- /**
61
- * List all jobs within a project or session. Retrieve information about all jobs within a given session.
62
- *
63
- * @param request - The request {@link ListJobsRequest}
64
- * @returns A Promise of ListJobsResponse
65
- */
66
- listJobs = (request = {}) => enrichForPagination("jobs", this.pageOfListJobs, request);
67
- pageOfListJobResults = (request) => this.client.fetch(
68
- {
69
- method: "GET",
70
- path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}/results`,
71
- urlParams: urlParams(
72
- ["order_by", request.orderBy],
73
- ["page", request.page],
74
- [
75
- "page_size",
76
- request.pageSize ?? this.client.settings.defaultPageSize
77
- ]
78
- )
79
- },
80
- unmarshalListJobResultsResponse
81
- );
82
- /**
83
- * List all results of a job. Retrieve all intermediate and final results of a job.
84
- *
85
- * @param request - The request {@link ListJobResultsRequest}
86
- * @returns A Promise of ListJobResultsResponse
87
- */
88
- listJobResults = (request) => enrichForPagination("jobResults", this.pageOfListJobResults, request);
89
- /**
90
- * Create a job. Create a job to be executed inside a QPU session.
91
- *
92
- * @param request - The request {@link CreateJobRequest}
93
- * @returns A Promise of Job
94
- */
95
- createJob = (request) => this.client.fetch(
96
- {
97
- body: JSON.stringify(
98
- marshalCreateJobRequest(request, this.client.settings)
99
- ),
100
- headers: jsonContentHeaders,
101
- method: "POST",
102
- path: `/qaas/v1alpha1/jobs`
103
- },
104
- unmarshalJob
105
- );
106
- /**
107
- * Update job information. Update job information about the provided **job ID**.
108
- *
109
- * @param request - The request {@link UpdateJobRequest}
110
- * @returns A Promise of Job
111
- */
112
- updateJob = (request) => this.client.fetch(
113
- {
114
- body: JSON.stringify(
115
- marshalUpdateJobRequest(request, this.client.settings)
116
- ),
117
- headers: jsonContentHeaders,
118
- method: "PATCH",
119
- path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}`
120
- },
121
- unmarshalJob
122
- );
123
- /**
124
- * Cancel a job. Cancel the job corresponding to the provided **job ID**.
125
- *
126
- * @param request - The request {@link CancelJobRequest}
127
- * @returns A Promise of Job
128
- */
129
- cancelJob = (request) => this.client.fetch(
130
- {
131
- body: "{}",
132
- headers: jsonContentHeaders,
133
- method: "POST",
134
- path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}/cancel`
135
- },
136
- unmarshalJob
137
- );
138
- /**
139
- * Delete a job. Delete the job corresponding to the provided **job ID**.
140
- *
141
- * @param request - The request {@link DeleteJobRequest}
142
- */
143
- deleteJob = (request) => this.client.fetch({
144
- method: "DELETE",
145
- path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}`
146
- });
147
- /**
148
- * Get a job circuit. Retrieve the circuit of the provided **job ID**.
149
- *
150
- * @param request - The request {@link GetJobCircuitRequest}
151
- * @returns A Promise of JobCircuit
152
- */
153
- getJobCircuit = (request) => this.client.fetch(
154
- {
155
- method: "GET",
156
- path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}/circuit`
157
- },
158
- unmarshalJobCircuit
159
- );
160
- /**
161
- * Get platform information. Retrieve information about the provided **platform ID**, such as provider name, technology, and type.
162
- *
163
- * @param request - The request {@link GetPlatformRequest}
164
- * @returns A Promise of Platform
165
- */
166
- getPlatform = (request) => this.client.fetch(
167
- {
168
- method: "GET",
169
- path: `/qaas/v1alpha1/platforms/${validatePathParam("platformId", request.platformId)}`
170
- },
171
- unmarshalPlatform
172
- );
173
- pageOfListPlatforms = (request = {}) => this.client.fetch(
174
- {
175
- method: "GET",
176
- path: `/qaas/v1alpha1/platforms`,
177
- urlParams: urlParams(
178
- ["backend_name", request.backendName],
179
- ["name", request.name],
180
- ["order_by", request.orderBy],
181
- ["page", request.page],
182
- [
183
- "page_size",
184
- request.pageSize ?? this.client.settings.defaultPageSize
185
- ],
186
- ["platform_technology", request.platformTechnology],
187
- ["platform_type", request.platformType],
188
- ["provider_name", request.providerName]
189
- )
190
- },
191
- unmarshalListPlatformsResponse
192
- );
193
- /**
194
- * List all available platforms. Retrieve information about all platforms.
195
- *
196
- * @param request - The request {@link ListPlatformsRequest}
197
- * @returns A Promise of ListPlatformsResponse
198
- */
199
- listPlatforms = (request = {}) => enrichForPagination("platforms", this.pageOfListPlatforms, request);
200
- /**
201
- * Get session information. Retrieve information about the provided **session ID**, such as name and status.
202
- *
203
- * @param request - The request {@link GetSessionRequest}
204
- * @returns A Promise of Session
205
- */
206
- getSession = (request) => this.client.fetch(
207
- {
208
- method: "GET",
209
- path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}`
210
- },
211
- unmarshalSession
212
- );
213
- /**
214
- * Waits for {@link Session} to be in a final state.
215
- *
216
- * @param request - The request {@link GetSessionRequest}
217
- * @param options - The waiting options
218
- * @returns A Promise of Session
219
- */
220
- waitForSession = (request, options) => waitForResource(
221
- options?.stop ?? ((res) => Promise.resolve(
222
- !SESSION_TRANSIENT_STATUSES.includes(res.status)
223
- )),
224
- this.getSession,
225
- request,
226
- options
227
- );
228
- pageOfListSessions = (request = {}) => this.client.fetch(
229
- {
230
- method: "GET",
231
- path: `/qaas/v1alpha1/sessions`,
232
- urlParams: urlParams(
233
- ["order_by", request.orderBy],
234
- ["page", request.page],
235
- [
236
- "page_size",
237
- request.pageSize ?? this.client.settings.defaultPageSize
238
- ],
239
- ["platform_id", request.platformId],
240
- [
241
- "project_id",
242
- request.projectId ?? this.client.settings.defaultProjectId
243
- ],
244
- ["tags", request.tags]
245
- )
246
- },
247
- unmarshalListSessionsResponse
248
- );
249
- /**
250
- * List all sessions. Retrieve information about all QPU sessions.
251
- *
252
- * @param request - The request {@link ListSessionsRequest}
253
- * @returns A Promise of ListSessionsResponse
254
- */
255
- listSessions = (request = {}) => enrichForPagination("sessions", this.pageOfListSessions, request);
256
- /**
257
- * Create a session. Create a new QPU session for the specified platform. Once ready, jobs can be sent to this session.
258
- *
259
- * @param request - The request {@link CreateSessionRequest}
260
- * @returns A Promise of Session
261
- */
262
- createSession = (request) => this.client.fetch(
263
- {
264
- body: JSON.stringify(
265
- marshalCreateSessionRequest(request, this.client.settings)
266
- ),
267
- headers: jsonContentHeaders,
268
- method: "POST",
269
- path: `/qaas/v1alpha1/sessions`
270
- },
271
- unmarshalSession
272
- );
273
- /**
274
- * Update session information. Update session information of the provided **session ID**.
275
- *
276
- * @param request - The request {@link UpdateSessionRequest}
277
- * @returns A Promise of Session
278
- */
279
- updateSession = (request) => this.client.fetch(
280
- {
281
- body: JSON.stringify(
282
- marshalUpdateSessionRequest(request, this.client.settings)
283
- ),
284
- headers: jsonContentHeaders,
285
- method: "PATCH",
286
- path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}`
287
- },
288
- unmarshalSession
289
- );
290
- /**
291
- * Terminate an existing session. Terminate a session by its unique ID and cancel all its attached jobs and bookings.
292
- *
293
- * @param request - The request {@link TerminateSessionRequest}
294
- * @returns A Promise of Session
295
- */
296
- terminateSession = (request) => this.client.fetch(
297
- {
298
- body: "{}",
299
- headers: jsonContentHeaders,
300
- method: "POST",
301
- path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}/terminate`
302
- },
303
- unmarshalSession
304
- );
305
- /**
306
- * Delete an existing session. Delete a session by its unique ID and delete all its attached jobs and bookings.
307
- *
308
- * @param request - The request {@link DeleteSessionRequest}
309
- */
310
- deleteSession = (request) => this.client.fetch({
311
- method: "DELETE",
312
- path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}`
313
- });
314
- pageOfListSessionACLs = (request) => this.client.fetch(
315
- {
316
- method: "GET",
317
- path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}/acls`,
318
- urlParams: urlParams(
319
- ["order_by", request.orderBy],
320
- ["page", request.page],
321
- [
322
- "page_size",
323
- request.pageSize ?? this.client.settings.defaultPageSize
324
- ]
325
- )
326
- },
327
- unmarshalListSessionACLsResponse
328
- );
329
- listSessionACLs = (request) => enrichForPagination("acls", this.pageOfListSessionACLs, request);
330
- /**
331
- * Create a process. Create a new process for the specified application on a specified platform.
332
- *
333
- * @param request - The request {@link CreateProcessRequest}
334
- * @returns A Promise of Process
335
- */
336
- createProcess = (request) => this.client.fetch(
337
- {
338
- body: JSON.stringify(
339
- marshalCreateProcessRequest(request, this.client.settings)
340
- ),
341
- headers: jsonContentHeaders,
342
- method: "POST",
343
- path: `/qaas/v1alpha1/processes`
344
- },
345
- unmarshalProcess
346
- );
347
- /**
348
- * Get process information. Retrieve information about the provided **process ID**, such as name, status and progress.
349
- *
350
- * @param request - The request {@link GetProcessRequest}
351
- * @returns A Promise of Process
352
- */
353
- getProcess = (request) => this.client.fetch(
354
- {
355
- method: "GET",
356
- path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}`
357
- },
358
- unmarshalProcess
359
- );
360
- /**
361
- * Waits for {@link Process} to be in a final state.
362
- *
363
- * @param request - The request {@link GetProcessRequest}
364
- * @param options - The waiting options
365
- * @returns A Promise of Process
366
- */
367
- waitForProcess = (request, options) => waitForResource(
368
- options?.stop ?? ((res) => Promise.resolve(
369
- !PROCESS_TRANSIENT_STATUSES.includes(res.status)
370
- )),
371
- this.getProcess,
372
- request,
373
- options
374
- );
375
- pageOfListProcesses = (request = {}) => this.client.fetch(
376
- {
377
- method: "GET",
378
- path: `/qaas/v1alpha1/processes`,
379
- urlParams: urlParams(
380
- ["application_id", request.applicationId],
381
- ["order_by", request.orderBy],
382
- ["page", request.page],
383
- [
384
- "page_size",
385
- request.pageSize ?? this.client.settings.defaultPageSize
386
- ],
387
- [
388
- "project_id",
389
- request.projectId ?? this.client.settings.defaultProjectId
390
- ],
391
- ["tags", request.tags]
392
- )
393
- },
394
- unmarshalListProcessesResponse
395
- );
396
- /**
397
- * List all processes. Retrieve information about all processes.
398
- *
399
- * @param request - The request {@link ListProcessesRequest}
400
- * @returns A Promise of ListProcessesResponse
401
- */
402
- listProcesses = (request = {}) => enrichForPagination("processes", this.pageOfListProcesses, request);
403
- /**
404
- * Update process information. Update process information of the provided **process ID**.
405
- *
406
- * @param request - The request {@link UpdateProcessRequest}
407
- * @returns A Promise of Process
408
- */
409
- updateProcess = (request) => this.client.fetch(
410
- {
411
- body: JSON.stringify(
412
- marshalUpdateProcessRequest(request, this.client.settings)
413
- ),
414
- headers: jsonContentHeaders,
415
- method: "PATCH",
416
- path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}`
417
- },
418
- unmarshalProcess
419
- );
420
- /**
421
- * Cancel a running process. Cancel a process by its unique ID. Intermediate results are still available.
422
- *
423
- * @param request - The request {@link CancelProcessRequest}
424
- * @returns A Promise of Process
425
- */
426
- cancelProcess = (request) => this.client.fetch(
427
- {
428
- body: "{}",
429
- headers: jsonContentHeaders,
430
- method: "POST",
431
- path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}/cancel`
432
- },
433
- unmarshalProcess
434
- );
435
- /**
436
- * Delete an existing process. Delete a process by its unique ID and delete all its data.
437
- *
438
- * @param request - The request {@link DeleteProcessRequest}
439
- */
440
- deleteProcess = (request) => this.client.fetch({
441
- method: "DELETE",
442
- path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}`
443
- });
444
- pageOfListProcessResults = (request) => this.client.fetch(
445
- {
446
- method: "GET",
447
- path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}/results`,
448
- urlParams: urlParams(
449
- ["order_by", request.orderBy],
450
- ["page", request.page],
451
- [
452
- "page_size",
453
- request.pageSize ?? this.client.settings.defaultPageSize
454
- ]
455
- )
456
- },
457
- unmarshalListProcessResultsResponse
458
- );
459
- /**
460
- * List all results of a process. Retrieve all intermediate and final result of a process.
461
- *
462
- * @param request - The request {@link ListProcessResultsRequest}
463
- * @returns A Promise of ListProcessResultsResponse
464
- */
465
- listProcessResults = (request) => enrichForPagination(
466
- "processResults",
467
- this.pageOfListProcessResults,
468
- request
469
- );
470
- /**
471
- * Get application information. Retrieve information about the provided **application ID**, such as name, type and compatible platforms.
472
- *
473
- * @param request - The request {@link GetApplicationRequest}
474
- * @returns A Promise of Application
475
- */
476
- getApplication = (request) => this.client.fetch(
477
- {
478
- method: "GET",
479
- path: `/qaas/v1alpha1/applications/${validatePathParam("applicationId", request.applicationId)}`
480
- },
481
- unmarshalApplication
482
- );
483
- pageOfListApplications = (request = {}) => this.client.fetch(
484
- {
485
- method: "GET",
486
- path: `/qaas/v1alpha1/applications`,
487
- urlParams: urlParams(
488
- ["application_type", request.applicationType],
489
- ["name", request.name],
490
- ["order_by", request.orderBy],
491
- ["page", request.page],
492
- [
493
- "page_size",
494
- request.pageSize ?? this.client.settings.defaultPageSize
495
- ]
496
- )
497
- },
498
- unmarshalListApplicationsResponse
499
- );
500
- /**
501
- * List all available applications. Retrieve information about all applications.
502
- *
503
- * @param request - The request {@link ListApplicationsRequest}
504
- * @returns A Promise of ListApplicationsResponse
505
- */
506
- listApplications = (request = {}) => enrichForPagination("applications", this.pageOfListApplications, request);
507
- /**
508
- * Get booking information. Retrieve information about the provided **booking ID**, such as description, status and progress message.
509
- *
510
- * @param request - The request {@link GetBookingRequest}
511
- * @returns A Promise of Booking
512
- */
513
- getBooking = (request) => this.client.fetch(
514
- {
515
- method: "GET",
516
- path: `/qaas/v1alpha1/bookings/${validatePathParam("bookingId", request.bookingId)}`
517
- },
518
- unmarshalBooking
519
- );
520
- /**
521
- * Waits for {@link Booking} to be in a final state.
522
- *
523
- * @param request - The request {@link GetBookingRequest}
524
- * @param options - The waiting options
525
- * @returns A Promise of Booking
526
- */
527
- waitForBooking = (request, options) => waitForResource(
528
- options?.stop ?? ((res) => Promise.resolve(
529
- !BOOKING_TRANSIENT_STATUSES.includes(res.status)
530
- )),
531
- this.getBooking,
532
- request,
533
- options
534
- );
535
- pageOfListBookings = (request = {}) => this.client.fetch(
536
- {
537
- method: "GET",
538
- path: `/qaas/v1alpha1/bookings`,
539
- urlParams: urlParams(
540
- ["order_by", request.orderBy],
541
- ["page", request.page],
542
- [
543
- "page_size",
544
- request.pageSize ?? this.client.settings.defaultPageSize
545
- ],
546
- ["platform_id", request.platformId],
547
- ["project_id", request.projectId]
548
- )
549
- },
550
- unmarshalListBookingsResponse
551
- );
552
- /**
553
- * List all bookings according the filter. Retrieve information about all bookings of the provided **project ID** or ** platform ID**.
554
- *
555
- * @param request - The request {@link ListBookingsRequest}
556
- * @returns A Promise of ListBookingsResponse
557
- */
558
- listBookings = (request = {}) => enrichForPagination("bookings", this.pageOfListBookings, request);
559
- /**
560
- * Update booking information. Update booking information of the provided **booking ID**.
561
- *
562
- * @param request - The request {@link UpdateBookingRequest}
563
- * @returns A Promise of Booking
564
- */
565
- updateBooking = (request) => this.client.fetch(
566
- {
567
- body: JSON.stringify(
568
- marshalUpdateBookingRequest(request, this.client.settings)
569
- ),
570
- headers: jsonContentHeaders,
571
- method: "PATCH",
572
- path: `/qaas/v1alpha1/bookings/${validatePathParam("bookingId", request.bookingId)}`
573
- },
574
- unmarshalBooking
575
- );
576
- /**
577
- * Create a new model. Create and register a new model that can be executed through next jobs. A model can also be assigned to a Session.
578
- *
579
- * @param request - The request {@link CreateModelRequest}
580
- * @returns A Promise of Model
581
- */
582
- createModel = (request = {}) => this.client.fetch(
583
- {
584
- body: JSON.stringify(
585
- marshalCreateModelRequest(request, this.client.settings)
586
- ),
587
- headers: jsonContentHeaders,
588
- method: "POST",
589
- path: `/qaas/v1alpha1/models`
590
- },
591
- unmarshalModel
592
- );
593
- /**
594
- * Get model information. Retrieve information about of the provided **model ID**.
595
- *
596
- * @param request - The request {@link GetModelRequest}
597
- * @returns A Promise of Model
598
- */
599
- getModel = (request) => this.client.fetch(
600
- {
601
- method: "GET",
602
- path: `/qaas/v1alpha1/models/${validatePathParam("modelId", request.modelId)}`
603
- },
604
- unmarshalModel
605
- );
606
- pageOfListModels = (request = {}) => this.client.fetch(
607
- {
608
- method: "GET",
609
- path: `/qaas/v1alpha1/models`,
610
- urlParams: urlParams(
611
- ["order_by", request.orderBy],
612
- ["page", request.page],
613
- [
614
- "page_size",
615
- request.pageSize ?? this.client.settings.defaultPageSize
616
- ],
617
- [
618
- "project_id",
619
- request.projectId ?? this.client.settings.defaultProjectId
620
- ]
621
- )
622
- },
623
- unmarshalListModelsResponse
624
- );
625
- /**
626
- * List all models attached to the **project ID**. Retrieve information about all models of the provided **project ID**.
627
- *
628
- * @param request - The request {@link ListModelsRequest}
629
- * @returns A Promise of ListModelsResponse
630
- */
631
- listModels = (request = {}) => enrichForPagination("models", this.pageOfListModels, request);
632
- }
633
- export {
634
- API
1
+ import { BOOKING_TRANSIENT_STATUSES, JOB_TRANSIENT_STATUSES, PROCESS_TRANSIENT_STATUSES, SESSION_TRANSIENT_STATUSES } from "./content.gen.js";
2
+ import { marshalCreateJobRequest, marshalCreateModelRequest, marshalCreateProcessRequest, marshalCreateSessionRequest, marshalUpdateBookingRequest, marshalUpdateJobRequest, marshalUpdateProcessRequest, marshalUpdateSessionRequest, unmarshalApplication, unmarshalBooking, unmarshalJob, unmarshalJobCircuit, unmarshalListApplicationsResponse, unmarshalListBookingsResponse, unmarshalListJobResultsResponse, unmarshalListJobsResponse, unmarshalListModelsResponse, unmarshalListPlatformsResponse, unmarshalListProcessResultsResponse, unmarshalListProcessesResponse, unmarshalListSessionACLsResponse, unmarshalListSessionsResponse, unmarshalModel, unmarshalPlatform, unmarshalProcess, unmarshalSession } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, resolveOneOf, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Quantum as a Service API.
7
+
8
+ This API allows you to allocate and program Quantum Processing Units (QPUs) to run quantum algorithms.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Get job information. Retrieve information about the provided **job ID**, mainly used to get the current status.
13
+ *
14
+ * @param request - The request {@link GetJobRequest}
15
+ * @returns A Promise of Job
16
+ */
17
+ getJob = (request) => this.client.fetch({
18
+ method: "GET",
19
+ path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}`
20
+ }, unmarshalJob);
21
+ /**
22
+ * Waits for {@link Job} to be in a final state.
23
+ *
24
+ * @param request - The request {@link GetJobRequest}
25
+ * @param options - The waiting options
26
+ * @returns A Promise of Job
27
+ */
28
+ waitForJob = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!JOB_TRANSIENT_STATUSES.includes(res.status))), this.getJob, request, options);
29
+ pageOfListJobs = (request = {}) => this.client.fetch({
30
+ method: "GET",
31
+ path: `/qaas/v1alpha1/jobs`,
32
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["tags", request.tags], ...Object.entries(resolveOneOf([{
33
+ param: "session_id",
34
+ value: request.sessionId
35
+ }, {
36
+ default: this.client.settings.defaultProjectId,
37
+ param: "project_id",
38
+ value: request.projectId
39
+ }])))
40
+ }, unmarshalListJobsResponse);
41
+ /**
42
+ * List all jobs within a project or session. Retrieve information about all jobs within a given session.
43
+ *
44
+ * @param request - The request {@link ListJobsRequest}
45
+ * @returns A Promise of ListJobsResponse
46
+ */
47
+ listJobs = (request = {}) => enrichForPagination("jobs", this.pageOfListJobs, request);
48
+ pageOfListJobResults = (request) => this.client.fetch({
49
+ method: "GET",
50
+ path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}/results`,
51
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
52
+ }, unmarshalListJobResultsResponse);
53
+ /**
54
+ * List all results of a job. Retrieve all intermediate and final results of a job.
55
+ *
56
+ * @param request - The request {@link ListJobResultsRequest}
57
+ * @returns A Promise of ListJobResultsResponse
58
+ */
59
+ listJobResults = (request) => enrichForPagination("jobResults", this.pageOfListJobResults, request);
60
+ /**
61
+ * Create a job. Create a job to be executed inside a QPU session.
62
+ *
63
+ * @param request - The request {@link CreateJobRequest}
64
+ * @returns A Promise of Job
65
+ */
66
+ createJob = (request) => this.client.fetch({
67
+ body: JSON.stringify(marshalCreateJobRequest(request, this.client.settings)),
68
+ headers: jsonContentHeaders,
69
+ method: "POST",
70
+ path: `/qaas/v1alpha1/jobs`
71
+ }, unmarshalJob);
72
+ /**
73
+ * Update job information. Update job information about the provided **job ID**.
74
+ *
75
+ * @param request - The request {@link UpdateJobRequest}
76
+ * @returns A Promise of Job
77
+ */
78
+ updateJob = (request) => this.client.fetch({
79
+ body: JSON.stringify(marshalUpdateJobRequest(request, this.client.settings)),
80
+ headers: jsonContentHeaders,
81
+ method: "PATCH",
82
+ path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}`
83
+ }, unmarshalJob);
84
+ /**
85
+ * Cancel a job. Cancel the job corresponding to the provided **job ID**.
86
+ *
87
+ * @param request - The request {@link CancelJobRequest}
88
+ * @returns A Promise of Job
89
+ */
90
+ cancelJob = (request) => this.client.fetch({
91
+ body: "{}",
92
+ headers: jsonContentHeaders,
93
+ method: "POST",
94
+ path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}/cancel`
95
+ }, unmarshalJob);
96
+ /**
97
+ * Delete a job. Delete the job corresponding to the provided **job ID**.
98
+ *
99
+ * @param request - The request {@link DeleteJobRequest}
100
+ */
101
+ deleteJob = (request) => this.client.fetch({
102
+ method: "DELETE",
103
+ path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}`
104
+ });
105
+ /**
106
+ * Get a job circuit. Retrieve the circuit of the provided **job ID**.
107
+ *
108
+ * @param request - The request {@link GetJobCircuitRequest}
109
+ * @returns A Promise of JobCircuit
110
+ */
111
+ getJobCircuit = (request) => this.client.fetch({
112
+ method: "GET",
113
+ path: `/qaas/v1alpha1/jobs/${validatePathParam("jobId", request.jobId)}/circuit`
114
+ }, unmarshalJobCircuit);
115
+ /**
116
+ * Get platform information. Retrieve information about the provided **platform ID**, such as provider name, technology, and type.
117
+ *
118
+ * @param request - The request {@link GetPlatformRequest}
119
+ * @returns A Promise of Platform
120
+ */
121
+ getPlatform = (request) => this.client.fetch({
122
+ method: "GET",
123
+ path: `/qaas/v1alpha1/platforms/${validatePathParam("platformId", request.platformId)}`
124
+ }, unmarshalPlatform);
125
+ pageOfListPlatforms = (request = {}) => this.client.fetch({
126
+ method: "GET",
127
+ path: `/qaas/v1alpha1/platforms`,
128
+ urlParams: urlParams(["backend_name", request.backendName], ["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["platform_technology", request.platformTechnology], ["platform_type", request.platformType], ["provider_name", request.providerName])
129
+ }, unmarshalListPlatformsResponse);
130
+ /**
131
+ * List all available platforms. Retrieve information about all platforms.
132
+ *
133
+ * @param request - The request {@link ListPlatformsRequest}
134
+ * @returns A Promise of ListPlatformsResponse
135
+ */
136
+ listPlatforms = (request = {}) => enrichForPagination("platforms", this.pageOfListPlatforms, request);
137
+ /**
138
+ * Get session information. Retrieve information about the provided **session ID**, such as name and status.
139
+ *
140
+ * @param request - The request {@link GetSessionRequest}
141
+ * @returns A Promise of Session
142
+ */
143
+ getSession = (request) => this.client.fetch({
144
+ method: "GET",
145
+ path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}`
146
+ }, unmarshalSession);
147
+ /**
148
+ * Waits for {@link Session} to be in a final state.
149
+ *
150
+ * @param request - The request {@link GetSessionRequest}
151
+ * @param options - The waiting options
152
+ * @returns A Promise of Session
153
+ */
154
+ waitForSession = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!SESSION_TRANSIENT_STATUSES.includes(res.status))), this.getSession, request, options);
155
+ pageOfListSessions = (request = {}) => this.client.fetch({
156
+ method: "GET",
157
+ path: `/qaas/v1alpha1/sessions`,
158
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["platform_id", request.platformId], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["tags", request.tags])
159
+ }, unmarshalListSessionsResponse);
160
+ /**
161
+ * List all sessions. Retrieve information about all QPU sessions.
162
+ *
163
+ * @param request - The request {@link ListSessionsRequest}
164
+ * @returns A Promise of ListSessionsResponse
165
+ */
166
+ listSessions = (request = {}) => enrichForPagination("sessions", this.pageOfListSessions, request);
167
+ /**
168
+ * Create a session. Create a new QPU session for the specified platform. Once ready, jobs can be sent to this session.
169
+ *
170
+ * @param request - The request {@link CreateSessionRequest}
171
+ * @returns A Promise of Session
172
+ */
173
+ createSession = (request) => this.client.fetch({
174
+ body: JSON.stringify(marshalCreateSessionRequest(request, this.client.settings)),
175
+ headers: jsonContentHeaders,
176
+ method: "POST",
177
+ path: `/qaas/v1alpha1/sessions`
178
+ }, unmarshalSession);
179
+ /**
180
+ * Update session information. Update session information of the provided **session ID**.
181
+ *
182
+ * @param request - The request {@link UpdateSessionRequest}
183
+ * @returns A Promise of Session
184
+ */
185
+ updateSession = (request) => this.client.fetch({
186
+ body: JSON.stringify(marshalUpdateSessionRequest(request, this.client.settings)),
187
+ headers: jsonContentHeaders,
188
+ method: "PATCH",
189
+ path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}`
190
+ }, unmarshalSession);
191
+ /**
192
+ * Terminate an existing session. Terminate a session by its unique ID and cancel all its attached jobs and bookings.
193
+ *
194
+ * @param request - The request {@link TerminateSessionRequest}
195
+ * @returns A Promise of Session
196
+ */
197
+ terminateSession = (request) => this.client.fetch({
198
+ body: "{}",
199
+ headers: jsonContentHeaders,
200
+ method: "POST",
201
+ path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}/terminate`
202
+ }, unmarshalSession);
203
+ /**
204
+ * Delete an existing session. Delete a session by its unique ID and delete all its attached jobs and bookings.
205
+ *
206
+ * @param request - The request {@link DeleteSessionRequest}
207
+ */
208
+ deleteSession = (request) => this.client.fetch({
209
+ method: "DELETE",
210
+ path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}`
211
+ });
212
+ pageOfListSessionACLs = (request) => this.client.fetch({
213
+ method: "GET",
214
+ path: `/qaas/v1alpha1/sessions/${validatePathParam("sessionId", request.sessionId)}/acls`,
215
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
216
+ }, unmarshalListSessionACLsResponse);
217
+ listSessionACLs = (request) => enrichForPagination("acls", this.pageOfListSessionACLs, request);
218
+ /**
219
+ * Create a process. Create a new process for the specified application on a specified platform.
220
+ *
221
+ * @param request - The request {@link CreateProcessRequest}
222
+ * @returns A Promise of Process
223
+ */
224
+ createProcess = (request) => this.client.fetch({
225
+ body: JSON.stringify(marshalCreateProcessRequest(request, this.client.settings)),
226
+ headers: jsonContentHeaders,
227
+ method: "POST",
228
+ path: `/qaas/v1alpha1/processes`
229
+ }, unmarshalProcess);
230
+ /**
231
+ * Get process information. Retrieve information about the provided **process ID**, such as name, status and progress.
232
+ *
233
+ * @param request - The request {@link GetProcessRequest}
234
+ * @returns A Promise of Process
235
+ */
236
+ getProcess = (request) => this.client.fetch({
237
+ method: "GET",
238
+ path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}`
239
+ }, unmarshalProcess);
240
+ /**
241
+ * Waits for {@link Process} to be in a final state.
242
+ *
243
+ * @param request - The request {@link GetProcessRequest}
244
+ * @param options - The waiting options
245
+ * @returns A Promise of Process
246
+ */
247
+ waitForProcess = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!PROCESS_TRANSIENT_STATUSES.includes(res.status))), this.getProcess, request, options);
248
+ pageOfListProcesses = (request = {}) => this.client.fetch({
249
+ method: "GET",
250
+ path: `/qaas/v1alpha1/processes`,
251
+ urlParams: urlParams(["application_id", request.applicationId], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["tags", request.tags])
252
+ }, unmarshalListProcessesResponse);
253
+ /**
254
+ * List all processes. Retrieve information about all processes.
255
+ *
256
+ * @param request - The request {@link ListProcessesRequest}
257
+ * @returns A Promise of ListProcessesResponse
258
+ */
259
+ listProcesses = (request = {}) => enrichForPagination("processes", this.pageOfListProcesses, request);
260
+ /**
261
+ * Update process information. Update process information of the provided **process ID**.
262
+ *
263
+ * @param request - The request {@link UpdateProcessRequest}
264
+ * @returns A Promise of Process
265
+ */
266
+ updateProcess = (request) => this.client.fetch({
267
+ body: JSON.stringify(marshalUpdateProcessRequest(request, this.client.settings)),
268
+ headers: jsonContentHeaders,
269
+ method: "PATCH",
270
+ path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}`
271
+ }, unmarshalProcess);
272
+ /**
273
+ * Cancel a running process. Cancel a process by its unique ID. Intermediate results are still available.
274
+ *
275
+ * @param request - The request {@link CancelProcessRequest}
276
+ * @returns A Promise of Process
277
+ */
278
+ cancelProcess = (request) => this.client.fetch({
279
+ body: "{}",
280
+ headers: jsonContentHeaders,
281
+ method: "POST",
282
+ path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}/cancel`
283
+ }, unmarshalProcess);
284
+ /**
285
+ * Delete an existing process. Delete a process by its unique ID and delete all its data.
286
+ *
287
+ * @param request - The request {@link DeleteProcessRequest}
288
+ */
289
+ deleteProcess = (request) => this.client.fetch({
290
+ method: "DELETE",
291
+ path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}`
292
+ });
293
+ pageOfListProcessResults = (request) => this.client.fetch({
294
+ method: "GET",
295
+ path: `/qaas/v1alpha1/processes/${validatePathParam("processId", request.processId)}/results`,
296
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
297
+ }, unmarshalListProcessResultsResponse);
298
+ /**
299
+ * List all results of a process. Retrieve all intermediate and final result of a process.
300
+ *
301
+ * @param request - The request {@link ListProcessResultsRequest}
302
+ * @returns A Promise of ListProcessResultsResponse
303
+ */
304
+ listProcessResults = (request) => enrichForPagination("processResults", this.pageOfListProcessResults, request);
305
+ /**
306
+ * Get application information. Retrieve information about the provided **application ID**, such as name, type and compatible platforms.
307
+ *
308
+ * @param request - The request {@link GetApplicationRequest}
309
+ * @returns A Promise of Application
310
+ */
311
+ getApplication = (request) => this.client.fetch({
312
+ method: "GET",
313
+ path: `/qaas/v1alpha1/applications/${validatePathParam("applicationId", request.applicationId)}`
314
+ }, unmarshalApplication);
315
+ pageOfListApplications = (request = {}) => this.client.fetch({
316
+ method: "GET",
317
+ path: `/qaas/v1alpha1/applications`,
318
+ urlParams: urlParams(["application_type", request.applicationType], ["name", request.name], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
319
+ }, unmarshalListApplicationsResponse);
320
+ /**
321
+ * List all available applications. Retrieve information about all applications.
322
+ *
323
+ * @param request - The request {@link ListApplicationsRequest}
324
+ * @returns A Promise of ListApplicationsResponse
325
+ */
326
+ listApplications = (request = {}) => enrichForPagination("applications", this.pageOfListApplications, request);
327
+ /**
328
+ * Get booking information. Retrieve information about the provided **booking ID**, such as description, status and progress message.
329
+ *
330
+ * @param request - The request {@link GetBookingRequest}
331
+ * @returns A Promise of Booking
332
+ */
333
+ getBooking = (request) => this.client.fetch({
334
+ method: "GET",
335
+ path: `/qaas/v1alpha1/bookings/${validatePathParam("bookingId", request.bookingId)}`
336
+ }, unmarshalBooking);
337
+ /**
338
+ * Waits for {@link Booking} to be in a final state.
339
+ *
340
+ * @param request - The request {@link GetBookingRequest}
341
+ * @param options - The waiting options
342
+ * @returns A Promise of Booking
343
+ */
344
+ waitForBooking = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!BOOKING_TRANSIENT_STATUSES.includes(res.status))), this.getBooking, request, options);
345
+ pageOfListBookings = (request = {}) => this.client.fetch({
346
+ method: "GET",
347
+ path: `/qaas/v1alpha1/bookings`,
348
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["platform_id", request.platformId], ["project_id", request.projectId])
349
+ }, unmarshalListBookingsResponse);
350
+ /**
351
+ * List all bookings according the filter. Retrieve information about all bookings of the provided **project ID** or ** platform ID**.
352
+ *
353
+ * @param request - The request {@link ListBookingsRequest}
354
+ * @returns A Promise of ListBookingsResponse
355
+ */
356
+ listBookings = (request = {}) => enrichForPagination("bookings", this.pageOfListBookings, request);
357
+ /**
358
+ * Update booking information. Update booking information of the provided **booking ID**.
359
+ *
360
+ * @param request - The request {@link UpdateBookingRequest}
361
+ * @returns A Promise of Booking
362
+ */
363
+ updateBooking = (request) => this.client.fetch({
364
+ body: JSON.stringify(marshalUpdateBookingRequest(request, this.client.settings)),
365
+ headers: jsonContentHeaders,
366
+ method: "PATCH",
367
+ path: `/qaas/v1alpha1/bookings/${validatePathParam("bookingId", request.bookingId)}`
368
+ }, unmarshalBooking);
369
+ /**
370
+ * Create a new model. Create and register a new model that can be executed through next jobs. A model can also be assigned to a Session.
371
+ *
372
+ * @param request - The request {@link CreateModelRequest}
373
+ * @returns A Promise of Model
374
+ */
375
+ createModel = (request = {}) => this.client.fetch({
376
+ body: JSON.stringify(marshalCreateModelRequest(request, this.client.settings)),
377
+ headers: jsonContentHeaders,
378
+ method: "POST",
379
+ path: `/qaas/v1alpha1/models`
380
+ }, unmarshalModel);
381
+ /**
382
+ * Get model information. Retrieve information about of the provided **model ID**.
383
+ *
384
+ * @param request - The request {@link GetModelRequest}
385
+ * @returns A Promise of Model
386
+ */
387
+ getModel = (request) => this.client.fetch({
388
+ method: "GET",
389
+ path: `/qaas/v1alpha1/models/${validatePathParam("modelId", request.modelId)}`
390
+ }, unmarshalModel);
391
+ pageOfListModels = (request = {}) => this.client.fetch({
392
+ method: "GET",
393
+ path: `/qaas/v1alpha1/models`,
394
+ urlParams: urlParams(["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId ?? this.client.settings.defaultProjectId])
395
+ }, unmarshalListModelsResponse);
396
+ /**
397
+ * List all models attached to the **project ID**. Retrieve information about all models of the provided **project ID**.
398
+ *
399
+ * @param request - The request {@link ListModelsRequest}
400
+ * @returns A Promise of ListModelsResponse
401
+ */
402
+ listModels = (request = {}) => enrichForPagination("models", this.pageOfListModels, request);
635
403
  };
404
+ export { API$1 as API };