From c96ec85238722a097a96833d59465dbbeb9a9ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20M=C3=BCller-Seydlitz?= Date: Fri, 16 Aug 2024 21:15:05 +0200 Subject: [PATCH] Manually modifying openapi - JerseyResponseBuilderDTO for response to create event subscription, Allowing for X-Atmosphere-Transport for long-polling, SitemapWidgetEvent for server side events Experimenting with SSE consumption Include Client and Types to make it compile on github Shifted logging to dedicated ClientMiddleware Created class OpenHABSitemapWidgetEvent Modified openapi to include sitemapName and pageId in SitemapWidgetEvent Getting server sent events working - establishing a subscription and receiving events , not yet consuming / Commented out in OpenHABSitemapViewController --- .gitignore | 3 +- .../GeneratedSources/openapi/Client.swift | 1967 +++++ .../GeneratedSources/openapi/Types.swift | 7295 +++++++++++++++++ .../Sources/OpenHABCore/Model/APIActor.swift | 169 +- .../OpenHABCore/Model/LoggingMiddleware.swift | 115 + .../OpenHABCore/Model/OpenHABItem.swift | 2 +- .../Sources/OpenHABCore/openapi/openapi.json | 107 +- .../OpenHABDrawerTableViewController.swift | 25 +- openHAB/OpenHABSitemapViewController.swift | 25 +- openHAB/OpenHABWebViewController.swift | 1 - 10 files changed, 9647 insertions(+), 62 deletions(-) create mode 100644 OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Client.swift create mode 100644 OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Types.swift create mode 100644 OpenHABCore/Sources/OpenHABCore/Model/LoggingMiddleware.swift diff --git a/.gitignore b/.gitignore index 92c6fa79..5999bc48 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,6 @@ build/ BuildTools/.build OpenHABCore/Package.resolved -OpenHABCore/Sources/OpenHABCore/GeneratedSources + +#OpenHABCore/Sources/OpenHABCore/GeneratedSources OpenHABCore/swift-openapi-generator diff --git a/OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Client.swift b/OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Client.swift new file mode 100644 index 00000000..9f0f22bf --- /dev/null +++ b/OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Client.swift @@ -0,0 +1,1967 @@ +// Copyright (c) 2010-2024 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +@preconcurrency import struct Foundation.URL +#else +import struct Foundation.Data +import struct Foundation.Date +import struct Foundation.URL +#endif +import HTTPTypes + +struct Client: 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. + init(serverURL: Foundation.URL, + configuration: Configuration = .init(), + transport: any ClientTransport, + middlewares: [any ClientMiddleware] = []) { + client = .init( + serverURL: serverURL, + configuration: configuration, + transport: transport, + middlewares: middlewares + ) + } + + private var converter: Converter { + client.converter + } + + /// Adds a new member to a group item. + /// + /// - Remark: HTTP `PUT /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)`. + func addMemberToGroupItem(_ input: Operations.addMemberToGroupItem.Input) async throws -> Operations.addMemberToGroupItem.Output { + try await client.send( + input: input, + forOperation: Operations.addMemberToGroupItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/members/{}", + parameters: [ + input.path.itemName, + input.path.memberItemName + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + case 405: + .methodNotAllowed(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Removes an existing member from a group item. + /// + /// - Remark: HTTP `DELETE /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)`. + func removeMemberFromGroupItem(_ input: Operations.removeMemberFromGroupItem.Input) async throws -> Operations.removeMemberFromGroupItem.Output { + try await client.send( + input: input, + forOperation: Operations.removeMemberFromGroupItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/members/{}", + parameters: [ + input.path.itemName, + input.path.memberItemName + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + case 405: + .methodNotAllowed(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Adds metadata to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)`. + func addMetadataToItem(_ input: Operations.addMetadataToItem.Input) async throws -> Operations.addMetadataToItem.Output { + try await client.send( + input: input, + forOperation: Operations.addMetadataToItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/metadata/{}", + parameters: [ + input.path.itemname, + input.path.namespace + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + let body: OpenAPIRuntime.HTTPBody? = switch input.body { + case let .json(value): + 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 200: + .ok(.init()) + case 201: + .created(.init()) + case 400: + .badRequest(.init()) + case 404: + .notFound(.init()) + case 405: + .methodNotAllowed(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Removes metadata from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)`. + func removeMetadataFromItem(_ input: Operations.removeMetadataFromItem.Input) async throws -> Operations.removeMetadataFromItem.Output { + try await client.send( + input: input, + forOperation: Operations.removeMetadataFromItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/metadata/{}", + parameters: [ + input.path.itemname, + input.path.namespace + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + case 405: + .methodNotAllowed(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Adds a tag to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)`. + func addTagToItem(_ input: Operations.addTagToItem.Input) async throws -> Operations.addTagToItem.Output { + try await client.send( + input: input, + forOperation: Operations.addTagToItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/tags/{}", + parameters: [ + input.path.itemname, + input.path.tag + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + case 405: + .methodNotAllowed(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Removes a tag from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)`. + func removeTagFromItem(_ input: Operations.removeTagFromItem.Input) async throws -> Operations.removeTagFromItem.Output { + try await client.send( + input: input, + forOperation: Operations.removeTagFromItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/tags/{}", + parameters: [ + input.path.itemname, + input.path.tag + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + case 405: + .methodNotAllowed(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Gets a single item. + /// + /// - Remark: HTTP `GET /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/get(getItemByName)`. + func getItemByName(_ input: Operations.getItemByName.Input) async throws -> Operations.getItemByName.Output { + try await client.send( + input: input, + forOperation: Operations.getItemByName.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "metadata", + value: input.query.metadata + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "recursive", + value: input.query.recursive + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getItemByName.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.EnrichedItemDTO.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Sends a command to an item. + /// + /// - Remark: HTTP `POST /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)`. + func sendItemCommand(_ input: Operations.sendItemCommand.Input) async throws -> Operations.sendItemCommand.Output { + try await client.send( + input: input, + forOperation: Operations.sendItemCommand.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + let body: OpenAPIRuntime.HTTPBody? = switch input.body { + case let .plainText(value): + try converter.setRequiredRequestBodyAsBinary( + value, + headerFields: &request.headerFields, + contentType: "text/plain" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 400: + .badRequest(.init()) + case 404: + .notFound(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Adds a new item to the registry or updates the existing item. + /// + /// - Remark: HTTP `PUT /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)`. + func addOrUpdateItemInRegistry(_ input: Operations.addOrUpdateItemInRegistry.Input) async throws -> Operations.addOrUpdateItemInRegistry.Output { + try await client.send( + input: input, + forOperation: Operations.addOrUpdateItemInRegistry.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? = switch input.body { + case let .json(value): + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.addOrUpdateItemInRegistry.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "*/*" + ] + ) + switch chosenContentType { + case "*/*": + body = try converter.getResponseBodyAsBinary( + OpenAPIRuntime.HTTPBody.self, + from: responseBody, + transforming: { value in + .any(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 201: + return .created(.init()) + case 400: + return .badRequest(.init()) + case 404: + return .notFound(.init()) + case 405: + return .methodNotAllowed(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Removes an item from the registry. + /// + /// - Remark: HTTP `DELETE /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/delete(removeItemFromRegistry)`. + func removeItemFromRegistry(_ input: Operations.removeItemFromRegistry.Input) async throws -> Operations.removeItemFromRegistry.Output { + try await client.send( + input: input, + forOperation: Operations.removeItemFromRegistry.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Get all available items. + /// + /// - Remark: HTTP `GET /items`. + /// - Remark: Generated from `#/paths//items/get(getItems)`. + func getItems(_ input: Operations.getItems.Input) async throws -> Operations.getItems.Output { + try await client.send( + input: input, + forOperation: Operations.getItems.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "type", + value: input.query._type + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "tags", + value: input.query.tags + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "metadata", + value: input.query.metadata + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "recursive", + value: input.query.recursive + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "fields", + value: input.query.fields + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "staticDataOnly", + value: input.query.staticDataOnly + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getItems.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.EnrichedItemDTO].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 + ) + ) + } + } + ) + } + + /// Adds a list of items to the registry or updates the existing items. + /// + /// - Remark: HTTP `PUT /items`. + /// - Remark: Generated from `#/paths//items/put(addOrUpdateItemsInRegistry)`. + func addOrUpdateItemsInRegistry(_ input: Operations.addOrUpdateItemsInRegistry.Input) async throws -> Operations.addOrUpdateItemsInRegistry.Output { + try await client.send( + input: input, + forOperation: Operations.addOrUpdateItemsInRegistry.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? = switch input.body { + case let .json(value): + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.addOrUpdateItemsInRegistry.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "*/*" + ] + ) + switch chosenContentType { + case "*/*": + body = try converter.getResponseBodyAsBinary( + OpenAPIRuntime.HTTPBody.self, + from: responseBody, + transforming: { value in + .any(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + return .badRequest(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Gets the state of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/get(getItemState_1)`. + func getItemState_1(_ input: Operations.getItemState_1.Input) async throws -> Operations.getItemState_1.Output { + try await client.send( + input: input, + forOperation: Operations.getItemState_1.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/state", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getItemState_1.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "text/plain" + ] + ) + switch chosenContentType { + case "text/plain": + body = try converter.getResponseBodyAsBinary( + OpenAPIRuntime.HTTPBody.self, + from: responseBody, + transforming: { value in + .plainText(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Updates the state of an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)`. + func updateItemState(_ input: Operations.updateItemState.Input) async throws -> Operations.updateItemState.Output { + try await client.send( + input: input, + forOperation: Operations.updateItemState.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/state", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + let body: OpenAPIRuntime.HTTPBody? = switch input.body { + case let .plainText(value): + try converter.setRequiredRequestBodyAsBinary( + value, + headerFields: &request.headerFields, + contentType: "text/plain" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 202: + .accepted(.init()) + case 400: + .badRequest(.init()) + case 404: + .notFound(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Gets the namespace of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/metadata/namespaces`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/namespaces/get(getItemNamespaces)`. + func getItemNamespaces(_ input: Operations.getItemNamespaces.Input) async throws -> Operations.getItemNamespaces.Output { + try await client.send( + input: input, + forOperation: Operations.getItemNamespaces.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/metadata/namespaces", + parameters: [ + input.path.itemname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getItemNamespaces.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Swift.String.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Gets the item which defines the requested semantics of an item. + /// + /// - Remark: HTTP `GET /items/{itemName}/semantic/{semanticClass}`. + /// - Remark: Generated from `#/paths//items/{itemName}/semantic/{semanticClass}/get(getSemanticItem)`. + func getSemanticItem(_ input: Operations.getSemanticItem.Input) async throws -> Operations.getSemanticItem.Output { + try await client.send( + input: input, + forOperation: Operations.getSemanticItem.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/items/{}/semantic/{}", + parameters: [ + input.path.itemName, + input.path.semanticClass + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Remove unused/orphaned metadata. + /// + /// - Remark: HTTP `POST /items/metadata/purge`. + /// - Remark: Generated from `#/paths//items/metadata/purge/post(purgeDatabase)`. + func purgeDatabase(_ input: Operations.purgeDatabase.Input) async throws -> Operations.purgeDatabase.Output { + try await client.send( + input: input, + forOperation: Operations.purgeDatabase.id, + serializer: { _ in + let path = try converter.renderedPath( + template: "/items/metadata/purge", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Creates a sitemap event subscription. + /// + /// - Remark: HTTP `POST /sitemaps/events/subscribe`. + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)`. + func createSitemapEventSubscription(_ input: Operations.createSitemapEventSubscription.Input) async throws -> Operations.createSitemapEventSubscription.Output { + try await client.send( + input: input, + forOperation: Operations.createSitemapEventSubscription.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps/events/subscribe", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 201: + return .created(.init()) + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.createSitemapEventSubscription.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.JerseyResponseBuilderDTO.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 503: + return .serviceUnavailable(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Polls the data for one page of a sitemap. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/{pageid}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)`. + func pollDataForPage(_ input: Operations.pollDataForPage.Input) async throws -> Operations.pollDataForPage.Output { + try await client.send( + input: input, + forOperation: Operations.pollDataForPage.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps/{}/{}", + parameters: [ + input.path.sitemapname, + input.path.pageid + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "X-Atmosphere-Transport", + value: input.headers.X_hyphen_Atmosphere_hyphen_Transport + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "subscriptionid", + value: input.query.subscriptionid + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "includeHidden", + value: input.query.includeHidden + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.pollDataForPage.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.PageDTO.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + return .badRequest(.init()) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Polls the data for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/*`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)`. + func pollDataForSitemap(_ input: Operations.pollDataForSitemap.Input) async throws -> Operations.pollDataForSitemap.Output { + try await client.send( + input: input, + forOperation: Operations.pollDataForSitemap.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps/{}/*", + parameters: [ + input.path.sitemapname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "X-Atmosphere-Transport", + value: input.headers.X_hyphen_Atmosphere_hyphen_Transport + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "subscriptionid", + value: input.query.subscriptionid + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "includeHidden", + value: input.query.includeHidden + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.pollDataForSitemap.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.SitemapDTO.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + return .badRequest(.init()) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Get sitemap by name. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/get(getSitemapByName)`. + func getSitemapByName(_ input: Operations.getSitemapByName.Input) async throws -> Operations.getSitemapByName.Output { + try await client.send( + input: input, + forOperation: Operations.getSitemapByName.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps/{}", + parameters: [ + input.path.sitemapname + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setHeaderFieldAsURI( + in: &request.headerFields, + name: "Accept-Language", + value: input.headers.Accept_hyphen_Language + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "type", + value: input.query._type + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "jsoncallback", + value: input.query.jsoncallback + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "includeHidden", + value: input.query.includeHidden + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getSitemapByName.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.SitemapDTO.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 + ) + ) + } + } + ) + } + + /// Get sitemap events for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}/*`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)`. + func getSitemapEvents(_ input: Operations.getSitemapEvents.Input) async throws -> Operations.getSitemapEvents.Output { + try await client.send( + input: input, + forOperation: Operations.getSitemapEvents.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps/events/{}/*", + parameters: [ + input.path.subscriptionid + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "sitemap", + value: input.query.sitemap + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 400: + .badRequest(.init()) + case 404: + .notFound(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Get sitemap events. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)`. + func getSitemapEvents_1(_ input: Operations.getSitemapEvents_1.Input) async throws -> Operations.getSitemapEvents_1.Output { + try await client.send( + input: input, + forOperation: Operations.getSitemapEvents_1.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps/events/{}", + parameters: [ + input.path.subscriptionid + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "sitemap", + value: input.query.sitemap + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "pageid", + value: input.query.pageid + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getSitemapEvents_1.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "text/event-stream", + "application/json" + ] + ) + switch chosenContentType { + case "text/event-stream": + body = try converter.getResponseBodyAsBinary( + OpenAPIRuntime.HTTPBody.self, + from: responseBody, + transforming: { value in + .text_event_hyphen_stream(value) + } + ) + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.SitemapWidgetEvent.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + return .badRequest(.init()) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Get all available sitemaps. + /// + /// - Remark: HTTP `GET /sitemaps`. + /// - Remark: Generated from `#/paths//sitemaps/get(getSitemaps)`. + func getSitemaps(_ input: Operations.getSitemaps.Input) async throws -> Operations.getSitemaps.Output { + try await client.send( + input: input, + forOperation: Operations.getSitemaps.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/sitemaps", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getSitemaps.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.SitemapDTO].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 + ) + ) + } + } + ) + } + + /// Get all registered UI components in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/get(getRegisteredUIComponentsInNamespace)`. + func getRegisteredUIComponentsInNamespace(_ input: Operations.getRegisteredUIComponentsInNamespace.Input) async throws -> Operations.getRegisteredUIComponentsInNamespace.Output { + try await client.send( + input: input, + forOperation: Operations.getRegisteredUIComponentsInNamespace.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ui/components/{}", + parameters: [ + input.path.namespace + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "summary", + value: input.query.summary + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getRegisteredUIComponentsInNamespace.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.RootUIComponent].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 + ) + ) + } + } + ) + } + + /// Add a UI component in the specified namespace. + /// + /// - Remark: HTTP `POST /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/post(addUIComponentToNamespace)`. + func addUIComponentToNamespace(_ input: Operations.addUIComponentToNamespace.Input) async throws -> Operations.addUIComponentToNamespace.Output { + try await client.send( + input: input, + forOperation: Operations.addUIComponentToNamespace.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ui/components/{}", + parameters: [ + input.path.namespace + ] + ) + 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 .none: + nil + case let .json(value): + try converter.setOptionalRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.addUIComponentToNamespace.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.RootUIComponent.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 + ) + ) + } + } + ) + } + + /// Get a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/get(getUIComponentInNamespace)`. + func getUIComponentInNamespace(_ input: Operations.getUIComponentInNamespace.Input) async throws -> Operations.getUIComponentInNamespace.Output { + try await client.send( + input: input, + forOperation: Operations.getUIComponentInNamespace.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ui/components/{}/{}", + parameters: [ + input.path.namespace, + input.path.componentUID + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getUIComponentInNamespace.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.RootUIComponent.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Update a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `PUT /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/put(updateUIComponentInNamespace)`. + func updateUIComponentInNamespace(_ input: Operations.updateUIComponentInNamespace.Input) async throws -> Operations.updateUIComponentInNamespace.Output { + try await client.send( + input: input, + forOperation: Operations.updateUIComponentInNamespace.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ui/components/{}/{}", + parameters: [ + input.path.namespace, + input.path.componentUID + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? = switch input.body { + case .none: + nil + case let .json(value): + try converter.setOptionalRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.updateUIComponentInNamespace.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.RootUIComponent.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 404: + return .notFound(.init()) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Remove a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `DELETE /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/delete(removeUIComponentFromNamespace)`. + func removeUIComponentFromNamespace(_ input: Operations.removeUIComponentFromNamespace.Input) async throws -> Operations.removeUIComponentFromNamespace.Output { + try await client.send( + input: input, + forOperation: Operations.removeUIComponentFromNamespace.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ui/components/{}/{}", + parameters: [ + input.path.namespace, + input.path.componentUID + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + .ok(.init()) + case 404: + .notFound(.init()) + default: + .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + + /// Get all registered UI tiles. + /// + /// - Remark: HTTP `GET /ui/tiles`. + /// - Remark: Generated from `#/paths//ui/tiles/get(getUITiles)`. + func getUITiles(_ input: Operations.getUITiles.Input) async throws -> Operations.getUITiles.Output { + try await client.send( + input: input, + forOperation: Operations.getUITiles.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/ui/tiles", + parameters: [] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.getUITiles.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.TileDTO].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 + ) + ) + } + } + ) + } +} diff --git a/OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Types.swift b/OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Types.swift new file mode 100644 index 00000000..23afee90 --- /dev/null +++ b/OpenHABCore/Sources/OpenHABCore/GeneratedSources/openapi/Types.swift @@ -0,0 +1,7295 @@ +// Copyright (c) 2010-2024 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +@preconcurrency import struct Foundation.URL +#else +import struct Foundation.Data +import struct Foundation.Date +import struct Foundation.URL +#endif +/// A type that performs HTTP operations defined by the OpenAPI document. +protocol APIProtocol: Sendable { + /// Adds a new member to a group item. + /// + /// - Remark: HTTP `PUT /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)`. + func addMemberToGroupItem(_ input: Operations.addMemberToGroupItem.Input) async throws -> Operations.addMemberToGroupItem.Output + /// Removes an existing member from a group item. + /// + /// - Remark: HTTP `DELETE /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)`. + func removeMemberFromGroupItem(_ input: Operations.removeMemberFromGroupItem.Input) async throws -> Operations.removeMemberFromGroupItem.Output + /// Adds metadata to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)`. + func addMetadataToItem(_ input: Operations.addMetadataToItem.Input) async throws -> Operations.addMetadataToItem.Output + /// Removes metadata from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)`. + func removeMetadataFromItem(_ input: Operations.removeMetadataFromItem.Input) async throws -> Operations.removeMetadataFromItem.Output + /// Adds a tag to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)`. + func addTagToItem(_ input: Operations.addTagToItem.Input) async throws -> Operations.addTagToItem.Output + /// Removes a tag from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)`. + func removeTagFromItem(_ input: Operations.removeTagFromItem.Input) async throws -> Operations.removeTagFromItem.Output + /// Gets a single item. + /// + /// - Remark: HTTP `GET /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/get(getItemByName)`. + func getItemByName(_ input: Operations.getItemByName.Input) async throws -> Operations.getItemByName.Output + /// Sends a command to an item. + /// + /// - Remark: HTTP `POST /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)`. + func sendItemCommand(_ input: Operations.sendItemCommand.Input) async throws -> Operations.sendItemCommand.Output + /// Adds a new item to the registry or updates the existing item. + /// + /// - Remark: HTTP `PUT /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)`. + func addOrUpdateItemInRegistry(_ input: Operations.addOrUpdateItemInRegistry.Input) async throws -> Operations.addOrUpdateItemInRegistry.Output + /// Removes an item from the registry. + /// + /// - Remark: HTTP `DELETE /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/delete(removeItemFromRegistry)`. + func removeItemFromRegistry(_ input: Operations.removeItemFromRegistry.Input) async throws -> Operations.removeItemFromRegistry.Output + /// Get all available items. + /// + /// - Remark: HTTP `GET /items`. + /// - Remark: Generated from `#/paths//items/get(getItems)`. + func getItems(_ input: Operations.getItems.Input) async throws -> Operations.getItems.Output + /// Adds a list of items to the registry or updates the existing items. + /// + /// - Remark: HTTP `PUT /items`. + /// - Remark: Generated from `#/paths//items/put(addOrUpdateItemsInRegistry)`. + func addOrUpdateItemsInRegistry(_ input: Operations.addOrUpdateItemsInRegistry.Input) async throws -> Operations.addOrUpdateItemsInRegistry.Output + /// Gets the state of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/get(getItemState_1)`. + func getItemState_1(_ input: Operations.getItemState_1.Input) async throws -> Operations.getItemState_1.Output + /// Updates the state of an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)`. + func updateItemState(_ input: Operations.updateItemState.Input) async throws -> Operations.updateItemState.Output + /// Gets the namespace of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/metadata/namespaces`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/namespaces/get(getItemNamespaces)`. + func getItemNamespaces(_ input: Operations.getItemNamespaces.Input) async throws -> Operations.getItemNamespaces.Output + /// Gets the item which defines the requested semantics of an item. + /// + /// - Remark: HTTP `GET /items/{itemName}/semantic/{semanticClass}`. + /// - Remark: Generated from `#/paths//items/{itemName}/semantic/{semanticClass}/get(getSemanticItem)`. + func getSemanticItem(_ input: Operations.getSemanticItem.Input) async throws -> Operations.getSemanticItem.Output + /// Remove unused/orphaned metadata. + /// + /// - Remark: HTTP `POST /items/metadata/purge`. + /// - Remark: Generated from `#/paths//items/metadata/purge/post(purgeDatabase)`. + func purgeDatabase(_ input: Operations.purgeDatabase.Input) async throws -> Operations.purgeDatabase.Output + /// Creates a sitemap event subscription. + /// + /// - Remark: HTTP `POST /sitemaps/events/subscribe`. + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)`. + func createSitemapEventSubscription(_ input: Operations.createSitemapEventSubscription.Input) async throws -> Operations.createSitemapEventSubscription.Output + /// Polls the data for one page of a sitemap. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/{pageid}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)`. + func pollDataForPage(_ input: Operations.pollDataForPage.Input) async throws -> Operations.pollDataForPage.Output + /// Polls the data for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/*`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)`. + func pollDataForSitemap(_ input: Operations.pollDataForSitemap.Input) async throws -> Operations.pollDataForSitemap.Output + /// Get sitemap by name. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/get(getSitemapByName)`. + func getSitemapByName(_ input: Operations.getSitemapByName.Input) async throws -> Operations.getSitemapByName.Output + /// Get sitemap events for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}/*`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)`. + func getSitemapEvents(_ input: Operations.getSitemapEvents.Input) async throws -> Operations.getSitemapEvents.Output + /// Get sitemap events. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)`. + func getSitemapEvents_1(_ input: Operations.getSitemapEvents_1.Input) async throws -> Operations.getSitemapEvents_1.Output + /// Get all available sitemaps. + /// + /// - Remark: HTTP `GET /sitemaps`. + /// - Remark: Generated from `#/paths//sitemaps/get(getSitemaps)`. + func getSitemaps(_ input: Operations.getSitemaps.Input) async throws -> Operations.getSitemaps.Output + /// Get all registered UI components in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/get(getRegisteredUIComponentsInNamespace)`. + func getRegisteredUIComponentsInNamespace(_ input: Operations.getRegisteredUIComponentsInNamespace.Input) async throws -> Operations.getRegisteredUIComponentsInNamespace.Output + /// Add a UI component in the specified namespace. + /// + /// - Remark: HTTP `POST /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/post(addUIComponentToNamespace)`. + func addUIComponentToNamespace(_ input: Operations.addUIComponentToNamespace.Input) async throws -> Operations.addUIComponentToNamespace.Output + /// Get a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/get(getUIComponentInNamespace)`. + func getUIComponentInNamespace(_ input: Operations.getUIComponentInNamespace.Input) async throws -> Operations.getUIComponentInNamespace.Output + /// Update a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `PUT /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/put(updateUIComponentInNamespace)`. + func updateUIComponentInNamespace(_ input: Operations.updateUIComponentInNamespace.Input) async throws -> Operations.updateUIComponentInNamespace.Output + /// Remove a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `DELETE /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/delete(removeUIComponentFromNamespace)`. + func removeUIComponentFromNamespace(_ input: Operations.removeUIComponentFromNamespace.Input) async throws -> Operations.removeUIComponentFromNamespace.Output + /// Get all registered UI tiles. + /// + /// - Remark: HTTP `GET /ui/tiles`. + /// - Remark: Generated from `#/paths//ui/tiles/get(getUITiles)`. + func getUITiles(_ input: Operations.getUITiles.Input) async throws -> Operations.getUITiles.Output +} + +/// Convenience overloads for operation inputs. +extension APIProtocol { + /// Adds a new member to a group item. + /// + /// - Remark: HTTP `PUT /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)`. + func addMemberToGroupItem(path: Operations.addMemberToGroupItem.Input.Path) async throws -> Operations.addMemberToGroupItem.Output { + try await addMemberToGroupItem(Operations.addMemberToGroupItem.Input(path: path)) + } + + /// Removes an existing member from a group item. + /// + /// - Remark: HTTP `DELETE /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)`. + func removeMemberFromGroupItem(path: Operations.removeMemberFromGroupItem.Input.Path) async throws -> Operations.removeMemberFromGroupItem.Output { + try await removeMemberFromGroupItem(Operations.removeMemberFromGroupItem.Input(path: path)) + } + + /// Adds metadata to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)`. + func addMetadataToItem(path: Operations.addMetadataToItem.Input.Path, + body: Operations.addMetadataToItem.Input.Body) async throws -> Operations.addMetadataToItem.Output { + try await addMetadataToItem(Operations.addMetadataToItem.Input( + path: path, + body: body + )) + } + + /// Removes metadata from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)`. + func removeMetadataFromItem(path: Operations.removeMetadataFromItem.Input.Path) async throws -> Operations.removeMetadataFromItem.Output { + try await removeMetadataFromItem(Operations.removeMetadataFromItem.Input(path: path)) + } + + /// Adds a tag to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)`. + func addTagToItem(path: Operations.addTagToItem.Input.Path) async throws -> Operations.addTagToItem.Output { + try await addTagToItem(Operations.addTagToItem.Input(path: path)) + } + + /// Removes a tag from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)`. + func removeTagFromItem(path: Operations.removeTagFromItem.Input.Path) async throws -> Operations.removeTagFromItem.Output { + try await removeTagFromItem(Operations.removeTagFromItem.Input(path: path)) + } + + /// Gets a single item. + /// + /// - Remark: HTTP `GET /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/get(getItemByName)`. + func getItemByName(path: Operations.getItemByName.Input.Path, + query: Operations.getItemByName.Input.Query = .init(), + headers: Operations.getItemByName.Input.Headers = .init()) async throws -> Operations.getItemByName.Output { + try await getItemByName(Operations.getItemByName.Input( + path: path, + query: query, + headers: headers + )) + } + + /// Sends a command to an item. + /// + /// - Remark: HTTP `POST /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)`. + func sendItemCommand(path: Operations.sendItemCommand.Input.Path, + body: Operations.sendItemCommand.Input.Body) async throws -> Operations.sendItemCommand.Output { + try await sendItemCommand(Operations.sendItemCommand.Input( + path: path, + body: body + )) + } + + /// Adds a new item to the registry or updates the existing item. + /// + /// - Remark: HTTP `PUT /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)`. + func addOrUpdateItemInRegistry(path: Operations.addOrUpdateItemInRegistry.Input.Path, + headers: Operations.addOrUpdateItemInRegistry.Input.Headers = .init(), + body: Operations.addOrUpdateItemInRegistry.Input.Body) async throws -> Operations.addOrUpdateItemInRegistry.Output { + try await addOrUpdateItemInRegistry(Operations.addOrUpdateItemInRegistry.Input( + path: path, + headers: headers, + body: body + )) + } + + /// Removes an item from the registry. + /// + /// - Remark: HTTP `DELETE /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/delete(removeItemFromRegistry)`. + func removeItemFromRegistry(path: Operations.removeItemFromRegistry.Input.Path) async throws -> Operations.removeItemFromRegistry.Output { + try await removeItemFromRegistry(Operations.removeItemFromRegistry.Input(path: path)) + } + + /// Get all available items. + /// + /// - Remark: HTTP `GET /items`. + /// - Remark: Generated from `#/paths//items/get(getItems)`. + func getItems(query: Operations.getItems.Input.Query = .init(), + headers: Operations.getItems.Input.Headers = .init()) async throws -> Operations.getItems.Output { + try await getItems(Operations.getItems.Input( + query: query, + headers: headers + )) + } + + /// Adds a list of items to the registry or updates the existing items. + /// + /// - Remark: HTTP `PUT /items`. + /// - Remark: Generated from `#/paths//items/put(addOrUpdateItemsInRegistry)`. + func addOrUpdateItemsInRegistry(headers: Operations.addOrUpdateItemsInRegistry.Input.Headers = .init(), + body: Operations.addOrUpdateItemsInRegistry.Input.Body) async throws -> Operations.addOrUpdateItemsInRegistry.Output { + try await addOrUpdateItemsInRegistry(Operations.addOrUpdateItemsInRegistry.Input( + headers: headers, + body: body + )) + } + + /// Gets the state of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/get(getItemState_1)`. + func getItemState_1(path: Operations.getItemState_1.Input.Path, + headers: Operations.getItemState_1.Input.Headers = .init()) async throws -> Operations.getItemState_1.Output { + try await getItemState_1(Operations.getItemState_1.Input( + path: path, + headers: headers + )) + } + + /// Updates the state of an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)`. + func updateItemState(path: Operations.updateItemState.Input.Path, + headers: Operations.updateItemState.Input.Headers = .init(), + body: Operations.updateItemState.Input.Body) async throws -> Operations.updateItemState.Output { + try await updateItemState(Operations.updateItemState.Input( + path: path, + headers: headers, + body: body + )) + } + + /// Gets the namespace of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/metadata/namespaces`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/namespaces/get(getItemNamespaces)`. + func getItemNamespaces(path: Operations.getItemNamespaces.Input.Path, + headers: Operations.getItemNamespaces.Input.Headers = .init()) async throws -> Operations.getItemNamespaces.Output { + try await getItemNamespaces(Operations.getItemNamespaces.Input( + path: path, + headers: headers + )) + } + + /// Gets the item which defines the requested semantics of an item. + /// + /// - Remark: HTTP `GET /items/{itemName}/semantic/{semanticClass}`. + /// - Remark: Generated from `#/paths//items/{itemName}/semantic/{semanticClass}/get(getSemanticItem)`. + func getSemanticItem(path: Operations.getSemanticItem.Input.Path, + headers: Operations.getSemanticItem.Input.Headers = .init()) async throws -> Operations.getSemanticItem.Output { + try await getSemanticItem(Operations.getSemanticItem.Input( + path: path, + headers: headers + )) + } + + /// Remove unused/orphaned metadata. + /// + /// - Remark: HTTP `POST /items/metadata/purge`. + /// - Remark: Generated from `#/paths//items/metadata/purge/post(purgeDatabase)`. + func purgeDatabase() async throws -> Operations.purgeDatabase.Output { + try await purgeDatabase(Operations.purgeDatabase.Input()) + } + + /// Creates a sitemap event subscription. + /// + /// - Remark: HTTP `POST /sitemaps/events/subscribe`. + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)`. + func createSitemapEventSubscription(headers: Operations.createSitemapEventSubscription.Input.Headers = .init()) async throws -> Operations.createSitemapEventSubscription.Output { + try await createSitemapEventSubscription(Operations.createSitemapEventSubscription.Input(headers: headers)) + } + + /// Polls the data for one page of a sitemap. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/{pageid}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)`. + func pollDataForPage(path: Operations.pollDataForPage.Input.Path, + query: Operations.pollDataForPage.Input.Query = .init(), + headers: Operations.pollDataForPage.Input.Headers = .init()) async throws -> Operations.pollDataForPage.Output { + try await pollDataForPage(Operations.pollDataForPage.Input( + path: path, + query: query, + headers: headers + )) + } + + /// Polls the data for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/*`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)`. + func pollDataForSitemap(path: Operations.pollDataForSitemap.Input.Path, + query: Operations.pollDataForSitemap.Input.Query = .init(), + headers: Operations.pollDataForSitemap.Input.Headers = .init()) async throws -> Operations.pollDataForSitemap.Output { + try await pollDataForSitemap(Operations.pollDataForSitemap.Input( + path: path, + query: query, + headers: headers + )) + } + + /// Get sitemap by name. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/get(getSitemapByName)`. + func getSitemapByName(path: Operations.getSitemapByName.Input.Path, + query: Operations.getSitemapByName.Input.Query = .init(), + headers: Operations.getSitemapByName.Input.Headers = .init()) async throws -> Operations.getSitemapByName.Output { + try await getSitemapByName(Operations.getSitemapByName.Input( + path: path, + query: query, + headers: headers + )) + } + + /// Get sitemap events for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}/*`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)`. + func getSitemapEvents(path: Operations.getSitemapEvents.Input.Path, + query: Operations.getSitemapEvents.Input.Query = .init()) async throws -> Operations.getSitemapEvents.Output { + try await getSitemapEvents(Operations.getSitemapEvents.Input( + path: path, + query: query + )) + } + + /// Get sitemap events. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)`. + func getSitemapEvents_1(path: Operations.getSitemapEvents_1.Input.Path, + query: Operations.getSitemapEvents_1.Input.Query = .init(), + headers: Operations.getSitemapEvents_1.Input.Headers = .init()) async throws -> Operations.getSitemapEvents_1.Output { + try await getSitemapEvents_1(Operations.getSitemapEvents_1.Input( + path: path, + query: query, + headers: headers + )) + } + + /// Get all available sitemaps. + /// + /// - Remark: HTTP `GET /sitemaps`. + /// - Remark: Generated from `#/paths//sitemaps/get(getSitemaps)`. + func getSitemaps(headers: Operations.getSitemaps.Input.Headers = .init()) async throws -> Operations.getSitemaps.Output { + try await getSitemaps(Operations.getSitemaps.Input(headers: headers)) + } + + /// Get all registered UI components in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/get(getRegisteredUIComponentsInNamespace)`. + func getRegisteredUIComponentsInNamespace(path: Operations.getRegisteredUIComponentsInNamespace.Input.Path, + query: Operations.getRegisteredUIComponentsInNamespace.Input.Query = .init(), + headers: Operations.getRegisteredUIComponentsInNamespace.Input.Headers = .init()) async throws -> Operations.getRegisteredUIComponentsInNamespace.Output { + try await getRegisteredUIComponentsInNamespace(Operations.getRegisteredUIComponentsInNamespace.Input( + path: path, + query: query, + headers: headers + )) + } + + /// Add a UI component in the specified namespace. + /// + /// - Remark: HTTP `POST /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/post(addUIComponentToNamespace)`. + func addUIComponentToNamespace(path: Operations.addUIComponentToNamespace.Input.Path, + headers: Operations.addUIComponentToNamespace.Input.Headers = .init(), + body: Operations.addUIComponentToNamespace.Input.Body? = nil) async throws -> Operations.addUIComponentToNamespace.Output { + try await addUIComponentToNamespace(Operations.addUIComponentToNamespace.Input( + path: path, + headers: headers, + body: body + )) + } + + /// Get a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/get(getUIComponentInNamespace)`. + func getUIComponentInNamespace(path: Operations.getUIComponentInNamespace.Input.Path, + headers: Operations.getUIComponentInNamespace.Input.Headers = .init()) async throws -> Operations.getUIComponentInNamespace.Output { + try await getUIComponentInNamespace(Operations.getUIComponentInNamespace.Input( + path: path, + headers: headers + )) + } + + /// Update a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `PUT /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/put(updateUIComponentInNamespace)`. + func updateUIComponentInNamespace(path: Operations.updateUIComponentInNamespace.Input.Path, + headers: Operations.updateUIComponentInNamespace.Input.Headers = .init(), + body: Operations.updateUIComponentInNamespace.Input.Body? = nil) async throws -> Operations.updateUIComponentInNamespace.Output { + try await updateUIComponentInNamespace(Operations.updateUIComponentInNamespace.Input( + path: path, + headers: headers, + body: body + )) + } + + /// Remove a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `DELETE /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/delete(removeUIComponentFromNamespace)`. + func removeUIComponentFromNamespace(path: Operations.removeUIComponentFromNamespace.Input.Path) async throws -> Operations.removeUIComponentFromNamespace.Output { + try await removeUIComponentFromNamespace(Operations.removeUIComponentFromNamespace.Input(path: path)) + } + + /// Get all registered UI tiles. + /// + /// - Remark: HTTP `GET /ui/tiles`. + /// - Remark: Generated from `#/paths//ui/tiles/get(getUITiles)`. + func getUITiles(headers: Operations.getUITiles.Input.Headers = .init()) async throws -> Operations.getUITiles.Output { + try await getUITiles(Operations.getUITiles.Input(headers: headers)) + } +} + +/// Server URLs defined in the OpenAPI document. +enum Servers { + static func server1() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "/rest", + variables: [] + ) + } +} + +/// Types generated from the components section of the OpenAPI document. +enum Components { + /// Types generated from the `#/components/schemas` section of the OpenAPI document. + enum Schemas { + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO`. + struct ConfigDescriptionParameterDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/context`. + var context: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/defaultValue`. + var defaultValue: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/description`. + var description: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/required`. + var required: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/type`. + enum _typePayload: String, Codable, Hashable, Sendable, CaseIterable { + case TEXT + case INTEGER + case DECIMAL + case BOOLEAN + } + + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/type`. + var _type: Components.Schemas.ConfigDescriptionParameterDTO._typePayload? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/min`. + var min: Swift.Double? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/max`. + var max: Swift.Double? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/stepsize`. + var stepsize: Swift.Double? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/pattern`. + var pattern: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/readOnly`. + var readOnly: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/multiple`. + var multiple: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/multipleLimit`. + var multipleLimit: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/groupName`. + var groupName: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/advanced`. + var advanced: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/verify`. + var verify: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/limitToOptions`. + var limitToOptions: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/unit`. + var unit: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/unitLabel`. + var unitLabel: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/options`. + var options: [Components.Schemas.ParameterOptionDTO]? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterDTO/filterCriteria`. + var filterCriteria: [Components.Schemas.FilterCriteriaDTO]? + /// Creates a new `ConfigDescriptionParameterDTO`. + /// + /// - Parameters: + /// - context: + /// - defaultValue: + /// - description: + /// - label: + /// - name: + /// - required: + /// - _type: + /// - min: + /// - max: + /// - stepsize: + /// - pattern: + /// - readOnly: + /// - multiple: + /// - multipleLimit: + /// - groupName: + /// - advanced: + /// - verify: + /// - limitToOptions: + /// - unit: + /// - unitLabel: + /// - options: + /// - filterCriteria: + init(context: Swift.String? = nil, + defaultValue: Swift.String? = nil, + description: Swift.String? = nil, + label: Swift.String? = nil, + name: Swift.String? = nil, + required: Swift.Bool? = nil, + _type: Components.Schemas.ConfigDescriptionParameterDTO._typePayload? = nil, + min: Swift.Double? = nil, + max: Swift.Double? = nil, + stepsize: Swift.Double? = nil, + pattern: Swift.String? = nil, + readOnly: Swift.Bool? = nil, + multiple: Swift.Bool? = nil, + multipleLimit: Swift.Int32? = nil, + groupName: Swift.String? = nil, + advanced: Swift.Bool? = nil, + verify: Swift.Bool? = nil, + limitToOptions: Swift.Bool? = nil, + unit: Swift.String? = nil, + unitLabel: Swift.String? = nil, + options: [Components.Schemas.ParameterOptionDTO]? = nil, + filterCriteria: [Components.Schemas.FilterCriteriaDTO]? = nil) { + self.context = context + self.defaultValue = defaultValue + self.description = description + self.label = label + self.name = name + self.required = required + self._type = _type + self.min = min + self.max = max + self.stepsize = stepsize + self.pattern = pattern + self.readOnly = readOnly + self.multiple = multiple + self.multipleLimit = multipleLimit + self.groupName = groupName + self.advanced = advanced + self.verify = verify + self.limitToOptions = limitToOptions + self.unit = unit + self.unitLabel = unitLabel + self.options = options + self.filterCriteria = filterCriteria + } + + enum CodingKeys: String, CodingKey { + case context + case defaultValue + case description + case label + case name + case required + case _type = "type" + case min + case max + case stepsize + case pattern + case readOnly + case multiple + case multipleLimit + case groupName + case advanced + case verify + case limitToOptions + case unit + case unitLabel + case options + case filterCriteria + } + } + + /// - Remark: Generated from `#/components/schemas/FilterCriteriaDTO`. + struct FilterCriteriaDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/FilterCriteriaDTO/value`. + var value: Swift.String? + /// - Remark: Generated from `#/components/schemas/FilterCriteriaDTO/name`. + var name: Swift.String? + /// Creates a new `FilterCriteriaDTO`. + /// + /// - Parameters: + /// - value: + /// - name: + init(value: Swift.String? = nil, + name: Swift.String? = nil) { + self.value = value + self.name = name + } + + enum CodingKeys: String, CodingKey { + case value + case name + } + } + + /// - Remark: Generated from `#/components/schemas/ParameterOptionDTO`. + struct ParameterOptionDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ParameterOptionDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/ParameterOptionDTO/value`. + var value: Swift.String? + /// Creates a new `ParameterOptionDTO`. + /// + /// - Parameters: + /// - label: + /// - value: + init(label: Swift.String? = nil, + value: Swift.String? = nil) { + self.label = label + self.value = value + } + + enum CodingKeys: String, CodingKey { + case label + case value + } + } + + /// - Remark: Generated from `#/components/schemas/CommandDescription`. + struct CommandDescription: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/CommandDescription/commandOptions`. + var commandOptions: [Components.Schemas.CommandOption]? + /// Creates a new `CommandDescription`. + /// + /// - Parameters: + /// - commandOptions: + init(commandOptions: [Components.Schemas.CommandOption]? = nil) { + self.commandOptions = commandOptions + } + + enum CodingKeys: String, CodingKey { + case commandOptions + } + } + + /// - Remark: Generated from `#/components/schemas/CommandOption`. + struct CommandOption: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/CommandOption/command`. + var command: Swift.String? + /// - Remark: Generated from `#/components/schemas/CommandOption/label`. + var label: Swift.String? + /// Creates a new `CommandOption`. + /// + /// - Parameters: + /// - command: + /// - label: + init(command: Swift.String? = nil, + label: Swift.String? = nil) { + self.command = command + self.label = label + } + + enum CodingKeys: String, CodingKey { + case command + case label + } + } + + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterGroupDTO`. + struct ConfigDescriptionParameterGroupDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterGroupDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterGroupDTO/context`. + var context: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterGroupDTO/advanced`. + var advanced: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterGroupDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionParameterGroupDTO/description`. + var description: Swift.String? + /// Creates a new `ConfigDescriptionParameterGroupDTO`. + /// + /// - Parameters: + /// - name: + /// - context: + /// - advanced: + /// - label: + /// - description: + init(name: Swift.String? = nil, + context: Swift.String? = nil, + advanced: Swift.Bool? = nil, + label: Swift.String? = nil, + description: Swift.String? = nil) { + self.name = name + self.context = context + self.advanced = advanced + self.label = label + self.description = description + } + + enum CodingKeys: String, CodingKey { + case name + case context + case advanced + case label + case description + } + } + + /// - Remark: Generated from `#/components/schemas/StateDescription`. + struct StateDescription: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/StateDescription/minimum`. + var minimum: Swift.Double? + /// - Remark: Generated from `#/components/schemas/StateDescription/maximum`. + var maximum: Swift.Double? + /// - Remark: Generated from `#/components/schemas/StateDescription/step`. + var step: Swift.Double? + /// - Remark: Generated from `#/components/schemas/StateDescription/pattern`. + var pattern: Swift.String? + /// - Remark: Generated from `#/components/schemas/StateDescription/readOnly`. + var readOnly: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/StateDescription/options`. + var options: [Components.Schemas.StateOption]? + /// Creates a new `StateDescription`. + /// + /// - Parameters: + /// - minimum: + /// - maximum: + /// - step: + /// - pattern: + /// - readOnly: + /// - options: + init(minimum: Swift.Double? = nil, + maximum: Swift.Double? = nil, + step: Swift.Double? = nil, + pattern: Swift.String? = nil, + readOnly: Swift.Bool? = nil, + options: [Components.Schemas.StateOption]? = nil) { + self.minimum = minimum + self.maximum = maximum + self.step = step + self.pattern = pattern + self.readOnly = readOnly + self.options = options + } + + enum CodingKeys: String, CodingKey { + case minimum + case maximum + case step + case pattern + case readOnly + case options + } + } + + /// - Remark: Generated from `#/components/schemas/StateOption`. + struct StateOption: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/StateOption/value`. + var value: Swift.String? + /// - Remark: Generated from `#/components/schemas/StateOption/label`. + var label: Swift.String? + /// Creates a new `StateOption`. + /// + /// - Parameters: + /// - value: + /// - label: + init(value: Swift.String? = nil, + label: Swift.String? = nil) { + self.value = value + self.label = label + } + + enum CodingKeys: String, CodingKey { + case value + case label + } + } + + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionDTO`. + struct ConfigDescriptionDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionDTO/uri`. + var uri: Swift.String? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionDTO/parameters`. + var parameters: [Components.Schemas.ConfigDescriptionParameterDTO]? + /// - Remark: Generated from `#/components/schemas/ConfigDescriptionDTO/parameterGroups`. + var parameterGroups: [Components.Schemas.ConfigDescriptionParameterGroupDTO]? + /// Creates a new `ConfigDescriptionDTO`. + /// + /// - Parameters: + /// - uri: + /// - parameters: + /// - parameterGroups: + init(uri: Swift.String? = nil, + parameters: [Components.Schemas.ConfigDescriptionParameterDTO]? = nil, + parameterGroups: [Components.Schemas.ConfigDescriptionParameterGroupDTO]? = nil) { + self.uri = uri + self.parameters = parameters + self.parameterGroups = parameterGroups + } + + enum CodingKeys: String, CodingKey { + case uri + case parameters + case parameterGroups + } + } + + /// - Remark: Generated from `#/components/schemas/MetadataDTO`. + struct MetadataDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/MetadataDTO/value`. + var value: Swift.String? + /// - Remark: Generated from `#/components/schemas/MetadataDTO/config`. + struct configPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + var additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] + /// Creates a new `configPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + init(additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] = .init()) { + self.additionalProperties = additionalProperties + } + + init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + + func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + + /// - Remark: Generated from `#/components/schemas/MetadataDTO/config`. + var config: Components.Schemas.MetadataDTO.configPayload? + /// Creates a new `MetadataDTO`. + /// + /// - Parameters: + /// - value: + /// - config: + init(value: Swift.String? = nil, + config: Components.Schemas.MetadataDTO.configPayload? = nil) { + self.value = value + self.config = config + } + + enum CodingKeys: String, CodingKey { + case value + case config + } + } + + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO`. + struct EnrichedItemDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/type`. + var _type: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/category`. + var category: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/tags`. + var tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/groupNames`. + var groupNames: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/link`. + var link: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/state`. + var state: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/transformedState`. + var transformedState: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/stateDescription`. + var stateDescription: Components.Schemas.StateDescription? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/unitSymbol`. + var unitSymbol: Swift.String? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/commandDescription`. + var commandDescription: Components.Schemas.CommandDescription? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/metadata`. + struct metadataPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + var additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] + /// Creates a new `metadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + init(additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] = .init()) { + self.additionalProperties = additionalProperties + } + + init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + + func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/metadata`. + var metadata: Components.Schemas.EnrichedItemDTO.metadataPayload? + /// - Remark: Generated from `#/components/schemas/EnrichedItemDTO/editable`. + var editable: Swift.Bool? + /// Creates a new `EnrichedItemDTO`. + /// + /// - Parameters: + /// - _type: + /// - name: + /// - label: + /// - category: + /// - tags: + /// - groupNames: + /// - link: + /// - state: + /// - transformedState: + /// - stateDescription: + /// - unitSymbol: + /// - commandDescription: + /// - metadata: + /// - editable: + init(_type: Swift.String? = nil, + name: Swift.String? = nil, + label: Swift.String? = nil, + category: Swift.String? = nil, + tags: [Swift.String]? = nil, + groupNames: [Swift.String]? = nil, + link: Swift.String? = nil, + state: Swift.String? = nil, + transformedState: Swift.String? = nil, + stateDescription: Components.Schemas.StateDescription? = nil, + unitSymbol: Swift.String? = nil, + commandDescription: Components.Schemas.CommandDescription? = nil, + metadata: Components.Schemas.EnrichedItemDTO.metadataPayload? = nil, + editable: Swift.Bool? = nil) { + self._type = _type + self.name = name + self.label = label + self.category = category + self.tags = tags + self.groupNames = groupNames + self.link = link + self.state = state + self.transformedState = transformedState + self.stateDescription = stateDescription + self.unitSymbol = unitSymbol + self.commandDescription = commandDescription + self.metadata = metadata + self.editable = editable + } + + enum CodingKeys: String, CodingKey { + case _type = "type" + case name + case label + case category + case tags + case groupNames + case link + case state + case transformedState + case stateDescription + case unitSymbol + case commandDescription + case metadata + case editable + } + } + + /// - Remark: Generated from `#/components/schemas/GroupFunctionDTO`. + struct GroupFunctionDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/GroupFunctionDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/GroupFunctionDTO/params`. + var params: [Swift.String]? + /// Creates a new `GroupFunctionDTO`. + /// + /// - Parameters: + /// - name: + /// - params: + init(name: Swift.String? = nil, + params: [Swift.String]? = nil) { + self.name = name + self.params = params + } + + enum CodingKeys: String, CodingKey { + case name + case params + } + } + + /// - Remark: Generated from `#/components/schemas/GroupItemDTO`. + struct GroupItemDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/type`. + var _type: Swift.String? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/category`. + var category: Swift.String? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/tags`. + var tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/groupNames`. + var groupNames: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/groupType`. + var groupType: Swift.String? + /// - Remark: Generated from `#/components/schemas/GroupItemDTO/function`. + var function: Components.Schemas.GroupFunctionDTO? + /// Creates a new `GroupItemDTO`. + /// + /// - Parameters: + /// - _type: + /// - name: + /// - label: + /// - category: + /// - tags: + /// - groupNames: + /// - groupType: + /// - function: + init(_type: Swift.String? = nil, + name: Swift.String? = nil, + label: Swift.String? = nil, + category: Swift.String? = nil, + tags: [Swift.String]? = nil, + groupNames: [Swift.String]? = nil, + groupType: Swift.String? = nil, + function: Components.Schemas.GroupFunctionDTO? = nil) { + self._type = _type + self.name = name + self.label = label + self.category = category + self.tags = tags + self.groupNames = groupNames + self.groupType = groupType + self.function = function + } + + enum CodingKeys: String, CodingKey { + case _type = "type" + case name + case label + case category + case tags + case groupNames + case groupType + case function + } + } + + /// - Remark: Generated from `#/components/schemas/JerseyResponseBuilderDTO`. + struct JerseyResponseBuilderDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/JerseyResponseBuilderDTO/status`. + var status: Swift.String? + /// - Remark: Generated from `#/components/schemas/JerseyResponseBuilderDTO/context`. + var context: Components.Schemas.ContextDTO? + /// Creates a new `JerseyResponseBuilderDTO`. + /// + /// - Parameters: + /// - status: + /// - context: + init(status: Swift.String? = nil, + context: Components.Schemas.ContextDTO? = nil) { + self.status = status + self.context = context + } + + enum CodingKeys: String, CodingKey { + case status + case context + } + } + + /// - Remark: Generated from `#/components/schemas/ContextDTO`. + struct ContextDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/ContextDTO/headers`. + var headers: Components.Schemas.HeadersDTO? + /// Creates a new `ContextDTO`. + /// + /// - Parameters: + /// - headers: + init(headers: Components.Schemas.HeadersDTO? = nil) { + self.headers = headers + } + + enum CodingKeys: String, CodingKey { + case headers + } + } + + /// - Remark: Generated from `#/components/schemas/HeadersDTO`. + struct HeadersDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/HeadersDTO/Location`. + var Location: [Swift.String]? + /// Creates a new `HeadersDTO`. + /// + /// - Parameters: + /// - Location: + init(Location: [Swift.String]? = nil) { + self.Location = Location + } + + enum CodingKeys: String, CodingKey { + case Location + } + } + + /// - Remark: Generated from `#/components/schemas/MappingDTO`. + struct MappingDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/MappingDTO/row`. + var row: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/MappingDTO/column`. + var column: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/MappingDTO/command`. + var command: Swift.String? + /// - Remark: Generated from `#/components/schemas/MappingDTO/releaseCommand`. + var releaseCommand: Swift.String? + /// - Remark: Generated from `#/components/schemas/MappingDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/MappingDTO/icon`. + var icon: Swift.String? + /// Creates a new `MappingDTO`. + /// + /// - Parameters: + /// - row: + /// - column: + /// - command: + /// - releaseCommand: + /// - label: + /// - icon: + init(row: Swift.Int32? = nil, + column: Swift.Int32? = nil, + command: Swift.String? = nil, + releaseCommand: Swift.String? = nil, + label: Swift.String? = nil, + icon: Swift.String? = nil) { + self.row = row + self.column = column + self.command = command + self.releaseCommand = releaseCommand + self.label = label + self.icon = icon + } + + enum CodingKeys: String, CodingKey { + case row + case column + case command + case releaseCommand + case label + case icon + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO`. + struct PageDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/PageDTO/id`. + var id: Swift.String? { + get { + storage.value.id + } + _modify { + yield &storage.value.id + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/title`. + var title: Swift.String? { + get { + storage.value.title + } + _modify { + yield &storage.value.title + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/icon`. + var icon: Swift.String? { + get { + storage.value.icon + } + _modify { + yield &storage.value.icon + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/link`. + var link: Swift.String? { + get { + storage.value.link + } + _modify { + yield &storage.value.link + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/parent`. + var parent: Components.Schemas.PageDTO? { + get { + storage.value.parent + } + _modify { + yield &storage.value.parent + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/leaf`. + var leaf: Swift.Bool? { + get { + storage.value.leaf + } + _modify { + yield &storage.value.leaf + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/timeout`. + var timeout: Swift.Bool? { + get { + storage.value.timeout + } + _modify { + yield &storage.value.timeout + } + } + + /// - Remark: Generated from `#/components/schemas/PageDTO/widgets`. + var widgets: [Components.Schemas.WidgetDTO]? { + get { + storage.value.widgets + } + _modify { + yield &storage.value.widgets + } + } + + /// Creates a new `PageDTO`. + /// + /// - Parameters: + /// - id: + /// - title: + /// - icon: + /// - link: + /// - parent: + /// - leaf: + /// - timeout: + /// - widgets: + init(id: Swift.String? = nil, + title: Swift.String? = nil, + icon: Swift.String? = nil, + link: Swift.String? = nil, + parent: Components.Schemas.PageDTO? = nil, + leaf: Swift.Bool? = nil, + timeout: Swift.Bool? = nil, + widgets: [Components.Schemas.WidgetDTO]? = nil) { + storage = .init(value: .init( + id: id, + title: title, + icon: icon, + link: link, + parent: parent, + leaf: leaf, + timeout: timeout, + widgets: widgets + )) + } + + enum CodingKeys: String, CodingKey { + case id + case title + case icon + case link + case parent + case leaf + case timeout + case widgets + } + + init(from decoder: any Decoder) throws { + storage = try .init(from: decoder) + } + + func encode(to encoder: any Encoder) throws { + try storage.encode(to: encoder) + } + + /// Internal reference storage to allow type recursion. + private var storage: OpenAPIRuntime.CopyOnWriteBox + private struct Storage: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/PageDTO/id`. + var id: Swift.String? + /// - Remark: Generated from `#/components/schemas/PageDTO/title`. + var title: Swift.String? + /// - Remark: Generated from `#/components/schemas/PageDTO/icon`. + var icon: Swift.String? + /// - Remark: Generated from `#/components/schemas/PageDTO/link`. + var link: Swift.String? + /// - Remark: Generated from `#/components/schemas/PageDTO/parent`. + var parent: Components.Schemas.PageDTO? + /// - Remark: Generated from `#/components/schemas/PageDTO/leaf`. + var leaf: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/PageDTO/timeout`. + var timeout: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/PageDTO/widgets`. + var widgets: [Components.Schemas.WidgetDTO]? + init(id: Swift.String? = nil, + title: Swift.String? = nil, + icon: Swift.String? = nil, + link: Swift.String? = nil, + parent: Components.Schemas.PageDTO? = nil, + leaf: Swift.Bool? = nil, + timeout: Swift.Bool? = nil, + widgets: [Components.Schemas.WidgetDTO]? = nil) { + self.id = id + self.title = title + self.icon = icon + self.link = link + self.parent = parent + self.leaf = leaf + self.timeout = timeout + self.widgets = widgets + } + + typealias CodingKeys = Components.Schemas.PageDTO.CodingKeys + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO`. + struct WidgetDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/WidgetDTO/widgetId`. + var widgetId: Swift.String? { + get { + storage.value.widgetId + } + _modify { + yield &storage.value.widgetId + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/type`. + var _type: Swift.String? { + get { + storage.value._type + } + _modify { + yield &storage.value._type + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/name`. + var name: Swift.String? { + get { + storage.value.name + } + _modify { + yield &storage.value.name + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/visibility`. + var visibility: Swift.Bool? { + get { + storage.value.visibility + } + _modify { + yield &storage.value.visibility + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/label`. + var label: Swift.String? { + get { + storage.value.label + } + _modify { + yield &storage.value.label + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/labelSource`. + var labelSource: Swift.String? { + get { + storage.value.labelSource + } + _modify { + yield &storage.value.labelSource + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/icon`. + var icon: Swift.String? { + get { + storage.value.icon + } + _modify { + yield &storage.value.icon + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/staticIcon`. + var staticIcon: Swift.Bool? { + get { + storage.value.staticIcon + } + _modify { + yield &storage.value.staticIcon + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/labelcolor`. + var labelcolor: Swift.String? { + get { + storage.value.labelcolor + } + _modify { + yield &storage.value.labelcolor + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/valuecolor`. + var valuecolor: Swift.String? { + get { + storage.value.valuecolor + } + _modify { + yield &storage.value.valuecolor + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/iconcolor`. + var iconcolor: Swift.String? { + get { + storage.value.iconcolor + } + _modify { + yield &storage.value.iconcolor + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/pattern`. + var pattern: Swift.String? { + get { + storage.value.pattern + } + _modify { + yield &storage.value.pattern + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/unit`. + var unit: Swift.String? { + get { + storage.value.unit + } + _modify { + yield &storage.value.unit + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/mappings`. + var mappings: [Components.Schemas.MappingDTO]? { + get { + storage.value.mappings + } + _modify { + yield &storage.value.mappings + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/switchSupport`. + var switchSupport: Swift.Bool? { + get { + storage.value.switchSupport + } + _modify { + yield &storage.value.switchSupport + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/releaseOnly`. + var releaseOnly: Swift.Bool? { + get { + storage.value.releaseOnly + } + _modify { + yield &storage.value.releaseOnly + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/sendFrequency`. + var sendFrequency: Swift.Int32? { + get { + storage.value.sendFrequency + } + _modify { + yield &storage.value.sendFrequency + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/refresh`. + var refresh: Swift.Int32? { + get { + storage.value.refresh + } + _modify { + yield &storage.value.refresh + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/height`. + var height: Swift.Int32? { + get { + storage.value.height + } + _modify { + yield &storage.value.height + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/minValue`. + var minValue: Swift.Double? { + get { + storage.value.minValue + } + _modify { + yield &storage.value.minValue + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/maxValue`. + var maxValue: Swift.Double? { + get { + storage.value.maxValue + } + _modify { + yield &storage.value.maxValue + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/step`. + var step: Swift.Double? { + get { + storage.value.step + } + _modify { + yield &storage.value.step + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/inputHint`. + var inputHint: Swift.String? { + get { + storage.value.inputHint + } + _modify { + yield &storage.value.inputHint + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/url`. + var url: Swift.String? { + get { + storage.value.url + } + _modify { + yield &storage.value.url + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/encoding`. + var encoding: Swift.String? { + get { + storage.value.encoding + } + _modify { + yield &storage.value.encoding + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/service`. + var service: Swift.String? { + get { + storage.value.service + } + _modify { + yield &storage.value.service + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/period`. + var period: Swift.String? { + get { + storage.value.period + } + _modify { + yield &storage.value.period + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/yAxisDecimalPattern`. + var yAxisDecimalPattern: Swift.String? { + get { + storage.value.yAxisDecimalPattern + } + _modify { + yield &storage.value.yAxisDecimalPattern + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/legend`. + var legend: Swift.Bool? { + get { + storage.value.legend + } + _modify { + yield &storage.value.legend + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/forceAsItem`. + var forceAsItem: Swift.Bool? { + get { + storage.value.forceAsItem + } + _modify { + yield &storage.value.forceAsItem + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/row`. + var row: Swift.Int32? { + get { + storage.value.row + } + _modify { + yield &storage.value.row + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/column`. + var column: Swift.Int32? { + get { + storage.value.column + } + _modify { + yield &storage.value.column + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/command`. + var command: Swift.String? { + get { + storage.value.command + } + _modify { + yield &storage.value.command + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/releaseCommand`. + var releaseCommand: Swift.String? { + get { + storage.value.releaseCommand + } + _modify { + yield &storage.value.releaseCommand + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/stateless`. + var stateless: Swift.Bool? { + get { + storage.value.stateless + } + _modify { + yield &storage.value.stateless + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/state`. + var state: Swift.String? { + get { + storage.value.state + } + _modify { + yield &storage.value.state + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/item`. + var item: Components.Schemas.EnrichedItemDTO? { + get { + storage.value.item + } + _modify { + yield &storage.value.item + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/linkedPage`. + var linkedPage: Components.Schemas.PageDTO? { + get { + storage.value.linkedPage + } + _modify { + yield &storage.value.linkedPage + } + } + + /// - Remark: Generated from `#/components/schemas/WidgetDTO/widgets`. + var widgets: [Components.Schemas.WidgetDTO]? { + get { + storage.value.widgets + } + _modify { + yield &storage.value.widgets + } + } + + /// Creates a new `WidgetDTO`. + /// + /// - Parameters: + /// - widgetId: + /// - _type: + /// - name: + /// - visibility: + /// - label: + /// - labelSource: + /// - icon: + /// - staticIcon: + /// - labelcolor: + /// - valuecolor: + /// - iconcolor: + /// - pattern: + /// - unit: + /// - mappings: + /// - switchSupport: + /// - releaseOnly: + /// - sendFrequency: + /// - refresh: + /// - height: + /// - minValue: + /// - maxValue: + /// - step: + /// - inputHint: + /// - url: + /// - encoding: + /// - service: + /// - period: + /// - yAxisDecimalPattern: + /// - legend: + /// - forceAsItem: + /// - row: + /// - column: + /// - command: + /// - releaseCommand: + /// - stateless: + /// - state: + /// - item: + /// - linkedPage: + /// - widgets: + init(widgetId: Swift.String? = nil, + _type: Swift.String? = nil, + name: Swift.String? = nil, + visibility: Swift.Bool? = nil, + label: Swift.String? = nil, + labelSource: Swift.String? = nil, + icon: Swift.String? = nil, + staticIcon: Swift.Bool? = nil, + labelcolor: Swift.String? = nil, + valuecolor: Swift.String? = nil, + iconcolor: Swift.String? = nil, + pattern: Swift.String? = nil, + unit: Swift.String? = nil, + mappings: [Components.Schemas.MappingDTO]? = nil, + switchSupport: Swift.Bool? = nil, + releaseOnly: Swift.Bool? = nil, + sendFrequency: Swift.Int32? = nil, + refresh: Swift.Int32? = nil, + height: Swift.Int32? = nil, + minValue: Swift.Double? = nil, + maxValue: Swift.Double? = nil, + step: Swift.Double? = nil, + inputHint: Swift.String? = nil, + url: Swift.String? = nil, + encoding: Swift.String? = nil, + service: Swift.String? = nil, + period: Swift.String? = nil, + yAxisDecimalPattern: Swift.String? = nil, + legend: Swift.Bool? = nil, + forceAsItem: Swift.Bool? = nil, + row: Swift.Int32? = nil, + column: Swift.Int32? = nil, + command: Swift.String? = nil, + releaseCommand: Swift.String? = nil, + stateless: Swift.Bool? = nil, + state: Swift.String? = nil, + item: Components.Schemas.EnrichedItemDTO? = nil, + linkedPage: Components.Schemas.PageDTO? = nil, + widgets: [Components.Schemas.WidgetDTO]? = nil) { + storage = .init(value: .init( + widgetId: widgetId, + _type: _type, + name: name, + visibility: visibility, + label: label, + labelSource: labelSource, + icon: icon, + staticIcon: staticIcon, + labelcolor: labelcolor, + valuecolor: valuecolor, + iconcolor: iconcolor, + pattern: pattern, + unit: unit, + mappings: mappings, + switchSupport: switchSupport, + releaseOnly: releaseOnly, + sendFrequency: sendFrequency, + refresh: refresh, + height: height, + minValue: minValue, + maxValue: maxValue, + step: step, + inputHint: inputHint, + url: url, + encoding: encoding, + service: service, + period: period, + yAxisDecimalPattern: yAxisDecimalPattern, + legend: legend, + forceAsItem: forceAsItem, + row: row, + column: column, + command: command, + releaseCommand: releaseCommand, + stateless: stateless, + state: state, + item: item, + linkedPage: linkedPage, + widgets: widgets + )) + } + + enum CodingKeys: String, CodingKey { + case widgetId + case _type = "type" + case name + case visibility + case label + case labelSource + case icon + case staticIcon + case labelcolor + case valuecolor + case iconcolor + case pattern + case unit + case mappings + case switchSupport + case releaseOnly + case sendFrequency + case refresh + case height + case minValue + case maxValue + case step + case inputHint + case url + case encoding + case service + case period + case yAxisDecimalPattern + case legend + case forceAsItem + case row + case column + case command + case releaseCommand + case stateless + case state + case item + case linkedPage + case widgets + } + + init(from decoder: any Decoder) throws { + storage = try .init(from: decoder) + } + + func encode(to encoder: any Encoder) throws { + try storage.encode(to: encoder) + } + + /// Internal reference storage to allow type recursion. + private var storage: OpenAPIRuntime.CopyOnWriteBox + private struct Storage: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/WidgetDTO/widgetId`. + var widgetId: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/type`. + var _type: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/visibility`. + var visibility: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/labelSource`. + var labelSource: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/icon`. + var icon: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/staticIcon`. + var staticIcon: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/labelcolor`. + var labelcolor: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/valuecolor`. + var valuecolor: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/iconcolor`. + var iconcolor: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/pattern`. + var pattern: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/unit`. + var unit: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/mappings`. + var mappings: [Components.Schemas.MappingDTO]? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/switchSupport`. + var switchSupport: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/releaseOnly`. + var releaseOnly: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/sendFrequency`. + var sendFrequency: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/refresh`. + var refresh: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/height`. + var height: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/minValue`. + var minValue: Swift.Double? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/maxValue`. + var maxValue: Swift.Double? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/step`. + var step: Swift.Double? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/inputHint`. + var inputHint: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/url`. + var url: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/encoding`. + var encoding: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/service`. + var service: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/period`. + var period: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/yAxisDecimalPattern`. + var yAxisDecimalPattern: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/legend`. + var legend: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/forceAsItem`. + var forceAsItem: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/row`. + var row: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/column`. + var column: Swift.Int32? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/command`. + var command: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/releaseCommand`. + var releaseCommand: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/stateless`. + var stateless: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/state`. + var state: Swift.String? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/item`. + var item: Components.Schemas.EnrichedItemDTO? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/linkedPage`. + var linkedPage: Components.Schemas.PageDTO? + /// - Remark: Generated from `#/components/schemas/WidgetDTO/widgets`. + var widgets: [Components.Schemas.WidgetDTO]? + init(widgetId: Swift.String? = nil, + _type: Swift.String? = nil, + name: Swift.String? = nil, + visibility: Swift.Bool? = nil, + label: Swift.String? = nil, + labelSource: Swift.String? = nil, + icon: Swift.String? = nil, + staticIcon: Swift.Bool? = nil, + labelcolor: Swift.String? = nil, + valuecolor: Swift.String? = nil, + iconcolor: Swift.String? = nil, + pattern: Swift.String? = nil, + unit: Swift.String? = nil, + mappings: [Components.Schemas.MappingDTO]? = nil, + switchSupport: Swift.Bool? = nil, + releaseOnly: Swift.Bool? = nil, + sendFrequency: Swift.Int32? = nil, + refresh: Swift.Int32? = nil, + height: Swift.Int32? = nil, + minValue: Swift.Double? = nil, + maxValue: Swift.Double? = nil, + step: Swift.Double? = nil, + inputHint: Swift.String? = nil, + url: Swift.String? = nil, + encoding: Swift.String? = nil, + service: Swift.String? = nil, + period: Swift.String? = nil, + yAxisDecimalPattern: Swift.String? = nil, + legend: Swift.Bool? = nil, + forceAsItem: Swift.Bool? = nil, + row: Swift.Int32? = nil, + column: Swift.Int32? = nil, + command: Swift.String? = nil, + releaseCommand: Swift.String? = nil, + stateless: Swift.Bool? = nil, + state: Swift.String? = nil, + item: Components.Schemas.EnrichedItemDTO? = nil, + linkedPage: Components.Schemas.PageDTO? = nil, + widgets: [Components.Schemas.WidgetDTO]? = nil) { + self.widgetId = widgetId + self._type = _type + self.name = name + self.visibility = visibility + self.label = label + self.labelSource = labelSource + self.icon = icon + self.staticIcon = staticIcon + self.labelcolor = labelcolor + self.valuecolor = valuecolor + self.iconcolor = iconcolor + self.pattern = pattern + self.unit = unit + self.mappings = mappings + self.switchSupport = switchSupport + self.releaseOnly = releaseOnly + self.sendFrequency = sendFrequency + self.refresh = refresh + self.height = height + self.minValue = minValue + self.maxValue = maxValue + self.step = step + self.inputHint = inputHint + self.url = url + self.encoding = encoding + self.service = service + self.period = period + self.yAxisDecimalPattern = yAxisDecimalPattern + self.legend = legend + self.forceAsItem = forceAsItem + self.row = row + self.column = column + self.command = command + self.releaseCommand = releaseCommand + self.stateless = stateless + self.state = state + self.item = item + self.linkedPage = linkedPage + self.widgets = widgets + } + + typealias CodingKeys = Components.Schemas.WidgetDTO.CodingKeys + } + } + + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent`. + struct SitemapWidgetEvent: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/widgetId`. + var widgetId: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/labelSource`. + var labelSource: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/icon`. + var icon: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/labelcolor`. + var labelcolor: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/valuecolor`. + var valuecolor: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/iconcolor`. + var iconcolor: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/state`. + var state: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/reloadIcon`. + var reloadIcon: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/visibility`. + var visibility: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/descriptionChanged`. + var descriptionChanged: Swift.Bool? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/item`. + var item: Components.Schemas.EnrichedItemDTO? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/sitemapName`. + var sitemapName: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapWidgetEvent/pageId`. + var pageId: Swift.String? + /// Creates a new `SitemapWidgetEvent`. + /// + /// - Parameters: + /// - widgetId: + /// - label: + /// - labelSource: + /// - icon: + /// - labelcolor: + /// - valuecolor: + /// - iconcolor: + /// - state: + /// - reloadIcon: + /// - visibility: + /// - descriptionChanged: + /// - item: + /// - sitemapName: + /// - pageId: + init(widgetId: Swift.String? = nil, + label: Swift.String? = nil, + labelSource: Swift.String? = nil, + icon: Swift.String? = nil, + labelcolor: Swift.String? = nil, + valuecolor: Swift.String? = nil, + iconcolor: Swift.String? = nil, + state: Swift.String? = nil, + reloadIcon: Swift.Bool? = nil, + visibility: Swift.Bool? = nil, + descriptionChanged: Swift.Bool? = nil, + item: Components.Schemas.EnrichedItemDTO? = nil, + sitemapName: Swift.String? = nil, + pageId: Swift.String? = nil) { + self.widgetId = widgetId + self.label = label + self.labelSource = labelSource + self.icon = icon + self.labelcolor = labelcolor + self.valuecolor = valuecolor + self.iconcolor = iconcolor + self.state = state + self.reloadIcon = reloadIcon + self.visibility = visibility + self.descriptionChanged = descriptionChanged + self.item = item + self.sitemapName = sitemapName + self.pageId = pageId + } + + enum CodingKeys: String, CodingKey { + case widgetId + case label + case labelSource + case icon + case labelcolor + case valuecolor + case iconcolor + case state + case reloadIcon + case visibility + case descriptionChanged + case item + case sitemapName + case pageId + } + } + + /// - Remark: Generated from `#/components/schemas/SitemapDTO`. + struct SitemapDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/SitemapDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapDTO/icon`. + var icon: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapDTO/label`. + var label: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapDTO/link`. + var link: Swift.String? + /// - Remark: Generated from `#/components/schemas/SitemapDTO/homepage`. + var homepage: Components.Schemas.PageDTO? + /// Creates a new `SitemapDTO`. + /// + /// - Parameters: + /// - name: + /// - icon: + /// - label: + /// - link: + /// - homepage: + init(name: Swift.String? = nil, + icon: Swift.String? = nil, + label: Swift.String? = nil, + link: Swift.String? = nil, + homepage: Components.Schemas.PageDTO? = nil) { + self.name = name + self.icon = icon + self.label = label + self.link = link + self.homepage = homepage + } + + enum CodingKeys: String, CodingKey { + case name + case icon + case label + case link + case homepage + } + } + + /// - Remark: Generated from `#/components/schemas/RootUIComponent`. + struct RootUIComponent: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/RootUIComponent/component`. + var component: Swift.String? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/config`. + struct configPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + var additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] + /// Creates a new `configPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + init(additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] = .init()) { + self.additionalProperties = additionalProperties + } + + init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + + func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + + /// - Remark: Generated from `#/components/schemas/RootUIComponent/config`. + var config: Components.Schemas.RootUIComponent.configPayload? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/slots`. + struct slotsPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + var additionalProperties: [String: [Components.Schemas.UIComponent]] + /// Creates a new `slotsPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + init(additionalProperties: [String: [Components.Schemas.UIComponent]] = .init()) { + self.additionalProperties = additionalProperties + } + + init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + + func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + + /// - Remark: Generated from `#/components/schemas/RootUIComponent/slots`. + var slots: Components.Schemas.RootUIComponent.slotsPayload? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/uid`. + var uid: Swift.String? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/tags`. + var tags: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/props`. + var props: Components.Schemas.ConfigDescriptionDTO? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/timestamp`. + var timestamp: Foundation.Date? + /// - Remark: Generated from `#/components/schemas/RootUIComponent/type`. + var _type: Swift.String? + /// Creates a new `RootUIComponent`. + /// + /// - Parameters: + /// - component: + /// - config: + /// - slots: + /// - uid: + /// - tags: + /// - props: + /// - timestamp: + /// - _type: + init(component: Swift.String? = nil, + config: Components.Schemas.RootUIComponent.configPayload? = nil, + slots: Components.Schemas.RootUIComponent.slotsPayload? = nil, + uid: Swift.String? = nil, + tags: [Swift.String]? = nil, + props: Components.Schemas.ConfigDescriptionDTO? = nil, + timestamp: Foundation.Date? = nil, + _type: Swift.String? = nil) { + self.component = component + self.config = config + self.slots = slots + self.uid = uid + self.tags = tags + self.props = props + self.timestamp = timestamp + self._type = _type + } + + enum CodingKeys: String, CodingKey { + case component + case config + case slots + case uid + case tags + case props + case timestamp + case _type = "type" + } + } + + /// - Remark: Generated from `#/components/schemas/UIComponent`. + struct UIComponent: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/UIComponent/component`. + var component: Swift.String? + /// - Remark: Generated from `#/components/schemas/UIComponent/config`. + struct configPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + var additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] + /// Creates a new `configPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + init(additionalProperties: [String: OpenAPIRuntime.OpenAPIObjectContainer] = .init()) { + self.additionalProperties = additionalProperties + } + + init(from decoder: any Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + + func encode(to encoder: any Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + + /// - Remark: Generated from `#/components/schemas/UIComponent/config`. + var config: Components.Schemas.UIComponent.configPayload? + /// - Remark: Generated from `#/components/schemas/UIComponent/type`. + var _type: Swift.String? + /// Creates a new `UIComponent`. + /// + /// - Parameters: + /// - component: + /// - config: + /// - _type: + init(component: Swift.String? = nil, + config: Components.Schemas.UIComponent.configPayload? = nil, + _type: Swift.String? = nil) { + self.component = component + self.config = config + self._type = _type + } + + enum CodingKeys: String, CodingKey { + case component + case config + case _type = "type" + } + } + + /// - Remark: Generated from `#/components/schemas/TileDTO`. + struct TileDTO: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/TileDTO/name`. + var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/TileDTO/url`. + var url: Swift.String? + /// - Remark: Generated from `#/components/schemas/TileDTO/overlay`. + var overlay: Swift.String? + /// - Remark: Generated from `#/components/schemas/TileDTO/imageUrl`. + var imageUrl: Swift.String? + /// Creates a new `TileDTO`. + /// + /// - Parameters: + /// - name: + /// - url: + /// - overlay: + /// - imageUrl: + init(name: Swift.String? = nil, + url: Swift.String? = nil, + overlay: Swift.String? = nil, + imageUrl: Swift.String? = nil) { + self.name = name + self.url = url + self.overlay = overlay + self.imageUrl = imageUrl + } + + enum CodingKeys: String, CodingKey { + case name + case url + case overlay + case imageUrl + } + } + } + + /// Types generated from the `#/components/parameters` section of the OpenAPI document. + enum Parameters {} + /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. + enum RequestBodies {} + /// Types generated from the `#/components/responses` section of the OpenAPI document. + enum Responses {} + /// Types generated from the `#/components/headers` section of the OpenAPI document. + enum Headers {} +} + +/// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. +enum Operations { + /// Adds a new member to a group item. + /// + /// - Remark: HTTP `PUT /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)`. + enum addMemberToGroupItem { + static let id: Swift.String = "addMemberToGroupItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemName}/members/{memberItemName}/PUT/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemName}/members/{memberItemName}/PUT/path/itemName`. + var itemName: Swift.String + /// member item name + /// + /// - Remark: Generated from `#/paths/items/{itemName}/members/{memberItemName}/PUT/path/memberItemName`. + var memberItemName: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemName: item name + /// - memberItemName: member item name + init(itemName: Swift.String, + memberItemName: Swift.String) { + self.itemName = itemName + self.memberItemName = memberItemName + } + } + + var path: Operations.addMemberToGroupItem.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.addMemberToGroupItem.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.addMemberToGroupItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.addMemberToGroupItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item or member item not found or item is not of type group item. + /// + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.addMemberToGroupItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.addMemberToGroupItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Member item is not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/put(addMemberToGroupItem)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.addMemberToGroupItem.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.addMemberToGroupItem.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Removes an existing member from a group item. + /// + /// - Remark: HTTP `DELETE /items/{itemName}/members/{memberItemName}`. + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)`. + enum removeMemberFromGroupItem { + static let id: Swift.String = "removeMemberFromGroupItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemName}/members/{memberItemName}/DELETE/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemName}/members/{memberItemName}/DELETE/path/itemName`. + var itemName: Swift.String + /// member item name + /// + /// - Remark: Generated from `#/paths/items/{itemName}/members/{memberItemName}/DELETE/path/memberItemName`. + var memberItemName: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemName: item name + /// - memberItemName: member item name + init(itemName: Swift.String, + memberItemName: Swift.String) { + self.itemName = itemName + self.memberItemName = memberItemName + } + } + + var path: Operations.removeMemberFromGroupItem.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.removeMemberFromGroupItem.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.removeMemberFromGroupItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.removeMemberFromGroupItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item or member item not found or item is not of type group item. + /// + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.removeMemberFromGroupItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.removeMemberFromGroupItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Member item is not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemName}/members/{memberItemName}/delete(removeMemberFromGroupItem)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.removeMemberFromGroupItem.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.removeMemberFromGroupItem.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Adds metadata to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)`. + enum addMetadataToItem { + static let id: Swift.String = "addMetadataToItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/PUT/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/PUT/path/itemname`. + var itemname: Swift.String + /// namespace + /// + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/PUT/path/namespace`. + var namespace: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + /// - namespace: namespace + init(itemname: Swift.String, + namespace: Swift.String) { + self.itemname = itemname + self.namespace = namespace + } + } + + var path: Operations.addMetadataToItem.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/PUT/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/PUT/requestBody/content/application\/json`. + case json(Components.Schemas.MetadataDTO) + } + + var body: Operations.addMetadataToItem.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - body: + init(path: Operations.addMetadataToItem.Input.Path, + body: Operations.addMetadataToItem.Input.Body) { + self.path = path + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.addMetadataToItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.addMetadataToItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct Created: Sendable, Hashable { + /// Creates a new `Created`. + init() {} + } + + /// Created + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.addMetadataToItem.Output.Created) + /// The associated value of the enum case if `self` is `.created`. + /// + /// - Throws: An error if `self` is not `.created`. + /// - SeeAlso: `.created`. + var created: Operations.addMetadataToItem.Output.Created { + get throws { + switch self { + case let .created(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Metadata value empty. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.addMetadataToItem.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.addMetadataToItem.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.addMetadataToItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.addMetadataToItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Metadata not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/put(addMetadataToItem)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.addMetadataToItem.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.addMetadataToItem.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Removes metadata from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/metadata/{namespace}`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)`. + enum removeMetadataFromItem { + static let id: Swift.String = "removeMetadataFromItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/DELETE/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/DELETE/path/itemname`. + var itemname: Swift.String + /// namespace + /// + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/{namespace}/DELETE/path/namespace`. + var namespace: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + /// - namespace: namespace + init(itemname: Swift.String, + namespace: Swift.String) { + self.itemname = itemname + self.namespace = namespace + } + } + + var path: Operations.removeMetadataFromItem.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.removeMetadataFromItem.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.removeMetadataFromItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.removeMetadataFromItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.removeMetadataFromItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.removeMetadataFromItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Meta data not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/{namespace}/delete(removeMetadataFromItem)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.removeMetadataFromItem.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.removeMetadataFromItem.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Adds a tag to an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)`. + enum addTagToItem { + static let id: Swift.String = "addTagToItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/tags/{tag}/PUT/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/tags/{tag}/PUT/path/itemname`. + var itemname: Swift.String + /// tag + /// + /// - Remark: Generated from `#/paths/items/{itemname}/tags/{tag}/PUT/path/tag`. + var tag: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + /// - tag: tag + init(itemname: Swift.String, + tag: Swift.String) { + self.itemname = itemname + self.tag = tag + } + } + + var path: Operations.addTagToItem.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.addTagToItem.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.addTagToItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.addTagToItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.addTagToItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.addTagToItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Item not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/put(addTagToItem)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.addTagToItem.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.addTagToItem.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Removes a tag from an item. + /// + /// - Remark: HTTP `DELETE /items/{itemname}/tags/{tag}`. + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)`. + enum removeTagFromItem { + static let id: Swift.String = "removeTagFromItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/tags/{tag}/DELETE/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/tags/{tag}/DELETE/path/itemname`. + var itemname: Swift.String + /// tag + /// + /// - Remark: Generated from `#/paths/items/{itemname}/tags/{tag}/DELETE/path/tag`. + var tag: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + /// - tag: tag + init(itemname: Swift.String, + tag: Swift.String) { + self.itemname = itemname + self.tag = tag + } + } + + var path: Operations.removeTagFromItem.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.removeTagFromItem.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.removeTagFromItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.removeTagFromItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.removeTagFromItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.removeTagFromItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Item not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/tags/{tag}/delete(removeTagFromItem)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.removeTagFromItem.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.removeTagFromItem.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Gets a single item. + /// + /// - Remark: HTTP `GET /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/get(getItemByName)`. + enum getItemByName { + static let id: Swift.String = "getItemByName" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/GET/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/GET/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.getItemByName.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/GET/query`. + struct Query: Sendable, Hashable { + /// metadata selector - a comma separated list or a regular expression (returns all if no value given) + /// + /// - Remark: Generated from `#/paths/items/{itemname}/GET/query/metadata`. + var metadata: Swift.String? + /// get member items if the item is a group item + /// + /// - Remark: Generated from `#/paths/items/{itemname}/GET/query/recursive`. + var recursive: Swift.Bool? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - metadata: metadata selector - a comma separated list or a regular expression (returns all if no value given) + /// - recursive: get member items if the item is a group item + init(metadata: Swift.String? = nil, + recursive: Swift.Bool? = nil) { + self.metadata = metadata + self.recursive = recursive + } + } + + var query: Operations.getItemByName.Input.Query + /// - Remark: Generated from `#/paths/items/{itemname}/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/items/{itemname}/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.accept = accept + } + } + + var headers: Operations.getItemByName.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + init(path: Operations.getItemByName.Input.Path, + query: Operations.getItemByName.Input.Query = .init(), + headers: Operations.getItemByName.Input.Headers = .init()) { + self.path = path + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.EnrichedItemDTO) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.EnrichedItemDTO { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getItemByName.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getItemByName.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/get(getItemByName)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getItemByName.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getItemByName.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found + /// + /// - Remark: Generated from `#/paths//items/{itemname}/get(getItemByName)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getItemByName.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getItemByName.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Sends a command to an item. + /// + /// - Remark: HTTP `POST /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)`. + enum sendItemCommand { + static let id: Swift.String = "sendItemCommand" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/POST/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/POST/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.sendItemCommand.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/POST/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/POST/requestBody/content/text\/plain`. + case plainText(OpenAPIRuntime.HTTPBody) + } + + var body: Operations.sendItemCommand.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - body: + init(path: Operations.sendItemCommand.Input.Path, + body: Operations.sendItemCommand.Input.Body) { + self.path = path + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.sendItemCommand.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.sendItemCommand.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Item command null + /// + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.sendItemCommand.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.sendItemCommand.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found + /// + /// - Remark: Generated from `#/paths//items/{itemname}/post(sendItemCommand)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.sendItemCommand.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.sendItemCommand.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Adds a new item to the registry or updates the existing item. + /// + /// - Remark: HTTP `PUT /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)`. + enum addOrUpdateItemInRegistry { + static let id: Swift.String = "addOrUpdateItemInRegistry" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.addOrUpdateItemInRegistry.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.accept = accept + } + } + + var headers: Operations.addOrUpdateItemInRegistry.Input.Headers + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/requestBody/content/application\/json`. + case json(Components.Schemas.GroupItemDTO) + } + + var body: Operations.addOrUpdateItemInRegistry.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + init(path: Operations.addOrUpdateItemInRegistry.Input.Path, + headers: Operations.addOrUpdateItemInRegistry.Input.Headers = .init(), + body: Operations.addOrUpdateItemInRegistry.Input.Body) { + self.path = path + self.headers = headers + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/PUT/responses/200/content/*\/*`. + case any(OpenAPIRuntime.HTTPBody) + /// The associated value of the enum case if `self` is `.any`. + /// + /// - Throws: An error if `self` is not `.any`. + /// - SeeAlso: `.any`. + var any: OpenAPIRuntime.HTTPBody { + get throws { + switch self { + case let .any(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.addOrUpdateItemInRegistry.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.addOrUpdateItemInRegistry.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.addOrUpdateItemInRegistry.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.addOrUpdateItemInRegistry.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct Created: Sendable, Hashable { + /// Creates a new `Created`. + init() {} + } + + /// Item created. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.addOrUpdateItemInRegistry.Output.Created) + /// The associated value of the enum case if `self` is `.created`. + /// + /// - Throws: An error if `self` is not `.created`. + /// - SeeAlso: `.created`. + var created: Operations.addOrUpdateItemInRegistry.Output.Created { + get throws { + switch self { + case let .created(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Payload invalid. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.addOrUpdateItemInRegistry.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.addOrUpdateItemInRegistry.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found or name in path invalid. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.addOrUpdateItemInRegistry.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.addOrUpdateItemInRegistry.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + struct MethodNotAllowed: Sendable, Hashable { + /// Creates a new `MethodNotAllowed`. + init() {} + } + + /// Item not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/put(addOrUpdateItemInRegistry)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.addOrUpdateItemInRegistry.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + var methodNotAllowed: Operations.addOrUpdateItemInRegistry.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case any + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "*/*": + self = .any + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .any: + "*/*" + } + } + + static var allCases: [Self] { + [ + .any + ] + } + } + } + + /// Removes an item from the registry. + /// + /// - Remark: HTTP `DELETE /items/{itemname}`. + /// - Remark: Generated from `#/paths//items/{itemname}/delete(removeItemFromRegistry)`. + enum removeItemFromRegistry { + static let id: Swift.String = "removeItemFromRegistry" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/DELETE/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/DELETE/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.removeItemFromRegistry.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.removeItemFromRegistry.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/delete(removeItemFromRegistry)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.removeItemFromRegistry.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.removeItemFromRegistry.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found or item is not editable. + /// + /// - Remark: Generated from `#/paths//items/{itemname}/delete(removeItemFromRegistry)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.removeItemFromRegistry.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.removeItemFromRegistry.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Get all available items. + /// + /// - Remark: HTTP `GET /items`. + /// - Remark: Generated from `#/paths//items/get(getItems)`. + enum getItems { + static let id: Swift.String = "getItems" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/GET/query`. + struct Query: Sendable, Hashable { + /// item type filter + /// + /// - Remark: Generated from `#/paths/items/GET/query/type`. + var _type: Swift.String? + /// item tag filter + /// + /// - Remark: Generated from `#/paths/items/GET/query/tags`. + var tags: Swift.String? + /// metadata selector - a comma separated list or a regular expression (returns all if no value given) + /// + /// - Remark: Generated from `#/paths/items/GET/query/metadata`. + var metadata: Swift.String? + /// get member items recursively + /// + /// - Remark: Generated from `#/paths/items/GET/query/recursive`. + var recursive: Swift.Bool? + /// limit output to the given fields (comma separated) + /// + /// - Remark: Generated from `#/paths/items/GET/query/fields`. + var fields: Swift.String? + /// provides a cacheable list of values not expected to change regularly and checks the If-Modified-Since header, all other parameters are ignored except "metadata" + /// + /// - Remark: Generated from `#/paths/items/GET/query/staticDataOnly`. + var staticDataOnly: Swift.Bool? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - _type: item type filter + /// - tags: item tag filter + /// - metadata: metadata selector - a comma separated list or a regular expression (returns all if no value given) + /// - recursive: get member items recursively + /// - fields: limit output to the given fields (comma separated) + /// - staticDataOnly: provides a cacheable list of values not expected to change regularly and checks the If-Modified-Since header, all other parameters are ignored except "metadata" + init(_type: Swift.String? = nil, + tags: Swift.String? = nil, + metadata: Swift.String? = nil, + recursive: Swift.Bool? = nil, + fields: Swift.String? = nil, + staticDataOnly: Swift.Bool? = nil) { + self._type = _type + self.tags = tags + self.metadata = metadata + self.recursive = recursive + self.fields = fields + self.staticDataOnly = staticDataOnly + } + } + + var query: Operations.getItems.Input.Query + /// - Remark: Generated from `#/paths/items/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/items/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.accept = accept + } + } + + var headers: Operations.getItems.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - query: + /// - headers: + init(query: Operations.getItems.Input.Query = .init(), + headers: Operations.getItems.Input.Headers = .init()) { + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/GET/responses/200/content/application\/json`. + case json([Components.Schemas.EnrichedItemDTO]) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: [Components.Schemas.EnrichedItemDTO] { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getItems.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getItems.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/get(getItems)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getItems.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getItems.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Adds a list of items to the registry or updates the existing items. + /// + /// - Remark: HTTP `PUT /items`. + /// - Remark: Generated from `#/paths//items/put(addOrUpdateItemsInRegistry)`. + enum addOrUpdateItemsInRegistry { + static let id: Swift.String = "addOrUpdateItemsInRegistry" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/PUT/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.addOrUpdateItemsInRegistry.Input.Headers + /// - Remark: Generated from `#/paths/items/PUT/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/PUT/requestBody/content/application\/json`. + case json([Components.Schemas.GroupItemDTO]) + } + + var body: Operations.addOrUpdateItemsInRegistry.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + /// - body: + init(headers: Operations.addOrUpdateItemsInRegistry.Input.Headers = .init(), + body: Operations.addOrUpdateItemsInRegistry.Input.Body) { + self.headers = headers + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/PUT/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/PUT/responses/200/content/*\/*`. + case any(OpenAPIRuntime.HTTPBody) + /// The associated value of the enum case if `self` is `.any`. + /// + /// - Throws: An error if `self` is not `.any`. + /// - SeeAlso: `.any`. + var any: OpenAPIRuntime.HTTPBody { + get throws { + switch self { + case let .any(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.addOrUpdateItemsInRegistry.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.addOrUpdateItemsInRegistry.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/put(addOrUpdateItemsInRegistry)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.addOrUpdateItemsInRegistry.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.addOrUpdateItemsInRegistry.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Payload is invalid. + /// + /// - Remark: Generated from `#/paths//items/put(addOrUpdateItemsInRegistry)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.addOrUpdateItemsInRegistry.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.addOrUpdateItemsInRegistry.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case any + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "*/*": + self = .any + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .any: + "*/*" + } + } + + static var allCases: [Self] { + [ + .any + ] + } + } + } + + /// Gets the state of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/get(getItemState_1)`. + enum getItemState_1 { + static let id: Swift.String = "getItemState_1" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/state/GET/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/state/GET/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.getItemState_1.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/state/GET/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.getItemState_1.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + init(path: Operations.getItemState_1.Input.Path, + headers: Operations.getItemState_1.Input.Headers = .init()) { + self.path = path + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/state/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/state/GET/responses/200/content/text\/plain`. + case plainText(OpenAPIRuntime.HTTPBody) + /// The associated value of the enum case if `self` is `.plainText`. + /// + /// - Throws: An error if `self` is not `.plainText`. + /// - SeeAlso: `.plainText`. + var plainText: OpenAPIRuntime.HTTPBody { + get throws { + switch self { + case let .plainText(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getItemState_1.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getItemState_1.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/state/get(getItemState_1)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getItemState_1.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getItemState_1.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found + /// + /// - Remark: Generated from `#/paths//items/{itemname}/state/get(getItemState_1)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getItemState_1.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getItemState_1.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case plainText + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "text/plain": + self = .plainText + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .plainText: + "text/plain" + } + } + + static var allCases: [Self] { + [ + .plainText + ] + } + } + } + + /// Updates the state of an item. + /// + /// - Remark: HTTP `PUT /items/{itemname}/state`. + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)`. + enum updateItemState { + static let id: Swift.String = "updateItemState" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/state/PUT/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/state/PUT/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.updateItemState.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/state/PUT/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/items/{itemname}/state/PUT/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + init(Accept_hyphen_Language: Swift.String? = nil) { + self.Accept_hyphen_Language = Accept_hyphen_Language + } + } + + var headers: Operations.updateItemState.Input.Headers + /// - Remark: Generated from `#/paths/items/{itemname}/state/PUT/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/state/PUT/requestBody/content/text\/plain`. + case plainText(OpenAPIRuntime.HTTPBody) + } + + var body: Operations.updateItemState.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + init(path: Operations.updateItemState.Input.Path, + headers: Operations.updateItemState.Input.Headers = .init(), + body: Operations.updateItemState.Input.Body) { + self.path = path + self.headers = headers + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Accepted: Sendable, Hashable { + /// Creates a new `Accepted`. + init() {} + } + + /// Accepted + /// + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)/responses/202`. + /// + /// HTTP response code: `202 accepted`. + case accepted(Operations.updateItemState.Output.Accepted) + /// The associated value of the enum case if `self` is `.accepted`. + /// + /// - Throws: An error if `self` is not `.accepted`. + /// - SeeAlso: `.accepted`. + var accepted: Operations.updateItemState.Output.Accepted { + get throws { + switch self { + case let .accepted(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "accepted", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Item state null + /// + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.updateItemState.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.updateItemState.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found + /// + /// - Remark: Generated from `#/paths//items/{itemname}/state/put(updateItemState)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.updateItemState.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.updateItemState.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Gets the namespace of an item. + /// + /// - Remark: HTTP `GET /items/{itemname}/metadata/namespaces`. + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/namespaces/get(getItemNamespaces)`. + enum getItemNamespaces { + static let id: Swift.String = "getItemNamespaces" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/namespaces/GET/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/namespaces/GET/path/itemname`. + var itemname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemname: item name + init(itemname: Swift.String) { + self.itemname = itemname + } + } + + var path: Operations.getItemNamespaces.Input.Path + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/namespaces/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/namespaces/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.accept = accept + } + } + + var headers: Operations.getItemNamespaces.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + init(path: Operations.getItemNamespaces.Input.Path, + headers: Operations.getItemNamespaces.Input.Headers = .init()) { + self.path = path + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/namespaces/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemname}/metadata/namespaces/GET/responses/200/content/application\/json`. + case json(Swift.String) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Swift.String { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getItemNamespaces.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getItemNamespaces.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/namespaces/get(getItemNamespaces)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getItemNamespaces.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getItemNamespaces.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found + /// + /// - Remark: Generated from `#/paths//items/{itemname}/metadata/namespaces/get(getItemNamespaces)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getItemNamespaces.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getItemNamespaces.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Gets the item which defines the requested semantics of an item. + /// + /// - Remark: HTTP `GET /items/{itemName}/semantic/{semanticClass}`. + /// - Remark: Generated from `#/paths//items/{itemName}/semantic/{semanticClass}/get(getSemanticItem)`. + enum getSemanticItem { + static let id: Swift.String = "getSemanticItem" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/items/{itemName}/semantic/{semanticClass}/GET/path`. + struct Path: Sendable, Hashable { + /// item name + /// + /// - Remark: Generated from `#/paths/items/{itemName}/semantic/{semanticClass}/GET/path/itemName`. + var itemName: Swift.String + /// semantic class + /// + /// - Remark: Generated from `#/paths/items/{itemName}/semantic/{semanticClass}/GET/path/semanticClass`. + var semanticClass: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - itemName: item name + /// - semanticClass: semantic class + init(itemName: Swift.String, + semanticClass: Swift.String) { + self.itemName = itemName + self.semanticClass = semanticClass + } + } + + var path: Operations.getSemanticItem.Input.Path + /// - Remark: Generated from `#/paths/items/{itemName}/semantic/{semanticClass}/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/items/{itemName}/semantic/{semanticClass}/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + init(Accept_hyphen_Language: Swift.String? = nil) { + self.Accept_hyphen_Language = Accept_hyphen_Language + } + } + + var headers: Operations.getSemanticItem.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + init(path: Operations.getSemanticItem.Input.Path, + headers: Operations.getSemanticItem.Input.Headers = .init()) { + self.path = path + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/{itemName}/semantic/{semanticClass}/get(getSemanticItem)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getSemanticItem.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getSemanticItem.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Item not found + /// + /// - Remark: Generated from `#/paths//items/{itemName}/semantic/{semanticClass}/get(getSemanticItem)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getSemanticItem.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getSemanticItem.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Remove unused/orphaned metadata. + /// + /// - Remark: HTTP `POST /items/metadata/purge`. + /// - Remark: Generated from `#/paths//items/metadata/purge/post(purgeDatabase)`. + enum purgeDatabase { + static let id: Swift.String = "purgeDatabase" + struct Input: Sendable, Hashable { + /// Creates a new `Input`. + init() {} + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//items/metadata/purge/post(purgeDatabase)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.purgeDatabase.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.purgeDatabase.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Creates a sitemap event subscription. + /// + /// - Remark: HTTP `POST /sitemaps/events/subscribe`. + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)`. + enum createSitemapEventSubscription { + static let id: Swift.String = "createSitemapEventSubscription" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/subscribe/POST/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.createSitemapEventSubscription.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + init(headers: Operations.createSitemapEventSubscription.Input.Headers = .init()) { + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Created: Sendable, Hashable { + /// Creates a new `Created`. + init() {} + } + + /// Subscription created. + /// + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.createSitemapEventSubscription.Output.Created) + /// The associated value of the enum case if `self` is `.created`. + /// + /// - Throws: An error if `self` is not `.created`. + /// - SeeAlso: `.created`. + var created: Operations.createSitemapEventSubscription.Output.Created { + get throws { + switch self { + case let .created(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/subscribe/POST/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/subscribe/POST/responses/200/content/application\/json`. + case json(Components.Schemas.JerseyResponseBuilderDTO) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.JerseyResponseBuilderDTO { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.createSitemapEventSubscription.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.createSitemapEventSubscription.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.createSitemapEventSubscription.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.createSitemapEventSubscription.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct ServiceUnavailable: Sendable, Hashable { + /// Creates a new `ServiceUnavailable`. + init() {} + } + + /// Subscriptions limit reached. + /// + /// - Remark: Generated from `#/paths//sitemaps/events/subscribe/post(createSitemapEventSubscription)/responses/503`. + /// + /// HTTP response code: `503 serviceUnavailable`. + case serviceUnavailable(Operations.createSitemapEventSubscription.Output.ServiceUnavailable) + /// The associated value of the enum case if `self` is `.serviceUnavailable`. + /// + /// - Throws: An error if `self` is not `.serviceUnavailable`. + /// - SeeAlso: `.serviceUnavailable`. + var serviceUnavailable: Operations.createSitemapEventSubscription.Output.ServiceUnavailable { + get throws { + switch self { + case let .serviceUnavailable(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "serviceUnavailable", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Polls the data for one page of a sitemap. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/{pageid}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)`. + enum pollDataForPage { + static let id: Swift.String = "pollDataForPage" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/path`. + struct Path: Sendable, Hashable { + /// sitemap name + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/path/sitemapname`. + var sitemapname: Swift.String + /// page id + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/path/pageid`. + var pageid: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - sitemapname: sitemap name + /// - pageid: page id + init(sitemapname: Swift.String, + pageid: Swift.String) { + self.sitemapname = sitemapname + self.pageid = pageid + } + } + + var path: Operations.pollDataForPage.Input.Path + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/query`. + struct Query: Sendable, Hashable { + /// subscriptionid + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/query/subscriptionid`. + var subscriptionid: Swift.String? + /// include hidden widgets + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/query/includeHidden`. + var includeHidden: Swift.Bool? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - subscriptionid: subscriptionid + /// - includeHidden: include hidden widgets + init(subscriptionid: Swift.String? = nil, + includeHidden: Swift.Bool? = nil) { + self.subscriptionid = subscriptionid + self.includeHidden = includeHidden + } + } + + var query: Operations.pollDataForPage.Input.Query + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + /// X-Atmosphere-Transport for long polling + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/header/X-Atmosphere-Transport`. + var X_hyphen_Atmosphere_hyphen_Transport: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - X_hyphen_Atmosphere_hyphen_Transport: X-Atmosphere-Transport for long polling + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + X_hyphen_Atmosphere_hyphen_Transport: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.X_hyphen_Atmosphere_hyphen_Transport = X_hyphen_Atmosphere_hyphen_Transport + self.accept = accept + } + } + + var headers: Operations.pollDataForPage.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + init(path: Operations.pollDataForPage.Input.Path, + query: Operations.pollDataForPage.Input.Query = .init(), + headers: Operations.pollDataForPage.Input.Headers = .init()) { + self.path = path + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/{pageid}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.PageDTO) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.PageDTO { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.pollDataForPage.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.pollDataForPage.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.pollDataForPage.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.pollDataForPage.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Invalid subscription id has been provided. + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.pollDataForPage.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.pollDataForPage.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Sitemap with requested name does not exist or page does not exist, or page refers to a non-linkable widget + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/{pageid}/get(pollDataForPage)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.pollDataForPage.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.pollDataForPage.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Polls the data for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}/*`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)`. + enum pollDataForSitemap { + static let id: Swift.String = "pollDataForSitemap" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/path`. + struct Path: Sendable, Hashable { + /// sitemap name + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/path/sitemapname`. + var sitemapname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - sitemapname: sitemap name + init(sitemapname: Swift.String) { + self.sitemapname = sitemapname + } + } + + var path: Operations.pollDataForSitemap.Input.Path + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/query`. + struct Query: Sendable, Hashable { + /// subscriptionid + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/query/subscriptionid`. + var subscriptionid: Swift.String? + /// include hidden widgets + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/query/includeHidden`. + var includeHidden: Swift.Bool? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - subscriptionid: subscriptionid + /// - includeHidden: include hidden widgets + init(subscriptionid: Swift.String? = nil, + includeHidden: Swift.Bool? = nil) { + self.subscriptionid = subscriptionid + self.includeHidden = includeHidden + } + } + + var query: Operations.pollDataForSitemap.Input.Query + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + /// X-Atmosphere-Transport for long polling + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/header/X-Atmosphere-Transport`. + var X_hyphen_Atmosphere_hyphen_Transport: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - X_hyphen_Atmosphere_hyphen_Transport: X-Atmosphere-Transport for long polling + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + X_hyphen_Atmosphere_hyphen_Transport: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.X_hyphen_Atmosphere_hyphen_Transport = X_hyphen_Atmosphere_hyphen_Transport + self.accept = accept + } + } + + var headers: Operations.pollDataForSitemap.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + init(path: Operations.pollDataForSitemap.Input.Path, + query: Operations.pollDataForSitemap.Input.Query = .init(), + headers: Operations.pollDataForSitemap.Input.Headers = .init()) { + self.path = path + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/*/GET/responses/200/content/application\/json`. + case json(Components.Schemas.SitemapDTO) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.SitemapDTO { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.pollDataForSitemap.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.pollDataForSitemap.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.pollDataForSitemap.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.pollDataForSitemap.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Invalid subscription id has been provided. + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.pollDataForSitemap.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.pollDataForSitemap.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Sitemap with requested name does not exist + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/*/get(pollDataForSitemap)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.pollDataForSitemap.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.pollDataForSitemap.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Get sitemap by name. + /// + /// - Remark: HTTP `GET /sitemaps/{sitemapname}`. + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/get(getSitemapByName)`. + enum getSitemapByName { + static let id: Swift.String = "getSitemapByName" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/path`. + struct Path: Sendable, Hashable { + /// sitemap name + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/path/sitemapname`. + var sitemapname: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - sitemapname: sitemap name + init(sitemapname: Swift.String) { + self.sitemapname = sitemapname + } + } + + var path: Operations.getSitemapByName.Input.Path + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/query`. + struct Query: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/query/type`. + var _type: Swift.String? + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/query/jsoncallback`. + var jsoncallback: Swift.String? + /// include hidden widgets + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/query/includeHidden`. + var includeHidden: Swift.Bool? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - _type: + /// - jsoncallback: + /// - includeHidden: include hidden widgets + init(_type: Swift.String? = nil, + jsoncallback: Swift.String? = nil, + includeHidden: Swift.Bool? = nil) { + self._type = _type + self.jsoncallback = jsoncallback + self.includeHidden = includeHidden + } + } + + var query: Operations.getSitemapByName.Input.Query + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/header`. + struct Headers: Sendable, Hashable { + /// language + /// + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/header/Accept-Language`. + var Accept_hyphen_Language: Swift.String? + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - Accept_hyphen_Language: language + /// - accept: + init(Accept_hyphen_Language: Swift.String? = nil, + accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.Accept_hyphen_Language = Accept_hyphen_Language + self.accept = accept + } + } + + var headers: Operations.getSitemapByName.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + init(path: Operations.getSitemapByName.Input.Path, + query: Operations.getSitemapByName.Input.Query = .init(), + headers: Operations.getSitemapByName.Input.Headers = .init()) { + self.path = path + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/{sitemapname}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.SitemapDTO) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.SitemapDTO { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getSitemapByName.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getSitemapByName.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/{sitemapname}/get(getSitemapByName)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getSitemapByName.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getSitemapByName.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Get sitemap events for a whole sitemap. Not recommended due to potentially high traffic. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}/*`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)`. + enum getSitemapEvents { + static let id: Swift.String = "getSitemapEvents" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/*/GET/path`. + struct Path: Sendable, Hashable { + /// subscription id + /// + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/*/GET/path/subscriptionid`. + var subscriptionid: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - subscriptionid: subscription id + init(subscriptionid: Swift.String) { + self.subscriptionid = subscriptionid + } + } + + var path: Operations.getSitemapEvents.Input.Path + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/*/GET/query`. + struct Query: Sendable, Hashable { + /// sitemap name + /// + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/*/GET/query/sitemap`. + var sitemap: Swift.String? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - sitemap: sitemap name + init(sitemap: Swift.String? = nil) { + self.sitemap = sitemap + } + } + + var query: Operations.getSitemapEvents.Input.Query + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + init(path: Operations.getSitemapEvents.Input.Path, + query: Operations.getSitemapEvents.Input.Query = .init()) { + self.path = path + self.query = query + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getSitemapEvents.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getSitemapEvents.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Missing sitemap parameter, or sitemap not linked successfully to the subscription. + /// + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.getSitemapEvents.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.getSitemapEvents.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Subscription not found. + /// + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/*/get(getSitemapEvents)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getSitemapEvents.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getSitemapEvents.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Get sitemap events. + /// + /// - Remark: HTTP `GET /sitemaps/events/{subscriptionid}`. + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)`. + enum getSitemapEvents_1 { + static let id: Swift.String = "getSitemapEvents_1" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/path`. + struct Path: Sendable, Hashable { + /// subscription id + /// + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/path/subscriptionid`. + var subscriptionid: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - subscriptionid: subscription id + init(subscriptionid: Swift.String) { + self.subscriptionid = subscriptionid + } + } + + var path: Operations.getSitemapEvents_1.Input.Path + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/query`. + struct Query: Sendable, Hashable { + /// sitemap name + /// + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/query/sitemap`. + var sitemap: Swift.String? + /// page id + /// + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/query/pageid`. + var pageid: Swift.String? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - sitemap: sitemap name + /// - pageid: page id + init(sitemap: Swift.String? = nil, + pageid: Swift.String? = nil) { + self.sitemap = sitemap + self.pageid = pageid + } + } + + var query: Operations.getSitemapEvents_1.Input.Query + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.getSitemapEvents_1.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + init(path: Operations.getSitemapEvents_1.Input.Path, + query: Operations.getSitemapEvents_1.Input.Query = .init(), + headers: Operations.getSitemapEvents_1.Input.Headers = .init()) { + self.path = path + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/responses/200/content/text\/event-stream`. + case text_event_hyphen_stream(OpenAPIRuntime.HTTPBody) + /// The associated value of the enum case if `self` is `.text_event_hyphen_stream`. + /// + /// - Throws: An error if `self` is not `.text_event_hyphen_stream`. + /// - SeeAlso: `.text_event_hyphen_stream`. + var text_event_hyphen_stream: OpenAPIRuntime.HTTPBody { + get throws { + switch self { + case let .text_event_hyphen_stream(body): + body + default: + try throwUnexpectedResponseBody( + expectedContent: "text/event-stream", + body: self + ) + } + } + } + + /// - Remark: Generated from `#/paths/sitemaps/events/{subscriptionid}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.SitemapWidgetEvent) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.SitemapWidgetEvent { + get throws { + switch self { + case let .json(body): + body + default: + try throwUnexpectedResponseBody( + expectedContent: "application/json", + body: self + ) + } + } + } + } + + /// Received HTTP response body + var body: Operations.getSitemapEvents_1.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getSitemapEvents_1.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getSitemapEvents_1.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getSitemapEvents_1.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct BadRequest: Sendable, Hashable { + /// Creates a new `BadRequest`. + init() {} + } + + /// Missing sitemap or page parameter, or page not linked successfully to the subscription. + /// + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.getSitemapEvents_1.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + var badRequest: Operations.getSitemapEvents_1.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Subscription not found. + /// + /// - Remark: Generated from `#/paths//sitemaps/events/{subscriptionid}/get(getSitemapEvents_1)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getSitemapEvents_1.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getSitemapEvents_1.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case text_event_hyphen_stream + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "text/event-stream": + self = .text_event_hyphen_stream + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .text_event_hyphen_stream: + "text/event-stream" + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .text_event_hyphen_stream, + .json + ] + } + } + } + + /// Get all available sitemaps. + /// + /// - Remark: HTTP `GET /sitemaps`. + /// - Remark: Generated from `#/paths//sitemaps/get(getSitemaps)`. + enum getSitemaps { + static let id: Swift.String = "getSitemaps" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/GET/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.getSitemaps.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + init(headers: Operations.getSitemaps.Input.Headers = .init()) { + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/sitemaps/GET/responses/200/content/application\/json`. + case json([Components.Schemas.SitemapDTO]) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: [Components.Schemas.SitemapDTO] { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getSitemaps.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getSitemaps.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//sitemaps/get(getSitemaps)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getSitemaps.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getSitemaps.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Get all registered UI components in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/get(getRegisteredUIComponentsInNamespace)`. + enum getRegisteredUIComponentsInNamespace { + static let id: Swift.String = "getRegisteredUIComponentsInNamespace" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/path`. + struct Path: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/path/namespace`. + var namespace: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - namespace: + init(namespace: Swift.String) { + self.namespace = namespace + } + } + + var path: Operations.getRegisteredUIComponentsInNamespace.Input.Path + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/query`. + struct Query: Sendable, Hashable { + /// summary fields only + /// + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/query/summary`. + var summary: Swift.Bool? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - summary: summary fields only + init(summary: Swift.Bool? = nil) { + self.summary = summary + } + } + + var query: Operations.getRegisteredUIComponentsInNamespace.Input.Query + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.getRegisteredUIComponentsInNamespace.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + init(path: Operations.getRegisteredUIComponentsInNamespace.Input.Path, + query: Operations.getRegisteredUIComponentsInNamespace.Input.Query = .init(), + headers: Operations.getRegisteredUIComponentsInNamespace.Input.Headers = .init()) { + self.path = path + self.query = query + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/GET/responses/200/content/application\/json`. + case json([Components.Schemas.RootUIComponent]) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: [Components.Schemas.RootUIComponent] { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getRegisteredUIComponentsInNamespace.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getRegisteredUIComponentsInNamespace.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/get(getRegisteredUIComponentsInNamespace)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getRegisteredUIComponentsInNamespace.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getRegisteredUIComponentsInNamespace.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Add a UI component in the specified namespace. + /// + /// - Remark: HTTP `POST /ui/components/{namespace}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/post(addUIComponentToNamespace)`. + enum addUIComponentToNamespace { + static let id: Swift.String = "addUIComponentToNamespace" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/path`. + struct Path: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/path/namespace`. + var namespace: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - namespace: + init(namespace: Swift.String) { + self.namespace = namespace + } + } + + var path: Operations.addUIComponentToNamespace.Input.Path + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.addUIComponentToNamespace.Input.Headers + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/requestBody/content/application\/json`. + case json(Components.Schemas.RootUIComponent) + } + + var body: Operations.addUIComponentToNamespace.Input.Body? + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + init(path: Operations.addUIComponentToNamespace.Input.Path, + headers: Operations.addUIComponentToNamespace.Input.Headers = .init(), + body: Operations.addUIComponentToNamespace.Input.Body? = nil) { + self.path = path + self.headers = headers + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/POST/responses/200/content/application\/json`. + case json(Components.Schemas.RootUIComponent) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.RootUIComponent { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.addUIComponentToNamespace.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.addUIComponentToNamespace.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/post(addUIComponentToNamespace)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.addUIComponentToNamespace.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.addUIComponentToNamespace.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Get a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `GET /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/get(getUIComponentInNamespace)`. + enum getUIComponentInNamespace { + static let id: Swift.String = "getUIComponentInNamespace" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/GET/path`. + struct Path: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/GET/path/namespace`. + var namespace: Swift.String + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/GET/path/componentUID`. + var componentUID: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - namespace: + /// - componentUID: + init(namespace: Swift.String, + componentUID: Swift.String) { + self.namespace = namespace + self.componentUID = componentUID + } + } + + var path: Operations.getUIComponentInNamespace.Input.Path + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/GET/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.getUIComponentInNamespace.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + init(path: Operations.getUIComponentInNamespace.Input.Path, + headers: Operations.getUIComponentInNamespace.Input.Headers = .init()) { + self.path = path + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.RootUIComponent) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.RootUIComponent { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getUIComponentInNamespace.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getUIComponentInNamespace.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/get(getUIComponentInNamespace)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getUIComponentInNamespace.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getUIComponentInNamespace.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Component not found + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/get(getUIComponentInNamespace)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.getUIComponentInNamespace.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.getUIComponentInNamespace.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Update a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `PUT /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/put(updateUIComponentInNamespace)`. + enum updateUIComponentInNamespace { + static let id: Swift.String = "updateUIComponentInNamespace" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/path`. + struct Path: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/path/namespace`. + var namespace: Swift.String + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/path/componentUID`. + var componentUID: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - namespace: + /// - componentUID: + init(namespace: Swift.String, + componentUID: Swift.String) { + self.namespace = namespace + self.componentUID = componentUID + } + } + + var path: Operations.updateUIComponentInNamespace.Input.Path + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.updateUIComponentInNamespace.Input.Headers + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/requestBody`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/requestBody/content/application\/json`. + case json(Components.Schemas.RootUIComponent) + } + + var body: Operations.updateUIComponentInNamespace.Input.Body? + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + init(path: Operations.updateUIComponentInNamespace.Input.Path, + headers: Operations.updateUIComponentInNamespace.Input.Headers = .init(), + body: Operations.updateUIComponentInNamespace.Input.Body? = nil) { + self.path = path + self.headers = headers + self.body = body + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.RootUIComponent) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: Components.Schemas.RootUIComponent { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.updateUIComponentInNamespace.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.updateUIComponentInNamespace.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/put(updateUIComponentInNamespace)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.updateUIComponentInNamespace.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.updateUIComponentInNamespace.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Component not found + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/put(updateUIComponentInNamespace)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.updateUIComponentInNamespace.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.updateUIComponentInNamespace.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } + + /// Remove a specific UI component in the specified namespace. + /// + /// - Remark: HTTP `DELETE /ui/components/{namespace}/{componentUID}`. + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/delete(removeUIComponentFromNamespace)`. + enum removeUIComponentFromNamespace { + static let id: Swift.String = "removeUIComponentFromNamespace" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/DELETE/path`. + struct Path: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/DELETE/path/namespace`. + var namespace: Swift.String + /// - Remark: Generated from `#/paths/ui/components/{namespace}/{componentUID}/DELETE/path/componentUID`. + var componentUID: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - namespace: + /// - componentUID: + init(namespace: Swift.String, + componentUID: Swift.String) { + self.namespace = namespace + self.componentUID = componentUID + } + } + + var path: Operations.removeUIComponentFromNamespace.Input.Path + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + init(path: Operations.removeUIComponentFromNamespace.Input.Path) { + self.path = path + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// Creates a new `Ok`. + init() {} + } + + /// OK + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/delete(removeUIComponentFromNamespace)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.removeUIComponentFromNamespace.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.removeUIComponentFromNamespace.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + struct NotFound: Sendable, Hashable { + /// Creates a new `NotFound`. + init() {} + } + + /// Component not found + /// + /// - Remark: Generated from `#/paths//ui/components/{namespace}/{componentUID}/delete(removeUIComponentFromNamespace)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.removeUIComponentFromNamespace.Output.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + var notFound: Operations.removeUIComponentFromNamespace.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + } + + /// Get all registered UI tiles. + /// + /// - Remark: HTTP `GET /ui/tiles`. + /// - Remark: Generated from `#/paths//ui/tiles/get(getUITiles)`. + enum getUITiles { + static let id: Swift.String = "getUITiles" + struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/tiles/GET/header`. + struct Headers: Sendable, Hashable { + var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + + var headers: Operations.getUITiles.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - headers: + init(headers: Operations.getUITiles.Input.Headers = .init()) { + self.headers = headers + } + } + + enum Output: Sendable, Hashable { + struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/tiles/GET/responses/200/content`. + enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/ui/tiles/GET/responses/200/content/application\/json`. + case json([Components.Schemas.TileDTO]) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + var json: [Components.Schemas.TileDTO] { + get throws { + switch self { + case let .json(body): + body + } + } + } + } + + /// Received HTTP response body + var body: Operations.getUITiles.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + init(body: Operations.getUITiles.Output.Ok.Body) { + self.body = body + } + } + + /// OK + /// + /// - Remark: Generated from `#/paths//ui/tiles/get(getUITiles)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.getUITiles.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + var ok: Operations.getUITiles.Output.Ok { + get throws { + switch self { + case let .ok(response): + response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + + enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + + var rawValue: Swift.String { + switch self { + case let .other(string): + string + case .json: + "application/json" + } + } + + static var allCases: [Self] { + [ + .json + ] + } + } + } +} diff --git a/OpenHABCore/Sources/OpenHABCore/Model/APIActor.swift b/OpenHABCore/Sources/OpenHABCore/Model/APIActor.swift index b0b70859..f1433b84 100644 --- a/OpenHABCore/Sources/OpenHABCore/Model/APIActor.swift +++ b/OpenHABCore/Sources/OpenHABCore/Model/APIActor.swift @@ -9,20 +9,12 @@ // // SPDX-License-Identifier: EPL-2.0 -// -// File.swift -// -// -// Created by Tim on 10.08.24. -// import Foundation import HTTPTypes import OpenAPIRuntime import OpenAPIURLSession import os -let logger = Logger(subsystem: "org.openhab.app", category: "apiactor") - public protocol OpenHABSitemapsService { func openHABSitemaps() async throws -> [OpenHABSitemap] } @@ -41,8 +33,9 @@ public actor APIActor { var username: String var password: String - public init(username: String = "", password: String = "", alwaysSendBasicAuth: Bool = true) { - let url = "about:blank" + private let logger = Logger(subsystem: "org.openhab.app", category: "apiactor") + + public init(username: String = "", password: String = "", alwaysSendBasicAuth: Bool = true, url: URL = URL(staticString: "about:blank")) async { // TODO: Make use of prepareURLSessionConfiguration let config = URLSessionConfiguration.default // config.timeoutIntervalForRequest = if longPolling { 35.0 } else { 20.0 } @@ -51,11 +44,15 @@ public actor APIActor { self.username = username self.password = password self.alwaysSendBasicAuth = alwaysSendBasicAuth + self.url = url api = Client( - serverURL: URL(string: url)!, + serverURL: url.appending(path: "/rest"), transport: URLSessionTransport(configuration: .init(session: session)), - middlewares: [AuthorisationMiddleware(username: username, password: password, alwaysSendBasicAuth: alwaysSendBasicAuth)] + middlewares: [ + AuthorisationMiddleware(username: username, password: password, alwaysSendBasicAuth: alwaysSendBasicAuth), + LoggingMiddleware() + ] ) } @@ -74,7 +71,10 @@ public actor APIActor { api = Client( serverURL: newURL.appending(path: "/rest"), transport: URLSessionTransport(configuration: .init(session: session)), - middlewares: [AuthorisationMiddleware(username: username, password: password)] + middlewares: [ + AuthorisationMiddleware(username: username, password: password), + LoggingMiddleware() + ] ) } } @@ -88,17 +88,27 @@ public actor APIActor { api = Client( serverURL: url!.appending(path: "/rest"), transport: URLSessionTransport(configuration: .init(session: session)), - middlewares: [AuthorisationMiddleware(username: username, password: password)] + middlewares: [ + AuthorisationMiddleware(username: username, password: password), + LoggingMiddleware() + ] ) } } } +public enum APIActorError: Error { + case undocumented +} + extension APIActor: OpenHABSitemapsService { public func openHABSitemaps() async throws -> [OpenHABSitemap] { - try await api.getSitemaps(.init()) - .ok.body.json - .map(OpenHABSitemap.init) + // swiftformat:disable:next redundantSelf + logger.log("Trying to getSitemaps for : \(self.url?.debugDescription ?? "No URL")") + switch try await api.getSitemaps(.init()) { + case let .ok(okresponse): return try okresponse.body.json.map(OpenHABSitemap.init) + case .undocumented: throw APIActorError.undocumented + } } } @@ -110,19 +120,65 @@ extension APIActor: OpenHABUiTileService { } } -extension APIActor { - func openHABSitemap(path: Operations.getSitemapByName.Input.Path) async throws -> OpenHABSitemap? { - let result = try await api.getSitemapByName(path: path) - .ok.body.json - return OpenHABSitemap(result) +public extension AsyncThrowingStream { +// func map(_ transform: @escaping (Self.Element) -> Transformed) -> AsyncThrowingStream { +// AsyncThrowingStream { continuation in +// Task { +// for try await element in self { +// continuation.yield(transform(element)) +// } +// continuation.finish() +// } +// } +// } + + func map2(transform: @escaping (Self.Element) -> T) -> AsyncThrowingStream { + AsyncThrowingStream { continuation in + let task = Task { + for try await element in self { + continuation.yield(transform(element)) + } + continuation.finish() + } + continuation.onTermination = { _ in task.cancel() } + } + } +} + +public extension APIActor { + func openHABcreateSubscription() async throws -> String? { + logger.info("Creating subscription") + let result = try await api.createSitemapEventSubscription() + guard let urlString = try result.ok.body.json.context?.headers?.Location?.first else { return nil } + return URL(string: urlString)?.lastPathComponent + } + + func openHABSitemapWidgetEvents(subscriptionid: String, sitemap: String) async throws -> String { +// AsyncThrowingStream { + let path = Operations.getSitemapEvents_1.Input.Path(subscriptionid: subscriptionid) + let query = Operations.getSitemapEvents_1.Input.Query(sitemap: sitemap, pageid: sitemap) + let stream = try await api.getSitemapEvents_1(path: path, query: query).ok.body.text_event_hyphen_stream.asDecodedServerSentEventsWithJSONData(of: Components.Schemas.SitemapWidgetEvent.self).compactMap { (value) -> OpenHABSitemapWidgetEvent? in + guard let data = value.data else { return nil } + return OpenHABSitemapWidgetEvent(data) + } +// return stream.map2 + + for try await line in stream { + print(line) + print("\n") + } + return "" + + logger.debug("subscription date received") } } extension APIActor { // Internal function for pollPage func openHABpollPage(path: Operations.pollDataForPage.Input.Path, + query: Operations.pollDataForPage.Input.Query = .init(), headers: Operations.pollDataForPage.Input.Headers) async throws -> OpenHABPage? { - let result = try await api.pollDataForPage(path: path, headers: headers) + let result = try await api.pollDataForPage(path: path, query: query, headers: headers) .ok.body.json return OpenHABPage(result) } @@ -133,7 +189,6 @@ extension APIActor { /// - longPolling: set to true for long-polling public func openHABpollPage(sitemapname: String, longPolling: Bool) async throws -> OpenHABPage? { var headers = Operations.pollDataForPage.Input.Headers() - if longPolling { logger.info("Long-polling, setting X-Atmosphere-Transport") headers.X_hyphen_Atmosphere_hyphen_Transport = "long-polling" @@ -144,15 +199,29 @@ extension APIActor { await updateForLongPolling(longPolling) return try await openHABpollPage(path: path, headers: headers) } -} -extension APIActor { - func openHABSitemap(path: Operations.getSitemapByName.Input.Path, - headers: Operations.getSitemapByName.Input.Headers) async throws -> OpenHABSitemap? { - let result = try await api.getSitemapByName(path: path, headers: headers) + // Internal function for pollSitemap + func openHABpollSitemap(path: Operations.pollDataForSitemap.Input.Path, + query: Operations.pollDataForSitemap.Input.Query = .init(), + headers: Operations.pollDataForSitemap.Input.Headers) async throws -> OpenHABSitemap? { + let result = try await api.pollDataForSitemap(path: path, query: query, headers: headers) .ok.body.json return OpenHABSitemap(result) } + + public func openHABpollSitemap(sitemapname: String, longPolling: Bool, subscriptionId: String? = nil) async throws -> OpenHABSitemap? { + var headers = Operations.pollDataForSitemap.Input.Headers() + if longPolling { + logger.info("Long-polling, setting X-Atmosphere-Transport") + headers.X_hyphen_Atmosphere_hyphen_Transport = "long-polling" + } else { + headers.X_hyphen_Atmosphere_hyphen_Transport = nil + } + let query = Operations.pollDataForSitemap.Input.Query(subscriptionid: subscriptionId) + let path = Operations.pollDataForSitemap.Input.Path(sitemapname: sitemapname) + await updateForLongPolling(longPolling) + return try await openHABpollSitemap(path: path, query: query, headers: headers) + } } // MARK: State changes and commands @@ -173,6 +242,44 @@ public extension APIActor { } } +class OpenHABSitemapWidgetEvent { + init(sitemapName: String? = nil, pageId: String? = nil, widgetId: String? = nil, label: String? = nil, labelSource: String? = nil, icon: String? = nil, reloadIcon: Bool? = nil, labelcolor: String? = nil, valuecolor: String? = nil, iconcolor: String? = nil, visibility: Bool? = nil, state: String? = nil, enrichedItem: OpenHABItem? = nil, descriptionChanged: Bool? = nil) { + self.sitemapName = sitemapName + self.pageId = pageId + self.widgetId = widgetId + self.label = label + self.labelSource = labelSource + self.icon = icon + self.reloadIcon = reloadIcon + self.labelcolor = labelcolor + self.valuecolor = valuecolor + self.iconcolor = iconcolor + self.visibility = visibility + self.state = state + self.enrichedItem = enrichedItem + self.descriptionChanged = descriptionChanged + } + + convenience init(_ event: Components.Schemas.SitemapWidgetEvent) { + self.init(sitemapName: event.sitemapName, pageId: event.pageId, widgetId: event.widgetId, label: event.label, labelSource: event.labelSource, icon: event.icon, reloadIcon: event.reloadIcon, labelcolor: event.labelcolor, valuecolor: event.valuecolor, iconcolor: event.iconcolor, visibility: event.visibility, state: event.state, enrichedItem: OpenHABItem(event.item), descriptionChanged: event.descriptionChanged) + } + + var sitemapName: String? + var pageId: String? + var widgetId: String? + var label: String? + var labelSource: String? + var icon: String? + var reloadIcon: Bool? + var labelcolor: String? + var valuecolor: String? + var iconcolor: String? + var visibility: Bool? + var state: String? + var enrichedItem: OpenHABItem? + var descriptionChanged: Bool? +} + public struct AuthorisationMiddleware { private let username: String private let password: String @@ -199,12 +306,10 @@ extension AuthorisationMiddleware: ClientMiddleware { // Use a mutable copy of request var request = request - if ((baseURL.host?.hasSuffix("myopenhab.org")) == nil), alwaysSendBasicAuth, !username.isEmpty, !password.isEmpty { + if baseURL.host?.hasSuffix("myopenhab.org") == nil, alwaysSendBasicAuth, !username.isEmpty, !password.isEmpty { request.headerFields[.authorization] = basicAuthHeader() } - logger.info("Outgoing request: \(request.headerFields.debugDescription, privacy: .public)") let (response, body) = try await next(request, body, baseURL) - logger.debug("Incoming response \(response.headerFields.debugDescription)") return (response, body) } } diff --git a/OpenHABCore/Sources/OpenHABCore/Model/LoggingMiddleware.swift b/OpenHABCore/Sources/OpenHABCore/Model/LoggingMiddleware.swift new file mode 100644 index 00000000..cc4f12e8 --- /dev/null +++ b/OpenHABCore/Sources/OpenHABCore/Model/LoggingMiddleware.swift @@ -0,0 +1,115 @@ +// Copyright (c) 2010-2024 Contributors to the openHAB project +// +// See the NOTICE file(s) distributed with this work for additional +// information. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0 +// +// SPDX-License-Identifier: EPL-2.0 + +import Foundation +import HTTPTypes +import OpenAPIRuntime +import os + +// swiftlint:disable file_types_order +package actor LoggingMiddleware { + private static var defaultLogger: Logger { + Logger(subsystem: "org.openhab.app", category: "logging-middleware") + } + + private let logger: Logger + package let bodyLoggingPolicy: BodyLoggingPolicy + + package init(logger: Logger = defaultLogger, bodyLoggingConfiguration: BodyLoggingPolicy = .never) { + self.logger = logger + bodyLoggingPolicy = bodyLoggingConfiguration + } +} + +extension LoggingMiddleware: ClientMiddleware { + package func intercept(_ request: HTTPRequest, + body: HTTPBody?, + baseURL: URL, + operationID: String, + next: @Sendable (HTTPRequest, HTTPBody?, URL) async throws -> (HTTPResponse, HTTPBody?)) async throws -> (HTTPResponse, HTTPBody?) { + let (requestBodyToLog, requestBodyForNext) = try await bodyLoggingPolicy.process(body) + log(request, requestBodyToLog) + do { + let (response, responseBody) = try await next(request, requestBodyForNext, baseURL) + let (responseBodyToLog, responseBodyForNext) = try await bodyLoggingPolicy.process(responseBody) + log(request, response, responseBodyToLog) + return (response, responseBodyForNext) + } catch { + log(request, failedWith: error) + throw error + } + } +} + +extension LoggingMiddleware { + func log(_ request: HTTPRequest, _ requestBody: BodyLoggingPolicy.BodyLog) { + logger.debug( + "Request: \(request.method, privacy: .public) \(request.path ?? "", privacy: .public) body: \(requestBody, privacy: .auto)" + ) + } + + func log(_ request: HTTPRequest, _ response: HTTPResponse, _ responseBody: BodyLoggingPolicy.BodyLog) { + logger.debug( + "Response: \(request.method, privacy: .public) \(request.path ?? "", privacy: .public) \(response.status, privacy: .public) body: \(responseBody, privacy: .auto)" + ) + } + + func log(_ request: HTTPRequest, failedWith error: any Error) { + logger.warning("Request failed. Error: \(error.localizedDescription)") + } +} + +// swiftlint:enable file_types_order + +package enum BodyLoggingPolicy { + /// Never log request or response bodies. + case never + /// Log request and response bodies that have a known length less than or equal to `maxBytes`. + case upTo(maxBytes: Int) + + enum BodyLog: Equatable, CustomStringConvertible { + /// There is no body to log. + case none + /// The policy forbids logging the body. + case redacted + /// The body was of unknown length. + case unknownLength + /// The body exceeds the maximum size for logging allowed by the policy. + case tooManyBytesToLog(Int64) + /// The body can be logged. + case complete(Data) + + var description: String { + switch self { + case .none: return "" + case .redacted: return "" + case .unknownLength: return "" + case let .tooManyBytesToLog(byteCount): return "<\(byteCount) bytes>" + case let .complete(data): + if let string = String(data: data, encoding: .utf8) { return string } + return String(describing: data) + } + } + } + + func process(_ body: HTTPBody?) async throws -> (bodyToLog: BodyLog, bodyForNext: HTTPBody?) { + switch (body?.length, self) { + case (.none, _): return (.none, body) + case (_, .never): return (.redacted, body) + case (.unknown, _): return (.unknownLength, body) + case let (.known(length), .upTo(maxBytesToLog)) where length > maxBytesToLog: + return (.tooManyBytesToLog(length), body) + case let (.known, .upTo(maxBytesToLog)): + let bodyData = try await Data(collecting: body!, upTo: maxBytesToLog) + return (.complete(bodyData), HTTPBody(bodyData)) + } + } +} diff --git a/OpenHABCore/Sources/OpenHABCore/Model/OpenHABItem.swift b/OpenHABCore/Sources/OpenHABCore/Model/OpenHABItem.swift index 9c2e97ad..aab719bf 100644 --- a/OpenHABCore/Sources/OpenHABCore/Model/OpenHABItem.swift +++ b/OpenHABCore/Sources/OpenHABCore/Model/OpenHABItem.swift @@ -13,7 +13,7 @@ import CoreLocation import os.log import UIKit -public final class OpenHABItem: NSObject, CommItem { +public class OpenHABItem: NSObject, CommItem { public enum ItemType: String { case color = "Color" case contact = "Contact" diff --git a/OpenHABCore/Sources/OpenHABCore/openapi/openapi.json b/OpenHABCore/Sources/OpenHABCore/openapi/openapi.json index facdf003..d34f3343 100644 --- a/OpenHABCore/Sources/OpenHABCore/openapi/openapi.json +++ b/OpenHABCore/Sources/OpenHABCore/openapi/openapi.json @@ -5501,7 +5501,17 @@ "operationId": "createSitemapEventSubscription", "responses": { "201": { - "description": "Subscription created." + "description": "Subscription created.", + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/JerseyResponseBuilderDTO" + } + } + } }, "503": { "description": "Subscriptions limit reached." @@ -5606,6 +5616,14 @@ "type": "string" } }, + { + "name": "X-Atmosphere-Transport", + "in": "header", + "description": "X-Atmosphere-Transport for long polling", + "schema": { + "type": "string" + } + }, { "name": "sitemapname", "in": "path", @@ -5794,7 +5812,15 @@ ], "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "text/event-stream": {}, + "application/json": { + "schema": { + "$ref": "#/components/schemas/SitemapWidgetEvent" + } + } + } }, "400": { "description": "Missing sitemap or page parameter, or page not linked successfully to the subscription." @@ -9001,6 +9027,36 @@ } } }, + "JerseyResponseBuilderDTO": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "context": { + "$ref": "#/components/schemas/ContextDTO" + } + } + }, + "ContextDTO": { + "type": "object", + "properties": { + "headers": { + "$ref": "#/components/schemas/HeadersDTO" + } + } + }, + "HeadersDTO": { + "type": "object", + "properties": { + "Location": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "ChannelDefinitionDTO": { "type": "object", "properties": { @@ -9450,6 +9506,53 @@ } } }, + "SitemapWidgetEvent": { + "type": "object", + "properties": { + "widgetId": { + "type": "string" + }, + "label": { + "type": "string" + }, + "labelSource": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "labelcolor": { + "type": "string" + }, + "valuecolor": { + "type": "string" + }, + "iconcolor": { + "type": "string" + }, + "state": { + "type": "string" + }, + "reloadIcon": { + "type": "boolean" + }, + "visibility": { + "type": "boolean" + }, + "descriptionChanged": { + "type": "boolean" + }, + "item": { + "$ref": "#/components/schemas/EnrichedItemDTO" + }, + "sitemapName": { + "type": "string" + }, + "pageId": { + "type": "string" + } + } + }, "SitemapDTO": { "type": "object", "properties": { diff --git a/openHAB/OpenHABDrawerTableViewController.swift b/openHAB/OpenHABDrawerTableViewController.swift index cbe48ed7..ee009bf8 100644 --- a/openHAB/OpenHABDrawerTableViewController.swift +++ b/openHAB/OpenHABDrawerTableViewController.swift @@ -16,6 +16,8 @@ import os.log import SafariServices import UIKit +let logger = Logger(subsystem: "org.openhab.app", category: "OpenHABDrawerTableViewController") + struct UiTile: Decodable { var name: String var url: String @@ -37,17 +39,7 @@ class OpenHABDrawerTableViewController: UITableViewController { AppDelegate.appDelegate.appData } - private let apiactor: APIActor - - init() { - apiactor = APIActor() - super.init(nibName: nil, bundle: nil) - } - - required init?(coder aDecoder: NSCoder) { - apiactor = APIActor() - super.init(coder: aDecoder) - } + private var apiactor: APIActor? override func viewDidLoad() { super.viewDidLoad() @@ -65,9 +57,8 @@ class OpenHABDrawerTableViewController: UITableViewController { Task { do { - await apiactor.updateBaseURL(with: URL(string: appData?.openHABRootUrl ?? "")!) - - sitemaps = try await apiactor.openHABSitemaps() + apiactor = await APIActor(username: appData!.openHABUsername, password: appData!.openHABPassword, alwaysSendBasicAuth: appData!.openHABAlwaysSendCreds, url: URL(string: appData?.openHABRootUrl ?? "")!) + sitemaps = try await apiactor?.openHABSitemaps() ?? [] if sitemaps.last?.name == "_default", sitemaps.count > 1 { sitemaps = Array(sitemaps.dropLast()) } @@ -81,7 +72,7 @@ class OpenHABDrawerTableViewController: UITableViewController { self.setStandardDrawerItems() self.tableView.reloadData() } catch { - os_log("%{PUBLIC}@", log: .default, type: .error, error.localizedDescription) + os_log("Error %{PUBLIC}@", log: .default, type: .error, error.localizedDescription) self.drawerItems.removeAll() self.setStandardDrawerItems() self.tableView.reloadData() @@ -90,8 +81,8 @@ class OpenHABDrawerTableViewController: UITableViewController { Task { do { - await apiactor.updateBaseURL(with: URL(string: appData?.openHABRootUrl ?? "")!) - uiTiles = try await apiactor.openHABTiles() + await apiactor = APIActor(username: appData!.openHABUsername, password: appData!.openHABPassword, alwaysSendBasicAuth: appData!.openHABAlwaysSendCreds, url: URL(string: appData?.openHABRootUrl ?? "")!) + uiTiles = try await apiactor?.openHABTiles() ?? [] os_log("ui tiles response", log: .viewCycle, type: .info) self.tableView.reloadData() } catch { diff --git a/openHAB/OpenHABSitemapViewController.swift b/openHAB/OpenHABSitemapViewController.swift index 9b01fb65..7ff07ff6 100644 --- a/openHAB/OpenHABSitemapViewController.swift +++ b/openHAB/OpenHABSitemapViewController.swift @@ -112,7 +112,7 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel search.isActive && !searchBarIsEmpty } - private let apiactor = APIActor() + private var apiactor: APIActor? @IBOutlet private var widgetTableView: UITableView! @@ -124,6 +124,7 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel pageNetworkStatus = nil sitemaps = [] widgetTableView.tableFooterView = UIView() + Task { await apiactor = APIActor(username: openHABUsername, password: openHABPassword, alwaysSendBasicAuth: openHABAlwaysSendCreds, url: URL(string: openHABRootUrl) ?? URL(staticString: "about:blank")) } registerTableViewCells() configureTableView() @@ -182,7 +183,7 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel OpenHABTracker.shared.multicastDelegate.add(self) OpenHABTracker.shared.restart() } else { - Task { await apiactor.updateBaseURL(with: URL(string: appData!.openHABRootUrl)!) } + Task { await apiactor?.updateBaseURL(with: URL(string: appData!.openHABRootUrl)!) } if !pageNetworkStatusChanged() { os_log("OpenHABSitemapViewController pageUrl = %{PUBLIC}@", log: .notifications, type: .info, pageUrl) loadPage(false) @@ -330,9 +331,14 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel } asyncOperation = Task { do { - await apiactor.updateBaseURL(with: URL(string: appData?.openHABRootUrl ?? "")!) + await apiactor?.updateBaseURL(with: URL(string: appData?.openHABRootUrl ?? "")!) - currentPage = try await apiactor.openHABpollPage(sitemapname: defaultSitemap, longPolling: longPolling) +// if let subscriptionid = try await apiactor?.openHABcreateSubscription() { +// let sitemap = try await apiactor?.openHABpollSitemap(sitemapname: defaultSitemap, longPolling: longPolling, subscriptionId: subscriptionid) +// try await apiactor?.openHABSitemapWidgetEvents(subscriptionid: subscriptionid, sitemap: defaultSitemap) +// } + + currentPage = try await apiactor?.openHABpollPage(sitemapname: defaultSitemap, longPolling: longPolling) if isFiltering { filterContentForSearchText(search.searchBar.text) @@ -379,9 +385,9 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel func selectSitemap() { Task { do { - await apiactor.updateBaseURL(with: URL(string: appData?.openHABRootUrl ?? "")!) - - sitemaps = try await apiactor.openHABSitemaps() + logger.debug("Running selectSitemap for URL: \(self.appData?.openHABRootUrl ?? "")") + apiactor = await APIActor(username: appData!.openHABUsername, password: appData!.openHABPassword, alwaysSendBasicAuth: appData!.openHABAlwaysSendCreds, url: URL(string: appData?.openHABRootUrl ?? "")!) + sitemaps = try await apiactor?.openHABSitemaps() ?? [] switch sitemaps.count { case 2...: @@ -407,6 +413,8 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel default: break } widgetTableView.reloadData() + } catch let error as APIActorError { + logger.debug("APIActorError on OpenHABSitemapViewController") } catch { os_log("%{PUBLIC}@", log: .default, type: .error, error.localizedDescription) DispatchQueue.main.async { @@ -491,11 +499,12 @@ class OpenHABSitemapViewController: OpenHABViewController, GenericUITableViewCel } func sendCommand(itemname: String, command: String) { - Task { try await apiactor.openHABSendItemCommand(itemname: itemname, command: command) } + Task { try await apiactor?.openHABSendItemCommand(itemname: itemname, command: command) } } override func reloadView() { defaultSitemap = Preferences.defaultSitemap + logger.debug("Reload view") selectSitemap() } diff --git a/openHAB/OpenHABWebViewController.swift b/openHAB/OpenHABWebViewController.swift index e0cbb224..e68e0616 100644 --- a/openHAB/OpenHABWebViewController.swift +++ b/openHAB/OpenHABWebViewController.swift @@ -13,7 +13,6 @@ import OpenHABCore import os.log import SafariServices import SideMenu -import SwiftMessages import UIKit import WebKit