Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
main ▾

xtool.git / Sources / DeveloperAPI / Generated / Client.swift

Client.swift6731 lines · 315.2 KiBRaw
1// Generated by swift-openapi-generator, do not modify.
2@_spi(Generated) import OpenAPIRuntime
3#if os(Linux)
4@preconcurrency import struct Foundation.URL
5@preconcurrency import struct Foundation.Data
6@preconcurrency import struct Foundation.Date
7#else
8import struct Foundation.URL
9import struct Foundation.Data
10import struct Foundation.Date
11#endif
12import HTTPTypes
13public struct DeveloperAPIClient: APIProtocol {
14 /// The underlying HTTP client.
15 private let client: UniversalClient
16 /// Creates a new client.
17 /// - Parameters:
18 /// - serverURL: The server URL that the client connects to. Any server
19 /// URLs defined in the OpenAPI document are available as static methods
20 /// on the ``Servers`` type.
21 /// - configuration: A set of configuration values for the client.
22 /// - transport: A transport that performs HTTP operations.
23 /// - middlewares: A list of middlewares to call before the transport.
24 public init(
25 serverURL: Foundation.URL,
26 configuration: Configuration = .init(),
27 transport: any ClientTransport,
28 middlewares: [any ClientMiddleware] = []
29 ) {
30 self.client = .init(
31 serverURL: serverURL,
32 configuration: configuration,
33 transport: transport,
34 middlewares: middlewares
35 )
36 }
37 private var converter: Converter {
38 client.converter
39 }
40 /// - Remark: HTTP `POST /v1/bundleIdCapabilities`.
41 /// - Remark: Generated from `#/paths//v1/bundleIdCapabilities/post(bundleIdCapabilities_createInstance)`.
42 public func bundleIdCapabilitiesCreateInstance(_ input: Operations.BundleIdCapabilitiesCreateInstance.Input) async throws -> Operations.BundleIdCapabilitiesCreateInstance.Output {
43 try await client.send(
44 input: input,
45 forOperation: Operations.BundleIdCapabilitiesCreateInstance.id,
46 serializer: { input in
47 let path = try converter.renderedPath(
48 template: "/v1/bundleIdCapabilities",
49 parameters: []
50 )
51 var request: HTTPTypes.HTTPRequest = .init(
52 soar_path: path,
53 method: .post
54 )
55 suppressMutabilityWarning(&request)
56 converter.setAcceptHeader(
57 in: &request.headerFields,
58 contentTypes: input.headers.accept
59 )
60 let body: OpenAPIRuntime.HTTPBody?
61 switch input.body {
62 case let .json(value):
63 body = try converter.setRequiredRequestBodyAsJSON(
64 value,
65 headerFields: &request.headerFields,
66 contentType: "application/json; charset=utf-8"
67 )
68 }
69 return (request, body)
70 },
71 deserializer: { response, responseBody in
72 switch response.status.code {
73 case 201:
74 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
75 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Created.Body
76 let chosenContentType = try converter.bestContentType(
77 received: contentType,
78 options: [
79 "application/json"
80 ]
81 )
82 switch chosenContentType {
83 case "application/json":
84 body = try await converter.getResponseBodyAsJSON(
85 Components.Schemas.BundleIdCapabilityResponse.self,
86 from: responseBody,
87 transforming: { value in
88 .json(value)
89 }
90 )
91 default:
92 preconditionFailure("bestContentType chose an invalid content type.")
93 }
94 return .created(.init(body: body))
95 case 400:
96 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
97 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.BadRequest.Body
98 let chosenContentType = try converter.bestContentType(
99 received: contentType,
100 options: [
101 "application/json"
102 ]
103 )
104 switch chosenContentType {
105 case "application/json":
106 body = try await converter.getResponseBodyAsJSON(
107 Components.Schemas.ErrorResponse.self,
108 from: responseBody,
109 transforming: { value in
110 .json(value)
111 }
112 )
113 default:
114 preconditionFailure("bestContentType chose an invalid content type.")
115 }
116 return .badRequest(.init(body: body))
117 case 401:
118 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
119 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Unauthorized.Body
120 let chosenContentType = try converter.bestContentType(
121 received: contentType,
122 options: [
123 "application/json"
124 ]
125 )
126 switch chosenContentType {
127 case "application/json":
128 body = try await converter.getResponseBodyAsJSON(
129 Components.Schemas.ErrorResponse.self,
130 from: responseBody,
131 transforming: { value in
132 .json(value)
133 }
134 )
135 default:
136 preconditionFailure("bestContentType chose an invalid content type.")
137 }
138 return .unauthorized(.init(body: body))
139 case 403:
140 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
141 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Forbidden.Body
142 let chosenContentType = try converter.bestContentType(
143 received: contentType,
144 options: [
145 "application/json"
146 ]
147 )
148 switch chosenContentType {
149 case "application/json":
150 body = try await converter.getResponseBodyAsJSON(
151 Components.Schemas.ErrorResponse.self,
152 from: responseBody,
153 transforming: { value in
154 .json(value)
155 }
156 )
157 default:
158 preconditionFailure("bestContentType chose an invalid content type.")
159 }
160 return .forbidden(.init(body: body))
161 case 409:
162 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
163 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Conflict.Body
164 let chosenContentType = try converter.bestContentType(
165 received: contentType,
166 options: [
167 "application/json"
168 ]
169 )
170 switch chosenContentType {
171 case "application/json":
172 body = try await converter.getResponseBodyAsJSON(
173 Components.Schemas.ErrorResponse.self,
174 from: responseBody,
175 transforming: { value in
176 .json(value)
177 }
178 )
179 default:
180 preconditionFailure("bestContentType chose an invalid content type.")
181 }
182 return .conflict(.init(body: body))
183 case 422:
184 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
185 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.UnprocessableContent.Body
186 let chosenContentType = try converter.bestContentType(
187 received: contentType,
188 options: [
189 "application/json"
190 ]
191 )
192 switch chosenContentType {
193 case "application/json":
194 body = try await converter.getResponseBodyAsJSON(
195 Components.Schemas.ErrorResponse.self,
196 from: responseBody,
197 transforming: { value in
198 .json(value)
199 }
200 )
201 default:
202 preconditionFailure("bestContentType chose an invalid content type.")
203 }
204 return .unprocessableContent(.init(body: body))
205 case 429:
206 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
207 let body: Operations.BundleIdCapabilitiesCreateInstance.Output.TooManyRequests.Body
208 let chosenContentType = try converter.bestContentType(
209 received: contentType,
210 options: [
211 "application/json"
212 ]
213 )
214 switch chosenContentType {
215 case "application/json":
216 body = try await converter.getResponseBodyAsJSON(
217 Components.Schemas.ErrorResponse.self,
218 from: responseBody,
219 transforming: { value in
220 .json(value)
221 }
222 )
223 default:
224 preconditionFailure("bestContentType chose an invalid content type.")
225 }
226 return .tooManyRequests(.init(body: body))
227 default:
228 return .undocumented(
229 statusCode: response.status.code,
230 .init(
231 headerFields: response.headerFields,
232 body: responseBody
233 )
234 )
235 }
236 }
237 )
238 }
239 /// - Remark: HTTP `PATCH /v1/bundleIdCapabilities/{id}`.
240 /// - Remark: Generated from `#/paths//v1/bundleIdCapabilities/{id}/patch(bundleIdCapabilities_updateInstance)`.
241 public func bundleIdCapabilitiesUpdateInstance(_ input: Operations.BundleIdCapabilitiesUpdateInstance.Input) async throws -> Operations.BundleIdCapabilitiesUpdateInstance.Output {
242 try await client.send(
243 input: input,
244 forOperation: Operations.BundleIdCapabilitiesUpdateInstance.id,
245 serializer: { input in
246 let path = try converter.renderedPath(
247 template: "/v1/bundleIdCapabilities/{}",
248 parameters: [
249 input.path.id
250 ]
251 )
252 var request: HTTPTypes.HTTPRequest = .init(
253 soar_path: path,
254 method: .patch
255 )
256 suppressMutabilityWarning(&request)
257 converter.setAcceptHeader(
258 in: &request.headerFields,
259 contentTypes: input.headers.accept
260 )
261 let body: OpenAPIRuntime.HTTPBody?
262 switch input.body {
263 case let .json(value):
264 body = try converter.setRequiredRequestBodyAsJSON(
265 value,
266 headerFields: &request.headerFields,
267 contentType: "application/json; charset=utf-8"
268 )
269 }
270 return (request, body)
271 },
272 deserializer: { response, responseBody in
273 switch response.status.code {
274 case 200:
275 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
276 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Ok.Body
277 let chosenContentType = try converter.bestContentType(
278 received: contentType,
279 options: [
280 "application/json"
281 ]
282 )
283 switch chosenContentType {
284 case "application/json":
285 body = try await converter.getResponseBodyAsJSON(
286 Components.Schemas.BundleIdCapabilityResponse.self,
287 from: responseBody,
288 transforming: { value in
289 .json(value)
290 }
291 )
292 default:
293 preconditionFailure("bestContentType chose an invalid content type.")
294 }
295 return .ok(.init(body: body))
296 case 400:
297 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
298 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.BadRequest.Body
299 let chosenContentType = try converter.bestContentType(
300 received: contentType,
301 options: [
302 "application/json"
303 ]
304 )
305 switch chosenContentType {
306 case "application/json":
307 body = try await converter.getResponseBodyAsJSON(
308 Components.Schemas.ErrorResponse.self,
309 from: responseBody,
310 transforming: { value in
311 .json(value)
312 }
313 )
314 default:
315 preconditionFailure("bestContentType chose an invalid content type.")
316 }
317 return .badRequest(.init(body: body))
318 case 401:
319 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
320 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Unauthorized.Body
321 let chosenContentType = try converter.bestContentType(
322 received: contentType,
323 options: [
324 "application/json"
325 ]
326 )
327 switch chosenContentType {
328 case "application/json":
329 body = try await converter.getResponseBodyAsJSON(
330 Components.Schemas.ErrorResponse.self,
331 from: responseBody,
332 transforming: { value in
333 .json(value)
334 }
335 )
336 default:
337 preconditionFailure("bestContentType chose an invalid content type.")
338 }
339 return .unauthorized(.init(body: body))
340 case 403:
341 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
342 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Forbidden.Body
343 let chosenContentType = try converter.bestContentType(
344 received: contentType,
345 options: [
346 "application/json"
347 ]
348 )
349 switch chosenContentType {
350 case "application/json":
351 body = try await converter.getResponseBodyAsJSON(
352 Components.Schemas.ErrorResponse.self,
353 from: responseBody,
354 transforming: { value in
355 .json(value)
356 }
357 )
358 default:
359 preconditionFailure("bestContentType chose an invalid content type.")
360 }
361 return .forbidden(.init(body: body))
362 case 404:
363 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
364 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.NotFound.Body
365 let chosenContentType = try converter.bestContentType(
366 received: contentType,
367 options: [
368 "application/json"
369 ]
370 )
371 switch chosenContentType {
372 case "application/json":
373 body = try await converter.getResponseBodyAsJSON(
374 Components.Schemas.ErrorResponse.self,
375 from: responseBody,
376 transforming: { value in
377 .json(value)
378 }
379 )
380 default:
381 preconditionFailure("bestContentType chose an invalid content type.")
382 }
383 return .notFound(.init(body: body))
384 case 409:
385 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
386 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Conflict.Body
387 let chosenContentType = try converter.bestContentType(
388 received: contentType,
389 options: [
390 "application/json"
391 ]
392 )
393 switch chosenContentType {
394 case "application/json":
395 body = try await converter.getResponseBodyAsJSON(
396 Components.Schemas.ErrorResponse.self,
397 from: responseBody,
398 transforming: { value in
399 .json(value)
400 }
401 )
402 default:
403 preconditionFailure("bestContentType chose an invalid content type.")
404 }
405 return .conflict(.init(body: body))
406 case 422:
407 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
408 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.UnprocessableContent.Body
409 let chosenContentType = try converter.bestContentType(
410 received: contentType,
411 options: [
412 "application/json"
413 ]
414 )
415 switch chosenContentType {
416 case "application/json":
417 body = try await converter.getResponseBodyAsJSON(
418 Components.Schemas.ErrorResponse.self,
419 from: responseBody,
420 transforming: { value in
421 .json(value)
422 }
423 )
424 default:
425 preconditionFailure("bestContentType chose an invalid content type.")
426 }
427 return .unprocessableContent(.init(body: body))
428 case 429:
429 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
430 let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.TooManyRequests.Body
431 let chosenContentType = try converter.bestContentType(
432 received: contentType,
433 options: [
434 "application/json"
435 ]
436 )
437 switch chosenContentType {
438 case "application/json":
439 body = try await converter.getResponseBodyAsJSON(
440 Components.Schemas.ErrorResponse.self,
441 from: responseBody,
442 transforming: { value in
443 .json(value)
444 }
445 )
446 default:
447 preconditionFailure("bestContentType chose an invalid content type.")
448 }
449 return .tooManyRequests(.init(body: body))
450 default:
451 return .undocumented(
452 statusCode: response.status.code,
453 .init(
454 headerFields: response.headerFields,
455 body: responseBody
456 )
457 )
458 }
459 }
460 )
461 }
462 /// - Remark: HTTP `DELETE /v1/bundleIdCapabilities/{id}`.
463 /// - Remark: Generated from `#/paths//v1/bundleIdCapabilities/{id}/delete(bundleIdCapabilities_deleteInstance)`.
464 public func bundleIdCapabilitiesDeleteInstance(_ input: Operations.BundleIdCapabilitiesDeleteInstance.Input) async throws -> Operations.BundleIdCapabilitiesDeleteInstance.Output {
465 try await client.send(
466 input: input,
467 forOperation: Operations.BundleIdCapabilitiesDeleteInstance.id,
468 serializer: { input in
469 let path = try converter.renderedPath(
470 template: "/v1/bundleIdCapabilities/{}",
471 parameters: [
472 input.path.id
473 ]
474 )
475 var request: HTTPTypes.HTTPRequest = .init(
476 soar_path: path,
477 method: .delete
478 )
479 suppressMutabilityWarning(&request)
480 converter.setAcceptHeader(
481 in: &request.headerFields,
482 contentTypes: input.headers.accept
483 )
484 return (request, nil)
485 },
486 deserializer: { response, responseBody in
487 switch response.status.code {
488 case 204:
489 return .noContent(.init())
490 case 400:
491 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
492 let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.BadRequest.Body
493 let chosenContentType = try converter.bestContentType(
494 received: contentType,
495 options: [
496 "application/json"
497 ]
498 )
499 switch chosenContentType {
500 case "application/json":
501 body = try await converter.getResponseBodyAsJSON(
502 Components.Schemas.ErrorResponse.self,
503 from: responseBody,
504 transforming: { value in
505 .json(value)
506 }
507 )
508 default:
509 preconditionFailure("bestContentType chose an invalid content type.")
510 }
511 return .badRequest(.init(body: body))
512 case 401:
513 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
514 let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.Unauthorized.Body
515 let chosenContentType = try converter.bestContentType(
516 received: contentType,
517 options: [
518 "application/json"
519 ]
520 )
521 switch chosenContentType {
522 case "application/json":
523 body = try await converter.getResponseBodyAsJSON(
524 Components.Schemas.ErrorResponse.self,
525 from: responseBody,
526 transforming: { value in
527 .json(value)
528 }
529 )
530 default:
531 preconditionFailure("bestContentType chose an invalid content type.")
532 }
533 return .unauthorized(.init(body: body))
534 case 403:
535 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
536 let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.Forbidden.Body
537 let chosenContentType = try converter.bestContentType(
538 received: contentType,
539 options: [
540 "application/json"
541 ]
542 )
543 switch chosenContentType {
544 case "application/json":
545 body = try await converter.getResponseBodyAsJSON(
546 Components.Schemas.ErrorResponse.self,
547 from: responseBody,
548 transforming: { value in
549 .json(value)
550 }
551 )
552 default:
553 preconditionFailure("bestContentType chose an invalid content type.")
554 }
555 return .forbidden(.init(body: body))
556 case 404:
557 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
558 let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.NotFound.Body
559 let chosenContentType = try converter.bestContentType(
560 received: contentType,
561 options: [
562 "application/json"
563 ]
564 )
565 switch chosenContentType {
566 case "application/json":
567 body = try await converter.getResponseBodyAsJSON(
568 Components.Schemas.ErrorResponse.self,
569 from: responseBody,
570 transforming: { value in
571 .json(value)
572 }
573 )
574 default:
575 preconditionFailure("bestContentType chose an invalid content type.")
576 }
577 return .notFound(.init(body: body))
578 case 429:
579 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
580 let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.TooManyRequests.Body
581 let chosenContentType = try converter.bestContentType(
582 received: contentType,
583 options: [
584 "application/json"
585 ]
586 )
587 switch chosenContentType {
588 case "application/json":
589 body = try await converter.getResponseBodyAsJSON(
590 Components.Schemas.ErrorResponse.self,
591 from: responseBody,
592 transforming: { value in
593 .json(value)
594 }
595 )
596 default:
597 preconditionFailure("bestContentType chose an invalid content type.")
598 }
599 return .tooManyRequests(.init(body: body))
600 default:
601 return .undocumented(
602 statusCode: response.status.code,
603 .init(
604 headerFields: response.headerFields,
605 body: responseBody
606 )
607 )
608 }
609 }
610 )
611 }
612 /// - Remark: HTTP `GET /v1/bundleIds`.
613 /// - Remark: Generated from `#/paths//v1/bundleIds/get(bundleIds_getCollection)`.
614 public func bundleIdsGetCollection(_ input: Operations.BundleIdsGetCollection.Input) async throws -> Operations.BundleIdsGetCollection.Output {
615 try await client.send(
616 input: input,
617 forOperation: Operations.BundleIdsGetCollection.id,
618 serializer: { input in
619 let path = try converter.renderedPath(
620 template: "/v1/bundleIds",
621 parameters: []
622 )
623 var request: HTTPTypes.HTTPRequest = .init(
624 soar_path: path,
625 method: .get
626 )
627 suppressMutabilityWarning(&request)
628 try converter.setQueryItemAsURI(
629 in: &request,
630 style: .form,
631 explode: false,
632 name: "filter[name]",
633 value: input.query.filter_lbrack_name_rbrack_
634 )
635 try converter.setQueryItemAsURI(
636 in: &request,
637 style: .form,
638 explode: false,
639 name: "filter[platform]",
640 value: input.query.filter_lbrack_platform_rbrack_
641 )
642 try converter.setQueryItemAsURI(
643 in: &request,
644 style: .form,
645 explode: false,
646 name: "filter[identifier]",
647 value: input.query.filter_lbrack_identifier_rbrack_
648 )
649 try converter.setQueryItemAsURI(
650 in: &request,
651 style: .form,
652 explode: false,
653 name: "filter[seedId]",
654 value: input.query.filter_lbrack_seedId_rbrack_
655 )
656 try converter.setQueryItemAsURI(
657 in: &request,
658 style: .form,
659 explode: false,
660 name: "filter[id]",
661 value: input.query.filter_lbrack_id_rbrack_
662 )
663 try converter.setQueryItemAsURI(
664 in: &request,
665 style: .form,
666 explode: false,
667 name: "sort",
668 value: input.query.sort
669 )
670 try converter.setQueryItemAsURI(
671 in: &request,
672 style: .form,
673 explode: false,
674 name: "fields[bundleIds]",
675 value: input.query.fields_lbrack_bundleIds_rbrack_
676 )
677 try converter.setQueryItemAsURI(
678 in: &request,
679 style: .form,
680 explode: false,
681 name: "fields[profiles]",
682 value: input.query.fields_lbrack_profiles_rbrack_
683 )
684 try converter.setQueryItemAsURI(
685 in: &request,
686 style: .form,
687 explode: false,
688 name: "fields[bundleIdCapabilities]",
689 value: input.query.fields_lbrack_bundleIdCapabilities_rbrack_
690 )
691 try converter.setQueryItemAsURI(
692 in: &request,
693 style: .form,
694 explode: false,
695 name: "fields[apps]",
696 value: input.query.fields_lbrack_apps_rbrack_
697 )
698 try converter.setQueryItemAsURI(
699 in: &request,
700 style: .form,
701 explode: true,
702 name: "limit",
703 value: input.query.limit
704 )
705 try converter.setQueryItemAsURI(
706 in: &request,
707 style: .form,
708 explode: false,
709 name: "include",
710 value: input.query.include
711 )
712 try converter.setQueryItemAsURI(
713 in: &request,
714 style: .form,
715 explode: true,
716 name: "limit[bundleIdCapabilities]",
717 value: input.query.limit_lbrack_bundleIdCapabilities_rbrack_
718 )
719 try converter.setQueryItemAsURI(
720 in: &request,
721 style: .form,
722 explode: true,
723 name: "limit[profiles]",
724 value: input.query.limit_lbrack_profiles_rbrack_
725 )
726 converter.setAcceptHeader(
727 in: &request.headerFields,
728 contentTypes: input.headers.accept
729 )
730 return (request, nil)
731 },
732 deserializer: { response, responseBody in
733 switch response.status.code {
734 case 200:
735 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
736 let body: Operations.BundleIdsGetCollection.Output.Ok.Body
737 let chosenContentType = try converter.bestContentType(
738 received: contentType,
739 options: [
740 "application/json"
741 ]
742 )
743 switch chosenContentType {
744 case "application/json":
745 body = try await converter.getResponseBodyAsJSON(
746 Components.Schemas.BundleIdsResponse.self,
747 from: responseBody,
748 transforming: { value in
749 .json(value)
750 }
751 )
752 default:
753 preconditionFailure("bestContentType chose an invalid content type.")
754 }
755 return .ok(.init(body: body))
756 case 400:
757 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
758 let body: Operations.BundleIdsGetCollection.Output.BadRequest.Body
759 let chosenContentType = try converter.bestContentType(
760 received: contentType,
761 options: [
762 "application/json"
763 ]
764 )
765 switch chosenContentType {
766 case "application/json":
767 body = try await converter.getResponseBodyAsJSON(
768 Components.Schemas.ErrorResponse.self,
769 from: responseBody,
770 transforming: { value in
771 .json(value)
772 }
773 )
774 default:
775 preconditionFailure("bestContentType chose an invalid content type.")
776 }
777 return .badRequest(.init(body: body))
778 case 401:
779 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
780 let body: Operations.BundleIdsGetCollection.Output.Unauthorized.Body
781 let chosenContentType = try converter.bestContentType(
782 received: contentType,
783 options: [
784 "application/json"
785 ]
786 )
787 switch chosenContentType {
788 case "application/json":
789 body = try await converter.getResponseBodyAsJSON(
790 Components.Schemas.ErrorResponse.self,
791 from: responseBody,
792 transforming: { value in
793 .json(value)
794 }
795 )
796 default:
797 preconditionFailure("bestContentType chose an invalid content type.")
798 }
799 return .unauthorized(.init(body: body))
800 case 403:
801 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
802 let body: Operations.BundleIdsGetCollection.Output.Forbidden.Body
803 let chosenContentType = try converter.bestContentType(
804 received: contentType,
805 options: [
806 "application/json"
807 ]
808 )
809 switch chosenContentType {
810 case "application/json":
811 body = try await converter.getResponseBodyAsJSON(
812 Components.Schemas.ErrorResponse.self,
813 from: responseBody,
814 transforming: { value in
815 .json(value)
816 }
817 )
818 default:
819 preconditionFailure("bestContentType chose an invalid content type.")
820 }
821 return .forbidden(.init(body: body))
822 case 429:
823 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
824 let body: Operations.BundleIdsGetCollection.Output.TooManyRequests.Body
825 let chosenContentType = try converter.bestContentType(
826 received: contentType,
827 options: [
828 "application/json"
829 ]
830 )
831 switch chosenContentType {
832 case "application/json":
833 body = try await converter.getResponseBodyAsJSON(
834 Components.Schemas.ErrorResponse.self,
835 from: responseBody,
836 transforming: { value in
837 .json(value)
838 }
839 )
840 default:
841 preconditionFailure("bestContentType chose an invalid content type.")
842 }
843 return .tooManyRequests(.init(body: body))
844 default:
845 return .undocumented(
846 statusCode: response.status.code,
847 .init(
848 headerFields: response.headerFields,
849 body: responseBody
850 )
851 )
852 }
853 }
854 )
855 }
856 /// - Remark: HTTP `POST /v1/bundleIds`.
857 /// - Remark: Generated from `#/paths//v1/bundleIds/post(bundleIds_createInstance)`.
858 public func bundleIdsCreateInstance(_ input: Operations.BundleIdsCreateInstance.Input) async throws -> Operations.BundleIdsCreateInstance.Output {
859 try await client.send(
860 input: input,
861 forOperation: Operations.BundleIdsCreateInstance.id,
862 serializer: { input in
863 let path = try converter.renderedPath(
864 template: "/v1/bundleIds",
865 parameters: []
866 )
867 var request: HTTPTypes.HTTPRequest = .init(
868 soar_path: path,
869 method: .post
870 )
871 suppressMutabilityWarning(&request)
872 converter.setAcceptHeader(
873 in: &request.headerFields,
874 contentTypes: input.headers.accept
875 )
876 let body: OpenAPIRuntime.HTTPBody?
877 switch input.body {
878 case let .json(value):
879 body = try converter.setRequiredRequestBodyAsJSON(
880 value,
881 headerFields: &request.headerFields,
882 contentType: "application/json; charset=utf-8"
883 )
884 }
885 return (request, body)
886 },
887 deserializer: { response, responseBody in
888 switch response.status.code {
889 case 201:
890 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
891 let body: Operations.BundleIdsCreateInstance.Output.Created.Body
892 let chosenContentType = try converter.bestContentType(
893 received: contentType,
894 options: [
895 "application/json"
896 ]
897 )
898 switch chosenContentType {
899 case "application/json":
900 body = try await converter.getResponseBodyAsJSON(
901 Components.Schemas.BundleIdResponse.self,
902 from: responseBody,
903 transforming: { value in
904 .json(value)
905 }
906 )
907 default:
908 preconditionFailure("bestContentType chose an invalid content type.")
909 }
910 return .created(.init(body: body))
911 case 400:
912 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
913 let body: Operations.BundleIdsCreateInstance.Output.BadRequest.Body
914 let chosenContentType = try converter.bestContentType(
915 received: contentType,
916 options: [
917 "application/json"
918 ]
919 )
920 switch chosenContentType {
921 case "application/json":
922 body = try await converter.getResponseBodyAsJSON(
923 Components.Schemas.ErrorResponse.self,
924 from: responseBody,
925 transforming: { value in
926 .json(value)
927 }
928 )
929 default:
930 preconditionFailure("bestContentType chose an invalid content type.")
931 }
932 return .badRequest(.init(body: body))
933 case 401:
934 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
935 let body: Operations.BundleIdsCreateInstance.Output.Unauthorized.Body
936 let chosenContentType = try converter.bestContentType(
937 received: contentType,
938 options: [
939 "application/json"
940 ]
941 )
942 switch chosenContentType {
943 case "application/json":
944 body = try await converter.getResponseBodyAsJSON(
945 Components.Schemas.ErrorResponse.self,
946 from: responseBody,
947 transforming: { value in
948 .json(value)
949 }
950 )
951 default:
952 preconditionFailure("bestContentType chose an invalid content type.")
953 }
954 return .unauthorized(.init(body: body))
955 case 403:
956 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
957 let body: Operations.BundleIdsCreateInstance.Output.Forbidden.Body
958 let chosenContentType = try converter.bestContentType(
959 received: contentType,
960 options: [
961 "application/json"
962 ]
963 )
964 switch chosenContentType {
965 case "application/json":
966 body = try await converter.getResponseBodyAsJSON(
967 Components.Schemas.ErrorResponse.self,
968 from: responseBody,
969 transforming: { value in
970 .json(value)
971 }
972 )
973 default:
974 preconditionFailure("bestContentType chose an invalid content type.")
975 }
976 return .forbidden(.init(body: body))
977 case 409:
978 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
979 let body: Operations.BundleIdsCreateInstance.Output.Conflict.Body
980 let chosenContentType = try converter.bestContentType(
981 received: contentType,
982 options: [
983 "application/json"
984 ]
985 )
986 switch chosenContentType {
987 case "application/json":
988 body = try await converter.getResponseBodyAsJSON(
989 Components.Schemas.ErrorResponse.self,
990 from: responseBody,
991 transforming: { value in
992 .json(value)
993 }
994 )
995 default:
996 preconditionFailure("bestContentType chose an invalid content type.")
997 }
998 return .conflict(.init(body: body))
999 case 422:
1000 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1001 let body: Operations.BundleIdsCreateInstance.Output.UnprocessableContent.Body
1002 let chosenContentType = try converter.bestContentType(
1003 received: contentType,
1004 options: [
1005 "application/json"
1006 ]
1007 )
1008 switch chosenContentType {
1009 case "application/json":
1010 body = try await converter.getResponseBodyAsJSON(
1011 Components.Schemas.ErrorResponse.self,
1012 from: responseBody,
1013 transforming: { value in
1014 .json(value)
1015 }
1016 )
1017 default:
1018 preconditionFailure("bestContentType chose an invalid content type.")
1019 }
1020 return .unprocessableContent(.init(body: body))
1021 case 429:
1022 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1023 let body: Operations.BundleIdsCreateInstance.Output.TooManyRequests.Body
1024 let chosenContentType = try converter.bestContentType(
1025 received: contentType,
1026 options: [
1027 "application/json"
1028 ]
1029 )
1030 switch chosenContentType {
1031 case "application/json":
1032 body = try await converter.getResponseBodyAsJSON(
1033 Components.Schemas.ErrorResponse.self,
1034 from: responseBody,
1035 transforming: { value in
1036 .json(value)
1037 }
1038 )
1039 default:
1040 preconditionFailure("bestContentType chose an invalid content type.")
1041 }
1042 return .tooManyRequests(.init(body: body))
1043 default:
1044 return .undocumented(
1045 statusCode: response.status.code,
1046 .init(
1047 headerFields: response.headerFields,
1048 body: responseBody
1049 )
1050 )
1051 }
1052 }
1053 )
1054 }
1055 /// - Remark: HTTP `GET /v1/bundleIds/{id}`.
1056 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/get(bundleIds_getInstance)`.
1057 public func bundleIdsGetInstance(_ input: Operations.BundleIdsGetInstance.Input) async throws -> Operations.BundleIdsGetInstance.Output {
1058 try await client.send(
1059 input: input,
1060 forOperation: Operations.BundleIdsGetInstance.id,
1061 serializer: { input in
1062 let path = try converter.renderedPath(
1063 template: "/v1/bundleIds/{}",
1064 parameters: [
1065 input.path.id
1066 ]
1067 )
1068 var request: HTTPTypes.HTTPRequest = .init(
1069 soar_path: path,
1070 method: .get
1071 )
1072 suppressMutabilityWarning(&request)
1073 try converter.setQueryItemAsURI(
1074 in: &request,
1075 style: .form,
1076 explode: false,
1077 name: "fields[bundleIds]",
1078 value: input.query.fields_lbrack_bundleIds_rbrack_
1079 )
1080 try converter.setQueryItemAsURI(
1081 in: &request,
1082 style: .form,
1083 explode: false,
1084 name: "fields[profiles]",
1085 value: input.query.fields_lbrack_profiles_rbrack_
1086 )
1087 try converter.setQueryItemAsURI(
1088 in: &request,
1089 style: .form,
1090 explode: false,
1091 name: "fields[bundleIdCapabilities]",
1092 value: input.query.fields_lbrack_bundleIdCapabilities_rbrack_
1093 )
1094 try converter.setQueryItemAsURI(
1095 in: &request,
1096 style: .form,
1097 explode: false,
1098 name: "fields[apps]",
1099 value: input.query.fields_lbrack_apps_rbrack_
1100 )
1101 try converter.setQueryItemAsURI(
1102 in: &request,
1103 style: .form,
1104 explode: false,
1105 name: "include",
1106 value: input.query.include
1107 )
1108 try converter.setQueryItemAsURI(
1109 in: &request,
1110 style: .form,
1111 explode: true,
1112 name: "limit[bundleIdCapabilities]",
1113 value: input.query.limit_lbrack_bundleIdCapabilities_rbrack_
1114 )
1115 try converter.setQueryItemAsURI(
1116 in: &request,
1117 style: .form,
1118 explode: true,
1119 name: "limit[profiles]",
1120 value: input.query.limit_lbrack_profiles_rbrack_
1121 )
1122 converter.setAcceptHeader(
1123 in: &request.headerFields,
1124 contentTypes: input.headers.accept
1125 )
1126 return (request, nil)
1127 },
1128 deserializer: { response, responseBody in
1129 switch response.status.code {
1130 case 200:
1131 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1132 let body: Operations.BundleIdsGetInstance.Output.Ok.Body
1133 let chosenContentType = try converter.bestContentType(
1134 received: contentType,
1135 options: [
1136 "application/json"
1137 ]
1138 )
1139 switch chosenContentType {
1140 case "application/json":
1141 body = try await converter.getResponseBodyAsJSON(
1142 Components.Schemas.BundleIdResponse.self,
1143 from: responseBody,
1144 transforming: { value in
1145 .json(value)
1146 }
1147 )
1148 default:
1149 preconditionFailure("bestContentType chose an invalid content type.")
1150 }
1151 return .ok(.init(body: body))
1152 case 400:
1153 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1154 let body: Operations.BundleIdsGetInstance.Output.BadRequest.Body
1155 let chosenContentType = try converter.bestContentType(
1156 received: contentType,
1157 options: [
1158 "application/json"
1159 ]
1160 )
1161 switch chosenContentType {
1162 case "application/json":
1163 body = try await converter.getResponseBodyAsJSON(
1164 Components.Schemas.ErrorResponse.self,
1165 from: responseBody,
1166 transforming: { value in
1167 .json(value)
1168 }
1169 )
1170 default:
1171 preconditionFailure("bestContentType chose an invalid content type.")
1172 }
1173 return .badRequest(.init(body: body))
1174 case 401:
1175 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1176 let body: Operations.BundleIdsGetInstance.Output.Unauthorized.Body
1177 let chosenContentType = try converter.bestContentType(
1178 received: contentType,
1179 options: [
1180 "application/json"
1181 ]
1182 )
1183 switch chosenContentType {
1184 case "application/json":
1185 body = try await converter.getResponseBodyAsJSON(
1186 Components.Schemas.ErrorResponse.self,
1187 from: responseBody,
1188 transforming: { value in
1189 .json(value)
1190 }
1191 )
1192 default:
1193 preconditionFailure("bestContentType chose an invalid content type.")
1194 }
1195 return .unauthorized(.init(body: body))
1196 case 403:
1197 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1198 let body: Operations.BundleIdsGetInstance.Output.Forbidden.Body
1199 let chosenContentType = try converter.bestContentType(
1200 received: contentType,
1201 options: [
1202 "application/json"
1203 ]
1204 )
1205 switch chosenContentType {
1206 case "application/json":
1207 body = try await converter.getResponseBodyAsJSON(
1208 Components.Schemas.ErrorResponse.self,
1209 from: responseBody,
1210 transforming: { value in
1211 .json(value)
1212 }
1213 )
1214 default:
1215 preconditionFailure("bestContentType chose an invalid content type.")
1216 }
1217 return .forbidden(.init(body: body))
1218 case 404:
1219 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1220 let body: Operations.BundleIdsGetInstance.Output.NotFound.Body
1221 let chosenContentType = try converter.bestContentType(
1222 received: contentType,
1223 options: [
1224 "application/json"
1225 ]
1226 )
1227 switch chosenContentType {
1228 case "application/json":
1229 body = try await converter.getResponseBodyAsJSON(
1230 Components.Schemas.ErrorResponse.self,
1231 from: responseBody,
1232 transforming: { value in
1233 .json(value)
1234 }
1235 )
1236 default:
1237 preconditionFailure("bestContentType chose an invalid content type.")
1238 }
1239 return .notFound(.init(body: body))
1240 case 429:
1241 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1242 let body: Operations.BundleIdsGetInstance.Output.TooManyRequests.Body
1243 let chosenContentType = try converter.bestContentType(
1244 received: contentType,
1245 options: [
1246 "application/json"
1247 ]
1248 )
1249 switch chosenContentType {
1250 case "application/json":
1251 body = try await converter.getResponseBodyAsJSON(
1252 Components.Schemas.ErrorResponse.self,
1253 from: responseBody,
1254 transforming: { value in
1255 .json(value)
1256 }
1257 )
1258 default:
1259 preconditionFailure("bestContentType chose an invalid content type.")
1260 }
1261 return .tooManyRequests(.init(body: body))
1262 default:
1263 return .undocumented(
1264 statusCode: response.status.code,
1265 .init(
1266 headerFields: response.headerFields,
1267 body: responseBody
1268 )
1269 )
1270 }
1271 }
1272 )
1273 }
1274 /// - Remark: HTTP `PATCH /v1/bundleIds/{id}`.
1275 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/patch(bundleIds_updateInstance)`.
1276 public func bundleIdsUpdateInstance(_ input: Operations.BundleIdsUpdateInstance.Input) async throws -> Operations.BundleIdsUpdateInstance.Output {
1277 try await client.send(
1278 input: input,
1279 forOperation: Operations.BundleIdsUpdateInstance.id,
1280 serializer: { input in
1281 let path = try converter.renderedPath(
1282 template: "/v1/bundleIds/{}",
1283 parameters: [
1284 input.path.id
1285 ]
1286 )
1287 var request: HTTPTypes.HTTPRequest = .init(
1288 soar_path: path,
1289 method: .patch
1290 )
1291 suppressMutabilityWarning(&request)
1292 converter.setAcceptHeader(
1293 in: &request.headerFields,
1294 contentTypes: input.headers.accept
1295 )
1296 let body: OpenAPIRuntime.HTTPBody?
1297 switch input.body {
1298 case let .json(value):
1299 body = try converter.setRequiredRequestBodyAsJSON(
1300 value,
1301 headerFields: &request.headerFields,
1302 contentType: "application/json; charset=utf-8"
1303 )
1304 }
1305 return (request, body)
1306 },
1307 deserializer: { response, responseBody in
1308 switch response.status.code {
1309 case 200:
1310 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1311 let body: Operations.BundleIdsUpdateInstance.Output.Ok.Body
1312 let chosenContentType = try converter.bestContentType(
1313 received: contentType,
1314 options: [
1315 "application/json"
1316 ]
1317 )
1318 switch chosenContentType {
1319 case "application/json":
1320 body = try await converter.getResponseBodyAsJSON(
1321 Components.Schemas.BundleIdResponse.self,
1322 from: responseBody,
1323 transforming: { value in
1324 .json(value)
1325 }
1326 )
1327 default:
1328 preconditionFailure("bestContentType chose an invalid content type.")
1329 }
1330 return .ok(.init(body: body))
1331 case 400:
1332 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1333 let body: Operations.BundleIdsUpdateInstance.Output.BadRequest.Body
1334 let chosenContentType = try converter.bestContentType(
1335 received: contentType,
1336 options: [
1337 "application/json"
1338 ]
1339 )
1340 switch chosenContentType {
1341 case "application/json":
1342 body = try await converter.getResponseBodyAsJSON(
1343 Components.Schemas.ErrorResponse.self,
1344 from: responseBody,
1345 transforming: { value in
1346 .json(value)
1347 }
1348 )
1349 default:
1350 preconditionFailure("bestContentType chose an invalid content type.")
1351 }
1352 return .badRequest(.init(body: body))
1353 case 401:
1354 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1355 let body: Operations.BundleIdsUpdateInstance.Output.Unauthorized.Body
1356 let chosenContentType = try converter.bestContentType(
1357 received: contentType,
1358 options: [
1359 "application/json"
1360 ]
1361 )
1362 switch chosenContentType {
1363 case "application/json":
1364 body = try await converter.getResponseBodyAsJSON(
1365 Components.Schemas.ErrorResponse.self,
1366 from: responseBody,
1367 transforming: { value in
1368 .json(value)
1369 }
1370 )
1371 default:
1372 preconditionFailure("bestContentType chose an invalid content type.")
1373 }
1374 return .unauthorized(.init(body: body))
1375 case 403:
1376 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1377 let body: Operations.BundleIdsUpdateInstance.Output.Forbidden.Body
1378 let chosenContentType = try converter.bestContentType(
1379 received: contentType,
1380 options: [
1381 "application/json"
1382 ]
1383 )
1384 switch chosenContentType {
1385 case "application/json":
1386 body = try await converter.getResponseBodyAsJSON(
1387 Components.Schemas.ErrorResponse.self,
1388 from: responseBody,
1389 transforming: { value in
1390 .json(value)
1391 }
1392 )
1393 default:
1394 preconditionFailure("bestContentType chose an invalid content type.")
1395 }
1396 return .forbidden(.init(body: body))
1397 case 404:
1398 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1399 let body: Operations.BundleIdsUpdateInstance.Output.NotFound.Body
1400 let chosenContentType = try converter.bestContentType(
1401 received: contentType,
1402 options: [
1403 "application/json"
1404 ]
1405 )
1406 switch chosenContentType {
1407 case "application/json":
1408 body = try await converter.getResponseBodyAsJSON(
1409 Components.Schemas.ErrorResponse.self,
1410 from: responseBody,
1411 transforming: { value in
1412 .json(value)
1413 }
1414 )
1415 default:
1416 preconditionFailure("bestContentType chose an invalid content type.")
1417 }
1418 return .notFound(.init(body: body))
1419 case 409:
1420 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1421 let body: Operations.BundleIdsUpdateInstance.Output.Conflict.Body
1422 let chosenContentType = try converter.bestContentType(
1423 received: contentType,
1424 options: [
1425 "application/json"
1426 ]
1427 )
1428 switch chosenContentType {
1429 case "application/json":
1430 body = try await converter.getResponseBodyAsJSON(
1431 Components.Schemas.ErrorResponse.self,
1432 from: responseBody,
1433 transforming: { value in
1434 .json(value)
1435 }
1436 )
1437 default:
1438 preconditionFailure("bestContentType chose an invalid content type.")
1439 }
1440 return .conflict(.init(body: body))
1441 case 422:
1442 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1443 let body: Operations.BundleIdsUpdateInstance.Output.UnprocessableContent.Body
1444 let chosenContentType = try converter.bestContentType(
1445 received: contentType,
1446 options: [
1447 "application/json"
1448 ]
1449 )
1450 switch chosenContentType {
1451 case "application/json":
1452 body = try await converter.getResponseBodyAsJSON(
1453 Components.Schemas.ErrorResponse.self,
1454 from: responseBody,
1455 transforming: { value in
1456 .json(value)
1457 }
1458 )
1459 default:
1460 preconditionFailure("bestContentType chose an invalid content type.")
1461 }
1462 return .unprocessableContent(.init(body: body))
1463 case 429:
1464 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1465 let body: Operations.BundleIdsUpdateInstance.Output.TooManyRequests.Body
1466 let chosenContentType = try converter.bestContentType(
1467 received: contentType,
1468 options: [
1469 "application/json"
1470 ]
1471 )
1472 switch chosenContentType {
1473 case "application/json":
1474 body = try await converter.getResponseBodyAsJSON(
1475 Components.Schemas.ErrorResponse.self,
1476 from: responseBody,
1477 transforming: { value in
1478 .json(value)
1479 }
1480 )
1481 default:
1482 preconditionFailure("bestContentType chose an invalid content type.")
1483 }
1484 return .tooManyRequests(.init(body: body))
1485 default:
1486 return .undocumented(
1487 statusCode: response.status.code,
1488 .init(
1489 headerFields: response.headerFields,
1490 body: responseBody
1491 )
1492 )
1493 }
1494 }
1495 )
1496 }
1497 /// - Remark: HTTP `DELETE /v1/bundleIds/{id}`.
1498 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/delete(bundleIds_deleteInstance)`.
1499 public func bundleIdsDeleteInstance(_ input: Operations.BundleIdsDeleteInstance.Input) async throws -> Operations.BundleIdsDeleteInstance.Output {
1500 try await client.send(
1501 input: input,
1502 forOperation: Operations.BundleIdsDeleteInstance.id,
1503 serializer: { input in
1504 let path = try converter.renderedPath(
1505 template: "/v1/bundleIds/{}",
1506 parameters: [
1507 input.path.id
1508 ]
1509 )
1510 var request: HTTPTypes.HTTPRequest = .init(
1511 soar_path: path,
1512 method: .delete
1513 )
1514 suppressMutabilityWarning(&request)
1515 converter.setAcceptHeader(
1516 in: &request.headerFields,
1517 contentTypes: input.headers.accept
1518 )
1519 return (request, nil)
1520 },
1521 deserializer: { response, responseBody in
1522 switch response.status.code {
1523 case 204:
1524 return .noContent(.init())
1525 case 400:
1526 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1527 let body: Operations.BundleIdsDeleteInstance.Output.BadRequest.Body
1528 let chosenContentType = try converter.bestContentType(
1529 received: contentType,
1530 options: [
1531 "application/json"
1532 ]
1533 )
1534 switch chosenContentType {
1535 case "application/json":
1536 body = try await converter.getResponseBodyAsJSON(
1537 Components.Schemas.ErrorResponse.self,
1538 from: responseBody,
1539 transforming: { value in
1540 .json(value)
1541 }
1542 )
1543 default:
1544 preconditionFailure("bestContentType chose an invalid content type.")
1545 }
1546 return .badRequest(.init(body: body))
1547 case 401:
1548 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1549 let body: Operations.BundleIdsDeleteInstance.Output.Unauthorized.Body
1550 let chosenContentType = try converter.bestContentType(
1551 received: contentType,
1552 options: [
1553 "application/json"
1554 ]
1555 )
1556 switch chosenContentType {
1557 case "application/json":
1558 body = try await converter.getResponseBodyAsJSON(
1559 Components.Schemas.ErrorResponse.self,
1560 from: responseBody,
1561 transforming: { value in
1562 .json(value)
1563 }
1564 )
1565 default:
1566 preconditionFailure("bestContentType chose an invalid content type.")
1567 }
1568 return .unauthorized(.init(body: body))
1569 case 403:
1570 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1571 let body: Operations.BundleIdsDeleteInstance.Output.Forbidden.Body
1572 let chosenContentType = try converter.bestContentType(
1573 received: contentType,
1574 options: [
1575 "application/json"
1576 ]
1577 )
1578 switch chosenContentType {
1579 case "application/json":
1580 body = try await converter.getResponseBodyAsJSON(
1581 Components.Schemas.ErrorResponse.self,
1582 from: responseBody,
1583 transforming: { value in
1584 .json(value)
1585 }
1586 )
1587 default:
1588 preconditionFailure("bestContentType chose an invalid content type.")
1589 }
1590 return .forbidden(.init(body: body))
1591 case 404:
1592 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1593 let body: Operations.BundleIdsDeleteInstance.Output.NotFound.Body
1594 let chosenContentType = try converter.bestContentType(
1595 received: contentType,
1596 options: [
1597 "application/json"
1598 ]
1599 )
1600 switch chosenContentType {
1601 case "application/json":
1602 body = try await converter.getResponseBodyAsJSON(
1603 Components.Schemas.ErrorResponse.self,
1604 from: responseBody,
1605 transforming: { value in
1606 .json(value)
1607 }
1608 )
1609 default:
1610 preconditionFailure("bestContentType chose an invalid content type.")
1611 }
1612 return .notFound(.init(body: body))
1613 case 429:
1614 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1615 let body: Operations.BundleIdsDeleteInstance.Output.TooManyRequests.Body
1616 let chosenContentType = try converter.bestContentType(
1617 received: contentType,
1618 options: [
1619 "application/json"
1620 ]
1621 )
1622 switch chosenContentType {
1623 case "application/json":
1624 body = try await converter.getResponseBodyAsJSON(
1625 Components.Schemas.ErrorResponse.self,
1626 from: responseBody,
1627 transforming: { value in
1628 .json(value)
1629 }
1630 )
1631 default:
1632 preconditionFailure("bestContentType chose an invalid content type.")
1633 }
1634 return .tooManyRequests(.init(body: body))
1635 default:
1636 return .undocumented(
1637 statusCode: response.status.code,
1638 .init(
1639 headerFields: response.headerFields,
1640 body: responseBody
1641 )
1642 )
1643 }
1644 }
1645 )
1646 }
1647 /// - Remark: HTTP `GET /v1/certificates`.
1648 /// - Remark: Generated from `#/paths//v1/certificates/get(certificates_getCollection)`.
1649 public func certificatesGetCollection(_ input: Operations.CertificatesGetCollection.Input) async throws -> Operations.CertificatesGetCollection.Output {
1650 try await client.send(
1651 input: input,
1652 forOperation: Operations.CertificatesGetCollection.id,
1653 serializer: { input in
1654 let path = try converter.renderedPath(
1655 template: "/v1/certificates",
1656 parameters: []
1657 )
1658 var request: HTTPTypes.HTTPRequest = .init(
1659 soar_path: path,
1660 method: .get
1661 )
1662 suppressMutabilityWarning(&request)
1663 try converter.setQueryItemAsURI(
1664 in: &request,
1665 style: .form,
1666 explode: false,
1667 name: "filter[displayName]",
1668 value: input.query.filter_lbrack_displayName_rbrack_
1669 )
1670 try converter.setQueryItemAsURI(
1671 in: &request,
1672 style: .form,
1673 explode: false,
1674 name: "filter[certificateType]",
1675 value: input.query.filter_lbrack_certificateType_rbrack_
1676 )
1677 try converter.setQueryItemAsURI(
1678 in: &request,
1679 style: .form,
1680 explode: false,
1681 name: "filter[serialNumber]",
1682 value: input.query.filter_lbrack_serialNumber_rbrack_
1683 )
1684 try converter.setQueryItemAsURI(
1685 in: &request,
1686 style: .form,
1687 explode: false,
1688 name: "filter[id]",
1689 value: input.query.filter_lbrack_id_rbrack_
1690 )
1691 try converter.setQueryItemAsURI(
1692 in: &request,
1693 style: .form,
1694 explode: false,
1695 name: "sort",
1696 value: input.query.sort
1697 )
1698 try converter.setQueryItemAsURI(
1699 in: &request,
1700 style: .form,
1701 explode: false,
1702 name: "fields[certificates]",
1703 value: input.query.fields_lbrack_certificates_rbrack_
1704 )
1705 try converter.setQueryItemAsURI(
1706 in: &request,
1707 style: .form,
1708 explode: false,
1709 name: "fields[passTypeIds]",
1710 value: input.query.fields_lbrack_passTypeIds_rbrack_
1711 )
1712 try converter.setQueryItemAsURI(
1713 in: &request,
1714 style: .form,
1715 explode: true,
1716 name: "limit",
1717 value: input.query.limit
1718 )
1719 try converter.setQueryItemAsURI(
1720 in: &request,
1721 style: .form,
1722 explode: false,
1723 name: "include",
1724 value: input.query.include
1725 )
1726 converter.setAcceptHeader(
1727 in: &request.headerFields,
1728 contentTypes: input.headers.accept
1729 )
1730 return (request, nil)
1731 },
1732 deserializer: { response, responseBody in
1733 switch response.status.code {
1734 case 200:
1735 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1736 let body: Operations.CertificatesGetCollection.Output.Ok.Body
1737 let chosenContentType = try converter.bestContentType(
1738 received: contentType,
1739 options: [
1740 "application/json"
1741 ]
1742 )
1743 switch chosenContentType {
1744 case "application/json":
1745 body = try await converter.getResponseBodyAsJSON(
1746 Components.Schemas.CertificatesResponse.self,
1747 from: responseBody,
1748 transforming: { value in
1749 .json(value)
1750 }
1751 )
1752 default:
1753 preconditionFailure("bestContentType chose an invalid content type.")
1754 }
1755 return .ok(.init(body: body))
1756 case 400:
1757 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1758 let body: Operations.CertificatesGetCollection.Output.BadRequest.Body
1759 let chosenContentType = try converter.bestContentType(
1760 received: contentType,
1761 options: [
1762 "application/json"
1763 ]
1764 )
1765 switch chosenContentType {
1766 case "application/json":
1767 body = try await converter.getResponseBodyAsJSON(
1768 Components.Schemas.ErrorResponse.self,
1769 from: responseBody,
1770 transforming: { value in
1771 .json(value)
1772 }
1773 )
1774 default:
1775 preconditionFailure("bestContentType chose an invalid content type.")
1776 }
1777 return .badRequest(.init(body: body))
1778 case 401:
1779 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1780 let body: Operations.CertificatesGetCollection.Output.Unauthorized.Body
1781 let chosenContentType = try converter.bestContentType(
1782 received: contentType,
1783 options: [
1784 "application/json"
1785 ]
1786 )
1787 switch chosenContentType {
1788 case "application/json":
1789 body = try await converter.getResponseBodyAsJSON(
1790 Components.Schemas.ErrorResponse.self,
1791 from: responseBody,
1792 transforming: { value in
1793 .json(value)
1794 }
1795 )
1796 default:
1797 preconditionFailure("bestContentType chose an invalid content type.")
1798 }
1799 return .unauthorized(.init(body: body))
1800 case 403:
1801 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1802 let body: Operations.CertificatesGetCollection.Output.Forbidden.Body
1803 let chosenContentType = try converter.bestContentType(
1804 received: contentType,
1805 options: [
1806 "application/json"
1807 ]
1808 )
1809 switch chosenContentType {
1810 case "application/json":
1811 body = try await converter.getResponseBodyAsJSON(
1812 Components.Schemas.ErrorResponse.self,
1813 from: responseBody,
1814 transforming: { value in
1815 .json(value)
1816 }
1817 )
1818 default:
1819 preconditionFailure("bestContentType chose an invalid content type.")
1820 }
1821 return .forbidden(.init(body: body))
1822 case 429:
1823 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1824 let body: Operations.CertificatesGetCollection.Output.TooManyRequests.Body
1825 let chosenContentType = try converter.bestContentType(
1826 received: contentType,
1827 options: [
1828 "application/json"
1829 ]
1830 )
1831 switch chosenContentType {
1832 case "application/json":
1833 body = try await converter.getResponseBodyAsJSON(
1834 Components.Schemas.ErrorResponse.self,
1835 from: responseBody,
1836 transforming: { value in
1837 .json(value)
1838 }
1839 )
1840 default:
1841 preconditionFailure("bestContentType chose an invalid content type.")
1842 }
1843 return .tooManyRequests(.init(body: body))
1844 default:
1845 return .undocumented(
1846 statusCode: response.status.code,
1847 .init(
1848 headerFields: response.headerFields,
1849 body: responseBody
1850 )
1851 )
1852 }
1853 }
1854 )
1855 }
1856 /// - Remark: HTTP `POST /v1/certificates`.
1857 /// - Remark: Generated from `#/paths//v1/certificates/post(certificates_createInstance)`.
1858 public func certificatesCreateInstance(_ input: Operations.CertificatesCreateInstance.Input) async throws -> Operations.CertificatesCreateInstance.Output {
1859 try await client.send(
1860 input: input,
1861 forOperation: Operations.CertificatesCreateInstance.id,
1862 serializer: { input in
1863 let path = try converter.renderedPath(
1864 template: "/v1/certificates",
1865 parameters: []
1866 )
1867 var request: HTTPTypes.HTTPRequest = .init(
1868 soar_path: path,
1869 method: .post
1870 )
1871 suppressMutabilityWarning(&request)
1872 converter.setAcceptHeader(
1873 in: &request.headerFields,
1874 contentTypes: input.headers.accept
1875 )
1876 let body: OpenAPIRuntime.HTTPBody?
1877 switch input.body {
1878 case let .json(value):
1879 body = try converter.setRequiredRequestBodyAsJSON(
1880 value,
1881 headerFields: &request.headerFields,
1882 contentType: "application/json; charset=utf-8"
1883 )
1884 }
1885 return (request, body)
1886 },
1887 deserializer: { response, responseBody in
1888 switch response.status.code {
1889 case 201:
1890 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1891 let body: Operations.CertificatesCreateInstance.Output.Created.Body
1892 let chosenContentType = try converter.bestContentType(
1893 received: contentType,
1894 options: [
1895 "application/json"
1896 ]
1897 )
1898 switch chosenContentType {
1899 case "application/json":
1900 body = try await converter.getResponseBodyAsJSON(
1901 Components.Schemas.CertificateResponse.self,
1902 from: responseBody,
1903 transforming: { value in
1904 .json(value)
1905 }
1906 )
1907 default:
1908 preconditionFailure("bestContentType chose an invalid content type.")
1909 }
1910 return .created(.init(body: body))
1911 case 400:
1912 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1913 let body: Operations.CertificatesCreateInstance.Output.BadRequest.Body
1914 let chosenContentType = try converter.bestContentType(
1915 received: contentType,
1916 options: [
1917 "application/json"
1918 ]
1919 )
1920 switch chosenContentType {
1921 case "application/json":
1922 body = try await converter.getResponseBodyAsJSON(
1923 Components.Schemas.ErrorResponse.self,
1924 from: responseBody,
1925 transforming: { value in
1926 .json(value)
1927 }
1928 )
1929 default:
1930 preconditionFailure("bestContentType chose an invalid content type.")
1931 }
1932 return .badRequest(.init(body: body))
1933 case 401:
1934 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1935 let body: Operations.CertificatesCreateInstance.Output.Unauthorized.Body
1936 let chosenContentType = try converter.bestContentType(
1937 received: contentType,
1938 options: [
1939 "application/json"
1940 ]
1941 )
1942 switch chosenContentType {
1943 case "application/json":
1944 body = try await converter.getResponseBodyAsJSON(
1945 Components.Schemas.ErrorResponse.self,
1946 from: responseBody,
1947 transforming: { value in
1948 .json(value)
1949 }
1950 )
1951 default:
1952 preconditionFailure("bestContentType chose an invalid content type.")
1953 }
1954 return .unauthorized(.init(body: body))
1955 case 403:
1956 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1957 let body: Operations.CertificatesCreateInstance.Output.Forbidden.Body
1958 let chosenContentType = try converter.bestContentType(
1959 received: contentType,
1960 options: [
1961 "application/json"
1962 ]
1963 )
1964 switch chosenContentType {
1965 case "application/json":
1966 body = try await converter.getResponseBodyAsJSON(
1967 Components.Schemas.ErrorResponse.self,
1968 from: responseBody,
1969 transforming: { value in
1970 .json(value)
1971 }
1972 )
1973 default:
1974 preconditionFailure("bestContentType chose an invalid content type.")
1975 }
1976 return .forbidden(.init(body: body))
1977 case 409:
1978 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1979 let body: Operations.CertificatesCreateInstance.Output.Conflict.Body
1980 let chosenContentType = try converter.bestContentType(
1981 received: contentType,
1982 options: [
1983 "application/json"
1984 ]
1985 )
1986 switch chosenContentType {
1987 case "application/json":
1988 body = try await converter.getResponseBodyAsJSON(
1989 Components.Schemas.ErrorResponse.self,
1990 from: responseBody,
1991 transforming: { value in
1992 .json(value)
1993 }
1994 )
1995 default:
1996 preconditionFailure("bestContentType chose an invalid content type.")
1997 }
1998 return .conflict(.init(body: body))
1999 case 422:
2000 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2001 let body: Operations.CertificatesCreateInstance.Output.UnprocessableContent.Body
2002 let chosenContentType = try converter.bestContentType(
2003 received: contentType,
2004 options: [
2005 "application/json"
2006 ]
2007 )
2008 switch chosenContentType {
2009 case "application/json":
2010 body = try await converter.getResponseBodyAsJSON(
2011 Components.Schemas.ErrorResponse.self,
2012 from: responseBody,
2013 transforming: { value in
2014 .json(value)
2015 }
2016 )
2017 default:
2018 preconditionFailure("bestContentType chose an invalid content type.")
2019 }
2020 return .unprocessableContent(.init(body: body))
2021 case 429:
2022 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2023 let body: Operations.CertificatesCreateInstance.Output.TooManyRequests.Body
2024 let chosenContentType = try converter.bestContentType(
2025 received: contentType,
2026 options: [
2027 "application/json"
2028 ]
2029 )
2030 switch chosenContentType {
2031 case "application/json":
2032 body = try await converter.getResponseBodyAsJSON(
2033 Components.Schemas.ErrorResponse.self,
2034 from: responseBody,
2035 transforming: { value in
2036 .json(value)
2037 }
2038 )
2039 default:
2040 preconditionFailure("bestContentType chose an invalid content type.")
2041 }
2042 return .tooManyRequests(.init(body: body))
2043 default:
2044 return .undocumented(
2045 statusCode: response.status.code,
2046 .init(
2047 headerFields: response.headerFields,
2048 body: responseBody
2049 )
2050 )
2051 }
2052 }
2053 )
2054 }
2055 /// - Remark: HTTP `GET /v1/certificates/{id}`.
2056 /// - Remark: Generated from `#/paths//v1/certificates/{id}/get(certificates_getInstance)`.
2057 public func certificatesGetInstance(_ input: Operations.CertificatesGetInstance.Input) async throws -> Operations.CertificatesGetInstance.Output {
2058 try await client.send(
2059 input: input,
2060 forOperation: Operations.CertificatesGetInstance.id,
2061 serializer: { input in
2062 let path = try converter.renderedPath(
2063 template: "/v1/certificates/{}",
2064 parameters: [
2065 input.path.id
2066 ]
2067 )
2068 var request: HTTPTypes.HTTPRequest = .init(
2069 soar_path: path,
2070 method: .get
2071 )
2072 suppressMutabilityWarning(&request)
2073 try converter.setQueryItemAsURI(
2074 in: &request,
2075 style: .form,
2076 explode: false,
2077 name: "fields[certificates]",
2078 value: input.query.fields_lbrack_certificates_rbrack_
2079 )
2080 try converter.setQueryItemAsURI(
2081 in: &request,
2082 style: .form,
2083 explode: false,
2084 name: "fields[passTypeIds]",
2085 value: input.query.fields_lbrack_passTypeIds_rbrack_
2086 )
2087 try converter.setQueryItemAsURI(
2088 in: &request,
2089 style: .form,
2090 explode: false,
2091 name: "include",
2092 value: input.query.include
2093 )
2094 converter.setAcceptHeader(
2095 in: &request.headerFields,
2096 contentTypes: input.headers.accept
2097 )
2098 return (request, nil)
2099 },
2100 deserializer: { response, responseBody in
2101 switch response.status.code {
2102 case 200:
2103 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2104 let body: Operations.CertificatesGetInstance.Output.Ok.Body
2105 let chosenContentType = try converter.bestContentType(
2106 received: contentType,
2107 options: [
2108 "application/json"
2109 ]
2110 )
2111 switch chosenContentType {
2112 case "application/json":
2113 body = try await converter.getResponseBodyAsJSON(
2114 Components.Schemas.CertificateResponse.self,
2115 from: responseBody,
2116 transforming: { value in
2117 .json(value)
2118 }
2119 )
2120 default:
2121 preconditionFailure("bestContentType chose an invalid content type.")
2122 }
2123 return .ok(.init(body: body))
2124 case 400:
2125 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2126 let body: Operations.CertificatesGetInstance.Output.BadRequest.Body
2127 let chosenContentType = try converter.bestContentType(
2128 received: contentType,
2129 options: [
2130 "application/json"
2131 ]
2132 )
2133 switch chosenContentType {
2134 case "application/json":
2135 body = try await converter.getResponseBodyAsJSON(
2136 Components.Schemas.ErrorResponse.self,
2137 from: responseBody,
2138 transforming: { value in
2139 .json(value)
2140 }
2141 )
2142 default:
2143 preconditionFailure("bestContentType chose an invalid content type.")
2144 }
2145 return .badRequest(.init(body: body))
2146 case 401:
2147 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2148 let body: Operations.CertificatesGetInstance.Output.Unauthorized.Body
2149 let chosenContentType = try converter.bestContentType(
2150 received: contentType,
2151 options: [
2152 "application/json"
2153 ]
2154 )
2155 switch chosenContentType {
2156 case "application/json":
2157 body = try await converter.getResponseBodyAsJSON(
2158 Components.Schemas.ErrorResponse.self,
2159 from: responseBody,
2160 transforming: { value in
2161 .json(value)
2162 }
2163 )
2164 default:
2165 preconditionFailure("bestContentType chose an invalid content type.")
2166 }
2167 return .unauthorized(.init(body: body))
2168 case 403:
2169 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2170 let body: Operations.CertificatesGetInstance.Output.Forbidden.Body
2171 let chosenContentType = try converter.bestContentType(
2172 received: contentType,
2173 options: [
2174 "application/json"
2175 ]
2176 )
2177 switch chosenContentType {
2178 case "application/json":
2179 body = try await converter.getResponseBodyAsJSON(
2180 Components.Schemas.ErrorResponse.self,
2181 from: responseBody,
2182 transforming: { value in
2183 .json(value)
2184 }
2185 )
2186 default:
2187 preconditionFailure("bestContentType chose an invalid content type.")
2188 }
2189 return .forbidden(.init(body: body))
2190 case 404:
2191 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2192 let body: Operations.CertificatesGetInstance.Output.NotFound.Body
2193 let chosenContentType = try converter.bestContentType(
2194 received: contentType,
2195 options: [
2196 "application/json"
2197 ]
2198 )
2199 switch chosenContentType {
2200 case "application/json":
2201 body = try await converter.getResponseBodyAsJSON(
2202 Components.Schemas.ErrorResponse.self,
2203 from: responseBody,
2204 transforming: { value in
2205 .json(value)
2206 }
2207 )
2208 default:
2209 preconditionFailure("bestContentType chose an invalid content type.")
2210 }
2211 return .notFound(.init(body: body))
2212 case 429:
2213 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2214 let body: Operations.CertificatesGetInstance.Output.TooManyRequests.Body
2215 let chosenContentType = try converter.bestContentType(
2216 received: contentType,
2217 options: [
2218 "application/json"
2219 ]
2220 )
2221 switch chosenContentType {
2222 case "application/json":
2223 body = try await converter.getResponseBodyAsJSON(
2224 Components.Schemas.ErrorResponse.self,
2225 from: responseBody,
2226 transforming: { value in
2227 .json(value)
2228 }
2229 )
2230 default:
2231 preconditionFailure("bestContentType chose an invalid content type.")
2232 }
2233 return .tooManyRequests(.init(body: body))
2234 default:
2235 return .undocumented(
2236 statusCode: response.status.code,
2237 .init(
2238 headerFields: response.headerFields,
2239 body: responseBody
2240 )
2241 )
2242 }
2243 }
2244 )
2245 }
2246 /// - Remark: HTTP `PATCH /v1/certificates/{id}`.
2247 /// - Remark: Generated from `#/paths//v1/certificates/{id}/patch(certificates_updateInstance)`.
2248 public func certificatesUpdateInstance(_ input: Operations.CertificatesUpdateInstance.Input) async throws -> Operations.CertificatesUpdateInstance.Output {
2249 try await client.send(
2250 input: input,
2251 forOperation: Operations.CertificatesUpdateInstance.id,
2252 serializer: { input in
2253 let path = try converter.renderedPath(
2254 template: "/v1/certificates/{}",
2255 parameters: [
2256 input.path.id
2257 ]
2258 )
2259 var request: HTTPTypes.HTTPRequest = .init(
2260 soar_path: path,
2261 method: .patch
2262 )
2263 suppressMutabilityWarning(&request)
2264 converter.setAcceptHeader(
2265 in: &request.headerFields,
2266 contentTypes: input.headers.accept
2267 )
2268 let body: OpenAPIRuntime.HTTPBody?
2269 switch input.body {
2270 case let .json(value):
2271 body = try converter.setRequiredRequestBodyAsJSON(
2272 value,
2273 headerFields: &request.headerFields,
2274 contentType: "application/json; charset=utf-8"
2275 )
2276 }
2277 return (request, body)
2278 },
2279 deserializer: { response, responseBody in
2280 switch response.status.code {
2281 case 200:
2282 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2283 let body: Operations.CertificatesUpdateInstance.Output.Ok.Body
2284 let chosenContentType = try converter.bestContentType(
2285 received: contentType,
2286 options: [
2287 "application/json"
2288 ]
2289 )
2290 switch chosenContentType {
2291 case "application/json":
2292 body = try await converter.getResponseBodyAsJSON(
2293 Components.Schemas.CertificateResponse.self,
2294 from: responseBody,
2295 transforming: { value in
2296 .json(value)
2297 }
2298 )
2299 default:
2300 preconditionFailure("bestContentType chose an invalid content type.")
2301 }
2302 return .ok(.init(body: body))
2303 case 400:
2304 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2305 let body: Operations.CertificatesUpdateInstance.Output.BadRequest.Body
2306 let chosenContentType = try converter.bestContentType(
2307 received: contentType,
2308 options: [
2309 "application/json"
2310 ]
2311 )
2312 switch chosenContentType {
2313 case "application/json":
2314 body = try await converter.getResponseBodyAsJSON(
2315 Components.Schemas.ErrorResponse.self,
2316 from: responseBody,
2317 transforming: { value in
2318 .json(value)
2319 }
2320 )
2321 default:
2322 preconditionFailure("bestContentType chose an invalid content type.")
2323 }
2324 return .badRequest(.init(body: body))
2325 case 401:
2326 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2327 let body: Operations.CertificatesUpdateInstance.Output.Unauthorized.Body
2328 let chosenContentType = try converter.bestContentType(
2329 received: contentType,
2330 options: [
2331 "application/json"
2332 ]
2333 )
2334 switch chosenContentType {
2335 case "application/json":
2336 body = try await converter.getResponseBodyAsJSON(
2337 Components.Schemas.ErrorResponse.self,
2338 from: responseBody,
2339 transforming: { value in
2340 .json(value)
2341 }
2342 )
2343 default:
2344 preconditionFailure("bestContentType chose an invalid content type.")
2345 }
2346 return .unauthorized(.init(body: body))
2347 case 403:
2348 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2349 let body: Operations.CertificatesUpdateInstance.Output.Forbidden.Body
2350 let chosenContentType = try converter.bestContentType(
2351 received: contentType,
2352 options: [
2353 "application/json"
2354 ]
2355 )
2356 switch chosenContentType {
2357 case "application/json":
2358 body = try await converter.getResponseBodyAsJSON(
2359 Components.Schemas.ErrorResponse.self,
2360 from: responseBody,
2361 transforming: { value in
2362 .json(value)
2363 }
2364 )
2365 default:
2366 preconditionFailure("bestContentType chose an invalid content type.")
2367 }
2368 return .forbidden(.init(body: body))
2369 case 404:
2370 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2371 let body: Operations.CertificatesUpdateInstance.Output.NotFound.Body
2372 let chosenContentType = try converter.bestContentType(
2373 received: contentType,
2374 options: [
2375 "application/json"
2376 ]
2377 )
2378 switch chosenContentType {
2379 case "application/json":
2380 body = try await converter.getResponseBodyAsJSON(
2381 Components.Schemas.ErrorResponse.self,
2382 from: responseBody,
2383 transforming: { value in
2384 .json(value)
2385 }
2386 )
2387 default:
2388 preconditionFailure("bestContentType chose an invalid content type.")
2389 }
2390 return .notFound(.init(body: body))
2391 case 409:
2392 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2393 let body: Operations.CertificatesUpdateInstance.Output.Conflict.Body
2394 let chosenContentType = try converter.bestContentType(
2395 received: contentType,
2396 options: [
2397 "application/json"
2398 ]
2399 )
2400 switch chosenContentType {
2401 case "application/json":
2402 body = try await converter.getResponseBodyAsJSON(
2403 Components.Schemas.ErrorResponse.self,
2404 from: responseBody,
2405 transforming: { value in
2406 .json(value)
2407 }
2408 )
2409 default:
2410 preconditionFailure("bestContentType chose an invalid content type.")
2411 }
2412 return .conflict(.init(body: body))
2413 case 422:
2414 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2415 let body: Operations.CertificatesUpdateInstance.Output.UnprocessableContent.Body
2416 let chosenContentType = try converter.bestContentType(
2417 received: contentType,
2418 options: [
2419 "application/json"
2420 ]
2421 )
2422 switch chosenContentType {
2423 case "application/json":
2424 body = try await converter.getResponseBodyAsJSON(
2425 Components.Schemas.ErrorResponse.self,
2426 from: responseBody,
2427 transforming: { value in
2428 .json(value)
2429 }
2430 )
2431 default:
2432 preconditionFailure("bestContentType chose an invalid content type.")
2433 }
2434 return .unprocessableContent(.init(body: body))
2435 case 429:
2436 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2437 let body: Operations.CertificatesUpdateInstance.Output.TooManyRequests.Body
2438 let chosenContentType = try converter.bestContentType(
2439 received: contentType,
2440 options: [
2441 "application/json"
2442 ]
2443 )
2444 switch chosenContentType {
2445 case "application/json":
2446 body = try await converter.getResponseBodyAsJSON(
2447 Components.Schemas.ErrorResponse.self,
2448 from: responseBody,
2449 transforming: { value in
2450 .json(value)
2451 }
2452 )
2453 default:
2454 preconditionFailure("bestContentType chose an invalid content type.")
2455 }
2456 return .tooManyRequests(.init(body: body))
2457 default:
2458 return .undocumented(
2459 statusCode: response.status.code,
2460 .init(
2461 headerFields: response.headerFields,
2462 body: responseBody
2463 )
2464 )
2465 }
2466 }
2467 )
2468 }
2469 /// - Remark: HTTP `DELETE /v1/certificates/{id}`.
2470 /// - Remark: Generated from `#/paths//v1/certificates/{id}/delete(certificates_deleteInstance)`.
2471 public func certificatesDeleteInstance(_ input: Operations.CertificatesDeleteInstance.Input) async throws -> Operations.CertificatesDeleteInstance.Output {
2472 try await client.send(
2473 input: input,
2474 forOperation: Operations.CertificatesDeleteInstance.id,
2475 serializer: { input in
2476 let path = try converter.renderedPath(
2477 template: "/v1/certificates/{}",
2478 parameters: [
2479 input.path.id
2480 ]
2481 )
2482 var request: HTTPTypes.HTTPRequest = .init(
2483 soar_path: path,
2484 method: .delete
2485 )
2486 suppressMutabilityWarning(&request)
2487 converter.setAcceptHeader(
2488 in: &request.headerFields,
2489 contentTypes: input.headers.accept
2490 )
2491 return (request, nil)
2492 },
2493 deserializer: { response, responseBody in
2494 switch response.status.code {
2495 case 204:
2496 return .noContent(.init())
2497 case 400:
2498 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2499 let body: Operations.CertificatesDeleteInstance.Output.BadRequest.Body
2500 let chosenContentType = try converter.bestContentType(
2501 received: contentType,
2502 options: [
2503 "application/json"
2504 ]
2505 )
2506 switch chosenContentType {
2507 case "application/json":
2508 body = try await converter.getResponseBodyAsJSON(
2509 Components.Schemas.ErrorResponse.self,
2510 from: responseBody,
2511 transforming: { value in
2512 .json(value)
2513 }
2514 )
2515 default:
2516 preconditionFailure("bestContentType chose an invalid content type.")
2517 }
2518 return .badRequest(.init(body: body))
2519 case 401:
2520 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2521 let body: Operations.CertificatesDeleteInstance.Output.Unauthorized.Body
2522 let chosenContentType = try converter.bestContentType(
2523 received: contentType,
2524 options: [
2525 "application/json"
2526 ]
2527 )
2528 switch chosenContentType {
2529 case "application/json":
2530 body = try await converter.getResponseBodyAsJSON(
2531 Components.Schemas.ErrorResponse.self,
2532 from: responseBody,
2533 transforming: { value in
2534 .json(value)
2535 }
2536 )
2537 default:
2538 preconditionFailure("bestContentType chose an invalid content type.")
2539 }
2540 return .unauthorized(.init(body: body))
2541 case 403:
2542 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2543 let body: Operations.CertificatesDeleteInstance.Output.Forbidden.Body
2544 let chosenContentType = try converter.bestContentType(
2545 received: contentType,
2546 options: [
2547 "application/json"
2548 ]
2549 )
2550 switch chosenContentType {
2551 case "application/json":
2552 body = try await converter.getResponseBodyAsJSON(
2553 Components.Schemas.ErrorResponse.self,
2554 from: responseBody,
2555 transforming: { value in
2556 .json(value)
2557 }
2558 )
2559 default:
2560 preconditionFailure("bestContentType chose an invalid content type.")
2561 }
2562 return .forbidden(.init(body: body))
2563 case 404:
2564 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2565 let body: Operations.CertificatesDeleteInstance.Output.NotFound.Body
2566 let chosenContentType = try converter.bestContentType(
2567 received: contentType,
2568 options: [
2569 "application/json"
2570 ]
2571 )
2572 switch chosenContentType {
2573 case "application/json":
2574 body = try await converter.getResponseBodyAsJSON(
2575 Components.Schemas.ErrorResponse.self,
2576 from: responseBody,
2577 transforming: { value in
2578 .json(value)
2579 }
2580 )
2581 default:
2582 preconditionFailure("bestContentType chose an invalid content type.")
2583 }
2584 return .notFound(.init(body: body))
2585 case 429:
2586 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2587 let body: Operations.CertificatesDeleteInstance.Output.TooManyRequests.Body
2588 let chosenContentType = try converter.bestContentType(
2589 received: contentType,
2590 options: [
2591 "application/json"
2592 ]
2593 )
2594 switch chosenContentType {
2595 case "application/json":
2596 body = try await converter.getResponseBodyAsJSON(
2597 Components.Schemas.ErrorResponse.self,
2598 from: responseBody,
2599 transforming: { value in
2600 .json(value)
2601 }
2602 )
2603 default:
2604 preconditionFailure("bestContentType chose an invalid content type.")
2605 }
2606 return .tooManyRequests(.init(body: body))
2607 default:
2608 return .undocumented(
2609 statusCode: response.status.code,
2610 .init(
2611 headerFields: response.headerFields,
2612 body: responseBody
2613 )
2614 )
2615 }
2616 }
2617 )
2618 }
2619 /// - Remark: HTTP `GET /v1/devices`.
2620 /// - Remark: Generated from `#/paths//v1/devices/get(devices_getCollection)`.
2621 public func devicesGetCollection(_ input: Operations.DevicesGetCollection.Input) async throws -> Operations.DevicesGetCollection.Output {
2622 try await client.send(
2623 input: input,
2624 forOperation: Operations.DevicesGetCollection.id,
2625 serializer: { input in
2626 let path = try converter.renderedPath(
2627 template: "/v1/devices",
2628 parameters: []
2629 )
2630 var request: HTTPTypes.HTTPRequest = .init(
2631 soar_path: path,
2632 method: .get
2633 )
2634 suppressMutabilityWarning(&request)
2635 try converter.setQueryItemAsURI(
2636 in: &request,
2637 style: .form,
2638 explode: false,
2639 name: "filter[name]",
2640 value: input.query.filter_lbrack_name_rbrack_
2641 )
2642 try converter.setQueryItemAsURI(
2643 in: &request,
2644 style: .form,
2645 explode: false,
2646 name: "filter[platform]",
2647 value: input.query.filter_lbrack_platform_rbrack_
2648 )
2649 try converter.setQueryItemAsURI(
2650 in: &request,
2651 style: .form,
2652 explode: false,
2653 name: "filter[udid]",
2654 value: input.query.filter_lbrack_udid_rbrack_
2655 )
2656 try converter.setQueryItemAsURI(
2657 in: &request,
2658 style: .form,
2659 explode: false,
2660 name: "filter[status]",
2661 value: input.query.filter_lbrack_status_rbrack_
2662 )
2663 try converter.setQueryItemAsURI(
2664 in: &request,
2665 style: .form,
2666 explode: false,
2667 name: "filter[id]",
2668 value: input.query.filter_lbrack_id_rbrack_
2669 )
2670 try converter.setQueryItemAsURI(
2671 in: &request,
2672 style: .form,
2673 explode: false,
2674 name: "sort",
2675 value: input.query.sort
2676 )
2677 try converter.setQueryItemAsURI(
2678 in: &request,
2679 style: .form,
2680 explode: false,
2681 name: "fields[devices]",
2682 value: input.query.fields_lbrack_devices_rbrack_
2683 )
2684 try converter.setQueryItemAsURI(
2685 in: &request,
2686 style: .form,
2687 explode: true,
2688 name: "limit",
2689 value: input.query.limit
2690 )
2691 converter.setAcceptHeader(
2692 in: &request.headerFields,
2693 contentTypes: input.headers.accept
2694 )
2695 return (request, nil)
2696 },
2697 deserializer: { response, responseBody in
2698 switch response.status.code {
2699 case 200:
2700 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2701 let body: Operations.DevicesGetCollection.Output.Ok.Body
2702 let chosenContentType = try converter.bestContentType(
2703 received: contentType,
2704 options: [
2705 "application/json"
2706 ]
2707 )
2708 switch chosenContentType {
2709 case "application/json":
2710 body = try await converter.getResponseBodyAsJSON(
2711 Components.Schemas.DevicesResponse.self,
2712 from: responseBody,
2713 transforming: { value in
2714 .json(value)
2715 }
2716 )
2717 default:
2718 preconditionFailure("bestContentType chose an invalid content type.")
2719 }
2720 return .ok(.init(body: body))
2721 case 400:
2722 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2723 let body: Operations.DevicesGetCollection.Output.BadRequest.Body
2724 let chosenContentType = try converter.bestContentType(
2725 received: contentType,
2726 options: [
2727 "application/json"
2728 ]
2729 )
2730 switch chosenContentType {
2731 case "application/json":
2732 body = try await converter.getResponseBodyAsJSON(
2733 Components.Schemas.ErrorResponse.self,
2734 from: responseBody,
2735 transforming: { value in
2736 .json(value)
2737 }
2738 )
2739 default:
2740 preconditionFailure("bestContentType chose an invalid content type.")
2741 }
2742 return .badRequest(.init(body: body))
2743 case 401:
2744 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2745 let body: Operations.DevicesGetCollection.Output.Unauthorized.Body
2746 let chosenContentType = try converter.bestContentType(
2747 received: contentType,
2748 options: [
2749 "application/json"
2750 ]
2751 )
2752 switch chosenContentType {
2753 case "application/json":
2754 body = try await converter.getResponseBodyAsJSON(
2755 Components.Schemas.ErrorResponse.self,
2756 from: responseBody,
2757 transforming: { value in
2758 .json(value)
2759 }
2760 )
2761 default:
2762 preconditionFailure("bestContentType chose an invalid content type.")
2763 }
2764 return .unauthorized(.init(body: body))
2765 case 403:
2766 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2767 let body: Operations.DevicesGetCollection.Output.Forbidden.Body
2768 let chosenContentType = try converter.bestContentType(
2769 received: contentType,
2770 options: [
2771 "application/json"
2772 ]
2773 )
2774 switch chosenContentType {
2775 case "application/json":
2776 body = try await converter.getResponseBodyAsJSON(
2777 Components.Schemas.ErrorResponse.self,
2778 from: responseBody,
2779 transforming: { value in
2780 .json(value)
2781 }
2782 )
2783 default:
2784 preconditionFailure("bestContentType chose an invalid content type.")
2785 }
2786 return .forbidden(.init(body: body))
2787 case 429:
2788 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2789 let body: Operations.DevicesGetCollection.Output.TooManyRequests.Body
2790 let chosenContentType = try converter.bestContentType(
2791 received: contentType,
2792 options: [
2793 "application/json"
2794 ]
2795 )
2796 switch chosenContentType {
2797 case "application/json":
2798 body = try await converter.getResponseBodyAsJSON(
2799 Components.Schemas.ErrorResponse.self,
2800 from: responseBody,
2801 transforming: { value in
2802 .json(value)
2803 }
2804 )
2805 default:
2806 preconditionFailure("bestContentType chose an invalid content type.")
2807 }
2808 return .tooManyRequests(.init(body: body))
2809 default:
2810 return .undocumented(
2811 statusCode: response.status.code,
2812 .init(
2813 headerFields: response.headerFields,
2814 body: responseBody
2815 )
2816 )
2817 }
2818 }
2819 )
2820 }
2821 /// - Remark: HTTP `POST /v1/devices`.
2822 /// - Remark: Generated from `#/paths//v1/devices/post(devices_createInstance)`.
2823 public func devicesCreateInstance(_ input: Operations.DevicesCreateInstance.Input) async throws -> Operations.DevicesCreateInstance.Output {
2824 try await client.send(
2825 input: input,
2826 forOperation: Operations.DevicesCreateInstance.id,
2827 serializer: { input in
2828 let path = try converter.renderedPath(
2829 template: "/v1/devices",
2830 parameters: []
2831 )
2832 var request: HTTPTypes.HTTPRequest = .init(
2833 soar_path: path,
2834 method: .post
2835 )
2836 suppressMutabilityWarning(&request)
2837 converter.setAcceptHeader(
2838 in: &request.headerFields,
2839 contentTypes: input.headers.accept
2840 )
2841 let body: OpenAPIRuntime.HTTPBody?
2842 switch input.body {
2843 case let .json(value):
2844 body = try converter.setRequiredRequestBodyAsJSON(
2845 value,
2846 headerFields: &request.headerFields,
2847 contentType: "application/json; charset=utf-8"
2848 )
2849 }
2850 return (request, body)
2851 },
2852 deserializer: { response, responseBody in
2853 switch response.status.code {
2854 case 201:
2855 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2856 let body: Operations.DevicesCreateInstance.Output.Created.Body
2857 let chosenContentType = try converter.bestContentType(
2858 received: contentType,
2859 options: [
2860 "application/json"
2861 ]
2862 )
2863 switch chosenContentType {
2864 case "application/json":
2865 body = try await converter.getResponseBodyAsJSON(
2866 Components.Schemas.DeviceResponse.self,
2867 from: responseBody,
2868 transforming: { value in
2869 .json(value)
2870 }
2871 )
2872 default:
2873 preconditionFailure("bestContentType chose an invalid content type.")
2874 }
2875 return .created(.init(body: body))
2876 case 400:
2877 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2878 let body: Operations.DevicesCreateInstance.Output.BadRequest.Body
2879 let chosenContentType = try converter.bestContentType(
2880 received: contentType,
2881 options: [
2882 "application/json"
2883 ]
2884 )
2885 switch chosenContentType {
2886 case "application/json":
2887 body = try await converter.getResponseBodyAsJSON(
2888 Components.Schemas.ErrorResponse.self,
2889 from: responseBody,
2890 transforming: { value in
2891 .json(value)
2892 }
2893 )
2894 default:
2895 preconditionFailure("bestContentType chose an invalid content type.")
2896 }
2897 return .badRequest(.init(body: body))
2898 case 401:
2899 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2900 let body: Operations.DevicesCreateInstance.Output.Unauthorized.Body
2901 let chosenContentType = try converter.bestContentType(
2902 received: contentType,
2903 options: [
2904 "application/json"
2905 ]
2906 )
2907 switch chosenContentType {
2908 case "application/json":
2909 body = try await converter.getResponseBodyAsJSON(
2910 Components.Schemas.ErrorResponse.self,
2911 from: responseBody,
2912 transforming: { value in
2913 .json(value)
2914 }
2915 )
2916 default:
2917 preconditionFailure("bestContentType chose an invalid content type.")
2918 }
2919 return .unauthorized(.init(body: body))
2920 case 403:
2921 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2922 let body: Operations.DevicesCreateInstance.Output.Forbidden.Body
2923 let chosenContentType = try converter.bestContentType(
2924 received: contentType,
2925 options: [
2926 "application/json"
2927 ]
2928 )
2929 switch chosenContentType {
2930 case "application/json":
2931 body = try await converter.getResponseBodyAsJSON(
2932 Components.Schemas.ErrorResponse.self,
2933 from: responseBody,
2934 transforming: { value in
2935 .json(value)
2936 }
2937 )
2938 default:
2939 preconditionFailure("bestContentType chose an invalid content type.")
2940 }
2941 return .forbidden(.init(body: body))
2942 case 409:
2943 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2944 let body: Operations.DevicesCreateInstance.Output.Conflict.Body
2945 let chosenContentType = try converter.bestContentType(
2946 received: contentType,
2947 options: [
2948 "application/json"
2949 ]
2950 )
2951 switch chosenContentType {
2952 case "application/json":
2953 body = try await converter.getResponseBodyAsJSON(
2954 Components.Schemas.ErrorResponse.self,
2955 from: responseBody,
2956 transforming: { value in
2957 .json(value)
2958 }
2959 )
2960 default:
2961 preconditionFailure("bestContentType chose an invalid content type.")
2962 }
2963 return .conflict(.init(body: body))
2964 case 422:
2965 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2966 let body: Operations.DevicesCreateInstance.Output.UnprocessableContent.Body
2967 let chosenContentType = try converter.bestContentType(
2968 received: contentType,
2969 options: [
2970 "application/json"
2971 ]
2972 )
2973 switch chosenContentType {
2974 case "application/json":
2975 body = try await converter.getResponseBodyAsJSON(
2976 Components.Schemas.ErrorResponse.self,
2977 from: responseBody,
2978 transforming: { value in
2979 .json(value)
2980 }
2981 )
2982 default:
2983 preconditionFailure("bestContentType chose an invalid content type.")
2984 }
2985 return .unprocessableContent(.init(body: body))
2986 case 429:
2987 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2988 let body: Operations.DevicesCreateInstance.Output.TooManyRequests.Body
2989 let chosenContentType = try converter.bestContentType(
2990 received: contentType,
2991 options: [
2992 "application/json"
2993 ]
2994 )
2995 switch chosenContentType {
2996 case "application/json":
2997 body = try await converter.getResponseBodyAsJSON(
2998 Components.Schemas.ErrorResponse.self,
2999 from: responseBody,
3000 transforming: { value in
3001 .json(value)
3002 }
3003 )
3004 default:
3005 preconditionFailure("bestContentType chose an invalid content type.")
3006 }
3007 return .tooManyRequests(.init(body: body))
3008 default:
3009 return .undocumented(
3010 statusCode: response.status.code,
3011 .init(
3012 headerFields: response.headerFields,
3013 body: responseBody
3014 )
3015 )
3016 }
3017 }
3018 )
3019 }
3020 /// - Remark: HTTP `GET /v1/devices/{id}`.
3021 /// - Remark: Generated from `#/paths//v1/devices/{id}/get(devices_getInstance)`.
3022 public func devicesGetInstance(_ input: Operations.DevicesGetInstance.Input) async throws -> Operations.DevicesGetInstance.Output {
3023 try await client.send(
3024 input: input,
3025 forOperation: Operations.DevicesGetInstance.id,
3026 serializer: { input in
3027 let path = try converter.renderedPath(
3028 template: "/v1/devices/{}",
3029 parameters: [
3030 input.path.id
3031 ]
3032 )
3033 var request: HTTPTypes.HTTPRequest = .init(
3034 soar_path: path,
3035 method: .get
3036 )
3037 suppressMutabilityWarning(&request)
3038 try converter.setQueryItemAsURI(
3039 in: &request,
3040 style: .form,
3041 explode: false,
3042 name: "fields[devices]",
3043 value: input.query.fields_lbrack_devices_rbrack_
3044 )
3045 converter.setAcceptHeader(
3046 in: &request.headerFields,
3047 contentTypes: input.headers.accept
3048 )
3049 return (request, nil)
3050 },
3051 deserializer: { response, responseBody in
3052 switch response.status.code {
3053 case 200:
3054 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3055 let body: Operations.DevicesGetInstance.Output.Ok.Body
3056 let chosenContentType = try converter.bestContentType(
3057 received: contentType,
3058 options: [
3059 "application/json"
3060 ]
3061 )
3062 switch chosenContentType {
3063 case "application/json":
3064 body = try await converter.getResponseBodyAsJSON(
3065 Components.Schemas.DeviceResponse.self,
3066 from: responseBody,
3067 transforming: { value in
3068 .json(value)
3069 }
3070 )
3071 default:
3072 preconditionFailure("bestContentType chose an invalid content type.")
3073 }
3074 return .ok(.init(body: body))
3075 case 400:
3076 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3077 let body: Operations.DevicesGetInstance.Output.BadRequest.Body
3078 let chosenContentType = try converter.bestContentType(
3079 received: contentType,
3080 options: [
3081 "application/json"
3082 ]
3083 )
3084 switch chosenContentType {
3085 case "application/json":
3086 body = try await converter.getResponseBodyAsJSON(
3087 Components.Schemas.ErrorResponse.self,
3088 from: responseBody,
3089 transforming: { value in
3090 .json(value)
3091 }
3092 )
3093 default:
3094 preconditionFailure("bestContentType chose an invalid content type.")
3095 }
3096 return .badRequest(.init(body: body))
3097 case 401:
3098 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3099 let body: Operations.DevicesGetInstance.Output.Unauthorized.Body
3100 let chosenContentType = try converter.bestContentType(
3101 received: contentType,
3102 options: [
3103 "application/json"
3104 ]
3105 )
3106 switch chosenContentType {
3107 case "application/json":
3108 body = try await converter.getResponseBodyAsJSON(
3109 Components.Schemas.ErrorResponse.self,
3110 from: responseBody,
3111 transforming: { value in
3112 .json(value)
3113 }
3114 )
3115 default:
3116 preconditionFailure("bestContentType chose an invalid content type.")
3117 }
3118 return .unauthorized(.init(body: body))
3119 case 403:
3120 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3121 let body: Operations.DevicesGetInstance.Output.Forbidden.Body
3122 let chosenContentType = try converter.bestContentType(
3123 received: contentType,
3124 options: [
3125 "application/json"
3126 ]
3127 )
3128 switch chosenContentType {
3129 case "application/json":
3130 body = try await converter.getResponseBodyAsJSON(
3131 Components.Schemas.ErrorResponse.self,
3132 from: responseBody,
3133 transforming: { value in
3134 .json(value)
3135 }
3136 )
3137 default:
3138 preconditionFailure("bestContentType chose an invalid content type.")
3139 }
3140 return .forbidden(.init(body: body))
3141 case 404:
3142 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3143 let body: Operations.DevicesGetInstance.Output.NotFound.Body
3144 let chosenContentType = try converter.bestContentType(
3145 received: contentType,
3146 options: [
3147 "application/json"
3148 ]
3149 )
3150 switch chosenContentType {
3151 case "application/json":
3152 body = try await converter.getResponseBodyAsJSON(
3153 Components.Schemas.ErrorResponse.self,
3154 from: responseBody,
3155 transforming: { value in
3156 .json(value)
3157 }
3158 )
3159 default:
3160 preconditionFailure("bestContentType chose an invalid content type.")
3161 }
3162 return .notFound(.init(body: body))
3163 case 429:
3164 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3165 let body: Operations.DevicesGetInstance.Output.TooManyRequests.Body
3166 let chosenContentType = try converter.bestContentType(
3167 received: contentType,
3168 options: [
3169 "application/json"
3170 ]
3171 )
3172 switch chosenContentType {
3173 case "application/json":
3174 body = try await converter.getResponseBodyAsJSON(
3175 Components.Schemas.ErrorResponse.self,
3176 from: responseBody,
3177 transforming: { value in
3178 .json(value)
3179 }
3180 )
3181 default:
3182 preconditionFailure("bestContentType chose an invalid content type.")
3183 }
3184 return .tooManyRequests(.init(body: body))
3185 default:
3186 return .undocumented(
3187 statusCode: response.status.code,
3188 .init(
3189 headerFields: response.headerFields,
3190 body: responseBody
3191 )
3192 )
3193 }
3194 }
3195 )
3196 }
3197 /// - Remark: HTTP `PATCH /v1/devices/{id}`.
3198 /// - Remark: Generated from `#/paths//v1/devices/{id}/patch(devices_updateInstance)`.
3199 public func devicesUpdateInstance(_ input: Operations.DevicesUpdateInstance.Input) async throws -> Operations.DevicesUpdateInstance.Output {
3200 try await client.send(
3201 input: input,
3202 forOperation: Operations.DevicesUpdateInstance.id,
3203 serializer: { input in
3204 let path = try converter.renderedPath(
3205 template: "/v1/devices/{}",
3206 parameters: [
3207 input.path.id
3208 ]
3209 )
3210 var request: HTTPTypes.HTTPRequest = .init(
3211 soar_path: path,
3212 method: .patch
3213 )
3214 suppressMutabilityWarning(&request)
3215 converter.setAcceptHeader(
3216 in: &request.headerFields,
3217 contentTypes: input.headers.accept
3218 )
3219 let body: OpenAPIRuntime.HTTPBody?
3220 switch input.body {
3221 case let .json(value):
3222 body = try converter.setRequiredRequestBodyAsJSON(
3223 value,
3224 headerFields: &request.headerFields,
3225 contentType: "application/json; charset=utf-8"
3226 )
3227 }
3228 return (request, body)
3229 },
3230 deserializer: { response, responseBody in
3231 switch response.status.code {
3232 case 200:
3233 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3234 let body: Operations.DevicesUpdateInstance.Output.Ok.Body
3235 let chosenContentType = try converter.bestContentType(
3236 received: contentType,
3237 options: [
3238 "application/json"
3239 ]
3240 )
3241 switch chosenContentType {
3242 case "application/json":
3243 body = try await converter.getResponseBodyAsJSON(
3244 Components.Schemas.DeviceResponse.self,
3245 from: responseBody,
3246 transforming: { value in
3247 .json(value)
3248 }
3249 )
3250 default:
3251 preconditionFailure("bestContentType chose an invalid content type.")
3252 }
3253 return .ok(.init(body: body))
3254 case 400:
3255 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3256 let body: Operations.DevicesUpdateInstance.Output.BadRequest.Body
3257 let chosenContentType = try converter.bestContentType(
3258 received: contentType,
3259 options: [
3260 "application/json"
3261 ]
3262 )
3263 switch chosenContentType {
3264 case "application/json":
3265 body = try await converter.getResponseBodyAsJSON(
3266 Components.Schemas.ErrorResponse.self,
3267 from: responseBody,
3268 transforming: { value in
3269 .json(value)
3270 }
3271 )
3272 default:
3273 preconditionFailure("bestContentType chose an invalid content type.")
3274 }
3275 return .badRequest(.init(body: body))
3276 case 401:
3277 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3278 let body: Operations.DevicesUpdateInstance.Output.Unauthorized.Body
3279 let chosenContentType = try converter.bestContentType(
3280 received: contentType,
3281 options: [
3282 "application/json"
3283 ]
3284 )
3285 switch chosenContentType {
3286 case "application/json":
3287 body = try await converter.getResponseBodyAsJSON(
3288 Components.Schemas.ErrorResponse.self,
3289 from: responseBody,
3290 transforming: { value in
3291 .json(value)
3292 }
3293 )
3294 default:
3295 preconditionFailure("bestContentType chose an invalid content type.")
3296 }
3297 return .unauthorized(.init(body: body))
3298 case 403:
3299 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3300 let body: Operations.DevicesUpdateInstance.Output.Forbidden.Body
3301 let chosenContentType = try converter.bestContentType(
3302 received: contentType,
3303 options: [
3304 "application/json"
3305 ]
3306 )
3307 switch chosenContentType {
3308 case "application/json":
3309 body = try await converter.getResponseBodyAsJSON(
3310 Components.Schemas.ErrorResponse.self,
3311 from: responseBody,
3312 transforming: { value in
3313 .json(value)
3314 }
3315 )
3316 default:
3317 preconditionFailure("bestContentType chose an invalid content type.")
3318 }
3319 return .forbidden(.init(body: body))
3320 case 404:
3321 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3322 let body: Operations.DevicesUpdateInstance.Output.NotFound.Body
3323 let chosenContentType = try converter.bestContentType(
3324 received: contentType,
3325 options: [
3326 "application/json"
3327 ]
3328 )
3329 switch chosenContentType {
3330 case "application/json":
3331 body = try await converter.getResponseBodyAsJSON(
3332 Components.Schemas.ErrorResponse.self,
3333 from: responseBody,
3334 transforming: { value in
3335 .json(value)
3336 }
3337 )
3338 default:
3339 preconditionFailure("bestContentType chose an invalid content type.")
3340 }
3341 return .notFound(.init(body: body))
3342 case 409:
3343 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3344 let body: Operations.DevicesUpdateInstance.Output.Conflict.Body
3345 let chosenContentType = try converter.bestContentType(
3346 received: contentType,
3347 options: [
3348 "application/json"
3349 ]
3350 )
3351 switch chosenContentType {
3352 case "application/json":
3353 body = try await converter.getResponseBodyAsJSON(
3354 Components.Schemas.ErrorResponse.self,
3355 from: responseBody,
3356 transforming: { value in
3357 .json(value)
3358 }
3359 )
3360 default:
3361 preconditionFailure("bestContentType chose an invalid content type.")
3362 }
3363 return .conflict(.init(body: body))
3364 case 422:
3365 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3366 let body: Operations.DevicesUpdateInstance.Output.UnprocessableContent.Body
3367 let chosenContentType = try converter.bestContentType(
3368 received: contentType,
3369 options: [
3370 "application/json"
3371 ]
3372 )
3373 switch chosenContentType {
3374 case "application/json":
3375 body = try await converter.getResponseBodyAsJSON(
3376 Components.Schemas.ErrorResponse.self,
3377 from: responseBody,
3378 transforming: { value in
3379 .json(value)
3380 }
3381 )
3382 default:
3383 preconditionFailure("bestContentType chose an invalid content type.")
3384 }
3385 return .unprocessableContent(.init(body: body))
3386 case 429:
3387 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3388 let body: Operations.DevicesUpdateInstance.Output.TooManyRequests.Body
3389 let chosenContentType = try converter.bestContentType(
3390 received: contentType,
3391 options: [
3392 "application/json"
3393 ]
3394 )
3395 switch chosenContentType {
3396 case "application/json":
3397 body = try await converter.getResponseBodyAsJSON(
3398 Components.Schemas.ErrorResponse.self,
3399 from: responseBody,
3400 transforming: { value in
3401 .json(value)
3402 }
3403 )
3404 default:
3405 preconditionFailure("bestContentType chose an invalid content type.")
3406 }
3407 return .tooManyRequests(.init(body: body))
3408 default:
3409 return .undocumented(
3410 statusCode: response.status.code,
3411 .init(
3412 headerFields: response.headerFields,
3413 body: responseBody
3414 )
3415 )
3416 }
3417 }
3418 )
3419 }
3420 /// - Remark: HTTP `GET /v1/profiles`.
3421 /// - Remark: Generated from `#/paths//v1/profiles/get(profiles_getCollection)`.
3422 public func profilesGetCollection(_ input: Operations.ProfilesGetCollection.Input) async throws -> Operations.ProfilesGetCollection.Output {
3423 try await client.send(
3424 input: input,
3425 forOperation: Operations.ProfilesGetCollection.id,
3426 serializer: { input in
3427 let path = try converter.renderedPath(
3428 template: "/v1/profiles",
3429 parameters: []
3430 )
3431 var request: HTTPTypes.HTTPRequest = .init(
3432 soar_path: path,
3433 method: .get
3434 )
3435 suppressMutabilityWarning(&request)
3436 try converter.setQueryItemAsURI(
3437 in: &request,
3438 style: .form,
3439 explode: false,
3440 name: "filter[name]",
3441 value: input.query.filter_lbrack_name_rbrack_
3442 )
3443 try converter.setQueryItemAsURI(
3444 in: &request,
3445 style: .form,
3446 explode: false,
3447 name: "filter[profileType]",
3448 value: input.query.filter_lbrack_profileType_rbrack_
3449 )
3450 try converter.setQueryItemAsURI(
3451 in: &request,
3452 style: .form,
3453 explode: false,
3454 name: "filter[profileState]",
3455 value: input.query.filter_lbrack_profileState_rbrack_
3456 )
3457 try converter.setQueryItemAsURI(
3458 in: &request,
3459 style: .form,
3460 explode: false,
3461 name: "filter[id]",
3462 value: input.query.filter_lbrack_id_rbrack_
3463 )
3464 try converter.setQueryItemAsURI(
3465 in: &request,
3466 style: .form,
3467 explode: false,
3468 name: "sort",
3469 value: input.query.sort
3470 )
3471 try converter.setQueryItemAsURI(
3472 in: &request,
3473 style: .form,
3474 explode: false,
3475 name: "fields[profiles]",
3476 value: input.query.fields_lbrack_profiles_rbrack_
3477 )
3478 try converter.setQueryItemAsURI(
3479 in: &request,
3480 style: .form,
3481 explode: false,
3482 name: "fields[bundleIds]",
3483 value: input.query.fields_lbrack_bundleIds_rbrack_
3484 )
3485 try converter.setQueryItemAsURI(
3486 in: &request,
3487 style: .form,
3488 explode: false,
3489 name: "fields[devices]",
3490 value: input.query.fields_lbrack_devices_rbrack_
3491 )
3492 try converter.setQueryItemAsURI(
3493 in: &request,
3494 style: .form,
3495 explode: false,
3496 name: "fields[certificates]",
3497 value: input.query.fields_lbrack_certificates_rbrack_
3498 )
3499 try converter.setQueryItemAsURI(
3500 in: &request,
3501 style: .form,
3502 explode: true,
3503 name: "limit",
3504 value: input.query.limit
3505 )
3506 try converter.setQueryItemAsURI(
3507 in: &request,
3508 style: .form,
3509 explode: false,
3510 name: "include",
3511 value: input.query.include
3512 )
3513 try converter.setQueryItemAsURI(
3514 in: &request,
3515 style: .form,
3516 explode: true,
3517 name: "limit[certificates]",
3518 value: input.query.limit_lbrack_certificates_rbrack_
3519 )
3520 try converter.setQueryItemAsURI(
3521 in: &request,
3522 style: .form,
3523 explode: true,
3524 name: "limit[devices]",
3525 value: input.query.limit_lbrack_devices_rbrack_
3526 )
3527 converter.setAcceptHeader(
3528 in: &request.headerFields,
3529 contentTypes: input.headers.accept
3530 )
3531 return (request, nil)
3532 },
3533 deserializer: { response, responseBody in
3534 switch response.status.code {
3535 case 200:
3536 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3537 let body: Operations.ProfilesGetCollection.Output.Ok.Body
3538 let chosenContentType = try converter.bestContentType(
3539 received: contentType,
3540 options: [
3541 "application/json"
3542 ]
3543 )
3544 switch chosenContentType {
3545 case "application/json":
3546 body = try await converter.getResponseBodyAsJSON(
3547 Components.Schemas.ProfilesResponse.self,
3548 from: responseBody,
3549 transforming: { value in
3550 .json(value)
3551 }
3552 )
3553 default:
3554 preconditionFailure("bestContentType chose an invalid content type.")
3555 }
3556 return .ok(.init(body: body))
3557 case 400:
3558 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3559 let body: Operations.ProfilesGetCollection.Output.BadRequest.Body
3560 let chosenContentType = try converter.bestContentType(
3561 received: contentType,
3562 options: [
3563 "application/json"
3564 ]
3565 )
3566 switch chosenContentType {
3567 case "application/json":
3568 body = try await converter.getResponseBodyAsJSON(
3569 Components.Schemas.ErrorResponse.self,
3570 from: responseBody,
3571 transforming: { value in
3572 .json(value)
3573 }
3574 )
3575 default:
3576 preconditionFailure("bestContentType chose an invalid content type.")
3577 }
3578 return .badRequest(.init(body: body))
3579 case 401:
3580 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3581 let body: Operations.ProfilesGetCollection.Output.Unauthorized.Body
3582 let chosenContentType = try converter.bestContentType(
3583 received: contentType,
3584 options: [
3585 "application/json"
3586 ]
3587 )
3588 switch chosenContentType {
3589 case "application/json":
3590 body = try await converter.getResponseBodyAsJSON(
3591 Components.Schemas.ErrorResponse.self,
3592 from: responseBody,
3593 transforming: { value in
3594 .json(value)
3595 }
3596 )
3597 default:
3598 preconditionFailure("bestContentType chose an invalid content type.")
3599 }
3600 return .unauthorized(.init(body: body))
3601 case 403:
3602 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3603 let body: Operations.ProfilesGetCollection.Output.Forbidden.Body
3604 let chosenContentType = try converter.bestContentType(
3605 received: contentType,
3606 options: [
3607 "application/json"
3608 ]
3609 )
3610 switch chosenContentType {
3611 case "application/json":
3612 body = try await converter.getResponseBodyAsJSON(
3613 Components.Schemas.ErrorResponse.self,
3614 from: responseBody,
3615 transforming: { value in
3616 .json(value)
3617 }
3618 )
3619 default:
3620 preconditionFailure("bestContentType chose an invalid content type.")
3621 }
3622 return .forbidden(.init(body: body))
3623 case 429:
3624 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3625 let body: Operations.ProfilesGetCollection.Output.TooManyRequests.Body
3626 let chosenContentType = try converter.bestContentType(
3627 received: contentType,
3628 options: [
3629 "application/json"
3630 ]
3631 )
3632 switch chosenContentType {
3633 case "application/json":
3634 body = try await converter.getResponseBodyAsJSON(
3635 Components.Schemas.ErrorResponse.self,
3636 from: responseBody,
3637 transforming: { value in
3638 .json(value)
3639 }
3640 )
3641 default:
3642 preconditionFailure("bestContentType chose an invalid content type.")
3643 }
3644 return .tooManyRequests(.init(body: body))
3645 default:
3646 return .undocumented(
3647 statusCode: response.status.code,
3648 .init(
3649 headerFields: response.headerFields,
3650 body: responseBody
3651 )
3652 )
3653 }
3654 }
3655 )
3656 }
3657 /// - Remark: HTTP `POST /v1/profiles`.
3658 /// - Remark: Generated from `#/paths//v1/profiles/post(profiles_createInstance)`.
3659 public func profilesCreateInstance(_ input: Operations.ProfilesCreateInstance.Input) async throws -> Operations.ProfilesCreateInstance.Output {
3660 try await client.send(
3661 input: input,
3662 forOperation: Operations.ProfilesCreateInstance.id,
3663 serializer: { input in
3664 let path = try converter.renderedPath(
3665 template: "/v1/profiles",
3666 parameters: []
3667 )
3668 var request: HTTPTypes.HTTPRequest = .init(
3669 soar_path: path,
3670 method: .post
3671 )
3672 suppressMutabilityWarning(&request)
3673 converter.setAcceptHeader(
3674 in: &request.headerFields,
3675 contentTypes: input.headers.accept
3676 )
3677 let body: OpenAPIRuntime.HTTPBody?
3678 switch input.body {
3679 case let .json(value):
3680 body = try converter.setRequiredRequestBodyAsJSON(
3681 value,
3682 headerFields: &request.headerFields,
3683 contentType: "application/json; charset=utf-8"
3684 )
3685 }
3686 return (request, body)
3687 },
3688 deserializer: { response, responseBody in
3689 switch response.status.code {
3690 case 201:
3691 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3692 let body: Operations.ProfilesCreateInstance.Output.Created.Body
3693 let chosenContentType = try converter.bestContentType(
3694 received: contentType,
3695 options: [
3696 "application/json"
3697 ]
3698 )
3699 switch chosenContentType {
3700 case "application/json":
3701 body = try await converter.getResponseBodyAsJSON(
3702 Components.Schemas.ProfileResponse.self,
3703 from: responseBody,
3704 transforming: { value in
3705 .json(value)
3706 }
3707 )
3708 default:
3709 preconditionFailure("bestContentType chose an invalid content type.")
3710 }
3711 return .created(.init(body: body))
3712 case 400:
3713 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3714 let body: Operations.ProfilesCreateInstance.Output.BadRequest.Body
3715 let chosenContentType = try converter.bestContentType(
3716 received: contentType,
3717 options: [
3718 "application/json"
3719 ]
3720 )
3721 switch chosenContentType {
3722 case "application/json":
3723 body = try await converter.getResponseBodyAsJSON(
3724 Components.Schemas.ErrorResponse.self,
3725 from: responseBody,
3726 transforming: { value in
3727 .json(value)
3728 }
3729 )
3730 default:
3731 preconditionFailure("bestContentType chose an invalid content type.")
3732 }
3733 return .badRequest(.init(body: body))
3734 case 401:
3735 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3736 let body: Operations.ProfilesCreateInstance.Output.Unauthorized.Body
3737 let chosenContentType = try converter.bestContentType(
3738 received: contentType,
3739 options: [
3740 "application/json"
3741 ]
3742 )
3743 switch chosenContentType {
3744 case "application/json":
3745 body = try await converter.getResponseBodyAsJSON(
3746 Components.Schemas.ErrorResponse.self,
3747 from: responseBody,
3748 transforming: { value in
3749 .json(value)
3750 }
3751 )
3752 default:
3753 preconditionFailure("bestContentType chose an invalid content type.")
3754 }
3755 return .unauthorized(.init(body: body))
3756 case 403:
3757 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3758 let body: Operations.ProfilesCreateInstance.Output.Forbidden.Body
3759 let chosenContentType = try converter.bestContentType(
3760 received: contentType,
3761 options: [
3762 "application/json"
3763 ]
3764 )
3765 switch chosenContentType {
3766 case "application/json":
3767 body = try await converter.getResponseBodyAsJSON(
3768 Components.Schemas.ErrorResponse.self,
3769 from: responseBody,
3770 transforming: { value in
3771 .json(value)
3772 }
3773 )
3774 default:
3775 preconditionFailure("bestContentType chose an invalid content type.")
3776 }
3777 return .forbidden(.init(body: body))
3778 case 409:
3779 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3780 let body: Operations.ProfilesCreateInstance.Output.Conflict.Body
3781 let chosenContentType = try converter.bestContentType(
3782 received: contentType,
3783 options: [
3784 "application/json"
3785 ]
3786 )
3787 switch chosenContentType {
3788 case "application/json":
3789 body = try await converter.getResponseBodyAsJSON(
3790 Components.Schemas.ErrorResponse.self,
3791 from: responseBody,
3792 transforming: { value in
3793 .json(value)
3794 }
3795 )
3796 default:
3797 preconditionFailure("bestContentType chose an invalid content type.")
3798 }
3799 return .conflict(.init(body: body))
3800 case 422:
3801 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3802 let body: Operations.ProfilesCreateInstance.Output.UnprocessableContent.Body
3803 let chosenContentType = try converter.bestContentType(
3804 received: contentType,
3805 options: [
3806 "application/json"
3807 ]
3808 )
3809 switch chosenContentType {
3810 case "application/json":
3811 body = try await converter.getResponseBodyAsJSON(
3812 Components.Schemas.ErrorResponse.self,
3813 from: responseBody,
3814 transforming: { value in
3815 .json(value)
3816 }
3817 )
3818 default:
3819 preconditionFailure("bestContentType chose an invalid content type.")
3820 }
3821 return .unprocessableContent(.init(body: body))
3822 case 429:
3823 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3824 let body: Operations.ProfilesCreateInstance.Output.TooManyRequests.Body
3825 let chosenContentType = try converter.bestContentType(
3826 received: contentType,
3827 options: [
3828 "application/json"
3829 ]
3830 )
3831 switch chosenContentType {
3832 case "application/json":
3833 body = try await converter.getResponseBodyAsJSON(
3834 Components.Schemas.ErrorResponse.self,
3835 from: responseBody,
3836 transforming: { value in
3837 .json(value)
3838 }
3839 )
3840 default:
3841 preconditionFailure("bestContentType chose an invalid content type.")
3842 }
3843 return .tooManyRequests(.init(body: body))
3844 default:
3845 return .undocumented(
3846 statusCode: response.status.code,
3847 .init(
3848 headerFields: response.headerFields,
3849 body: responseBody
3850 )
3851 )
3852 }
3853 }
3854 )
3855 }
3856 /// - Remark: HTTP `GET /v1/profiles/{id}`.
3857 /// - Remark: Generated from `#/paths//v1/profiles/{id}/get(profiles_getInstance)`.
3858 public func profilesGetInstance(_ input: Operations.ProfilesGetInstance.Input) async throws -> Operations.ProfilesGetInstance.Output {
3859 try await client.send(
3860 input: input,
3861 forOperation: Operations.ProfilesGetInstance.id,
3862 serializer: { input in
3863 let path = try converter.renderedPath(
3864 template: "/v1/profiles/{}",
3865 parameters: [
3866 input.path.id
3867 ]
3868 )
3869 var request: HTTPTypes.HTTPRequest = .init(
3870 soar_path: path,
3871 method: .get
3872 )
3873 suppressMutabilityWarning(&request)
3874 try converter.setQueryItemAsURI(
3875 in: &request,
3876 style: .form,
3877 explode: false,
3878 name: "fields[profiles]",
3879 value: input.query.fields_lbrack_profiles_rbrack_
3880 )
3881 try converter.setQueryItemAsURI(
3882 in: &request,
3883 style: .form,
3884 explode: false,
3885 name: "fields[bundleIds]",
3886 value: input.query.fields_lbrack_bundleIds_rbrack_
3887 )
3888 try converter.setQueryItemAsURI(
3889 in: &request,
3890 style: .form,
3891 explode: false,
3892 name: "fields[devices]",
3893 value: input.query.fields_lbrack_devices_rbrack_
3894 )
3895 try converter.setQueryItemAsURI(
3896 in: &request,
3897 style: .form,
3898 explode: false,
3899 name: "fields[certificates]",
3900 value: input.query.fields_lbrack_certificates_rbrack_
3901 )
3902 try converter.setQueryItemAsURI(
3903 in: &request,
3904 style: .form,
3905 explode: false,
3906 name: "include",
3907 value: input.query.include
3908 )
3909 try converter.setQueryItemAsURI(
3910 in: &request,
3911 style: .form,
3912 explode: true,
3913 name: "limit[certificates]",
3914 value: input.query.limit_lbrack_certificates_rbrack_
3915 )
3916 try converter.setQueryItemAsURI(
3917 in: &request,
3918 style: .form,
3919 explode: true,
3920 name: "limit[devices]",
3921 value: input.query.limit_lbrack_devices_rbrack_
3922 )
3923 converter.setAcceptHeader(
3924 in: &request.headerFields,
3925 contentTypes: input.headers.accept
3926 )
3927 return (request, nil)
3928 },
3929 deserializer: { response, responseBody in
3930 switch response.status.code {
3931 case 200:
3932 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3933 let body: Operations.ProfilesGetInstance.Output.Ok.Body
3934 let chosenContentType = try converter.bestContentType(
3935 received: contentType,
3936 options: [
3937 "application/json"
3938 ]
3939 )
3940 switch chosenContentType {
3941 case "application/json":
3942 body = try await converter.getResponseBodyAsJSON(
3943 Components.Schemas.ProfileResponse.self,
3944 from: responseBody,
3945 transforming: { value in
3946 .json(value)
3947 }
3948 )
3949 default:
3950 preconditionFailure("bestContentType chose an invalid content type.")
3951 }
3952 return .ok(.init(body: body))
3953 case 400:
3954 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3955 let body: Operations.ProfilesGetInstance.Output.BadRequest.Body
3956 let chosenContentType = try converter.bestContentType(
3957 received: contentType,
3958 options: [
3959 "application/json"
3960 ]
3961 )
3962 switch chosenContentType {
3963 case "application/json":
3964 body = try await converter.getResponseBodyAsJSON(
3965 Components.Schemas.ErrorResponse.self,
3966 from: responseBody,
3967 transforming: { value in
3968 .json(value)
3969 }
3970 )
3971 default:
3972 preconditionFailure("bestContentType chose an invalid content type.")
3973 }
3974 return .badRequest(.init(body: body))
3975 case 401:
3976 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3977 let body: Operations.ProfilesGetInstance.Output.Unauthorized.Body
3978 let chosenContentType = try converter.bestContentType(
3979 received: contentType,
3980 options: [
3981 "application/json"
3982 ]
3983 )
3984 switch chosenContentType {
3985 case "application/json":
3986 body = try await converter.getResponseBodyAsJSON(
3987 Components.Schemas.ErrorResponse.self,
3988 from: responseBody,
3989 transforming: { value in
3990 .json(value)
3991 }
3992 )
3993 default:
3994 preconditionFailure("bestContentType chose an invalid content type.")
3995 }
3996 return .unauthorized(.init(body: body))
3997 case 403:
3998 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
3999 let body: Operations.ProfilesGetInstance.Output.Forbidden.Body
4000 let chosenContentType = try converter.bestContentType(
4001 received: contentType,
4002 options: [
4003 "application/json"
4004 ]
4005 )
4006 switch chosenContentType {
4007 case "application/json":
4008 body = try await converter.getResponseBodyAsJSON(
4009 Components.Schemas.ErrorResponse.self,
4010 from: responseBody,
4011 transforming: { value in
4012 .json(value)
4013 }
4014 )
4015 default:
4016 preconditionFailure("bestContentType chose an invalid content type.")
4017 }
4018 return .forbidden(.init(body: body))
4019 case 404:
4020 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4021 let body: Operations.ProfilesGetInstance.Output.NotFound.Body
4022 let chosenContentType = try converter.bestContentType(
4023 received: contentType,
4024 options: [
4025 "application/json"
4026 ]
4027 )
4028 switch chosenContentType {
4029 case "application/json":
4030 body = try await converter.getResponseBodyAsJSON(
4031 Components.Schemas.ErrorResponse.self,
4032 from: responseBody,
4033 transforming: { value in
4034 .json(value)
4035 }
4036 )
4037 default:
4038 preconditionFailure("bestContentType chose an invalid content type.")
4039 }
4040 return .notFound(.init(body: body))
4041 case 429:
4042 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4043 let body: Operations.ProfilesGetInstance.Output.TooManyRequests.Body
4044 let chosenContentType = try converter.bestContentType(
4045 received: contentType,
4046 options: [
4047 "application/json"
4048 ]
4049 )
4050 switch chosenContentType {
4051 case "application/json":
4052 body = try await converter.getResponseBodyAsJSON(
4053 Components.Schemas.ErrorResponse.self,
4054 from: responseBody,
4055 transforming: { value in
4056 .json(value)
4057 }
4058 )
4059 default:
4060 preconditionFailure("bestContentType chose an invalid content type.")
4061 }
4062 return .tooManyRequests(.init(body: body))
4063 default:
4064 return .undocumented(
4065 statusCode: response.status.code,
4066 .init(
4067 headerFields: response.headerFields,
4068 body: responseBody
4069 )
4070 )
4071 }
4072 }
4073 )
4074 }
4075 /// - Remark: HTTP `DELETE /v1/profiles/{id}`.
4076 /// - Remark: Generated from `#/paths//v1/profiles/{id}/delete(profiles_deleteInstance)`.
4077 public func profilesDeleteInstance(_ input: Operations.ProfilesDeleteInstance.Input) async throws -> Operations.ProfilesDeleteInstance.Output {
4078 try await client.send(
4079 input: input,
4080 forOperation: Operations.ProfilesDeleteInstance.id,
4081 serializer: { input in
4082 let path = try converter.renderedPath(
4083 template: "/v1/profiles/{}",
4084 parameters: [
4085 input.path.id
4086 ]
4087 )
4088 var request: HTTPTypes.HTTPRequest = .init(
4089 soar_path: path,
4090 method: .delete
4091 )
4092 suppressMutabilityWarning(&request)
4093 converter.setAcceptHeader(
4094 in: &request.headerFields,
4095 contentTypes: input.headers.accept
4096 )
4097 return (request, nil)
4098 },
4099 deserializer: { response, responseBody in
4100 switch response.status.code {
4101 case 204:
4102 return .noContent(.init())
4103 case 400:
4104 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4105 let body: Operations.ProfilesDeleteInstance.Output.BadRequest.Body
4106 let chosenContentType = try converter.bestContentType(
4107 received: contentType,
4108 options: [
4109 "application/json"
4110 ]
4111 )
4112 switch chosenContentType {
4113 case "application/json":
4114 body = try await converter.getResponseBodyAsJSON(
4115 Components.Schemas.ErrorResponse.self,
4116 from: responseBody,
4117 transforming: { value in
4118 .json(value)
4119 }
4120 )
4121 default:
4122 preconditionFailure("bestContentType chose an invalid content type.")
4123 }
4124 return .badRequest(.init(body: body))
4125 case 401:
4126 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4127 let body: Operations.ProfilesDeleteInstance.Output.Unauthorized.Body
4128 let chosenContentType = try converter.bestContentType(
4129 received: contentType,
4130 options: [
4131 "application/json"
4132 ]
4133 )
4134 switch chosenContentType {
4135 case "application/json":
4136 body = try await converter.getResponseBodyAsJSON(
4137 Components.Schemas.ErrorResponse.self,
4138 from: responseBody,
4139 transforming: { value in
4140 .json(value)
4141 }
4142 )
4143 default:
4144 preconditionFailure("bestContentType chose an invalid content type.")
4145 }
4146 return .unauthorized(.init(body: body))
4147 case 403:
4148 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4149 let body: Operations.ProfilesDeleteInstance.Output.Forbidden.Body
4150 let chosenContentType = try converter.bestContentType(
4151 received: contentType,
4152 options: [
4153 "application/json"
4154 ]
4155 )
4156 switch chosenContentType {
4157 case "application/json":
4158 body = try await converter.getResponseBodyAsJSON(
4159 Components.Schemas.ErrorResponse.self,
4160 from: responseBody,
4161 transforming: { value in
4162 .json(value)
4163 }
4164 )
4165 default:
4166 preconditionFailure("bestContentType chose an invalid content type.")
4167 }
4168 return .forbidden(.init(body: body))
4169 case 404:
4170 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4171 let body: Operations.ProfilesDeleteInstance.Output.NotFound.Body
4172 let chosenContentType = try converter.bestContentType(
4173 received: contentType,
4174 options: [
4175 "application/json"
4176 ]
4177 )
4178 switch chosenContentType {
4179 case "application/json":
4180 body = try await converter.getResponseBodyAsJSON(
4181 Components.Schemas.ErrorResponse.self,
4182 from: responseBody,
4183 transforming: { value in
4184 .json(value)
4185 }
4186 )
4187 default:
4188 preconditionFailure("bestContentType chose an invalid content type.")
4189 }
4190 return .notFound(.init(body: body))
4191 case 429:
4192 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4193 let body: Operations.ProfilesDeleteInstance.Output.TooManyRequests.Body
4194 let chosenContentType = try converter.bestContentType(
4195 received: contentType,
4196 options: [
4197 "application/json"
4198 ]
4199 )
4200 switch chosenContentType {
4201 case "application/json":
4202 body = try await converter.getResponseBodyAsJSON(
4203 Components.Schemas.ErrorResponse.self,
4204 from: responseBody,
4205 transforming: { value in
4206 .json(value)
4207 }
4208 )
4209 default:
4210 preconditionFailure("bestContentType chose an invalid content type.")
4211 }
4212 return .tooManyRequests(.init(body: body))
4213 default:
4214 return .undocumented(
4215 statusCode: response.status.code,
4216 .init(
4217 headerFields: response.headerFields,
4218 body: responseBody
4219 )
4220 )
4221 }
4222 }
4223 )
4224 }
4225 /// - Remark: HTTP `GET /v1/bundleIds/{id}/relationships/app`.
4226 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/relationships/app/get(bundleIds_app_getToOneRelationship)`.
4227 public func bundleIdsAppGetToOneRelationship(_ input: Operations.BundleIdsAppGetToOneRelationship.Input) async throws -> Operations.BundleIdsAppGetToOneRelationship.Output {
4228 try await client.send(
4229 input: input,
4230 forOperation: Operations.BundleIdsAppGetToOneRelationship.id,
4231 serializer: { input in
4232 let path = try converter.renderedPath(
4233 template: "/v1/bundleIds/{}/relationships/app",
4234 parameters: [
4235 input.path.id
4236 ]
4237 )
4238 var request: HTTPTypes.HTTPRequest = .init(
4239 soar_path: path,
4240 method: .get
4241 )
4242 suppressMutabilityWarning(&request)
4243 converter.setAcceptHeader(
4244 in: &request.headerFields,
4245 contentTypes: input.headers.accept
4246 )
4247 return (request, nil)
4248 },
4249 deserializer: { response, responseBody in
4250 switch response.status.code {
4251 case 200:
4252 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4253 let body: Operations.BundleIdsAppGetToOneRelationship.Output.Ok.Body
4254 let chosenContentType = try converter.bestContentType(
4255 received: contentType,
4256 options: [
4257 "application/json"
4258 ]
4259 )
4260 switch chosenContentType {
4261 case "application/json":
4262 body = try await converter.getResponseBodyAsJSON(
4263 Components.Schemas.BundleIdAppLinkageResponse.self,
4264 from: responseBody,
4265 transforming: { value in
4266 .json(value)
4267 }
4268 )
4269 default:
4270 preconditionFailure("bestContentType chose an invalid content type.")
4271 }
4272 return .ok(.init(body: body))
4273 case 400:
4274 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4275 let body: Operations.BundleIdsAppGetToOneRelationship.Output.BadRequest.Body
4276 let chosenContentType = try converter.bestContentType(
4277 received: contentType,
4278 options: [
4279 "application/json"
4280 ]
4281 )
4282 switch chosenContentType {
4283 case "application/json":
4284 body = try await converter.getResponseBodyAsJSON(
4285 Components.Schemas.ErrorResponse.self,
4286 from: responseBody,
4287 transforming: { value in
4288 .json(value)
4289 }
4290 )
4291 default:
4292 preconditionFailure("bestContentType chose an invalid content type.")
4293 }
4294 return .badRequest(.init(body: body))
4295 case 401:
4296 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4297 let body: Operations.BundleIdsAppGetToOneRelationship.Output.Unauthorized.Body
4298 let chosenContentType = try converter.bestContentType(
4299 received: contentType,
4300 options: [
4301 "application/json"
4302 ]
4303 )
4304 switch chosenContentType {
4305 case "application/json":
4306 body = try await converter.getResponseBodyAsJSON(
4307 Components.Schemas.ErrorResponse.self,
4308 from: responseBody,
4309 transforming: { value in
4310 .json(value)
4311 }
4312 )
4313 default:
4314 preconditionFailure("bestContentType chose an invalid content type.")
4315 }
4316 return .unauthorized(.init(body: body))
4317 case 403:
4318 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4319 let body: Operations.BundleIdsAppGetToOneRelationship.Output.Forbidden.Body
4320 let chosenContentType = try converter.bestContentType(
4321 received: contentType,
4322 options: [
4323 "application/json"
4324 ]
4325 )
4326 switch chosenContentType {
4327 case "application/json":
4328 body = try await converter.getResponseBodyAsJSON(
4329 Components.Schemas.ErrorResponse.self,
4330 from: responseBody,
4331 transforming: { value in
4332 .json(value)
4333 }
4334 )
4335 default:
4336 preconditionFailure("bestContentType chose an invalid content type.")
4337 }
4338 return .forbidden(.init(body: body))
4339 case 404:
4340 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4341 let body: Operations.BundleIdsAppGetToOneRelationship.Output.NotFound.Body
4342 let chosenContentType = try converter.bestContentType(
4343 received: contentType,
4344 options: [
4345 "application/json"
4346 ]
4347 )
4348 switch chosenContentType {
4349 case "application/json":
4350 body = try await converter.getResponseBodyAsJSON(
4351 Components.Schemas.ErrorResponse.self,
4352 from: responseBody,
4353 transforming: { value in
4354 .json(value)
4355 }
4356 )
4357 default:
4358 preconditionFailure("bestContentType chose an invalid content type.")
4359 }
4360 return .notFound(.init(body: body))
4361 case 429:
4362 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4363 let body: Operations.BundleIdsAppGetToOneRelationship.Output.TooManyRequests.Body
4364 let chosenContentType = try converter.bestContentType(
4365 received: contentType,
4366 options: [
4367 "application/json"
4368 ]
4369 )
4370 switch chosenContentType {
4371 case "application/json":
4372 body = try await converter.getResponseBodyAsJSON(
4373 Components.Schemas.ErrorResponse.self,
4374 from: responseBody,
4375 transforming: { value in
4376 .json(value)
4377 }
4378 )
4379 default:
4380 preconditionFailure("bestContentType chose an invalid content type.")
4381 }
4382 return .tooManyRequests(.init(body: body))
4383 default:
4384 return .undocumented(
4385 statusCode: response.status.code,
4386 .init(
4387 headerFields: response.headerFields,
4388 body: responseBody
4389 )
4390 )
4391 }
4392 }
4393 )
4394 }
4395 /// - Remark: HTTP `GET /v1/bundleIds/{id}/app`.
4396 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/app/get(bundleIds_app_getToOneRelated)`.
4397 public func bundleIdsAppGetToOneRelated(_ input: Operations.BundleIdsAppGetToOneRelated.Input) async throws -> Operations.BundleIdsAppGetToOneRelated.Output {
4398 try await client.send(
4399 input: input,
4400 forOperation: Operations.BundleIdsAppGetToOneRelated.id,
4401 serializer: { input in
4402 let path = try converter.renderedPath(
4403 template: "/v1/bundleIds/{}/app",
4404 parameters: [
4405 input.path.id
4406 ]
4407 )
4408 var request: HTTPTypes.HTTPRequest = .init(
4409 soar_path: path,
4410 method: .get
4411 )
4412 suppressMutabilityWarning(&request)
4413 try converter.setQueryItemAsURI(
4414 in: &request,
4415 style: .form,
4416 explode: false,
4417 name: "fields[apps]",
4418 value: input.query.fields_lbrack_apps_rbrack_
4419 )
4420 converter.setAcceptHeader(
4421 in: &request.headerFields,
4422 contentTypes: input.headers.accept
4423 )
4424 return (request, nil)
4425 },
4426 deserializer: { response, responseBody in
4427 switch response.status.code {
4428 case 200:
4429 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4430 let body: Operations.BundleIdsAppGetToOneRelated.Output.Ok.Body
4431 let chosenContentType = try converter.bestContentType(
4432 received: contentType,
4433 options: [
4434 "application/json"
4435 ]
4436 )
4437 switch chosenContentType {
4438 case "application/json":
4439 body = try await converter.getResponseBodyAsJSON(
4440 Components.Schemas.AppWithoutIncludesResponse.self,
4441 from: responseBody,
4442 transforming: { value in
4443 .json(value)
4444 }
4445 )
4446 default:
4447 preconditionFailure("bestContentType chose an invalid content type.")
4448 }
4449 return .ok(.init(body: body))
4450 case 400:
4451 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4452 let body: Operations.BundleIdsAppGetToOneRelated.Output.BadRequest.Body
4453 let chosenContentType = try converter.bestContentType(
4454 received: contentType,
4455 options: [
4456 "application/json"
4457 ]
4458 )
4459 switch chosenContentType {
4460 case "application/json":
4461 body = try await converter.getResponseBodyAsJSON(
4462 Components.Schemas.ErrorResponse.self,
4463 from: responseBody,
4464 transforming: { value in
4465 .json(value)
4466 }
4467 )
4468 default:
4469 preconditionFailure("bestContentType chose an invalid content type.")
4470 }
4471 return .badRequest(.init(body: body))
4472 case 401:
4473 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4474 let body: Operations.BundleIdsAppGetToOneRelated.Output.Unauthorized.Body
4475 let chosenContentType = try converter.bestContentType(
4476 received: contentType,
4477 options: [
4478 "application/json"
4479 ]
4480 )
4481 switch chosenContentType {
4482 case "application/json":
4483 body = try await converter.getResponseBodyAsJSON(
4484 Components.Schemas.ErrorResponse.self,
4485 from: responseBody,
4486 transforming: { value in
4487 .json(value)
4488 }
4489 )
4490 default:
4491 preconditionFailure("bestContentType chose an invalid content type.")
4492 }
4493 return .unauthorized(.init(body: body))
4494 case 403:
4495 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4496 let body: Operations.BundleIdsAppGetToOneRelated.Output.Forbidden.Body
4497 let chosenContentType = try converter.bestContentType(
4498 received: contentType,
4499 options: [
4500 "application/json"
4501 ]
4502 )
4503 switch chosenContentType {
4504 case "application/json":
4505 body = try await converter.getResponseBodyAsJSON(
4506 Components.Schemas.ErrorResponse.self,
4507 from: responseBody,
4508 transforming: { value in
4509 .json(value)
4510 }
4511 )
4512 default:
4513 preconditionFailure("bestContentType chose an invalid content type.")
4514 }
4515 return .forbidden(.init(body: body))
4516 case 404:
4517 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4518 let body: Operations.BundleIdsAppGetToOneRelated.Output.NotFound.Body
4519 let chosenContentType = try converter.bestContentType(
4520 received: contentType,
4521 options: [
4522 "application/json"
4523 ]
4524 )
4525 switch chosenContentType {
4526 case "application/json":
4527 body = try await converter.getResponseBodyAsJSON(
4528 Components.Schemas.ErrorResponse.self,
4529 from: responseBody,
4530 transforming: { value in
4531 .json(value)
4532 }
4533 )
4534 default:
4535 preconditionFailure("bestContentType chose an invalid content type.")
4536 }
4537 return .notFound(.init(body: body))
4538 case 429:
4539 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4540 let body: Operations.BundleIdsAppGetToOneRelated.Output.TooManyRequests.Body
4541 let chosenContentType = try converter.bestContentType(
4542 received: contentType,
4543 options: [
4544 "application/json"
4545 ]
4546 )
4547 switch chosenContentType {
4548 case "application/json":
4549 body = try await converter.getResponseBodyAsJSON(
4550 Components.Schemas.ErrorResponse.self,
4551 from: responseBody,
4552 transforming: { value in
4553 .json(value)
4554 }
4555 )
4556 default:
4557 preconditionFailure("bestContentType chose an invalid content type.")
4558 }
4559 return .tooManyRequests(.init(body: body))
4560 default:
4561 return .undocumented(
4562 statusCode: response.status.code,
4563 .init(
4564 headerFields: response.headerFields,
4565 body: responseBody
4566 )
4567 )
4568 }
4569 }
4570 )
4571 }
4572 /// - Remark: HTTP `GET /v1/bundleIds/{id}/relationships/bundleIdCapabilities`.
4573 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/relationships/bundleIdCapabilities/get(bundleIds_bundleIdCapabilities_getToManyRelationship)`.
4574 public func bundleIdsBundleIdCapabilitiesGetToManyRelationship(_ input: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Input) async throws -> Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output {
4575 try await client.send(
4576 input: input,
4577 forOperation: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.id,
4578 serializer: { input in
4579 let path = try converter.renderedPath(
4580 template: "/v1/bundleIds/{}/relationships/bundleIdCapabilities",
4581 parameters: [
4582 input.path.id
4583 ]
4584 )
4585 var request: HTTPTypes.HTTPRequest = .init(
4586 soar_path: path,
4587 method: .get
4588 )
4589 suppressMutabilityWarning(&request)
4590 try converter.setQueryItemAsURI(
4591 in: &request,
4592 style: .form,
4593 explode: true,
4594 name: "limit",
4595 value: input.query.limit
4596 )
4597 converter.setAcceptHeader(
4598 in: &request.headerFields,
4599 contentTypes: input.headers.accept
4600 )
4601 return (request, nil)
4602 },
4603 deserializer: { response, responseBody in
4604 switch response.status.code {
4605 case 200:
4606 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4607 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output.Ok.Body
4608 let chosenContentType = try converter.bestContentType(
4609 received: contentType,
4610 options: [
4611 "application/json"
4612 ]
4613 )
4614 switch chosenContentType {
4615 case "application/json":
4616 body = try await converter.getResponseBodyAsJSON(
4617 Components.Schemas.BundleIdBundleIdCapabilitiesLinkagesResponse.self,
4618 from: responseBody,
4619 transforming: { value in
4620 .json(value)
4621 }
4622 )
4623 default:
4624 preconditionFailure("bestContentType chose an invalid content type.")
4625 }
4626 return .ok(.init(body: body))
4627 case 400:
4628 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4629 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output.BadRequest.Body
4630 let chosenContentType = try converter.bestContentType(
4631 received: contentType,
4632 options: [
4633 "application/json"
4634 ]
4635 )
4636 switch chosenContentType {
4637 case "application/json":
4638 body = try await converter.getResponseBodyAsJSON(
4639 Components.Schemas.ErrorResponse.self,
4640 from: responseBody,
4641 transforming: { value in
4642 .json(value)
4643 }
4644 )
4645 default:
4646 preconditionFailure("bestContentType chose an invalid content type.")
4647 }
4648 return .badRequest(.init(body: body))
4649 case 401:
4650 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4651 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output.Unauthorized.Body
4652 let chosenContentType = try converter.bestContentType(
4653 received: contentType,
4654 options: [
4655 "application/json"
4656 ]
4657 )
4658 switch chosenContentType {
4659 case "application/json":
4660 body = try await converter.getResponseBodyAsJSON(
4661 Components.Schemas.ErrorResponse.self,
4662 from: responseBody,
4663 transforming: { value in
4664 .json(value)
4665 }
4666 )
4667 default:
4668 preconditionFailure("bestContentType chose an invalid content type.")
4669 }
4670 return .unauthorized(.init(body: body))
4671 case 403:
4672 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4673 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output.Forbidden.Body
4674 let chosenContentType = try converter.bestContentType(
4675 received: contentType,
4676 options: [
4677 "application/json"
4678 ]
4679 )
4680 switch chosenContentType {
4681 case "application/json":
4682 body = try await converter.getResponseBodyAsJSON(
4683 Components.Schemas.ErrorResponse.self,
4684 from: responseBody,
4685 transforming: { value in
4686 .json(value)
4687 }
4688 )
4689 default:
4690 preconditionFailure("bestContentType chose an invalid content type.")
4691 }
4692 return .forbidden(.init(body: body))
4693 case 404:
4694 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4695 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output.NotFound.Body
4696 let chosenContentType = try converter.bestContentType(
4697 received: contentType,
4698 options: [
4699 "application/json"
4700 ]
4701 )
4702 switch chosenContentType {
4703 case "application/json":
4704 body = try await converter.getResponseBodyAsJSON(
4705 Components.Schemas.ErrorResponse.self,
4706 from: responseBody,
4707 transforming: { value in
4708 .json(value)
4709 }
4710 )
4711 default:
4712 preconditionFailure("bestContentType chose an invalid content type.")
4713 }
4714 return .notFound(.init(body: body))
4715 case 429:
4716 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4717 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelationship.Output.TooManyRequests.Body
4718 let chosenContentType = try converter.bestContentType(
4719 received: contentType,
4720 options: [
4721 "application/json"
4722 ]
4723 )
4724 switch chosenContentType {
4725 case "application/json":
4726 body = try await converter.getResponseBodyAsJSON(
4727 Components.Schemas.ErrorResponse.self,
4728 from: responseBody,
4729 transforming: { value in
4730 .json(value)
4731 }
4732 )
4733 default:
4734 preconditionFailure("bestContentType chose an invalid content type.")
4735 }
4736 return .tooManyRequests(.init(body: body))
4737 default:
4738 return .undocumented(
4739 statusCode: response.status.code,
4740 .init(
4741 headerFields: response.headerFields,
4742 body: responseBody
4743 )
4744 )
4745 }
4746 }
4747 )
4748 }
4749 /// - Remark: HTTP `GET /v1/bundleIds/{id}/bundleIdCapabilities`.
4750 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/bundleIdCapabilities/get(bundleIds_bundleIdCapabilities_getToManyRelated)`.
4751 public func bundleIdsBundleIdCapabilitiesGetToManyRelated(_ input: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Input) async throws -> Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output {
4752 try await client.send(
4753 input: input,
4754 forOperation: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.id,
4755 serializer: { input in
4756 let path = try converter.renderedPath(
4757 template: "/v1/bundleIds/{}/bundleIdCapabilities",
4758 parameters: [
4759 input.path.id
4760 ]
4761 )
4762 var request: HTTPTypes.HTTPRequest = .init(
4763 soar_path: path,
4764 method: .get
4765 )
4766 suppressMutabilityWarning(&request)
4767 try converter.setQueryItemAsURI(
4768 in: &request,
4769 style: .form,
4770 explode: false,
4771 name: "fields[bundleIdCapabilities]",
4772 value: input.query.fields_lbrack_bundleIdCapabilities_rbrack_
4773 )
4774 try converter.setQueryItemAsURI(
4775 in: &request,
4776 style: .form,
4777 explode: true,
4778 name: "limit",
4779 value: input.query.limit
4780 )
4781 converter.setAcceptHeader(
4782 in: &request.headerFields,
4783 contentTypes: input.headers.accept
4784 )
4785 return (request, nil)
4786 },
4787 deserializer: { response, responseBody in
4788 switch response.status.code {
4789 case 200:
4790 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4791 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.Ok.Body
4792 let chosenContentType = try converter.bestContentType(
4793 received: contentType,
4794 options: [
4795 "application/json"
4796 ]
4797 )
4798 switch chosenContentType {
4799 case "application/json":
4800 body = try await converter.getResponseBodyAsJSON(
4801 Components.Schemas.BundleIdCapabilitiesWithoutIncludesResponse.self,
4802 from: responseBody,
4803 transforming: { value in
4804 .json(value)
4805 }
4806 )
4807 default:
4808 preconditionFailure("bestContentType chose an invalid content type.")
4809 }
4810 return .ok(.init(body: body))
4811 case 400:
4812 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4813 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.BadRequest.Body
4814 let chosenContentType = try converter.bestContentType(
4815 received: contentType,
4816 options: [
4817 "application/json"
4818 ]
4819 )
4820 switch chosenContentType {
4821 case "application/json":
4822 body = try await converter.getResponseBodyAsJSON(
4823 Components.Schemas.ErrorResponse.self,
4824 from: responseBody,
4825 transforming: { value in
4826 .json(value)
4827 }
4828 )
4829 default:
4830 preconditionFailure("bestContentType chose an invalid content type.")
4831 }
4832 return .badRequest(.init(body: body))
4833 case 401:
4834 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4835 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.Unauthorized.Body
4836 let chosenContentType = try converter.bestContentType(
4837 received: contentType,
4838 options: [
4839 "application/json"
4840 ]
4841 )
4842 switch chosenContentType {
4843 case "application/json":
4844 body = try await converter.getResponseBodyAsJSON(
4845 Components.Schemas.ErrorResponse.self,
4846 from: responseBody,
4847 transforming: { value in
4848 .json(value)
4849 }
4850 )
4851 default:
4852 preconditionFailure("bestContentType chose an invalid content type.")
4853 }
4854 return .unauthorized(.init(body: body))
4855 case 403:
4856 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4857 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.Forbidden.Body
4858 let chosenContentType = try converter.bestContentType(
4859 received: contentType,
4860 options: [
4861 "application/json"
4862 ]
4863 )
4864 switch chosenContentType {
4865 case "application/json":
4866 body = try await converter.getResponseBodyAsJSON(
4867 Components.Schemas.ErrorResponse.self,
4868 from: responseBody,
4869 transforming: { value in
4870 .json(value)
4871 }
4872 )
4873 default:
4874 preconditionFailure("bestContentType chose an invalid content type.")
4875 }
4876 return .forbidden(.init(body: body))
4877 case 404:
4878 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4879 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.NotFound.Body
4880 let chosenContentType = try converter.bestContentType(
4881 received: contentType,
4882 options: [
4883 "application/json"
4884 ]
4885 )
4886 switch chosenContentType {
4887 case "application/json":
4888 body = try await converter.getResponseBodyAsJSON(
4889 Components.Schemas.ErrorResponse.self,
4890 from: responseBody,
4891 transforming: { value in
4892 .json(value)
4893 }
4894 )
4895 default:
4896 preconditionFailure("bestContentType chose an invalid content type.")
4897 }
4898 return .notFound(.init(body: body))
4899 case 429:
4900 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4901 let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.TooManyRequests.Body
4902 let chosenContentType = try converter.bestContentType(
4903 received: contentType,
4904 options: [
4905 "application/json"
4906 ]
4907 )
4908 switch chosenContentType {
4909 case "application/json":
4910 body = try await converter.getResponseBodyAsJSON(
4911 Components.Schemas.ErrorResponse.self,
4912 from: responseBody,
4913 transforming: { value in
4914 .json(value)
4915 }
4916 )
4917 default:
4918 preconditionFailure("bestContentType chose an invalid content type.")
4919 }
4920 return .tooManyRequests(.init(body: body))
4921 default:
4922 return .undocumented(
4923 statusCode: response.status.code,
4924 .init(
4925 headerFields: response.headerFields,
4926 body: responseBody
4927 )
4928 )
4929 }
4930 }
4931 )
4932 }
4933 /// - Remark: HTTP `GET /v1/bundleIds/{id}/relationships/profiles`.
4934 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/relationships/profiles/get(bundleIds_profiles_getToManyRelationship)`.
4935 public func bundleIdsProfilesGetToManyRelationship(_ input: Operations.BundleIdsProfilesGetToManyRelationship.Input) async throws -> Operations.BundleIdsProfilesGetToManyRelationship.Output {
4936 try await client.send(
4937 input: input,
4938 forOperation: Operations.BundleIdsProfilesGetToManyRelationship.id,
4939 serializer: { input in
4940 let path = try converter.renderedPath(
4941 template: "/v1/bundleIds/{}/relationships/profiles",
4942 parameters: [
4943 input.path.id
4944 ]
4945 )
4946 var request: HTTPTypes.HTTPRequest = .init(
4947 soar_path: path,
4948 method: .get
4949 )
4950 suppressMutabilityWarning(&request)
4951 try converter.setQueryItemAsURI(
4952 in: &request,
4953 style: .form,
4954 explode: true,
4955 name: "limit",
4956 value: input.query.limit
4957 )
4958 converter.setAcceptHeader(
4959 in: &request.headerFields,
4960 contentTypes: input.headers.accept
4961 )
4962 return (request, nil)
4963 },
4964 deserializer: { response, responseBody in
4965 switch response.status.code {
4966 case 200:
4967 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4968 let body: Operations.BundleIdsProfilesGetToManyRelationship.Output.Ok.Body
4969 let chosenContentType = try converter.bestContentType(
4970 received: contentType,
4971 options: [
4972 "application/json"
4973 ]
4974 )
4975 switch chosenContentType {
4976 case "application/json":
4977 body = try await converter.getResponseBodyAsJSON(
4978 Components.Schemas.BundleIdProfilesLinkagesResponse.self,
4979 from: responseBody,
4980 transforming: { value in
4981 .json(value)
4982 }
4983 )
4984 default:
4985 preconditionFailure("bestContentType chose an invalid content type.")
4986 }
4987 return .ok(.init(body: body))
4988 case 400:
4989 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4990 let body: Operations.BundleIdsProfilesGetToManyRelationship.Output.BadRequest.Body
4991 let chosenContentType = try converter.bestContentType(
4992 received: contentType,
4993 options: [
4994 "application/json"
4995 ]
4996 )
4997 switch chosenContentType {
4998 case "application/json":
4999 body = try await converter.getResponseBodyAsJSON(
5000 Components.Schemas.ErrorResponse.self,
5001 from: responseBody,
5002 transforming: { value in
5003 .json(value)
5004 }
5005 )
5006 default:
5007 preconditionFailure("bestContentType chose an invalid content type.")
5008 }
5009 return .badRequest(.init(body: body))
5010 case 401:
5011 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5012 let body: Operations.BundleIdsProfilesGetToManyRelationship.Output.Unauthorized.Body
5013 let chosenContentType = try converter.bestContentType(
5014 received: contentType,
5015 options: [
5016 "application/json"
5017 ]
5018 )
5019 switch chosenContentType {
5020 case "application/json":
5021 body = try await converter.getResponseBodyAsJSON(
5022 Components.Schemas.ErrorResponse.self,
5023 from: responseBody,
5024 transforming: { value in
5025 .json(value)
5026 }
5027 )
5028 default:
5029 preconditionFailure("bestContentType chose an invalid content type.")
5030 }
5031 return .unauthorized(.init(body: body))
5032 case 403:
5033 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5034 let body: Operations.BundleIdsProfilesGetToManyRelationship.Output.Forbidden.Body
5035 let chosenContentType = try converter.bestContentType(
5036 received: contentType,
5037 options: [
5038 "application/json"
5039 ]
5040 )
5041 switch chosenContentType {
5042 case "application/json":
5043 body = try await converter.getResponseBodyAsJSON(
5044 Components.Schemas.ErrorResponse.self,
5045 from: responseBody,
5046 transforming: { value in
5047 .json(value)
5048 }
5049 )
5050 default:
5051 preconditionFailure("bestContentType chose an invalid content type.")
5052 }
5053 return .forbidden(.init(body: body))
5054 case 404:
5055 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5056 let body: Operations.BundleIdsProfilesGetToManyRelationship.Output.NotFound.Body
5057 let chosenContentType = try converter.bestContentType(
5058 received: contentType,
5059 options: [
5060 "application/json"
5061 ]
5062 )
5063 switch chosenContentType {
5064 case "application/json":
5065 body = try await converter.getResponseBodyAsJSON(
5066 Components.Schemas.ErrorResponse.self,
5067 from: responseBody,
5068 transforming: { value in
5069 .json(value)
5070 }
5071 )
5072 default:
5073 preconditionFailure("bestContentType chose an invalid content type.")
5074 }
5075 return .notFound(.init(body: body))
5076 case 429:
5077 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5078 let body: Operations.BundleIdsProfilesGetToManyRelationship.Output.TooManyRequests.Body
5079 let chosenContentType = try converter.bestContentType(
5080 received: contentType,
5081 options: [
5082 "application/json"
5083 ]
5084 )
5085 switch chosenContentType {
5086 case "application/json":
5087 body = try await converter.getResponseBodyAsJSON(
5088 Components.Schemas.ErrorResponse.self,
5089 from: responseBody,
5090 transforming: { value in
5091 .json(value)
5092 }
5093 )
5094 default:
5095 preconditionFailure("bestContentType chose an invalid content type.")
5096 }
5097 return .tooManyRequests(.init(body: body))
5098 default:
5099 return .undocumented(
5100 statusCode: response.status.code,
5101 .init(
5102 headerFields: response.headerFields,
5103 body: responseBody
5104 )
5105 )
5106 }
5107 }
5108 )
5109 }
5110 /// - Remark: HTTP `GET /v1/bundleIds/{id}/profiles`.
5111 /// - Remark: Generated from `#/paths//v1/bundleIds/{id}/profiles/get(bundleIds_profiles_getToManyRelated)`.
5112 public func bundleIdsProfilesGetToManyRelated(_ input: Operations.BundleIdsProfilesGetToManyRelated.Input) async throws -> Operations.BundleIdsProfilesGetToManyRelated.Output {
5113 try await client.send(
5114 input: input,
5115 forOperation: Operations.BundleIdsProfilesGetToManyRelated.id,
5116 serializer: { input in
5117 let path = try converter.renderedPath(
5118 template: "/v1/bundleIds/{}/profiles",
5119 parameters: [
5120 input.path.id
5121 ]
5122 )
5123 var request: HTTPTypes.HTTPRequest = .init(
5124 soar_path: path,
5125 method: .get
5126 )
5127 suppressMutabilityWarning(&request)
5128 try converter.setQueryItemAsURI(
5129 in: &request,
5130 style: .form,
5131 explode: false,
5132 name: "fields[profiles]",
5133 value: input.query.fields_lbrack_profiles_rbrack_
5134 )
5135 try converter.setQueryItemAsURI(
5136 in: &request,
5137 style: .form,
5138 explode: true,
5139 name: "limit",
5140 value: input.query.limit
5141 )
5142 converter.setAcceptHeader(
5143 in: &request.headerFields,
5144 contentTypes: input.headers.accept
5145 )
5146 return (request, nil)
5147 },
5148 deserializer: { response, responseBody in
5149 switch response.status.code {
5150 case 200:
5151 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5152 let body: Operations.BundleIdsProfilesGetToManyRelated.Output.Ok.Body
5153 let chosenContentType = try converter.bestContentType(
5154 received: contentType,
5155 options: [
5156 "application/json"
5157 ]
5158 )
5159 switch chosenContentType {
5160 case "application/json":
5161 body = try await converter.getResponseBodyAsJSON(
5162 Components.Schemas.ProfilesWithoutIncludesResponse.self,
5163 from: responseBody,
5164 transforming: { value in
5165 .json(value)
5166 }
5167 )
5168 default:
5169 preconditionFailure("bestContentType chose an invalid content type.")
5170 }
5171 return .ok(.init(body: body))
5172 case 400:
5173 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5174 let body: Operations.BundleIdsProfilesGetToManyRelated.Output.BadRequest.Body
5175 let chosenContentType = try converter.bestContentType(
5176 received: contentType,
5177 options: [
5178 "application/json"
5179 ]
5180 )
5181 switch chosenContentType {
5182 case "application/json":
5183 body = try await converter.getResponseBodyAsJSON(
5184 Components.Schemas.ErrorResponse.self,
5185 from: responseBody,
5186 transforming: { value in
5187 .json(value)
5188 }
5189 )
5190 default:
5191 preconditionFailure("bestContentType chose an invalid content type.")
5192 }
5193 return .badRequest(.init(body: body))
5194 case 401:
5195 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5196 let body: Operations.BundleIdsProfilesGetToManyRelated.Output.Unauthorized.Body
5197 let chosenContentType = try converter.bestContentType(
5198 received: contentType,
5199 options: [
5200 "application/json"
5201 ]
5202 )
5203 switch chosenContentType {
5204 case "application/json":
5205 body = try await converter.getResponseBodyAsJSON(
5206 Components.Schemas.ErrorResponse.self,
5207 from: responseBody,
5208 transforming: { value in
5209 .json(value)
5210 }
5211 )
5212 default:
5213 preconditionFailure("bestContentType chose an invalid content type.")
5214 }
5215 return .unauthorized(.init(body: body))
5216 case 403:
5217 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5218 let body: Operations.BundleIdsProfilesGetToManyRelated.Output.Forbidden.Body
5219 let chosenContentType = try converter.bestContentType(
5220 received: contentType,
5221 options: [
5222 "application/json"
5223 ]
5224 )
5225 switch chosenContentType {
5226 case "application/json":
5227 body = try await converter.getResponseBodyAsJSON(
5228 Components.Schemas.ErrorResponse.self,
5229 from: responseBody,
5230 transforming: { value in
5231 .json(value)
5232 }
5233 )
5234 default:
5235 preconditionFailure("bestContentType chose an invalid content type.")
5236 }
5237 return .forbidden(.init(body: body))
5238 case 404:
5239 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5240 let body: Operations.BundleIdsProfilesGetToManyRelated.Output.NotFound.Body
5241 let chosenContentType = try converter.bestContentType(
5242 received: contentType,
5243 options: [
5244 "application/json"
5245 ]
5246 )
5247 switch chosenContentType {
5248 case "application/json":
5249 body = try await converter.getResponseBodyAsJSON(
5250 Components.Schemas.ErrorResponse.self,
5251 from: responseBody,
5252 transforming: { value in
5253 .json(value)
5254 }
5255 )
5256 default:
5257 preconditionFailure("bestContentType chose an invalid content type.")
5258 }
5259 return .notFound(.init(body: body))
5260 case 429:
5261 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5262 let body: Operations.BundleIdsProfilesGetToManyRelated.Output.TooManyRequests.Body
5263 let chosenContentType = try converter.bestContentType(
5264 received: contentType,
5265 options: [
5266 "application/json"
5267 ]
5268 )
5269 switch chosenContentType {
5270 case "application/json":
5271 body = try await converter.getResponseBodyAsJSON(
5272 Components.Schemas.ErrorResponse.self,
5273 from: responseBody,
5274 transforming: { value in
5275 .json(value)
5276 }
5277 )
5278 default:
5279 preconditionFailure("bestContentType chose an invalid content type.")
5280 }
5281 return .tooManyRequests(.init(body: body))
5282 default:
5283 return .undocumented(
5284 statusCode: response.status.code,
5285 .init(
5286 headerFields: response.headerFields,
5287 body: responseBody
5288 )
5289 )
5290 }
5291 }
5292 )
5293 }
5294 /// - Remark: HTTP `GET /v1/certificates/{id}/relationships/passTypeId`.
5295 /// - Remark: Generated from `#/paths//v1/certificates/{id}/relationships/passTypeId/get(certificates_passTypeId_getToOneRelationship)`.
5296 public func certificatesPassTypeIdGetToOneRelationship(_ input: Operations.CertificatesPassTypeIdGetToOneRelationship.Input) async throws -> Operations.CertificatesPassTypeIdGetToOneRelationship.Output {
5297 try await client.send(
5298 input: input,
5299 forOperation: Operations.CertificatesPassTypeIdGetToOneRelationship.id,
5300 serializer: { input in
5301 let path = try converter.renderedPath(
5302 template: "/v1/certificates/{}/relationships/passTypeId",
5303 parameters: [
5304 input.path.id
5305 ]
5306 )
5307 var request: HTTPTypes.HTTPRequest = .init(
5308 soar_path: path,
5309 method: .get
5310 )
5311 suppressMutabilityWarning(&request)
5312 converter.setAcceptHeader(
5313 in: &request.headerFields,
5314 contentTypes: input.headers.accept
5315 )
5316 return (request, nil)
5317 },
5318 deserializer: { response, responseBody in
5319 switch response.status.code {
5320 case 200:
5321 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5322 let body: Operations.CertificatesPassTypeIdGetToOneRelationship.Output.Ok.Body
5323 let chosenContentType = try converter.bestContentType(
5324 received: contentType,
5325 options: [
5326 "application/json"
5327 ]
5328 )
5329 switch chosenContentType {
5330 case "application/json":
5331 body = try await converter.getResponseBodyAsJSON(
5332 Components.Schemas.CertificatePassTypeIdLinkageResponse.self,
5333 from: responseBody,
5334 transforming: { value in
5335 .json(value)
5336 }
5337 )
5338 default:
5339 preconditionFailure("bestContentType chose an invalid content type.")
5340 }
5341 return .ok(.init(body: body))
5342 case 400:
5343 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5344 let body: Operations.CertificatesPassTypeIdGetToOneRelationship.Output.BadRequest.Body
5345 let chosenContentType = try converter.bestContentType(
5346 received: contentType,
5347 options: [
5348 "application/json"
5349 ]
5350 )
5351 switch chosenContentType {
5352 case "application/json":
5353 body = try await converter.getResponseBodyAsJSON(
5354 Components.Schemas.ErrorResponse.self,
5355 from: responseBody,
5356 transforming: { value in
5357 .json(value)
5358 }
5359 )
5360 default:
5361 preconditionFailure("bestContentType chose an invalid content type.")
5362 }
5363 return .badRequest(.init(body: body))
5364 case 401:
5365 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5366 let body: Operations.CertificatesPassTypeIdGetToOneRelationship.Output.Unauthorized.Body
5367 let chosenContentType = try converter.bestContentType(
5368 received: contentType,
5369 options: [
5370 "application/json"
5371 ]
5372 )
5373 switch chosenContentType {
5374 case "application/json":
5375 body = try await converter.getResponseBodyAsJSON(
5376 Components.Schemas.ErrorResponse.self,
5377 from: responseBody,
5378 transforming: { value in
5379 .json(value)
5380 }
5381 )
5382 default:
5383 preconditionFailure("bestContentType chose an invalid content type.")
5384 }
5385 return .unauthorized(.init(body: body))
5386 case 403:
5387 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5388 let body: Operations.CertificatesPassTypeIdGetToOneRelationship.Output.Forbidden.Body
5389 let chosenContentType = try converter.bestContentType(
5390 received: contentType,
5391 options: [
5392 "application/json"
5393 ]
5394 )
5395 switch chosenContentType {
5396 case "application/json":
5397 body = try await converter.getResponseBodyAsJSON(
5398 Components.Schemas.ErrorResponse.self,
5399 from: responseBody,
5400 transforming: { value in
5401 .json(value)
5402 }
5403 )
5404 default:
5405 preconditionFailure("bestContentType chose an invalid content type.")
5406 }
5407 return .forbidden(.init(body: body))
5408 case 404:
5409 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5410 let body: Operations.CertificatesPassTypeIdGetToOneRelationship.Output.NotFound.Body
5411 let chosenContentType = try converter.bestContentType(
5412 received: contentType,
5413 options: [
5414 "application/json"
5415 ]
5416 )
5417 switch chosenContentType {
5418 case "application/json":
5419 body = try await converter.getResponseBodyAsJSON(
5420 Components.Schemas.ErrorResponse.self,
5421 from: responseBody,
5422 transforming: { value in
5423 .json(value)
5424 }
5425 )
5426 default:
5427 preconditionFailure("bestContentType chose an invalid content type.")
5428 }
5429 return .notFound(.init(body: body))
5430 case 429:
5431 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5432 let body: Operations.CertificatesPassTypeIdGetToOneRelationship.Output.TooManyRequests.Body
5433 let chosenContentType = try converter.bestContentType(
5434 received: contentType,
5435 options: [
5436 "application/json"
5437 ]
5438 )
5439 switch chosenContentType {
5440 case "application/json":
5441 body = try await converter.getResponseBodyAsJSON(
5442 Components.Schemas.ErrorResponse.self,
5443 from: responseBody,
5444 transforming: { value in
5445 .json(value)
5446 }
5447 )
5448 default:
5449 preconditionFailure("bestContentType chose an invalid content type.")
5450 }
5451 return .tooManyRequests(.init(body: body))
5452 default:
5453 return .undocumented(
5454 statusCode: response.status.code,
5455 .init(
5456 headerFields: response.headerFields,
5457 body: responseBody
5458 )
5459 )
5460 }
5461 }
5462 )
5463 }
5464 /// - Remark: HTTP `GET /v1/certificates/{id}/passTypeId`.
5465 /// - Remark: Generated from `#/paths//v1/certificates/{id}/passTypeId/get(certificates_passTypeId_getToOneRelated)`.
5466 public func certificatesPassTypeIdGetToOneRelated(_ input: Operations.CertificatesPassTypeIdGetToOneRelated.Input) async throws -> Operations.CertificatesPassTypeIdGetToOneRelated.Output {
5467 try await client.send(
5468 input: input,
5469 forOperation: Operations.CertificatesPassTypeIdGetToOneRelated.id,
5470 serializer: { input in
5471 let path = try converter.renderedPath(
5472 template: "/v1/certificates/{}/passTypeId",
5473 parameters: [
5474 input.path.id
5475 ]
5476 )
5477 var request: HTTPTypes.HTTPRequest = .init(
5478 soar_path: path,
5479 method: .get
5480 )
5481 suppressMutabilityWarning(&request)
5482 try converter.setQueryItemAsURI(
5483 in: &request,
5484 style: .form,
5485 explode: false,
5486 name: "fields[passTypeIds]",
5487 value: input.query.fields_lbrack_passTypeIds_rbrack_
5488 )
5489 try converter.setQueryItemAsURI(
5490 in: &request,
5491 style: .form,
5492 explode: false,
5493 name: "fields[certificates]",
5494 value: input.query.fields_lbrack_certificates_rbrack_
5495 )
5496 try converter.setQueryItemAsURI(
5497 in: &request,
5498 style: .form,
5499 explode: false,
5500 name: "include",
5501 value: input.query.include
5502 )
5503 try converter.setQueryItemAsURI(
5504 in: &request,
5505 style: .form,
5506 explode: true,
5507 name: "limit[certificates]",
5508 value: input.query.limit_lbrack_certificates_rbrack_
5509 )
5510 converter.setAcceptHeader(
5511 in: &request.headerFields,
5512 contentTypes: input.headers.accept
5513 )
5514 return (request, nil)
5515 },
5516 deserializer: { response, responseBody in
5517 switch response.status.code {
5518 case 200:
5519 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5520 let body: Operations.CertificatesPassTypeIdGetToOneRelated.Output.Ok.Body
5521 let chosenContentType = try converter.bestContentType(
5522 received: contentType,
5523 options: [
5524 "application/json"
5525 ]
5526 )
5527 switch chosenContentType {
5528 case "application/json":
5529 body = try await converter.getResponseBodyAsJSON(
5530 Components.Schemas.PassTypeIdResponse.self,
5531 from: responseBody,
5532 transforming: { value in
5533 .json(value)
5534 }
5535 )
5536 default:
5537 preconditionFailure("bestContentType chose an invalid content type.")
5538 }
5539 return .ok(.init(body: body))
5540 case 400:
5541 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5542 let body: Operations.CertificatesPassTypeIdGetToOneRelated.Output.BadRequest.Body
5543 let chosenContentType = try converter.bestContentType(
5544 received: contentType,
5545 options: [
5546 "application/json"
5547 ]
5548 )
5549 switch chosenContentType {
5550 case "application/json":
5551 body = try await converter.getResponseBodyAsJSON(
5552 Components.Schemas.ErrorResponse.self,
5553 from: responseBody,
5554 transforming: { value in
5555 .json(value)
5556 }
5557 )
5558 default:
5559 preconditionFailure("bestContentType chose an invalid content type.")
5560 }
5561 return .badRequest(.init(body: body))
5562 case 401:
5563 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5564 let body: Operations.CertificatesPassTypeIdGetToOneRelated.Output.Unauthorized.Body
5565 let chosenContentType = try converter.bestContentType(
5566 received: contentType,
5567 options: [
5568 "application/json"
5569 ]
5570 )
5571 switch chosenContentType {
5572 case "application/json":
5573 body = try await converter.getResponseBodyAsJSON(
5574 Components.Schemas.ErrorResponse.self,
5575 from: responseBody,
5576 transforming: { value in
5577 .json(value)
5578 }
5579 )
5580 default:
5581 preconditionFailure("bestContentType chose an invalid content type.")
5582 }
5583 return .unauthorized(.init(body: body))
5584 case 403:
5585 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5586 let body: Operations.CertificatesPassTypeIdGetToOneRelated.Output.Forbidden.Body
5587 let chosenContentType = try converter.bestContentType(
5588 received: contentType,
5589 options: [
5590 "application/json"
5591 ]
5592 )
5593 switch chosenContentType {
5594 case "application/json":
5595 body = try await converter.getResponseBodyAsJSON(
5596 Components.Schemas.ErrorResponse.self,
5597 from: responseBody,
5598 transforming: { value in
5599 .json(value)
5600 }
5601 )
5602 default:
5603 preconditionFailure("bestContentType chose an invalid content type.")
5604 }
5605 return .forbidden(.init(body: body))
5606 case 404:
5607 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5608 let body: Operations.CertificatesPassTypeIdGetToOneRelated.Output.NotFound.Body
5609 let chosenContentType = try converter.bestContentType(
5610 received: contentType,
5611 options: [
5612 "application/json"
5613 ]
5614 )
5615 switch chosenContentType {
5616 case "application/json":
5617 body = try await converter.getResponseBodyAsJSON(
5618 Components.Schemas.ErrorResponse.self,
5619 from: responseBody,
5620 transforming: { value in
5621 .json(value)
5622 }
5623 )
5624 default:
5625 preconditionFailure("bestContentType chose an invalid content type.")
5626 }
5627 return .notFound(.init(body: body))
5628 case 429:
5629 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5630 let body: Operations.CertificatesPassTypeIdGetToOneRelated.Output.TooManyRequests.Body
5631 let chosenContentType = try converter.bestContentType(
5632 received: contentType,
5633 options: [
5634 "application/json"
5635 ]
5636 )
5637 switch chosenContentType {
5638 case "application/json":
5639 body = try await converter.getResponseBodyAsJSON(
5640 Components.Schemas.ErrorResponse.self,
5641 from: responseBody,
5642 transforming: { value in
5643 .json(value)
5644 }
5645 )
5646 default:
5647 preconditionFailure("bestContentType chose an invalid content type.")
5648 }
5649 return .tooManyRequests(.init(body: body))
5650 default:
5651 return .undocumented(
5652 statusCode: response.status.code,
5653 .init(
5654 headerFields: response.headerFields,
5655 body: responseBody
5656 )
5657 )
5658 }
5659 }
5660 )
5661 }
5662 /// - Remark: HTTP `GET /v1/profiles/{id}/relationships/bundleId`.
5663 /// - Remark: Generated from `#/paths//v1/profiles/{id}/relationships/bundleId/get(profiles_bundleId_getToOneRelationship)`.
5664 public func profilesBundleIdGetToOneRelationship(_ input: Operations.ProfilesBundleIdGetToOneRelationship.Input) async throws -> Operations.ProfilesBundleIdGetToOneRelationship.Output {
5665 try await client.send(
5666 input: input,
5667 forOperation: Operations.ProfilesBundleIdGetToOneRelationship.id,
5668 serializer: { input in
5669 let path = try converter.renderedPath(
5670 template: "/v1/profiles/{}/relationships/bundleId",
5671 parameters: [
5672 input.path.id
5673 ]
5674 )
5675 var request: HTTPTypes.HTTPRequest = .init(
5676 soar_path: path,
5677 method: .get
5678 )
5679 suppressMutabilityWarning(&request)
5680 converter.setAcceptHeader(
5681 in: &request.headerFields,
5682 contentTypes: input.headers.accept
5683 )
5684 return (request, nil)
5685 },
5686 deserializer: { response, responseBody in
5687 switch response.status.code {
5688 case 200:
5689 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5690 let body: Operations.ProfilesBundleIdGetToOneRelationship.Output.Ok.Body
5691 let chosenContentType = try converter.bestContentType(
5692 received: contentType,
5693 options: [
5694 "application/json"
5695 ]
5696 )
5697 switch chosenContentType {
5698 case "application/json":
5699 body = try await converter.getResponseBodyAsJSON(
5700 Components.Schemas.ProfileBundleIdLinkageResponse.self,
5701 from: responseBody,
5702 transforming: { value in
5703 .json(value)
5704 }
5705 )
5706 default:
5707 preconditionFailure("bestContentType chose an invalid content type.")
5708 }
5709 return .ok(.init(body: body))
5710 case 400:
5711 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5712 let body: Operations.ProfilesBundleIdGetToOneRelationship.Output.BadRequest.Body
5713 let chosenContentType = try converter.bestContentType(
5714 received: contentType,
5715 options: [
5716 "application/json"
5717 ]
5718 )
5719 switch chosenContentType {
5720 case "application/json":
5721 body = try await converter.getResponseBodyAsJSON(
5722 Components.Schemas.ErrorResponse.self,
5723 from: responseBody,
5724 transforming: { value in
5725 .json(value)
5726 }
5727 )
5728 default:
5729 preconditionFailure("bestContentType chose an invalid content type.")
5730 }
5731 return .badRequest(.init(body: body))
5732 case 401:
5733 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5734 let body: Operations.ProfilesBundleIdGetToOneRelationship.Output.Unauthorized.Body
5735 let chosenContentType = try converter.bestContentType(
5736 received: contentType,
5737 options: [
5738 "application/json"
5739 ]
5740 )
5741 switch chosenContentType {
5742 case "application/json":
5743 body = try await converter.getResponseBodyAsJSON(
5744 Components.Schemas.ErrorResponse.self,
5745 from: responseBody,
5746 transforming: { value in
5747 .json(value)
5748 }
5749 )
5750 default:
5751 preconditionFailure("bestContentType chose an invalid content type.")
5752 }
5753 return .unauthorized(.init(body: body))
5754 case 403:
5755 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5756 let body: Operations.ProfilesBundleIdGetToOneRelationship.Output.Forbidden.Body
5757 let chosenContentType = try converter.bestContentType(
5758 received: contentType,
5759 options: [
5760 "application/json"
5761 ]
5762 )
5763 switch chosenContentType {
5764 case "application/json":
5765 body = try await converter.getResponseBodyAsJSON(
5766 Components.Schemas.ErrorResponse.self,
5767 from: responseBody,
5768 transforming: { value in
5769 .json(value)
5770 }
5771 )
5772 default:
5773 preconditionFailure("bestContentType chose an invalid content type.")
5774 }
5775 return .forbidden(.init(body: body))
5776 case 404:
5777 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5778 let body: Operations.ProfilesBundleIdGetToOneRelationship.Output.NotFound.Body
5779 let chosenContentType = try converter.bestContentType(
5780 received: contentType,
5781 options: [
5782 "application/json"
5783 ]
5784 )
5785 switch chosenContentType {
5786 case "application/json":
5787 body = try await converter.getResponseBodyAsJSON(
5788 Components.Schemas.ErrorResponse.self,
5789 from: responseBody,
5790 transforming: { value in
5791 .json(value)
5792 }
5793 )
5794 default:
5795 preconditionFailure("bestContentType chose an invalid content type.")
5796 }
5797 return .notFound(.init(body: body))
5798 case 429:
5799 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5800 let body: Operations.ProfilesBundleIdGetToOneRelationship.Output.TooManyRequests.Body
5801 let chosenContentType = try converter.bestContentType(
5802 received: contentType,
5803 options: [
5804 "application/json"
5805 ]
5806 )
5807 switch chosenContentType {
5808 case "application/json":
5809 body = try await converter.getResponseBodyAsJSON(
5810 Components.Schemas.ErrorResponse.self,
5811 from: responseBody,
5812 transforming: { value in
5813 .json(value)
5814 }
5815 )
5816 default:
5817 preconditionFailure("bestContentType chose an invalid content type.")
5818 }
5819 return .tooManyRequests(.init(body: body))
5820 default:
5821 return .undocumented(
5822 statusCode: response.status.code,
5823 .init(
5824 headerFields: response.headerFields,
5825 body: responseBody
5826 )
5827 )
5828 }
5829 }
5830 )
5831 }
5832 /// - Remark: HTTP `GET /v1/profiles/{id}/bundleId`.
5833 /// - Remark: Generated from `#/paths//v1/profiles/{id}/bundleId/get(profiles_bundleId_getToOneRelated)`.
5834 public func profilesBundleIdGetToOneRelated(_ input: Operations.ProfilesBundleIdGetToOneRelated.Input) async throws -> Operations.ProfilesBundleIdGetToOneRelated.Output {
5835 try await client.send(
5836 input: input,
5837 forOperation: Operations.ProfilesBundleIdGetToOneRelated.id,
5838 serializer: { input in
5839 let path = try converter.renderedPath(
5840 template: "/v1/profiles/{}/bundleId",
5841 parameters: [
5842 input.path.id
5843 ]
5844 )
5845 var request: HTTPTypes.HTTPRequest = .init(
5846 soar_path: path,
5847 method: .get
5848 )
5849 suppressMutabilityWarning(&request)
5850 try converter.setQueryItemAsURI(
5851 in: &request,
5852 style: .form,
5853 explode: false,
5854 name: "fields[bundleIds]",
5855 value: input.query.fields_lbrack_bundleIds_rbrack_
5856 )
5857 converter.setAcceptHeader(
5858 in: &request.headerFields,
5859 contentTypes: input.headers.accept
5860 )
5861 return (request, nil)
5862 },
5863 deserializer: { response, responseBody in
5864 switch response.status.code {
5865 case 200:
5866 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5867 let body: Operations.ProfilesBundleIdGetToOneRelated.Output.Ok.Body
5868 let chosenContentType = try converter.bestContentType(
5869 received: contentType,
5870 options: [
5871 "application/json"
5872 ]
5873 )
5874 switch chosenContentType {
5875 case "application/json":
5876 body = try await converter.getResponseBodyAsJSON(
5877 Components.Schemas.BundleIdWithoutIncludesResponse.self,
5878 from: responseBody,
5879 transforming: { value in
5880 .json(value)
5881 }
5882 )
5883 default:
5884 preconditionFailure("bestContentType chose an invalid content type.")
5885 }
5886 return .ok(.init(body: body))
5887 case 400:
5888 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5889 let body: Operations.ProfilesBundleIdGetToOneRelated.Output.BadRequest.Body
5890 let chosenContentType = try converter.bestContentType(
5891 received: contentType,
5892 options: [
5893 "application/json"
5894 ]
5895 )
5896 switch chosenContentType {
5897 case "application/json":
5898 body = try await converter.getResponseBodyAsJSON(
5899 Components.Schemas.ErrorResponse.self,
5900 from: responseBody,
5901 transforming: { value in
5902 .json(value)
5903 }
5904 )
5905 default:
5906 preconditionFailure("bestContentType chose an invalid content type.")
5907 }
5908 return .badRequest(.init(body: body))
5909 case 401:
5910 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5911 let body: Operations.ProfilesBundleIdGetToOneRelated.Output.Unauthorized.Body
5912 let chosenContentType = try converter.bestContentType(
5913 received: contentType,
5914 options: [
5915 "application/json"
5916 ]
5917 )
5918 switch chosenContentType {
5919 case "application/json":
5920 body = try await converter.getResponseBodyAsJSON(
5921 Components.Schemas.ErrorResponse.self,
5922 from: responseBody,
5923 transforming: { value in
5924 .json(value)
5925 }
5926 )
5927 default:
5928 preconditionFailure("bestContentType chose an invalid content type.")
5929 }
5930 return .unauthorized(.init(body: body))
5931 case 403:
5932 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5933 let body: Operations.ProfilesBundleIdGetToOneRelated.Output.Forbidden.Body
5934 let chosenContentType = try converter.bestContentType(
5935 received: contentType,
5936 options: [
5937 "application/json"
5938 ]
5939 )
5940 switch chosenContentType {
5941 case "application/json":
5942 body = try await converter.getResponseBodyAsJSON(
5943 Components.Schemas.ErrorResponse.self,
5944 from: responseBody,
5945 transforming: { value in
5946 .json(value)
5947 }
5948 )
5949 default:
5950 preconditionFailure("bestContentType chose an invalid content type.")
5951 }
5952 return .forbidden(.init(body: body))
5953 case 404:
5954 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5955 let body: Operations.ProfilesBundleIdGetToOneRelated.Output.NotFound.Body
5956 let chosenContentType = try converter.bestContentType(
5957 received: contentType,
5958 options: [
5959 "application/json"
5960 ]
5961 )
5962 switch chosenContentType {
5963 case "application/json":
5964 body = try await converter.getResponseBodyAsJSON(
5965 Components.Schemas.ErrorResponse.self,
5966 from: responseBody,
5967 transforming: { value in
5968 .json(value)
5969 }
5970 )
5971 default:
5972 preconditionFailure("bestContentType chose an invalid content type.")
5973 }
5974 return .notFound(.init(body: body))
5975 case 429:
5976 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
5977 let body: Operations.ProfilesBundleIdGetToOneRelated.Output.TooManyRequests.Body
5978 let chosenContentType = try converter.bestContentType(
5979 received: contentType,
5980 options: [
5981 "application/json"
5982 ]
5983 )
5984 switch chosenContentType {
5985 case "application/json":
5986 body = try await converter.getResponseBodyAsJSON(
5987 Components.Schemas.ErrorResponse.self,
5988 from: responseBody,
5989 transforming: { value in
5990 .json(value)
5991 }
5992 )
5993 default:
5994 preconditionFailure("bestContentType chose an invalid content type.")
5995 }
5996 return .tooManyRequests(.init(body: body))
5997 default:
5998 return .undocumented(
5999 statusCode: response.status.code,
6000 .init(
6001 headerFields: response.headerFields,
6002 body: responseBody
6003 )
6004 )
6005 }
6006 }
6007 )
6008 }
6009 /// - Remark: HTTP `GET /v1/profiles/{id}/relationships/certificates`.
6010 /// - Remark: Generated from `#/paths//v1/profiles/{id}/relationships/certificates/get(profiles_certificates_getToManyRelationship)`.
6011 public func profilesCertificatesGetToManyRelationship(_ input: Operations.ProfilesCertificatesGetToManyRelationship.Input) async throws -> Operations.ProfilesCertificatesGetToManyRelationship.Output {
6012 try await client.send(
6013 input: input,
6014 forOperation: Operations.ProfilesCertificatesGetToManyRelationship.id,
6015 serializer: { input in
6016 let path = try converter.renderedPath(
6017 template: "/v1/profiles/{}/relationships/certificates",
6018 parameters: [
6019 input.path.id
6020 ]
6021 )
6022 var request: HTTPTypes.HTTPRequest = .init(
6023 soar_path: path,
6024 method: .get
6025 )
6026 suppressMutabilityWarning(&request)
6027 try converter.setQueryItemAsURI(
6028 in: &request,
6029 style: .form,
6030 explode: true,
6031 name: "limit",
6032 value: input.query.limit
6033 )
6034 converter.setAcceptHeader(
6035 in: &request.headerFields,
6036 contentTypes: input.headers.accept
6037 )
6038 return (request, nil)
6039 },
6040 deserializer: { response, responseBody in
6041 switch response.status.code {
6042 case 200:
6043 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6044 let body: Operations.ProfilesCertificatesGetToManyRelationship.Output.Ok.Body
6045 let chosenContentType = try converter.bestContentType(
6046 received: contentType,
6047 options: [
6048 "application/json"
6049 ]
6050 )
6051 switch chosenContentType {
6052 case "application/json":
6053 body = try await converter.getResponseBodyAsJSON(
6054 Components.Schemas.ProfileCertificatesLinkagesResponse.self,
6055 from: responseBody,
6056 transforming: { value in
6057 .json(value)
6058 }
6059 )
6060 default:
6061 preconditionFailure("bestContentType chose an invalid content type.")
6062 }
6063 return .ok(.init(body: body))
6064 case 400:
6065 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6066 let body: Operations.ProfilesCertificatesGetToManyRelationship.Output.BadRequest.Body
6067 let chosenContentType = try converter.bestContentType(
6068 received: contentType,
6069 options: [
6070 "application/json"
6071 ]
6072 )
6073 switch chosenContentType {
6074 case "application/json":
6075 body = try await converter.getResponseBodyAsJSON(
6076 Components.Schemas.ErrorResponse.self,
6077 from: responseBody,
6078 transforming: { value in
6079 .json(value)
6080 }
6081 )
6082 default:
6083 preconditionFailure("bestContentType chose an invalid content type.")
6084 }
6085 return .badRequest(.init(body: body))
6086 case 401:
6087 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6088 let body: Operations.ProfilesCertificatesGetToManyRelationship.Output.Unauthorized.Body
6089 let chosenContentType = try converter.bestContentType(
6090 received: contentType,
6091 options: [
6092 "application/json"
6093 ]
6094 )
6095 switch chosenContentType {
6096 case "application/json":
6097 body = try await converter.getResponseBodyAsJSON(
6098 Components.Schemas.ErrorResponse.self,
6099 from: responseBody,
6100 transforming: { value in
6101 .json(value)
6102 }
6103 )
6104 default:
6105 preconditionFailure("bestContentType chose an invalid content type.")
6106 }
6107 return .unauthorized(.init(body: body))
6108 case 403:
6109 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6110 let body: Operations.ProfilesCertificatesGetToManyRelationship.Output.Forbidden.Body
6111 let chosenContentType = try converter.bestContentType(
6112 received: contentType,
6113 options: [
6114 "application/json"
6115 ]
6116 )
6117 switch chosenContentType {
6118 case "application/json":
6119 body = try await converter.getResponseBodyAsJSON(
6120 Components.Schemas.ErrorResponse.self,
6121 from: responseBody,
6122 transforming: { value in
6123 .json(value)
6124 }
6125 )
6126 default:
6127 preconditionFailure("bestContentType chose an invalid content type.")
6128 }
6129 return .forbidden(.init(body: body))
6130 case 404:
6131 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6132 let body: Operations.ProfilesCertificatesGetToManyRelationship.Output.NotFound.Body
6133 let chosenContentType = try converter.bestContentType(
6134 received: contentType,
6135 options: [
6136 "application/json"
6137 ]
6138 )
6139 switch chosenContentType {
6140 case "application/json":
6141 body = try await converter.getResponseBodyAsJSON(
6142 Components.Schemas.ErrorResponse.self,
6143 from: responseBody,
6144 transforming: { value in
6145 .json(value)
6146 }
6147 )
6148 default:
6149 preconditionFailure("bestContentType chose an invalid content type.")
6150 }
6151 return .notFound(.init(body: body))
6152 case 429:
6153 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6154 let body: Operations.ProfilesCertificatesGetToManyRelationship.Output.TooManyRequests.Body
6155 let chosenContentType = try converter.bestContentType(
6156 received: contentType,
6157 options: [
6158 "application/json"
6159 ]
6160 )
6161 switch chosenContentType {
6162 case "application/json":
6163 body = try await converter.getResponseBodyAsJSON(
6164 Components.Schemas.ErrorResponse.self,
6165 from: responseBody,
6166 transforming: { value in
6167 .json(value)
6168 }
6169 )
6170 default:
6171 preconditionFailure("bestContentType chose an invalid content type.")
6172 }
6173 return .tooManyRequests(.init(body: body))
6174 default:
6175 return .undocumented(
6176 statusCode: response.status.code,
6177 .init(
6178 headerFields: response.headerFields,
6179 body: responseBody
6180 )
6181 )
6182 }
6183 }
6184 )
6185 }
6186 /// - Remark: HTTP `GET /v1/profiles/{id}/certificates`.
6187 /// - Remark: Generated from `#/paths//v1/profiles/{id}/certificates/get(profiles_certificates_getToManyRelated)`.
6188 public func profilesCertificatesGetToManyRelated(_ input: Operations.ProfilesCertificatesGetToManyRelated.Input) async throws -> Operations.ProfilesCertificatesGetToManyRelated.Output {
6189 try await client.send(
6190 input: input,
6191 forOperation: Operations.ProfilesCertificatesGetToManyRelated.id,
6192 serializer: { input in
6193 let path = try converter.renderedPath(
6194 template: "/v1/profiles/{}/certificates",
6195 parameters: [
6196 input.path.id
6197 ]
6198 )
6199 var request: HTTPTypes.HTTPRequest = .init(
6200 soar_path: path,
6201 method: .get
6202 )
6203 suppressMutabilityWarning(&request)
6204 try converter.setQueryItemAsURI(
6205 in: &request,
6206 style: .form,
6207 explode: false,
6208 name: "fields[certificates]",
6209 value: input.query.fields_lbrack_certificates_rbrack_
6210 )
6211 try converter.setQueryItemAsURI(
6212 in: &request,
6213 style: .form,
6214 explode: true,
6215 name: "limit",
6216 value: input.query.limit
6217 )
6218 converter.setAcceptHeader(
6219 in: &request.headerFields,
6220 contentTypes: input.headers.accept
6221 )
6222 return (request, nil)
6223 },
6224 deserializer: { response, responseBody in
6225 switch response.status.code {
6226 case 200:
6227 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6228 let body: Operations.ProfilesCertificatesGetToManyRelated.Output.Ok.Body
6229 let chosenContentType = try converter.bestContentType(
6230 received: contentType,
6231 options: [
6232 "application/json"
6233 ]
6234 )
6235 switch chosenContentType {
6236 case "application/json":
6237 body = try await converter.getResponseBodyAsJSON(
6238 Components.Schemas.CertificatesWithoutIncludesResponse.self,
6239 from: responseBody,
6240 transforming: { value in
6241 .json(value)
6242 }
6243 )
6244 default:
6245 preconditionFailure("bestContentType chose an invalid content type.")
6246 }
6247 return .ok(.init(body: body))
6248 case 400:
6249 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6250 let body: Operations.ProfilesCertificatesGetToManyRelated.Output.BadRequest.Body
6251 let chosenContentType = try converter.bestContentType(
6252 received: contentType,
6253 options: [
6254 "application/json"
6255 ]
6256 )
6257 switch chosenContentType {
6258 case "application/json":
6259 body = try await converter.getResponseBodyAsJSON(
6260 Components.Schemas.ErrorResponse.self,
6261 from: responseBody,
6262 transforming: { value in
6263 .json(value)
6264 }
6265 )
6266 default:
6267 preconditionFailure("bestContentType chose an invalid content type.")
6268 }
6269 return .badRequest(.init(body: body))
6270 case 401:
6271 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6272 let body: Operations.ProfilesCertificatesGetToManyRelated.Output.Unauthorized.Body
6273 let chosenContentType = try converter.bestContentType(
6274 received: contentType,
6275 options: [
6276 "application/json"
6277 ]
6278 )
6279 switch chosenContentType {
6280 case "application/json":
6281 body = try await converter.getResponseBodyAsJSON(
6282 Components.Schemas.ErrorResponse.self,
6283 from: responseBody,
6284 transforming: { value in
6285 .json(value)
6286 }
6287 )
6288 default:
6289 preconditionFailure("bestContentType chose an invalid content type.")
6290 }
6291 return .unauthorized(.init(body: body))
6292 case 403:
6293 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6294 let body: Operations.ProfilesCertificatesGetToManyRelated.Output.Forbidden.Body
6295 let chosenContentType = try converter.bestContentType(
6296 received: contentType,
6297 options: [
6298 "application/json"
6299 ]
6300 )
6301 switch chosenContentType {
6302 case "application/json":
6303 body = try await converter.getResponseBodyAsJSON(
6304 Components.Schemas.ErrorResponse.self,
6305 from: responseBody,
6306 transforming: { value in
6307 .json(value)
6308 }
6309 )
6310 default:
6311 preconditionFailure("bestContentType chose an invalid content type.")
6312 }
6313 return .forbidden(.init(body: body))
6314 case 404:
6315 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6316 let body: Operations.ProfilesCertificatesGetToManyRelated.Output.NotFound.Body
6317 let chosenContentType = try converter.bestContentType(
6318 received: contentType,
6319 options: [
6320 "application/json"
6321 ]
6322 )
6323 switch chosenContentType {
6324 case "application/json":
6325 body = try await converter.getResponseBodyAsJSON(
6326 Components.Schemas.ErrorResponse.self,
6327 from: responseBody,
6328 transforming: { value in
6329 .json(value)
6330 }
6331 )
6332 default:
6333 preconditionFailure("bestContentType chose an invalid content type.")
6334 }
6335 return .notFound(.init(body: body))
6336 case 429:
6337 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6338 let body: Operations.ProfilesCertificatesGetToManyRelated.Output.TooManyRequests.Body
6339 let chosenContentType = try converter.bestContentType(
6340 received: contentType,
6341 options: [
6342 "application/json"
6343 ]
6344 )
6345 switch chosenContentType {
6346 case "application/json":
6347 body = try await converter.getResponseBodyAsJSON(
6348 Components.Schemas.ErrorResponse.self,
6349 from: responseBody,
6350 transforming: { value in
6351 .json(value)
6352 }
6353 )
6354 default:
6355 preconditionFailure("bestContentType chose an invalid content type.")
6356 }
6357 return .tooManyRequests(.init(body: body))
6358 default:
6359 return .undocumented(
6360 statusCode: response.status.code,
6361 .init(
6362 headerFields: response.headerFields,
6363 body: responseBody
6364 )
6365 )
6366 }
6367 }
6368 )
6369 }
6370 /// - Remark: HTTP `GET /v1/profiles/{id}/relationships/devices`.
6371 /// - Remark: Generated from `#/paths//v1/profiles/{id}/relationships/devices/get(profiles_devices_getToManyRelationship)`.
6372 public func profilesDevicesGetToManyRelationship(_ input: Operations.ProfilesDevicesGetToManyRelationship.Input) async throws -> Operations.ProfilesDevicesGetToManyRelationship.Output {
6373 try await client.send(
6374 input: input,
6375 forOperation: Operations.ProfilesDevicesGetToManyRelationship.id,
6376 serializer: { input in
6377 let path = try converter.renderedPath(
6378 template: "/v1/profiles/{}/relationships/devices",
6379 parameters: [
6380 input.path.id
6381 ]
6382 )
6383 var request: HTTPTypes.HTTPRequest = .init(
6384 soar_path: path,
6385 method: .get
6386 )
6387 suppressMutabilityWarning(&request)
6388 try converter.setQueryItemAsURI(
6389 in: &request,
6390 style: .form,
6391 explode: true,
6392 name: "limit",
6393 value: input.query.limit
6394 )
6395 converter.setAcceptHeader(
6396 in: &request.headerFields,
6397 contentTypes: input.headers.accept
6398 )
6399 return (request, nil)
6400 },
6401 deserializer: { response, responseBody in
6402 switch response.status.code {
6403 case 200:
6404 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6405 let body: Operations.ProfilesDevicesGetToManyRelationship.Output.Ok.Body
6406 let chosenContentType = try converter.bestContentType(
6407 received: contentType,
6408 options: [
6409 "application/json"
6410 ]
6411 )
6412 switch chosenContentType {
6413 case "application/json":
6414 body = try await converter.getResponseBodyAsJSON(
6415 Components.Schemas.ProfileDevicesLinkagesResponse.self,
6416 from: responseBody,
6417 transforming: { value in
6418 .json(value)
6419 }
6420 )
6421 default:
6422 preconditionFailure("bestContentType chose an invalid content type.")
6423 }
6424 return .ok(.init(body: body))
6425 case 400:
6426 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6427 let body: Operations.ProfilesDevicesGetToManyRelationship.Output.BadRequest.Body
6428 let chosenContentType = try converter.bestContentType(
6429 received: contentType,
6430 options: [
6431 "application/json"
6432 ]
6433 )
6434 switch chosenContentType {
6435 case "application/json":
6436 body = try await converter.getResponseBodyAsJSON(
6437 Components.Schemas.ErrorResponse.self,
6438 from: responseBody,
6439 transforming: { value in
6440 .json(value)
6441 }
6442 )
6443 default:
6444 preconditionFailure("bestContentType chose an invalid content type.")
6445 }
6446 return .badRequest(.init(body: body))
6447 case 401:
6448 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6449 let body: Operations.ProfilesDevicesGetToManyRelationship.Output.Unauthorized.Body
6450 let chosenContentType = try converter.bestContentType(
6451 received: contentType,
6452 options: [
6453 "application/json"
6454 ]
6455 )
6456 switch chosenContentType {
6457 case "application/json":
6458 body = try await converter.getResponseBodyAsJSON(
6459 Components.Schemas.ErrorResponse.self,
6460 from: responseBody,
6461 transforming: { value in
6462 .json(value)
6463 }
6464 )
6465 default:
6466 preconditionFailure("bestContentType chose an invalid content type.")
6467 }
6468 return .unauthorized(.init(body: body))
6469 case 403:
6470 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6471 let body: Operations.ProfilesDevicesGetToManyRelationship.Output.Forbidden.Body
6472 let chosenContentType = try converter.bestContentType(
6473 received: contentType,
6474 options: [
6475 "application/json"
6476 ]
6477 )
6478 switch chosenContentType {
6479 case "application/json":
6480 body = try await converter.getResponseBodyAsJSON(
6481 Components.Schemas.ErrorResponse.self,
6482 from: responseBody,
6483 transforming: { value in
6484 .json(value)
6485 }
6486 )
6487 default:
6488 preconditionFailure("bestContentType chose an invalid content type.")
6489 }
6490 return .forbidden(.init(body: body))
6491 case 404:
6492 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6493 let body: Operations.ProfilesDevicesGetToManyRelationship.Output.NotFound.Body
6494 let chosenContentType = try converter.bestContentType(
6495 received: contentType,
6496 options: [
6497 "application/json"
6498 ]
6499 )
6500 switch chosenContentType {
6501 case "application/json":
6502 body = try await converter.getResponseBodyAsJSON(
6503 Components.Schemas.ErrorResponse.self,
6504 from: responseBody,
6505 transforming: { value in
6506 .json(value)
6507 }
6508 )
6509 default:
6510 preconditionFailure("bestContentType chose an invalid content type.")
6511 }
6512 return .notFound(.init(body: body))
6513 case 429:
6514 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6515 let body: Operations.ProfilesDevicesGetToManyRelationship.Output.TooManyRequests.Body
6516 let chosenContentType = try converter.bestContentType(
6517 received: contentType,
6518 options: [
6519 "application/json"
6520 ]
6521 )
6522 switch chosenContentType {
6523 case "application/json":
6524 body = try await converter.getResponseBodyAsJSON(
6525 Components.Schemas.ErrorResponse.self,
6526 from: responseBody,
6527 transforming: { value in
6528 .json(value)
6529 }
6530 )
6531 default:
6532 preconditionFailure("bestContentType chose an invalid content type.")
6533 }
6534 return .tooManyRequests(.init(body: body))
6535 default:
6536 return .undocumented(
6537 statusCode: response.status.code,
6538 .init(
6539 headerFields: response.headerFields,
6540 body: responseBody
6541 )
6542 )
6543 }
6544 }
6545 )
6546 }
6547 /// - Remark: HTTP `GET /v1/profiles/{id}/devices`.
6548 /// - Remark: Generated from `#/paths//v1/profiles/{id}/devices/get(profiles_devices_getToManyRelated)`.
6549 public func profilesDevicesGetToManyRelated(_ input: Operations.ProfilesDevicesGetToManyRelated.Input) async throws -> Operations.ProfilesDevicesGetToManyRelated.Output {
6550 try await client.send(
6551 input: input,
6552 forOperation: Operations.ProfilesDevicesGetToManyRelated.id,
6553 serializer: { input in
6554 let path = try converter.renderedPath(
6555 template: "/v1/profiles/{}/devices",
6556 parameters: [
6557 input.path.id
6558 ]
6559 )
6560 var request: HTTPTypes.HTTPRequest = .init(
6561 soar_path: path,
6562 method: .get
6563 )
6564 suppressMutabilityWarning(&request)
6565 try converter.setQueryItemAsURI(
6566 in: &request,
6567 style: .form,
6568 explode: false,
6569 name: "fields[devices]",
6570 value: input.query.fields_lbrack_devices_rbrack_
6571 )
6572 try converter.setQueryItemAsURI(
6573 in: &request,
6574 style: .form,
6575 explode: true,
6576 name: "limit",
6577 value: input.query.limit
6578 )
6579 converter.setAcceptHeader(
6580 in: &request.headerFields,
6581 contentTypes: input.headers.accept
6582 )
6583 return (request, nil)
6584 },
6585 deserializer: { response, responseBody in
6586 switch response.status.code {
6587 case 200:
6588 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6589 let body: Operations.ProfilesDevicesGetToManyRelated.Output.Ok.Body
6590 let chosenContentType = try converter.bestContentType(
6591 received: contentType,
6592 options: [
6593 "application/json"
6594 ]
6595 )
6596 switch chosenContentType {
6597 case "application/json":
6598 body = try await converter.getResponseBodyAsJSON(
6599 Components.Schemas.DevicesWithoutIncludesResponse.self,
6600 from: responseBody,
6601 transforming: { value in
6602 .json(value)
6603 }
6604 )
6605 default:
6606 preconditionFailure("bestContentType chose an invalid content type.")
6607 }
6608 return .ok(.init(body: body))
6609 case 400:
6610 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6611 let body: Operations.ProfilesDevicesGetToManyRelated.Output.BadRequest.Body
6612 let chosenContentType = try converter.bestContentType(
6613 received: contentType,
6614 options: [
6615 "application/json"
6616 ]
6617 )
6618 switch chosenContentType {
6619 case "application/json":
6620 body = try await converter.getResponseBodyAsJSON(
6621 Components.Schemas.ErrorResponse.self,
6622 from: responseBody,
6623 transforming: { value in
6624 .json(value)
6625 }
6626 )
6627 default:
6628 preconditionFailure("bestContentType chose an invalid content type.")
6629 }
6630 return .badRequest(.init(body: body))
6631 case 401:
6632 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6633 let body: Operations.ProfilesDevicesGetToManyRelated.Output.Unauthorized.Body
6634 let chosenContentType = try converter.bestContentType(
6635 received: contentType,
6636 options: [
6637 "application/json"
6638 ]
6639 )
6640 switch chosenContentType {
6641 case "application/json":
6642 body = try await converter.getResponseBodyAsJSON(
6643 Components.Schemas.ErrorResponse.self,
6644 from: responseBody,
6645 transforming: { value in
6646 .json(value)
6647 }
6648 )
6649 default:
6650 preconditionFailure("bestContentType chose an invalid content type.")
6651 }
6652 return .unauthorized(.init(body: body))
6653 case 403:
6654 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6655 let body: Operations.ProfilesDevicesGetToManyRelated.Output.Forbidden.Body
6656 let chosenContentType = try converter.bestContentType(
6657 received: contentType,
6658 options: [
6659 "application/json"
6660 ]
6661 )
6662 switch chosenContentType {
6663 case "application/json":
6664 body = try await converter.getResponseBodyAsJSON(
6665 Components.Schemas.ErrorResponse.self,
6666 from: responseBody,
6667 transforming: { value in
6668 .json(value)
6669 }
6670 )
6671 default:
6672 preconditionFailure("bestContentType chose an invalid content type.")
6673 }
6674 return .forbidden(.init(body: body))
6675 case 404:
6676 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6677 let body: Operations.ProfilesDevicesGetToManyRelated.Output.NotFound.Body
6678 let chosenContentType = try converter.bestContentType(
6679 received: contentType,
6680 options: [
6681 "application/json"
6682 ]
6683 )
6684 switch chosenContentType {
6685 case "application/json":
6686 body = try await converter.getResponseBodyAsJSON(
6687 Components.Schemas.ErrorResponse.self,
6688 from: responseBody,
6689 transforming: { value in
6690 .json(value)
6691 }
6692 )
6693 default:
6694 preconditionFailure("bestContentType chose an invalid content type.")
6695 }
6696 return .notFound(.init(body: body))
6697 case 429:
6698 let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
6699 let body: Operations.ProfilesDevicesGetToManyRelated.Output.TooManyRequests.Body
6700 let chosenContentType = try converter.bestContentType(
6701 received: contentType,
6702 options: [
6703 "application/json"
6704 ]
6705 )
6706 switch chosenContentType {
6707 case "application/json":
6708 body = try await converter.getResponseBodyAsJSON(
6709 Components.Schemas.ErrorResponse.self,
6710 from: responseBody,
6711 transforming: { value in
6712 .json(value)
6713 }
6714 )
6715 default:
6716 preconditionFailure("bestContentType chose an invalid content type.")
6717 }
6718 return .tooManyRequests(.init(body: body))
6719 default:
6720 return .undocumented(
6721 statusCode: response.status.code,
6722 .init(
6723 headerFields: response.headerFields,
6724 body: responseBody
6725 )
6726 )
6727 }
6728 }
6729 )
6730 }
6731}