Files
xtool-mirror/Sources/DeveloperAPI/Generated/Client.swift
2024-12-22 01:33:17 +05:30

4581 lines
211 KiB
Swift

// Generated by swift-openapi-generator, do not modify.
@_spi(Generated) import OpenAPIRuntime
#if os(Linux)
@preconcurrency import struct Foundation.URL
@preconcurrency import struct Foundation.Data
@preconcurrency import struct Foundation.Date
#else
import struct Foundation.URL
import struct Foundation.Data
import struct Foundation.Date
#endif
import HTTPTypes
public struct DeveloperAPIClient: APIProtocol {
/// The underlying HTTP client.
private let client: UniversalClient
/// Creates a new client.
/// - Parameters:
/// - serverURL: The server URL that the client connects to. Any server
/// URLs defined in the OpenAPI document are available as static methods
/// on the ``Servers`` type.
/// - configuration: A set of configuration values for the client.
/// - transport: A transport that performs HTTP operations.
/// - middlewares: A list of middlewares to call before the transport.
public init(
serverURL: Foundation.URL,
configuration: Configuration = .init(),
transport: any ClientTransport,
middlewares: [any ClientMiddleware] = []
) {
self.client = .init(
serverURL: serverURL,
configuration: configuration,
transport: transport,
middlewares: middlewares
)
}
private var converter: Converter {
client.converter
}
/// - Remark: HTTP `POST /v1/bundleIdCapabilities`.
/// - Remark: Generated from `#/paths//v1/bundleIdCapabilities/post(bundleIdCapabilities_createInstance)`.
public func bundleIdCapabilitiesCreateInstance(_ input: Operations.BundleIdCapabilitiesCreateInstance.Input) async throws -> Operations.BundleIdCapabilitiesCreateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdCapabilitiesCreateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIdCapabilities",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .post
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesCreateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesCreateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 201:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Created.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdCapabilityResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .created(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesCreateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `PATCH /v1/bundleIdCapabilities/{id}`.
/// - Remark: Generated from `#/paths//v1/bundleIdCapabilities/{id}/patch(bundleIdCapabilities_updateInstance)`.
public func bundleIdCapabilitiesUpdateInstance(_ input: Operations.BundleIdCapabilitiesUpdateInstance.Input) async throws -> Operations.BundleIdCapabilitiesUpdateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdCapabilitiesUpdateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIdCapabilities/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .patch
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdCapabilityResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesUpdateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `DELETE /v1/bundleIdCapabilities/{id}`.
/// - Remark: Generated from `#/paths//v1/bundleIdCapabilities/{id}/delete(bundleIdCapabilities_deleteInstance)`.
public func bundleIdCapabilitiesDeleteInstance(_ input: Operations.BundleIdCapabilitiesDeleteInstance.Input) async throws -> Operations.BundleIdCapabilitiesDeleteInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdCapabilitiesDeleteInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIdCapabilities/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .delete
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdCapabilitiesDeleteInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
case 204:
return .noContent(.init())
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/bundleIds`.
/// - Remark: Generated from `#/paths//v1/bundleIds/get(bundleIds_getCollection)`.
public func bundleIdsGetCollection(_ input: Operations.BundleIdsGetCollection.Input) async throws -> Operations.BundleIdsGetCollection.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsGetCollection.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[name]",
value: input.query.filter_lbrack_name_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[platform]",
value: input.query.filter_lbrack_platform_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[identifier]",
value: input.query.filter_lbrack_identifier_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[seedId]",
value: input.query.filter_lbrack_seedId_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[id]",
value: input.query.filter_lbrack_id_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "sort",
value: input.query.sort
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIds]",
value: input.query.fields_lbrack_bundleIds_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[profiles]",
value: input.query.fields_lbrack_profiles_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIdCapabilities]",
value: input.query.fields_lbrack_bundleIdCapabilities_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[apps]",
value: input.query.fields_lbrack_apps_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "include",
value: input.query.include
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[bundleIdCapabilities]",
value: input.query.limit_lbrack_bundleIdCapabilities_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[profiles]",
value: input.query.limit_lbrack_profiles_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetCollection.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetCollection.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetCollection.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetCollection.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdsResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `POST /v1/bundleIds`.
/// - Remark: Generated from `#/paths//v1/bundleIds/post(bundleIds_createInstance)`.
public func bundleIdsCreateInstance(_ input: Operations.BundleIdsCreateInstance.Input) async throws -> Operations.BundleIdsCreateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsCreateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .post
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsCreateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsCreateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsCreateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsCreateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 201:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsCreateInstance.Output.Created.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .created(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsCreateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/bundleIds/{id}`.
/// - Remark: Generated from `#/paths//v1/bundleIds/{id}/get(bundleIds_getInstance)`.
public func bundleIdsGetInstance(_ input: Operations.BundleIdsGetInstance.Input) async throws -> Operations.BundleIdsGetInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsGetInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIds]",
value: input.query.fields_lbrack_bundleIds_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[profiles]",
value: input.query.fields_lbrack_profiles_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIdCapabilities]",
value: input.query.fields_lbrack_bundleIdCapabilities_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[apps]",
value: input.query.fields_lbrack_apps_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "include",
value: input.query.include
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[bundleIdCapabilities]",
value: input.query.limit_lbrack_bundleIdCapabilities_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[profiles]",
value: input.query.limit_lbrack_profiles_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsGetInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `PATCH /v1/bundleIds/{id}`.
/// - Remark: Generated from `#/paths//v1/bundleIds/{id}/patch(bundleIds_updateInstance)`.
public func bundleIdsUpdateInstance(_ input: Operations.BundleIdsUpdateInstance.Input) async throws -> Operations.BundleIdsUpdateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsUpdateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .patch
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsUpdateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `DELETE /v1/bundleIds/{id}`.
/// - Remark: Generated from `#/paths//v1/bundleIds/{id}/delete(bundleIds_deleteInstance)`.
public func bundleIdsDeleteInstance(_ input: Operations.BundleIdsDeleteInstance.Input) async throws -> Operations.BundleIdsDeleteInstance.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsDeleteInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .delete
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsDeleteInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsDeleteInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsDeleteInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsDeleteInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsDeleteInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
case 204:
return .noContent(.init())
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/certificates`.
/// - Remark: Generated from `#/paths//v1/certificates/get(certificates_getCollection)`.
public func certificatesGetCollection(_ input: Operations.CertificatesGetCollection.Input) async throws -> Operations.CertificatesGetCollection.Output {
try await client.send(
input: input,
forOperation: Operations.CertificatesGetCollection.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/certificates",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[displayName]",
value: input.query.filter_lbrack_displayName_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[certificateType]",
value: input.query.filter_lbrack_certificateType_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[serialNumber]",
value: input.query.filter_lbrack_serialNumber_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[id]",
value: input.query.filter_lbrack_id_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "sort",
value: input.query.sort
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[certificates]",
value: input.query.fields_lbrack_certificates_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetCollection.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetCollection.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetCollection.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetCollection.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.CertificatesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `POST /v1/certificates`.
/// - Remark: Generated from `#/paths//v1/certificates/post(certificates_createInstance)`.
public func certificatesCreateInstance(_ input: Operations.CertificatesCreateInstance.Input) async throws -> Operations.CertificatesCreateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.CertificatesCreateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/certificates",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .post
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesCreateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesCreateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesCreateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesCreateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 201:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesCreateInstance.Output.Created.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.CertificateResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .created(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesCreateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/get(certificates_getInstance)`.
public func certificatesGetInstance(_ input: Operations.CertificatesGetInstance.Input) async throws -> Operations.CertificatesGetInstance.Output {
try await client.send(
input: input,
forOperation: Operations.CertificatesGetInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/certificates/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[certificates]",
value: input.query.fields_lbrack_certificates_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesGetInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.CertificateResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `DELETE /v1/certificates/{id}`.
/// - Remark: Generated from `#/paths//v1/certificates/{id}/delete(certificates_deleteInstance)`.
public func certificatesDeleteInstance(_ input: Operations.CertificatesDeleteInstance.Input) async throws -> Operations.CertificatesDeleteInstance.Output {
try await client.send(
input: input,
forOperation: Operations.CertificatesDeleteInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/certificates/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .delete
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesDeleteInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesDeleteInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesDeleteInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesDeleteInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.CertificatesDeleteInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
case 204:
return .noContent(.init())
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/devices`.
/// - Remark: Generated from `#/paths//v1/devices/get(devices_getCollection)`.
public func devicesGetCollection(_ input: Operations.DevicesGetCollection.Input) async throws -> Operations.DevicesGetCollection.Output {
try await client.send(
input: input,
forOperation: Operations.DevicesGetCollection.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/devices",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[name]",
value: input.query.filter_lbrack_name_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[platform]",
value: input.query.filter_lbrack_platform_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[udid]",
value: input.query.filter_lbrack_udid_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[status]",
value: input.query.filter_lbrack_status_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[id]",
value: input.query.filter_lbrack_id_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "sort",
value: input.query.sort
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[devices]",
value: input.query.fields_lbrack_devices_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetCollection.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetCollection.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetCollection.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetCollection.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.DevicesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `POST /v1/devices`.
/// - Remark: Generated from `#/paths//v1/devices/post(devices_createInstance)`.
public func devicesCreateInstance(_ input: Operations.DevicesCreateInstance.Input) async throws -> Operations.DevicesCreateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.DevicesCreateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/devices",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .post
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesCreateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesCreateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesCreateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesCreateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 201:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesCreateInstance.Output.Created.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.DeviceResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .created(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesCreateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/devices/{id}`.
/// - Remark: Generated from `#/paths//v1/devices/{id}/get(devices_getInstance)`.
public func devicesGetInstance(_ input: Operations.DevicesGetInstance.Input) async throws -> Operations.DevicesGetInstance.Output {
try await client.send(
input: input,
forOperation: Operations.DevicesGetInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/devices/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[devices]",
value: input.query.fields_lbrack_devices_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesGetInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.DeviceResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `PATCH /v1/devices/{id}`.
/// - Remark: Generated from `#/paths//v1/devices/{id}/patch(devices_updateInstance)`.
public func devicesUpdateInstance(_ input: Operations.DevicesUpdateInstance.Input) async throws -> Operations.DevicesUpdateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.DevicesUpdateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/devices/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .patch
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.DeviceResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.DevicesUpdateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/profiles`.
/// - Remark: Generated from `#/paths//v1/profiles/get(profiles_getCollection)`.
public func profilesGetCollection(_ input: Operations.ProfilesGetCollection.Input) async throws -> Operations.ProfilesGetCollection.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesGetCollection.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[name]",
value: input.query.filter_lbrack_name_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[profileType]",
value: input.query.filter_lbrack_profileType_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[profileState]",
value: input.query.filter_lbrack_profileState_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "filter[id]",
value: input.query.filter_lbrack_id_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "sort",
value: input.query.sort
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[profiles]",
value: input.query.fields_lbrack_profiles_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIds]",
value: input.query.fields_lbrack_bundleIds_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[devices]",
value: input.query.fields_lbrack_devices_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[certificates]",
value: input.query.fields_lbrack_certificates_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "include",
value: input.query.include
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[certificates]",
value: input.query.limit_lbrack_certificates_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[devices]",
value: input.query.limit_lbrack_devices_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetCollection.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetCollection.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetCollection.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetCollection.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ProfilesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `POST /v1/profiles`.
/// - Remark: Generated from `#/paths//v1/profiles/post(profiles_createInstance)`.
public func profilesCreateInstance(_ input: Operations.ProfilesCreateInstance.Input) async throws -> Operations.ProfilesCreateInstance.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesCreateInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles",
parameters: []
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .post
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
let body: OpenAPIRuntime.HTTPBody?
switch input.body {
case let .json(value):
body = try converter.setRequiredRequestBodyAsJSON(
value,
headerFields: &request.headerFields,
contentType: "application/json; charset=utf-8"
)
}
return (request, body)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCreateInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCreateInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCreateInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 422:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCreateInstance.Output.UnprocessableContent.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unprocessableContent(.init(body: body))
case 201:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCreateInstance.Output.Created.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ProfileResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .created(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCreateInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/profiles/{id}`.
/// - Remark: Generated from `#/paths//v1/profiles/{id}/get(profiles_getInstance)`.
public func profilesGetInstance(_ input: Operations.ProfilesGetInstance.Input) async throws -> Operations.ProfilesGetInstance.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesGetInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[profiles]",
value: input.query.fields_lbrack_profiles_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIds]",
value: input.query.fields_lbrack_bundleIds_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[devices]",
value: input.query.fields_lbrack_devices_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[certificates]",
value: input.query.fields_lbrack_certificates_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "include",
value: input.query.include
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[certificates]",
value: input.query.limit_lbrack_certificates_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit[devices]",
value: input.query.limit_lbrack_devices_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesGetInstance.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ProfileResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `DELETE /v1/profiles/{id}`.
/// - Remark: Generated from `#/paths//v1/profiles/{id}/delete(profiles_deleteInstance)`.
public func profilesDeleteInstance(_ input: Operations.ProfilesDeleteInstance.Input) async throws -> Operations.ProfilesDeleteInstance.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesDeleteInstance.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles/{}",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .delete
)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDeleteInstance.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDeleteInstance.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDeleteInstance.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDeleteInstance.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 409:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDeleteInstance.Output.Conflict.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .conflict(.init(body: body))
case 204:
return .noContent(.init())
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/bundleIds/{id}/app`.
/// - Remark: Generated from `#/paths//v1/bundleIds/{id}/app/get(bundleIds_app_getToOneRelated)`.
public func bundleIdsAppGetToOneRelated(_ input: Operations.BundleIdsAppGetToOneRelated.Input) async throws -> Operations.BundleIdsAppGetToOneRelated.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsAppGetToOneRelated.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds/{}/app",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[apps]",
value: input.query.fields_lbrack_apps_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsAppGetToOneRelated.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsAppGetToOneRelated.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsAppGetToOneRelated.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsAppGetToOneRelated.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsAppGetToOneRelated.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.AppWithoutIncludesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/bundleIds/{id}/bundleIdCapabilities`.
/// - Remark: Generated from `#/paths//v1/bundleIds/{id}/bundleIdCapabilities/get(bundleIds_bundleIdCapabilities_getToManyRelated)`.
public func bundleIdsBundleIdCapabilitiesGetToManyRelated(_ input: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Input) async throws -> Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds/{}/bundleIdCapabilities",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIdCapabilities]",
value: input.query.fields_lbrack_bundleIdCapabilities_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsBundleIdCapabilitiesGetToManyRelated.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdCapabilitiesWithoutIncludesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/bundleIds/{id}/profiles`.
/// - Remark: Generated from `#/paths//v1/bundleIds/{id}/profiles/get(bundleIds_profiles_getToManyRelated)`.
public func bundleIdsProfilesGetToManyRelated(_ input: Operations.BundleIdsProfilesGetToManyRelated.Input) async throws -> Operations.BundleIdsProfilesGetToManyRelated.Output {
try await client.send(
input: input,
forOperation: Operations.BundleIdsProfilesGetToManyRelated.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/bundleIds/{}/profiles",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[profiles]",
value: input.query.fields_lbrack_profiles_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsProfilesGetToManyRelated.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsProfilesGetToManyRelated.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsProfilesGetToManyRelated.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsProfilesGetToManyRelated.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.BundleIdsProfilesGetToManyRelated.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ProfilesWithoutIncludesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/profiles/{id}/bundleId`.
/// - Remark: Generated from `#/paths//v1/profiles/{id}/bundleId/get(profiles_bundleId_getToOneRelated)`.
public func profilesBundleIdGetToOneRelated(_ input: Operations.ProfilesBundleIdGetToOneRelated.Input) async throws -> Operations.ProfilesBundleIdGetToOneRelated.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesBundleIdGetToOneRelated.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles/{}/bundleId",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[bundleIds]",
value: input.query.fields_lbrack_bundleIds_rbrack_
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesBundleIdGetToOneRelated.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesBundleIdGetToOneRelated.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesBundleIdGetToOneRelated.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesBundleIdGetToOneRelated.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesBundleIdGetToOneRelated.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.BundleIdWithoutIncludesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/profiles/{id}/certificates`.
/// - Remark: Generated from `#/paths//v1/profiles/{id}/certificates/get(profiles_certificates_getToManyRelated)`.
public func profilesCertificatesGetToManyRelated(_ input: Operations.ProfilesCertificatesGetToManyRelated.Input) async throws -> Operations.ProfilesCertificatesGetToManyRelated.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesCertificatesGetToManyRelated.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles/{}/certificates",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[certificates]",
value: input.query.fields_lbrack_certificates_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCertificatesGetToManyRelated.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCertificatesGetToManyRelated.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCertificatesGetToManyRelated.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCertificatesGetToManyRelated.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesCertificatesGetToManyRelated.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.CertificatesWithoutIncludesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// - Remark: HTTP `GET /v1/profiles/{id}/devices`.
/// - Remark: Generated from `#/paths//v1/profiles/{id}/devices/get(profiles_devices_getToManyRelated)`.
public func profilesDevicesGetToManyRelated(_ input: Operations.ProfilesDevicesGetToManyRelated.Input) async throws -> Operations.ProfilesDevicesGetToManyRelated.Output {
try await client.send(
input: input,
forOperation: Operations.ProfilesDevicesGetToManyRelated.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v1/profiles/{}/devices",
parameters: [
input.path.id
]
)
var request: HTTPTypes.HTTPRequest = .init(
soar_path: path,
method: .get
)
suppressMutabilityWarning(&request)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: false,
name: "fields[devices]",
value: input.query.fields_lbrack_devices_rbrack_
)
try converter.setQueryItemAsURI(
in: &request,
style: .form,
explode: true,
name: "limit",
value: input.query.limit
)
converter.setAcceptHeader(
in: &request.headerFields,
contentTypes: input.headers.accept
)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 400:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDevicesGetToManyRelated.Output.BadRequest.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .badRequest(.init(body: body))
case 401:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDevicesGetToManyRelated.Output.Unauthorized.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .unauthorized(.init(body: body))
case 403:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDevicesGetToManyRelated.Output.Forbidden.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .forbidden(.init(body: body))
case 404:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDevicesGetToManyRelated.Output.NotFound.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ErrorResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .notFound(.init(body: body))
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.ProfilesDevicesGetToManyRelated.Output.Ok.Body
let chosenContentType = try converter.bestContentType(
received: contentType,
options: [
"application/json"
]
)
switch chosenContentType {
case "application/json":
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.DevicesWithoutIncludesResponse.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
}